Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-markdownlint / lib / index.js
1 (function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
2 /******/        // The module cache
3 /******/        var installedModules = {};
4 /******/
5 /******/        // The require function
6 /******/        function __webpack_require__(moduleId) {
7 /******/
8 /******/                // Check if module is in cache
9 /******/                if(installedModules[moduleId]) {
10 /******/                        return installedModules[moduleId].exports;
11 /******/                }
12 /******/                // Create a new module (and put it into the cache)
13 /******/                var module = installedModules[moduleId] = {
14 /******/                        i: moduleId,
15 /******/                        l: false,
16 /******/                        exports: {}
17 /******/                };
18 /******/
19 /******/                // Execute the module function
20 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21 /******/
22 /******/                // Flag the module as loaded
23 /******/                module.l = true;
24 /******/
25 /******/                // Return the exports of the module
26 /******/                return module.exports;
27 /******/        }
28 /******/
29 /******/
30 /******/        // expose the modules object (__webpack_modules__)
31 /******/        __webpack_require__.m = modules;
32 /******/
33 /******/        // expose the module cache
34 /******/        __webpack_require__.c = installedModules;
35 /******/
36 /******/        // define getter function for harmony exports
37 /******/        __webpack_require__.d = function(exports, name, getter) {
38 /******/                if(!__webpack_require__.o(exports, name)) {
39 /******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
40 /******/                }
41 /******/        };
42 /******/
43 /******/        // define __esModule on exports
44 /******/        __webpack_require__.r = function(exports) {
45 /******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46 /******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47 /******/                }
48 /******/                Object.defineProperty(exports, '__esModule', { value: true });
49 /******/        };
50 /******/
51 /******/        // create a fake namespace object
52 /******/        // mode & 1: value is a module id, require it
53 /******/        // mode & 2: merge all properties of value into the ns
54 /******/        // mode & 4: return value when already ns object
55 /******/        // mode & 8|1: behave like require
56 /******/        __webpack_require__.t = function(value, mode) {
57 /******/                if(mode & 1) value = __webpack_require__(value);
58 /******/                if(mode & 8) return value;
59 /******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60 /******/                var ns = Object.create(null);
61 /******/                __webpack_require__.r(ns);
62 /******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63 /******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64 /******/                return ns;
65 /******/        };
66 /******/
67 /******/        // getDefaultExport function for compatibility with non-harmony modules
68 /******/        __webpack_require__.n = function(module) {
69 /******/                var getter = module && module.__esModule ?
70 /******/                        function getDefault() { return module['default']; } :
71 /******/                        function getModuleExports() { return module; };
72 /******/                __webpack_require__.d(getter, 'a', getter);
73 /******/                return getter;
74 /******/        };
75 /******/
76 /******/        // Object.prototype.hasOwnProperty.call
77 /******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78 /******/
79 /******/        // __webpack_public_path__
80 /******/        __webpack_require__.p = "";
81 /******/
82 /******/
83 /******/        // Load entry module and return exports
84 /******/        return __webpack_require__(__webpack_require__.s = 0);
85 /******/ })
86 /************************************************************************/
87 /******/ ([
88 /* 0 */
89 /***/ (function(module, exports, __webpack_require__) {
90
91 "use strict";
92
93 Object.defineProperty(exports, "__esModule", { value: true });
94 exports.activate = void 0;
95 const coc_nvim_1 = __webpack_require__(1);
96 const engine_1 = __webpack_require__(2);
97 const documentSelector = [
98     {
99         language: 'markdown',
100         scheme: 'file'
101     },
102     {
103         language: 'markdown',
104         scheme: 'untitled'
105     }
106 ];
107 let documentVersion = 0;
108 const engine = new engine_1.MarkdownlintEngine();
109 const config = coc_nvim_1.workspace.getConfiguration('markdownlint');
110 function didOpenTextDocument(document) {
111     if (config.get('onOpen', true)) {
112         engine.lint(document);
113     }
114 }
115 async function didChangeTextDocument(params) {
116     if (!config.get('onChange', true)) {
117         return;
118     }
119     if (params.textDocument.version && documentVersion !== params.textDocument.version) {
120         documentVersion = params.textDocument.version;
121         const { document } = await coc_nvim_1.workspace.getCurrentState();
122         engine.lint(document);
123     }
124 }
125 async function didSaveTextDocument(document) {
126     if (config.get('onSave', true)) {
127         engine.lint(document);
128     }
129 }
130 async function activate(context) {
131     await engine.parseConfig();
132     context.subscriptions.push(coc_nvim_1.languages.registerCodeActionProvider(documentSelector, engine, 'markdownlint'), coc_nvim_1.commands.registerCommand(engine.fixAllCommandName, async () => {
133         const { document } = await coc_nvim_1.workspace.getCurrentState();
134         engine.fixAll(document);
135     }), coc_nvim_1.workspace.onDidOpenTextDocument(didOpenTextDocument), coc_nvim_1.workspace.onDidChangeTextDocument(didChangeTextDocument), coc_nvim_1.workspace.onDidSaveTextDocument(didSaveTextDocument), coc_nvim_1.events.on('BufEnter', bufnr => {
136         if (!bufnr) {
137             return;
138         }
139         const doc = coc_nvim_1.workspace.getDocument(bufnr);
140         if (!doc) {
141             return;
142         }
143         didOpenTextDocument(doc.textDocument);
144     }));
145     coc_nvim_1.workspace.documents.map((doc) => {
146         didOpenTextDocument(doc.textDocument);
147     });
148 }
149 exports.activate = activate;
150
151
152 /***/ }),
153 /* 1 */
154 /***/ (function(module, exports) {
155
156 module.exports = require("coc.nvim");
157
158 /***/ }),
159 /* 2 */
160 /***/ (function(module, exports, __webpack_require__) {
161
162 "use strict";
163
164 var __importDefault = (this && this.__importDefault) || function (mod) {
165     return (mod && mod.__esModule) ? mod : { "default": mod };
166 };
167 Object.defineProperty(exports, "__esModule", { value: true });
168 exports.MarkdownlintEngine = void 0;
169 const coc_nvim_1 = __webpack_require__(1);
170 const deep_extend_1 = __importDefault(__webpack_require__(3));
171 const fs_1 = __importDefault(__webpack_require__(4));
172 const js_yaml_1 = __importDefault(__webpack_require__(5));
173 const markdownlint_1 = __importDefault(__webpack_require__(37));
174 const markdownlint_rule_helpers_1 = __webpack_require__(156);
175 const path_1 = __importDefault(__webpack_require__(38));
176 const rc_1 = __importDefault(__webpack_require__(157));
177 const vscode_languageserver_protocol_1 = __webpack_require__(162);
178 const projectConfigFiles = ['.markdownlint.json', '.markdownlint.yaml', '.markdownlint.yml'];
179 const configFileParsers = [JSON.parse, js_yaml_1.default.safeLoad];
180 class MarkdownlintEngine {
181     constructor() {
182         this.fixAllCommandName = 'markdownlint.fixAll';
183         this.source = 'markdownlint';
184         this.outputChannel = coc_nvim_1.workspace.createOutputChannel(this.source);
185         this.diagnosticCollection = coc_nvim_1.languages.createDiagnosticCollection(this.source);
186         this.config = {};
187     }
188     outputLine(message) {
189         if (this.outputChannel) {
190             this.outputChannel.appendLine(`[${new Date().toLocaleTimeString()}] ${message}`);
191         }
192     }
193     async parseConfig() {
194         try {
195             this.config = rc_1.default(this.source, {});
196             this.outputLine(`Info: global config: ${JSON.stringify(rc_1.default(this.source, {}))}`);
197         }
198         catch (e) {
199             this.outputLine(`Error: global config parse failed: ${e}`);
200         }
201         try {
202             const preferences = coc_nvim_1.workspace.getConfiguration('coc.preferences');
203             const rootFolder = await coc_nvim_1.workspace.resolveRootFolder(coc_nvim_1.Uri.parse(coc_nvim_1.workspace.uri), preferences.get('rootPatterns', []));
204             for (const projectConfigFile of projectConfigFiles) {
205                 const fullPath = path_1.default.join(rootFolder, projectConfigFile);
206                 if (fs_1.default.existsSync(fullPath)) {
207                     // @ts-ignore
208                     const projectConfig = markdownlint_1.default.readConfigSync(fullPath, configFileParsers);
209                     this.config = deep_extend_1.default(this.config, projectConfig);
210                     this.outputLine(`Info: local config: ${fullPath}, ${JSON.stringify(projectConfig)}`);
211                     break;
212                 }
213             }
214         }
215         catch (e) {
216             this.outputLine(`Error: local config parse failed: ${e}`);
217         }
218         const cocConfig = coc_nvim_1.workspace.getConfiguration('markdownlint').get('config');
219         if (cocConfig) {
220             this.config = deep_extend_1.default(this.config, cocConfig);
221             this.outputLine(`Info: config from coc-settings.json: ${JSON.stringify(cocConfig)}`);
222         }
223         this.outputLine(`Info: full config: ${JSON.stringify(this.config)}`);
224     }
225     markdownlintWrapper(document) {
226         const options = {
227             resultVersion: 3,
228             config: this.config,
229             // customRules: customRules,
230             strings: {
231                 [document.uri]: document.getText()
232             }
233         };
234         let results = [];
235         try {
236             results = markdownlint_1.default.sync(options)[document.uri];
237         }
238         catch (e) {
239             this.outputLine(`Error: lint exception: ${e.stack}`);
240         }
241         return results;
242     }
243     async provideCodeActions(document, _range, context) {
244         const codeActions = [];
245         const fixInfoDiagnostics = [];
246         for (const diagnostic of context.diagnostics) {
247             // @ts-ignore
248             if (diagnostic.fixInfo) {
249                 // @ts-ignore
250                 const lineNumber = diagnostic.fixInfo.lineNumber - 1 || diagnostic.range.start.line;
251                 const line = await coc_nvim_1.workspace.getLine(document.uri, lineNumber);
252                 // @ts-ignore
253                 const newText = markdownlint_rule_helpers_1.applyFix(line, diagnostic.fixInfo, '\n');
254                 const edit = { changes: {} };
255                 if (typeof newText === 'string') {
256                     const range = vscode_languageserver_protocol_1.Range.create(lineNumber, 0, lineNumber, line.length);
257                     edit.changes[document.uri] = [vscode_languageserver_protocol_1.TextEdit.replace(range, newText)];
258                 }
259                 else {
260                     edit.changes[document.uri] = [vscode_languageserver_protocol_1.TextEdit.del(diagnostic.range)];
261                 }
262                 const title = `Fix: ${diagnostic.message.split(':')[0]}`;
263                 const action = {
264                     title,
265                     edit,
266                     diagnostics: [...context.diagnostics]
267                 };
268                 fixInfoDiagnostics.push(diagnostic);
269                 codeActions.push(action);
270             }
271         }
272         if (fixInfoDiagnostics.length) {
273             const title = 'Fix All error found by markdownlint';
274             const sourceFixAllAction = {
275                 title,
276                 kind: vscode_languageserver_protocol_1.CodeActionKind.SourceFixAll,
277                 diagnostics: fixInfoDiagnostics,
278                 command: {
279                     title,
280                     command: this.fixAllCommandName
281                 }
282             };
283             codeActions.push(sourceFixAllAction);
284         }
285         return codeActions;
286     }
287     lint(document) {
288         this.diagnosticCollection.clear();
289         if (document.languageId !== 'markdown') {
290             return;
291         }
292         const results = this.markdownlintWrapper(document);
293         if (!results.length) {
294             return;
295         }
296         const diagnostics = [];
297         results.forEach((result) => {
298             const ruleDescription = result.ruleDescription;
299             let message = result.ruleNames.join('/') + ': ' + ruleDescription;
300             if (result.errorDetail) {
301                 message += ' [' + result.errorDetail + ']';
302             }
303             const start = vscode_languageserver_protocol_1.Position.create(result.lineNumber - 1, 0);
304             const end = vscode_languageserver_protocol_1.Position.create(result.lineNumber - 1, 0);
305             if (result.errorRange) {
306                 start.character = result.errorRange[0] - 1;
307                 end.character = start.character + result.errorRange[1];
308             }
309             const range = vscode_languageserver_protocol_1.Range.create(start, end);
310             const diagnostic = vscode_languageserver_protocol_1.Diagnostic.create(range, message);
311             diagnostic.severity = vscode_languageserver_protocol_1.DiagnosticSeverity.Warning;
312             diagnostic.source = this.source;
313             // @ts-ignore
314             diagnostic.fixInfo = result.fixInfo;
315             diagnostics.push(diagnostic);
316         });
317         this.diagnosticCollection.set(document.uri, diagnostics);
318     }
319     async fixAll(document) {
320         const results = this.markdownlintWrapper(document);
321         if (!results.length) {
322             return;
323         }
324         const text = document.getText();
325         const fixedText = markdownlint_rule_helpers_1.applyFixes(text, results);
326         if (text != fixedText) {
327             const doc = coc_nvim_1.workspace.getDocument(document.uri);
328             const end = vscode_languageserver_protocol_1.Position.create(doc.lineCount - 1, doc.getline(doc.lineCount - 1).length);
329             const edit = {
330                 changes: {
331                     [document.uri]: [vscode_languageserver_protocol_1.TextEdit.replace(vscode_languageserver_protocol_1.Range.create(vscode_languageserver_protocol_1.Position.create(0, 0), end), fixedText)]
332                 }
333             };
334             await coc_nvim_1.workspace.applyEdit(edit);
335         }
336     }
337 }
338 exports.MarkdownlintEngine = MarkdownlintEngine;
339
340
341 /***/ }),
342 /* 3 */
343 /***/ (function(module, exports, __webpack_require__) {
344
345 "use strict";
346 /*!
347  * @description Recursive object extending
348  * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
349  * @license MIT
350  *
351  * The MIT License (MIT)
352  *
353  * Copyright (c) 2013-2018 Viacheslav Lotsmanov
354  *
355  * Permission is hereby granted, free of charge, to any person obtaining a copy of
356  * this software and associated documentation files (the "Software"), to deal in
357  * the Software without restriction, including without limitation the rights to
358  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
359  * the Software, and to permit persons to whom the Software is furnished to do so,
360  * subject to the following conditions:
361  *
362  * The above copyright notice and this permission notice shall be included in all
363  * copies or substantial portions of the Software.
364  *
365  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
366  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
367  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
368  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
369  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
370  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
371  */
372
373
374
375 function isSpecificValue(val) {
376         return (
377                 val instanceof Buffer
378                 || val instanceof Date
379                 || val instanceof RegExp
380         ) ? true : false;
381 }
382
383 function cloneSpecificValue(val) {
384         if (val instanceof Buffer) {
385                 var x = Buffer.alloc
386                         ? Buffer.alloc(val.length)
387                         : new Buffer(val.length);
388                 val.copy(x);
389                 return x;
390         } else if (val instanceof Date) {
391                 return new Date(val.getTime());
392         } else if (val instanceof RegExp) {
393                 return new RegExp(val);
394         } else {
395                 throw new Error('Unexpected situation');
396         }
397 }
398
399 /**
400  * Recursive cloning array.
401  */
402 function deepCloneArray(arr) {
403         var clone = [];
404         arr.forEach(function (item, index) {
405                 if (typeof item === 'object' && item !== null) {
406                         if (Array.isArray(item)) {
407                                 clone[index] = deepCloneArray(item);
408                         } else if (isSpecificValue(item)) {
409                                 clone[index] = cloneSpecificValue(item);
410                         } else {
411                                 clone[index] = deepExtend({}, item);
412                         }
413                 } else {
414                         clone[index] = item;
415                 }
416         });
417         return clone;
418 }
419
420 function safeGetProperty(object, property) {
421         return property === '__proto__' ? undefined : object[property];
422 }
423
424 /**
425  * Extening object that entered in first argument.
426  *
427  * Returns extended object or false if have no target object or incorrect type.
428  *
429  * If you wish to clone source object (without modify it), just use empty new
430  * object as first argument, like this:
431  *   deepExtend({}, yourObj_1, [yourObj_N]);
432  */
433 var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
434         if (arguments.length < 1 || typeof arguments[0] !== 'object') {
435                 return false;
436         }
437
438         if (arguments.length < 2) {
439                 return arguments[0];
440         }
441
442         var target = arguments[0];
443
444         // convert arguments to array and cut off target object
445         var args = Array.prototype.slice.call(arguments, 1);
446
447         var val, src, clone;
448
449         args.forEach(function (obj) {
450                 // skip argument if isn't an object, is null, or is an array
451                 if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
452                         return;
453                 }
454
455                 Object.keys(obj).forEach(function (key) {
456                         src = safeGetProperty(target, key); // source value
457                         val = safeGetProperty(obj, key); // new value
458
459                         // recursion prevention
460                         if (val === target) {
461                                 return;
462
463                         /**
464                          * if new value isn't object then just overwrite by new value
465                          * instead of extending.
466                          */
467                         } else if (typeof val !== 'object' || val === null) {
468                                 target[key] = val;
469                                 return;
470
471                         // just clone arrays (and recursive clone objects inside)
472                         } else if (Array.isArray(val)) {
473                                 target[key] = deepCloneArray(val);
474                                 return;
475
476                         // custom cloning and overwrite for specific objects
477                         } else if (isSpecificValue(val)) {
478                                 target[key] = cloneSpecificValue(val);
479                                 return;
480
481                         // overwrite by new value if source isn't object or array
482                         } else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
483                                 target[key] = deepExtend({}, val);
484                                 return;
485
486                         // source value and new value is objects both, extending...
487                         } else {
488                                 target[key] = deepExtend(src, val);
489                                 return;
490                         }
491                 });
492         });
493
494         return target;
495 };
496
497
498 /***/ }),
499 /* 4 */
500 /***/ (function(module, exports) {
501
502 module.exports = require("fs");
503
504 /***/ }),
505 /* 5 */
506 /***/ (function(module, exports, __webpack_require__) {
507
508 "use strict";
509
510
511
512 var yaml = __webpack_require__(6);
513
514
515 module.exports = yaml;
516
517
518 /***/ }),
519 /* 6 */
520 /***/ (function(module, exports, __webpack_require__) {
521
522 "use strict";
523
524
525
526 var loader = __webpack_require__(7);
527 var dumper = __webpack_require__(36);
528
529
530 function deprecated(name) {
531   return function () {
532     throw new Error('Function ' + name + ' is deprecated and cannot be used.');
533   };
534 }
535
536
537 module.exports.Type                = __webpack_require__(13);
538 module.exports.Schema              = __webpack_require__(12);
539 module.exports.FAILSAFE_SCHEMA     = __webpack_require__(16);
540 module.exports.JSON_SCHEMA         = __webpack_require__(15);
541 module.exports.CORE_SCHEMA         = __webpack_require__(14);
542 module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
543 module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(31);
544 module.exports.load                = loader.load;
545 module.exports.loadAll             = loader.loadAll;
546 module.exports.safeLoad            = loader.safeLoad;
547 module.exports.safeLoadAll         = loader.safeLoadAll;
548 module.exports.dump                = dumper.dump;
549 module.exports.safeDump            = dumper.safeDump;
550 module.exports.YAMLException       = __webpack_require__(9);
551
552 // Deprecated schema names from JS-YAML 2.0.x
553 module.exports.MINIMAL_SCHEMA = __webpack_require__(16);
554 module.exports.SAFE_SCHEMA    = __webpack_require__(11);
555 module.exports.DEFAULT_SCHEMA = __webpack_require__(31);
556
557 // Deprecated functions from JS-YAML 1.x.x
558 module.exports.scan           = deprecated('scan');
559 module.exports.parse          = deprecated('parse');
560 module.exports.compose        = deprecated('compose');
561 module.exports.addConstructor = deprecated('addConstructor');
562
563
564 /***/ }),
565 /* 7 */
566 /***/ (function(module, exports, __webpack_require__) {
567
568 "use strict";
569
570
571 /*eslint-disable max-len,no-use-before-define*/
572
573 var common              = __webpack_require__(8);
574 var YAMLException       = __webpack_require__(9);
575 var Mark                = __webpack_require__(10);
576 var DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
577 var DEFAULT_FULL_SCHEMA = __webpack_require__(31);
578
579
580 var _hasOwnProperty = Object.prototype.hasOwnProperty;
581
582
583 var CONTEXT_FLOW_IN   = 1;
584 var CONTEXT_FLOW_OUT  = 2;
585 var CONTEXT_BLOCK_IN  = 3;
586 var CONTEXT_BLOCK_OUT = 4;
587
588
589 var CHOMPING_CLIP  = 1;
590 var CHOMPING_STRIP = 2;
591 var CHOMPING_KEEP  = 3;
592
593
594 var PATTERN_NON_PRINTABLE         = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
595 var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
596 var PATTERN_FLOW_INDICATORS       = /[,\[\]\{\}]/;
597 var PATTERN_TAG_HANDLE            = /^(?:!|!!|![a-z\-]+!)$/i;
598 var PATTERN_TAG_URI               = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
599
600
601 function _class(obj) { return Object.prototype.toString.call(obj); }
602
603 function is_EOL(c) {
604   return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
605 }
606
607 function is_WHITE_SPACE(c) {
608   return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
609 }
610
611 function is_WS_OR_EOL(c) {
612   return (c === 0x09/* Tab */) ||
613          (c === 0x20/* Space */) ||
614          (c === 0x0A/* LF */) ||
615          (c === 0x0D/* CR */);
616 }
617
618 function is_FLOW_INDICATOR(c) {
619   return c === 0x2C/* , */ ||
620          c === 0x5B/* [ */ ||
621          c === 0x5D/* ] */ ||
622          c === 0x7B/* { */ ||
623          c === 0x7D/* } */;
624 }
625
626 function fromHexCode(c) {
627   var lc;
628
629   if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
630     return c - 0x30;
631   }
632
633   /*eslint-disable no-bitwise*/
634   lc = c | 0x20;
635
636   if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
637     return lc - 0x61 + 10;
638   }
639
640   return -1;
641 }
642
643 function escapedHexLen(c) {
644   if (c === 0x78/* x */) { return 2; }
645   if (c === 0x75/* u */) { return 4; }
646   if (c === 0x55/* U */) { return 8; }
647   return 0;
648 }
649
650 function fromDecimalCode(c) {
651   if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
652     return c - 0x30;
653   }
654
655   return -1;
656 }
657
658 function simpleEscapeSequence(c) {
659   /* eslint-disable indent */
660   return (c === 0x30/* 0 */) ? '\x00' :
661         (c === 0x61/* a */) ? '\x07' :
662         (c === 0x62/* b */) ? '\x08' :
663         (c === 0x74/* t */) ? '\x09' :
664         (c === 0x09/* Tab */) ? '\x09' :
665         (c === 0x6E/* n */) ? '\x0A' :
666         (c === 0x76/* v */) ? '\x0B' :
667         (c === 0x66/* f */) ? '\x0C' :
668         (c === 0x72/* r */) ? '\x0D' :
669         (c === 0x65/* e */) ? '\x1B' :
670         (c === 0x20/* Space */) ? ' ' :
671         (c === 0x22/* " */) ? '\x22' :
672         (c === 0x2F/* / */) ? '/' :
673         (c === 0x5C/* \ */) ? '\x5C' :
674         (c === 0x4E/* N */) ? '\x85' :
675         (c === 0x5F/* _ */) ? '\xA0' :
676         (c === 0x4C/* L */) ? '\u2028' :
677         (c === 0x50/* P */) ? '\u2029' : '';
678 }
679
680 function charFromCodepoint(c) {
681   if (c <= 0xFFFF) {
682     return String.fromCharCode(c);
683   }
684   // Encode UTF-16 surrogate pair
685   // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
686   return String.fromCharCode(
687     ((c - 0x010000) >> 10) + 0xD800,
688     ((c - 0x010000) & 0x03FF) + 0xDC00
689   );
690 }
691
692 var simpleEscapeCheck = new Array(256); // integer, for fast access
693 var simpleEscapeMap = new Array(256);
694 for (var i = 0; i < 256; i++) {
695   simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
696   simpleEscapeMap[i] = simpleEscapeSequence(i);
697 }
698
699
700 function State(input, options) {
701   this.input = input;
702
703   this.filename  = options['filename']  || null;
704   this.schema    = options['schema']    || DEFAULT_FULL_SCHEMA;
705   this.onWarning = options['onWarning'] || null;
706   this.legacy    = options['legacy']    || false;
707   this.json      = options['json']      || false;
708   this.listener  = options['listener']  || null;
709
710   this.implicitTypes = this.schema.compiledImplicit;
711   this.typeMap       = this.schema.compiledTypeMap;
712
713   this.length     = input.length;
714   this.position   = 0;
715   this.line       = 0;
716   this.lineStart  = 0;
717   this.lineIndent = 0;
718
719   this.documents = [];
720
721   /*
722   this.version;
723   this.checkLineBreaks;
724   this.tagMap;
725   this.anchorMap;
726   this.tag;
727   this.anchor;
728   this.kind;
729   this.result;*/
730
731 }
732
733
734 function generateError(state, message) {
735   return new YAMLException(
736     message,
737     new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
738 }
739
740 function throwError(state, message) {
741   throw generateError(state, message);
742 }
743
744 function throwWarning(state, message) {
745   if (state.onWarning) {
746     state.onWarning.call(null, generateError(state, message));
747   }
748 }
749
750
751 var directiveHandlers = {
752
753   YAML: function handleYamlDirective(state, name, args) {
754
755     var match, major, minor;
756
757     if (state.version !== null) {
758       throwError(state, 'duplication of %YAML directive');
759     }
760
761     if (args.length !== 1) {
762       throwError(state, 'YAML directive accepts exactly one argument');
763     }
764
765     match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
766
767     if (match === null) {
768       throwError(state, 'ill-formed argument of the YAML directive');
769     }
770
771     major = parseInt(match[1], 10);
772     minor = parseInt(match[2], 10);
773
774     if (major !== 1) {
775       throwError(state, 'unacceptable YAML version of the document');
776     }
777
778     state.version = args[0];
779     state.checkLineBreaks = (minor < 2);
780
781     if (minor !== 1 && minor !== 2) {
782       throwWarning(state, 'unsupported YAML version of the document');
783     }
784   },
785
786   TAG: function handleTagDirective(state, name, args) {
787
788     var handle, prefix;
789
790     if (args.length !== 2) {
791       throwError(state, 'TAG directive accepts exactly two arguments');
792     }
793
794     handle = args[0];
795     prefix = args[1];
796
797     if (!PATTERN_TAG_HANDLE.test(handle)) {
798       throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
799     }
800
801     if (_hasOwnProperty.call(state.tagMap, handle)) {
802       throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
803     }
804
805     if (!PATTERN_TAG_URI.test(prefix)) {
806       throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
807     }
808
809     state.tagMap[handle] = prefix;
810   }
811 };
812
813
814 function captureSegment(state, start, end, checkJson) {
815   var _position, _length, _character, _result;
816
817   if (start < end) {
818     _result = state.input.slice(start, end);
819
820     if (checkJson) {
821       for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
822         _character = _result.charCodeAt(_position);
823         if (!(_character === 0x09 ||
824               (0x20 <= _character && _character <= 0x10FFFF))) {
825           throwError(state, 'expected valid JSON character');
826         }
827       }
828     } else if (PATTERN_NON_PRINTABLE.test(_result)) {
829       throwError(state, 'the stream contains non-printable characters');
830     }
831
832     state.result += _result;
833   }
834 }
835
836 function mergeMappings(state, destination, source, overridableKeys) {
837   var sourceKeys, key, index, quantity;
838
839   if (!common.isObject(source)) {
840     throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
841   }
842
843   sourceKeys = Object.keys(source);
844
845   for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
846     key = sourceKeys[index];
847
848     if (!_hasOwnProperty.call(destination, key)) {
849       destination[key] = source[key];
850       overridableKeys[key] = true;
851     }
852   }
853 }
854
855 function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
856   var index, quantity;
857
858   // The output is a plain object here, so keys can only be strings.
859   // We need to convert keyNode to a string, but doing so can hang the process
860   // (deeply nested arrays that explode exponentially using aliases).
861   if (Array.isArray(keyNode)) {
862     keyNode = Array.prototype.slice.call(keyNode);
863
864     for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
865       if (Array.isArray(keyNode[index])) {
866         throwError(state, 'nested arrays are not supported inside keys');
867       }
868
869       if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
870         keyNode[index] = '[object Object]';
871       }
872     }
873   }
874
875   // Avoid code execution in load() via toString property
876   // (still use its own toString for arrays, timestamps,
877   // and whatever user schema extensions happen to have @@toStringTag)
878   if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
879     keyNode = '[object Object]';
880   }
881
882
883   keyNode = String(keyNode);
884
885   if (_result === null) {
886     _result = {};
887   }
888
889   if (keyTag === 'tag:yaml.org,2002:merge') {
890     if (Array.isArray(valueNode)) {
891       for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
892         mergeMappings(state, _result, valueNode[index], overridableKeys);
893       }
894     } else {
895       mergeMappings(state, _result, valueNode, overridableKeys);
896     }
897   } else {
898     if (!state.json &&
899         !_hasOwnProperty.call(overridableKeys, keyNode) &&
900         _hasOwnProperty.call(_result, keyNode)) {
901       state.line = startLine || state.line;
902       state.position = startPos || state.position;
903       throwError(state, 'duplicated mapping key');
904     }
905     _result[keyNode] = valueNode;
906     delete overridableKeys[keyNode];
907   }
908
909   return _result;
910 }
911
912 function readLineBreak(state) {
913   var ch;
914
915   ch = state.input.charCodeAt(state.position);
916
917   if (ch === 0x0A/* LF */) {
918     state.position++;
919   } else if (ch === 0x0D/* CR */) {
920     state.position++;
921     if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
922       state.position++;
923     }
924   } else {
925     throwError(state, 'a line break is expected');
926   }
927
928   state.line += 1;
929   state.lineStart = state.position;
930 }
931
932 function skipSeparationSpace(state, allowComments, checkIndent) {
933   var lineBreaks = 0,
934       ch = state.input.charCodeAt(state.position);
935
936   while (ch !== 0) {
937     while (is_WHITE_SPACE(ch)) {
938       ch = state.input.charCodeAt(++state.position);
939     }
940
941     if (allowComments && ch === 0x23/* # */) {
942       do {
943         ch = state.input.charCodeAt(++state.position);
944       } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
945     }
946
947     if (is_EOL(ch)) {
948       readLineBreak(state);
949
950       ch = state.input.charCodeAt(state.position);
951       lineBreaks++;
952       state.lineIndent = 0;
953
954       while (ch === 0x20/* Space */) {
955         state.lineIndent++;
956         ch = state.input.charCodeAt(++state.position);
957       }
958     } else {
959       break;
960     }
961   }
962
963   if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
964     throwWarning(state, 'deficient indentation');
965   }
966
967   return lineBreaks;
968 }
969
970 function testDocumentSeparator(state) {
971   var _position = state.position,
972       ch;
973
974   ch = state.input.charCodeAt(_position);
975
976   // Condition state.position === state.lineStart is tested
977   // in parent on each call, for efficiency. No needs to test here again.
978   if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
979       ch === state.input.charCodeAt(_position + 1) &&
980       ch === state.input.charCodeAt(_position + 2)) {
981
982     _position += 3;
983
984     ch = state.input.charCodeAt(_position);
985
986     if (ch === 0 || is_WS_OR_EOL(ch)) {
987       return true;
988     }
989   }
990
991   return false;
992 }
993
994 function writeFoldedLines(state, count) {
995   if (count === 1) {
996     state.result += ' ';
997   } else if (count > 1) {
998     state.result += common.repeat('\n', count - 1);
999   }
1000 }
1001
1002
1003 function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1004   var preceding,
1005       following,
1006       captureStart,
1007       captureEnd,
1008       hasPendingContent,
1009       _line,
1010       _lineStart,
1011       _lineIndent,
1012       _kind = state.kind,
1013       _result = state.result,
1014       ch;
1015
1016   ch = state.input.charCodeAt(state.position);
1017
1018   if (is_WS_OR_EOL(ch)      ||
1019       is_FLOW_INDICATOR(ch) ||
1020       ch === 0x23/* # */    ||
1021       ch === 0x26/* & */    ||
1022       ch === 0x2A/* * */    ||
1023       ch === 0x21/* ! */    ||
1024       ch === 0x7C/* | */    ||
1025       ch === 0x3E/* > */    ||
1026       ch === 0x27/* ' */    ||
1027       ch === 0x22/* " */    ||
1028       ch === 0x25/* % */    ||
1029       ch === 0x40/* @ */    ||
1030       ch === 0x60/* ` */) {
1031     return false;
1032   }
1033
1034   if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
1035     following = state.input.charCodeAt(state.position + 1);
1036
1037     if (is_WS_OR_EOL(following) ||
1038         withinFlowCollection && is_FLOW_INDICATOR(following)) {
1039       return false;
1040     }
1041   }
1042
1043   state.kind = 'scalar';
1044   state.result = '';
1045   captureStart = captureEnd = state.position;
1046   hasPendingContent = false;
1047
1048   while (ch !== 0) {
1049     if (ch === 0x3A/* : */) {
1050       following = state.input.charCodeAt(state.position + 1);
1051
1052       if (is_WS_OR_EOL(following) ||
1053           withinFlowCollection && is_FLOW_INDICATOR(following)) {
1054         break;
1055       }
1056
1057     } else if (ch === 0x23/* # */) {
1058       preceding = state.input.charCodeAt(state.position - 1);
1059
1060       if (is_WS_OR_EOL(preceding)) {
1061         break;
1062       }
1063
1064     } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
1065                withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1066       break;
1067
1068     } else if (is_EOL(ch)) {
1069       _line = state.line;
1070       _lineStart = state.lineStart;
1071       _lineIndent = state.lineIndent;
1072       skipSeparationSpace(state, false, -1);
1073
1074       if (state.lineIndent >= nodeIndent) {
1075         hasPendingContent = true;
1076         ch = state.input.charCodeAt(state.position);
1077         continue;
1078       } else {
1079         state.position = captureEnd;
1080         state.line = _line;
1081         state.lineStart = _lineStart;
1082         state.lineIndent = _lineIndent;
1083         break;
1084       }
1085     }
1086
1087     if (hasPendingContent) {
1088       captureSegment(state, captureStart, captureEnd, false);
1089       writeFoldedLines(state, state.line - _line);
1090       captureStart = captureEnd = state.position;
1091       hasPendingContent = false;
1092     }
1093
1094     if (!is_WHITE_SPACE(ch)) {
1095       captureEnd = state.position + 1;
1096     }
1097
1098     ch = state.input.charCodeAt(++state.position);
1099   }
1100
1101   captureSegment(state, captureStart, captureEnd, false);
1102
1103   if (state.result) {
1104     return true;
1105   }
1106
1107   state.kind = _kind;
1108   state.result = _result;
1109   return false;
1110 }
1111
1112 function readSingleQuotedScalar(state, nodeIndent) {
1113   var ch,
1114       captureStart, captureEnd;
1115
1116   ch = state.input.charCodeAt(state.position);
1117
1118   if (ch !== 0x27/* ' */) {
1119     return false;
1120   }
1121
1122   state.kind = 'scalar';
1123   state.result = '';
1124   state.position++;
1125   captureStart = captureEnd = state.position;
1126
1127   while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1128     if (ch === 0x27/* ' */) {
1129       captureSegment(state, captureStart, state.position, true);
1130       ch = state.input.charCodeAt(++state.position);
1131
1132       if (ch === 0x27/* ' */) {
1133         captureStart = state.position;
1134         state.position++;
1135         captureEnd = state.position;
1136       } else {
1137         return true;
1138       }
1139
1140     } else if (is_EOL(ch)) {
1141       captureSegment(state, captureStart, captureEnd, true);
1142       writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1143       captureStart = captureEnd = state.position;
1144
1145     } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1146       throwError(state, 'unexpected end of the document within a single quoted scalar');
1147
1148     } else {
1149       state.position++;
1150       captureEnd = state.position;
1151     }
1152   }
1153
1154   throwError(state, 'unexpected end of the stream within a single quoted scalar');
1155 }
1156
1157 function readDoubleQuotedScalar(state, nodeIndent) {
1158   var captureStart,
1159       captureEnd,
1160       hexLength,
1161       hexResult,
1162       tmp,
1163       ch;
1164
1165   ch = state.input.charCodeAt(state.position);
1166
1167   if (ch !== 0x22/* " */) {
1168     return false;
1169   }
1170
1171   state.kind = 'scalar';
1172   state.result = '';
1173   state.position++;
1174   captureStart = captureEnd = state.position;
1175
1176   while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1177     if (ch === 0x22/* " */) {
1178       captureSegment(state, captureStart, state.position, true);
1179       state.position++;
1180       return true;
1181
1182     } else if (ch === 0x5C/* \ */) {
1183       captureSegment(state, captureStart, state.position, true);
1184       ch = state.input.charCodeAt(++state.position);
1185
1186       if (is_EOL(ch)) {
1187         skipSeparationSpace(state, false, nodeIndent);
1188
1189         // TODO: rework to inline fn with no type cast?
1190       } else if (ch < 256 && simpleEscapeCheck[ch]) {
1191         state.result += simpleEscapeMap[ch];
1192         state.position++;
1193
1194       } else if ((tmp = escapedHexLen(ch)) > 0) {
1195         hexLength = tmp;
1196         hexResult = 0;
1197
1198         for (; hexLength > 0; hexLength--) {
1199           ch = state.input.charCodeAt(++state.position);
1200
1201           if ((tmp = fromHexCode(ch)) >= 0) {
1202             hexResult = (hexResult << 4) + tmp;
1203
1204           } else {
1205             throwError(state, 'expected hexadecimal character');
1206           }
1207         }
1208
1209         state.result += charFromCodepoint(hexResult);
1210
1211         state.position++;
1212
1213       } else {
1214         throwError(state, 'unknown escape sequence');
1215       }
1216
1217       captureStart = captureEnd = state.position;
1218
1219     } else if (is_EOL(ch)) {
1220       captureSegment(state, captureStart, captureEnd, true);
1221       writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1222       captureStart = captureEnd = state.position;
1223
1224     } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1225       throwError(state, 'unexpected end of the document within a double quoted scalar');
1226
1227     } else {
1228       state.position++;
1229       captureEnd = state.position;
1230     }
1231   }
1232
1233   throwError(state, 'unexpected end of the stream within a double quoted scalar');
1234 }
1235
1236 function readFlowCollection(state, nodeIndent) {
1237   var readNext = true,
1238       _line,
1239       _tag     = state.tag,
1240       _result,
1241       _anchor  = state.anchor,
1242       following,
1243       terminator,
1244       isPair,
1245       isExplicitPair,
1246       isMapping,
1247       overridableKeys = {},
1248       keyNode,
1249       keyTag,
1250       valueNode,
1251       ch;
1252
1253   ch = state.input.charCodeAt(state.position);
1254
1255   if (ch === 0x5B/* [ */) {
1256     terminator = 0x5D;/* ] */
1257     isMapping = false;
1258     _result = [];
1259   } else if (ch === 0x7B/* { */) {
1260     terminator = 0x7D;/* } */
1261     isMapping = true;
1262     _result = {};
1263   } else {
1264     return false;
1265   }
1266
1267   if (state.anchor !== null) {
1268     state.anchorMap[state.anchor] = _result;
1269   }
1270
1271   ch = state.input.charCodeAt(++state.position);
1272
1273   while (ch !== 0) {
1274     skipSeparationSpace(state, true, nodeIndent);
1275
1276     ch = state.input.charCodeAt(state.position);
1277
1278     if (ch === terminator) {
1279       state.position++;
1280       state.tag = _tag;
1281       state.anchor = _anchor;
1282       state.kind = isMapping ? 'mapping' : 'sequence';
1283       state.result = _result;
1284       return true;
1285     } else if (!readNext) {
1286       throwError(state, 'missed comma between flow collection entries');
1287     }
1288
1289     keyTag = keyNode = valueNode = null;
1290     isPair = isExplicitPair = false;
1291
1292     if (ch === 0x3F/* ? */) {
1293       following = state.input.charCodeAt(state.position + 1);
1294
1295       if (is_WS_OR_EOL(following)) {
1296         isPair = isExplicitPair = true;
1297         state.position++;
1298         skipSeparationSpace(state, true, nodeIndent);
1299       }
1300     }
1301
1302     _line = state.line;
1303     composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1304     keyTag = state.tag;
1305     keyNode = state.result;
1306     skipSeparationSpace(state, true, nodeIndent);
1307
1308     ch = state.input.charCodeAt(state.position);
1309
1310     if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
1311       isPair = true;
1312       ch = state.input.charCodeAt(++state.position);
1313       skipSeparationSpace(state, true, nodeIndent);
1314       composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1315       valueNode = state.result;
1316     }
1317
1318     if (isMapping) {
1319       storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
1320     } else if (isPair) {
1321       _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
1322     } else {
1323       _result.push(keyNode);
1324     }
1325
1326     skipSeparationSpace(state, true, nodeIndent);
1327
1328     ch = state.input.charCodeAt(state.position);
1329
1330     if (ch === 0x2C/* , */) {
1331       readNext = true;
1332       ch = state.input.charCodeAt(++state.position);
1333     } else {
1334       readNext = false;
1335     }
1336   }
1337
1338   throwError(state, 'unexpected end of the stream within a flow collection');
1339 }
1340
1341 function readBlockScalar(state, nodeIndent) {
1342   var captureStart,
1343       folding,
1344       chomping       = CHOMPING_CLIP,
1345       didReadContent = false,
1346       detectedIndent = false,
1347       textIndent     = nodeIndent,
1348       emptyLines     = 0,
1349       atMoreIndented = false,
1350       tmp,
1351       ch;
1352
1353   ch = state.input.charCodeAt(state.position);
1354
1355   if (ch === 0x7C/* | */) {
1356     folding = false;
1357   } else if (ch === 0x3E/* > */) {
1358     folding = true;
1359   } else {
1360     return false;
1361   }
1362
1363   state.kind = 'scalar';
1364   state.result = '';
1365
1366   while (ch !== 0) {
1367     ch = state.input.charCodeAt(++state.position);
1368
1369     if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
1370       if (CHOMPING_CLIP === chomping) {
1371         chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
1372       } else {
1373         throwError(state, 'repeat of a chomping mode identifier');
1374       }
1375
1376     } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1377       if (tmp === 0) {
1378         throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
1379       } else if (!detectedIndent) {
1380         textIndent = nodeIndent + tmp - 1;
1381         detectedIndent = true;
1382       } else {
1383         throwError(state, 'repeat of an indentation width identifier');
1384       }
1385
1386     } else {
1387       break;
1388     }
1389   }
1390
1391   if (is_WHITE_SPACE(ch)) {
1392     do { ch = state.input.charCodeAt(++state.position); }
1393     while (is_WHITE_SPACE(ch));
1394
1395     if (ch === 0x23/* # */) {
1396       do { ch = state.input.charCodeAt(++state.position); }
1397       while (!is_EOL(ch) && (ch !== 0));
1398     }
1399   }
1400
1401   while (ch !== 0) {
1402     readLineBreak(state);
1403     state.lineIndent = 0;
1404
1405     ch = state.input.charCodeAt(state.position);
1406
1407     while ((!detectedIndent || state.lineIndent < textIndent) &&
1408            (ch === 0x20/* Space */)) {
1409       state.lineIndent++;
1410       ch = state.input.charCodeAt(++state.position);
1411     }
1412
1413     if (!detectedIndent && state.lineIndent > textIndent) {
1414       textIndent = state.lineIndent;
1415     }
1416
1417     if (is_EOL(ch)) {
1418       emptyLines++;
1419       continue;
1420     }
1421
1422     // End of the scalar.
1423     if (state.lineIndent < textIndent) {
1424
1425       // Perform the chomping.
1426       if (chomping === CHOMPING_KEEP) {
1427         state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1428       } else if (chomping === CHOMPING_CLIP) {
1429         if (didReadContent) { // i.e. only if the scalar is not empty.
1430           state.result += '\n';
1431         }
1432       }
1433
1434       // Break this `while` cycle and go to the funciton's epilogue.
1435       break;
1436     }
1437
1438     // Folded style: use fancy rules to handle line breaks.
1439     if (folding) {
1440
1441       // Lines starting with white space characters (more-indented lines) are not folded.
1442       if (is_WHITE_SPACE(ch)) {
1443         atMoreIndented = true;
1444         // except for the first content line (cf. Example 8.1)
1445         state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1446
1447       // End of more-indented block.
1448       } else if (atMoreIndented) {
1449         atMoreIndented = false;
1450         state.result += common.repeat('\n', emptyLines + 1);
1451
1452       // Just one line break - perceive as the same line.
1453       } else if (emptyLines === 0) {
1454         if (didReadContent) { // i.e. only if we have already read some scalar content.
1455           state.result += ' ';
1456         }
1457
1458       // Several line breaks - perceive as different lines.
1459       } else {
1460         state.result += common.repeat('\n', emptyLines);
1461       }
1462
1463     // Literal style: just add exact number of line breaks between content lines.
1464     } else {
1465       // Keep all line breaks except the header line break.
1466       state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
1467     }
1468
1469     didReadContent = true;
1470     detectedIndent = true;
1471     emptyLines = 0;
1472     captureStart = state.position;
1473
1474     while (!is_EOL(ch) && (ch !== 0)) {
1475       ch = state.input.charCodeAt(++state.position);
1476     }
1477
1478     captureSegment(state, captureStart, state.position, false);
1479   }
1480
1481   return true;
1482 }
1483
1484 function readBlockSequence(state, nodeIndent) {
1485   var _line,
1486       _tag      = state.tag,
1487       _anchor   = state.anchor,
1488       _result   = [],
1489       following,
1490       detected  = false,
1491       ch;
1492
1493   if (state.anchor !== null) {
1494     state.anchorMap[state.anchor] = _result;
1495   }
1496
1497   ch = state.input.charCodeAt(state.position);
1498
1499   while (ch !== 0) {
1500
1501     if (ch !== 0x2D/* - */) {
1502       break;
1503     }
1504
1505     following = state.input.charCodeAt(state.position + 1);
1506
1507     if (!is_WS_OR_EOL(following)) {
1508       break;
1509     }
1510
1511     detected = true;
1512     state.position++;
1513
1514     if (skipSeparationSpace(state, true, -1)) {
1515       if (state.lineIndent <= nodeIndent) {
1516         _result.push(null);
1517         ch = state.input.charCodeAt(state.position);
1518         continue;
1519       }
1520     }
1521
1522     _line = state.line;
1523     composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1524     _result.push(state.result);
1525     skipSeparationSpace(state, true, -1);
1526
1527     ch = state.input.charCodeAt(state.position);
1528
1529     if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
1530       throwError(state, 'bad indentation of a sequence entry');
1531     } else if (state.lineIndent < nodeIndent) {
1532       break;
1533     }
1534   }
1535
1536   if (detected) {
1537     state.tag = _tag;
1538     state.anchor = _anchor;
1539     state.kind = 'sequence';
1540     state.result = _result;
1541     return true;
1542   }
1543   return false;
1544 }
1545
1546 function readBlockMapping(state, nodeIndent, flowIndent) {
1547   var following,
1548       allowCompact,
1549       _line,
1550       _pos,
1551       _tag          = state.tag,
1552       _anchor       = state.anchor,
1553       _result       = {},
1554       overridableKeys = {},
1555       keyTag        = null,
1556       keyNode       = null,
1557       valueNode     = null,
1558       atExplicitKey = false,
1559       detected      = false,
1560       ch;
1561
1562   if (state.anchor !== null) {
1563     state.anchorMap[state.anchor] = _result;
1564   }
1565
1566   ch = state.input.charCodeAt(state.position);
1567
1568   while (ch !== 0) {
1569     following = state.input.charCodeAt(state.position + 1);
1570     _line = state.line; // Save the current line.
1571     _pos = state.position;
1572
1573     //
1574     // Explicit notation case. There are two separate blocks:
1575     // first for the key (denoted by "?") and second for the value (denoted by ":")
1576     //
1577     if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
1578
1579       if (ch === 0x3F/* ? */) {
1580         if (atExplicitKey) {
1581           storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1582           keyTag = keyNode = valueNode = null;
1583         }
1584
1585         detected = true;
1586         atExplicitKey = true;
1587         allowCompact = true;
1588
1589       } else if (atExplicitKey) {
1590         // i.e. 0x3A/* : */ === character after the explicit key.
1591         atExplicitKey = false;
1592         allowCompact = true;
1593
1594       } else {
1595         throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
1596       }
1597
1598       state.position += 1;
1599       ch = following;
1600
1601     //
1602     // Implicit notation case. Flow-style node as the key first, then ":", and the value.
1603     //
1604     } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
1605
1606       if (state.line === _line) {
1607         ch = state.input.charCodeAt(state.position);
1608
1609         while (is_WHITE_SPACE(ch)) {
1610           ch = state.input.charCodeAt(++state.position);
1611         }
1612
1613         if (ch === 0x3A/* : */) {
1614           ch = state.input.charCodeAt(++state.position);
1615
1616           if (!is_WS_OR_EOL(ch)) {
1617             throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
1618           }
1619
1620           if (atExplicitKey) {
1621             storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1622             keyTag = keyNode = valueNode = null;
1623           }
1624
1625           detected = true;
1626           atExplicitKey = false;
1627           allowCompact = false;
1628           keyTag = state.tag;
1629           keyNode = state.result;
1630
1631         } else if (detected) {
1632           throwError(state, 'can not read an implicit mapping pair; a colon is missed');
1633
1634         } else {
1635           state.tag = _tag;
1636           state.anchor = _anchor;
1637           return true; // Keep the result of `composeNode`.
1638         }
1639
1640       } else if (detected) {
1641         throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
1642
1643       } else {
1644         state.tag = _tag;
1645         state.anchor = _anchor;
1646         return true; // Keep the result of `composeNode`.
1647       }
1648
1649     } else {
1650       break; // Reading is done. Go to the epilogue.
1651     }
1652
1653     //
1654     // Common reading code for both explicit and implicit notations.
1655     //
1656     if (state.line === _line || state.lineIndent > nodeIndent) {
1657       if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
1658         if (atExplicitKey) {
1659           keyNode = state.result;
1660         } else {
1661           valueNode = state.result;
1662         }
1663       }
1664
1665       if (!atExplicitKey) {
1666         storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
1667         keyTag = keyNode = valueNode = null;
1668       }
1669
1670       skipSeparationSpace(state, true, -1);
1671       ch = state.input.charCodeAt(state.position);
1672     }
1673
1674     if (state.lineIndent > nodeIndent && (ch !== 0)) {
1675       throwError(state, 'bad indentation of a mapping entry');
1676     } else if (state.lineIndent < nodeIndent) {
1677       break;
1678     }
1679   }
1680
1681   //
1682   // Epilogue.
1683   //
1684
1685   // Special case: last mapping's node contains only the key in explicit notation.
1686   if (atExplicitKey) {
1687     storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
1688   }
1689
1690   // Expose the resulting mapping.
1691   if (detected) {
1692     state.tag = _tag;
1693     state.anchor = _anchor;
1694     state.kind = 'mapping';
1695     state.result = _result;
1696   }
1697
1698   return detected;
1699 }
1700
1701 function readTagProperty(state) {
1702   var _position,
1703       isVerbatim = false,
1704       isNamed    = false,
1705       tagHandle,
1706       tagName,
1707       ch;
1708
1709   ch = state.input.charCodeAt(state.position);
1710
1711   if (ch !== 0x21/* ! */) return false;
1712
1713   if (state.tag !== null) {
1714     throwError(state, 'duplication of a tag property');
1715   }
1716
1717   ch = state.input.charCodeAt(++state.position);
1718
1719   if (ch === 0x3C/* < */) {
1720     isVerbatim = true;
1721     ch = state.input.charCodeAt(++state.position);
1722
1723   } else if (ch === 0x21/* ! */) {
1724     isNamed = true;
1725     tagHandle = '!!';
1726     ch = state.input.charCodeAt(++state.position);
1727
1728   } else {
1729     tagHandle = '!';
1730   }
1731
1732   _position = state.position;
1733
1734   if (isVerbatim) {
1735     do { ch = state.input.charCodeAt(++state.position); }
1736     while (ch !== 0 && ch !== 0x3E/* > */);
1737
1738     if (state.position < state.length) {
1739       tagName = state.input.slice(_position, state.position);
1740       ch = state.input.charCodeAt(++state.position);
1741     } else {
1742       throwError(state, 'unexpected end of the stream within a verbatim tag');
1743     }
1744   } else {
1745     while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1746
1747       if (ch === 0x21/* ! */) {
1748         if (!isNamed) {
1749           tagHandle = state.input.slice(_position - 1, state.position + 1);
1750
1751           if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1752             throwError(state, 'named tag handle cannot contain such characters');
1753           }
1754
1755           isNamed = true;
1756           _position = state.position + 1;
1757         } else {
1758           throwError(state, 'tag suffix cannot contain exclamation marks');
1759         }
1760       }
1761
1762       ch = state.input.charCodeAt(++state.position);
1763     }
1764
1765     tagName = state.input.slice(_position, state.position);
1766
1767     if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1768       throwError(state, 'tag suffix cannot contain flow indicator characters');
1769     }
1770   }
1771
1772   if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1773     throwError(state, 'tag name cannot contain such characters: ' + tagName);
1774   }
1775
1776   if (isVerbatim) {
1777     state.tag = tagName;
1778
1779   } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
1780     state.tag = state.tagMap[tagHandle] + tagName;
1781
1782   } else if (tagHandle === '!') {
1783     state.tag = '!' + tagName;
1784
1785   } else if (tagHandle === '!!') {
1786     state.tag = 'tag:yaml.org,2002:' + tagName;
1787
1788   } else {
1789     throwError(state, 'undeclared tag handle "' + tagHandle + '"');
1790   }
1791
1792   return true;
1793 }
1794
1795 function readAnchorProperty(state) {
1796   var _position,
1797       ch;
1798
1799   ch = state.input.charCodeAt(state.position);
1800
1801   if (ch !== 0x26/* & */) return false;
1802
1803   if (state.anchor !== null) {
1804     throwError(state, 'duplication of an anchor property');
1805   }
1806
1807   ch = state.input.charCodeAt(++state.position);
1808   _position = state.position;
1809
1810   while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1811     ch = state.input.charCodeAt(++state.position);
1812   }
1813
1814   if (state.position === _position) {
1815     throwError(state, 'name of an anchor node must contain at least one character');
1816   }
1817
1818   state.anchor = state.input.slice(_position, state.position);
1819   return true;
1820 }
1821
1822 function readAlias(state) {
1823   var _position, alias,
1824       ch;
1825
1826   ch = state.input.charCodeAt(state.position);
1827
1828   if (ch !== 0x2A/* * */) return false;
1829
1830   ch = state.input.charCodeAt(++state.position);
1831   _position = state.position;
1832
1833   while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1834     ch = state.input.charCodeAt(++state.position);
1835   }
1836
1837   if (state.position === _position) {
1838     throwError(state, 'name of an alias node must contain at least one character');
1839   }
1840
1841   alias = state.input.slice(_position, state.position);
1842
1843   if (!state.anchorMap.hasOwnProperty(alias)) {
1844     throwError(state, 'unidentified alias "' + alias + '"');
1845   }
1846
1847   state.result = state.anchorMap[alias];
1848   skipSeparationSpace(state, true, -1);
1849   return true;
1850 }
1851
1852 function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1853   var allowBlockStyles,
1854       allowBlockScalars,
1855       allowBlockCollections,
1856       indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
1857       atNewLine  = false,
1858       hasContent = false,
1859       typeIndex,
1860       typeQuantity,
1861       type,
1862       flowIndent,
1863       blockIndent;
1864
1865   if (state.listener !== null) {
1866     state.listener('open', state);
1867   }
1868
1869   state.tag    = null;
1870   state.anchor = null;
1871   state.kind   = null;
1872   state.result = null;
1873
1874   allowBlockStyles = allowBlockScalars = allowBlockCollections =
1875     CONTEXT_BLOCK_OUT === nodeContext ||
1876     CONTEXT_BLOCK_IN  === nodeContext;
1877
1878   if (allowToSeek) {
1879     if (skipSeparationSpace(state, true, -1)) {
1880       atNewLine = true;
1881
1882       if (state.lineIndent > parentIndent) {
1883         indentStatus = 1;
1884       } else if (state.lineIndent === parentIndent) {
1885         indentStatus = 0;
1886       } else if (state.lineIndent < parentIndent) {
1887         indentStatus = -1;
1888       }
1889     }
1890   }
1891
1892   if (indentStatus === 1) {
1893     while (readTagProperty(state) || readAnchorProperty(state)) {
1894       if (skipSeparationSpace(state, true, -1)) {
1895         atNewLine = true;
1896         allowBlockCollections = allowBlockStyles;
1897
1898         if (state.lineIndent > parentIndent) {
1899           indentStatus = 1;
1900         } else if (state.lineIndent === parentIndent) {
1901           indentStatus = 0;
1902         } else if (state.lineIndent < parentIndent) {
1903           indentStatus = -1;
1904         }
1905       } else {
1906         allowBlockCollections = false;
1907       }
1908     }
1909   }
1910
1911   if (allowBlockCollections) {
1912     allowBlockCollections = atNewLine || allowCompact;
1913   }
1914
1915   if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1916     if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
1917       flowIndent = parentIndent;
1918     } else {
1919       flowIndent = parentIndent + 1;
1920     }
1921
1922     blockIndent = state.position - state.lineStart;
1923
1924     if (indentStatus === 1) {
1925       if (allowBlockCollections &&
1926           (readBlockSequence(state, blockIndent) ||
1927            readBlockMapping(state, blockIndent, flowIndent)) ||
1928           readFlowCollection(state, flowIndent)) {
1929         hasContent = true;
1930       } else {
1931         if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
1932             readSingleQuotedScalar(state, flowIndent) ||
1933             readDoubleQuotedScalar(state, flowIndent)) {
1934           hasContent = true;
1935
1936         } else if (readAlias(state)) {
1937           hasContent = true;
1938
1939           if (state.tag !== null || state.anchor !== null) {
1940             throwError(state, 'alias node should not have any properties');
1941           }
1942
1943         } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1944           hasContent = true;
1945
1946           if (state.tag === null) {
1947             state.tag = '?';
1948           }
1949         }
1950
1951         if (state.anchor !== null) {
1952           state.anchorMap[state.anchor] = state.result;
1953         }
1954       }
1955     } else if (indentStatus === 0) {
1956       // Special case: block sequences are allowed to have same indentation level as the parent.
1957       // http://www.yaml.org/spec/1.2/spec.html#id2799784
1958       hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1959     }
1960   }
1961
1962   if (state.tag !== null && state.tag !== '!') {
1963     if (state.tag === '?') {
1964       // Implicit resolving is not allowed for non-scalar types, and '?'
1965       // non-specific tag is only automatically assigned to plain scalars.
1966       //
1967       // We only need to check kind conformity in case user explicitly assigns '?'
1968       // tag, for example like this: "!<?> [0]"
1969       //
1970       if (state.result !== null && state.kind !== 'scalar') {
1971         throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
1972       }
1973
1974       for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1975         type = state.implicitTypes[typeIndex];
1976
1977         if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
1978           state.result = type.construct(state.result);
1979           state.tag = type.tag;
1980           if (state.anchor !== null) {
1981             state.anchorMap[state.anchor] = state.result;
1982           }
1983           break;
1984         }
1985       }
1986     } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
1987       type = state.typeMap[state.kind || 'fallback'][state.tag];
1988
1989       if (state.result !== null && type.kind !== state.kind) {
1990         throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
1991       }
1992
1993       if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
1994         throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
1995       } else {
1996         state.result = type.construct(state.result);
1997         if (state.anchor !== null) {
1998           state.anchorMap[state.anchor] = state.result;
1999         }
2000       }
2001     } else {
2002       throwError(state, 'unknown tag !<' + state.tag + '>');
2003     }
2004   }
2005
2006   if (state.listener !== null) {
2007     state.listener('close', state);
2008   }
2009   return state.tag !== null ||  state.anchor !== null || hasContent;
2010 }
2011
2012 function readDocument(state) {
2013   var documentStart = state.position,
2014       _position,
2015       directiveName,
2016       directiveArgs,
2017       hasDirectives = false,
2018       ch;
2019
2020   state.version = null;
2021   state.checkLineBreaks = state.legacy;
2022   state.tagMap = {};
2023   state.anchorMap = {};
2024
2025   while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2026     skipSeparationSpace(state, true, -1);
2027
2028     ch = state.input.charCodeAt(state.position);
2029
2030     if (state.lineIndent > 0 || ch !== 0x25/* % */) {
2031       break;
2032     }
2033
2034     hasDirectives = true;
2035     ch = state.input.charCodeAt(++state.position);
2036     _position = state.position;
2037
2038     while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2039       ch = state.input.charCodeAt(++state.position);
2040     }
2041
2042     directiveName = state.input.slice(_position, state.position);
2043     directiveArgs = [];
2044
2045     if (directiveName.length < 1) {
2046       throwError(state, 'directive name must not be less than one character in length');
2047     }
2048
2049     while (ch !== 0) {
2050       while (is_WHITE_SPACE(ch)) {
2051         ch = state.input.charCodeAt(++state.position);
2052       }
2053
2054       if (ch === 0x23/* # */) {
2055         do { ch = state.input.charCodeAt(++state.position); }
2056         while (ch !== 0 && !is_EOL(ch));
2057         break;
2058       }
2059
2060       if (is_EOL(ch)) break;
2061
2062       _position = state.position;
2063
2064       while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2065         ch = state.input.charCodeAt(++state.position);
2066       }
2067
2068       directiveArgs.push(state.input.slice(_position, state.position));
2069     }
2070
2071     if (ch !== 0) readLineBreak(state);
2072
2073     if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
2074       directiveHandlers[directiveName](state, directiveName, directiveArgs);
2075     } else {
2076       throwWarning(state, 'unknown document directive "' + directiveName + '"');
2077     }
2078   }
2079
2080   skipSeparationSpace(state, true, -1);
2081
2082   if (state.lineIndent === 0 &&
2083       state.input.charCodeAt(state.position)     === 0x2D/* - */ &&
2084       state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
2085       state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
2086     state.position += 3;
2087     skipSeparationSpace(state, true, -1);
2088
2089   } else if (hasDirectives) {
2090     throwError(state, 'directives end mark is expected');
2091   }
2092
2093   composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2094   skipSeparationSpace(state, true, -1);
2095
2096   if (state.checkLineBreaks &&
2097       PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
2098     throwWarning(state, 'non-ASCII line breaks are interpreted as content');
2099   }
2100
2101   state.documents.push(state.result);
2102
2103   if (state.position === state.lineStart && testDocumentSeparator(state)) {
2104
2105     if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
2106       state.position += 3;
2107       skipSeparationSpace(state, true, -1);
2108     }
2109     return;
2110   }
2111
2112   if (state.position < (state.length - 1)) {
2113     throwError(state, 'end of the stream or a document separator is expected');
2114   } else {
2115     return;
2116   }
2117 }
2118
2119
2120 function loadDocuments(input, options) {
2121   input = String(input);
2122   options = options || {};
2123
2124   if (input.length !== 0) {
2125
2126     // Add tailing `\n` if not exists
2127     if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
2128         input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
2129       input += '\n';
2130     }
2131
2132     // Strip BOM
2133     if (input.charCodeAt(0) === 0xFEFF) {
2134       input = input.slice(1);
2135     }
2136   }
2137
2138   var state = new State(input, options);
2139
2140   var nullpos = input.indexOf('\0');
2141
2142   if (nullpos !== -1) {
2143     state.position = nullpos;
2144     throwError(state, 'null byte is not allowed in input');
2145   }
2146
2147   // Use 0 as string terminator. That significantly simplifies bounds check.
2148   state.input += '\0';
2149
2150   while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
2151     state.lineIndent += 1;
2152     state.position += 1;
2153   }
2154
2155   while (state.position < (state.length - 1)) {
2156     readDocument(state);
2157   }
2158
2159   return state.documents;
2160 }
2161
2162
2163 function loadAll(input, iterator, options) {
2164   if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
2165     options = iterator;
2166     iterator = null;
2167   }
2168
2169   var documents = loadDocuments(input, options);
2170
2171   if (typeof iterator !== 'function') {
2172     return documents;
2173   }
2174
2175   for (var index = 0, length = documents.length; index < length; index += 1) {
2176     iterator(documents[index]);
2177   }
2178 }
2179
2180
2181 function load(input, options) {
2182   var documents = loadDocuments(input, options);
2183
2184   if (documents.length === 0) {
2185     /*eslint-disable no-undefined*/
2186     return undefined;
2187   } else if (documents.length === 1) {
2188     return documents[0];
2189   }
2190   throw new YAMLException('expected a single document in the stream, but found more');
2191 }
2192
2193
2194 function safeLoadAll(input, iterator, options) {
2195   if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
2196     options = iterator;
2197     iterator = null;
2198   }
2199
2200   return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2201 }
2202
2203
2204 function safeLoad(input, options) {
2205   return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2206 }
2207
2208
2209 module.exports.loadAll     = loadAll;
2210 module.exports.load        = load;
2211 module.exports.safeLoadAll = safeLoadAll;
2212 module.exports.safeLoad    = safeLoad;
2213
2214
2215 /***/ }),
2216 /* 8 */
2217 /***/ (function(module, exports, __webpack_require__) {
2218
2219 "use strict";
2220
2221
2222
2223 function isNothing(subject) {
2224   return (typeof subject === 'undefined') || (subject === null);
2225 }
2226
2227
2228 function isObject(subject) {
2229   return (typeof subject === 'object') && (subject !== null);
2230 }
2231
2232
2233 function toArray(sequence) {
2234   if (Array.isArray(sequence)) return sequence;
2235   else if (isNothing(sequence)) return [];
2236
2237   return [ sequence ];
2238 }
2239
2240
2241 function extend(target, source) {
2242   var index, length, key, sourceKeys;
2243
2244   if (source) {
2245     sourceKeys = Object.keys(source);
2246
2247     for (index = 0, length = sourceKeys.length; index < length; index += 1) {
2248       key = sourceKeys[index];
2249       target[key] = source[key];
2250     }
2251   }
2252
2253   return target;
2254 }
2255
2256
2257 function repeat(string, count) {
2258   var result = '', cycle;
2259
2260   for (cycle = 0; cycle < count; cycle += 1) {
2261     result += string;
2262   }
2263
2264   return result;
2265 }
2266
2267
2268 function isNegativeZero(number) {
2269   return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
2270 }
2271
2272
2273 module.exports.isNothing      = isNothing;
2274 module.exports.isObject       = isObject;
2275 module.exports.toArray        = toArray;
2276 module.exports.repeat         = repeat;
2277 module.exports.isNegativeZero = isNegativeZero;
2278 module.exports.extend         = extend;
2279
2280
2281 /***/ }),
2282 /* 9 */
2283 /***/ (function(module, exports, __webpack_require__) {
2284
2285 "use strict";
2286 // YAML error class. http://stackoverflow.com/questions/8458984
2287 //
2288
2289
2290 function YAMLException(reason, mark) {
2291   // Super constructor
2292   Error.call(this);
2293
2294   this.name = 'YAMLException';
2295   this.reason = reason;
2296   this.mark = mark;
2297   this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
2298
2299   // Include stack trace in error object
2300   if (Error.captureStackTrace) {
2301     // Chrome and NodeJS
2302     Error.captureStackTrace(this, this.constructor);
2303   } else {
2304     // FF, IE 10+ and Safari 6+. Fallback for others
2305     this.stack = (new Error()).stack || '';
2306   }
2307 }
2308
2309
2310 // Inherit from Error
2311 YAMLException.prototype = Object.create(Error.prototype);
2312 YAMLException.prototype.constructor = YAMLException;
2313
2314
2315 YAMLException.prototype.toString = function toString(compact) {
2316   var result = this.name + ': ';
2317
2318   result += this.reason || '(unknown reason)';
2319
2320   if (!compact && this.mark) {
2321     result += ' ' + this.mark.toString();
2322   }
2323
2324   return result;
2325 };
2326
2327
2328 module.exports = YAMLException;
2329
2330
2331 /***/ }),
2332 /* 10 */
2333 /***/ (function(module, exports, __webpack_require__) {
2334
2335 "use strict";
2336
2337
2338
2339 var common = __webpack_require__(8);
2340
2341
2342 function Mark(name, buffer, position, line, column) {
2343   this.name     = name;
2344   this.buffer   = buffer;
2345   this.position = position;
2346   this.line     = line;
2347   this.column   = column;
2348 }
2349
2350
2351 Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
2352   var head, start, tail, end, snippet;
2353
2354   if (!this.buffer) return null;
2355
2356   indent = indent || 4;
2357   maxLength = maxLength || 75;
2358
2359   head = '';
2360   start = this.position;
2361
2362   while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
2363     start -= 1;
2364     if (this.position - start > (maxLength / 2 - 1)) {
2365       head = ' ... ';
2366       start += 5;
2367       break;
2368     }
2369   }
2370
2371   tail = '';
2372   end = this.position;
2373
2374   while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
2375     end += 1;
2376     if (end - this.position > (maxLength / 2 - 1)) {
2377       tail = ' ... ';
2378       end -= 5;
2379       break;
2380     }
2381   }
2382
2383   snippet = this.buffer.slice(start, end);
2384
2385   return common.repeat(' ', indent) + head + snippet + tail + '\n' +
2386          common.repeat(' ', indent + this.position - start + head.length) + '^';
2387 };
2388
2389
2390 Mark.prototype.toString = function toString(compact) {
2391   var snippet, where = '';
2392
2393   if (this.name) {
2394     where += 'in "' + this.name + '" ';
2395   }
2396
2397   where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
2398
2399   if (!compact) {
2400     snippet = this.getSnippet();
2401
2402     if (snippet) {
2403       where += ':\n' + snippet;
2404     }
2405   }
2406
2407   return where;
2408 };
2409
2410
2411 module.exports = Mark;
2412
2413
2414 /***/ }),
2415 /* 11 */
2416 /***/ (function(module, exports, __webpack_require__) {
2417
2418 "use strict";
2419 // JS-YAML's default schema for `safeLoad` function.
2420 // It is not described in the YAML specification.
2421 //
2422 // This schema is based on standard YAML's Core schema and includes most of
2423 // extra types described at YAML tag repository. (http://yaml.org/type/)
2424
2425
2426
2427
2428
2429 var Schema = __webpack_require__(12);
2430
2431
2432 module.exports = new Schema({
2433   include: [
2434     __webpack_require__(14)
2435   ],
2436   implicit: [
2437     __webpack_require__(24),
2438     __webpack_require__(25)
2439   ],
2440   explicit: [
2441     __webpack_require__(26),
2442     __webpack_require__(28),
2443     __webpack_require__(29),
2444     __webpack_require__(30)
2445   ]
2446 });
2447
2448
2449 /***/ }),
2450 /* 12 */
2451 /***/ (function(module, exports, __webpack_require__) {
2452
2453 "use strict";
2454
2455
2456 /*eslint-disable max-len*/
2457
2458 var common        = __webpack_require__(8);
2459 var YAMLException = __webpack_require__(9);
2460 var Type          = __webpack_require__(13);
2461
2462
2463 function compileList(schema, name, result) {
2464   var exclude = [];
2465
2466   schema.include.forEach(function (includedSchema) {
2467     result = compileList(includedSchema, name, result);
2468   });
2469
2470   schema[name].forEach(function (currentType) {
2471     result.forEach(function (previousType, previousIndex) {
2472       if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
2473         exclude.push(previousIndex);
2474       }
2475     });
2476
2477     result.push(currentType);
2478   });
2479
2480   return result.filter(function (type, index) {
2481     return exclude.indexOf(index) === -1;
2482   });
2483 }
2484
2485
2486 function compileMap(/* lists... */) {
2487   var result = {
2488         scalar: {},
2489         sequence: {},
2490         mapping: {},
2491         fallback: {}
2492       }, index, length;
2493
2494   function collectType(type) {
2495     result[type.kind][type.tag] = result['fallback'][type.tag] = type;
2496   }
2497
2498   for (index = 0, length = arguments.length; index < length; index += 1) {
2499     arguments[index].forEach(collectType);
2500   }
2501   return result;
2502 }
2503
2504
2505 function Schema(definition) {
2506   this.include  = definition.include  || [];
2507   this.implicit = definition.implicit || [];
2508   this.explicit = definition.explicit || [];
2509
2510   this.implicit.forEach(function (type) {
2511     if (type.loadKind && type.loadKind !== 'scalar') {
2512       throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
2513     }
2514   });
2515
2516   this.compiledImplicit = compileList(this, 'implicit', []);
2517   this.compiledExplicit = compileList(this, 'explicit', []);
2518   this.compiledTypeMap  = compileMap(this.compiledImplicit, this.compiledExplicit);
2519 }
2520
2521
2522 Schema.DEFAULT = null;
2523
2524
2525 Schema.create = function createSchema() {
2526   var schemas, types;
2527
2528   switch (arguments.length) {
2529     case 1:
2530       schemas = Schema.DEFAULT;
2531       types = arguments[0];
2532       break;
2533
2534     case 2:
2535       schemas = arguments[0];
2536       types = arguments[1];
2537       break;
2538
2539     default:
2540       throw new YAMLException('Wrong number of arguments for Schema.create function');
2541   }
2542
2543   schemas = common.toArray(schemas);
2544   types = common.toArray(types);
2545
2546   if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
2547     throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
2548   }
2549
2550   if (!types.every(function (type) { return type instanceof Type; })) {
2551     throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
2552   }
2553
2554   return new Schema({
2555     include: schemas,
2556     explicit: types
2557   });
2558 };
2559
2560
2561 module.exports = Schema;
2562
2563
2564 /***/ }),
2565 /* 13 */
2566 /***/ (function(module, exports, __webpack_require__) {
2567
2568 "use strict";
2569
2570
2571 var YAMLException = __webpack_require__(9);
2572
2573 var TYPE_CONSTRUCTOR_OPTIONS = [
2574   'kind',
2575   'resolve',
2576   'construct',
2577   'instanceOf',
2578   'predicate',
2579   'represent',
2580   'defaultStyle',
2581   'styleAliases'
2582 ];
2583
2584 var YAML_NODE_KINDS = [
2585   'scalar',
2586   'sequence',
2587   'mapping'
2588 ];
2589
2590 function compileStyleAliases(map) {
2591   var result = {};
2592
2593   if (map !== null) {
2594     Object.keys(map).forEach(function (style) {
2595       map[style].forEach(function (alias) {
2596         result[String(alias)] = style;
2597       });
2598     });
2599   }
2600
2601   return result;
2602 }
2603
2604 function Type(tag, options) {
2605   options = options || {};
2606
2607   Object.keys(options).forEach(function (name) {
2608     if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
2609       throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
2610     }
2611   });
2612
2613   // TODO: Add tag format check.
2614   this.tag          = tag;
2615   this.kind         = options['kind']         || null;
2616   this.resolve      = options['resolve']      || function () { return true; };
2617   this.construct    = options['construct']    || function (data) { return data; };
2618   this.instanceOf   = options['instanceOf']   || null;
2619   this.predicate    = options['predicate']    || null;
2620   this.represent    = options['represent']    || null;
2621   this.defaultStyle = options['defaultStyle'] || null;
2622   this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
2623
2624   if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
2625     throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
2626   }
2627 }
2628
2629 module.exports = Type;
2630
2631
2632 /***/ }),
2633 /* 14 */
2634 /***/ (function(module, exports, __webpack_require__) {
2635
2636 "use strict";
2637 // Standard YAML's Core schema.
2638 // http://www.yaml.org/spec/1.2/spec.html#id2804923
2639 //
2640 // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2641 // So, Core schema has no distinctions from JSON schema is JS-YAML.
2642
2643
2644
2645
2646
2647 var Schema = __webpack_require__(12);
2648
2649
2650 module.exports = new Schema({
2651   include: [
2652     __webpack_require__(15)
2653   ]
2654 });
2655
2656
2657 /***/ }),
2658 /* 15 */
2659 /***/ (function(module, exports, __webpack_require__) {
2660
2661 "use strict";
2662 // Standard YAML's JSON schema.
2663 // http://www.yaml.org/spec/1.2/spec.html#id2803231
2664 //
2665 // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2666 // So, this schema is not such strict as defined in the YAML specification.
2667 // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
2668
2669
2670
2671
2672
2673 var Schema = __webpack_require__(12);
2674
2675
2676 module.exports = new Schema({
2677   include: [
2678     __webpack_require__(16)
2679   ],
2680   implicit: [
2681     __webpack_require__(20),
2682     __webpack_require__(21),
2683     __webpack_require__(22),
2684     __webpack_require__(23)
2685   ]
2686 });
2687
2688
2689 /***/ }),
2690 /* 16 */
2691 /***/ (function(module, exports, __webpack_require__) {
2692
2693 "use strict";
2694 // Standard YAML's Failsafe schema.
2695 // http://www.yaml.org/spec/1.2/spec.html#id2802346
2696
2697
2698
2699
2700
2701 var Schema = __webpack_require__(12);
2702
2703
2704 module.exports = new Schema({
2705   explicit: [
2706     __webpack_require__(17),
2707     __webpack_require__(18),
2708     __webpack_require__(19)
2709   ]
2710 });
2711
2712
2713 /***/ }),
2714 /* 17 */
2715 /***/ (function(module, exports, __webpack_require__) {
2716
2717 "use strict";
2718
2719
2720 var Type = __webpack_require__(13);
2721
2722 module.exports = new Type('tag:yaml.org,2002:str', {
2723   kind: 'scalar',
2724   construct: function (data) { return data !== null ? data : ''; }
2725 });
2726
2727
2728 /***/ }),
2729 /* 18 */
2730 /***/ (function(module, exports, __webpack_require__) {
2731
2732 "use strict";
2733
2734
2735 var Type = __webpack_require__(13);
2736
2737 module.exports = new Type('tag:yaml.org,2002:seq', {
2738   kind: 'sequence',
2739   construct: function (data) { return data !== null ? data : []; }
2740 });
2741
2742
2743 /***/ }),
2744 /* 19 */
2745 /***/ (function(module, exports, __webpack_require__) {
2746
2747 "use strict";
2748
2749
2750 var Type = __webpack_require__(13);
2751
2752 module.exports = new Type('tag:yaml.org,2002:map', {
2753   kind: 'mapping',
2754   construct: function (data) { return data !== null ? data : {}; }
2755 });
2756
2757
2758 /***/ }),
2759 /* 20 */
2760 /***/ (function(module, exports, __webpack_require__) {
2761
2762 "use strict";
2763
2764
2765 var Type = __webpack_require__(13);
2766
2767 function resolveYamlNull(data) {
2768   if (data === null) return true;
2769
2770   var max = data.length;
2771
2772   return (max === 1 && data === '~') ||
2773          (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
2774 }
2775
2776 function constructYamlNull() {
2777   return null;
2778 }
2779
2780 function isNull(object) {
2781   return object === null;
2782 }
2783
2784 module.exports = new Type('tag:yaml.org,2002:null', {
2785   kind: 'scalar',
2786   resolve: resolveYamlNull,
2787   construct: constructYamlNull,
2788   predicate: isNull,
2789   represent: {
2790     canonical: function () { return '~';    },
2791     lowercase: function () { return 'null'; },
2792     uppercase: function () { return 'NULL'; },
2793     camelcase: function () { return 'Null'; }
2794   },
2795   defaultStyle: 'lowercase'
2796 });
2797
2798
2799 /***/ }),
2800 /* 21 */
2801 /***/ (function(module, exports, __webpack_require__) {
2802
2803 "use strict";
2804
2805
2806 var Type = __webpack_require__(13);
2807
2808 function resolveYamlBoolean(data) {
2809   if (data === null) return false;
2810
2811   var max = data.length;
2812
2813   return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
2814          (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
2815 }
2816
2817 function constructYamlBoolean(data) {
2818   return data === 'true' ||
2819          data === 'True' ||
2820          data === 'TRUE';
2821 }
2822
2823 function isBoolean(object) {
2824   return Object.prototype.toString.call(object) === '[object Boolean]';
2825 }
2826
2827 module.exports = new Type('tag:yaml.org,2002:bool', {
2828   kind: 'scalar',
2829   resolve: resolveYamlBoolean,
2830   construct: constructYamlBoolean,
2831   predicate: isBoolean,
2832   represent: {
2833     lowercase: function (object) { return object ? 'true' : 'false'; },
2834     uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
2835     camelcase: function (object) { return object ? 'True' : 'False'; }
2836   },
2837   defaultStyle: 'lowercase'
2838 });
2839
2840
2841 /***/ }),
2842 /* 22 */
2843 /***/ (function(module, exports, __webpack_require__) {
2844
2845 "use strict";
2846
2847
2848 var common = __webpack_require__(8);
2849 var Type   = __webpack_require__(13);
2850
2851 function isHexCode(c) {
2852   return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
2853          ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
2854          ((0x61/* a */ <= c) && (c <= 0x66/* f */));
2855 }
2856
2857 function isOctCode(c) {
2858   return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
2859 }
2860
2861 function isDecCode(c) {
2862   return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
2863 }
2864
2865 function resolveYamlInteger(data) {
2866   if (data === null) return false;
2867
2868   var max = data.length,
2869       index = 0,
2870       hasDigits = false,
2871       ch;
2872
2873   if (!max) return false;
2874
2875   ch = data[index];
2876
2877   // sign
2878   if (ch === '-' || ch === '+') {
2879     ch = data[++index];
2880   }
2881
2882   if (ch === '0') {
2883     // 0
2884     if (index + 1 === max) return true;
2885     ch = data[++index];
2886
2887     // base 2, base 8, base 16
2888
2889     if (ch === 'b') {
2890       // base 2
2891       index++;
2892
2893       for (; index < max; index++) {
2894         ch = data[index];
2895         if (ch === '_') continue;
2896         if (ch !== '0' && ch !== '1') return false;
2897         hasDigits = true;
2898       }
2899       return hasDigits && ch !== '_';
2900     }
2901
2902
2903     if (ch === 'x') {
2904       // base 16
2905       index++;
2906
2907       for (; index < max; index++) {
2908         ch = data[index];
2909         if (ch === '_') continue;
2910         if (!isHexCode(data.charCodeAt(index))) return false;
2911         hasDigits = true;
2912       }
2913       return hasDigits && ch !== '_';
2914     }
2915
2916     // base 8
2917     for (; index < max; index++) {
2918       ch = data[index];
2919       if (ch === '_') continue;
2920       if (!isOctCode(data.charCodeAt(index))) return false;
2921       hasDigits = true;
2922     }
2923     return hasDigits && ch !== '_';
2924   }
2925
2926   // base 10 (except 0) or base 60
2927
2928   // value should not start with `_`;
2929   if (ch === '_') return false;
2930
2931   for (; index < max; index++) {
2932     ch = data[index];
2933     if (ch === '_') continue;
2934     if (ch === ':') break;
2935     if (!isDecCode(data.charCodeAt(index))) {
2936       return false;
2937     }
2938     hasDigits = true;
2939   }
2940
2941   // Should have digits and should not end with `_`
2942   if (!hasDigits || ch === '_') return false;
2943
2944   // if !base60 - done;
2945   if (ch !== ':') return true;
2946
2947   // base60 almost not used, no needs to optimize
2948   return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
2949 }
2950
2951 function constructYamlInteger(data) {
2952   var value = data, sign = 1, ch, base, digits = [];
2953
2954   if (value.indexOf('_') !== -1) {
2955     value = value.replace(/_/g, '');
2956   }
2957
2958   ch = value[0];
2959
2960   if (ch === '-' || ch === '+') {
2961     if (ch === '-') sign = -1;
2962     value = value.slice(1);
2963     ch = value[0];
2964   }
2965
2966   if (value === '0') return 0;
2967
2968   if (ch === '0') {
2969     if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
2970     if (value[1] === 'x') return sign * parseInt(value, 16);
2971     return sign * parseInt(value, 8);
2972   }
2973
2974   if (value.indexOf(':') !== -1) {
2975     value.split(':').forEach(function (v) {
2976       digits.unshift(parseInt(v, 10));
2977     });
2978
2979     value = 0;
2980     base = 1;
2981
2982     digits.forEach(function (d) {
2983       value += (d * base);
2984       base *= 60;
2985     });
2986
2987     return sign * value;
2988
2989   }
2990
2991   return sign * parseInt(value, 10);
2992 }
2993
2994 function isInteger(object) {
2995   return (Object.prototype.toString.call(object)) === '[object Number]' &&
2996          (object % 1 === 0 && !common.isNegativeZero(object));
2997 }
2998
2999 module.exports = new Type('tag:yaml.org,2002:int', {
3000   kind: 'scalar',
3001   resolve: resolveYamlInteger,
3002   construct: constructYamlInteger,
3003   predicate: isInteger,
3004   represent: {
3005     binary:      function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
3006     octal:       function (obj) { return obj >= 0 ? '0'  + obj.toString(8) : '-0'  + obj.toString(8).slice(1); },
3007     decimal:     function (obj) { return obj.toString(10); },
3008     /* eslint-disable max-len */
3009     hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() :  '-0x' + obj.toString(16).toUpperCase().slice(1); }
3010   },
3011   defaultStyle: 'decimal',
3012   styleAliases: {
3013     binary:      [ 2,  'bin' ],
3014     octal:       [ 8,  'oct' ],
3015     decimal:     [ 10, 'dec' ],
3016     hexadecimal: [ 16, 'hex' ]
3017   }
3018 });
3019
3020
3021 /***/ }),
3022 /* 23 */
3023 /***/ (function(module, exports, __webpack_require__) {
3024
3025 "use strict";
3026
3027
3028 var common = __webpack_require__(8);
3029 var Type   = __webpack_require__(13);
3030
3031 var YAML_FLOAT_PATTERN = new RegExp(
3032   // 2.5e4, 2.5 and integers
3033   '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
3034   // .2e4, .2
3035   // special case, seems not from spec
3036   '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
3037   // 20:59
3038   '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
3039   // .inf
3040   '|[-+]?\\.(?:inf|Inf|INF)' +
3041   // .nan
3042   '|\\.(?:nan|NaN|NAN))$');
3043
3044 function resolveYamlFloat(data) {
3045   if (data === null) return false;
3046
3047   if (!YAML_FLOAT_PATTERN.test(data) ||
3048       // Quick hack to not allow integers end with `_`
3049       // Probably should update regexp & check speed
3050       data[data.length - 1] === '_') {
3051     return false;
3052   }
3053
3054   return true;
3055 }
3056
3057 function constructYamlFloat(data) {
3058   var value, sign, base, digits;
3059
3060   value  = data.replace(/_/g, '').toLowerCase();
3061   sign   = value[0] === '-' ? -1 : 1;
3062   digits = [];
3063
3064   if ('+-'.indexOf(value[0]) >= 0) {
3065     value = value.slice(1);
3066   }
3067
3068   if (value === '.inf') {
3069     return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
3070
3071   } else if (value === '.nan') {
3072     return NaN;
3073
3074   } else if (value.indexOf(':') >= 0) {
3075     value.split(':').forEach(function (v) {
3076       digits.unshift(parseFloat(v, 10));
3077     });
3078
3079     value = 0.0;
3080     base = 1;
3081
3082     digits.forEach(function (d) {
3083       value += d * base;
3084       base *= 60;
3085     });
3086
3087     return sign * value;
3088
3089   }
3090   return sign * parseFloat(value, 10);
3091 }
3092
3093
3094 var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
3095
3096 function representYamlFloat(object, style) {
3097   var res;
3098
3099   if (isNaN(object)) {
3100     switch (style) {
3101       case 'lowercase': return '.nan';
3102       case 'uppercase': return '.NAN';
3103       case 'camelcase': return '.NaN';
3104     }
3105   } else if (Number.POSITIVE_INFINITY === object) {
3106     switch (style) {
3107       case 'lowercase': return '.inf';
3108       case 'uppercase': return '.INF';
3109       case 'camelcase': return '.Inf';
3110     }
3111   } else if (Number.NEGATIVE_INFINITY === object) {
3112     switch (style) {
3113       case 'lowercase': return '-.inf';
3114       case 'uppercase': return '-.INF';
3115       case 'camelcase': return '-.Inf';
3116     }
3117   } else if (common.isNegativeZero(object)) {
3118     return '-0.0';
3119   }
3120
3121   res = object.toString(10);
3122
3123   // JS stringifier can build scientific format without dots: 5e-100,
3124   // while YAML requres dot: 5.e-100. Fix it with simple hack
3125
3126   return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
3127 }
3128
3129 function isFloat(object) {
3130   return (Object.prototype.toString.call(object) === '[object Number]') &&
3131          (object % 1 !== 0 || common.isNegativeZero(object));
3132 }
3133
3134 module.exports = new Type('tag:yaml.org,2002:float', {
3135   kind: 'scalar',
3136   resolve: resolveYamlFloat,
3137   construct: constructYamlFloat,
3138   predicate: isFloat,
3139   represent: representYamlFloat,
3140   defaultStyle: 'lowercase'
3141 });
3142
3143
3144 /***/ }),
3145 /* 24 */
3146 /***/ (function(module, exports, __webpack_require__) {
3147
3148 "use strict";
3149
3150
3151 var Type = __webpack_require__(13);
3152
3153 var YAML_DATE_REGEXP = new RegExp(
3154   '^([0-9][0-9][0-9][0-9])'          + // [1] year
3155   '-([0-9][0-9])'                    + // [2] month
3156   '-([0-9][0-9])$');                   // [3] day
3157
3158 var YAML_TIMESTAMP_REGEXP = new RegExp(
3159   '^([0-9][0-9][0-9][0-9])'          + // [1] year
3160   '-([0-9][0-9]?)'                   + // [2] month
3161   '-([0-9][0-9]?)'                   + // [3] day
3162   '(?:[Tt]|[ \\t]+)'                 + // ...
3163   '([0-9][0-9]?)'                    + // [4] hour
3164   ':([0-9][0-9])'                    + // [5] minute
3165   ':([0-9][0-9])'                    + // [6] second
3166   '(?:\\.([0-9]*))?'                 + // [7] fraction
3167   '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
3168   '(?::([0-9][0-9]))?))?$');           // [11] tz_minute
3169
3170 function resolveYamlTimestamp(data) {
3171   if (data === null) return false;
3172   if (YAML_DATE_REGEXP.exec(data) !== null) return true;
3173   if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
3174   return false;
3175 }
3176
3177 function constructYamlTimestamp(data) {
3178   var match, year, month, day, hour, minute, second, fraction = 0,
3179       delta = null, tz_hour, tz_minute, date;
3180
3181   match = YAML_DATE_REGEXP.exec(data);
3182   if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
3183
3184   if (match === null) throw new Error('Date resolve error');
3185
3186   // match: [1] year [2] month [3] day
3187
3188   year = +(match[1]);
3189   month = +(match[2]) - 1; // JS month starts with 0
3190   day = +(match[3]);
3191
3192   if (!match[4]) { // no hour
3193     return new Date(Date.UTC(year, month, day));
3194   }
3195
3196   // match: [4] hour [5] minute [6] second [7] fraction
3197
3198   hour = +(match[4]);
3199   minute = +(match[5]);
3200   second = +(match[6]);
3201
3202   if (match[7]) {
3203     fraction = match[7].slice(0, 3);
3204     while (fraction.length < 3) { // milli-seconds
3205       fraction += '0';
3206     }
3207     fraction = +fraction;
3208   }
3209
3210   // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
3211
3212   if (match[9]) {
3213     tz_hour = +(match[10]);
3214     tz_minute = +(match[11] || 0);
3215     delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
3216     if (match[9] === '-') delta = -delta;
3217   }
3218
3219   date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
3220
3221   if (delta) date.setTime(date.getTime() - delta);
3222
3223   return date;
3224 }
3225
3226 function representYamlTimestamp(object /*, style*/) {
3227   return object.toISOString();
3228 }
3229
3230 module.exports = new Type('tag:yaml.org,2002:timestamp', {
3231   kind: 'scalar',
3232   resolve: resolveYamlTimestamp,
3233   construct: constructYamlTimestamp,
3234   instanceOf: Date,
3235   represent: representYamlTimestamp
3236 });
3237
3238
3239 /***/ }),
3240 /* 25 */
3241 /***/ (function(module, exports, __webpack_require__) {
3242
3243 "use strict";
3244
3245
3246 var Type = __webpack_require__(13);
3247
3248 function resolveYamlMerge(data) {
3249   return data === '<<' || data === null;
3250 }
3251
3252 module.exports = new Type('tag:yaml.org,2002:merge', {
3253   kind: 'scalar',
3254   resolve: resolveYamlMerge
3255 });
3256
3257
3258 /***/ }),
3259 /* 26 */
3260 /***/ (function(module, exports, __webpack_require__) {
3261
3262 "use strict";
3263 var require;
3264
3265 /*eslint-disable no-bitwise*/
3266
3267 var NodeBuffer;
3268
3269 try {
3270   // A trick for browserified version, to not include `Buffer` shim
3271   var _require = require;
3272   NodeBuffer = __webpack_require__(27).Buffer;
3273 } catch (__) {}
3274
3275 var Type       = __webpack_require__(13);
3276
3277
3278 // [ 64, 65, 66 ] -> [ padding, CR, LF ]
3279 var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
3280
3281
3282 function resolveYamlBinary(data) {
3283   if (data === null) return false;
3284
3285   var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
3286
3287   // Convert one by one.
3288   for (idx = 0; idx < max; idx++) {
3289     code = map.indexOf(data.charAt(idx));
3290
3291     // Skip CR/LF
3292     if (code > 64) continue;
3293
3294     // Fail on illegal characters
3295     if (code < 0) return false;
3296
3297     bitlen += 6;
3298   }
3299
3300   // If there are any bits left, source was corrupted
3301   return (bitlen % 8) === 0;
3302 }
3303
3304 function constructYamlBinary(data) {
3305   var idx, tailbits,
3306       input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
3307       max = input.length,
3308       map = BASE64_MAP,
3309       bits = 0,
3310       result = [];
3311
3312   // Collect by 6*4 bits (3 bytes)
3313
3314   for (idx = 0; idx < max; idx++) {
3315     if ((idx % 4 === 0) && idx) {
3316       result.push((bits >> 16) & 0xFF);
3317       result.push((bits >> 8) & 0xFF);
3318       result.push(bits & 0xFF);
3319     }
3320
3321     bits = (bits << 6) | map.indexOf(input.charAt(idx));
3322   }
3323
3324   // Dump tail
3325
3326   tailbits = (max % 4) * 6;
3327
3328   if (tailbits === 0) {
3329     result.push((bits >> 16) & 0xFF);
3330     result.push((bits >> 8) & 0xFF);
3331     result.push(bits & 0xFF);
3332   } else if (tailbits === 18) {
3333     result.push((bits >> 10) & 0xFF);
3334     result.push((bits >> 2) & 0xFF);
3335   } else if (tailbits === 12) {
3336     result.push((bits >> 4) & 0xFF);
3337   }
3338
3339   // Wrap into Buffer for NodeJS and leave Array for browser
3340   if (NodeBuffer) {
3341     // Support node 6.+ Buffer API when available
3342     return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
3343   }
3344
3345   return result;
3346 }
3347
3348 function representYamlBinary(object /*, style*/) {
3349   var result = '', bits = 0, idx, tail,
3350       max = object.length,
3351       map = BASE64_MAP;
3352
3353   // Convert every three bytes to 4 ASCII characters.
3354
3355   for (idx = 0; idx < max; idx++) {
3356     if ((idx % 3 === 0) && idx) {
3357       result += map[(bits >> 18) & 0x3F];
3358       result += map[(bits >> 12) & 0x3F];
3359       result += map[(bits >> 6) & 0x3F];
3360       result += map[bits & 0x3F];
3361     }
3362
3363     bits = (bits << 8) + object[idx];
3364   }
3365
3366   // Dump tail
3367
3368   tail = max % 3;
3369
3370   if (tail === 0) {
3371     result += map[(bits >> 18) & 0x3F];
3372     result += map[(bits >> 12) & 0x3F];
3373     result += map[(bits >> 6) & 0x3F];
3374     result += map[bits & 0x3F];
3375   } else if (tail === 2) {
3376     result += map[(bits >> 10) & 0x3F];
3377     result += map[(bits >> 4) & 0x3F];
3378     result += map[(bits << 2) & 0x3F];
3379     result += map[64];
3380   } else if (tail === 1) {
3381     result += map[(bits >> 2) & 0x3F];
3382     result += map[(bits << 4) & 0x3F];
3383     result += map[64];
3384     result += map[64];
3385   }
3386
3387   return result;
3388 }
3389
3390 function isBinary(object) {
3391   return NodeBuffer && NodeBuffer.isBuffer(object);
3392 }
3393
3394 module.exports = new Type('tag:yaml.org,2002:binary', {
3395   kind: 'scalar',
3396   resolve: resolveYamlBinary,
3397   construct: constructYamlBinary,
3398   predicate: isBinary,
3399   represent: representYamlBinary
3400 });
3401
3402
3403 /***/ }),
3404 /* 27 */
3405 /***/ (function(module, exports) {
3406
3407 module.exports = require("buffer");
3408
3409 /***/ }),
3410 /* 28 */
3411 /***/ (function(module, exports, __webpack_require__) {
3412
3413 "use strict";
3414
3415
3416 var Type = __webpack_require__(13);
3417
3418 var _hasOwnProperty = Object.prototype.hasOwnProperty;
3419 var _toString       = Object.prototype.toString;
3420
3421 function resolveYamlOmap(data) {
3422   if (data === null) return true;
3423
3424   var objectKeys = [], index, length, pair, pairKey, pairHasKey,
3425       object = data;
3426
3427   for (index = 0, length = object.length; index < length; index += 1) {
3428     pair = object[index];
3429     pairHasKey = false;
3430
3431     if (_toString.call(pair) !== '[object Object]') return false;
3432
3433     for (pairKey in pair) {
3434       if (_hasOwnProperty.call(pair, pairKey)) {
3435         if (!pairHasKey) pairHasKey = true;
3436         else return false;
3437       }
3438     }
3439
3440     if (!pairHasKey) return false;
3441
3442     if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
3443     else return false;
3444   }
3445
3446   return true;
3447 }
3448
3449 function constructYamlOmap(data) {
3450   return data !== null ? data : [];
3451 }
3452
3453 module.exports = new Type('tag:yaml.org,2002:omap', {
3454   kind: 'sequence',
3455   resolve: resolveYamlOmap,
3456   construct: constructYamlOmap
3457 });
3458
3459
3460 /***/ }),
3461 /* 29 */
3462 /***/ (function(module, exports, __webpack_require__) {
3463
3464 "use strict";
3465
3466
3467 var Type = __webpack_require__(13);
3468
3469 var _toString = Object.prototype.toString;
3470
3471 function resolveYamlPairs(data) {
3472   if (data === null) return true;
3473
3474   var index, length, pair, keys, result,
3475       object = data;
3476
3477   result = new Array(object.length);
3478
3479   for (index = 0, length = object.length; index < length; index += 1) {
3480     pair = object[index];
3481
3482     if (_toString.call(pair) !== '[object Object]') return false;
3483
3484     keys = Object.keys(pair);
3485
3486     if (keys.length !== 1) return false;
3487
3488     result[index] = [ keys[0], pair[keys[0]] ];
3489   }
3490
3491   return true;
3492 }
3493
3494 function constructYamlPairs(data) {
3495   if (data === null) return [];
3496
3497   var index, length, pair, keys, result,
3498       object = data;
3499
3500   result = new Array(object.length);
3501
3502   for (index = 0, length = object.length; index < length; index += 1) {
3503     pair = object[index];
3504
3505     keys = Object.keys(pair);
3506
3507     result[index] = [ keys[0], pair[keys[0]] ];
3508   }
3509
3510   return result;
3511 }
3512
3513 module.exports = new Type('tag:yaml.org,2002:pairs', {
3514   kind: 'sequence',
3515   resolve: resolveYamlPairs,
3516   construct: constructYamlPairs
3517 });
3518
3519
3520 /***/ }),
3521 /* 30 */
3522 /***/ (function(module, exports, __webpack_require__) {
3523
3524 "use strict";
3525
3526
3527 var Type = __webpack_require__(13);
3528
3529 var _hasOwnProperty = Object.prototype.hasOwnProperty;
3530
3531 function resolveYamlSet(data) {
3532   if (data === null) return true;
3533
3534   var key, object = data;
3535
3536   for (key in object) {
3537     if (_hasOwnProperty.call(object, key)) {
3538       if (object[key] !== null) return false;
3539     }
3540   }
3541
3542   return true;
3543 }
3544
3545 function constructYamlSet(data) {
3546   return data !== null ? data : {};
3547 }
3548
3549 module.exports = new Type('tag:yaml.org,2002:set', {
3550   kind: 'mapping',
3551   resolve: resolveYamlSet,
3552   construct: constructYamlSet
3553 });
3554
3555
3556 /***/ }),
3557 /* 31 */
3558 /***/ (function(module, exports, __webpack_require__) {
3559
3560 "use strict";
3561 // JS-YAML's default schema for `load` function.
3562 // It is not described in the YAML specification.
3563 //
3564 // This schema is based on JS-YAML's default safe schema and includes
3565 // JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
3566 //
3567 // Also this schema is used as default base schema at `Schema.create` function.
3568
3569
3570
3571
3572
3573 var Schema = __webpack_require__(12);
3574
3575
3576 module.exports = Schema.DEFAULT = new Schema({
3577   include: [
3578     __webpack_require__(11)
3579   ],
3580   explicit: [
3581     __webpack_require__(32),
3582     __webpack_require__(33),
3583     __webpack_require__(34)
3584   ]
3585 });
3586
3587
3588 /***/ }),
3589 /* 32 */
3590 /***/ (function(module, exports, __webpack_require__) {
3591
3592 "use strict";
3593
3594
3595 var Type = __webpack_require__(13);
3596
3597 function resolveJavascriptUndefined() {
3598   return true;
3599 }
3600
3601 function constructJavascriptUndefined() {
3602   /*eslint-disable no-undefined*/
3603   return undefined;
3604 }
3605
3606 function representJavascriptUndefined() {
3607   return '';
3608 }
3609
3610 function isUndefined(object) {
3611   return typeof object === 'undefined';
3612 }
3613
3614 module.exports = new Type('tag:yaml.org,2002:js/undefined', {
3615   kind: 'scalar',
3616   resolve: resolveJavascriptUndefined,
3617   construct: constructJavascriptUndefined,
3618   predicate: isUndefined,
3619   represent: representJavascriptUndefined
3620 });
3621
3622
3623 /***/ }),
3624 /* 33 */
3625 /***/ (function(module, exports, __webpack_require__) {
3626
3627 "use strict";
3628
3629
3630 var Type = __webpack_require__(13);
3631
3632 function resolveJavascriptRegExp(data) {
3633   if (data === null) return false;
3634   if (data.length === 0) return false;
3635
3636   var regexp = data,
3637       tail   = /\/([gim]*)$/.exec(data),
3638       modifiers = '';
3639
3640   // if regexp starts with '/' it can have modifiers and must be properly closed
3641   // `/foo/gim` - modifiers tail can be maximum 3 chars
3642   if (regexp[0] === '/') {
3643     if (tail) modifiers = tail[1];
3644
3645     if (modifiers.length > 3) return false;
3646     // if expression starts with /, is should be properly terminated
3647     if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
3648   }
3649
3650   return true;
3651 }
3652
3653 function constructJavascriptRegExp(data) {
3654   var regexp = data,
3655       tail   = /\/([gim]*)$/.exec(data),
3656       modifiers = '';
3657
3658   // `/foo/gim` - tail can be maximum 4 chars
3659   if (regexp[0] === '/') {
3660     if (tail) modifiers = tail[1];
3661     regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
3662   }
3663
3664   return new RegExp(regexp, modifiers);
3665 }
3666
3667 function representJavascriptRegExp(object /*, style*/) {
3668   var result = '/' + object.source + '/';
3669
3670   if (object.global) result += 'g';
3671   if (object.multiline) result += 'm';
3672   if (object.ignoreCase) result += 'i';
3673
3674   return result;
3675 }
3676
3677 function isRegExp(object) {
3678   return Object.prototype.toString.call(object) === '[object RegExp]';
3679 }
3680
3681 module.exports = new Type('tag:yaml.org,2002:js/regexp', {
3682   kind: 'scalar',
3683   resolve: resolveJavascriptRegExp,
3684   construct: constructJavascriptRegExp,
3685   predicate: isRegExp,
3686   represent: representJavascriptRegExp
3687 });
3688
3689
3690 /***/ }),
3691 /* 34 */
3692 /***/ (function(module, exports, __webpack_require__) {
3693
3694 "use strict";
3695 var require;
3696
3697 var esprima;
3698
3699 // Browserified version does not have esprima
3700 //
3701 // 1. For node.js just require module as deps
3702 // 2. For browser try to require mudule via external AMD system.
3703 //    If not found - try to fallback to window.esprima. If not
3704 //    found too - then fail to parse.
3705 //
3706 try {
3707   // workaround to exclude package from browserify list.
3708   var _require = require;
3709   esprima = __webpack_require__(35);
3710 } catch (_) {
3711   /* eslint-disable no-redeclare */
3712   /* global window */
3713   if (typeof window !== 'undefined') esprima = window.esprima;
3714 }
3715
3716 var Type = __webpack_require__(13);
3717
3718 function resolveJavascriptFunction(data) {
3719   if (data === null) return false;
3720
3721   try {
3722     var source = '(' + data + ')',
3723         ast    = esprima.parse(source, { range: true });
3724
3725     if (ast.type                    !== 'Program'             ||
3726         ast.body.length             !== 1                     ||
3727         ast.body[0].type            !== 'ExpressionStatement' ||
3728         (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
3729           ast.body[0].expression.type !== 'FunctionExpression')) {
3730       return false;
3731     }
3732
3733     return true;
3734   } catch (err) {
3735     return false;
3736   }
3737 }
3738
3739 function constructJavascriptFunction(data) {
3740   /*jslint evil:true*/
3741
3742   var source = '(' + data + ')',
3743       ast    = esprima.parse(source, { range: true }),
3744       params = [],
3745       body;
3746
3747   if (ast.type                    !== 'Program'             ||
3748       ast.body.length             !== 1                     ||
3749       ast.body[0].type            !== 'ExpressionStatement' ||
3750       (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
3751         ast.body[0].expression.type !== 'FunctionExpression')) {
3752     throw new Error('Failed to resolve function');
3753   }
3754
3755   ast.body[0].expression.params.forEach(function (param) {
3756     params.push(param.name);
3757   });
3758
3759   body = ast.body[0].expression.body.range;
3760
3761   // Esprima's ranges include the first '{' and the last '}' characters on
3762   // function expressions. So cut them out.
3763   if (ast.body[0].expression.body.type === 'BlockStatement') {
3764     /*eslint-disable no-new-func*/
3765     return new Function(params, source.slice(body[0] + 1, body[1] - 1));
3766   }
3767   // ES6 arrow functions can omit the BlockStatement. In that case, just return
3768   // the body.
3769   /*eslint-disable no-new-func*/
3770   return new Function(params, 'return ' + source.slice(body[0], body[1]));
3771 }
3772
3773 function representJavascriptFunction(object /*, style*/) {
3774   return object.toString();
3775 }
3776
3777 function isFunction(object) {
3778   return Object.prototype.toString.call(object) === '[object Function]';
3779 }
3780
3781 module.exports = new Type('tag:yaml.org,2002:js/function', {
3782   kind: 'scalar',
3783   resolve: resolveJavascriptFunction,
3784   construct: constructJavascriptFunction,
3785   predicate: isFunction,
3786   represent: representJavascriptFunction
3787 });
3788
3789
3790 /***/ }),
3791 /* 35 */
3792 /***/ (function(module, exports, __webpack_require__) {
3793
3794 (function webpackUniversalModuleDefinition(root, factory) {
3795 /* istanbul ignore next */
3796         if(true)
3797                 module.exports = factory();
3798         else {}
3799 })(this, function() {
3800 return /******/ (function(modules) { // webpackBootstrap
3801 /******/        // The module cache
3802 /******/        var installedModules = {};
3803
3804 /******/        // The require function
3805 /******/        function __webpack_require__(moduleId) {
3806
3807 /******/                // Check if module is in cache
3808 /* istanbul ignore if */
3809 /******/                if(installedModules[moduleId])
3810 /******/                        return installedModules[moduleId].exports;
3811
3812 /******/                // Create a new module (and put it into the cache)
3813 /******/                var module = installedModules[moduleId] = {
3814 /******/                        exports: {},
3815 /******/                        id: moduleId,
3816 /******/                        loaded: false
3817 /******/                };
3818
3819 /******/                // Execute the module function
3820 /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
3821
3822 /******/                // Flag the module as loaded
3823 /******/                module.loaded = true;
3824
3825 /******/                // Return the exports of the module
3826 /******/                return module.exports;
3827 /******/        }
3828
3829
3830 /******/        // expose the modules object (__webpack_modules__)
3831 /******/        __webpack_require__.m = modules;
3832
3833 /******/        // expose the module cache
3834 /******/        __webpack_require__.c = installedModules;
3835
3836 /******/        // __webpack_public_path__
3837 /******/        __webpack_require__.p = "";
3838
3839 /******/        // Load entry module and return exports
3840 /******/        return __webpack_require__(0);
3841 /******/ })
3842 /************************************************************************/
3843 /******/ ([
3844 /* 0 */
3845 /***/ function(module, exports, __webpack_require__) {
3846
3847         "use strict";
3848         /*
3849           Copyright JS Foundation and other contributors, https://js.foundation/
3850
3851           Redistribution and use in source and binary forms, with or without
3852           modification, are permitted provided that the following conditions are met:
3853
3854             * Redistributions of source code must retain the above copyright
3855               notice, this list of conditions and the following disclaimer.
3856             * Redistributions in binary form must reproduce the above copyright
3857               notice, this list of conditions and the following disclaimer in the
3858               documentation and/or other materials provided with the distribution.
3859
3860           THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
3861           AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3862           IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3863           ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
3864           DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
3865           (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
3866           LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
3867           ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3868           (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3869           THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3870         */
3871         Object.defineProperty(exports, "__esModule", { value: true });
3872         var comment_handler_1 = __webpack_require__(1);
3873         var jsx_parser_1 = __webpack_require__(3);
3874         var parser_1 = __webpack_require__(8);
3875         var tokenizer_1 = __webpack_require__(15);
3876         function parse(code, options, delegate) {
3877             var commentHandler = null;
3878             var proxyDelegate = function (node, metadata) {
3879                 if (delegate) {
3880                     delegate(node, metadata);
3881                 }
3882                 if (commentHandler) {
3883                     commentHandler.visit(node, metadata);
3884                 }
3885             };
3886             var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
3887             var collectComment = false;
3888             if (options) {
3889                 collectComment = (typeof options.comment === 'boolean' && options.comment);
3890                 var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
3891                 if (collectComment || attachComment) {
3892                     commentHandler = new comment_handler_1.CommentHandler();
3893                     commentHandler.attach = attachComment;
3894                     options.comment = true;
3895                     parserDelegate = proxyDelegate;
3896                 }
3897             }
3898             var isModule = false;
3899             if (options && typeof options.sourceType === 'string') {
3900                 isModule = (options.sourceType === 'module');
3901             }
3902             var parser;
3903             if (options && typeof options.jsx === 'boolean' && options.jsx) {
3904                 parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
3905             }
3906             else {
3907                 parser = new parser_1.Parser(code, options, parserDelegate);
3908             }
3909             var program = isModule ? parser.parseModule() : parser.parseScript();
3910             var ast = program;
3911             if (collectComment && commentHandler) {
3912                 ast.comments = commentHandler.comments;
3913             }
3914             if (parser.config.tokens) {
3915                 ast.tokens = parser.tokens;
3916             }
3917             if (parser.config.tolerant) {
3918                 ast.errors = parser.errorHandler.errors;
3919             }
3920             return ast;
3921         }
3922         exports.parse = parse;
3923         function parseModule(code, options, delegate) {
3924             var parsingOptions = options || {};
3925             parsingOptions.sourceType = 'module';
3926             return parse(code, parsingOptions, delegate);
3927         }
3928         exports.parseModule = parseModule;
3929         function parseScript(code, options, delegate) {
3930             var parsingOptions = options || {};
3931             parsingOptions.sourceType = 'script';
3932             return parse(code, parsingOptions, delegate);
3933         }
3934         exports.parseScript = parseScript;
3935         function tokenize(code, options, delegate) {
3936             var tokenizer = new tokenizer_1.Tokenizer(code, options);
3937             var tokens;
3938             tokens = [];
3939             try {
3940                 while (true) {
3941                     var token = tokenizer.getNextToken();
3942                     if (!token) {
3943                         break;
3944                     }
3945                     if (delegate) {
3946                         token = delegate(token);
3947                     }
3948                     tokens.push(token);
3949                 }
3950             }
3951             catch (e) {
3952                 tokenizer.errorHandler.tolerate(e);
3953             }
3954             if (tokenizer.errorHandler.tolerant) {
3955                 tokens.errors = tokenizer.errors();
3956             }
3957             return tokens;
3958         }
3959         exports.tokenize = tokenize;
3960         var syntax_1 = __webpack_require__(2);
3961         exports.Syntax = syntax_1.Syntax;
3962         // Sync with *.json manifests.
3963         exports.version = '4.0.1';
3964
3965
3966 /***/ },
3967 /* 1 */
3968 /***/ function(module, exports, __webpack_require__) {
3969
3970         "use strict";
3971         Object.defineProperty(exports, "__esModule", { value: true });
3972         var syntax_1 = __webpack_require__(2);
3973         var CommentHandler = (function () {
3974             function CommentHandler() {
3975                 this.attach = false;
3976                 this.comments = [];
3977                 this.stack = [];
3978                 this.leading = [];
3979                 this.trailing = [];
3980             }
3981             CommentHandler.prototype.insertInnerComments = function (node, metadata) {
3982                 //  innnerComments for properties empty block
3983                 //  `function a() {/** comments **\/}`
3984                 if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
3985                     var innerComments = [];
3986                     for (var i = this.leading.length - 1; i >= 0; --i) {
3987                         var entry = this.leading[i];
3988                         if (metadata.end.offset >= entry.start) {
3989                             innerComments.unshift(entry.comment);
3990                             this.leading.splice(i, 1);
3991                             this.trailing.splice(i, 1);
3992                         }
3993                     }
3994                     if (innerComments.length) {
3995                         node.innerComments = innerComments;
3996                     }
3997                 }
3998             };
3999             CommentHandler.prototype.findTrailingComments = function (metadata) {
4000                 var trailingComments = [];
4001                 if (this.trailing.length > 0) {
4002                     for (var i = this.trailing.length - 1; i >= 0; --i) {
4003                         var entry_1 = this.trailing[i];
4004                         if (entry_1.start >= metadata.end.offset) {
4005                             trailingComments.unshift(entry_1.comment);
4006                         }
4007                     }
4008                     this.trailing.length = 0;
4009                     return trailingComments;
4010                 }
4011                 var entry = this.stack[this.stack.length - 1];
4012                 if (entry && entry.node.trailingComments) {
4013                     var firstComment = entry.node.trailingComments[0];
4014                     if (firstComment && firstComment.range[0] >= metadata.end.offset) {
4015                         trailingComments = entry.node.trailingComments;
4016                         delete entry.node.trailingComments;
4017                     }
4018                 }
4019                 return trailingComments;
4020             };
4021             CommentHandler.prototype.findLeadingComments = function (metadata) {
4022                 var leadingComments = [];
4023                 var target;
4024                 while (this.stack.length > 0) {
4025                     var entry = this.stack[this.stack.length - 1];
4026                     if (entry && entry.start >= metadata.start.offset) {
4027                         target = entry.node;
4028                         this.stack.pop();
4029                     }
4030                     else {
4031                         break;
4032                     }
4033                 }
4034                 if (target) {
4035                     var count = target.leadingComments ? target.leadingComments.length : 0;
4036                     for (var i = count - 1; i >= 0; --i) {
4037                         var comment = target.leadingComments[i];
4038                         if (comment.range[1] <= metadata.start.offset) {
4039                             leadingComments.unshift(comment);
4040                             target.leadingComments.splice(i, 1);
4041                         }
4042                     }
4043                     if (target.leadingComments && target.leadingComments.length === 0) {
4044                         delete target.leadingComments;
4045                     }
4046                     return leadingComments;
4047                 }
4048                 for (var i = this.leading.length - 1; i >= 0; --i) {
4049                     var entry = this.leading[i];
4050                     if (entry.start <= metadata.start.offset) {
4051                         leadingComments.unshift(entry.comment);
4052                         this.leading.splice(i, 1);
4053                     }
4054                 }
4055                 return leadingComments;
4056             };
4057             CommentHandler.prototype.visitNode = function (node, metadata) {
4058                 if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
4059                     return;
4060                 }
4061                 this.insertInnerComments(node, metadata);
4062                 var trailingComments = this.findTrailingComments(metadata);
4063                 var leadingComments = this.findLeadingComments(metadata);
4064                 if (leadingComments.length > 0) {
4065                     node.leadingComments = leadingComments;
4066                 }
4067                 if (trailingComments.length > 0) {
4068                     node.trailingComments = trailingComments;
4069                 }
4070                 this.stack.push({
4071                     node: node,
4072                     start: metadata.start.offset
4073                 });
4074             };
4075             CommentHandler.prototype.visitComment = function (node, metadata) {
4076                 var type = (node.type[0] === 'L') ? 'Line' : 'Block';
4077                 var comment = {
4078                     type: type,
4079                     value: node.value
4080                 };
4081                 if (node.range) {
4082                     comment.range = node.range;
4083                 }
4084                 if (node.loc) {
4085                     comment.loc = node.loc;
4086                 }
4087                 this.comments.push(comment);
4088                 if (this.attach) {
4089                     var entry = {
4090                         comment: {
4091                             type: type,
4092                             value: node.value,
4093                             range: [metadata.start.offset, metadata.end.offset]
4094                         },
4095                         start: metadata.start.offset
4096                     };
4097                     if (node.loc) {
4098                         entry.comment.loc = node.loc;
4099                     }
4100                     node.type = type;
4101                     this.leading.push(entry);
4102                     this.trailing.push(entry);
4103                 }
4104             };
4105             CommentHandler.prototype.visit = function (node, metadata) {
4106                 if (node.type === 'LineComment') {
4107                     this.visitComment(node, metadata);
4108                 }
4109                 else if (node.type === 'BlockComment') {
4110                     this.visitComment(node, metadata);
4111                 }
4112                 else if (this.attach) {
4113                     this.visitNode(node, metadata);
4114                 }
4115             };
4116             return CommentHandler;
4117         }());
4118         exports.CommentHandler = CommentHandler;
4119
4120
4121 /***/ },
4122 /* 2 */
4123 /***/ function(module, exports) {
4124
4125         "use strict";
4126         Object.defineProperty(exports, "__esModule", { value: true });
4127         exports.Syntax = {
4128             AssignmentExpression: 'AssignmentExpression',
4129             AssignmentPattern: 'AssignmentPattern',
4130             ArrayExpression: 'ArrayExpression',
4131             ArrayPattern: 'ArrayPattern',
4132             ArrowFunctionExpression: 'ArrowFunctionExpression',
4133             AwaitExpression: 'AwaitExpression',
4134             BlockStatement: 'BlockStatement',
4135             BinaryExpression: 'BinaryExpression',
4136             BreakStatement: 'BreakStatement',
4137             CallExpression: 'CallExpression',
4138             CatchClause: 'CatchClause',
4139             ClassBody: 'ClassBody',
4140             ClassDeclaration: 'ClassDeclaration',
4141             ClassExpression: 'ClassExpression',
4142             ConditionalExpression: 'ConditionalExpression',
4143             ContinueStatement: 'ContinueStatement',
4144             DoWhileStatement: 'DoWhileStatement',
4145             DebuggerStatement: 'DebuggerStatement',
4146             EmptyStatement: 'EmptyStatement',
4147             ExportAllDeclaration: 'ExportAllDeclaration',
4148             ExportDefaultDeclaration: 'ExportDefaultDeclaration',
4149             ExportNamedDeclaration: 'ExportNamedDeclaration',
4150             ExportSpecifier: 'ExportSpecifier',
4151             ExpressionStatement: 'ExpressionStatement',
4152             ForStatement: 'ForStatement',
4153             ForOfStatement: 'ForOfStatement',
4154             ForInStatement: 'ForInStatement',
4155             FunctionDeclaration: 'FunctionDeclaration',
4156             FunctionExpression: 'FunctionExpression',
4157             Identifier: 'Identifier',
4158             IfStatement: 'IfStatement',
4159             ImportDeclaration: 'ImportDeclaration',
4160             ImportDefaultSpecifier: 'ImportDefaultSpecifier',
4161             ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
4162             ImportSpecifier: 'ImportSpecifier',
4163             Literal: 'Literal',
4164             LabeledStatement: 'LabeledStatement',
4165             LogicalExpression: 'LogicalExpression',
4166             MemberExpression: 'MemberExpression',
4167             MetaProperty: 'MetaProperty',
4168             MethodDefinition: 'MethodDefinition',
4169             NewExpression: 'NewExpression',
4170             ObjectExpression: 'ObjectExpression',
4171             ObjectPattern: 'ObjectPattern',
4172             Program: 'Program',
4173             Property: 'Property',
4174             RestElement: 'RestElement',
4175             ReturnStatement: 'ReturnStatement',
4176             SequenceExpression: 'SequenceExpression',
4177             SpreadElement: 'SpreadElement',
4178             Super: 'Super',
4179             SwitchCase: 'SwitchCase',
4180             SwitchStatement: 'SwitchStatement',
4181             TaggedTemplateExpression: 'TaggedTemplateExpression',
4182             TemplateElement: 'TemplateElement',
4183             TemplateLiteral: 'TemplateLiteral',
4184             ThisExpression: 'ThisExpression',
4185             ThrowStatement: 'ThrowStatement',
4186             TryStatement: 'TryStatement',
4187             UnaryExpression: 'UnaryExpression',
4188             UpdateExpression: 'UpdateExpression',
4189             VariableDeclaration: 'VariableDeclaration',
4190             VariableDeclarator: 'VariableDeclarator',
4191             WhileStatement: 'WhileStatement',
4192             WithStatement: 'WithStatement',
4193             YieldExpression: 'YieldExpression'
4194         };
4195
4196
4197 /***/ },
4198 /* 3 */
4199 /***/ function(module, exports, __webpack_require__) {
4200
4201         "use strict";
4202 /* istanbul ignore next */
4203         var __extends = (this && this.__extends) || (function () {
4204             var extendStatics = Object.setPrototypeOf ||
4205                 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
4206                 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
4207             return function (d, b) {
4208                 extendStatics(d, b);
4209                 function __() { this.constructor = d; }
4210                 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4211             };
4212         })();
4213         Object.defineProperty(exports, "__esModule", { value: true });
4214         var character_1 = __webpack_require__(4);
4215         var JSXNode = __webpack_require__(5);
4216         var jsx_syntax_1 = __webpack_require__(6);
4217         var Node = __webpack_require__(7);
4218         var parser_1 = __webpack_require__(8);
4219         var token_1 = __webpack_require__(13);
4220         var xhtml_entities_1 = __webpack_require__(14);
4221         token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier';
4222         token_1.TokenName[101 /* Text */] = 'JSXText';
4223         // Fully qualified element name, e.g. <svg:path> returns "svg:path"
4224         function getQualifiedElementName(elementName) {
4225             var qualifiedName;
4226             switch (elementName.type) {
4227                 case jsx_syntax_1.JSXSyntax.JSXIdentifier:
4228                     var id = elementName;
4229                     qualifiedName = id.name;
4230                     break;
4231                 case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
4232                     var ns = elementName;
4233                     qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
4234                         getQualifiedElementName(ns.name);
4235                     break;
4236                 case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
4237                     var expr = elementName;
4238                     qualifiedName = getQualifiedElementName(expr.object) + '.' +
4239                         getQualifiedElementName(expr.property);
4240                     break;
4241                 /* istanbul ignore next */
4242                 default:
4243                     break;
4244             }
4245             return qualifiedName;
4246         }
4247         var JSXParser = (function (_super) {
4248             __extends(JSXParser, _super);
4249             function JSXParser(code, options, delegate) {
4250                 return _super.call(this, code, options, delegate) || this;
4251             }
4252             JSXParser.prototype.parsePrimaryExpression = function () {
4253                 return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
4254             };
4255             JSXParser.prototype.startJSX = function () {
4256                 // Unwind the scanner before the lookahead token.
4257                 this.scanner.index = this.startMarker.index;
4258                 this.scanner.lineNumber = this.startMarker.line;
4259                 this.scanner.lineStart = this.startMarker.index - this.startMarker.column;
4260             };
4261             JSXParser.prototype.finishJSX = function () {
4262                 // Prime the next lookahead.
4263                 this.nextToken();
4264             };
4265             JSXParser.prototype.reenterJSX = function () {
4266                 this.startJSX();
4267                 this.expectJSX('}');
4268                 // Pop the closing '}' added from the lookahead.
4269                 if (this.config.tokens) {
4270                     this.tokens.pop();
4271                 }
4272             };
4273             JSXParser.prototype.createJSXNode = function () {
4274                 this.collectComments();
4275                 return {
4276                     index: this.scanner.index,
4277                     line: this.scanner.lineNumber,
4278                     column: this.scanner.index - this.scanner.lineStart
4279                 };
4280             };
4281             JSXParser.prototype.createJSXChildNode = function () {
4282                 return {
4283                     index: this.scanner.index,
4284                     line: this.scanner.lineNumber,
4285                     column: this.scanner.index - this.scanner.lineStart
4286                 };
4287             };
4288             JSXParser.prototype.scanXHTMLEntity = function (quote) {
4289                 var result = '&';
4290                 var valid = true;
4291                 var terminated = false;
4292                 var numeric = false;
4293                 var hex = false;
4294                 while (!this.scanner.eof() && valid && !terminated) {
4295                     var ch = this.scanner.source[this.scanner.index];
4296                     if (ch === quote) {
4297                         break;
4298                     }
4299                     terminated = (ch === ';');
4300                     result += ch;
4301                     ++this.scanner.index;
4302                     if (!terminated) {
4303                         switch (result.length) {
4304                             case 2:
4305                                 // e.g. '&#123;'
4306                                 numeric = (ch === '#');
4307                                 break;
4308                             case 3:
4309                                 if (numeric) {
4310                                     // e.g. '&#x41;'
4311                                     hex = (ch === 'x');
4312                                     valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
4313                                     numeric = numeric && !hex;
4314                                 }
4315                                 break;
4316                             default:
4317                                 valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
4318                                 valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
4319                                 break;
4320                         }
4321                     }
4322                 }
4323                 if (valid && terminated && result.length > 2) {
4324                     // e.g. '&#x41;' becomes just '#x41'
4325                     var str = result.substr(1, result.length - 2);
4326                     if (numeric && str.length > 1) {
4327                         result = String.fromCharCode(parseInt(str.substr(1), 10));
4328                     }
4329                     else if (hex && str.length > 2) {
4330                         result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
4331                     }
4332                     else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
4333                         result = xhtml_entities_1.XHTMLEntities[str];
4334                     }
4335                 }
4336                 return result;
4337             };
4338             // Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
4339             JSXParser.prototype.lexJSX = function () {
4340                 var cp = this.scanner.source.charCodeAt(this.scanner.index);
4341                 // < > / : = { }
4342                 if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
4343                     var value = this.scanner.source[this.scanner.index++];
4344                     return {
4345                         type: 7 /* Punctuator */,
4346                         value: value,
4347                         lineNumber: this.scanner.lineNumber,
4348                         lineStart: this.scanner.lineStart,
4349                         start: this.scanner.index - 1,
4350                         end: this.scanner.index
4351                     };
4352                 }
4353                 // " '
4354                 if (cp === 34 || cp === 39) {
4355                     var start = this.scanner.index;
4356                     var quote = this.scanner.source[this.scanner.index++];
4357                     var str = '';
4358                     while (!this.scanner.eof()) {
4359                         var ch = this.scanner.source[this.scanner.index++];
4360                         if (ch === quote) {
4361                             break;
4362                         }
4363                         else if (ch === '&') {
4364                             str += this.scanXHTMLEntity(quote);
4365                         }
4366                         else {
4367                             str += ch;
4368                         }
4369                     }
4370                     return {
4371                         type: 8 /* StringLiteral */,
4372                         value: str,
4373                         lineNumber: this.scanner.lineNumber,
4374                         lineStart: this.scanner.lineStart,
4375                         start: start,
4376                         end: this.scanner.index
4377                     };
4378                 }
4379                 // ... or .
4380                 if (cp === 46) {
4381                     var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
4382                     var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
4383                     var value = (n1 === 46 && n2 === 46) ? '...' : '.';
4384                     var start = this.scanner.index;
4385                     this.scanner.index += value.length;
4386                     return {
4387                         type: 7 /* Punctuator */,
4388                         value: value,
4389                         lineNumber: this.scanner.lineNumber,
4390                         lineStart: this.scanner.lineStart,
4391                         start: start,
4392                         end: this.scanner.index
4393                     };
4394                 }
4395                 // `
4396                 if (cp === 96) {
4397                     // Only placeholder, since it will be rescanned as a real assignment expression.
4398                     return {
4399                         type: 10 /* Template */,
4400                         value: '',
4401                         lineNumber: this.scanner.lineNumber,
4402                         lineStart: this.scanner.lineStart,
4403                         start: this.scanner.index,
4404                         end: this.scanner.index
4405                     };
4406                 }
4407                 // Identifer can not contain backslash (char code 92).
4408                 if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
4409                     var start = this.scanner.index;
4410                     ++this.scanner.index;
4411                     while (!this.scanner.eof()) {
4412                         var ch = this.scanner.source.charCodeAt(this.scanner.index);
4413                         if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
4414                             ++this.scanner.index;
4415                         }
4416                         else if (ch === 45) {
4417                             // Hyphen (char code 45) can be part of an identifier.
4418                             ++this.scanner.index;
4419                         }
4420                         else {
4421                             break;
4422                         }
4423                     }
4424                     var id = this.scanner.source.slice(start, this.scanner.index);
4425                     return {
4426                         type: 100 /* Identifier */,
4427                         value: id,
4428                         lineNumber: this.scanner.lineNumber,
4429                         lineStart: this.scanner.lineStart,
4430                         start: start,
4431                         end: this.scanner.index
4432                     };
4433                 }
4434                 return this.scanner.lex();
4435             };
4436             JSXParser.prototype.nextJSXToken = function () {
4437                 this.collectComments();
4438                 this.startMarker.index = this.scanner.index;
4439                 this.startMarker.line = this.scanner.lineNumber;
4440                 this.startMarker.column = this.scanner.index - this.scanner.lineStart;
4441                 var token = this.lexJSX();
4442                 this.lastMarker.index = this.scanner.index;
4443                 this.lastMarker.line = this.scanner.lineNumber;
4444                 this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
4445                 if (this.config.tokens) {
4446                     this.tokens.push(this.convertToken(token));
4447                 }
4448                 return token;
4449             };
4450             JSXParser.prototype.nextJSXText = function () {
4451                 this.startMarker.index = this.scanner.index;
4452                 this.startMarker.line = this.scanner.lineNumber;
4453                 this.startMarker.column = this.scanner.index - this.scanner.lineStart;
4454                 var start = this.scanner.index;
4455                 var text = '';
4456                 while (!this.scanner.eof()) {
4457                     var ch = this.scanner.source[this.scanner.index];
4458                     if (ch === '{' || ch === '<') {
4459                         break;
4460                     }
4461                     ++this.scanner.index;
4462                     text += ch;
4463                     if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
4464                         ++this.scanner.lineNumber;
4465                         if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
4466                             ++this.scanner.index;
4467                         }
4468                         this.scanner.lineStart = this.scanner.index;
4469                     }
4470                 }
4471                 this.lastMarker.index = this.scanner.index;
4472                 this.lastMarker.line = this.scanner.lineNumber;
4473                 this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
4474                 var token = {
4475                     type: 101 /* Text */,
4476                     value: text,
4477                     lineNumber: this.scanner.lineNumber,
4478                     lineStart: this.scanner.lineStart,
4479                     start: start,
4480                     end: this.scanner.index
4481                 };
4482                 if ((text.length > 0) && this.config.tokens) {
4483                     this.tokens.push(this.convertToken(token));
4484                 }
4485                 return token;
4486             };
4487             JSXParser.prototype.peekJSXToken = function () {
4488                 var state = this.scanner.saveState();
4489                 this.scanner.scanComments();
4490                 var next = this.lexJSX();
4491                 this.scanner.restoreState(state);
4492                 return next;
4493             };
4494             // Expect the next JSX token to match the specified punctuator.
4495             // If not, an exception will be thrown.
4496             JSXParser.prototype.expectJSX = function (value) {
4497                 var token = this.nextJSXToken();
4498                 if (token.type !== 7 /* Punctuator */ || token.value !== value) {
4499                     this.throwUnexpectedToken(token);
4500                 }
4501             };
4502             // Return true if the next JSX token matches the specified punctuator.
4503             JSXParser.prototype.matchJSX = function (value) {
4504                 var next = this.peekJSXToken();
4505                 return next.type === 7 /* Punctuator */ && next.value === value;
4506             };
4507             JSXParser.prototype.parseJSXIdentifier = function () {
4508                 var node = this.createJSXNode();
4509                 var token = this.nextJSXToken();
4510                 if (token.type !== 100 /* Identifier */) {
4511                     this.throwUnexpectedToken(token);
4512                 }
4513                 return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
4514             };
4515             JSXParser.prototype.parseJSXElementName = function () {
4516                 var node = this.createJSXNode();
4517                 var elementName = this.parseJSXIdentifier();
4518                 if (this.matchJSX(':')) {
4519                     var namespace = elementName;
4520                     this.expectJSX(':');
4521                     var name_1 = this.parseJSXIdentifier();
4522                     elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
4523                 }
4524                 else if (this.matchJSX('.')) {
4525                     while (this.matchJSX('.')) {
4526                         var object = elementName;
4527                         this.expectJSX('.');
4528                         var property = this.parseJSXIdentifier();
4529                         elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
4530                     }
4531                 }
4532                 return elementName;
4533             };
4534             JSXParser.prototype.parseJSXAttributeName = function () {
4535                 var node = this.createJSXNode();
4536                 var attributeName;
4537                 var identifier = this.parseJSXIdentifier();
4538                 if (this.matchJSX(':')) {
4539                     var namespace = identifier;
4540                     this.expectJSX(':');
4541                     var name_2 = this.parseJSXIdentifier();
4542                     attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
4543                 }
4544                 else {
4545                     attributeName = identifier;
4546                 }
4547                 return attributeName;
4548             };
4549             JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
4550                 var node = this.createJSXNode();
4551                 var token = this.nextJSXToken();
4552                 if (token.type !== 8 /* StringLiteral */) {
4553                     this.throwUnexpectedToken(token);
4554                 }
4555                 var raw = this.getTokenRaw(token);
4556                 return this.finalize(node, new Node.Literal(token.value, raw));
4557             };
4558             JSXParser.prototype.parseJSXExpressionAttribute = function () {
4559                 var node = this.createJSXNode();
4560                 this.expectJSX('{');
4561                 this.finishJSX();
4562                 if (this.match('}')) {
4563                     this.tolerateError('JSX attributes must only be assigned a non-empty expression');
4564                 }
4565                 var expression = this.parseAssignmentExpression();
4566                 this.reenterJSX();
4567                 return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
4568             };
4569             JSXParser.prototype.parseJSXAttributeValue = function () {
4570                 return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
4571                     this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
4572             };
4573             JSXParser.prototype.parseJSXNameValueAttribute = function () {
4574                 var node = this.createJSXNode();
4575                 var name = this.parseJSXAttributeName();
4576                 var value = null;
4577                 if (this.matchJSX('=')) {
4578                     this.expectJSX('=');
4579                     value = this.parseJSXAttributeValue();
4580                 }
4581                 return this.finalize(node, new JSXNode.JSXAttribute(name, value));
4582             };
4583             JSXParser.prototype.parseJSXSpreadAttribute = function () {
4584                 var node = this.createJSXNode();
4585                 this.expectJSX('{');
4586                 this.expectJSX('...');
4587                 this.finishJSX();
4588                 var argument = this.parseAssignmentExpression();
4589                 this.reenterJSX();
4590                 return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
4591             };
4592             JSXParser.prototype.parseJSXAttributes = function () {
4593                 var attributes = [];
4594                 while (!this.matchJSX('/') && !this.matchJSX('>')) {
4595                     var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
4596                         this.parseJSXNameValueAttribute();
4597                     attributes.push(attribute);
4598                 }
4599                 return attributes;
4600             };
4601             JSXParser.prototype.parseJSXOpeningElement = function () {
4602                 var node = this.createJSXNode();
4603                 this.expectJSX('<');
4604                 var name = this.parseJSXElementName();
4605                 var attributes = this.parseJSXAttributes();
4606                 var selfClosing = this.matchJSX('/');
4607                 if (selfClosing) {
4608                     this.expectJSX('/');
4609                 }
4610                 this.expectJSX('>');
4611                 return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
4612             };
4613             JSXParser.prototype.parseJSXBoundaryElement = function () {
4614                 var node = this.createJSXNode();
4615                 this.expectJSX('<');
4616                 if (this.matchJSX('/')) {
4617                     this.expectJSX('/');
4618                     var name_3 = this.parseJSXElementName();
4619                     this.expectJSX('>');
4620                     return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
4621                 }
4622                 var name = this.parseJSXElementName();
4623                 var attributes = this.parseJSXAttributes();
4624                 var selfClosing = this.matchJSX('/');
4625                 if (selfClosing) {
4626                     this.expectJSX('/');
4627                 }
4628                 this.expectJSX('>');
4629                 return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
4630             };
4631             JSXParser.prototype.parseJSXEmptyExpression = function () {
4632                 var node = this.createJSXChildNode();
4633                 this.collectComments();
4634                 this.lastMarker.index = this.scanner.index;
4635                 this.lastMarker.line = this.scanner.lineNumber;
4636                 this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
4637                 return this.finalize(node, new JSXNode.JSXEmptyExpression());
4638             };
4639             JSXParser.prototype.parseJSXExpressionContainer = function () {
4640                 var node = this.createJSXNode();
4641                 this.expectJSX('{');
4642                 var expression;
4643                 if (this.matchJSX('}')) {
4644                     expression = this.parseJSXEmptyExpression();
4645                     this.expectJSX('}');
4646                 }
4647                 else {
4648                     this.finishJSX();
4649                     expression = this.parseAssignmentExpression();
4650                     this.reenterJSX();
4651                 }
4652                 return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
4653             };
4654             JSXParser.prototype.parseJSXChildren = function () {
4655                 var children = [];
4656                 while (!this.scanner.eof()) {
4657                     var node = this.createJSXChildNode();
4658                     var token = this.nextJSXText();
4659                     if (token.start < token.end) {
4660                         var raw = this.getTokenRaw(token);
4661                         var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
4662                         children.push(child);
4663                     }
4664                     if (this.scanner.source[this.scanner.index] === '{') {
4665                         var container = this.parseJSXExpressionContainer();
4666                         children.push(container);
4667                     }
4668                     else {
4669                         break;
4670                     }
4671                 }
4672                 return children;
4673             };
4674             JSXParser.prototype.parseComplexJSXElement = function (el) {
4675                 var stack = [];
4676                 while (!this.scanner.eof()) {
4677                     el.children = el.children.concat(this.parseJSXChildren());
4678                     var node = this.createJSXChildNode();
4679                     var element = this.parseJSXBoundaryElement();
4680                     if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
4681                         var opening = element;
4682                         if (opening.selfClosing) {
4683                             var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
4684                             el.children.push(child);
4685                         }
4686                         else {
4687                             stack.push(el);
4688                             el = { node: node, opening: opening, closing: null, children: [] };
4689                         }
4690                     }
4691                     if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
4692                         el.closing = element;
4693                         var open_1 = getQualifiedElementName(el.opening.name);
4694                         var close_1 = getQualifiedElementName(el.closing.name);
4695                         if (open_1 !== close_1) {
4696                             this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
4697                         }
4698                         if (stack.length > 0) {
4699                             var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
4700                             el = stack[stack.length - 1];
4701                             el.children.push(child);
4702                             stack.pop();
4703                         }
4704                         else {
4705                             break;
4706                         }
4707                     }
4708                 }
4709                 return el;
4710             };
4711             JSXParser.prototype.parseJSXElement = function () {
4712                 var node = this.createJSXNode();
4713                 var opening = this.parseJSXOpeningElement();
4714                 var children = [];
4715                 var closing = null;
4716                 if (!opening.selfClosing) {
4717                     var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
4718                     children = el.children;
4719                     closing = el.closing;
4720                 }
4721                 return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
4722             };
4723             JSXParser.prototype.parseJSXRoot = function () {
4724                 // Pop the opening '<' added from the lookahead.
4725                 if (this.config.tokens) {
4726                     this.tokens.pop();
4727                 }
4728                 this.startJSX();
4729                 var element = this.parseJSXElement();
4730                 this.finishJSX();
4731                 return element;
4732             };
4733             JSXParser.prototype.isStartOfExpression = function () {
4734                 return _super.prototype.isStartOfExpression.call(this) || this.match('<');
4735             };
4736             return JSXParser;
4737         }(parser_1.Parser));
4738         exports.JSXParser = JSXParser;
4739
4740
4741 /***/ },
4742 /* 4 */
4743 /***/ function(module, exports) {
4744
4745         "use strict";
4746         Object.defineProperty(exports, "__esModule", { value: true });
4747         // See also tools/generate-unicode-regex.js.
4748         var Regex = {
4749             // Unicode v8.0.0 NonAsciiIdentifierStart:
4750             NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
4751             // Unicode v8.0.0 NonAsciiIdentifierPart:
4752             NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
4753         };
4754         exports.Character = {
4755             /* tslint:disable:no-bitwise */
4756             fromCodePoint: function (cp) {
4757                 return (cp < 0x10000) ? String.fromCharCode(cp) :
4758                     String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
4759                         String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
4760             },
4761             // https://tc39.github.io/ecma262/#sec-white-space
4762             isWhiteSpace: function (cp) {
4763                 return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
4764                     (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
4765             },
4766             // https://tc39.github.io/ecma262/#sec-line-terminators
4767             isLineTerminator: function (cp) {
4768                 return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
4769             },
4770             // https://tc39.github.io/ecma262/#sec-names-and-keywords
4771             isIdentifierStart: function (cp) {
4772                 return (cp === 0x24) || (cp === 0x5F) ||
4773                     (cp >= 0x41 && cp <= 0x5A) ||
4774                     (cp >= 0x61 && cp <= 0x7A) ||
4775                     (cp === 0x5C) ||
4776                     ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
4777             },
4778             isIdentifierPart: function (cp) {
4779                 return (cp === 0x24) || (cp === 0x5F) ||
4780                     (cp >= 0x41 && cp <= 0x5A) ||
4781                     (cp >= 0x61 && cp <= 0x7A) ||
4782                     (cp >= 0x30 && cp <= 0x39) ||
4783                     (cp === 0x5C) ||
4784                     ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
4785             },
4786             // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
4787             isDecimalDigit: function (cp) {
4788                 return (cp >= 0x30 && cp <= 0x39); // 0..9
4789             },
4790             isHexDigit: function (cp) {
4791                 return (cp >= 0x30 && cp <= 0x39) ||
4792                     (cp >= 0x41 && cp <= 0x46) ||
4793                     (cp >= 0x61 && cp <= 0x66); // a..f
4794             },
4795             isOctalDigit: function (cp) {
4796                 return (cp >= 0x30 && cp <= 0x37); // 0..7
4797             }
4798         };
4799
4800
4801 /***/ },
4802 /* 5 */
4803 /***/ function(module, exports, __webpack_require__) {
4804
4805         "use strict";
4806         Object.defineProperty(exports, "__esModule", { value: true });
4807         var jsx_syntax_1 = __webpack_require__(6);
4808         /* tslint:disable:max-classes-per-file */
4809         var JSXClosingElement = (function () {
4810             function JSXClosingElement(name) {
4811                 this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
4812                 this.name = name;
4813             }
4814             return JSXClosingElement;
4815         }());
4816         exports.JSXClosingElement = JSXClosingElement;
4817         var JSXElement = (function () {
4818             function JSXElement(openingElement, children, closingElement) {
4819                 this.type = jsx_syntax_1.JSXSyntax.JSXElement;
4820                 this.openingElement = openingElement;
4821                 this.children = children;
4822                 this.closingElement = closingElement;
4823             }
4824             return JSXElement;
4825         }());
4826         exports.JSXElement = JSXElement;
4827         var JSXEmptyExpression = (function () {
4828             function JSXEmptyExpression() {
4829                 this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
4830             }
4831             return JSXEmptyExpression;
4832         }());
4833         exports.JSXEmptyExpression = JSXEmptyExpression;
4834         var JSXExpressionContainer = (function () {
4835             function JSXExpressionContainer(expression) {
4836                 this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
4837                 this.expression = expression;
4838             }
4839             return JSXExpressionContainer;
4840         }());
4841         exports.JSXExpressionContainer = JSXExpressionContainer;
4842         var JSXIdentifier = (function () {
4843             function JSXIdentifier(name) {
4844                 this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
4845                 this.name = name;
4846             }
4847             return JSXIdentifier;
4848         }());
4849         exports.JSXIdentifier = JSXIdentifier;
4850         var JSXMemberExpression = (function () {
4851             function JSXMemberExpression(object, property) {
4852                 this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
4853                 this.object = object;
4854                 this.property = property;
4855             }
4856             return JSXMemberExpression;
4857         }());
4858         exports.JSXMemberExpression = JSXMemberExpression;
4859         var JSXAttribute = (function () {
4860             function JSXAttribute(name, value) {
4861                 this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
4862                 this.name = name;
4863                 this.value = value;
4864             }
4865             return JSXAttribute;
4866         }());
4867         exports.JSXAttribute = JSXAttribute;
4868         var JSXNamespacedName = (function () {
4869             function JSXNamespacedName(namespace, name) {
4870                 this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
4871                 this.namespace = namespace;
4872                 this.name = name;
4873             }
4874             return JSXNamespacedName;
4875         }());
4876         exports.JSXNamespacedName = JSXNamespacedName;
4877         var JSXOpeningElement = (function () {
4878             function JSXOpeningElement(name, selfClosing, attributes) {
4879                 this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
4880                 this.name = name;
4881                 this.selfClosing = selfClosing;
4882                 this.attributes = attributes;
4883             }
4884             return JSXOpeningElement;
4885         }());
4886         exports.JSXOpeningElement = JSXOpeningElement;
4887         var JSXSpreadAttribute = (function () {
4888             function JSXSpreadAttribute(argument) {
4889                 this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
4890                 this.argument = argument;
4891             }
4892             return JSXSpreadAttribute;
4893         }());
4894         exports.JSXSpreadAttribute = JSXSpreadAttribute;
4895         var JSXText = (function () {
4896             function JSXText(value, raw) {
4897                 this.type = jsx_syntax_1.JSXSyntax.JSXText;
4898                 this.value = value;
4899                 this.raw = raw;
4900             }
4901             return JSXText;
4902         }());
4903         exports.JSXText = JSXText;
4904
4905
4906 /***/ },
4907 /* 6 */
4908 /***/ function(module, exports) {
4909
4910         "use strict";
4911         Object.defineProperty(exports, "__esModule", { value: true });
4912         exports.JSXSyntax = {
4913             JSXAttribute: 'JSXAttribute',
4914             JSXClosingElement: 'JSXClosingElement',
4915             JSXElement: 'JSXElement',
4916             JSXEmptyExpression: 'JSXEmptyExpression',
4917             JSXExpressionContainer: 'JSXExpressionContainer',
4918             JSXIdentifier: 'JSXIdentifier',
4919             JSXMemberExpression: 'JSXMemberExpression',
4920             JSXNamespacedName: 'JSXNamespacedName',
4921             JSXOpeningElement: 'JSXOpeningElement',
4922             JSXSpreadAttribute: 'JSXSpreadAttribute',
4923             JSXText: 'JSXText'
4924         };
4925
4926
4927 /***/ },
4928 /* 7 */
4929 /***/ function(module, exports, __webpack_require__) {
4930
4931         "use strict";
4932         Object.defineProperty(exports, "__esModule", { value: true });
4933         var syntax_1 = __webpack_require__(2);
4934         /* tslint:disable:max-classes-per-file */
4935         var ArrayExpression = (function () {
4936             function ArrayExpression(elements) {
4937                 this.type = syntax_1.Syntax.ArrayExpression;
4938                 this.elements = elements;
4939             }
4940             return ArrayExpression;
4941         }());
4942         exports.ArrayExpression = ArrayExpression;
4943         var ArrayPattern = (function () {
4944             function ArrayPattern(elements) {
4945                 this.type = syntax_1.Syntax.ArrayPattern;
4946                 this.elements = elements;
4947             }
4948             return ArrayPattern;
4949         }());
4950         exports.ArrayPattern = ArrayPattern;
4951         var ArrowFunctionExpression = (function () {
4952             function ArrowFunctionExpression(params, body, expression) {
4953                 this.type = syntax_1.Syntax.ArrowFunctionExpression;
4954                 this.id = null;
4955                 this.params = params;
4956                 this.body = body;
4957                 this.generator = false;
4958                 this.expression = expression;
4959                 this.async = false;
4960             }
4961             return ArrowFunctionExpression;
4962         }());
4963         exports.ArrowFunctionExpression = ArrowFunctionExpression;
4964         var AssignmentExpression = (function () {
4965             function AssignmentExpression(operator, left, right) {
4966                 this.type = syntax_1.Syntax.AssignmentExpression;
4967                 this.operator = operator;
4968                 this.left = left;
4969                 this.right = right;
4970             }
4971             return AssignmentExpression;
4972         }());
4973         exports.AssignmentExpression = AssignmentExpression;
4974         var AssignmentPattern = (function () {
4975             function AssignmentPattern(left, right) {
4976                 this.type = syntax_1.Syntax.AssignmentPattern;
4977                 this.left = left;
4978                 this.right = right;
4979             }
4980             return AssignmentPattern;
4981         }());
4982         exports.AssignmentPattern = AssignmentPattern;
4983         var AsyncArrowFunctionExpression = (function () {
4984             function AsyncArrowFunctionExpression(params, body, expression) {
4985                 this.type = syntax_1.Syntax.ArrowFunctionExpression;
4986                 this.id = null;
4987                 this.params = params;
4988                 this.body = body;
4989                 this.generator = false;
4990                 this.expression = expression;
4991                 this.async = true;
4992             }
4993             return AsyncArrowFunctionExpression;
4994         }());
4995         exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression;
4996         var AsyncFunctionDeclaration = (function () {
4997             function AsyncFunctionDeclaration(id, params, body) {
4998                 this.type = syntax_1.Syntax.FunctionDeclaration;
4999                 this.id = id;
5000                 this.params = params;
5001                 this.body = body;
5002                 this.generator = false;
5003                 this.expression = false;
5004                 this.async = true;
5005             }
5006             return AsyncFunctionDeclaration;
5007         }());
5008         exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration;
5009         var AsyncFunctionExpression = (function () {
5010             function AsyncFunctionExpression(id, params, body) {
5011                 this.type = syntax_1.Syntax.FunctionExpression;
5012                 this.id = id;
5013                 this.params = params;
5014                 this.body = body;
5015                 this.generator = false;
5016                 this.expression = false;
5017                 this.async = true;
5018             }
5019             return AsyncFunctionExpression;
5020         }());
5021         exports.AsyncFunctionExpression = AsyncFunctionExpression;
5022         var AwaitExpression = (function () {
5023             function AwaitExpression(argument) {
5024                 this.type = syntax_1.Syntax.AwaitExpression;
5025                 this.argument = argument;
5026             }
5027             return AwaitExpression;
5028         }());
5029         exports.AwaitExpression = AwaitExpression;
5030         var BinaryExpression = (function () {
5031             function BinaryExpression(operator, left, right) {
5032                 var logical = (operator === '||' || operator === '&&');
5033                 this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
5034                 this.operator = operator;
5035                 this.left = left;
5036                 this.right = right;
5037             }
5038             return BinaryExpression;
5039         }());
5040         exports.BinaryExpression = BinaryExpression;
5041         var BlockStatement = (function () {
5042             function BlockStatement(body) {
5043                 this.type = syntax_1.Syntax.BlockStatement;
5044                 this.body = body;
5045             }
5046             return BlockStatement;
5047         }());
5048         exports.BlockStatement = BlockStatement;
5049         var BreakStatement = (function () {
5050             function BreakStatement(label) {
5051                 this.type = syntax_1.Syntax.BreakStatement;
5052                 this.label = label;
5053             }
5054             return BreakStatement;
5055         }());
5056         exports.BreakStatement = BreakStatement;
5057         var CallExpression = (function () {
5058             function CallExpression(callee, args) {
5059                 this.type = syntax_1.Syntax.CallExpression;
5060                 this.callee = callee;
5061                 this.arguments = args;
5062             }
5063             return CallExpression;
5064         }());
5065         exports.CallExpression = CallExpression;
5066         var CatchClause = (function () {
5067             function CatchClause(param, body) {
5068                 this.type = syntax_1.Syntax.CatchClause;
5069                 this.param = param;
5070                 this.body = body;
5071             }
5072             return CatchClause;
5073         }());
5074         exports.CatchClause = CatchClause;
5075         var ClassBody = (function () {
5076             function ClassBody(body) {
5077                 this.type = syntax_1.Syntax.ClassBody;
5078                 this.body = body;
5079             }
5080             return ClassBody;
5081         }());
5082         exports.ClassBody = ClassBody;
5083         var ClassDeclaration = (function () {
5084             function ClassDeclaration(id, superClass, body) {
5085                 this.type = syntax_1.Syntax.ClassDeclaration;
5086                 this.id = id;
5087                 this.superClass = superClass;
5088                 this.body = body;
5089             }
5090             return ClassDeclaration;
5091         }());
5092         exports.ClassDeclaration = ClassDeclaration;
5093         var ClassExpression = (function () {
5094             function ClassExpression(id, superClass, body) {
5095                 this.type = syntax_1.Syntax.ClassExpression;
5096                 this.id = id;
5097                 this.superClass = superClass;
5098                 this.body = body;
5099             }
5100             return ClassExpression;
5101         }());
5102         exports.ClassExpression = ClassExpression;
5103         var ComputedMemberExpression = (function () {
5104             function ComputedMemberExpression(object, property) {
5105                 this.type = syntax_1.Syntax.MemberExpression;
5106                 this.computed = true;
5107                 this.object = object;
5108                 this.property = property;
5109             }
5110             return ComputedMemberExpression;
5111         }());
5112         exports.ComputedMemberExpression = ComputedMemberExpression;
5113         var ConditionalExpression = (function () {
5114             function ConditionalExpression(test, consequent, alternate) {
5115                 this.type = syntax_1.Syntax.ConditionalExpression;
5116                 this.test = test;
5117                 this.consequent = consequent;
5118                 this.alternate = alternate;
5119             }
5120             return ConditionalExpression;
5121         }());
5122         exports.ConditionalExpression = ConditionalExpression;
5123         var ContinueStatement = (function () {
5124             function ContinueStatement(label) {
5125                 this.type = syntax_1.Syntax.ContinueStatement;
5126                 this.label = label;
5127             }
5128             return ContinueStatement;
5129         }());
5130         exports.ContinueStatement = ContinueStatement;
5131         var DebuggerStatement = (function () {
5132             function DebuggerStatement() {
5133                 this.type = syntax_1.Syntax.DebuggerStatement;
5134             }
5135             return DebuggerStatement;
5136         }());
5137         exports.DebuggerStatement = DebuggerStatement;
5138         var Directive = (function () {
5139             function Directive(expression, directive) {
5140                 this.type = syntax_1.Syntax.ExpressionStatement;
5141                 this.expression = expression;
5142                 this.directive = directive;
5143             }
5144             return Directive;
5145         }());
5146         exports.Directive = Directive;
5147         var DoWhileStatement = (function () {
5148             function DoWhileStatement(body, test) {
5149                 this.type = syntax_1.Syntax.DoWhileStatement;
5150                 this.body = body;
5151                 this.test = test;
5152             }
5153             return DoWhileStatement;
5154         }());
5155         exports.DoWhileStatement = DoWhileStatement;
5156         var EmptyStatement = (function () {
5157             function EmptyStatement() {
5158                 this.type = syntax_1.Syntax.EmptyStatement;
5159             }
5160             return EmptyStatement;
5161         }());
5162         exports.EmptyStatement = EmptyStatement;
5163         var ExportAllDeclaration = (function () {
5164             function ExportAllDeclaration(source) {
5165                 this.type = syntax_1.Syntax.ExportAllDeclaration;
5166                 this.source = source;
5167             }
5168             return ExportAllDeclaration;
5169         }());
5170         exports.ExportAllDeclaration = ExportAllDeclaration;
5171         var ExportDefaultDeclaration = (function () {
5172             function ExportDefaultDeclaration(declaration) {
5173                 this.type = syntax_1.Syntax.ExportDefaultDeclaration;
5174                 this.declaration = declaration;
5175             }
5176             return ExportDefaultDeclaration;
5177         }());
5178         exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
5179         var ExportNamedDeclaration = (function () {
5180             function ExportNamedDeclaration(declaration, specifiers, source) {
5181                 this.type = syntax_1.Syntax.ExportNamedDeclaration;
5182                 this.declaration = declaration;
5183                 this.specifiers = specifiers;
5184                 this.source = source;
5185             }
5186             return ExportNamedDeclaration;
5187         }());
5188         exports.ExportNamedDeclaration = ExportNamedDeclaration;
5189         var ExportSpecifier = (function () {
5190             function ExportSpecifier(local, exported) {
5191                 this.type = syntax_1.Syntax.ExportSpecifier;
5192                 this.exported = exported;
5193                 this.local = local;
5194             }
5195             return ExportSpecifier;
5196         }());
5197         exports.ExportSpecifier = ExportSpecifier;
5198         var ExpressionStatement = (function () {
5199             function ExpressionStatement(expression) {
5200                 this.type = syntax_1.Syntax.ExpressionStatement;
5201                 this.expression = expression;
5202             }
5203             return ExpressionStatement;
5204         }());
5205         exports.ExpressionStatement = ExpressionStatement;
5206         var ForInStatement = (function () {
5207             function ForInStatement(left, right, body) {
5208                 this.type = syntax_1.Syntax.ForInStatement;
5209                 this.left = left;
5210                 this.right = right;
5211                 this.body = body;
5212                 this.each = false;
5213             }
5214             return ForInStatement;
5215         }());
5216         exports.ForInStatement = ForInStatement;
5217         var ForOfStatement = (function () {
5218             function ForOfStatement(left, right, body) {
5219                 this.type = syntax_1.Syntax.ForOfStatement;
5220                 this.left = left;
5221                 this.right = right;
5222                 this.body = body;
5223             }
5224             return ForOfStatement;
5225         }());
5226         exports.ForOfStatement = ForOfStatement;
5227         var ForStatement = (function () {
5228             function ForStatement(init, test, update, body) {
5229                 this.type = syntax_1.Syntax.ForStatement;
5230                 this.init = init;
5231                 this.test = test;
5232                 this.update = update;
5233                 this.body = body;
5234             }
5235             return ForStatement;
5236         }());
5237         exports.ForStatement = ForStatement;
5238         var FunctionDeclaration = (function () {
5239             function FunctionDeclaration(id, params, body, generator) {
5240                 this.type = syntax_1.Syntax.FunctionDeclaration;
5241                 this.id = id;
5242                 this.params = params;
5243                 this.body = body;
5244                 this.generator = generator;
5245                 this.expression = false;
5246                 this.async = false;
5247             }
5248             return FunctionDeclaration;
5249         }());
5250         exports.FunctionDeclaration = FunctionDeclaration;
5251         var FunctionExpression = (function () {
5252             function FunctionExpression(id, params, body, generator) {
5253                 this.type = syntax_1.Syntax.FunctionExpression;
5254                 this.id = id;
5255                 this.params = params;
5256                 this.body = body;
5257                 this.generator = generator;
5258                 this.expression = false;
5259                 this.async = false;
5260             }
5261             return FunctionExpression;
5262         }());
5263         exports.FunctionExpression = FunctionExpression;
5264         var Identifier = (function () {
5265             function Identifier(name) {
5266                 this.type = syntax_1.Syntax.Identifier;
5267                 this.name = name;
5268             }
5269             return Identifier;
5270         }());
5271         exports.Identifier = Identifier;
5272         var IfStatement = (function () {
5273             function IfStatement(test, consequent, alternate) {
5274                 this.type = syntax_1.Syntax.IfStatement;
5275                 this.test = test;
5276                 this.consequent = consequent;
5277                 this.alternate = alternate;
5278             }
5279             return IfStatement;
5280         }());
5281         exports.IfStatement = IfStatement;
5282         var ImportDeclaration = (function () {
5283             function ImportDeclaration(specifiers, source) {
5284                 this.type = syntax_1.Syntax.ImportDeclaration;
5285                 this.specifiers = specifiers;
5286                 this.source = source;
5287             }
5288             return ImportDeclaration;
5289         }());
5290         exports.ImportDeclaration = ImportDeclaration;
5291         var ImportDefaultSpecifier = (function () {
5292             function ImportDefaultSpecifier(local) {
5293                 this.type = syntax_1.Syntax.ImportDefaultSpecifier;
5294                 this.local = local;
5295             }
5296             return ImportDefaultSpecifier;
5297         }());
5298         exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
5299         var ImportNamespaceSpecifier = (function () {
5300             function ImportNamespaceSpecifier(local) {
5301                 this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
5302                 this.local = local;
5303             }
5304             return ImportNamespaceSpecifier;
5305         }());
5306         exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
5307         var ImportSpecifier = (function () {
5308             function ImportSpecifier(local, imported) {
5309                 this.type = syntax_1.Syntax.ImportSpecifier;
5310                 this.local = local;
5311                 this.imported = imported;
5312             }
5313             return ImportSpecifier;
5314         }());
5315         exports.ImportSpecifier = ImportSpecifier;
5316         var LabeledStatement = (function () {
5317             function LabeledStatement(label, body) {
5318                 this.type = syntax_1.Syntax.LabeledStatement;
5319                 this.label = label;
5320                 this.body = body;
5321             }
5322             return LabeledStatement;
5323         }());
5324         exports.LabeledStatement = LabeledStatement;
5325         var Literal = (function () {
5326             function Literal(value, raw) {
5327                 this.type = syntax_1.Syntax.Literal;
5328                 this.value = value;
5329                 this.raw = raw;
5330             }
5331             return Literal;
5332         }());
5333         exports.Literal = Literal;
5334         var MetaProperty = (function () {
5335             function MetaProperty(meta, property) {
5336                 this.type = syntax_1.Syntax.MetaProperty;
5337                 this.meta = meta;
5338                 this.property = property;
5339             }
5340             return MetaProperty;
5341         }());
5342         exports.MetaProperty = MetaProperty;
5343         var MethodDefinition = (function () {
5344             function MethodDefinition(key, computed, value, kind, isStatic) {
5345                 this.type = syntax_1.Syntax.MethodDefinition;
5346                 this.key = key;
5347                 this.computed = computed;
5348                 this.value = value;
5349                 this.kind = kind;
5350                 this.static = isStatic;
5351             }
5352             return MethodDefinition;
5353         }());
5354         exports.MethodDefinition = MethodDefinition;
5355         var Module = (function () {
5356             function Module(body) {
5357                 this.type = syntax_1.Syntax.Program;
5358                 this.body = body;
5359                 this.sourceType = 'module';
5360             }
5361             return Module;
5362         }());
5363         exports.Module = Module;
5364         var NewExpression = (function () {
5365             function NewExpression(callee, args) {
5366                 this.type = syntax_1.Syntax.NewExpression;
5367                 this.callee = callee;
5368                 this.arguments = args;
5369             }
5370             return NewExpression;
5371         }());
5372         exports.NewExpression = NewExpression;
5373         var ObjectExpression = (function () {
5374             function ObjectExpression(properties) {
5375                 this.type = syntax_1.Syntax.ObjectExpression;
5376                 this.properties = properties;
5377             }
5378             return ObjectExpression;
5379         }());
5380         exports.ObjectExpression = ObjectExpression;
5381         var ObjectPattern = (function () {
5382             function ObjectPattern(properties) {
5383                 this.type = syntax_1.Syntax.ObjectPattern;
5384                 this.properties = properties;
5385             }
5386             return ObjectPattern;
5387         }());
5388         exports.ObjectPattern = ObjectPattern;
5389         var Property = (function () {
5390             function Property(kind, key, computed, value, method, shorthand) {
5391                 this.type = syntax_1.Syntax.Property;
5392                 this.key = key;
5393                 this.computed = computed;
5394                 this.value = value;
5395                 this.kind = kind;
5396                 this.method = method;
5397                 this.shorthand = shorthand;
5398             }
5399             return Property;
5400         }());
5401         exports.Property = Property;
5402         var RegexLiteral = (function () {
5403             function RegexLiteral(value, raw, pattern, flags) {
5404                 this.type = syntax_1.Syntax.Literal;
5405                 this.value = value;
5406                 this.raw = raw;
5407                 this.regex = { pattern: pattern, flags: flags };
5408             }
5409             return RegexLiteral;
5410         }());
5411         exports.RegexLiteral = RegexLiteral;
5412         var RestElement = (function () {
5413             function RestElement(argument) {
5414                 this.type = syntax_1.Syntax.RestElement;
5415                 this.argument = argument;
5416             }
5417             return RestElement;
5418         }());
5419         exports.RestElement = RestElement;
5420         var ReturnStatement = (function () {
5421             function ReturnStatement(argument) {
5422                 this.type = syntax_1.Syntax.ReturnStatement;
5423                 this.argument = argument;
5424             }
5425             return ReturnStatement;
5426         }());
5427         exports.ReturnStatement = ReturnStatement;
5428         var Script = (function () {
5429             function Script(body) {
5430                 this.type = syntax_1.Syntax.Program;
5431                 this.body = body;
5432                 this.sourceType = 'script';
5433             }
5434             return Script;
5435         }());
5436         exports.Script = Script;
5437         var SequenceExpression = (function () {
5438             function SequenceExpression(expressions) {
5439                 this.type = syntax_1.Syntax.SequenceExpression;
5440                 this.expressions = expressions;
5441             }
5442             return SequenceExpression;
5443         }());
5444         exports.SequenceExpression = SequenceExpression;
5445         var SpreadElement = (function () {
5446             function SpreadElement(argument) {
5447                 this.type = syntax_1.Syntax.SpreadElement;
5448                 this.argument = argument;
5449             }
5450             return SpreadElement;
5451         }());
5452         exports.SpreadElement = SpreadElement;
5453         var StaticMemberExpression = (function () {
5454             function StaticMemberExpression(object, property) {
5455                 this.type = syntax_1.Syntax.MemberExpression;
5456                 this.computed = false;
5457                 this.object = object;
5458                 this.property = property;
5459             }
5460             return StaticMemberExpression;
5461         }());
5462         exports.StaticMemberExpression = StaticMemberExpression;
5463         var Super = (function () {
5464             function Super() {
5465                 this.type = syntax_1.Syntax.Super;
5466             }
5467             return Super;
5468         }());
5469         exports.Super = Super;
5470         var SwitchCase = (function () {
5471             function SwitchCase(test, consequent) {
5472                 this.type = syntax_1.Syntax.SwitchCase;
5473                 this.test = test;
5474                 this.consequent = consequent;
5475             }
5476             return SwitchCase;
5477         }());
5478         exports.SwitchCase = SwitchCase;
5479         var SwitchStatement = (function () {
5480             function SwitchStatement(discriminant, cases) {
5481                 this.type = syntax_1.Syntax.SwitchStatement;
5482                 this.discriminant = discriminant;
5483                 this.cases = cases;
5484             }
5485             return SwitchStatement;
5486         }());
5487         exports.SwitchStatement = SwitchStatement;
5488         var TaggedTemplateExpression = (function () {
5489             function TaggedTemplateExpression(tag, quasi) {
5490                 this.type = syntax_1.Syntax.TaggedTemplateExpression;
5491                 this.tag = tag;
5492                 this.quasi = quasi;
5493             }
5494             return TaggedTemplateExpression;
5495         }());
5496         exports.TaggedTemplateExpression = TaggedTemplateExpression;
5497         var TemplateElement = (function () {
5498             function TemplateElement(value, tail) {
5499                 this.type = syntax_1.Syntax.TemplateElement;
5500                 this.value = value;
5501                 this.tail = tail;
5502             }
5503             return TemplateElement;
5504         }());
5505         exports.TemplateElement = TemplateElement;
5506         var TemplateLiteral = (function () {
5507             function TemplateLiteral(quasis, expressions) {
5508                 this.type = syntax_1.Syntax.TemplateLiteral;
5509                 this.quasis = quasis;
5510                 this.expressions = expressions;
5511             }
5512             return TemplateLiteral;
5513         }());
5514         exports.TemplateLiteral = TemplateLiteral;
5515         var ThisExpression = (function () {
5516             function ThisExpression() {
5517                 this.type = syntax_1.Syntax.ThisExpression;
5518             }
5519             return ThisExpression;
5520         }());
5521         exports.ThisExpression = ThisExpression;
5522         var ThrowStatement = (function () {
5523             function ThrowStatement(argument) {
5524                 this.type = syntax_1.Syntax.ThrowStatement;
5525                 this.argument = argument;
5526             }
5527             return ThrowStatement;
5528         }());
5529         exports.ThrowStatement = ThrowStatement;
5530         var TryStatement = (function () {
5531             function TryStatement(block, handler, finalizer) {
5532                 this.type = syntax_1.Syntax.TryStatement;
5533                 this.block = block;
5534                 this.handler = handler;
5535                 this.finalizer = finalizer;
5536             }
5537             return TryStatement;
5538         }());
5539         exports.TryStatement = TryStatement;
5540         var UnaryExpression = (function () {
5541             function UnaryExpression(operator, argument) {
5542                 this.type = syntax_1.Syntax.UnaryExpression;
5543                 this.operator = operator;
5544                 this.argument = argument;
5545                 this.prefix = true;
5546             }
5547             return UnaryExpression;
5548         }());
5549         exports.UnaryExpression = UnaryExpression;
5550         var UpdateExpression = (function () {
5551             function UpdateExpression(operator, argument, prefix) {
5552                 this.type = syntax_1.Syntax.UpdateExpression;
5553                 this.operator = operator;
5554                 this.argument = argument;
5555                 this.prefix = prefix;
5556             }
5557             return UpdateExpression;
5558         }());
5559         exports.UpdateExpression = UpdateExpression;
5560         var VariableDeclaration = (function () {
5561             function VariableDeclaration(declarations, kind) {
5562                 this.type = syntax_1.Syntax.VariableDeclaration;
5563                 this.declarations = declarations;
5564                 this.kind = kind;
5565             }
5566             return VariableDeclaration;
5567         }());
5568         exports.VariableDeclaration = VariableDeclaration;
5569         var VariableDeclarator = (function () {
5570             function VariableDeclarator(id, init) {
5571                 this.type = syntax_1.Syntax.VariableDeclarator;
5572                 this.id = id;
5573                 this.init = init;
5574             }
5575             return VariableDeclarator;
5576         }());
5577         exports.VariableDeclarator = VariableDeclarator;
5578         var WhileStatement = (function () {
5579             function WhileStatement(test, body) {
5580                 this.type = syntax_1.Syntax.WhileStatement;
5581                 this.test = test;
5582                 this.body = body;
5583             }
5584             return WhileStatement;
5585         }());
5586         exports.WhileStatement = WhileStatement;
5587         var WithStatement = (function () {
5588             function WithStatement(object, body) {
5589                 this.type = syntax_1.Syntax.WithStatement;
5590                 this.object = object;
5591                 this.body = body;
5592             }
5593             return WithStatement;
5594         }());
5595         exports.WithStatement = WithStatement;
5596         var YieldExpression = (function () {
5597             function YieldExpression(argument, delegate) {
5598                 this.type = syntax_1.Syntax.YieldExpression;
5599                 this.argument = argument;
5600                 this.delegate = delegate;
5601             }
5602             return YieldExpression;
5603         }());
5604         exports.YieldExpression = YieldExpression;
5605
5606
5607 /***/ },
5608 /* 8 */
5609 /***/ function(module, exports, __webpack_require__) {
5610
5611         "use strict";
5612         Object.defineProperty(exports, "__esModule", { value: true });
5613         var assert_1 = __webpack_require__(9);
5614         var error_handler_1 = __webpack_require__(10);
5615         var messages_1 = __webpack_require__(11);
5616         var Node = __webpack_require__(7);
5617         var scanner_1 = __webpack_require__(12);
5618         var syntax_1 = __webpack_require__(2);
5619         var token_1 = __webpack_require__(13);
5620         var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
5621         var Parser = (function () {
5622             function Parser(code, options, delegate) {
5623                 if (options === void 0) { options = {}; }
5624                 this.config = {
5625                     range: (typeof options.range === 'boolean') && options.range,
5626                     loc: (typeof options.loc === 'boolean') && options.loc,
5627                     source: null,
5628                     tokens: (typeof options.tokens === 'boolean') && options.tokens,
5629                     comment: (typeof options.comment === 'boolean') && options.comment,
5630                     tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
5631                 };
5632                 if (this.config.loc && options.source && options.source !== null) {
5633                     this.config.source = String(options.source);
5634                 }
5635                 this.delegate = delegate;
5636                 this.errorHandler = new error_handler_1.ErrorHandler();
5637                 this.errorHandler.tolerant = this.config.tolerant;
5638                 this.scanner = new scanner_1.Scanner(code, this.errorHandler);
5639                 this.scanner.trackComment = this.config.comment;
5640                 this.operatorPrecedence = {
5641                     ')': 0,
5642                     ';': 0,
5643                     ',': 0,
5644                     '=': 0,
5645                     ']': 0,
5646                     '||': 1,
5647                     '&&': 2,
5648                     '|': 3,
5649                     '^': 4,
5650                     '&': 5,
5651                     '==': 6,
5652                     '!=': 6,
5653                     '===': 6,
5654                     '!==': 6,
5655                     '<': 7,
5656                     '>': 7,
5657                     '<=': 7,
5658                     '>=': 7,
5659                     '<<': 8,
5660                     '>>': 8,
5661                     '>>>': 8,
5662                     '+': 9,
5663                     '-': 9,
5664                     '*': 11,
5665                     '/': 11,
5666                     '%': 11
5667                 };
5668                 this.lookahead = {
5669                     type: 2 /* EOF */,
5670                     value: '',
5671                     lineNumber: this.scanner.lineNumber,
5672                     lineStart: 0,
5673                     start: 0,
5674                     end: 0
5675                 };
5676                 this.hasLineTerminator = false;
5677                 this.context = {
5678                     isModule: false,
5679                     await: false,
5680                     allowIn: true,
5681                     allowStrictDirective: true,
5682                     allowYield: true,
5683                     firstCoverInitializedNameError: null,
5684                     isAssignmentTarget: false,
5685                     isBindingElement: false,
5686                     inFunctionBody: false,
5687                     inIteration: false,
5688                     inSwitch: false,
5689                     labelSet: {},
5690                     strict: false
5691                 };
5692                 this.tokens = [];
5693                 this.startMarker = {
5694                     index: 0,
5695                     line: this.scanner.lineNumber,
5696                     column: 0
5697                 };
5698                 this.lastMarker = {
5699                     index: 0,
5700                     line: this.scanner.lineNumber,
5701                     column: 0
5702                 };
5703                 this.nextToken();
5704                 this.lastMarker = {
5705                     index: this.scanner.index,
5706                     line: this.scanner.lineNumber,
5707                     column: this.scanner.index - this.scanner.lineStart
5708                 };
5709             }
5710             Parser.prototype.throwError = function (messageFormat) {
5711                 var values = [];
5712                 for (var _i = 1; _i < arguments.length; _i++) {
5713                     values[_i - 1] = arguments[_i];
5714                 }
5715                 var args = Array.prototype.slice.call(arguments, 1);
5716                 var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
5717                     assert_1.assert(idx < args.length, 'Message reference must be in range');
5718                     return args[idx];
5719                 });
5720                 var index = this.lastMarker.index;
5721                 var line = this.lastMarker.line;
5722                 var column = this.lastMarker.column + 1;
5723                 throw this.errorHandler.createError(index, line, column, msg);
5724             };
5725             Parser.prototype.tolerateError = function (messageFormat) {
5726                 var values = [];
5727                 for (var _i = 1; _i < arguments.length; _i++) {
5728                     values[_i - 1] = arguments[_i];
5729                 }
5730                 var args = Array.prototype.slice.call(arguments, 1);
5731                 var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
5732                     assert_1.assert(idx < args.length, 'Message reference must be in range');
5733                     return args[idx];
5734                 });
5735                 var index = this.lastMarker.index;
5736                 var line = this.scanner.lineNumber;
5737                 var column = this.lastMarker.column + 1;
5738                 this.errorHandler.tolerateError(index, line, column, msg);
5739             };
5740             // Throw an exception because of the token.
5741             Parser.prototype.unexpectedTokenError = function (token, message) {
5742                 var msg = message || messages_1.Messages.UnexpectedToken;
5743                 var value;
5744                 if (token) {
5745                     if (!message) {
5746                         msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS :
5747                             (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier :
5748                                 (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber :
5749                                     (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString :
5750                                         (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate :
5751                                             messages_1.Messages.UnexpectedToken;
5752                         if (token.type === 4 /* Keyword */) {
5753                             if (this.scanner.isFutureReservedWord(token.value)) {
5754                                 msg = messages_1.Messages.UnexpectedReserved;
5755                             }
5756                             else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
5757                                 msg = messages_1.Messages.StrictReservedWord;
5758                             }
5759                         }
5760                     }
5761                     value = token.value;
5762                 }
5763                 else {
5764                     value = 'ILLEGAL';
5765                 }
5766                 msg = msg.replace('%0', value);
5767                 if (token && typeof token.lineNumber === 'number') {
5768                     var index = token.start;
5769                     var line = token.lineNumber;
5770                     var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column;
5771                     var column = token.start - lastMarkerLineStart + 1;
5772                     return this.errorHandler.createError(index, line, column, msg);
5773                 }
5774                 else {
5775                     var index = this.lastMarker.index;
5776                     var line = this.lastMarker.line;
5777                     var column = this.lastMarker.column + 1;
5778                     return this.errorHandler.createError(index, line, column, msg);
5779                 }
5780             };
5781             Parser.prototype.throwUnexpectedToken = function (token, message) {
5782                 throw this.unexpectedTokenError(token, message);
5783             };
5784             Parser.prototype.tolerateUnexpectedToken = function (token, message) {
5785                 this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
5786             };
5787             Parser.prototype.collectComments = function () {
5788                 if (!this.config.comment) {
5789                     this.scanner.scanComments();
5790                 }
5791                 else {
5792                     var comments = this.scanner.scanComments();
5793                     if (comments.length > 0 && this.delegate) {
5794                         for (var i = 0; i < comments.length; ++i) {
5795                             var e = comments[i];
5796                             var node = void 0;
5797                             node = {
5798                                 type: e.multiLine ? 'BlockComment' : 'LineComment',
5799                                 value: this.scanner.source.slice(e.slice[0], e.slice[1])
5800                             };
5801                             if (this.config.range) {
5802                                 node.range = e.range;
5803                             }
5804                             if (this.config.loc) {
5805                                 node.loc = e.loc;
5806                             }
5807                             var metadata = {
5808                                 start: {
5809                                     line: e.loc.start.line,
5810                                     column: e.loc.start.column,
5811                                     offset: e.range[0]
5812                                 },
5813                                 end: {
5814                                     line: e.loc.end.line,
5815                                     column: e.loc.end.column,
5816                                     offset: e.range[1]
5817                                 }
5818                             };
5819                             this.delegate(node, metadata);
5820                         }
5821                     }
5822                 }
5823             };
5824             // From internal representation to an external structure
5825             Parser.prototype.getTokenRaw = function (token) {
5826                 return this.scanner.source.slice(token.start, token.end);
5827             };
5828             Parser.prototype.convertToken = function (token) {
5829                 var t = {
5830                     type: token_1.TokenName[token.type],
5831                     value: this.getTokenRaw(token)
5832                 };
5833                 if (this.config.range) {
5834                     t.range = [token.start, token.end];
5835                 }
5836                 if (this.config.loc) {
5837                     t.loc = {
5838                         start: {
5839                             line: this.startMarker.line,
5840                             column: this.startMarker.column
5841                         },
5842                         end: {
5843                             line: this.scanner.lineNumber,
5844                             column: this.scanner.index - this.scanner.lineStart
5845                         }
5846                     };
5847                 }
5848                 if (token.type === 9 /* RegularExpression */) {
5849                     var pattern = token.pattern;
5850                     var flags = token.flags;
5851                     t.regex = { pattern: pattern, flags: flags };
5852                 }
5853                 return t;
5854             };
5855             Parser.prototype.nextToken = function () {
5856                 var token = this.lookahead;
5857                 this.lastMarker.index = this.scanner.index;
5858                 this.lastMarker.line = this.scanner.lineNumber;
5859                 this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
5860                 this.collectComments();
5861                 if (this.scanner.index !== this.startMarker.index) {
5862                     this.startMarker.index = this.scanner.index;
5863                     this.startMarker.line = this.scanner.lineNumber;
5864                     this.startMarker.column = this.scanner.index - this.scanner.lineStart;
5865                 }
5866                 var next = this.scanner.lex();
5867                 this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
5868                 if (next && this.context.strict && next.type === 3 /* Identifier */) {
5869                     if (this.scanner.isStrictModeReservedWord(next.value)) {
5870                         next.type = 4 /* Keyword */;
5871                     }
5872                 }
5873                 this.lookahead = next;
5874                 if (this.config.tokens && next.type !== 2 /* EOF */) {
5875                     this.tokens.push(this.convertToken(next));
5876                 }
5877                 return token;
5878             };
5879             Parser.prototype.nextRegexToken = function () {
5880                 this.collectComments();
5881                 var token = this.scanner.scanRegExp();
5882                 if (this.config.tokens) {
5883                     // Pop the previous token, '/' or '/='
5884                     // This is added from the lookahead token.
5885                     this.tokens.pop();
5886                     this.tokens.push(this.convertToken(token));
5887                 }
5888                 // Prime the next lookahead.
5889                 this.lookahead = token;
5890                 this.nextToken();
5891                 return token;
5892             };
5893             Parser.prototype.createNode = function () {
5894                 return {
5895                     index: this.startMarker.index,
5896                     line: this.startMarker.line,
5897                     column: this.startMarker.column
5898                 };
5899             };
5900             Parser.prototype.startNode = function (token, lastLineStart) {
5901                 if (lastLineStart === void 0) { lastLineStart = 0; }
5902                 var column = token.start - token.lineStart;
5903                 var line = token.lineNumber;
5904                 if (column < 0) {
5905                     column += lastLineStart;
5906                     line--;
5907                 }
5908                 return {
5909                     index: token.start,
5910                     line: line,
5911                     column: column
5912                 };
5913             };
5914             Parser.prototype.finalize = function (marker, node) {
5915                 if (this.config.range) {
5916                     node.range = [marker.index, this.lastMarker.index];
5917                 }
5918                 if (this.config.loc) {
5919                     node.loc = {
5920                         start: {
5921                             line: marker.line,
5922                             column: marker.column,
5923                         },
5924                         end: {
5925                             line: this.lastMarker.line,
5926                             column: this.lastMarker.column
5927                         }
5928                     };
5929                     if (this.config.source) {
5930                         node.loc.source = this.config.source;
5931                     }
5932                 }
5933                 if (this.delegate) {
5934                     var metadata = {
5935                         start: {
5936                             line: marker.line,
5937                             column: marker.column,
5938                             offset: marker.index
5939                         },
5940                         end: {
5941                             line: this.lastMarker.line,
5942                             column: this.lastMarker.column,
5943                             offset: this.lastMarker.index
5944                         }
5945                     };
5946                     this.delegate(node, metadata);
5947                 }
5948                 return node;
5949             };
5950             // Expect the next token to match the specified punctuator.
5951             // If not, an exception will be thrown.
5952             Parser.prototype.expect = function (value) {
5953                 var token = this.nextToken();
5954                 if (token.type !== 7 /* Punctuator */ || token.value !== value) {
5955                     this.throwUnexpectedToken(token);
5956                 }
5957             };
5958             // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
5959             Parser.prototype.expectCommaSeparator = function () {
5960                 if (this.config.tolerant) {
5961                     var token = this.lookahead;
5962                     if (token.type === 7 /* Punctuator */ && token.value === ',') {
5963                         this.nextToken();
5964                     }
5965                     else if (token.type === 7 /* Punctuator */ && token.value === ';') {
5966                         this.nextToken();
5967                         this.tolerateUnexpectedToken(token);
5968                     }
5969                     else {
5970                         this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
5971                     }
5972                 }
5973                 else {
5974                     this.expect(',');
5975                 }
5976             };
5977             // Expect the next token to match the specified keyword.
5978             // If not, an exception will be thrown.
5979             Parser.prototype.expectKeyword = function (keyword) {
5980                 var token = this.nextToken();
5981                 if (token.type !== 4 /* Keyword */ || token.value !== keyword) {
5982                     this.throwUnexpectedToken(token);
5983                 }
5984             };
5985             // Return true if the next token matches the specified punctuator.
5986             Parser.prototype.match = function (value) {
5987                 return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value;
5988             };
5989             // Return true if the next token matches the specified keyword
5990             Parser.prototype.matchKeyword = function (keyword) {
5991                 return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword;
5992             };
5993             // Return true if the next token matches the specified contextual keyword
5994             // (where an identifier is sometimes a keyword depending on the context)
5995             Parser.prototype.matchContextualKeyword = function (keyword) {
5996                 return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword;
5997             };
5998             // Return true if the next token is an assignment operator
5999             Parser.prototype.matchAssign = function () {
6000                 if (this.lookahead.type !== 7 /* Punctuator */) {
6001                     return false;
6002                 }
6003                 var op = this.lookahead.value;
6004                 return op === '=' ||
6005                     op === '*=' ||
6006                     op === '**=' ||
6007                     op === '/=' ||
6008                     op === '%=' ||
6009                     op === '+=' ||
6010                     op === '-=' ||
6011                     op === '<<=' ||
6012                     op === '>>=' ||
6013                     op === '>>>=' ||
6014                     op === '&=' ||
6015                     op === '^=' ||
6016                     op === '|=';
6017             };
6018             // Cover grammar support.
6019             //
6020             // When an assignment expression position starts with an left parenthesis, the determination of the type
6021             // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
6022             // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
6023             //
6024             // There are three productions that can be parsed in a parentheses pair that needs to be determined
6025             // after the outermost pair is closed. They are:
6026             //
6027             //   1. AssignmentExpression
6028             //   2. BindingElements
6029             //   3. AssignmentTargets
6030             //
6031             // In order to avoid exponential backtracking, we use two flags to denote if the production can be
6032             // binding element or assignment target.
6033             //
6034             // The three productions have the relationship:
6035             //
6036             //   BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
6037             //
6038             // with a single exception that CoverInitializedName when used directly in an Expression, generates
6039             // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
6040             // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
6041             //
6042             // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
6043             // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
6044             // the CoverInitializedName check is conducted.
6045             //
6046             // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
6047             // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
6048             // pattern. The CoverInitializedName check is deferred.
6049             Parser.prototype.isolateCoverGrammar = function (parseFunction) {
6050                 var previousIsBindingElement = this.context.isBindingElement;
6051                 var previousIsAssignmentTarget = this.context.isAssignmentTarget;
6052                 var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
6053                 this.context.isBindingElement = true;
6054                 this.context.isAssignmentTarget = true;
6055                 this.context.firstCoverInitializedNameError = null;
6056                 var result = parseFunction.call(this);
6057                 if (this.context.firstCoverInitializedNameError !== null) {
6058                     this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
6059                 }
6060                 this.context.isBindingElement = previousIsBindingElement;
6061                 this.context.isAssignmentTarget = previousIsAssignmentTarget;
6062                 this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
6063                 return result;
6064             };
6065             Parser.prototype.inheritCoverGrammar = function (parseFunction) {
6066                 var previousIsBindingElement = this.context.isBindingElement;
6067                 var previousIsAssignmentTarget = this.context.isAssignmentTarget;
6068                 var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
6069                 this.context.isBindingElement = true;
6070                 this.context.isAssignmentTarget = true;
6071                 this.context.firstCoverInitializedNameError = null;
6072                 var result = parseFunction.call(this);
6073                 this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
6074                 this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
6075                 this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
6076                 return result;
6077             };
6078             Parser.prototype.consumeSemicolon = function () {
6079                 if (this.match(';')) {
6080                     this.nextToken();
6081                 }
6082                 else if (!this.hasLineTerminator) {
6083                     if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) {
6084                         this.throwUnexpectedToken(this.lookahead);
6085                     }
6086                     this.lastMarker.index = this.startMarker.index;
6087                     this.lastMarker.line = this.startMarker.line;
6088                     this.lastMarker.column = this.startMarker.column;
6089                 }
6090             };
6091             // https://tc39.github.io/ecma262/#sec-primary-expression
6092             Parser.prototype.parsePrimaryExpression = function () {
6093                 var node = this.createNode();
6094                 var expr;
6095                 var token, raw;
6096                 switch (this.lookahead.type) {
6097                     case 3 /* Identifier */:
6098                         if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') {
6099                             this.tolerateUnexpectedToken(this.lookahead);
6100                         }
6101                         expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value));
6102                         break;
6103                     case 6 /* NumericLiteral */:
6104                     case 8 /* StringLiteral */:
6105                         if (this.context.strict && this.lookahead.octal) {
6106                             this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
6107                         }
6108                         this.context.isAssignmentTarget = false;
6109                         this.context.isBindingElement = false;
6110                         token = this.nextToken();
6111                         raw = this.getTokenRaw(token);
6112                         expr = this.finalize(node, new Node.Literal(token.value, raw));
6113                         break;
6114                     case 1 /* BooleanLiteral */:
6115                         this.context.isAssignmentTarget = false;
6116                         this.context.isBindingElement = false;
6117                         token = this.nextToken();
6118                         raw = this.getTokenRaw(token);
6119                         expr = this.finalize(node, new Node.Literal(token.value === 'true', raw));
6120                         break;
6121                     case 5 /* NullLiteral */:
6122                         this.context.isAssignmentTarget = false;
6123                         this.context.isBindingElement = false;
6124                         token = this.nextToken();
6125                         raw = this.getTokenRaw(token);
6126                         expr = this.finalize(node, new Node.Literal(null, raw));
6127                         break;
6128                     case 10 /* Template */:
6129                         expr = this.parseTemplateLiteral();
6130                         break;
6131                     case 7 /* Punctuator */:
6132                         switch (this.lookahead.value) {
6133                             case '(':
6134                                 this.context.isBindingElement = false;
6135                                 expr = this.inheritCoverGrammar(this.parseGroupExpression);
6136                                 break;
6137                             case '[':
6138                                 expr = this.inheritCoverGrammar(this.parseArrayInitializer);
6139                                 break;
6140                             case '{':
6141                                 expr = this.inheritCoverGrammar(this.parseObjectInitializer);
6142                                 break;
6143                             case '/':
6144                             case '/=':
6145                                 this.context.isAssignmentTarget = false;
6146                                 this.context.isBindingElement = false;
6147                                 this.scanner.index = this.startMarker.index;
6148                                 token = this.nextRegexToken();
6149                                 raw = this.getTokenRaw(token);
6150                                 expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags));
6151                                 break;
6152                             default:
6153                                 expr = this.throwUnexpectedToken(this.nextToken());
6154                         }
6155                         break;
6156                     case 4 /* Keyword */:
6157                         if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
6158                             expr = this.parseIdentifierName();
6159                         }
6160                         else if (!this.context.strict && this.matchKeyword('let')) {
6161                             expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
6162                         }
6163                         else {
6164                             this.context.isAssignmentTarget = false;
6165                             this.context.isBindingElement = false;
6166                             if (this.matchKeyword('function')) {
6167                                 expr = this.parseFunctionExpression();
6168                             }
6169                             else if (this.matchKeyword('this')) {
6170                                 this.nextToken();
6171                                 expr = this.finalize(node, new Node.ThisExpression());
6172                             }
6173                             else if (this.matchKeyword('class')) {
6174                                 expr = this.parseClassExpression();
6175                             }
6176                             else {
6177                                 expr = this.throwUnexpectedToken(this.nextToken());
6178                             }
6179                         }
6180                         break;
6181                     default:
6182                         expr = this.throwUnexpectedToken(this.nextToken());
6183                 }
6184                 return expr;
6185             };
6186             // https://tc39.github.io/ecma262/#sec-array-initializer
6187             Parser.prototype.parseSpreadElement = function () {
6188                 var node = this.createNode();
6189                 this.expect('...');
6190                 var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
6191                 return this.finalize(node, new Node.SpreadElement(arg));
6192             };
6193             Parser.prototype.parseArrayInitializer = function () {
6194                 var node = this.createNode();
6195                 var elements = [];
6196                 this.expect('[');
6197                 while (!this.match(']')) {
6198                     if (this.match(',')) {
6199                         this.nextToken();
6200                         elements.push(null);
6201                     }
6202                     else if (this.match('...')) {
6203                         var element = this.parseSpreadElement();
6204                         if (!this.match(']')) {
6205                             this.context.isAssignmentTarget = false;
6206                             this.context.isBindingElement = false;
6207                             this.expect(',');
6208                         }
6209                         elements.push(element);
6210                     }
6211                     else {
6212                         elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
6213                         if (!this.match(']')) {
6214                             this.expect(',');
6215                         }
6216                     }
6217                 }
6218                 this.expect(']');
6219                 return this.finalize(node, new Node.ArrayExpression(elements));
6220             };
6221             // https://tc39.github.io/ecma262/#sec-object-initializer
6222             Parser.prototype.parsePropertyMethod = function (params) {
6223                 this.context.isAssignmentTarget = false;
6224                 this.context.isBindingElement = false;
6225                 var previousStrict = this.context.strict;
6226                 var previousAllowStrictDirective = this.context.allowStrictDirective;
6227                 this.context.allowStrictDirective = params.simple;
6228                 var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
6229                 if (this.context.strict && params.firstRestricted) {
6230                     this.tolerateUnexpectedToken(params.firstRestricted, params.message);
6231                 }
6232                 if (this.context.strict && params.stricted) {
6233                     this.tolerateUnexpectedToken(params.stricted, params.message);
6234                 }
6235                 this.context.strict = previousStrict;
6236                 this.context.allowStrictDirective = previousAllowStrictDirective;
6237                 return body;
6238             };
6239             Parser.prototype.parsePropertyMethodFunction = function () {
6240                 var isGenerator = false;
6241                 var node = this.createNode();
6242                 var previousAllowYield = this.context.allowYield;
6243                 this.context.allowYield = true;
6244                 var params = this.parseFormalParameters();
6245                 var method = this.parsePropertyMethod(params);
6246                 this.context.allowYield = previousAllowYield;
6247                 return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
6248             };
6249             Parser.prototype.parsePropertyMethodAsyncFunction = function () {
6250                 var node = this.createNode();
6251                 var previousAllowYield = this.context.allowYield;
6252                 var previousAwait = this.context.await;
6253                 this.context.allowYield = false;
6254                 this.context.await = true;
6255                 var params = this.parseFormalParameters();
6256                 var method = this.parsePropertyMethod(params);
6257                 this.context.allowYield = previousAllowYield;
6258                 this.context.await = previousAwait;
6259                 return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method));
6260             };
6261             Parser.prototype.parseObjectPropertyKey = function () {
6262                 var node = this.createNode();
6263                 var token = this.nextToken();
6264                 var key;
6265                 switch (token.type) {
6266                     case 8 /* StringLiteral */:
6267                     case 6 /* NumericLiteral */:
6268                         if (this.context.strict && token.octal) {
6269                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
6270                         }
6271                         var raw = this.getTokenRaw(token);
6272                         key = this.finalize(node, new Node.Literal(token.value, raw));
6273                         break;
6274                     case 3 /* Identifier */:
6275                     case 1 /* BooleanLiteral */:
6276                     case 5 /* NullLiteral */:
6277                     case 4 /* Keyword */:
6278                         key = this.finalize(node, new Node.Identifier(token.value));
6279                         break;
6280                     case 7 /* Punctuator */:
6281                         if (token.value === '[') {
6282                             key = this.isolateCoverGrammar(this.parseAssignmentExpression);
6283                             this.expect(']');
6284                         }
6285                         else {
6286                             key = this.throwUnexpectedToken(token);
6287                         }
6288                         break;
6289                     default:
6290                         key = this.throwUnexpectedToken(token);
6291                 }
6292                 return key;
6293             };
6294             Parser.prototype.isPropertyKey = function (key, value) {
6295                 return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
6296                     (key.type === syntax_1.Syntax.Literal && key.value === value);
6297             };
6298             Parser.prototype.parseObjectProperty = function (hasProto) {
6299                 var node = this.createNode();
6300                 var token = this.lookahead;
6301                 var kind;
6302                 var key = null;
6303                 var value = null;
6304                 var computed = false;
6305                 var method = false;
6306                 var shorthand = false;
6307                 var isAsync = false;
6308                 if (token.type === 3 /* Identifier */) {
6309                     var id = token.value;
6310                     this.nextToken();
6311                     computed = this.match('[');
6312                     isAsync = !this.hasLineTerminator && (id === 'async') &&
6313                         !this.match(':') && !this.match('(') && !this.match('*') && !this.match(',');
6314                     key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id));
6315                 }
6316                 else if (this.match('*')) {
6317                     this.nextToken();
6318                 }
6319                 else {
6320                     computed = this.match('[');
6321                     key = this.parseObjectPropertyKey();
6322                 }
6323                 var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
6324                 if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) {
6325                     kind = 'get';
6326                     computed = this.match('[');
6327                     key = this.parseObjectPropertyKey();
6328                     this.context.allowYield = false;
6329                     value = this.parseGetterMethod();
6330                 }
6331                 else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) {
6332                     kind = 'set';
6333                     computed = this.match('[');
6334                     key = this.parseObjectPropertyKey();
6335                     value = this.parseSetterMethod();
6336                 }
6337                 else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
6338                     kind = 'init';
6339                     computed = this.match('[');
6340                     key = this.parseObjectPropertyKey();
6341                     value = this.parseGeneratorMethod();
6342                     method = true;
6343                 }
6344                 else {
6345                     if (!key) {
6346                         this.throwUnexpectedToken(this.lookahead);
6347                     }
6348                     kind = 'init';
6349                     if (this.match(':') && !isAsync) {
6350                         if (!computed && this.isPropertyKey(key, '__proto__')) {
6351                             if (hasProto.value) {
6352                                 this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
6353                             }
6354                             hasProto.value = true;
6355                         }
6356                         this.nextToken();
6357                         value = this.inheritCoverGrammar(this.parseAssignmentExpression);
6358                     }
6359                     else if (this.match('(')) {
6360                         value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
6361                         method = true;
6362                     }
6363                     else if (token.type === 3 /* Identifier */) {
6364                         var id = this.finalize(node, new Node.Identifier(token.value));
6365                         if (this.match('=')) {
6366                             this.context.firstCoverInitializedNameError = this.lookahead;
6367                             this.nextToken();
6368                             shorthand = true;
6369                             var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
6370                             value = this.finalize(node, new Node.AssignmentPattern(id, init));
6371                         }
6372                         else {
6373                             shorthand = true;
6374                             value = id;
6375                         }
6376                     }
6377                     else {
6378                         this.throwUnexpectedToken(this.nextToken());
6379                     }
6380                 }
6381                 return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
6382             };
6383             Parser.prototype.parseObjectInitializer = function () {
6384                 var node = this.createNode();
6385                 this.expect('{');
6386                 var properties = [];
6387                 var hasProto = { value: false };
6388                 while (!this.match('}')) {
6389                     properties.push(this.parseObjectProperty(hasProto));
6390                     if (!this.match('}')) {
6391                         this.expectCommaSeparator();
6392                     }
6393                 }
6394                 this.expect('}');
6395                 return this.finalize(node, new Node.ObjectExpression(properties));
6396             };
6397             // https://tc39.github.io/ecma262/#sec-template-literals
6398             Parser.prototype.parseTemplateHead = function () {
6399                 assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
6400                 var node = this.createNode();
6401                 var token = this.nextToken();
6402                 var raw = token.value;
6403                 var cooked = token.cooked;
6404                 return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
6405             };
6406             Parser.prototype.parseTemplateElement = function () {
6407                 if (this.lookahead.type !== 10 /* Template */) {
6408                     this.throwUnexpectedToken();
6409                 }
6410                 var node = this.createNode();
6411                 var token = this.nextToken();
6412                 var raw = token.value;
6413                 var cooked = token.cooked;
6414                 return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
6415             };
6416             Parser.prototype.parseTemplateLiteral = function () {
6417                 var node = this.createNode();
6418                 var expressions = [];
6419                 var quasis = [];
6420                 var quasi = this.parseTemplateHead();
6421                 quasis.push(quasi);
6422                 while (!quasi.tail) {
6423                     expressions.push(this.parseExpression());
6424                     quasi = this.parseTemplateElement();
6425                     quasis.push(quasi);
6426                 }
6427                 return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
6428             };
6429             // https://tc39.github.io/ecma262/#sec-grouping-operator
6430             Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
6431                 switch (expr.type) {
6432                     case syntax_1.Syntax.Identifier:
6433                     case syntax_1.Syntax.MemberExpression:
6434                     case syntax_1.Syntax.RestElement:
6435                     case syntax_1.Syntax.AssignmentPattern:
6436                         break;
6437                     case syntax_1.Syntax.SpreadElement:
6438                         expr.type = syntax_1.Syntax.RestElement;
6439                         this.reinterpretExpressionAsPattern(expr.argument);
6440                         break;
6441                     case syntax_1.Syntax.ArrayExpression:
6442                         expr.type = syntax_1.Syntax.ArrayPattern;
6443                         for (var i = 0; i < expr.elements.length; i++) {
6444                             if (expr.elements[i] !== null) {
6445                                 this.reinterpretExpressionAsPattern(expr.elements[i]);
6446                             }
6447                         }
6448                         break;
6449                     case syntax_1.Syntax.ObjectExpression:
6450                         expr.type = syntax_1.Syntax.ObjectPattern;
6451                         for (var i = 0; i < expr.properties.length; i++) {
6452                             this.reinterpretExpressionAsPattern(expr.properties[i].value);
6453                         }
6454                         break;
6455                     case syntax_1.Syntax.AssignmentExpression:
6456                         expr.type = syntax_1.Syntax.AssignmentPattern;
6457                         delete expr.operator;
6458                         this.reinterpretExpressionAsPattern(expr.left);
6459                         break;
6460                     default:
6461                         // Allow other node type for tolerant parsing.
6462                         break;
6463                 }
6464             };
6465             Parser.prototype.parseGroupExpression = function () {
6466                 var expr;
6467                 this.expect('(');
6468                 if (this.match(')')) {
6469                     this.nextToken();
6470                     if (!this.match('=>')) {
6471                         this.expect('=>');
6472                     }
6473                     expr = {
6474                         type: ArrowParameterPlaceHolder,
6475                         params: [],
6476                         async: false
6477                     };
6478                 }
6479                 else {
6480                     var startToken = this.lookahead;
6481                     var params = [];
6482                     if (this.match('...')) {
6483                         expr = this.parseRestElement(params);
6484                         this.expect(')');
6485                         if (!this.match('=>')) {
6486                             this.expect('=>');
6487                         }
6488                         expr = {
6489                             type: ArrowParameterPlaceHolder,
6490                             params: [expr],
6491                             async: false
6492                         };
6493                     }
6494                     else {
6495                         var arrow = false;
6496                         this.context.isBindingElement = true;
6497                         expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
6498                         if (this.match(',')) {
6499                             var expressions = [];
6500                             this.context.isAssignmentTarget = false;
6501                             expressions.push(expr);
6502                             while (this.lookahead.type !== 2 /* EOF */) {
6503                                 if (!this.match(',')) {
6504                                     break;
6505                                 }
6506                                 this.nextToken();
6507                                 if (this.match(')')) {
6508                                     this.nextToken();
6509                                     for (var i = 0; i < expressions.length; i++) {
6510                                         this.reinterpretExpressionAsPattern(expressions[i]);
6511                                     }
6512                                     arrow = true;
6513                                     expr = {
6514                                         type: ArrowParameterPlaceHolder,
6515                                         params: expressions,
6516                                         async: false
6517                                     };
6518                                 }
6519                                 else if (this.match('...')) {
6520                                     if (!this.context.isBindingElement) {
6521                                         this.throwUnexpectedToken(this.lookahead);
6522                                     }
6523                                     expressions.push(this.parseRestElement(params));
6524                                     this.expect(')');
6525                                     if (!this.match('=>')) {
6526                                         this.expect('=>');
6527                                     }
6528                                     this.context.isBindingElement = false;
6529                                     for (var i = 0; i < expressions.length; i++) {
6530                                         this.reinterpretExpressionAsPattern(expressions[i]);
6531                                     }
6532                                     arrow = true;
6533                                     expr = {
6534                                         type: ArrowParameterPlaceHolder,
6535                                         params: expressions,
6536                                         async: false
6537                                     };
6538                                 }
6539                                 else {
6540                                     expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
6541                                 }
6542                                 if (arrow) {
6543                                     break;
6544                                 }
6545                             }
6546                             if (!arrow) {
6547                                 expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
6548                             }
6549                         }
6550                         if (!arrow) {
6551                             this.expect(')');
6552                             if (this.match('=>')) {
6553                                 if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
6554                                     arrow = true;
6555                                     expr = {
6556                                         type: ArrowParameterPlaceHolder,
6557                                         params: [expr],
6558                                         async: false
6559                                     };
6560                                 }
6561                                 if (!arrow) {
6562                                     if (!this.context.isBindingElement) {
6563                                         this.throwUnexpectedToken(this.lookahead);
6564                                     }
6565                                     if (expr.type === syntax_1.Syntax.SequenceExpression) {
6566                                         for (var i = 0; i < expr.expressions.length; i++) {
6567                                             this.reinterpretExpressionAsPattern(expr.expressions[i]);
6568                                         }
6569                                     }
6570                                     else {
6571                                         this.reinterpretExpressionAsPattern(expr);
6572                                     }
6573                                     var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
6574                                     expr = {
6575                                         type: ArrowParameterPlaceHolder,
6576                                         params: parameters,
6577                                         async: false
6578                                     };
6579                                 }
6580                             }
6581                             this.context.isBindingElement = false;
6582                         }
6583                     }
6584                 }
6585                 return expr;
6586             };
6587             // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions
6588             Parser.prototype.parseArguments = function () {
6589                 this.expect('(');
6590                 var args = [];
6591                 if (!this.match(')')) {
6592                     while (true) {
6593                         var expr = this.match('...') ? this.parseSpreadElement() :
6594                             this.isolateCoverGrammar(this.parseAssignmentExpression);
6595                         args.push(expr);
6596                         if (this.match(')')) {
6597                             break;
6598                         }
6599                         this.expectCommaSeparator();
6600                         if (this.match(')')) {
6601                             break;
6602                         }
6603                     }
6604                 }
6605                 this.expect(')');
6606                 return args;
6607             };
6608             Parser.prototype.isIdentifierName = function (token) {
6609                 return token.type === 3 /* Identifier */ ||
6610                     token.type === 4 /* Keyword */ ||
6611                     token.type === 1 /* BooleanLiteral */ ||
6612                     token.type === 5 /* NullLiteral */;
6613             };
6614             Parser.prototype.parseIdentifierName = function () {
6615                 var node = this.createNode();
6616                 var token = this.nextToken();
6617                 if (!this.isIdentifierName(token)) {
6618                     this.throwUnexpectedToken(token);
6619                 }
6620                 return this.finalize(node, new Node.Identifier(token.value));
6621             };
6622             Parser.prototype.parseNewExpression = function () {
6623                 var node = this.createNode();
6624                 var id = this.parseIdentifierName();
6625                 assert_1.assert(id.name === 'new', 'New expression must start with `new`');
6626                 var expr;
6627                 if (this.match('.')) {
6628                     this.nextToken();
6629                     if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') {
6630                         var property = this.parseIdentifierName();
6631                         expr = new Node.MetaProperty(id, property);
6632                     }
6633                     else {
6634                         this.throwUnexpectedToken(this.lookahead);
6635                     }
6636                 }
6637                 else {
6638                     var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
6639                     var args = this.match('(') ? this.parseArguments() : [];
6640                     expr = new Node.NewExpression(callee, args);
6641                     this.context.isAssignmentTarget = false;
6642                     this.context.isBindingElement = false;
6643                 }
6644                 return this.finalize(node, expr);
6645             };
6646             Parser.prototype.parseAsyncArgument = function () {
6647                 var arg = this.parseAssignmentExpression();
6648                 this.context.firstCoverInitializedNameError = null;
6649                 return arg;
6650             };
6651             Parser.prototype.parseAsyncArguments = function () {
6652                 this.expect('(');
6653                 var args = [];
6654                 if (!this.match(')')) {
6655                     while (true) {
6656                         var expr = this.match('...') ? this.parseSpreadElement() :
6657                             this.isolateCoverGrammar(this.parseAsyncArgument);
6658                         args.push(expr);
6659                         if (this.match(')')) {
6660                             break;
6661                         }
6662                         this.expectCommaSeparator();
6663                         if (this.match(')')) {
6664                             break;
6665                         }
6666                     }
6667                 }
6668                 this.expect(')');
6669                 return args;
6670             };
6671             Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
6672                 var startToken = this.lookahead;
6673                 var maybeAsync = this.matchContextualKeyword('async');
6674                 var previousAllowIn = this.context.allowIn;
6675                 this.context.allowIn = true;
6676                 var expr;
6677                 if (this.matchKeyword('super') && this.context.inFunctionBody) {
6678                     expr = this.createNode();
6679                     this.nextToken();
6680                     expr = this.finalize(expr, new Node.Super());
6681                     if (!this.match('(') && !this.match('.') && !this.match('[')) {
6682                         this.throwUnexpectedToken(this.lookahead);
6683                     }
6684                 }
6685                 else {
6686                     expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
6687                 }
6688                 while (true) {
6689                     if (this.match('.')) {
6690                         this.context.isBindingElement = false;
6691                         this.context.isAssignmentTarget = true;
6692                         this.expect('.');
6693                         var property = this.parseIdentifierName();
6694                         expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
6695                     }
6696                     else if (this.match('(')) {
6697                         var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber);
6698                         this.context.isBindingElement = false;
6699                         this.context.isAssignmentTarget = false;
6700                         var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments();
6701                         expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
6702                         if (asyncArrow && this.match('=>')) {
6703                             for (var i = 0; i < args.length; ++i) {
6704                                 this.reinterpretExpressionAsPattern(args[i]);
6705                             }
6706                             expr = {
6707                                 type: ArrowParameterPlaceHolder,
6708                                 params: args,
6709                                 async: true
6710                             };
6711                         }
6712                     }
6713                     else if (this.match('[')) {
6714                         this.context.isBindingElement = false;
6715                         this.context.isAssignmentTarget = true;
6716                         this.expect('[');
6717                         var property = this.isolateCoverGrammar(this.parseExpression);
6718                         this.expect(']');
6719                         expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
6720                     }
6721                     else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
6722                         var quasi = this.parseTemplateLiteral();
6723                         expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
6724                     }
6725                     else {
6726                         break;
6727                     }
6728                 }
6729                 this.context.allowIn = previousAllowIn;
6730                 return expr;
6731             };
6732             Parser.prototype.parseSuper = function () {
6733                 var node = this.createNode();
6734                 this.expectKeyword('super');
6735                 if (!this.match('[') && !this.match('.')) {
6736                     this.throwUnexpectedToken(this.lookahead);
6737                 }
6738                 return this.finalize(node, new Node.Super());
6739             };
6740             Parser.prototype.parseLeftHandSideExpression = function () {
6741                 assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
6742                 var node = this.startNode(this.lookahead);
6743                 var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
6744                     this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
6745                 while (true) {
6746                     if (this.match('[')) {
6747                         this.context.isBindingElement = false;
6748                         this.context.isAssignmentTarget = true;
6749                         this.expect('[');
6750                         var property = this.isolateCoverGrammar(this.parseExpression);
6751                         this.expect(']');
6752                         expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
6753                     }
6754                     else if (this.match('.')) {
6755                         this.context.isBindingElement = false;
6756                         this.context.isAssignmentTarget = true;
6757                         this.expect('.');
6758                         var property = this.parseIdentifierName();
6759                         expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
6760                     }
6761                     else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
6762                         var quasi = this.parseTemplateLiteral();
6763                         expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
6764                     }
6765                     else {
6766                         break;
6767                     }
6768                 }
6769                 return expr;
6770             };
6771             // https://tc39.github.io/ecma262/#sec-update-expressions
6772             Parser.prototype.parseUpdateExpression = function () {
6773                 var expr;
6774                 var startToken = this.lookahead;
6775                 if (this.match('++') || this.match('--')) {
6776                     var node = this.startNode(startToken);
6777                     var token = this.nextToken();
6778                     expr = this.inheritCoverGrammar(this.parseUnaryExpression);
6779                     if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
6780                         this.tolerateError(messages_1.Messages.StrictLHSPrefix);
6781                     }
6782                     if (!this.context.isAssignmentTarget) {
6783                         this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
6784                     }
6785                     var prefix = true;
6786                     expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
6787                     this.context.isAssignmentTarget = false;
6788                     this.context.isBindingElement = false;
6789                 }
6790                 else {
6791                     expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
6792                     if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) {
6793                         if (this.match('++') || this.match('--')) {
6794                             if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
6795                                 this.tolerateError(messages_1.Messages.StrictLHSPostfix);
6796                             }
6797                             if (!this.context.isAssignmentTarget) {
6798                                 this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
6799                             }
6800                             this.context.isAssignmentTarget = false;
6801                             this.context.isBindingElement = false;
6802                             var operator = this.nextToken().value;
6803                             var prefix = false;
6804                             expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
6805                         }
6806                     }
6807                 }
6808                 return expr;
6809             };
6810             // https://tc39.github.io/ecma262/#sec-unary-operators
6811             Parser.prototype.parseAwaitExpression = function () {
6812                 var node = this.createNode();
6813                 this.nextToken();
6814                 var argument = this.parseUnaryExpression();
6815                 return this.finalize(node, new Node.AwaitExpression(argument));
6816             };
6817             Parser.prototype.parseUnaryExpression = function () {
6818                 var expr;
6819                 if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
6820                     this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
6821                     var node = this.startNode(this.lookahead);
6822                     var token = this.nextToken();
6823                     expr = this.inheritCoverGrammar(this.parseUnaryExpression);
6824                     expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
6825                     if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
6826                         this.tolerateError(messages_1.Messages.StrictDelete);
6827                     }
6828                     this.context.isAssignmentTarget = false;
6829                     this.context.isBindingElement = false;
6830                 }
6831                 else if (this.context.await && this.matchContextualKeyword('await')) {
6832                     expr = this.parseAwaitExpression();
6833                 }
6834                 else {
6835                     expr = this.parseUpdateExpression();
6836                 }
6837                 return expr;
6838             };
6839             Parser.prototype.parseExponentiationExpression = function () {
6840                 var startToken = this.lookahead;
6841                 var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
6842                 if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
6843                     this.nextToken();
6844                     this.context.isAssignmentTarget = false;
6845                     this.context.isBindingElement = false;
6846                     var left = expr;
6847                     var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
6848                     expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
6849                 }
6850                 return expr;
6851             };
6852             // https://tc39.github.io/ecma262/#sec-exp-operator
6853             // https://tc39.github.io/ecma262/#sec-multiplicative-operators
6854             // https://tc39.github.io/ecma262/#sec-additive-operators
6855             // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators
6856             // https://tc39.github.io/ecma262/#sec-relational-operators
6857             // https://tc39.github.io/ecma262/#sec-equality-operators
6858             // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators
6859             // https://tc39.github.io/ecma262/#sec-binary-logical-operators
6860             Parser.prototype.binaryPrecedence = function (token) {
6861                 var op = token.value;
6862                 var precedence;
6863                 if (token.type === 7 /* Punctuator */) {
6864                     precedence = this.operatorPrecedence[op] || 0;
6865                 }
6866                 else if (token.type === 4 /* Keyword */) {
6867                     precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
6868                 }
6869                 else {
6870                     precedence = 0;
6871                 }
6872                 return precedence;
6873             };
6874             Parser.prototype.parseBinaryExpression = function () {
6875                 var startToken = this.lookahead;
6876                 var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
6877                 var token = this.lookahead;
6878                 var prec = this.binaryPrecedence(token);
6879                 if (prec > 0) {
6880                     this.nextToken();
6881                     this.context.isAssignmentTarget = false;
6882                     this.context.isBindingElement = false;
6883                     var markers = [startToken, this.lookahead];
6884                     var left = expr;
6885                     var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
6886                     var stack = [left, token.value, right];
6887                     var precedences = [prec];
6888                     while (true) {
6889                         prec = this.binaryPrecedence(this.lookahead);
6890                         if (prec <= 0) {
6891                             break;
6892                         }
6893                         // Reduce: make a binary expression from the three topmost entries.
6894                         while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) {
6895                             right = stack.pop();
6896                             var operator = stack.pop();
6897                             precedences.pop();
6898                             left = stack.pop();
6899                             markers.pop();
6900                             var node = this.startNode(markers[markers.length - 1]);
6901                             stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
6902                         }
6903                         // Shift.
6904                         stack.push(this.nextToken().value);
6905                         precedences.push(prec);
6906                         markers.push(this.lookahead);
6907                         stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
6908                     }
6909                     // Final reduce to clean-up the stack.
6910                     var i = stack.length - 1;
6911                     expr = stack[i];
6912                     var lastMarker = markers.pop();
6913                     while (i > 1) {
6914                         var marker = markers.pop();
6915                         var lastLineStart = lastMarker && lastMarker.lineStart;
6916                         var node = this.startNode(marker, lastLineStart);
6917                         var operator = stack[i - 1];
6918                         expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr));
6919                         i -= 2;
6920                         lastMarker = marker;
6921                     }
6922                 }
6923                 return expr;
6924             };
6925             // https://tc39.github.io/ecma262/#sec-conditional-operator
6926             Parser.prototype.parseConditionalExpression = function () {
6927                 var startToken = this.lookahead;
6928                 var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
6929                 if (this.match('?')) {
6930                     this.nextToken();
6931                     var previousAllowIn = this.context.allowIn;
6932                     this.context.allowIn = true;
6933                     var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
6934                     this.context.allowIn = previousAllowIn;
6935                     this.expect(':');
6936                     var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
6937                     expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
6938                     this.context.isAssignmentTarget = false;
6939                     this.context.isBindingElement = false;
6940                 }
6941                 return expr;
6942             };
6943             // https://tc39.github.io/ecma262/#sec-assignment-operators
6944             Parser.prototype.checkPatternParam = function (options, param) {
6945                 switch (param.type) {
6946                     case syntax_1.Syntax.Identifier:
6947                         this.validateParam(options, param, param.name);
6948                         break;
6949                     case syntax_1.Syntax.RestElement:
6950                         this.checkPatternParam(options, param.argument);
6951                         break;
6952                     case syntax_1.Syntax.AssignmentPattern:
6953                         this.checkPatternParam(options, param.left);
6954                         break;
6955                     case syntax_1.Syntax.ArrayPattern:
6956                         for (var i = 0; i < param.elements.length; i++) {
6957                             if (param.elements[i] !== null) {
6958                                 this.checkPatternParam(options, param.elements[i]);
6959                             }
6960                         }
6961                         break;
6962                     case syntax_1.Syntax.ObjectPattern:
6963                         for (var i = 0; i < param.properties.length; i++) {
6964                             this.checkPatternParam(options, param.properties[i].value);
6965                         }
6966                         break;
6967                     default:
6968                         break;
6969                 }
6970                 options.simple = options.simple && (param instanceof Node.Identifier);
6971             };
6972             Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
6973                 var params = [expr];
6974                 var options;
6975                 var asyncArrow = false;
6976                 switch (expr.type) {
6977                     case syntax_1.Syntax.Identifier:
6978                         break;
6979                     case ArrowParameterPlaceHolder:
6980                         params = expr.params;
6981                         asyncArrow = expr.async;
6982                         break;
6983                     default:
6984                         return null;
6985                 }
6986                 options = {
6987                     simple: true,
6988                     paramSet: {}
6989                 };
6990                 for (var i = 0; i < params.length; ++i) {
6991                     var param = params[i];
6992                     if (param.type === syntax_1.Syntax.AssignmentPattern) {
6993                         if (param.right.type === syntax_1.Syntax.YieldExpression) {
6994                             if (param.right.argument) {
6995                                 this.throwUnexpectedToken(this.lookahead);
6996                             }
6997                             param.right.type = syntax_1.Syntax.Identifier;
6998                             param.right.name = 'yield';
6999                             delete param.right.argument;
7000                             delete param.right.delegate;
7001                         }
7002                     }
7003                     else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') {
7004                         this.throwUnexpectedToken(this.lookahead);
7005                     }
7006                     this.checkPatternParam(options, param);
7007                     params[i] = param;
7008                 }
7009                 if (this.context.strict || !this.context.allowYield) {
7010                     for (var i = 0; i < params.length; ++i) {
7011                         var param = params[i];
7012                         if (param.type === syntax_1.Syntax.YieldExpression) {
7013                             this.throwUnexpectedToken(this.lookahead);
7014                         }
7015                     }
7016                 }
7017                 if (options.message === messages_1.Messages.StrictParamDupe) {
7018                     var token = this.context.strict ? options.stricted : options.firstRestricted;
7019                     this.throwUnexpectedToken(token, options.message);
7020                 }
7021                 return {
7022                     simple: options.simple,
7023                     params: params,
7024                     stricted: options.stricted,
7025                     firstRestricted: options.firstRestricted,
7026                     message: options.message
7027                 };
7028             };
7029             Parser.prototype.parseAssignmentExpression = function () {
7030                 var expr;
7031                 if (!this.context.allowYield && this.matchKeyword('yield')) {
7032                     expr = this.parseYieldExpression();
7033                 }
7034                 else {
7035                     var startToken = this.lookahead;
7036                     var token = startToken;
7037                     expr = this.parseConditionalExpression();
7038                     if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') {
7039                         if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) {
7040                             var arg = this.parsePrimaryExpression();
7041                             this.reinterpretExpressionAsPattern(arg);
7042                             expr = {
7043                                 type: ArrowParameterPlaceHolder,
7044                                 params: [arg],
7045                                 async: true
7046                             };
7047                         }
7048                     }
7049                     if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
7050                         // https://tc39.github.io/ecma262/#sec-arrow-function-definitions
7051                         this.context.isAssignmentTarget = false;
7052                         this.context.isBindingElement = false;
7053                         var isAsync = expr.async;
7054                         var list = this.reinterpretAsCoverFormalsList(expr);
7055                         if (list) {
7056                             if (this.hasLineTerminator) {
7057                                 this.tolerateUnexpectedToken(this.lookahead);
7058                             }
7059                             this.context.firstCoverInitializedNameError = null;
7060                             var previousStrict = this.context.strict;
7061                             var previousAllowStrictDirective = this.context.allowStrictDirective;
7062                             this.context.allowStrictDirective = list.simple;
7063                             var previousAllowYield = this.context.allowYield;
7064                             var previousAwait = this.context.await;
7065                             this.context.allowYield = true;
7066                             this.context.await = isAsync;
7067                             var node = this.startNode(startToken);
7068                             this.expect('=>');
7069                             var body = void 0;
7070                             if (this.match('{')) {
7071                                 var previousAllowIn = this.context.allowIn;
7072                                 this.context.allowIn = true;
7073                                 body = this.parseFunctionSourceElements();
7074                                 this.context.allowIn = previousAllowIn;
7075                             }
7076                             else {
7077                                 body = this.isolateCoverGrammar(this.parseAssignmentExpression);
7078                             }
7079                             var expression = body.type !== syntax_1.Syntax.BlockStatement;
7080                             if (this.context.strict && list.firstRestricted) {
7081                                 this.throwUnexpectedToken(list.firstRestricted, list.message);
7082                             }
7083                             if (this.context.strict && list.stricted) {
7084                                 this.tolerateUnexpectedToken(list.stricted, list.message);
7085                             }
7086                             expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) :
7087                                 this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
7088                             this.context.strict = previousStrict;
7089                             this.context.allowStrictDirective = previousAllowStrictDirective;
7090                             this.context.allowYield = previousAllowYield;
7091                             this.context.await = previousAwait;
7092                         }
7093                     }
7094                     else {
7095                         if (this.matchAssign()) {
7096                             if (!this.context.isAssignmentTarget) {
7097                                 this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
7098                             }
7099                             if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
7100                                 var id = expr;
7101                                 if (this.scanner.isRestrictedWord(id.name)) {
7102                                     this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
7103                                 }
7104                                 if (this.scanner.isStrictModeReservedWord(id.name)) {
7105                                     this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
7106                                 }
7107                             }
7108                             if (!this.match('=')) {
7109                                 this.context.isAssignmentTarget = false;
7110                                 this.context.isBindingElement = false;
7111                             }
7112                             else {
7113                                 this.reinterpretExpressionAsPattern(expr);
7114                             }
7115                             token = this.nextToken();
7116                             var operator = token.value;
7117                             var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
7118                             expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right));
7119                             this.context.firstCoverInitializedNameError = null;
7120                         }
7121                     }
7122                 }
7123                 return expr;
7124             };
7125             // https://tc39.github.io/ecma262/#sec-comma-operator
7126             Parser.prototype.parseExpression = function () {
7127                 var startToken = this.lookahead;
7128                 var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
7129                 if (this.match(',')) {
7130                     var expressions = [];
7131                     expressions.push(expr);
7132                     while (this.lookahead.type !== 2 /* EOF */) {
7133                         if (!this.match(',')) {
7134                             break;
7135                         }
7136                         this.nextToken();
7137                         expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
7138                     }
7139                     expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
7140                 }
7141                 return expr;
7142             };
7143             // https://tc39.github.io/ecma262/#sec-block
7144             Parser.prototype.parseStatementListItem = function () {
7145                 var statement;
7146                 this.context.isAssignmentTarget = true;
7147                 this.context.isBindingElement = true;
7148                 if (this.lookahead.type === 4 /* Keyword */) {
7149                     switch (this.lookahead.value) {
7150                         case 'export':
7151                             if (!this.context.isModule) {
7152                                 this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
7153                             }
7154                             statement = this.parseExportDeclaration();
7155                             break;
7156                         case 'import':
7157                             if (!this.context.isModule) {
7158                                 this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
7159                             }
7160                             statement = this.parseImportDeclaration();
7161                             break;
7162                         case 'const':
7163                             statement = this.parseLexicalDeclaration({ inFor: false });
7164                             break;
7165                         case 'function':
7166                             statement = this.parseFunctionDeclaration();
7167                             break;
7168                         case 'class':
7169                             statement = this.parseClassDeclaration();
7170                             break;
7171                         case 'let':
7172                             statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
7173                             break;
7174                         default:
7175                             statement = this.parseStatement();
7176                             break;
7177                     }
7178                 }
7179                 else {
7180                     statement = this.parseStatement();
7181                 }
7182                 return statement;
7183             };
7184             Parser.prototype.parseBlock = function () {
7185                 var node = this.createNode();
7186                 this.expect('{');
7187                 var block = [];
7188                 while (true) {
7189                     if (this.match('}')) {
7190                         break;
7191                     }
7192                     block.push(this.parseStatementListItem());
7193                 }
7194                 this.expect('}');
7195                 return this.finalize(node, new Node.BlockStatement(block));
7196             };
7197             // https://tc39.github.io/ecma262/#sec-let-and-const-declarations
7198             Parser.prototype.parseLexicalBinding = function (kind, options) {
7199                 var node = this.createNode();
7200                 var params = [];
7201                 var id = this.parsePattern(params, kind);
7202                 if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
7203                     if (this.scanner.isRestrictedWord(id.name)) {
7204                         this.tolerateError(messages_1.Messages.StrictVarName);
7205                     }
7206                 }
7207                 var init = null;
7208                 if (kind === 'const') {
7209                     if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
7210                         if (this.match('=')) {
7211                             this.nextToken();
7212                             init = this.isolateCoverGrammar(this.parseAssignmentExpression);
7213                         }
7214                         else {
7215                             this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const');
7216                         }
7217                     }
7218                 }
7219                 else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
7220                     this.expect('=');
7221                     init = this.isolateCoverGrammar(this.parseAssignmentExpression);
7222                 }
7223                 return this.finalize(node, new Node.VariableDeclarator(id, init));
7224             };
7225             Parser.prototype.parseBindingList = function (kind, options) {
7226                 var list = [this.parseLexicalBinding(kind, options)];
7227                 while (this.match(',')) {
7228                     this.nextToken();
7229                     list.push(this.parseLexicalBinding(kind, options));
7230                 }
7231                 return list;
7232             };
7233             Parser.prototype.isLexicalDeclaration = function () {
7234                 var state = this.scanner.saveState();
7235                 this.scanner.scanComments();
7236                 var next = this.scanner.lex();
7237                 this.scanner.restoreState(state);
7238                 return (next.type === 3 /* Identifier */) ||
7239                     (next.type === 7 /* Punctuator */ && next.value === '[') ||
7240                     (next.type === 7 /* Punctuator */ && next.value === '{') ||
7241                     (next.type === 4 /* Keyword */ && next.value === 'let') ||
7242                     (next.type === 4 /* Keyword */ && next.value === 'yield');
7243             };
7244             Parser.prototype.parseLexicalDeclaration = function (options) {
7245                 var node = this.createNode();
7246                 var kind = this.nextToken().value;
7247                 assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
7248                 var declarations = this.parseBindingList(kind, options);
7249                 this.consumeSemicolon();
7250                 return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
7251             };
7252             // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns
7253             Parser.prototype.parseBindingRestElement = function (params, kind) {
7254                 var node = this.createNode();
7255                 this.expect('...');
7256                 var arg = this.parsePattern(params, kind);
7257                 return this.finalize(node, new Node.RestElement(arg));
7258             };
7259             Parser.prototype.parseArrayPattern = function (params, kind) {
7260                 var node = this.createNode();
7261                 this.expect('[');
7262                 var elements = [];
7263                 while (!this.match(']')) {
7264                     if (this.match(',')) {
7265                         this.nextToken();
7266                         elements.push(null);
7267                     }
7268                     else {
7269                         if (this.match('...')) {
7270                             elements.push(this.parseBindingRestElement(params, kind));
7271                             break;
7272                         }
7273                         else {
7274                             elements.push(this.parsePatternWithDefault(params, kind));
7275                         }
7276                         if (!this.match(']')) {
7277                             this.expect(',');
7278                         }
7279                     }
7280                 }
7281                 this.expect(']');
7282                 return this.finalize(node, new Node.ArrayPattern(elements));
7283             };
7284             Parser.prototype.parsePropertyPattern = function (params, kind) {
7285                 var node = this.createNode();
7286                 var computed = false;
7287                 var shorthand = false;
7288                 var method = false;
7289                 var key;
7290                 var value;
7291                 if (this.lookahead.type === 3 /* Identifier */) {
7292                     var keyToken = this.lookahead;
7293                     key = this.parseVariableIdentifier();
7294                     var init = this.finalize(node, new Node.Identifier(keyToken.value));
7295                     if (this.match('=')) {
7296                         params.push(keyToken);
7297                         shorthand = true;
7298                         this.nextToken();
7299                         var expr = this.parseAssignmentExpression();
7300                         value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
7301                     }
7302                     else if (!this.match(':')) {
7303                         params.push(keyToken);
7304                         shorthand = true;
7305                         value = init;
7306                     }
7307                     else {
7308                         this.expect(':');
7309                         value = this.parsePatternWithDefault(params, kind);
7310                     }
7311                 }
7312                 else {
7313                     computed = this.match('[');
7314                     key = this.parseObjectPropertyKey();
7315                     this.expect(':');
7316                     value = this.parsePatternWithDefault(params, kind);
7317                 }
7318                 return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
7319             };
7320             Parser.prototype.parseObjectPattern = function (params, kind) {
7321                 var node = this.createNode();
7322                 var properties = [];
7323                 this.expect('{');
7324                 while (!this.match('}')) {
7325                     properties.push(this.parsePropertyPattern(params, kind));
7326                     if (!this.match('}')) {
7327                         this.expect(',');
7328                     }
7329                 }
7330                 this.expect('}');
7331                 return this.finalize(node, new Node.ObjectPattern(properties));
7332             };
7333             Parser.prototype.parsePattern = function (params, kind) {
7334                 var pattern;
7335                 if (this.match('[')) {
7336                     pattern = this.parseArrayPattern(params, kind);
7337                 }
7338                 else if (this.match('{')) {
7339                     pattern = this.parseObjectPattern(params, kind);
7340                 }
7341                 else {
7342                     if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
7343                         this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding);
7344                     }
7345                     params.push(this.lookahead);
7346                     pattern = this.parseVariableIdentifier(kind);
7347                 }
7348                 return pattern;
7349             };
7350             Parser.prototype.parsePatternWithDefault = function (params, kind) {
7351                 var startToken = this.lookahead;
7352                 var pattern = this.parsePattern(params, kind);
7353                 if (this.match('=')) {
7354                     this.nextToken();
7355                     var previousAllowYield = this.context.allowYield;
7356                     this.context.allowYield = true;
7357                     var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
7358                     this.context.allowYield = previousAllowYield;
7359                     pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
7360                 }
7361                 return pattern;
7362             };
7363             // https://tc39.github.io/ecma262/#sec-variable-statement
7364             Parser.prototype.parseVariableIdentifier = function (kind) {
7365                 var node = this.createNode();
7366                 var token = this.nextToken();
7367                 if (token.type === 4 /* Keyword */ && token.value === 'yield') {
7368                     if (this.context.strict) {
7369                         this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
7370                     }
7371                     else if (!this.context.allowYield) {
7372                         this.throwUnexpectedToken(token);
7373                     }
7374                 }
7375                 else if (token.type !== 3 /* Identifier */) {
7376                     if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) {
7377                         this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
7378                     }
7379                     else {
7380                         if (this.context.strict || token.value !== 'let' || kind !== 'var') {
7381                             this.throwUnexpectedToken(token);
7382                         }
7383                     }
7384                 }
7385                 else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') {
7386                     this.tolerateUnexpectedToken(token);
7387                 }
7388                 return this.finalize(node, new Node.Identifier(token.value));
7389             };
7390             Parser.prototype.parseVariableDeclaration = function (options) {
7391                 var node = this.createNode();
7392                 var params = [];
7393                 var id = this.parsePattern(params, 'var');
7394                 if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
7395                     if (this.scanner.isRestrictedWord(id.name)) {
7396                         this.tolerateError(messages_1.Messages.StrictVarName);
7397                     }
7398                 }
7399                 var init = null;
7400                 if (this.match('=')) {
7401                     this.nextToken();
7402                     init = this.isolateCoverGrammar(this.parseAssignmentExpression);
7403                 }
7404                 else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
7405                     this.expect('=');
7406                 }
7407                 return this.finalize(node, new Node.VariableDeclarator(id, init));
7408             };
7409             Parser.prototype.parseVariableDeclarationList = function (options) {
7410                 var opt = { inFor: options.inFor };
7411                 var list = [];
7412                 list.push(this.parseVariableDeclaration(opt));
7413                 while (this.match(',')) {
7414                     this.nextToken();
7415                     list.push(this.parseVariableDeclaration(opt));
7416                 }
7417                 return list;
7418             };
7419             Parser.prototype.parseVariableStatement = function () {
7420                 var node = this.createNode();
7421                 this.expectKeyword('var');
7422                 var declarations = this.parseVariableDeclarationList({ inFor: false });
7423                 this.consumeSemicolon();
7424                 return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
7425             };
7426             // https://tc39.github.io/ecma262/#sec-empty-statement
7427             Parser.prototype.parseEmptyStatement = function () {
7428                 var node = this.createNode();
7429                 this.expect(';');
7430                 return this.finalize(node, new Node.EmptyStatement());
7431             };
7432             // https://tc39.github.io/ecma262/#sec-expression-statement
7433             Parser.prototype.parseExpressionStatement = function () {
7434                 var node = this.createNode();
7435                 var expr = this.parseExpression();
7436                 this.consumeSemicolon();
7437                 return this.finalize(node, new Node.ExpressionStatement(expr));
7438             };
7439             // https://tc39.github.io/ecma262/#sec-if-statement
7440             Parser.prototype.parseIfClause = function () {
7441                 if (this.context.strict && this.matchKeyword('function')) {
7442                     this.tolerateError(messages_1.Messages.StrictFunction);
7443                 }
7444                 return this.parseStatement();
7445             };
7446             Parser.prototype.parseIfStatement = function () {
7447                 var node = this.createNode();
7448                 var consequent;
7449                 var alternate = null;
7450                 this.expectKeyword('if');
7451                 this.expect('(');
7452                 var test = this.parseExpression();
7453                 if (!this.match(')') && this.config.tolerant) {
7454                     this.tolerateUnexpectedToken(this.nextToken());
7455                     consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
7456                 }
7457                 else {
7458                     this.expect(')');
7459                     consequent = this.parseIfClause();
7460                     if (this.matchKeyword('else')) {
7461                         this.nextToken();
7462                         alternate = this.parseIfClause();
7463                     }
7464                 }
7465                 return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
7466             };
7467             // https://tc39.github.io/ecma262/#sec-do-while-statement
7468             Parser.prototype.parseDoWhileStatement = function () {
7469                 var node = this.createNode();
7470                 this.expectKeyword('do');
7471                 var previousInIteration = this.context.inIteration;
7472                 this.context.inIteration = true;
7473                 var body = this.parseStatement();
7474                 this.context.inIteration = previousInIteration;
7475                 this.expectKeyword('while');
7476                 this.expect('(');
7477                 var test = this.parseExpression();
7478                 if (!this.match(')') && this.config.tolerant) {
7479                     this.tolerateUnexpectedToken(this.nextToken());
7480                 }
7481                 else {
7482                     this.expect(')');
7483                     if (this.match(';')) {
7484                         this.nextToken();
7485                     }
7486                 }
7487                 return this.finalize(node, new Node.DoWhileStatement(body, test));
7488             };
7489             // https://tc39.github.io/ecma262/#sec-while-statement
7490             Parser.prototype.parseWhileStatement = function () {
7491                 var node = this.createNode();
7492                 var body;
7493                 this.expectKeyword('while');
7494                 this.expect('(');
7495                 var test = this.parseExpression();
7496                 if (!this.match(')') && this.config.tolerant) {
7497                     this.tolerateUnexpectedToken(this.nextToken());
7498                     body = this.finalize(this.createNode(), new Node.EmptyStatement());
7499                 }
7500                 else {
7501                     this.expect(')');
7502                     var previousInIteration = this.context.inIteration;
7503                     this.context.inIteration = true;
7504                     body = this.parseStatement();
7505                     this.context.inIteration = previousInIteration;
7506                 }
7507                 return this.finalize(node, new Node.WhileStatement(test, body));
7508             };
7509             // https://tc39.github.io/ecma262/#sec-for-statement
7510             // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements
7511             Parser.prototype.parseForStatement = function () {
7512                 var init = null;
7513                 var test = null;
7514                 var update = null;
7515                 var forIn = true;
7516                 var left, right;
7517                 var node = this.createNode();
7518                 this.expectKeyword('for');
7519                 this.expect('(');
7520                 if (this.match(';')) {
7521                     this.nextToken();
7522                 }
7523                 else {
7524                     if (this.matchKeyword('var')) {
7525                         init = this.createNode();
7526                         this.nextToken();
7527                         var previousAllowIn = this.context.allowIn;
7528                         this.context.allowIn = false;
7529                         var declarations = this.parseVariableDeclarationList({ inFor: true });
7530                         this.context.allowIn = previousAllowIn;
7531                         if (declarations.length === 1 && this.matchKeyword('in')) {
7532                             var decl = declarations[0];
7533                             if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
7534                                 this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
7535                             }
7536                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
7537                             this.nextToken();
7538                             left = init;
7539                             right = this.parseExpression();
7540                             init = null;
7541                         }
7542                         else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
7543                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
7544                             this.nextToken();
7545                             left = init;
7546                             right = this.parseAssignmentExpression();
7547                             init = null;
7548                             forIn = false;
7549                         }
7550                         else {
7551                             init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
7552                             this.expect(';');
7553                         }
7554                     }
7555                     else if (this.matchKeyword('const') || this.matchKeyword('let')) {
7556                         init = this.createNode();
7557                         var kind = this.nextToken().value;
7558                         if (!this.context.strict && this.lookahead.value === 'in') {
7559                             init = this.finalize(init, new Node.Identifier(kind));
7560                             this.nextToken();
7561                             left = init;
7562                             right = this.parseExpression();
7563                             init = null;
7564                         }
7565                         else {
7566                             var previousAllowIn = this.context.allowIn;
7567                             this.context.allowIn = false;
7568                             var declarations = this.parseBindingList(kind, { inFor: true });
7569                             this.context.allowIn = previousAllowIn;
7570                             if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
7571                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
7572                                 this.nextToken();
7573                                 left = init;
7574                                 right = this.parseExpression();
7575                                 init = null;
7576                             }
7577                             else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
7578                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
7579                                 this.nextToken();
7580                                 left = init;
7581                                 right = this.parseAssignmentExpression();
7582                                 init = null;
7583                                 forIn = false;
7584                             }
7585                             else {
7586                                 this.consumeSemicolon();
7587                                 init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
7588                             }
7589                         }
7590                     }
7591                     else {
7592                         var initStartToken = this.lookahead;
7593                         var previousAllowIn = this.context.allowIn;
7594                         this.context.allowIn = false;
7595                         init = this.inheritCoverGrammar(this.parseAssignmentExpression);
7596                         this.context.allowIn = previousAllowIn;
7597                         if (this.matchKeyword('in')) {
7598                             if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
7599                                 this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
7600                             }
7601                             this.nextToken();
7602                             this.reinterpretExpressionAsPattern(init);
7603                             left = init;
7604                             right = this.parseExpression();
7605                             init = null;
7606                         }
7607                         else if (this.matchContextualKeyword('of')) {
7608                             if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
7609                                 this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
7610                             }
7611                             this.nextToken();
7612                             this.reinterpretExpressionAsPattern(init);
7613                             left = init;
7614                             right = this.parseAssignmentExpression();
7615                             init = null;
7616                             forIn = false;
7617                         }
7618                         else {
7619                             if (this.match(',')) {
7620                                 var initSeq = [init];
7621                                 while (this.match(',')) {
7622                                     this.nextToken();
7623                                     initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
7624                                 }
7625                                 init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
7626                             }
7627                             this.expect(';');
7628                         }
7629                     }
7630                 }
7631                 if (typeof left === 'undefined') {
7632                     if (!this.match(';')) {
7633                         test = this.parseExpression();
7634                     }
7635                     this.expect(';');
7636                     if (!this.match(')')) {
7637                         update = this.parseExpression();
7638                     }
7639                 }
7640                 var body;
7641                 if (!this.match(')') && this.config.tolerant) {
7642                     this.tolerateUnexpectedToken(this.nextToken());
7643                     body = this.finalize(this.createNode(), new Node.EmptyStatement());
7644                 }
7645                 else {
7646                     this.expect(')');
7647                     var previousInIteration = this.context.inIteration;
7648                     this.context.inIteration = true;
7649                     body = this.isolateCoverGrammar(this.parseStatement);
7650                     this.context.inIteration = previousInIteration;
7651                 }
7652                 return (typeof left === 'undefined') ?
7653                     this.finalize(node, new Node.ForStatement(init, test, update, body)) :
7654                     forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
7655                         this.finalize(node, new Node.ForOfStatement(left, right, body));
7656             };
7657             // https://tc39.github.io/ecma262/#sec-continue-statement
7658             Parser.prototype.parseContinueStatement = function () {
7659                 var node = this.createNode();
7660                 this.expectKeyword('continue');
7661                 var label = null;
7662                 if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
7663                     var id = this.parseVariableIdentifier();
7664                     label = id;
7665                     var key = '$' + id.name;
7666                     if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
7667                         this.throwError(messages_1.Messages.UnknownLabel, id.name);
7668                     }
7669                 }
7670                 this.consumeSemicolon();
7671                 if (label === null && !this.context.inIteration) {
7672                     this.throwError(messages_1.Messages.IllegalContinue);
7673                 }
7674                 return this.finalize(node, new Node.ContinueStatement(label));
7675             };
7676             // https://tc39.github.io/ecma262/#sec-break-statement
7677             Parser.prototype.parseBreakStatement = function () {
7678                 var node = this.createNode();
7679                 this.expectKeyword('break');
7680                 var label = null;
7681                 if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
7682                     var id = this.parseVariableIdentifier();
7683                     var key = '$' + id.name;
7684                     if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
7685                         this.throwError(messages_1.Messages.UnknownLabel, id.name);
7686                     }
7687                     label = id;
7688                 }
7689                 this.consumeSemicolon();
7690                 if (label === null && !this.context.inIteration && !this.context.inSwitch) {
7691                     this.throwError(messages_1.Messages.IllegalBreak);
7692                 }
7693                 return this.finalize(node, new Node.BreakStatement(label));
7694             };
7695             // https://tc39.github.io/ecma262/#sec-return-statement
7696             Parser.prototype.parseReturnStatement = function () {
7697                 if (!this.context.inFunctionBody) {
7698                     this.tolerateError(messages_1.Messages.IllegalReturn);
7699                 }
7700                 var node = this.createNode();
7701                 this.expectKeyword('return');
7702                 var hasArgument = (!this.match(';') && !this.match('}') &&
7703                     !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) ||
7704                     this.lookahead.type === 8 /* StringLiteral */ ||
7705                     this.lookahead.type === 10 /* Template */;
7706                 var argument = hasArgument ? this.parseExpression() : null;
7707                 this.consumeSemicolon();
7708                 return this.finalize(node, new Node.ReturnStatement(argument));
7709             };
7710             // https://tc39.github.io/ecma262/#sec-with-statement
7711             Parser.prototype.parseWithStatement = function () {
7712                 if (this.context.strict) {
7713                     this.tolerateError(messages_1.Messages.StrictModeWith);
7714                 }
7715                 var node = this.createNode();
7716                 var body;
7717                 this.expectKeyword('with');
7718                 this.expect('(');
7719                 var object = this.parseExpression();
7720                 if (!this.match(')') && this.config.tolerant) {
7721                     this.tolerateUnexpectedToken(this.nextToken());
7722                     body = this.finalize(this.createNode(), new Node.EmptyStatement());
7723                 }
7724                 else {
7725                     this.expect(')');
7726                     body = this.parseStatement();
7727                 }
7728                 return this.finalize(node, new Node.WithStatement(object, body));
7729             };
7730             // https://tc39.github.io/ecma262/#sec-switch-statement
7731             Parser.prototype.parseSwitchCase = function () {
7732                 var node = this.createNode();
7733                 var test;
7734                 if (this.matchKeyword('default')) {
7735                     this.nextToken();
7736                     test = null;
7737                 }
7738                 else {
7739                     this.expectKeyword('case');
7740                     test = this.parseExpression();
7741                 }
7742                 this.expect(':');
7743                 var consequent = [];
7744                 while (true) {
7745                     if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
7746                         break;
7747                     }
7748                     consequent.push(this.parseStatementListItem());
7749                 }
7750                 return this.finalize(node, new Node.SwitchCase(test, consequent));
7751             };
7752             Parser.prototype.parseSwitchStatement = function () {
7753                 var node = this.createNode();
7754                 this.expectKeyword('switch');
7755                 this.expect('(');
7756                 var discriminant = this.parseExpression();
7757                 this.expect(')');
7758                 var previousInSwitch = this.context.inSwitch;
7759                 this.context.inSwitch = true;
7760                 var cases = [];
7761                 var defaultFound = false;
7762                 this.expect('{');
7763                 while (true) {
7764                     if (this.match('}')) {
7765                         break;
7766                     }
7767                     var clause = this.parseSwitchCase();
7768                     if (clause.test === null) {
7769                         if (defaultFound) {
7770                             this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
7771                         }
7772                         defaultFound = true;
7773                     }
7774                     cases.push(clause);
7775                 }
7776                 this.expect('}');
7777                 this.context.inSwitch = previousInSwitch;
7778                 return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
7779             };
7780             // https://tc39.github.io/ecma262/#sec-labelled-statements
7781             Parser.prototype.parseLabelledStatement = function () {
7782                 var node = this.createNode();
7783                 var expr = this.parseExpression();
7784                 var statement;
7785                 if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
7786                     this.nextToken();
7787                     var id = expr;
7788                     var key = '$' + id.name;
7789                     if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
7790                         this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
7791                     }
7792                     this.context.labelSet[key] = true;
7793                     var body = void 0;
7794                     if (this.matchKeyword('class')) {
7795                         this.tolerateUnexpectedToken(this.lookahead);
7796                         body = this.parseClassDeclaration();
7797                     }
7798                     else if (this.matchKeyword('function')) {
7799                         var token = this.lookahead;
7800                         var declaration = this.parseFunctionDeclaration();
7801                         if (this.context.strict) {
7802                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction);
7803                         }
7804                         else if (declaration.generator) {
7805                             this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext);
7806                         }
7807                         body = declaration;
7808                     }
7809                     else {
7810                         body = this.parseStatement();
7811                     }
7812                     delete this.context.labelSet[key];
7813                     statement = new Node.LabeledStatement(id, body);
7814                 }
7815                 else {
7816                     this.consumeSemicolon();
7817                     statement = new Node.ExpressionStatement(expr);
7818                 }
7819                 return this.finalize(node, statement);
7820             };
7821             // https://tc39.github.io/ecma262/#sec-throw-statement
7822             Parser.prototype.parseThrowStatement = function () {
7823                 var node = this.createNode();
7824                 this.expectKeyword('throw');
7825                 if (this.hasLineTerminator) {
7826                     this.throwError(messages_1.Messages.NewlineAfterThrow);
7827                 }
7828                 var argument = this.parseExpression();
7829                 this.consumeSemicolon();
7830                 return this.finalize(node, new Node.ThrowStatement(argument));
7831             };
7832             // https://tc39.github.io/ecma262/#sec-try-statement
7833             Parser.prototype.parseCatchClause = function () {
7834                 var node = this.createNode();
7835                 this.expectKeyword('catch');
7836                 this.expect('(');
7837                 if (this.match(')')) {
7838                     this.throwUnexpectedToken(this.lookahead);
7839                 }
7840                 var params = [];
7841                 var param = this.parsePattern(params);
7842                 var paramMap = {};
7843                 for (var i = 0; i < params.length; i++) {
7844                     var key = '$' + params[i].value;
7845                     if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
7846                         this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
7847                     }
7848                     paramMap[key] = true;
7849                 }
7850                 if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
7851                     if (this.scanner.isRestrictedWord(param.name)) {
7852                         this.tolerateError(messages_1.Messages.StrictCatchVariable);
7853                     }
7854                 }
7855                 this.expect(')');
7856                 var body = this.parseBlock();
7857                 return this.finalize(node, new Node.CatchClause(param, body));
7858             };
7859             Parser.prototype.parseFinallyClause = function () {
7860                 this.expectKeyword('finally');
7861                 return this.parseBlock();
7862             };
7863             Parser.prototype.parseTryStatement = function () {
7864                 var node = this.createNode();
7865                 this.expectKeyword('try');
7866                 var block = this.parseBlock();
7867                 var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
7868                 var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
7869                 if (!handler && !finalizer) {
7870                     this.throwError(messages_1.Messages.NoCatchOrFinally);
7871                 }
7872                 return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
7873             };
7874             // https://tc39.github.io/ecma262/#sec-debugger-statement
7875             Parser.prototype.parseDebuggerStatement = function () {
7876                 var node = this.createNode();
7877                 this.expectKeyword('debugger');
7878                 this.consumeSemicolon();
7879                 return this.finalize(node, new Node.DebuggerStatement());
7880             };
7881             // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
7882             Parser.prototype.parseStatement = function () {
7883                 var statement;
7884                 switch (this.lookahead.type) {
7885                     case 1 /* BooleanLiteral */:
7886                     case 5 /* NullLiteral */:
7887                     case 6 /* NumericLiteral */:
7888                     case 8 /* StringLiteral */:
7889                     case 10 /* Template */:
7890                     case 9 /* RegularExpression */:
7891                         statement = this.parseExpressionStatement();
7892                         break;
7893                     case 7 /* Punctuator */:
7894                         var value = this.lookahead.value;
7895                         if (value === '{') {
7896                             statement = this.parseBlock();
7897                         }
7898                         else if (value === '(') {
7899                             statement = this.parseExpressionStatement();
7900                         }
7901                         else if (value === ';') {
7902                             statement = this.parseEmptyStatement();
7903                         }
7904                         else {
7905                             statement = this.parseExpressionStatement();
7906                         }
7907                         break;
7908                     case 3 /* Identifier */:
7909                         statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement();
7910                         break;
7911                     case 4 /* Keyword */:
7912                         switch (this.lookahead.value) {
7913                             case 'break':
7914                                 statement = this.parseBreakStatement();
7915                                 break;
7916                             case 'continue':
7917                                 statement = this.parseContinueStatement();
7918                                 break;
7919                             case 'debugger':
7920                                 statement = this.parseDebuggerStatement();
7921                                 break;
7922                             case 'do':
7923                                 statement = this.parseDoWhileStatement();
7924                                 break;
7925                             case 'for':
7926                                 statement = this.parseForStatement();
7927                                 break;
7928                             case 'function':
7929                                 statement = this.parseFunctionDeclaration();
7930                                 break;
7931                             case 'if':
7932                                 statement = this.parseIfStatement();
7933                                 break;
7934                             case 'return':
7935                                 statement = this.parseReturnStatement();
7936                                 break;
7937                             case 'switch':
7938                                 statement = this.parseSwitchStatement();
7939                                 break;
7940                             case 'throw':
7941                                 statement = this.parseThrowStatement();
7942                                 break;
7943                             case 'try':
7944                                 statement = this.parseTryStatement();
7945                                 break;
7946                             case 'var':
7947                                 statement = this.parseVariableStatement();
7948                                 break;
7949                             case 'while':
7950                                 statement = this.parseWhileStatement();
7951                                 break;
7952                             case 'with':
7953                                 statement = this.parseWithStatement();
7954                                 break;
7955                             default:
7956                                 statement = this.parseExpressionStatement();
7957                                 break;
7958                         }
7959                         break;
7960                     default:
7961                         statement = this.throwUnexpectedToken(this.lookahead);
7962                 }
7963                 return statement;
7964             };
7965             // https://tc39.github.io/ecma262/#sec-function-definitions
7966             Parser.prototype.parseFunctionSourceElements = function () {
7967                 var node = this.createNode();
7968                 this.expect('{');
7969                 var body = this.parseDirectivePrologues();
7970                 var previousLabelSet = this.context.labelSet;
7971                 var previousInIteration = this.context.inIteration;
7972                 var previousInSwitch = this.context.inSwitch;
7973                 var previousInFunctionBody = this.context.inFunctionBody;
7974                 this.context.labelSet = {};
7975                 this.context.inIteration = false;
7976                 this.context.inSwitch = false;
7977                 this.context.inFunctionBody = true;
7978                 while (this.lookahead.type !== 2 /* EOF */) {
7979                     if (this.match('}')) {
7980                         break;
7981                     }
7982                     body.push(this.parseStatementListItem());
7983                 }
7984                 this.expect('}');
7985                 this.context.labelSet = previousLabelSet;
7986                 this.context.inIteration = previousInIteration;
7987                 this.context.inSwitch = previousInSwitch;
7988                 this.context.inFunctionBody = previousInFunctionBody;
7989                 return this.finalize(node, new Node.BlockStatement(body));
7990             };
7991             Parser.prototype.validateParam = function (options, param, name) {
7992                 var key = '$' + name;
7993                 if (this.context.strict) {
7994                     if (this.scanner.isRestrictedWord(name)) {
7995                         options.stricted = param;
7996                         options.message = messages_1.Messages.StrictParamName;
7997                     }
7998                     if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
7999                         options.stricted = param;
8000                         options.message = messages_1.Messages.StrictParamDupe;
8001                     }
8002                 }
8003                 else if (!options.firstRestricted) {
8004                     if (this.scanner.isRestrictedWord(name)) {
8005                         options.firstRestricted = param;
8006                         options.message = messages_1.Messages.StrictParamName;
8007                     }
8008                     else if (this.scanner.isStrictModeReservedWord(name)) {
8009                         options.firstRestricted = param;
8010                         options.message = messages_1.Messages.StrictReservedWord;
8011                     }
8012                     else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
8013                         options.stricted = param;
8014                         options.message = messages_1.Messages.StrictParamDupe;
8015                     }
8016                 }
8017                 /* istanbul ignore next */
8018                 if (typeof Object.defineProperty === 'function') {
8019                     Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
8020                 }
8021                 else {
8022                     options.paramSet[key] = true;
8023                 }
8024             };
8025             Parser.prototype.parseRestElement = function (params) {
8026                 var node = this.createNode();
8027                 this.expect('...');
8028                 var arg = this.parsePattern(params);
8029                 if (this.match('=')) {
8030                     this.throwError(messages_1.Messages.DefaultRestParameter);
8031                 }
8032                 if (!this.match(')')) {
8033                     this.throwError(messages_1.Messages.ParameterAfterRestParameter);
8034                 }
8035                 return this.finalize(node, new Node.RestElement(arg));
8036             };
8037             Parser.prototype.parseFormalParameter = function (options) {
8038                 var params = [];
8039                 var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
8040                 for (var i = 0; i < params.length; i++) {
8041                     this.validateParam(options, params[i], params[i].value);
8042                 }
8043                 options.simple = options.simple && (param instanceof Node.Identifier);
8044                 options.params.push(param);
8045             };
8046             Parser.prototype.parseFormalParameters = function (firstRestricted) {
8047                 var options;
8048                 options = {
8049                     simple: true,
8050                     params: [],
8051                     firstRestricted: firstRestricted
8052                 };
8053                 this.expect('(');
8054                 if (!this.match(')')) {
8055                     options.paramSet = {};
8056                     while (this.lookahead.type !== 2 /* EOF */) {
8057                         this.parseFormalParameter(options);
8058                         if (this.match(')')) {
8059                             break;
8060                         }
8061                         this.expect(',');
8062                         if (this.match(')')) {
8063                             break;
8064                         }
8065                     }
8066                 }
8067                 this.expect(')');
8068                 return {
8069                     simple: options.simple,
8070                     params: options.params,
8071                     stricted: options.stricted,
8072                     firstRestricted: options.firstRestricted,
8073                     message: options.message
8074                 };
8075             };
8076             Parser.prototype.matchAsyncFunction = function () {
8077                 var match = this.matchContextualKeyword('async');
8078                 if (match) {
8079                     var state = this.scanner.saveState();
8080                     this.scanner.scanComments();
8081                     var next = this.scanner.lex();
8082                     this.scanner.restoreState(state);
8083                     match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function');
8084                 }
8085                 return match;
8086             };
8087             Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
8088                 var node = this.createNode();
8089                 var isAsync = this.matchContextualKeyword('async');
8090                 if (isAsync) {
8091                     this.nextToken();
8092                 }
8093                 this.expectKeyword('function');
8094                 var isGenerator = isAsync ? false : this.match('*');
8095                 if (isGenerator) {
8096                     this.nextToken();
8097                 }
8098                 var message;
8099                 var id = null;
8100                 var firstRestricted = null;
8101                 if (!identifierIsOptional || !this.match('(')) {
8102                     var token = this.lookahead;
8103                     id = this.parseVariableIdentifier();
8104                     if (this.context.strict) {
8105                         if (this.scanner.isRestrictedWord(token.value)) {
8106                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
8107                         }
8108                     }
8109                     else {
8110                         if (this.scanner.isRestrictedWord(token.value)) {
8111                             firstRestricted = token;
8112                             message = messages_1.Messages.StrictFunctionName;
8113                         }
8114                         else if (this.scanner.isStrictModeReservedWord(token.value)) {
8115                             firstRestricted = token;
8116                             message = messages_1.Messages.StrictReservedWord;
8117                         }
8118                     }
8119                 }
8120                 var previousAllowAwait = this.context.await;
8121                 var previousAllowYield = this.context.allowYield;
8122                 this.context.await = isAsync;
8123                 this.context.allowYield = !isGenerator;
8124                 var formalParameters = this.parseFormalParameters(firstRestricted);
8125                 var params = formalParameters.params;
8126                 var stricted = formalParameters.stricted;
8127                 firstRestricted = formalParameters.firstRestricted;
8128                 if (formalParameters.message) {
8129                     message = formalParameters.message;
8130                 }
8131                 var previousStrict = this.context.strict;
8132                 var previousAllowStrictDirective = this.context.allowStrictDirective;
8133                 this.context.allowStrictDirective = formalParameters.simple;
8134                 var body = this.parseFunctionSourceElements();
8135                 if (this.context.strict && firstRestricted) {
8136                     this.throwUnexpectedToken(firstRestricted, message);
8137                 }
8138                 if (this.context.strict && stricted) {
8139                     this.tolerateUnexpectedToken(stricted, message);
8140                 }
8141                 this.context.strict = previousStrict;
8142                 this.context.allowStrictDirective = previousAllowStrictDirective;
8143                 this.context.await = previousAllowAwait;
8144                 this.context.allowYield = previousAllowYield;
8145                 return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) :
8146                     this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
8147             };
8148             Parser.prototype.parseFunctionExpression = function () {
8149                 var node = this.createNode();
8150                 var isAsync = this.matchContextualKeyword('async');
8151                 if (isAsync) {
8152                     this.nextToken();
8153                 }
8154                 this.expectKeyword('function');
8155                 var isGenerator = isAsync ? false : this.match('*');
8156                 if (isGenerator) {
8157                     this.nextToken();
8158                 }
8159                 var message;
8160                 var id = null;
8161                 var firstRestricted;
8162                 var previousAllowAwait = this.context.await;
8163                 var previousAllowYield = this.context.allowYield;
8164                 this.context.await = isAsync;
8165                 this.context.allowYield = !isGenerator;
8166                 if (!this.match('(')) {
8167                     var token = this.lookahead;
8168                     id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
8169                     if (this.context.strict) {
8170                         if (this.scanner.isRestrictedWord(token.value)) {
8171                             this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
8172                         }
8173                     }
8174                     else {
8175                         if (this.scanner.isRestrictedWord(token.value)) {
8176                             firstRestricted = token;
8177                             message = messages_1.Messages.StrictFunctionName;
8178                         }
8179                         else if (this.scanner.isStrictModeReservedWord(token.value)) {
8180                             firstRestricted = token;
8181                             message = messages_1.Messages.StrictReservedWord;
8182                         }
8183                     }
8184                 }
8185                 var formalParameters = this.parseFormalParameters(firstRestricted);
8186                 var params = formalParameters.params;
8187                 var stricted = formalParameters.stricted;
8188                 firstRestricted = formalParameters.firstRestricted;
8189                 if (formalParameters.message) {
8190                     message = formalParameters.message;
8191                 }
8192                 var previousStrict = this.context.strict;
8193                 var previousAllowStrictDirective = this.context.allowStrictDirective;
8194                 this.context.allowStrictDirective = formalParameters.simple;
8195                 var body = this.parseFunctionSourceElements();
8196                 if (this.context.strict && firstRestricted) {
8197                     this.throwUnexpectedToken(firstRestricted, message);
8198                 }
8199                 if (this.context.strict && stricted) {
8200                     this.tolerateUnexpectedToken(stricted, message);
8201                 }
8202                 this.context.strict = previousStrict;
8203                 this.context.allowStrictDirective = previousAllowStrictDirective;
8204                 this.context.await = previousAllowAwait;
8205                 this.context.allowYield = previousAllowYield;
8206                 return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) :
8207                     this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
8208             };
8209             // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
8210             Parser.prototype.parseDirective = function () {
8211                 var token = this.lookahead;
8212                 var node = this.createNode();
8213                 var expr = this.parseExpression();
8214                 var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
8215                 this.consumeSemicolon();
8216                 return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
8217             };
8218             Parser.prototype.parseDirectivePrologues = function () {
8219                 var firstRestricted = null;
8220                 var body = [];
8221                 while (true) {
8222                     var token = this.lookahead;
8223                     if (token.type !== 8 /* StringLiteral */) {
8224                         break;
8225                     }
8226                     var statement = this.parseDirective();
8227                     body.push(statement);
8228                     var directive = statement.directive;
8229                     if (typeof directive !== 'string') {
8230                         break;
8231                     }
8232                     if (directive === 'use strict') {
8233                         this.context.strict = true;
8234                         if (firstRestricted) {
8235                             this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
8236                         }
8237                         if (!this.context.allowStrictDirective) {
8238                             this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective);
8239                         }
8240                     }
8241                     else {
8242                         if (!firstRestricted && token.octal) {
8243                             firstRestricted = token;
8244                         }
8245                     }
8246                 }
8247                 return body;
8248             };
8249             // https://tc39.github.io/ecma262/#sec-method-definitions
8250             Parser.prototype.qualifiedPropertyName = function (token) {
8251                 switch (token.type) {
8252                     case 3 /* Identifier */:
8253                     case 8 /* StringLiteral */:
8254                     case 1 /* BooleanLiteral */:
8255                     case 5 /* NullLiteral */:
8256                     case 6 /* NumericLiteral */:
8257                     case 4 /* Keyword */:
8258                         return true;
8259                     case 7 /* Punctuator */:
8260                         return token.value === '[';
8261                     default:
8262                         break;
8263                 }
8264                 return false;
8265             };
8266             Parser.prototype.parseGetterMethod = function () {
8267                 var node = this.createNode();
8268                 var isGenerator = false;
8269                 var previousAllowYield = this.context.allowYield;
8270                 this.context.allowYield = !isGenerator;
8271                 var formalParameters = this.parseFormalParameters();
8272                 if (formalParameters.params.length > 0) {
8273                     this.tolerateError(messages_1.Messages.BadGetterArity);
8274                 }
8275                 var method = this.parsePropertyMethod(formalParameters);
8276                 this.context.allowYield = previousAllowYield;
8277                 return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
8278             };
8279             Parser.prototype.parseSetterMethod = function () {
8280                 var node = this.createNode();
8281                 var isGenerator = false;
8282                 var previousAllowYield = this.context.allowYield;
8283                 this.context.allowYield = !isGenerator;
8284                 var formalParameters = this.parseFormalParameters();
8285                 if (formalParameters.params.length !== 1) {
8286                     this.tolerateError(messages_1.Messages.BadSetterArity);
8287                 }
8288                 else if (formalParameters.params[0] instanceof Node.RestElement) {
8289                     this.tolerateError(messages_1.Messages.BadSetterRestParameter);
8290                 }
8291                 var method = this.parsePropertyMethod(formalParameters);
8292                 this.context.allowYield = previousAllowYield;
8293                 return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
8294             };
8295             Parser.prototype.parseGeneratorMethod = function () {
8296                 var node = this.createNode();
8297                 var isGenerator = true;
8298                 var previousAllowYield = this.context.allowYield;
8299                 this.context.allowYield = true;
8300                 var params = this.parseFormalParameters();
8301                 this.context.allowYield = false;
8302                 var method = this.parsePropertyMethod(params);
8303                 this.context.allowYield = previousAllowYield;
8304                 return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
8305             };
8306             // https://tc39.github.io/ecma262/#sec-generator-function-definitions
8307             Parser.prototype.isStartOfExpression = function () {
8308                 var start = true;
8309                 var value = this.lookahead.value;
8310                 switch (this.lookahead.type) {
8311                     case 7 /* Punctuator */:
8312                         start = (value === '[') || (value === '(') || (value === '{') ||
8313                             (value === '+') || (value === '-') ||
8314                             (value === '!') || (value === '~') ||
8315                             (value === '++') || (value === '--') ||
8316                             (value === '/') || (value === '/='); // regular expression literal
8317                         break;
8318                     case 4 /* Keyword */:
8319                         start = (value === 'class') || (value === 'delete') ||
8320                             (value === 'function') || (value === 'let') || (value === 'new') ||
8321                             (value === 'super') || (value === 'this') || (value === 'typeof') ||
8322                             (value === 'void') || (value === 'yield');
8323                         break;
8324                     default:
8325                         break;
8326                 }
8327                 return start;
8328             };
8329             Parser.prototype.parseYieldExpression = function () {
8330                 var node = this.createNode();
8331                 this.expectKeyword('yield');
8332                 var argument = null;
8333                 var delegate = false;
8334                 if (!this.hasLineTerminator) {
8335                     var previousAllowYield = this.context.allowYield;
8336                     this.context.allowYield = false;
8337                     delegate = this.match('*');
8338                     if (delegate) {
8339                         this.nextToken();
8340                         argument = this.parseAssignmentExpression();
8341                     }
8342                     else if (this.isStartOfExpression()) {
8343                         argument = this.parseAssignmentExpression();
8344                     }
8345                     this.context.allowYield = previousAllowYield;
8346                 }
8347                 return this.finalize(node, new Node.YieldExpression(argument, delegate));
8348             };
8349             // https://tc39.github.io/ecma262/#sec-class-definitions
8350             Parser.prototype.parseClassElement = function (hasConstructor) {
8351                 var token = this.lookahead;
8352                 var node = this.createNode();
8353                 var kind = '';
8354                 var key = null;
8355                 var value = null;
8356                 var computed = false;
8357                 var method = false;
8358                 var isStatic = false;
8359                 var isAsync = false;
8360                 if (this.match('*')) {
8361                     this.nextToken();
8362                 }
8363                 else {
8364                     computed = this.match('[');
8365                     key = this.parseObjectPropertyKey();
8366                     var id = key;
8367                     if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
8368                         token = this.lookahead;
8369                         isStatic = true;
8370                         computed = this.match('[');
8371                         if (this.match('*')) {
8372                             this.nextToken();
8373                         }
8374                         else {
8375                             key = this.parseObjectPropertyKey();
8376                         }
8377                     }
8378                     if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) {
8379                         var punctuator = this.lookahead.value;
8380                         if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') {
8381                             isAsync = true;
8382                             token = this.lookahead;
8383                             key = this.parseObjectPropertyKey();
8384                             if (token.type === 3 /* Identifier */ && token.value === 'constructor') {
8385                                 this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync);
8386                             }
8387                         }
8388                     }
8389                 }
8390                 var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
8391                 if (token.type === 3 /* Identifier */) {
8392                     if (token.value === 'get' && lookaheadPropertyKey) {
8393                         kind = 'get';
8394                         computed = this.match('[');
8395                         key = this.parseObjectPropertyKey();
8396                         this.context.allowYield = false;
8397                         value = this.parseGetterMethod();
8398                     }
8399                     else if (token.value === 'set' && lookaheadPropertyKey) {
8400                         kind = 'set';
8401                         computed = this.match('[');
8402                         key = this.parseObjectPropertyKey();
8403                         value = this.parseSetterMethod();
8404                     }
8405                 }
8406                 else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
8407                     kind = 'init';
8408                     computed = this.match('[');
8409                     key = this.parseObjectPropertyKey();
8410                     value = this.parseGeneratorMethod();
8411                     method = true;
8412                 }
8413                 if (!kind && key && this.match('(')) {
8414                     kind = 'init';
8415                     value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
8416                     method = true;
8417                 }
8418                 if (!kind) {
8419                     this.throwUnexpectedToken(this.lookahead);
8420                 }
8421                 if (kind === 'init') {
8422                     kind = 'method';
8423                 }
8424                 if (!computed) {
8425                     if (isStatic && this.isPropertyKey(key, 'prototype')) {
8426                         this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
8427                     }
8428                     if (!isStatic && this.isPropertyKey(key, 'constructor')) {
8429                         if (kind !== 'method' || !method || (value && value.generator)) {
8430                             this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
8431                         }
8432                         if (hasConstructor.value) {
8433                             this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
8434                         }
8435                         else {
8436                             hasConstructor.value = true;
8437                         }
8438                         kind = 'constructor';
8439                     }
8440                 }
8441                 return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
8442             };
8443             Parser.prototype.parseClassElementList = function () {
8444                 var body = [];
8445                 var hasConstructor = { value: false };
8446                 this.expect('{');
8447                 while (!this.match('}')) {
8448                     if (this.match(';')) {
8449                         this.nextToken();
8450                     }
8451                     else {
8452                         body.push(this.parseClassElement(hasConstructor));
8453                     }
8454                 }
8455                 this.expect('}');
8456                 return body;
8457             };
8458             Parser.prototype.parseClassBody = function () {
8459                 var node = this.createNode();
8460                 var elementList = this.parseClassElementList();
8461                 return this.finalize(node, new Node.ClassBody(elementList));
8462             };
8463             Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
8464                 var node = this.createNode();
8465                 var previousStrict = this.context.strict;
8466                 this.context.strict = true;
8467                 this.expectKeyword('class');
8468                 var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier();
8469                 var superClass = null;
8470                 if (this.matchKeyword('extends')) {
8471                     this.nextToken();
8472                     superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
8473                 }
8474                 var classBody = this.parseClassBody();
8475                 this.context.strict = previousStrict;
8476                 return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
8477             };
8478             Parser.prototype.parseClassExpression = function () {
8479                 var node = this.createNode();
8480                 var previousStrict = this.context.strict;
8481                 this.context.strict = true;
8482                 this.expectKeyword('class');
8483                 var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null;
8484                 var superClass = null;
8485                 if (this.matchKeyword('extends')) {
8486                     this.nextToken();
8487                     superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
8488                 }
8489                 var classBody = this.parseClassBody();
8490                 this.context.strict = previousStrict;
8491                 return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
8492             };
8493             // https://tc39.github.io/ecma262/#sec-scripts
8494             // https://tc39.github.io/ecma262/#sec-modules
8495             Parser.prototype.parseModule = function () {
8496                 this.context.strict = true;
8497                 this.context.isModule = true;
8498                 this.scanner.isModule = true;
8499                 var node = this.createNode();
8500                 var body = this.parseDirectivePrologues();
8501                 while (this.lookahead.type !== 2 /* EOF */) {
8502                     body.push(this.parseStatementListItem());
8503                 }
8504                 return this.finalize(node, new Node.Module(body));
8505             };
8506             Parser.prototype.parseScript = function () {
8507                 var node = this.createNode();
8508                 var body = this.parseDirectivePrologues();
8509                 while (this.lookahead.type !== 2 /* EOF */) {
8510                     body.push(this.parseStatementListItem());
8511                 }
8512                 return this.finalize(node, new Node.Script(body));
8513             };
8514             // https://tc39.github.io/ecma262/#sec-imports
8515             Parser.prototype.parseModuleSpecifier = function () {
8516                 var node = this.createNode();
8517                 if (this.lookahead.type !== 8 /* StringLiteral */) {
8518                     this.throwError(messages_1.Messages.InvalidModuleSpecifier);
8519                 }
8520                 var token = this.nextToken();
8521                 var raw = this.getTokenRaw(token);
8522                 return this.finalize(node, new Node.Literal(token.value, raw));
8523             };
8524             // import {<foo as bar>} ...;
8525             Parser.prototype.parseImportSpecifier = function () {
8526                 var node = this.createNode();
8527                 var imported;
8528                 var local;
8529                 if (this.lookahead.type === 3 /* Identifier */) {
8530                     imported = this.parseVariableIdentifier();
8531                     local = imported;
8532                     if (this.matchContextualKeyword('as')) {
8533                         this.nextToken();
8534                         local = this.parseVariableIdentifier();
8535                     }
8536                 }
8537                 else {
8538                     imported = this.parseIdentifierName();
8539                     local = imported;
8540                     if (this.matchContextualKeyword('as')) {
8541                         this.nextToken();
8542                         local = this.parseVariableIdentifier();
8543                     }
8544                     else {
8545                         this.throwUnexpectedToken(this.nextToken());
8546                     }
8547                 }
8548                 return this.finalize(node, new Node.ImportSpecifier(local, imported));
8549             };
8550             // {foo, bar as bas}
8551             Parser.prototype.parseNamedImports = function () {
8552                 this.expect('{');
8553                 var specifiers = [];
8554                 while (!this.match('}')) {
8555                     specifiers.push(this.parseImportSpecifier());
8556                     if (!this.match('}')) {
8557                         this.expect(',');
8558                     }
8559                 }
8560                 this.expect('}');
8561                 return specifiers;
8562             };
8563             // import <foo> ...;
8564             Parser.prototype.parseImportDefaultSpecifier = function () {
8565                 var node = this.createNode();
8566                 var local = this.parseIdentifierName();
8567                 return this.finalize(node, new Node.ImportDefaultSpecifier(local));
8568             };
8569             // import <* as foo> ...;
8570             Parser.prototype.parseImportNamespaceSpecifier = function () {
8571                 var node = this.createNode();
8572                 this.expect('*');
8573                 if (!this.matchContextualKeyword('as')) {
8574                     this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
8575                 }
8576                 this.nextToken();
8577                 var local = this.parseIdentifierName();
8578                 return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
8579             };
8580             Parser.prototype.parseImportDeclaration = function () {
8581                 if (this.context.inFunctionBody) {
8582                     this.throwError(messages_1.Messages.IllegalImportDeclaration);
8583                 }
8584                 var node = this.createNode();
8585                 this.expectKeyword('import');
8586                 var src;
8587                 var specifiers = [];
8588                 if (this.lookahead.type === 8 /* StringLiteral */) {
8589                     // import 'foo';
8590                     src = this.parseModuleSpecifier();
8591                 }
8592                 else {
8593                     if (this.match('{')) {
8594                         // import {bar}
8595                         specifiers = specifiers.concat(this.parseNamedImports());
8596                     }
8597                     else if (this.match('*')) {
8598                         // import * as foo
8599                         specifiers.push(this.parseImportNamespaceSpecifier());
8600                     }
8601                     else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
8602                         // import foo
8603                         specifiers.push(this.parseImportDefaultSpecifier());
8604                         if (this.match(',')) {
8605                             this.nextToken();
8606                             if (this.match('*')) {
8607                                 // import foo, * as foo
8608                                 specifiers.push(this.parseImportNamespaceSpecifier());
8609                             }
8610                             else if (this.match('{')) {
8611                                 // import foo, {bar}
8612                                 specifiers = specifiers.concat(this.parseNamedImports());
8613                             }
8614                             else {
8615                                 this.throwUnexpectedToken(this.lookahead);
8616                             }
8617                         }
8618                     }
8619                     else {
8620                         this.throwUnexpectedToken(this.nextToken());
8621                     }
8622                     if (!this.matchContextualKeyword('from')) {
8623                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
8624                         this.throwError(message, this.lookahead.value);
8625                     }
8626                     this.nextToken();
8627                     src = this.parseModuleSpecifier();
8628                 }
8629                 this.consumeSemicolon();
8630                 return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
8631             };
8632             // https://tc39.github.io/ecma262/#sec-exports
8633             Parser.prototype.parseExportSpecifier = function () {
8634                 var node = this.createNode();
8635                 var local = this.parseIdentifierName();
8636                 var exported = local;
8637                 if (this.matchContextualKeyword('as')) {
8638                     this.nextToken();
8639                     exported = this.parseIdentifierName();
8640                 }
8641                 return this.finalize(node, new Node.ExportSpecifier(local, exported));
8642             };
8643             Parser.prototype.parseExportDeclaration = function () {
8644                 if (this.context.inFunctionBody) {
8645                     this.throwError(messages_1.Messages.IllegalExportDeclaration);
8646                 }
8647                 var node = this.createNode();
8648                 this.expectKeyword('export');
8649                 var exportDeclaration;
8650                 if (this.matchKeyword('default')) {
8651                     // export default ...
8652                     this.nextToken();
8653                     if (this.matchKeyword('function')) {
8654                         // export default function foo () {}
8655                         // export default function () {}
8656                         var declaration = this.parseFunctionDeclaration(true);
8657                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
8658                     }
8659                     else if (this.matchKeyword('class')) {
8660                         // export default class foo {}
8661                         var declaration = this.parseClassDeclaration(true);
8662                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
8663                     }
8664                     else if (this.matchContextualKeyword('async')) {
8665                         // export default async function f () {}
8666                         // export default async function () {}
8667                         // export default async x => x
8668                         var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression();
8669                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
8670                     }
8671                     else {
8672                         if (this.matchContextualKeyword('from')) {
8673                             this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
8674                         }
8675                         // export default {};
8676                         // export default [];
8677                         // export default (1 + 2);
8678                         var declaration = this.match('{') ? this.parseObjectInitializer() :
8679                             this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
8680                         this.consumeSemicolon();
8681                         exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
8682                     }
8683                 }
8684                 else if (this.match('*')) {
8685                     // export * from 'foo';
8686                     this.nextToken();
8687                     if (!this.matchContextualKeyword('from')) {
8688                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
8689                         this.throwError(message, this.lookahead.value);
8690                     }
8691                     this.nextToken();
8692                     var src = this.parseModuleSpecifier();
8693                     this.consumeSemicolon();
8694                     exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
8695                 }
8696                 else if (this.lookahead.type === 4 /* Keyword */) {
8697                     // export var f = 1;
8698                     var declaration = void 0;
8699                     switch (this.lookahead.value) {
8700                         case 'let':
8701                         case 'const':
8702                             declaration = this.parseLexicalDeclaration({ inFor: false });
8703                             break;
8704                         case 'var':
8705                         case 'class':
8706                         case 'function':
8707                             declaration = this.parseStatementListItem();
8708                             break;
8709                         default:
8710                             this.throwUnexpectedToken(this.lookahead);
8711                     }
8712                     exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
8713                 }
8714                 else if (this.matchAsyncFunction()) {
8715                     var declaration = this.parseFunctionDeclaration();
8716                     exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
8717                 }
8718                 else {
8719                     var specifiers = [];
8720                     var source = null;
8721                     var isExportFromIdentifier = false;
8722                     this.expect('{');
8723                     while (!this.match('}')) {
8724                         isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
8725                         specifiers.push(this.parseExportSpecifier());
8726                         if (!this.match('}')) {
8727                             this.expect(',');
8728                         }
8729                     }
8730                     this.expect('}');
8731                     if (this.matchContextualKeyword('from')) {
8732                         // export {default} from 'foo';
8733                         // export {foo} from 'foo';
8734                         this.nextToken();
8735                         source = this.parseModuleSpecifier();
8736                         this.consumeSemicolon();
8737                     }
8738                     else if (isExportFromIdentifier) {
8739                         // export {default}; // missing fromClause
8740                         var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
8741                         this.throwError(message, this.lookahead.value);
8742                     }
8743                     else {
8744                         // export {foo};
8745                         this.consumeSemicolon();
8746                     }
8747                     exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
8748                 }
8749                 return exportDeclaration;
8750             };
8751             return Parser;
8752         }());
8753         exports.Parser = Parser;
8754
8755
8756 /***/ },
8757 /* 9 */
8758 /***/ function(module, exports) {
8759
8760         "use strict";
8761         // Ensure the condition is true, otherwise throw an error.
8762         // This is only to have a better contract semantic, i.e. another safety net
8763         // to catch a logic error. The condition shall be fulfilled in normal case.
8764         // Do NOT use this to enforce a certain condition on any user input.
8765         Object.defineProperty(exports, "__esModule", { value: true });
8766         function assert(condition, message) {
8767             /* istanbul ignore if */
8768             if (!condition) {
8769                 throw new Error('ASSERT: ' + message);
8770             }
8771         }
8772         exports.assert = assert;
8773
8774
8775 /***/ },
8776 /* 10 */
8777 /***/ function(module, exports) {
8778
8779         "use strict";
8780         /* tslint:disable:max-classes-per-file */
8781         Object.defineProperty(exports, "__esModule", { value: true });
8782         var ErrorHandler = (function () {
8783             function ErrorHandler() {
8784                 this.errors = [];
8785                 this.tolerant = false;
8786             }
8787             ErrorHandler.prototype.recordError = function (error) {
8788                 this.errors.push(error);
8789             };
8790             ErrorHandler.prototype.tolerate = function (error) {
8791                 if (this.tolerant) {
8792                     this.recordError(error);
8793                 }
8794                 else {
8795                     throw error;
8796                 }
8797             };
8798             ErrorHandler.prototype.constructError = function (msg, column) {
8799                 var error = new Error(msg);
8800                 try {
8801                     throw error;
8802                 }
8803                 catch (base) {
8804                     /* istanbul ignore else */
8805                     if (Object.create && Object.defineProperty) {
8806                         error = Object.create(base);
8807                         Object.defineProperty(error, 'column', { value: column });
8808                     }
8809                 }
8810                 /* istanbul ignore next */
8811                 return error;
8812             };
8813             ErrorHandler.prototype.createError = function (index, line, col, description) {
8814                 var msg = 'Line ' + line + ': ' + description;
8815                 var error = this.constructError(msg, col);
8816                 error.index = index;
8817                 error.lineNumber = line;
8818                 error.description = description;
8819                 return error;
8820             };
8821             ErrorHandler.prototype.throwError = function (index, line, col, description) {
8822                 throw this.createError(index, line, col, description);
8823             };
8824             ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
8825                 var error = this.createError(index, line, col, description);
8826                 if (this.tolerant) {
8827                     this.recordError(error);
8828                 }
8829                 else {
8830                     throw error;
8831                 }
8832             };
8833             return ErrorHandler;
8834         }());
8835         exports.ErrorHandler = ErrorHandler;
8836
8837
8838 /***/ },
8839 /* 11 */
8840 /***/ function(module, exports) {
8841
8842         "use strict";
8843         Object.defineProperty(exports, "__esModule", { value: true });
8844         // Error messages should be identical to V8.
8845         exports.Messages = {
8846             BadGetterArity: 'Getter must not have any formal parameters',
8847             BadSetterArity: 'Setter must have exactly one formal parameter',
8848             BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
8849             ConstructorIsAsync: 'Class constructor may not be an async method',
8850             ConstructorSpecialMethod: 'Class constructor may not be an accessor',
8851             DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
8852             DefaultRestParameter: 'Unexpected token =',
8853             DuplicateBinding: 'Duplicate binding %0',
8854             DuplicateConstructor: 'A class may only have one constructor',
8855             DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
8856             ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer',
8857             GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts',
8858             IllegalBreak: 'Illegal break statement',
8859             IllegalContinue: 'Illegal continue statement',
8860             IllegalExportDeclaration: 'Unexpected token',
8861             IllegalImportDeclaration: 'Unexpected token',
8862             IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list',
8863             IllegalReturn: 'Illegal return statement',
8864             InvalidEscapedReservedWord: 'Keyword must not contain escaped characters',
8865             InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence',
8866             InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
8867             InvalidLHSInForIn: 'Invalid left-hand side in for-in',
8868             InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
8869             InvalidModuleSpecifier: 'Unexpected token',
8870             InvalidRegExp: 'Invalid regular expression',
8871             LetInLexicalBinding: 'let is disallowed as a lexically bound name',
8872             MissingFromClause: 'Unexpected token',
8873             MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
8874             NewlineAfterThrow: 'Illegal newline after throw',
8875             NoAsAfterImportNamespace: 'Unexpected token',
8876             NoCatchOrFinally: 'Missing catch or finally after try',
8877             ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
8878             Redeclaration: '%0 \'%1\' has already been declared',
8879             StaticPrototype: 'Classes may not have static property named prototype',
8880             StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
8881             StrictDelete: 'Delete of an unqualified identifier in strict mode.',
8882             StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block',
8883             StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
8884             StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
8885             StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
8886             StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
8887             StrictModeWith: 'Strict mode code may not include a with statement',
8888             StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
8889             StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
8890             StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
8891             StrictReservedWord: 'Use of future reserved word in strict mode',
8892             StrictVarName: 'Variable name may not be eval or arguments in strict mode',
8893             TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
8894             UnexpectedEOS: 'Unexpected end of input',
8895             UnexpectedIdentifier: 'Unexpected identifier',
8896             UnexpectedNumber: 'Unexpected number',
8897             UnexpectedReserved: 'Unexpected reserved word',
8898             UnexpectedString: 'Unexpected string',
8899             UnexpectedTemplate: 'Unexpected quasi %0',
8900             UnexpectedToken: 'Unexpected token %0',
8901             UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
8902             UnknownLabel: 'Undefined label \'%0\'',
8903             UnterminatedRegExp: 'Invalid regular expression: missing /'
8904         };
8905
8906
8907 /***/ },
8908 /* 12 */
8909 /***/ function(module, exports, __webpack_require__) {
8910
8911         "use strict";
8912         Object.defineProperty(exports, "__esModule", { value: true });
8913         var assert_1 = __webpack_require__(9);
8914         var character_1 = __webpack_require__(4);
8915         var messages_1 = __webpack_require__(11);
8916         function hexValue(ch) {
8917             return '0123456789abcdef'.indexOf(ch.toLowerCase());
8918         }
8919         function octalValue(ch) {
8920             return '01234567'.indexOf(ch);
8921         }
8922         var Scanner = (function () {
8923             function Scanner(code, handler) {
8924                 this.source = code;
8925                 this.errorHandler = handler;
8926                 this.trackComment = false;
8927                 this.isModule = false;
8928                 this.length = code.length;
8929                 this.index = 0;
8930                 this.lineNumber = (code.length > 0) ? 1 : 0;
8931                 this.lineStart = 0;
8932                 this.curlyStack = [];
8933             }
8934             Scanner.prototype.saveState = function () {
8935                 return {
8936                     index: this.index,
8937                     lineNumber: this.lineNumber,
8938                     lineStart: this.lineStart
8939                 };
8940             };
8941             Scanner.prototype.restoreState = function (state) {
8942                 this.index = state.index;
8943                 this.lineNumber = state.lineNumber;
8944                 this.lineStart = state.lineStart;
8945             };
8946             Scanner.prototype.eof = function () {
8947                 return this.index >= this.length;
8948             };
8949             Scanner.prototype.throwUnexpectedToken = function (message) {
8950                 if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
8951                 return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
8952             };
8953             Scanner.prototype.tolerateUnexpectedToken = function (message) {
8954                 if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
8955                 this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
8956             };
8957             // https://tc39.github.io/ecma262/#sec-comments
8958             Scanner.prototype.skipSingleLineComment = function (offset) {
8959                 var comments = [];
8960                 var start, loc;
8961                 if (this.trackComment) {
8962                     comments = [];
8963                     start = this.index - offset;
8964                     loc = {
8965                         start: {
8966                             line: this.lineNumber,
8967                             column: this.index - this.lineStart - offset
8968                         },
8969                         end: {}
8970                     };
8971                 }
8972                 while (!this.eof()) {
8973                     var ch = this.source.charCodeAt(this.index);
8974                     ++this.index;
8975                     if (character_1.Character.isLineTerminator(ch)) {
8976                         if (this.trackComment) {
8977                             loc.end = {
8978                                 line: this.lineNumber,
8979                                 column: this.index - this.lineStart - 1
8980                             };
8981                             var entry = {
8982                                 multiLine: false,
8983                                 slice: [start + offset, this.index - 1],
8984                                 range: [start, this.index - 1],
8985                                 loc: loc
8986                             };
8987                             comments.push(entry);
8988                         }
8989                         if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
8990                             ++this.index;
8991                         }
8992                         ++this.lineNumber;
8993                         this.lineStart = this.index;
8994                         return comments;
8995                     }
8996                 }
8997                 if (this.trackComment) {
8998                     loc.end = {
8999                         line: this.lineNumber,
9000                         column: this.index - this.lineStart
9001                     };
9002                     var entry = {
9003                         multiLine: false,
9004                         slice: [start + offset, this.index],
9005                         range: [start, this.index],
9006                         loc: loc
9007                     };
9008                     comments.push(entry);
9009                 }
9010                 return comments;
9011             };
9012             Scanner.prototype.skipMultiLineComment = function () {
9013                 var comments = [];
9014                 var start, loc;
9015                 if (this.trackComment) {
9016                     comments = [];
9017                     start = this.index - 2;
9018                     loc = {
9019                         start: {
9020                             line: this.lineNumber,
9021                             column: this.index - this.lineStart - 2
9022                         },
9023                         end: {}
9024                     };
9025                 }
9026                 while (!this.eof()) {
9027                     var ch = this.source.charCodeAt(this.index);
9028                     if (character_1.Character.isLineTerminator(ch)) {
9029                         if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
9030                             ++this.index;
9031                         }
9032                         ++this.lineNumber;
9033                         ++this.index;
9034                         this.lineStart = this.index;
9035                     }
9036                     else if (ch === 0x2A) {
9037                         // Block comment ends with '*/'.
9038                         if (this.source.charCodeAt(this.index + 1) === 0x2F) {
9039                             this.index += 2;
9040                             if (this.trackComment) {
9041                                 loc.end = {
9042                                     line: this.lineNumber,
9043                                     column: this.index - this.lineStart
9044                                 };
9045                                 var entry = {
9046                                     multiLine: true,
9047                                     slice: [start + 2, this.index - 2],
9048                                     range: [start, this.index],
9049                                     loc: loc
9050                                 };
9051                                 comments.push(entry);
9052                             }
9053                             return comments;
9054                         }
9055                         ++this.index;
9056                     }
9057                     else {
9058                         ++this.index;
9059                     }
9060                 }
9061                 // Ran off the end of the file - the whole thing is a comment
9062                 if (this.trackComment) {
9063                     loc.end = {
9064                         line: this.lineNumber,
9065                         column: this.index - this.lineStart
9066                     };
9067                     var entry = {
9068                         multiLine: true,
9069                         slice: [start + 2, this.index],
9070                         range: [start, this.index],
9071                         loc: loc
9072                     };
9073                     comments.push(entry);
9074                 }
9075                 this.tolerateUnexpectedToken();
9076                 return comments;
9077             };
9078             Scanner.prototype.scanComments = function () {
9079                 var comments;
9080                 if (this.trackComment) {
9081                     comments = [];
9082                 }
9083                 var start = (this.index === 0);
9084                 while (!this.eof()) {
9085                     var ch = this.source.charCodeAt(this.index);
9086                     if (character_1.Character.isWhiteSpace(ch)) {
9087                         ++this.index;
9088                     }
9089                     else if (character_1.Character.isLineTerminator(ch)) {
9090                         ++this.index;
9091                         if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
9092                             ++this.index;
9093                         }
9094                         ++this.lineNumber;
9095                         this.lineStart = this.index;
9096                         start = true;
9097                     }
9098                     else if (ch === 0x2F) {
9099                         ch = this.source.charCodeAt(this.index + 1);
9100                         if (ch === 0x2F) {
9101                             this.index += 2;
9102                             var comment = this.skipSingleLineComment(2);
9103                             if (this.trackComment) {
9104                                 comments = comments.concat(comment);
9105                             }
9106                             start = true;
9107                         }
9108                         else if (ch === 0x2A) {
9109                             this.index += 2;
9110                             var comment = this.skipMultiLineComment();
9111                             if (this.trackComment) {
9112                                 comments = comments.concat(comment);
9113                             }
9114                         }
9115                         else {
9116                             break;
9117                         }
9118                     }
9119                     else if (start && ch === 0x2D) {
9120                         // U+003E is '>'
9121                         if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
9122                             // '-->' is a single-line comment
9123                             this.index += 3;
9124                             var comment = this.skipSingleLineComment(3);
9125                             if (this.trackComment) {
9126                                 comments = comments.concat(comment);
9127                             }
9128                         }
9129                         else {
9130                             break;
9131                         }
9132                     }
9133                     else if (ch === 0x3C && !this.isModule) {
9134                         if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
9135                             this.index += 4; // `<!--`
9136                             var comment = this.skipSingleLineComment(4);
9137                             if (this.trackComment) {
9138                                 comments = comments.concat(comment);
9139                             }
9140                         }
9141                         else {
9142                             break;
9143                         }
9144                     }
9145                     else {
9146                         break;
9147                     }
9148                 }
9149                 return comments;
9150             };
9151             // https://tc39.github.io/ecma262/#sec-future-reserved-words
9152             Scanner.prototype.isFutureReservedWord = function (id) {
9153                 switch (id) {
9154                     case 'enum':
9155                     case 'export':
9156                     case 'import':
9157                     case 'super':
9158                         return true;
9159                     default:
9160                         return false;
9161                 }
9162             };
9163             Scanner.prototype.isStrictModeReservedWord = function (id) {
9164                 switch (id) {
9165                     case 'implements':
9166                     case 'interface':
9167                     case 'package':
9168                     case 'private':
9169                     case 'protected':
9170                     case 'public':
9171                     case 'static':
9172                     case 'yield':
9173                     case 'let':
9174                         return true;
9175                     default:
9176                         return false;
9177                 }
9178             };
9179             Scanner.prototype.isRestrictedWord = function (id) {
9180                 return id === 'eval' || id === 'arguments';
9181             };
9182             // https://tc39.github.io/ecma262/#sec-keywords
9183             Scanner.prototype.isKeyword = function (id) {
9184                 switch (id.length) {
9185                     case 2:
9186                         return (id === 'if') || (id === 'in') || (id === 'do');
9187                     case 3:
9188                         return (id === 'var') || (id === 'for') || (id === 'new') ||
9189                             (id === 'try') || (id === 'let');
9190                     case 4:
9191                         return (id === 'this') || (id === 'else') || (id === 'case') ||
9192                             (id === 'void') || (id === 'with') || (id === 'enum');
9193                     case 5:
9194                         return (id === 'while') || (id === 'break') || (id === 'catch') ||
9195                             (id === 'throw') || (id === 'const') || (id === 'yield') ||
9196                             (id === 'class') || (id === 'super');
9197                     case 6:
9198                         return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
9199                             (id === 'switch') || (id === 'export') || (id === 'import');
9200                     case 7:
9201                         return (id === 'default') || (id === 'finally') || (id === 'extends');
9202                     case 8:
9203                         return (id === 'function') || (id === 'continue') || (id === 'debugger');
9204                     case 10:
9205                         return (id === 'instanceof');
9206                     default:
9207                         return false;
9208                 }
9209             };
9210             Scanner.prototype.codePointAt = function (i) {
9211                 var cp = this.source.charCodeAt(i);
9212                 if (cp >= 0xD800 && cp <= 0xDBFF) {
9213                     var second = this.source.charCodeAt(i + 1);
9214                     if (second >= 0xDC00 && second <= 0xDFFF) {
9215                         var first = cp;
9216                         cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
9217                     }
9218                 }
9219                 return cp;
9220             };
9221             Scanner.prototype.scanHexEscape = function (prefix) {
9222                 var len = (prefix === 'u') ? 4 : 2;
9223                 var code = 0;
9224                 for (var i = 0; i < len; ++i) {
9225                     if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
9226                         code = code * 16 + hexValue(this.source[this.index++]);
9227                     }
9228                     else {
9229                         return null;
9230                     }
9231                 }
9232                 return String.fromCharCode(code);
9233             };
9234             Scanner.prototype.scanUnicodeCodePointEscape = function () {
9235                 var ch = this.source[this.index];
9236                 var code = 0;
9237                 // At least, one hex digit is required.
9238                 if (ch === '}') {
9239                     this.throwUnexpectedToken();
9240                 }
9241                 while (!this.eof()) {
9242                     ch = this.source[this.index++];
9243                     if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
9244                         break;
9245                     }
9246                     code = code * 16 + hexValue(ch);
9247                 }
9248                 if (code > 0x10FFFF || ch !== '}') {
9249                     this.throwUnexpectedToken();
9250                 }
9251                 return character_1.Character.fromCodePoint(code);
9252             };
9253             Scanner.prototype.getIdentifier = function () {
9254                 var start = this.index++;
9255                 while (!this.eof()) {
9256                     var ch = this.source.charCodeAt(this.index);
9257                     if (ch === 0x5C) {
9258                         // Blackslash (U+005C) marks Unicode escape sequence.
9259                         this.index = start;
9260                         return this.getComplexIdentifier();
9261                     }
9262                     else if (ch >= 0xD800 && ch < 0xDFFF) {
9263                         // Need to handle surrogate pairs.
9264                         this.index = start;
9265                         return this.getComplexIdentifier();
9266                     }
9267                     if (character_1.Character.isIdentifierPart(ch)) {
9268                         ++this.index;
9269                     }
9270                     else {
9271                         break;
9272                     }
9273                 }
9274                 return this.source.slice(start, this.index);
9275             };
9276             Scanner.prototype.getComplexIdentifier = function () {
9277                 var cp = this.codePointAt(this.index);
9278                 var id = character_1.Character.fromCodePoint(cp);
9279                 this.index += id.length;
9280                 // '\u' (U+005C, U+0075) denotes an escaped character.
9281                 var ch;
9282                 if (cp === 0x5C) {
9283                     if (this.source.charCodeAt(this.index) !== 0x75) {
9284                         this.throwUnexpectedToken();
9285                     }
9286                     ++this.index;
9287                     if (this.source[this.index] === '{') {
9288                         ++this.index;
9289                         ch = this.scanUnicodeCodePointEscape();
9290                     }
9291                     else {
9292                         ch = this.scanHexEscape('u');
9293                         if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) {
9294                             this.throwUnexpectedToken();
9295                         }
9296                     }
9297                     id = ch;
9298                 }
9299                 while (!this.eof()) {
9300                     cp = this.codePointAt(this.index);
9301                     if (!character_1.Character.isIdentifierPart(cp)) {
9302                         break;
9303                     }
9304                     ch = character_1.Character.fromCodePoint(cp);
9305                     id += ch;
9306                     this.index += ch.length;
9307                     // '\u' (U+005C, U+0075) denotes an escaped character.
9308                     if (cp === 0x5C) {
9309                         id = id.substr(0, id.length - 1);
9310                         if (this.source.charCodeAt(this.index) !== 0x75) {
9311                             this.throwUnexpectedToken();
9312                         }
9313                         ++this.index;
9314                         if (this.source[this.index] === '{') {
9315                             ++this.index;
9316                             ch = this.scanUnicodeCodePointEscape();
9317                         }
9318                         else {
9319                             ch = this.scanHexEscape('u');
9320                             if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
9321                                 this.throwUnexpectedToken();
9322                             }
9323                         }
9324                         id += ch;
9325                     }
9326                 }
9327                 return id;
9328             };
9329             Scanner.prototype.octalToDecimal = function (ch) {
9330                 // \0 is not octal escape sequence
9331                 var octal = (ch !== '0');
9332                 var code = octalValue(ch);
9333                 if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
9334                     octal = true;
9335                     code = code * 8 + octalValue(this.source[this.index++]);
9336                     // 3 digits are only allowed when string starts
9337                     // with 0, 1, 2, 3
9338                     if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
9339                         code = code * 8 + octalValue(this.source[this.index++]);
9340                     }
9341                 }
9342                 return {
9343                     code: code,
9344                     octal: octal
9345                 };
9346             };
9347             // https://tc39.github.io/ecma262/#sec-names-and-keywords
9348             Scanner.prototype.scanIdentifier = function () {
9349                 var type;
9350                 var start = this.index;
9351                 // Backslash (U+005C) starts an escaped character.
9352                 var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
9353                 // There is no keyword or literal with only one character.
9354                 // Thus, it must be an identifier.
9355                 if (id.length === 1) {
9356                     type = 3 /* Identifier */;
9357                 }
9358                 else if (this.isKeyword(id)) {
9359                     type = 4 /* Keyword */;
9360                 }
9361                 else if (id === 'null') {
9362                     type = 5 /* NullLiteral */;
9363                 }
9364                 else if (id === 'true' || id === 'false') {
9365                     type = 1 /* BooleanLiteral */;
9366                 }
9367                 else {
9368                     type = 3 /* Identifier */;
9369                 }
9370                 if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) {
9371                     var restore = this.index;
9372                     this.index = start;
9373                     this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord);
9374                     this.index = restore;
9375                 }
9376                 return {
9377                     type: type,
9378                     value: id,
9379                     lineNumber: this.lineNumber,
9380                     lineStart: this.lineStart,
9381                     start: start,
9382                     end: this.index
9383                 };
9384             };
9385             // https://tc39.github.io/ecma262/#sec-punctuators
9386             Scanner.prototype.scanPunctuator = function () {
9387                 var start = this.index;
9388                 // Check for most common single-character punctuators.
9389                 var str = this.source[this.index];
9390                 switch (str) {
9391                     case '(':
9392                     case '{':
9393                         if (str === '{') {
9394                             this.curlyStack.push('{');
9395                         }
9396                         ++this.index;
9397                         break;
9398                     case '.':
9399                         ++this.index;
9400                         if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
9401                             // Spread operator: ...
9402                             this.index += 2;
9403                             str = '...';
9404                         }
9405                         break;
9406                     case '}':
9407                         ++this.index;
9408                         this.curlyStack.pop();
9409                         break;
9410                     case ')':
9411                     case ';':
9412                     case ',':
9413                     case '[':
9414                     case ']':
9415                     case ':':
9416                     case '?':
9417                     case '~':
9418                         ++this.index;
9419                         break;
9420                     default:
9421                         // 4-character punctuator.
9422                         str = this.source.substr(this.index, 4);
9423                         if (str === '>>>=') {
9424                             this.index += 4;
9425                         }
9426                         else {
9427                             // 3-character punctuators.
9428                             str = str.substr(0, 3);
9429                             if (str === '===' || str === '!==' || str === '>>>' ||
9430                                 str === '<<=' || str === '>>=' || str === '**=') {
9431                                 this.index += 3;
9432                             }
9433                             else {
9434                                 // 2-character punctuators.
9435                                 str = str.substr(0, 2);
9436                                 if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
9437                                     str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
9438                                     str === '++' || str === '--' || str === '<<' || str === '>>' ||
9439                                     str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
9440                                     str === '<=' || str === '>=' || str === '=>' || str === '**') {
9441                                     this.index += 2;
9442                                 }
9443                                 else {
9444                                     // 1-character punctuators.
9445                                     str = this.source[this.index];
9446                                     if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
9447                                         ++this.index;
9448                                     }
9449                                 }
9450                             }
9451                         }
9452                 }
9453                 if (this.index === start) {
9454                     this.throwUnexpectedToken();
9455                 }
9456                 return {
9457                     type: 7 /* Punctuator */,
9458                     value: str,
9459                     lineNumber: this.lineNumber,
9460                     lineStart: this.lineStart,
9461                     start: start,
9462                     end: this.index
9463                 };
9464             };
9465             // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
9466             Scanner.prototype.scanHexLiteral = function (start) {
9467                 var num = '';
9468                 while (!this.eof()) {
9469                     if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
9470                         break;
9471                     }
9472                     num += this.source[this.index++];
9473                 }
9474                 if (num.length === 0) {
9475                     this.throwUnexpectedToken();
9476                 }
9477                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
9478                     this.throwUnexpectedToken();
9479                 }
9480                 return {
9481                     type: 6 /* NumericLiteral */,
9482                     value: parseInt('0x' + num, 16),
9483                     lineNumber: this.lineNumber,
9484                     lineStart: this.lineStart,
9485                     start: start,
9486                     end: this.index
9487                 };
9488             };
9489             Scanner.prototype.scanBinaryLiteral = function (start) {
9490                 var num = '';
9491                 var ch;
9492                 while (!this.eof()) {
9493                     ch = this.source[this.index];
9494                     if (ch !== '0' && ch !== '1') {
9495                         break;
9496                     }
9497                     num += this.source[this.index++];
9498                 }
9499                 if (num.length === 0) {
9500                     // only 0b or 0B
9501                     this.throwUnexpectedToken();
9502                 }
9503                 if (!this.eof()) {
9504                     ch = this.source.charCodeAt(this.index);
9505                     /* istanbul ignore else */
9506                     if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
9507                         this.throwUnexpectedToken();
9508                     }
9509                 }
9510                 return {
9511                     type: 6 /* NumericLiteral */,
9512                     value: parseInt(num, 2),
9513                     lineNumber: this.lineNumber,
9514                     lineStart: this.lineStart,
9515                     start: start,
9516                     end: this.index
9517                 };
9518             };
9519             Scanner.prototype.scanOctalLiteral = function (prefix, start) {
9520                 var num = '';
9521                 var octal = false;
9522                 if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
9523                     octal = true;
9524                     num = '0' + this.source[this.index++];
9525                 }
9526                 else {
9527                     ++this.index;
9528                 }
9529                 while (!this.eof()) {
9530                     if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
9531                         break;
9532                     }
9533                     num += this.source[this.index++];
9534                 }
9535                 if (!octal && num.length === 0) {
9536                     // only 0o or 0O
9537                     this.throwUnexpectedToken();
9538                 }
9539                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9540                     this.throwUnexpectedToken();
9541                 }
9542                 return {
9543                     type: 6 /* NumericLiteral */,
9544                     value: parseInt(num, 8),
9545                     octal: octal,
9546                     lineNumber: this.lineNumber,
9547                     lineStart: this.lineStart,
9548                     start: start,
9549                     end: this.index
9550                 };
9551             };
9552             Scanner.prototype.isImplicitOctalLiteral = function () {
9553                 // Implicit octal, unless there is a non-octal digit.
9554                 // (Annex B.1.1 on Numeric Literals)
9555                 for (var i = this.index + 1; i < this.length; ++i) {
9556                     var ch = this.source[i];
9557                     if (ch === '8' || ch === '9') {
9558                         return false;
9559                     }
9560                     if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
9561                         return true;
9562                     }
9563                 }
9564                 return true;
9565             };
9566             Scanner.prototype.scanNumericLiteral = function () {
9567                 var start = this.index;
9568                 var ch = this.source[start];
9569                 assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
9570                 var num = '';
9571                 if (ch !== '.') {
9572                     num = this.source[this.index++];
9573                     ch = this.source[this.index];
9574                     // Hex number starts with '0x'.
9575                     // Octal number starts with '0'.
9576                     // Octal number in ES6 starts with '0o'.
9577                     // Binary number in ES6 starts with '0b'.
9578                     if (num === '0') {
9579                         if (ch === 'x' || ch === 'X') {
9580                             ++this.index;
9581                             return this.scanHexLiteral(start);
9582                         }
9583                         if (ch === 'b' || ch === 'B') {
9584                             ++this.index;
9585                             return this.scanBinaryLiteral(start);
9586                         }
9587                         if (ch === 'o' || ch === 'O') {
9588                             return this.scanOctalLiteral(ch, start);
9589                         }
9590                         if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
9591                             if (this.isImplicitOctalLiteral()) {
9592                                 return this.scanOctalLiteral(ch, start);
9593                             }
9594                         }
9595                     }
9596                     while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9597                         num += this.source[this.index++];
9598                     }
9599                     ch = this.source[this.index];
9600                 }
9601                 if (ch === '.') {
9602                     num += this.source[this.index++];
9603                     while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9604                         num += this.source[this.index++];
9605                     }
9606                     ch = this.source[this.index];
9607                 }
9608                 if (ch === 'e' || ch === 'E') {
9609                     num += this.source[this.index++];
9610                     ch = this.source[this.index];
9611                     if (ch === '+' || ch === '-') {
9612                         num += this.source[this.index++];
9613                     }
9614                     if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9615                         while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9616                             num += this.source[this.index++];
9617                         }
9618                     }
9619                     else {
9620                         this.throwUnexpectedToken();
9621                     }
9622                 }
9623                 if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
9624                     this.throwUnexpectedToken();
9625                 }
9626                 return {
9627                     type: 6 /* NumericLiteral */,
9628                     value: parseFloat(num),
9629                     lineNumber: this.lineNumber,
9630                     lineStart: this.lineStart,
9631                     start: start,
9632                     end: this.index
9633                 };
9634             };
9635             // https://tc39.github.io/ecma262/#sec-literals-string-literals
9636             Scanner.prototype.scanStringLiteral = function () {
9637                 var start = this.index;
9638                 var quote = this.source[start];
9639                 assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
9640                 ++this.index;
9641                 var octal = false;
9642                 var str = '';
9643                 while (!this.eof()) {
9644                     var ch = this.source[this.index++];
9645                     if (ch === quote) {
9646                         quote = '';
9647                         break;
9648                     }
9649                     else if (ch === '\\') {
9650                         ch = this.source[this.index++];
9651                         if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9652                             switch (ch) {
9653                                 case 'u':
9654                                     if (this.source[this.index] === '{') {
9655                                         ++this.index;
9656                                         str += this.scanUnicodeCodePointEscape();
9657                                     }
9658                                     else {
9659                                         var unescaped_1 = this.scanHexEscape(ch);
9660                                         if (unescaped_1 === null) {
9661                                             this.throwUnexpectedToken();
9662                                         }
9663                                         str += unescaped_1;
9664                                     }
9665                                     break;
9666                                 case 'x':
9667                                     var unescaped = this.scanHexEscape(ch);
9668                                     if (unescaped === null) {
9669                                         this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
9670                                     }
9671                                     str += unescaped;
9672                                     break;
9673                                 case 'n':
9674                                     str += '\n';
9675                                     break;
9676                                 case 'r':
9677                                     str += '\r';
9678                                     break;
9679                                 case 't':
9680                                     str += '\t';
9681                                     break;
9682                                 case 'b':
9683                                     str += '\b';
9684                                     break;
9685                                 case 'f':
9686                                     str += '\f';
9687                                     break;
9688                                 case 'v':
9689                                     str += '\x0B';
9690                                     break;
9691                                 case '8':
9692                                 case '9':
9693                                     str += ch;
9694                                     this.tolerateUnexpectedToken();
9695                                     break;
9696                                 default:
9697                                     if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
9698                                         var octToDec = this.octalToDecimal(ch);
9699                                         octal = octToDec.octal || octal;
9700                                         str += String.fromCharCode(octToDec.code);
9701                                     }
9702                                     else {
9703                                         str += ch;
9704                                     }
9705                                     break;
9706                             }
9707                         }
9708                         else {
9709                             ++this.lineNumber;
9710                             if (ch === '\r' && this.source[this.index] === '\n') {
9711                                 ++this.index;
9712                             }
9713                             this.lineStart = this.index;
9714                         }
9715                     }
9716                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9717                         break;
9718                     }
9719                     else {
9720                         str += ch;
9721                     }
9722                 }
9723                 if (quote !== '') {
9724                     this.index = start;
9725                     this.throwUnexpectedToken();
9726                 }
9727                 return {
9728                     type: 8 /* StringLiteral */,
9729                     value: str,
9730                     octal: octal,
9731                     lineNumber: this.lineNumber,
9732                     lineStart: this.lineStart,
9733                     start: start,
9734                     end: this.index
9735                 };
9736             };
9737             // https://tc39.github.io/ecma262/#sec-template-literal-lexical-components
9738             Scanner.prototype.scanTemplate = function () {
9739                 var cooked = '';
9740                 var terminated = false;
9741                 var start = this.index;
9742                 var head = (this.source[start] === '`');
9743                 var tail = false;
9744                 var rawOffset = 2;
9745                 ++this.index;
9746                 while (!this.eof()) {
9747                     var ch = this.source[this.index++];
9748                     if (ch === '`') {
9749                         rawOffset = 1;
9750                         tail = true;
9751                         terminated = true;
9752                         break;
9753                     }
9754                     else if (ch === '$') {
9755                         if (this.source[this.index] === '{') {
9756                             this.curlyStack.push('${');
9757                             ++this.index;
9758                             terminated = true;
9759                             break;
9760                         }
9761                         cooked += ch;
9762                     }
9763                     else if (ch === '\\') {
9764                         ch = this.source[this.index++];
9765                         if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9766                             switch (ch) {
9767                                 case 'n':
9768                                     cooked += '\n';
9769                                     break;
9770                                 case 'r':
9771                                     cooked += '\r';
9772                                     break;
9773                                 case 't':
9774                                     cooked += '\t';
9775                                     break;
9776                                 case 'u':
9777                                     if (this.source[this.index] === '{') {
9778                                         ++this.index;
9779                                         cooked += this.scanUnicodeCodePointEscape();
9780                                     }
9781                                     else {
9782                                         var restore = this.index;
9783                                         var unescaped_2 = this.scanHexEscape(ch);
9784                                         if (unescaped_2 !== null) {
9785                                             cooked += unescaped_2;
9786                                         }
9787                                         else {
9788                                             this.index = restore;
9789                                             cooked += ch;
9790                                         }
9791                                     }
9792                                     break;
9793                                 case 'x':
9794                                     var unescaped = this.scanHexEscape(ch);
9795                                     if (unescaped === null) {
9796                                         this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
9797                                     }
9798                                     cooked += unescaped;
9799                                     break;
9800                                 case 'b':
9801                                     cooked += '\b';
9802                                     break;
9803                                 case 'f':
9804                                     cooked += '\f';
9805                                     break;
9806                                 case 'v':
9807                                     cooked += '\v';
9808                                     break;
9809                                 default:
9810                                     if (ch === '0') {
9811                                         if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
9812                                             // Illegal: \01 \02 and so on
9813                                             this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
9814                                         }
9815                                         cooked += '\0';
9816                                     }
9817                                     else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
9818                                         // Illegal: \1 \2
9819                                         this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
9820                                     }
9821                                     else {
9822                                         cooked += ch;
9823                                     }
9824                                     break;
9825                             }
9826                         }
9827                         else {
9828                             ++this.lineNumber;
9829                             if (ch === '\r' && this.source[this.index] === '\n') {
9830                                 ++this.index;
9831                             }
9832                             this.lineStart = this.index;
9833                         }
9834                     }
9835                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9836                         ++this.lineNumber;
9837                         if (ch === '\r' && this.source[this.index] === '\n') {
9838                             ++this.index;
9839                         }
9840                         this.lineStart = this.index;
9841                         cooked += '\n';
9842                     }
9843                     else {
9844                         cooked += ch;
9845                     }
9846                 }
9847                 if (!terminated) {
9848                     this.throwUnexpectedToken();
9849                 }
9850                 if (!head) {
9851                     this.curlyStack.pop();
9852                 }
9853                 return {
9854                     type: 10 /* Template */,
9855                     value: this.source.slice(start + 1, this.index - rawOffset),
9856                     cooked: cooked,
9857                     head: head,
9858                     tail: tail,
9859                     lineNumber: this.lineNumber,
9860                     lineStart: this.lineStart,
9861                     start: start,
9862                     end: this.index
9863                 };
9864             };
9865             // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
9866             Scanner.prototype.testRegExp = function (pattern, flags) {
9867                 // The BMP character to use as a replacement for astral symbols when
9868                 // translating an ES6 "u"-flagged pattern to an ES5-compatible
9869                 // approximation.
9870                 // Note: replacing with '\uFFFF' enables false positives in unlikely
9871                 // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
9872                 // pattern that would not be detected by this substitution.
9873                 var astralSubstitute = '\uFFFF';
9874                 var tmp = pattern;
9875                 var self = this;
9876                 if (flags.indexOf('u') >= 0) {
9877                     tmp = tmp
9878                         .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
9879                         var codePoint = parseInt($1 || $2, 16);
9880                         if (codePoint > 0x10FFFF) {
9881                             self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
9882                         }
9883                         if (codePoint <= 0xFFFF) {
9884                             return String.fromCharCode(codePoint);
9885                         }
9886                         return astralSubstitute;
9887                     })
9888                         .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
9889                 }
9890                 // First, detect invalid regular expressions.
9891                 try {
9892                     RegExp(tmp);
9893                 }
9894                 catch (e) {
9895                     this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
9896                 }
9897                 // Return a regular expression object for this pattern-flag pair, or
9898                 // `null` in case the current environment doesn't support the flags it
9899                 // uses.
9900                 try {
9901                     return new RegExp(pattern, flags);
9902                 }
9903                 catch (exception) {
9904                     /* istanbul ignore next */
9905                     return null;
9906                 }
9907             };
9908             Scanner.prototype.scanRegExpBody = function () {
9909                 var ch = this.source[this.index];
9910                 assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
9911                 var str = this.source[this.index++];
9912                 var classMarker = false;
9913                 var terminated = false;
9914                 while (!this.eof()) {
9915                     ch = this.source[this.index++];
9916                     str += ch;
9917                     if (ch === '\\') {
9918                         ch = this.source[this.index++];
9919                         // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
9920                         if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9921                             this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
9922                         }
9923                         str += ch;
9924                     }
9925                     else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
9926                         this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
9927                     }
9928                     else if (classMarker) {
9929                         if (ch === ']') {
9930                             classMarker = false;
9931                         }
9932                     }
9933                     else {
9934                         if (ch === '/') {
9935                             terminated = true;
9936                             break;
9937                         }
9938                         else if (ch === '[') {
9939                             classMarker = true;
9940                         }
9941                     }
9942                 }
9943                 if (!terminated) {
9944                     this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
9945                 }
9946                 // Exclude leading and trailing slash.
9947                 return str.substr(1, str.length - 2);
9948             };
9949             Scanner.prototype.scanRegExpFlags = function () {
9950                 var str = '';
9951                 var flags = '';
9952                 while (!this.eof()) {
9953                     var ch = this.source[this.index];
9954                     if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
9955                         break;
9956                     }
9957                     ++this.index;
9958                     if (ch === '\\' && !this.eof()) {
9959                         ch = this.source[this.index];
9960                         if (ch === 'u') {
9961                             ++this.index;
9962                             var restore = this.index;
9963                             var char = this.scanHexEscape('u');
9964                             if (char !== null) {
9965                                 flags += char;
9966                                 for (str += '\\u'; restore < this.index; ++restore) {
9967                                     str += this.source[restore];
9968                                 }
9969                             }
9970                             else {
9971                                 this.index = restore;
9972                                 flags += 'u';
9973                                 str += '\\u';
9974                             }
9975                             this.tolerateUnexpectedToken();
9976                         }
9977                         else {
9978                             str += '\\';
9979                             this.tolerateUnexpectedToken();
9980                         }
9981                     }
9982                     else {
9983                         flags += ch;
9984                         str += ch;
9985                     }
9986                 }
9987                 return flags;
9988             };
9989             Scanner.prototype.scanRegExp = function () {
9990                 var start = this.index;
9991                 var pattern = this.scanRegExpBody();
9992                 var flags = this.scanRegExpFlags();
9993                 var value = this.testRegExp(pattern, flags);
9994                 return {
9995                     type: 9 /* RegularExpression */,
9996                     value: '',
9997                     pattern: pattern,
9998                     flags: flags,
9999                     regex: value,
10000                     lineNumber: this.lineNumber,
10001                     lineStart: this.lineStart,
10002                     start: start,
10003                     end: this.index
10004                 };
10005             };
10006             Scanner.prototype.lex = function () {
10007                 if (this.eof()) {
10008                     return {
10009                         type: 2 /* EOF */,
10010                         value: '',
10011                         lineNumber: this.lineNumber,
10012                         lineStart: this.lineStart,
10013                         start: this.index,
10014                         end: this.index
10015                     };
10016                 }
10017                 var cp = this.source.charCodeAt(this.index);
10018                 if (character_1.Character.isIdentifierStart(cp)) {
10019                     return this.scanIdentifier();
10020                 }
10021                 // Very common: ( and ) and ;
10022                 if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
10023                     return this.scanPunctuator();
10024                 }
10025                 // String literal starts with single quote (U+0027) or double quote (U+0022).
10026                 if (cp === 0x27 || cp === 0x22) {
10027                     return this.scanStringLiteral();
10028                 }
10029                 // Dot (.) U+002E can also start a floating-point number, hence the need
10030                 // to check the next character.
10031                 if (cp === 0x2E) {
10032                     if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
10033                         return this.scanNumericLiteral();
10034                     }
10035                     return this.scanPunctuator();
10036                 }
10037                 if (character_1.Character.isDecimalDigit(cp)) {
10038                     return this.scanNumericLiteral();
10039                 }
10040                 // Template literals start with ` (U+0060) for template head
10041                 // or } (U+007D) for template middle or template tail.
10042                 if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
10043                     return this.scanTemplate();
10044                 }
10045                 // Possible identifier start in a surrogate pair.
10046                 if (cp >= 0xD800 && cp < 0xDFFF) {
10047                     if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
10048                         return this.scanIdentifier();
10049                     }
10050                 }
10051                 return this.scanPunctuator();
10052             };
10053             return Scanner;
10054         }());
10055         exports.Scanner = Scanner;
10056
10057
10058 /***/ },
10059 /* 13 */
10060 /***/ function(module, exports) {
10061
10062         "use strict";
10063         Object.defineProperty(exports, "__esModule", { value: true });
10064         exports.TokenName = {};
10065         exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
10066         exports.TokenName[2 /* EOF */] = '<end>';
10067         exports.TokenName[3 /* Identifier */] = 'Identifier';
10068         exports.TokenName[4 /* Keyword */] = 'Keyword';
10069         exports.TokenName[5 /* NullLiteral */] = 'Null';
10070         exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
10071         exports.TokenName[7 /* Punctuator */] = 'Punctuator';
10072         exports.TokenName[8 /* StringLiteral */] = 'String';
10073         exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
10074         exports.TokenName[10 /* Template */] = 'Template';
10075
10076
10077 /***/ },
10078 /* 14 */
10079 /***/ function(module, exports) {
10080
10081         "use strict";
10082         // Generated by generate-xhtml-entities.js. DO NOT MODIFY!
10083         Object.defineProperty(exports, "__esModule", { value: true });
10084         exports.XHTMLEntities = {
10085             quot: '\u0022',
10086             amp: '\u0026',
10087             apos: '\u0027',
10088             gt: '\u003E',
10089             nbsp: '\u00A0',
10090             iexcl: '\u00A1',
10091             cent: '\u00A2',
10092             pound: '\u00A3',
10093             curren: '\u00A4',
10094             yen: '\u00A5',
10095             brvbar: '\u00A6',
10096             sect: '\u00A7',
10097             uml: '\u00A8',
10098             copy: '\u00A9',
10099             ordf: '\u00AA',
10100             laquo: '\u00AB',
10101             not: '\u00AC',
10102             shy: '\u00AD',
10103             reg: '\u00AE',
10104             macr: '\u00AF',
10105             deg: '\u00B0',
10106             plusmn: '\u00B1',
10107             sup2: '\u00B2',
10108             sup3: '\u00B3',
10109             acute: '\u00B4',
10110             micro: '\u00B5',
10111             para: '\u00B6',
10112             middot: '\u00B7',
10113             cedil: '\u00B8',
10114             sup1: '\u00B9',
10115             ordm: '\u00BA',
10116             raquo: '\u00BB',
10117             frac14: '\u00BC',
10118             frac12: '\u00BD',
10119             frac34: '\u00BE',
10120             iquest: '\u00BF',
10121             Agrave: '\u00C0',
10122             Aacute: '\u00C1',
10123             Acirc: '\u00C2',
10124             Atilde: '\u00C3',
10125             Auml: '\u00C4',
10126             Aring: '\u00C5',
10127             AElig: '\u00C6',
10128             Ccedil: '\u00C7',
10129             Egrave: '\u00C8',
10130             Eacute: '\u00C9',
10131             Ecirc: '\u00CA',
10132             Euml: '\u00CB',
10133             Igrave: '\u00CC',
10134             Iacute: '\u00CD',
10135             Icirc: '\u00CE',
10136             Iuml: '\u00CF',
10137             ETH: '\u00D0',
10138             Ntilde: '\u00D1',
10139             Ograve: '\u00D2',
10140             Oacute: '\u00D3',
10141             Ocirc: '\u00D4',
10142             Otilde: '\u00D5',
10143             Ouml: '\u00D6',
10144             times: '\u00D7',
10145             Oslash: '\u00D8',
10146             Ugrave: '\u00D9',
10147             Uacute: '\u00DA',
10148             Ucirc: '\u00DB',
10149             Uuml: '\u00DC',
10150             Yacute: '\u00DD',
10151             THORN: '\u00DE',
10152             szlig: '\u00DF',
10153             agrave: '\u00E0',
10154             aacute: '\u00E1',
10155             acirc: '\u00E2',
10156             atilde: '\u00E3',
10157             auml: '\u00E4',
10158             aring: '\u00E5',
10159             aelig: '\u00E6',
10160             ccedil: '\u00E7',
10161             egrave: '\u00E8',
10162             eacute: '\u00E9',
10163             ecirc: '\u00EA',
10164             euml: '\u00EB',
10165             igrave: '\u00EC',
10166             iacute: '\u00ED',
10167             icirc: '\u00EE',
10168             iuml: '\u00EF',
10169             eth: '\u00F0',
10170             ntilde: '\u00F1',
10171             ograve: '\u00F2',
10172             oacute: '\u00F3',
10173             ocirc: '\u00F4',
10174             otilde: '\u00F5',
10175             ouml: '\u00F6',
10176             divide: '\u00F7',
10177             oslash: '\u00F8',
10178             ugrave: '\u00F9',
10179             uacute: '\u00FA',
10180             ucirc: '\u00FB',
10181             uuml: '\u00FC',
10182             yacute: '\u00FD',
10183             thorn: '\u00FE',
10184             yuml: '\u00FF',
10185             OElig: '\u0152',
10186             oelig: '\u0153',
10187             Scaron: '\u0160',
10188             scaron: '\u0161',
10189             Yuml: '\u0178',
10190             fnof: '\u0192',
10191             circ: '\u02C6',
10192             tilde: '\u02DC',
10193             Alpha: '\u0391',
10194             Beta: '\u0392',
10195             Gamma: '\u0393',
10196             Delta: '\u0394',
10197             Epsilon: '\u0395',
10198             Zeta: '\u0396',
10199             Eta: '\u0397',
10200             Theta: '\u0398',
10201             Iota: '\u0399',
10202             Kappa: '\u039A',
10203             Lambda: '\u039B',
10204             Mu: '\u039C',
10205             Nu: '\u039D',
10206             Xi: '\u039E',
10207             Omicron: '\u039F',
10208             Pi: '\u03A0',
10209             Rho: '\u03A1',
10210             Sigma: '\u03A3',
10211             Tau: '\u03A4',
10212             Upsilon: '\u03A5',
10213             Phi: '\u03A6',
10214             Chi: '\u03A7',
10215             Psi: '\u03A8',
10216             Omega: '\u03A9',
10217             alpha: '\u03B1',
10218             beta: '\u03B2',
10219             gamma: '\u03B3',
10220             delta: '\u03B4',
10221             epsilon: '\u03B5',
10222             zeta: '\u03B6',
10223             eta: '\u03B7',
10224             theta: '\u03B8',
10225             iota: '\u03B9',
10226             kappa: '\u03BA',
10227             lambda: '\u03BB',
10228             mu: '\u03BC',
10229             nu: '\u03BD',
10230             xi: '\u03BE',
10231             omicron: '\u03BF',
10232             pi: '\u03C0',
10233             rho: '\u03C1',
10234             sigmaf: '\u03C2',
10235             sigma: '\u03C3',
10236             tau: '\u03C4',
10237             upsilon: '\u03C5',
10238             phi: '\u03C6',
10239             chi: '\u03C7',
10240             psi: '\u03C8',
10241             omega: '\u03C9',
10242             thetasym: '\u03D1',
10243             upsih: '\u03D2',
10244             piv: '\u03D6',
10245             ensp: '\u2002',
10246             emsp: '\u2003',
10247             thinsp: '\u2009',
10248             zwnj: '\u200C',
10249             zwj: '\u200D',
10250             lrm: '\u200E',
10251             rlm: '\u200F',
10252             ndash: '\u2013',
10253             mdash: '\u2014',
10254             lsquo: '\u2018',
10255             rsquo: '\u2019',
10256             sbquo: '\u201A',
10257             ldquo: '\u201C',
10258             rdquo: '\u201D',
10259             bdquo: '\u201E',
10260             dagger: '\u2020',
10261             Dagger: '\u2021',
10262             bull: '\u2022',
10263             hellip: '\u2026',
10264             permil: '\u2030',
10265             prime: '\u2032',
10266             Prime: '\u2033',
10267             lsaquo: '\u2039',
10268             rsaquo: '\u203A',
10269             oline: '\u203E',
10270             frasl: '\u2044',
10271             euro: '\u20AC',
10272             image: '\u2111',
10273             weierp: '\u2118',
10274             real: '\u211C',
10275             trade: '\u2122',
10276             alefsym: '\u2135',
10277             larr: '\u2190',
10278             uarr: '\u2191',
10279             rarr: '\u2192',
10280             darr: '\u2193',
10281             harr: '\u2194',
10282             crarr: '\u21B5',
10283             lArr: '\u21D0',
10284             uArr: '\u21D1',
10285             rArr: '\u21D2',
10286             dArr: '\u21D3',
10287             hArr: '\u21D4',
10288             forall: '\u2200',
10289             part: '\u2202',
10290             exist: '\u2203',
10291             empty: '\u2205',
10292             nabla: '\u2207',
10293             isin: '\u2208',
10294             notin: '\u2209',
10295             ni: '\u220B',
10296             prod: '\u220F',
10297             sum: '\u2211',
10298             minus: '\u2212',
10299             lowast: '\u2217',
10300             radic: '\u221A',
10301             prop: '\u221D',
10302             infin: '\u221E',
10303             ang: '\u2220',
10304             and: '\u2227',
10305             or: '\u2228',
10306             cap: '\u2229',
10307             cup: '\u222A',
10308             int: '\u222B',
10309             there4: '\u2234',
10310             sim: '\u223C',
10311             cong: '\u2245',
10312             asymp: '\u2248',
10313             ne: '\u2260',
10314             equiv: '\u2261',
10315             le: '\u2264',
10316             ge: '\u2265',
10317             sub: '\u2282',
10318             sup: '\u2283',
10319             nsub: '\u2284',
10320             sube: '\u2286',
10321             supe: '\u2287',
10322             oplus: '\u2295',
10323             otimes: '\u2297',
10324             perp: '\u22A5',
10325             sdot: '\u22C5',
10326             lceil: '\u2308',
10327             rceil: '\u2309',
10328             lfloor: '\u230A',
10329             rfloor: '\u230B',
10330             loz: '\u25CA',
10331             spades: '\u2660',
10332             clubs: '\u2663',
10333             hearts: '\u2665',
10334             diams: '\u2666',
10335             lang: '\u27E8',
10336             rang: '\u27E9'
10337         };
10338
10339
10340 /***/ },
10341 /* 15 */
10342 /***/ function(module, exports, __webpack_require__) {
10343
10344         "use strict";
10345         Object.defineProperty(exports, "__esModule", { value: true });
10346         var error_handler_1 = __webpack_require__(10);
10347         var scanner_1 = __webpack_require__(12);
10348         var token_1 = __webpack_require__(13);
10349         var Reader = (function () {
10350             function Reader() {
10351                 this.values = [];
10352                 this.curly = this.paren = -1;
10353             }
10354             // A function following one of those tokens is an expression.
10355             Reader.prototype.beforeFunctionExpression = function (t) {
10356                 return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
10357                     'return', 'case', 'delete', 'throw', 'void',
10358                     // assignment operators
10359                     '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
10360                     '&=', '|=', '^=', ',',
10361                     // binary/unary operators
10362                     '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
10363                     '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
10364                     '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
10365             };
10366             // Determine if forward slash (/) is an operator or part of a regular expression
10367             // https://github.com/mozilla/sweet.js/wiki/design
10368             Reader.prototype.isRegexStart = function () {
10369                 var previous = this.values[this.values.length - 1];
10370                 var regex = (previous !== null);
10371                 switch (previous) {
10372                     case 'this':
10373                     case ']':
10374                         regex = false;
10375                         break;
10376                     case ')':
10377                         var keyword = this.values[this.paren - 1];
10378                         regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with');
10379                         break;
10380                     case '}':
10381                         // Dividing a function by anything makes little sense,
10382                         // but we have to check for that.
10383                         regex = false;
10384                         if (this.values[this.curly - 3] === 'function') {
10385                             // Anonymous function, e.g. function(){} /42
10386                             var check = this.values[this.curly - 4];
10387                             regex = check ? !this.beforeFunctionExpression(check) : false;
10388                         }
10389                         else if (this.values[this.curly - 4] === 'function') {
10390                             // Named function, e.g. function f(){} /42/
10391                             var check = this.values[this.curly - 5];
10392                             regex = check ? !this.beforeFunctionExpression(check) : true;
10393                         }
10394                         break;
10395                     default:
10396                         break;
10397                 }
10398                 return regex;
10399             };
10400             Reader.prototype.push = function (token) {
10401                 if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) {
10402                     if (token.value === '{') {
10403                         this.curly = this.values.length;
10404                     }
10405                     else if (token.value === '(') {
10406                         this.paren = this.values.length;
10407                     }
10408                     this.values.push(token.value);
10409                 }
10410                 else {
10411                     this.values.push(null);
10412                 }
10413             };
10414             return Reader;
10415         }());
10416         var Tokenizer = (function () {
10417             function Tokenizer(code, config) {
10418                 this.errorHandler = new error_handler_1.ErrorHandler();
10419                 this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
10420                 this.scanner = new scanner_1.Scanner(code, this.errorHandler);
10421                 this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
10422                 this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
10423                 this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
10424                 this.buffer = [];
10425                 this.reader = new Reader();
10426             }
10427             Tokenizer.prototype.errors = function () {
10428                 return this.errorHandler.errors;
10429             };
10430             Tokenizer.prototype.getNextToken = function () {
10431                 if (this.buffer.length === 0) {
10432                     var comments = this.scanner.scanComments();
10433                     if (this.scanner.trackComment) {
10434                         for (var i = 0; i < comments.length; ++i) {
10435                             var e = comments[i];
10436                             var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
10437                             var comment = {
10438                                 type: e.multiLine ? 'BlockComment' : 'LineComment',
10439                                 value: value
10440                             };
10441                             if (this.trackRange) {
10442                                 comment.range = e.range;
10443                             }
10444                             if (this.trackLoc) {
10445                                 comment.loc = e.loc;
10446                             }
10447                             this.buffer.push(comment);
10448                         }
10449                     }
10450                     if (!this.scanner.eof()) {
10451                         var loc = void 0;
10452                         if (this.trackLoc) {
10453                             loc = {
10454                                 start: {
10455                                     line: this.scanner.lineNumber,
10456                                     column: this.scanner.index - this.scanner.lineStart
10457                                 },
10458                                 end: {}
10459                             };
10460                         }
10461                         var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart();
10462                         var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex();
10463                         this.reader.push(token);
10464                         var entry = {
10465                             type: token_1.TokenName[token.type],
10466                             value: this.scanner.source.slice(token.start, token.end)
10467                         };
10468                         if (this.trackRange) {
10469                             entry.range = [token.start, token.end];
10470                         }
10471                         if (this.trackLoc) {
10472                             loc.end = {
10473                                 line: this.scanner.lineNumber,
10474                                 column: this.scanner.index - this.scanner.lineStart
10475                             };
10476                             entry.loc = loc;
10477                         }
10478                         if (token.type === 9 /* RegularExpression */) {
10479                             var pattern = token.pattern;
10480                             var flags = token.flags;
10481                             entry.regex = { pattern: pattern, flags: flags };
10482                         }
10483                         this.buffer.push(entry);
10484                     }
10485                 }
10486                 return this.buffer.shift();
10487             };
10488             return Tokenizer;
10489         }());
10490         exports.Tokenizer = Tokenizer;
10491
10492
10493 /***/ }
10494 /******/ ])
10495 });
10496 ;
10497
10498 /***/ }),
10499 /* 36 */
10500 /***/ (function(module, exports, __webpack_require__) {
10501
10502 "use strict";
10503
10504
10505 /*eslint-disable no-use-before-define*/
10506
10507 var common              = __webpack_require__(8);
10508 var YAMLException       = __webpack_require__(9);
10509 var DEFAULT_FULL_SCHEMA = __webpack_require__(31);
10510 var DEFAULT_SAFE_SCHEMA = __webpack_require__(11);
10511
10512 var _toString       = Object.prototype.toString;
10513 var _hasOwnProperty = Object.prototype.hasOwnProperty;
10514
10515 var CHAR_TAB                  = 0x09; /* Tab */
10516 var CHAR_LINE_FEED            = 0x0A; /* LF */
10517 var CHAR_CARRIAGE_RETURN      = 0x0D; /* CR */
10518 var CHAR_SPACE                = 0x20; /* Space */
10519 var CHAR_EXCLAMATION          = 0x21; /* ! */
10520 var CHAR_DOUBLE_QUOTE         = 0x22; /* " */
10521 var CHAR_SHARP                = 0x23; /* # */
10522 var CHAR_PERCENT              = 0x25; /* % */
10523 var CHAR_AMPERSAND            = 0x26; /* & */
10524 var CHAR_SINGLE_QUOTE         = 0x27; /* ' */
10525 var CHAR_ASTERISK             = 0x2A; /* * */
10526 var CHAR_COMMA                = 0x2C; /* , */
10527 var CHAR_MINUS                = 0x2D; /* - */
10528 var CHAR_COLON                = 0x3A; /* : */
10529 var CHAR_EQUALS               = 0x3D; /* = */
10530 var CHAR_GREATER_THAN         = 0x3E; /* > */
10531 var CHAR_QUESTION             = 0x3F; /* ? */
10532 var CHAR_COMMERCIAL_AT        = 0x40; /* @ */
10533 var CHAR_LEFT_SQUARE_BRACKET  = 0x5B; /* [ */
10534 var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
10535 var CHAR_GRAVE_ACCENT         = 0x60; /* ` */
10536 var CHAR_LEFT_CURLY_BRACKET   = 0x7B; /* { */
10537 var CHAR_VERTICAL_LINE        = 0x7C; /* | */
10538 var CHAR_RIGHT_CURLY_BRACKET  = 0x7D; /* } */
10539
10540 var ESCAPE_SEQUENCES = {};
10541
10542 ESCAPE_SEQUENCES[0x00]   = '\\0';
10543 ESCAPE_SEQUENCES[0x07]   = '\\a';
10544 ESCAPE_SEQUENCES[0x08]   = '\\b';
10545 ESCAPE_SEQUENCES[0x09]   = '\\t';
10546 ESCAPE_SEQUENCES[0x0A]   = '\\n';
10547 ESCAPE_SEQUENCES[0x0B]   = '\\v';
10548 ESCAPE_SEQUENCES[0x0C]   = '\\f';
10549 ESCAPE_SEQUENCES[0x0D]   = '\\r';
10550 ESCAPE_SEQUENCES[0x1B]   = '\\e';
10551 ESCAPE_SEQUENCES[0x22]   = '\\"';
10552 ESCAPE_SEQUENCES[0x5C]   = '\\\\';
10553 ESCAPE_SEQUENCES[0x85]   = '\\N';
10554 ESCAPE_SEQUENCES[0xA0]   = '\\_';
10555 ESCAPE_SEQUENCES[0x2028] = '\\L';
10556 ESCAPE_SEQUENCES[0x2029] = '\\P';
10557
10558 var DEPRECATED_BOOLEANS_SYNTAX = [
10559   'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
10560   'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
10561 ];
10562
10563 function compileStyleMap(schema, map) {
10564   var result, keys, index, length, tag, style, type;
10565
10566   if (map === null) return {};
10567
10568   result = {};
10569   keys = Object.keys(map);
10570
10571   for (index = 0, length = keys.length; index < length; index += 1) {
10572     tag = keys[index];
10573     style = String(map[tag]);
10574
10575     if (tag.slice(0, 2) === '!!') {
10576       tag = 'tag:yaml.org,2002:' + tag.slice(2);
10577     }
10578     type = schema.compiledTypeMap['fallback'][tag];
10579
10580     if (type && _hasOwnProperty.call(type.styleAliases, style)) {
10581       style = type.styleAliases[style];
10582     }
10583
10584     result[tag] = style;
10585   }
10586
10587   return result;
10588 }
10589
10590 function encodeHex(character) {
10591   var string, handle, length;
10592
10593   string = character.toString(16).toUpperCase();
10594
10595   if (character <= 0xFF) {
10596     handle = 'x';
10597     length = 2;
10598   } else if (character <= 0xFFFF) {
10599     handle = 'u';
10600     length = 4;
10601   } else if (character <= 0xFFFFFFFF) {
10602     handle = 'U';
10603     length = 8;
10604   } else {
10605     throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
10606   }
10607
10608   return '\\' + handle + common.repeat('0', length - string.length) + string;
10609 }
10610
10611 function State(options) {
10612   this.schema        = options['schema'] || DEFAULT_FULL_SCHEMA;
10613   this.indent        = Math.max(1, (options['indent'] || 2));
10614   this.noArrayIndent = options['noArrayIndent'] || false;
10615   this.skipInvalid   = options['skipInvalid'] || false;
10616   this.flowLevel     = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
10617   this.styleMap      = compileStyleMap(this.schema, options['styles'] || null);
10618   this.sortKeys      = options['sortKeys'] || false;
10619   this.lineWidth     = options['lineWidth'] || 80;
10620   this.noRefs        = options['noRefs'] || false;
10621   this.noCompatMode  = options['noCompatMode'] || false;
10622   this.condenseFlow  = options['condenseFlow'] || false;
10623
10624   this.implicitTypes = this.schema.compiledImplicit;
10625   this.explicitTypes = this.schema.compiledExplicit;
10626
10627   this.tag = null;
10628   this.result = '';
10629
10630   this.duplicates = [];
10631   this.usedDuplicates = null;
10632 }
10633
10634 // Indents every line in a string. Empty lines (\n only) are not indented.
10635 function indentString(string, spaces) {
10636   var ind = common.repeat(' ', spaces),
10637       position = 0,
10638       next = -1,
10639       result = '',
10640       line,
10641       length = string.length;
10642
10643   while (position < length) {
10644     next = string.indexOf('\n', position);
10645     if (next === -1) {
10646       line = string.slice(position);
10647       position = length;
10648     } else {
10649       line = string.slice(position, next + 1);
10650       position = next + 1;
10651     }
10652
10653     if (line.length && line !== '\n') result += ind;
10654
10655     result += line;
10656   }
10657
10658   return result;
10659 }
10660
10661 function generateNextLine(state, level) {
10662   return '\n' + common.repeat(' ', state.indent * level);
10663 }
10664
10665 function testImplicitResolving(state, str) {
10666   var index, length, type;
10667
10668   for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
10669     type = state.implicitTypes[index];
10670
10671     if (type.resolve(str)) {
10672       return true;
10673     }
10674   }
10675
10676   return false;
10677 }
10678
10679 // [33] s-white ::= s-space | s-tab
10680 function isWhitespace(c) {
10681   return c === CHAR_SPACE || c === CHAR_TAB;
10682 }
10683
10684 // Returns true if the character can be printed without escaping.
10685 // From YAML 1.2: "any allowed characters known to be non-printable
10686 // should also be escaped. [However,] This isn’t mandatory"
10687 // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
10688 function isPrintable(c) {
10689   return  (0x00020 <= c && c <= 0x00007E)
10690       || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
10691       || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
10692       ||  (0x10000 <= c && c <= 0x10FFFF);
10693 }
10694
10695 // [34] ns-char ::= nb-char - s-white
10696 // [27] nb-char ::= c-printable - b-char - c-byte-order-mark
10697 // [26] b-char  ::= b-line-feed | b-carriage-return
10698 // [24] b-line-feed       ::=     #xA    /* LF */
10699 // [25] b-carriage-return ::=     #xD    /* CR */
10700 // [3]  c-byte-order-mark ::=     #xFEFF
10701 function isNsChar(c) {
10702   return isPrintable(c) && !isWhitespace(c)
10703     // byte-order-mark
10704     && c !== 0xFEFF
10705     // b-char
10706     && c !== CHAR_CARRIAGE_RETURN
10707     && c !== CHAR_LINE_FEED;
10708 }
10709
10710 // Simplified test for values allowed after the first character in plain style.
10711 function isPlainSafe(c, prev) {
10712   // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
10713   // where nb-char ::= c-printable - b-char - c-byte-order-mark.
10714   return isPrintable(c) && c !== 0xFEFF
10715     // - c-flow-indicator
10716     && c !== CHAR_COMMA
10717     && c !== CHAR_LEFT_SQUARE_BRACKET
10718     && c !== CHAR_RIGHT_SQUARE_BRACKET
10719     && c !== CHAR_LEFT_CURLY_BRACKET
10720     && c !== CHAR_RIGHT_CURLY_BRACKET
10721     // - ":" - "#"
10722     // /* An ns-char preceding */ "#"
10723     && c !== CHAR_COLON
10724     && ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
10725 }
10726
10727 // Simplified test for values allowed as the first character in plain style.
10728 function isPlainSafeFirst(c) {
10729   // Uses a subset of ns-char - c-indicator
10730   // where ns-char = nb-char - s-white.
10731   return isPrintable(c) && c !== 0xFEFF
10732     && !isWhitespace(c) // - s-white
10733     // - (c-indicator ::=
10734     // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
10735     && c !== CHAR_MINUS
10736     && c !== CHAR_QUESTION
10737     && c !== CHAR_COLON
10738     && c !== CHAR_COMMA
10739     && c !== CHAR_LEFT_SQUARE_BRACKET
10740     && c !== CHAR_RIGHT_SQUARE_BRACKET
10741     && c !== CHAR_LEFT_CURLY_BRACKET
10742     && c !== CHAR_RIGHT_CURLY_BRACKET
10743     // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
10744     && c !== CHAR_SHARP
10745     && c !== CHAR_AMPERSAND
10746     && c !== CHAR_ASTERISK
10747     && c !== CHAR_EXCLAMATION
10748     && c !== CHAR_VERTICAL_LINE
10749     && c !== CHAR_EQUALS
10750     && c !== CHAR_GREATER_THAN
10751     && c !== CHAR_SINGLE_QUOTE
10752     && c !== CHAR_DOUBLE_QUOTE
10753     // | “%” | “@” | “`”)
10754     && c !== CHAR_PERCENT
10755     && c !== CHAR_COMMERCIAL_AT
10756     && c !== CHAR_GRAVE_ACCENT;
10757 }
10758
10759 // Determines whether block indentation indicator is required.
10760 function needIndentIndicator(string) {
10761   var leadingSpaceRe = /^\n* /;
10762   return leadingSpaceRe.test(string);
10763 }
10764
10765 var STYLE_PLAIN   = 1,
10766     STYLE_SINGLE  = 2,
10767     STYLE_LITERAL = 3,
10768     STYLE_FOLDED  = 4,
10769     STYLE_DOUBLE  = 5;
10770
10771 // Determines which scalar styles are possible and returns the preferred style.
10772 // lineWidth = -1 => no limit.
10773 // Pre-conditions: str.length > 0.
10774 // Post-conditions:
10775 //    STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
10776 //    STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
10777 //    STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
10778 function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
10779   var i;
10780   var char, prev_char;
10781   var hasLineBreak = false;
10782   var hasFoldableLine = false; // only checked if shouldTrackWidth
10783   var shouldTrackWidth = lineWidth !== -1;
10784   var previousLineBreak = -1; // count the first line correctly
10785   var plain = isPlainSafeFirst(string.charCodeAt(0))
10786           && !isWhitespace(string.charCodeAt(string.length - 1));
10787
10788   if (singleLineOnly) {
10789     // Case: no block styles.
10790     // Check for disallowed characters to rule out plain and single.
10791     for (i = 0; i < string.length; i++) {
10792       char = string.charCodeAt(i);
10793       if (!isPrintable(char)) {
10794         return STYLE_DOUBLE;
10795       }
10796       prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
10797       plain = plain && isPlainSafe(char, prev_char);
10798     }
10799   } else {
10800     // Case: block styles permitted.
10801     for (i = 0; i < string.length; i++) {
10802       char = string.charCodeAt(i);
10803       if (char === CHAR_LINE_FEED) {
10804         hasLineBreak = true;
10805         // Check if any line can be folded.
10806         if (shouldTrackWidth) {
10807           hasFoldableLine = hasFoldableLine ||
10808             // Foldable line = too long, and not more-indented.
10809             (i - previousLineBreak - 1 > lineWidth &&
10810              string[previousLineBreak + 1] !== ' ');
10811           previousLineBreak = i;
10812         }
10813       } else if (!isPrintable(char)) {
10814         return STYLE_DOUBLE;
10815       }
10816       prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
10817       plain = plain && isPlainSafe(char, prev_char);
10818     }
10819     // in case the end is missing a \n
10820     hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
10821       (i - previousLineBreak - 1 > lineWidth &&
10822        string[previousLineBreak + 1] !== ' '));
10823   }
10824   // Although every style can represent \n without escaping, prefer block styles
10825   // for multiline, since they're more readable and they don't add empty lines.
10826   // Also prefer folding a super-long line.
10827   if (!hasLineBreak && !hasFoldableLine) {
10828     // Strings interpretable as another type have to be quoted;
10829     // e.g. the string 'true' vs. the boolean true.
10830     return plain && !testAmbiguousType(string)
10831       ? STYLE_PLAIN : STYLE_SINGLE;
10832   }
10833   // Edge case: block indentation indicator can only have one digit.
10834   if (indentPerLevel > 9 && needIndentIndicator(string)) {
10835     return STYLE_DOUBLE;
10836   }
10837   // At this point we know block styles are valid.
10838   // Prefer literal style unless we want to fold.
10839   return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
10840 }
10841
10842 // Note: line breaking/folding is implemented for only the folded style.
10843 // NB. We drop the last trailing newline (if any) of a returned block scalar
10844 //  since the dumper adds its own newline. This always works:
10845 //    • No ending newline => unaffected; already using strip "-" chomping.
10846 //    • Ending newline    => removed then restored.
10847 //  Importantly, this keeps the "+" chomp indicator from gaining an extra line.
10848 function writeScalar(state, string, level, iskey) {
10849   state.dump = (function () {
10850     if (string.length === 0) {
10851       return "''";
10852     }
10853     if (!state.noCompatMode &&
10854         DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
10855       return "'" + string + "'";
10856     }
10857
10858     var indent = state.indent * Math.max(1, level); // no 0-indent scalars
10859     // As indentation gets deeper, let the width decrease monotonically
10860     // to the lower bound min(state.lineWidth, 40).
10861     // Note that this implies
10862     //  state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
10863     //  state.lineWidth > 40 + state.indent: width decreases until the lower bound.
10864     // This behaves better than a constant minimum width which disallows narrower options,
10865     // or an indent threshold which causes the width to suddenly increase.
10866     var lineWidth = state.lineWidth === -1
10867       ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
10868
10869     // Without knowing if keys are implicit/explicit, assume implicit for safety.
10870     var singleLineOnly = iskey
10871       // No block styles in flow mode.
10872       || (state.flowLevel > -1 && level >= state.flowLevel);
10873     function testAmbiguity(string) {
10874       return testImplicitResolving(state, string);
10875     }
10876
10877     switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
10878       case STYLE_PLAIN:
10879         return string;
10880       case STYLE_SINGLE:
10881         return "'" + string.replace(/'/g, "''") + "'";
10882       case STYLE_LITERAL:
10883         return '|' + blockHeader(string, state.indent)
10884           + dropEndingNewline(indentString(string, indent));
10885       case STYLE_FOLDED:
10886         return '>' + blockHeader(string, state.indent)
10887           + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
10888       case STYLE_DOUBLE:
10889         return '"' + escapeString(string, lineWidth) + '"';
10890       default:
10891         throw new YAMLException('impossible error: invalid scalar style');
10892     }
10893   }());
10894 }
10895
10896 // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
10897 function blockHeader(string, indentPerLevel) {
10898   var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
10899
10900   // note the special case: the string '\n' counts as a "trailing" empty line.
10901   var clip =          string[string.length - 1] === '\n';
10902   var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
10903   var chomp = keep ? '+' : (clip ? '' : '-');
10904
10905   return indentIndicator + chomp + '\n';
10906 }
10907
10908 // (See the note for writeScalar.)
10909 function dropEndingNewline(string) {
10910   return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
10911 }
10912
10913 // Note: a long line without a suitable break point will exceed the width limit.
10914 // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
10915 function foldString(string, width) {
10916   // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
10917   // unless they're before or after a more-indented line, or at the very
10918   // beginning or end, in which case $k$ maps to $k$.
10919   // Therefore, parse each chunk as newline(s) followed by a content line.
10920   var lineRe = /(\n+)([^\n]*)/g;
10921
10922   // first line (possibly an empty line)
10923   var result = (function () {
10924     var nextLF = string.indexOf('\n');
10925     nextLF = nextLF !== -1 ? nextLF : string.length;
10926     lineRe.lastIndex = nextLF;
10927     return foldLine(string.slice(0, nextLF), width);
10928   }());
10929   // If we haven't reached the first content line yet, don't add an extra \n.
10930   var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
10931   var moreIndented;
10932
10933   // rest of the lines
10934   var match;
10935   while ((match = lineRe.exec(string))) {
10936     var prefix = match[1], line = match[2];
10937     moreIndented = (line[0] === ' ');
10938     result += prefix
10939       + (!prevMoreIndented && !moreIndented && line !== ''
10940         ? '\n' : '')
10941       + foldLine(line, width);
10942     prevMoreIndented = moreIndented;
10943   }
10944
10945   return result;
10946 }
10947
10948 // Greedy line breaking.
10949 // Picks the longest line under the limit each time,
10950 // otherwise settles for the shortest line over the limit.
10951 // NB. More-indented lines *cannot* be folded, as that would add an extra \n.
10952 function foldLine(line, width) {
10953   if (line === '' || line[0] === ' ') return line;
10954
10955   // Since a more-indented line adds a \n, breaks can't be followed by a space.
10956   var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
10957   var match;
10958   // start is an inclusive index. end, curr, and next are exclusive.
10959   var start = 0, end, curr = 0, next = 0;
10960   var result = '';
10961
10962   // Invariants: 0 <= start <= length-1.
10963   //   0 <= curr <= next <= max(0, length-2). curr - start <= width.
10964   // Inside the loop:
10965   //   A match implies length >= 2, so curr and next are <= length-2.
10966   while ((match = breakRe.exec(line))) {
10967     next = match.index;
10968     // maintain invariant: curr - start <= width
10969     if (next - start > width) {
10970       end = (curr > start) ? curr : next; // derive end <= length-2
10971       result += '\n' + line.slice(start, end);
10972       // skip the space that was output as \n
10973       start = end + 1;                    // derive start <= length-1
10974     }
10975     curr = next;
10976   }
10977
10978   // By the invariants, start <= length-1, so there is something left over.
10979   // It is either the whole string or a part starting from non-whitespace.
10980   result += '\n';
10981   // Insert a break if the remainder is too long and there is a break available.
10982   if (line.length - start > width && curr > start) {
10983     result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
10984   } else {
10985     result += line.slice(start);
10986   }
10987
10988   return result.slice(1); // drop extra \n joiner
10989 }
10990
10991 // Escapes a double-quoted string.
10992 function escapeString(string) {
10993   var result = '';
10994   var char, nextChar;
10995   var escapeSeq;
10996
10997   for (var i = 0; i < string.length; i++) {
10998     char = string.charCodeAt(i);
10999     // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
11000     if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
11001       nextChar = string.charCodeAt(i + 1);
11002       if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
11003         // Combine the surrogate pair and store it escaped.
11004         result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
11005         // Advance index one extra since we already used that char here.
11006         i++; continue;
11007       }
11008     }
11009     escapeSeq = ESCAPE_SEQUENCES[char];
11010     result += !escapeSeq && isPrintable(char)
11011       ? string[i]
11012       : escapeSeq || encodeHex(char);
11013   }
11014
11015   return result;
11016 }
11017
11018 function writeFlowSequence(state, level, object) {
11019   var _result = '',
11020       _tag    = state.tag,
11021       index,
11022       length;
11023
11024   for (index = 0, length = object.length; index < length; index += 1) {
11025     // Write only valid elements.
11026     if (writeNode(state, level, object[index], false, false)) {
11027       if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
11028       _result += state.dump;
11029     }
11030   }
11031
11032   state.tag = _tag;
11033   state.dump = '[' + _result + ']';
11034 }
11035
11036 function writeBlockSequence(state, level, object, compact) {
11037   var _result = '',
11038       _tag    = state.tag,
11039       index,
11040       length;
11041
11042   for (index = 0, length = object.length; index < length; index += 1) {
11043     // Write only valid elements.
11044     if (writeNode(state, level + 1, object[index], true, true)) {
11045       if (!compact || index !== 0) {
11046         _result += generateNextLine(state, level);
11047       }
11048
11049       if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
11050         _result += '-';
11051       } else {
11052         _result += '- ';
11053       }
11054
11055       _result += state.dump;
11056     }
11057   }
11058
11059   state.tag = _tag;
11060   state.dump = _result || '[]'; // Empty sequence if no valid values.
11061 }
11062
11063 function writeFlowMapping(state, level, object) {
11064   var _result       = '',
11065       _tag          = state.tag,
11066       objectKeyList = Object.keys(object),
11067       index,
11068       length,
11069       objectKey,
11070       objectValue,
11071       pairBuffer;
11072
11073   for (index = 0, length = objectKeyList.length; index < length; index += 1) {
11074
11075     pairBuffer = '';
11076     if (index !== 0) pairBuffer += ', ';
11077
11078     if (state.condenseFlow) pairBuffer += '"';
11079
11080     objectKey = objectKeyList[index];
11081     objectValue = object[objectKey];
11082
11083     if (!writeNode(state, level, objectKey, false, false)) {
11084       continue; // Skip this pair because of invalid key;
11085     }
11086
11087     if (state.dump.length > 1024) pairBuffer += '? ';
11088
11089     pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
11090
11091     if (!writeNode(state, level, objectValue, false, false)) {
11092       continue; // Skip this pair because of invalid value.
11093     }
11094
11095     pairBuffer += state.dump;
11096
11097     // Both key and value are valid.
11098     _result += pairBuffer;
11099   }
11100
11101   state.tag = _tag;
11102   state.dump = '{' + _result + '}';
11103 }
11104
11105 function writeBlockMapping(state, level, object, compact) {
11106   var _result       = '',
11107       _tag          = state.tag,
11108       objectKeyList = Object.keys(object),
11109       index,
11110       length,
11111       objectKey,
11112       objectValue,
11113       explicitPair,
11114       pairBuffer;
11115
11116   // Allow sorting keys so that the output file is deterministic
11117   if (state.sortKeys === true) {
11118     // Default sorting
11119     objectKeyList.sort();
11120   } else if (typeof state.sortKeys === 'function') {
11121     // Custom sort function
11122     objectKeyList.sort(state.sortKeys);
11123   } else if (state.sortKeys) {
11124     // Something is wrong
11125     throw new YAMLException('sortKeys must be a boolean or a function');
11126   }
11127
11128   for (index = 0, length = objectKeyList.length; index < length; index += 1) {
11129     pairBuffer = '';
11130
11131     if (!compact || index !== 0) {
11132       pairBuffer += generateNextLine(state, level);
11133     }
11134
11135     objectKey = objectKeyList[index];
11136     objectValue = object[objectKey];
11137
11138     if (!writeNode(state, level + 1, objectKey, true, true, true)) {
11139       continue; // Skip this pair because of invalid key.
11140     }
11141
11142     explicitPair = (state.tag !== null && state.tag !== '?') ||
11143                    (state.dump && state.dump.length > 1024);
11144
11145     if (explicitPair) {
11146       if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
11147         pairBuffer += '?';
11148       } else {
11149         pairBuffer += '? ';
11150       }
11151     }
11152
11153     pairBuffer += state.dump;
11154
11155     if (explicitPair) {
11156       pairBuffer += generateNextLine(state, level);
11157     }
11158
11159     if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
11160       continue; // Skip this pair because of invalid value.
11161     }
11162
11163     if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
11164       pairBuffer += ':';
11165     } else {
11166       pairBuffer += ': ';
11167     }
11168
11169     pairBuffer += state.dump;
11170
11171     // Both key and value are valid.
11172     _result += pairBuffer;
11173   }
11174
11175   state.tag = _tag;
11176   state.dump = _result || '{}'; // Empty mapping if no valid pairs.
11177 }
11178
11179 function detectType(state, object, explicit) {
11180   var _result, typeList, index, length, type, style;
11181
11182   typeList = explicit ? state.explicitTypes : state.implicitTypes;
11183
11184   for (index = 0, length = typeList.length; index < length; index += 1) {
11185     type = typeList[index];
11186
11187     if ((type.instanceOf  || type.predicate) &&
11188         (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
11189         (!type.predicate  || type.predicate(object))) {
11190
11191       state.tag = explicit ? type.tag : '?';
11192
11193       if (type.represent) {
11194         style = state.styleMap[type.tag] || type.defaultStyle;
11195
11196         if (_toString.call(type.represent) === '[object Function]') {
11197           _result = type.represent(object, style);
11198         } else if (_hasOwnProperty.call(type.represent, style)) {
11199           _result = type.represent[style](object, style);
11200         } else {
11201           throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
11202         }
11203
11204         state.dump = _result;
11205       }
11206
11207       return true;
11208     }
11209   }
11210
11211   return false;
11212 }
11213
11214 // Serializes `object` and writes it to global `result`.
11215 // Returns true on success, or false on invalid object.
11216 //
11217 function writeNode(state, level, object, block, compact, iskey) {
11218   state.tag = null;
11219   state.dump = object;
11220
11221   if (!detectType(state, object, false)) {
11222     detectType(state, object, true);
11223   }
11224
11225   var type = _toString.call(state.dump);
11226
11227   if (block) {
11228     block = (state.flowLevel < 0 || state.flowLevel > level);
11229   }
11230
11231   var objectOrArray = type === '[object Object]' || type === '[object Array]',
11232       duplicateIndex,
11233       duplicate;
11234
11235   if (objectOrArray) {
11236     duplicateIndex = state.duplicates.indexOf(object);
11237     duplicate = duplicateIndex !== -1;
11238   }
11239
11240   if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
11241     compact = false;
11242   }
11243
11244   if (duplicate && state.usedDuplicates[duplicateIndex]) {
11245     state.dump = '*ref_' + duplicateIndex;
11246   } else {
11247     if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
11248       state.usedDuplicates[duplicateIndex] = true;
11249     }
11250     if (type === '[object Object]') {
11251       if (block && (Object.keys(state.dump).length !== 0)) {
11252         writeBlockMapping(state, level, state.dump, compact);
11253         if (duplicate) {
11254           state.dump = '&ref_' + duplicateIndex + state.dump;
11255         }
11256       } else {
11257         writeFlowMapping(state, level, state.dump);
11258         if (duplicate) {
11259           state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
11260         }
11261       }
11262     } else if (type === '[object Array]') {
11263       var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
11264       if (block && (state.dump.length !== 0)) {
11265         writeBlockSequence(state, arrayLevel, state.dump, compact);
11266         if (duplicate) {
11267           state.dump = '&ref_' + duplicateIndex + state.dump;
11268         }
11269       } else {
11270         writeFlowSequence(state, arrayLevel, state.dump);
11271         if (duplicate) {
11272           state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
11273         }
11274       }
11275     } else if (type === '[object String]') {
11276       if (state.tag !== '?') {
11277         writeScalar(state, state.dump, level, iskey);
11278       }
11279     } else {
11280       if (state.skipInvalid) return false;
11281       throw new YAMLException('unacceptable kind of an object to dump ' + type);
11282     }
11283
11284     if (state.tag !== null && state.tag !== '?') {
11285       state.dump = '!<' + state.tag + '> ' + state.dump;
11286     }
11287   }
11288
11289   return true;
11290 }
11291
11292 function getDuplicateReferences(object, state) {
11293   var objects = [],
11294       duplicatesIndexes = [],
11295       index,
11296       length;
11297
11298   inspectNode(object, objects, duplicatesIndexes);
11299
11300   for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
11301     state.duplicates.push(objects[duplicatesIndexes[index]]);
11302   }
11303   state.usedDuplicates = new Array(length);
11304 }
11305
11306 function inspectNode(object, objects, duplicatesIndexes) {
11307   var objectKeyList,
11308       index,
11309       length;
11310
11311   if (object !== null && typeof object === 'object') {
11312     index = objects.indexOf(object);
11313     if (index !== -1) {
11314       if (duplicatesIndexes.indexOf(index) === -1) {
11315         duplicatesIndexes.push(index);
11316       }
11317     } else {
11318       objects.push(object);
11319
11320       if (Array.isArray(object)) {
11321         for (index = 0, length = object.length; index < length; index += 1) {
11322           inspectNode(object[index], objects, duplicatesIndexes);
11323         }
11324       } else {
11325         objectKeyList = Object.keys(object);
11326
11327         for (index = 0, length = objectKeyList.length; index < length; index += 1) {
11328           inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
11329         }
11330       }
11331     }
11332   }
11333 }
11334
11335 function dump(input, options) {
11336   options = options || {};
11337
11338   var state = new State(options);
11339
11340   if (!state.noRefs) getDuplicateReferences(input, state);
11341
11342   if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
11343
11344   return '';
11345 }
11346
11347 function safeDump(input, options) {
11348   return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
11349 }
11350
11351 module.exports.dump     = dump;
11352 module.exports.safeDump = safeDump;
11353
11354
11355 /***/ }),
11356 /* 37 */
11357 /***/ (function(module, exports, __webpack_require__) {
11358
11359 "use strict";
11360 // @ts-check
11361
11362
11363
11364 const fs = __webpack_require__(4);
11365 const path = __webpack_require__(38);
11366 const { URL } = __webpack_require__(39);
11367 const markdownIt = __webpack_require__(40);
11368 const rules = __webpack_require__(107);
11369 const helpers = __webpack_require__(110);
11370 const cache = __webpack_require__(115);
11371
11372 const deprecatedRuleNames = [ "MD002", "MD006" ];
11373
11374
11375 /**
11376  * Validate the list of rules for structure and reuse.
11377  *
11378  * @param {Rule[]} ruleList List of rules.
11379  * @returns {string} Error message if validation fails.
11380  */
11381 function validateRuleList(ruleList) {
11382   let result = null;
11383   if (ruleList.length === rules.length) {
11384     // No need to validate if only using built-in rules
11385     return result;
11386   }
11387   const allIds = {};
11388   ruleList.forEach(function forRule(rule, index) {
11389     const customIndex = index - rules.length;
11390     // eslint-disable-next-line jsdoc/require-jsdoc
11391     function newError(property) {
11392       return new Error(
11393         "Property '" + property + "' of custom rule at index " +
11394         customIndex + " is incorrect.");
11395     }
11396     [ "names", "tags" ].forEach(function forProperty(property) {
11397       const value = rule[property];
11398       if (!result &&
11399         (!value || !Array.isArray(value) || (value.length === 0) ||
11400          !value.every(helpers.isString) || value.some(helpers.isEmptyString))) {
11401         result = newError(property);
11402       }
11403     });
11404     [
11405       [ "description", "string" ],
11406       [ "function", "function" ]
11407     ].forEach(function forProperty(propertyInfo) {
11408       const property = propertyInfo[0];
11409       const value = rule[property];
11410       if (!result && (!value || (typeof value !== propertyInfo[1]))) {
11411         result = newError(property);
11412       }
11413     });
11414     if (!result && rule.information) {
11415       if (Object.getPrototypeOf(rule.information) !== URL.prototype) {
11416         result = newError("information");
11417       }
11418     }
11419     if (!result) {
11420       rule.names.forEach(function forName(name) {
11421         const nameUpper = name.toUpperCase();
11422         if (!result && (allIds[nameUpper] !== undefined)) {
11423           result = new Error("Name '" + name + "' of custom rule at index " +
11424             customIndex + " is already used as a name or tag.");
11425         }
11426         allIds[nameUpper] = true;
11427       });
11428       rule.tags.forEach(function forTag(tag) {
11429         const tagUpper = tag.toUpperCase();
11430         if (!result && allIds[tagUpper]) {
11431           result = new Error("Tag '" + tag + "' of custom rule at index " +
11432             customIndex + " is already used as a name.");
11433         }
11434         allIds[tagUpper] = false;
11435       });
11436     }
11437   });
11438   return result;
11439 }
11440
11441 /**
11442  * Creates a LintResults instance with toString for pretty display.
11443  *
11444  * @param {Rule[]} ruleList List of rules.
11445  * @returns {LintResults} New LintResults instance.
11446  */
11447 function newResults(ruleList) {
11448   // eslint-disable-next-line jsdoc/require-jsdoc
11449   function Results() {}
11450   Results.prototype.toString = function toString(useAlias) {
11451     const that = this;
11452     let ruleNameToRule = null;
11453     const results = [];
11454     Object.keys(that).forEach(function forFile(file) {
11455       const fileResults = that[file];
11456       if (Array.isArray(fileResults)) {
11457         fileResults.forEach(function forResult(result) {
11458           const ruleMoniker = result.ruleNames ?
11459             result.ruleNames.join("/") :
11460             (result.ruleName + "/" + result.ruleAlias);
11461           results.push(
11462             file + ": " +
11463             result.lineNumber + ": " +
11464             ruleMoniker + " " +
11465             result.ruleDescription +
11466             (result.errorDetail ?
11467               " [" + result.errorDetail + "]" :
11468               "") +
11469             (result.errorContext ?
11470               " [Context: \"" + result.errorContext + "\"]" :
11471               ""));
11472         });
11473       } else {
11474         if (!ruleNameToRule) {
11475           ruleNameToRule = {};
11476           ruleList.forEach(function forRule(rule) {
11477             const ruleName = rule.names[0].toUpperCase();
11478             ruleNameToRule[ruleName] = rule;
11479           });
11480         }
11481         Object.keys(fileResults).forEach(function forRule(ruleName) {
11482           const rule = ruleNameToRule[ruleName.toUpperCase()];
11483           const ruleResults = fileResults[ruleName];
11484           ruleResults.forEach(function forLine(lineNumber) {
11485             const nameIndex = Math.min(useAlias ? 1 : 0, rule.names.length - 1);
11486             const result =
11487               file + ": " +
11488               lineNumber + ": " +
11489               rule.names[nameIndex] + " " +
11490               rule.description;
11491             results.push(result);
11492           });
11493         });
11494       }
11495     });
11496     return results.join("\n");
11497   };
11498   // @ts-ignore
11499   return new Results();
11500 }
11501
11502 /**
11503  * Remove front matter (if present at beginning of content).
11504  *
11505  * @param {string} content Markdown content.
11506  * @param {RegExp} frontMatter Regular expression to match front matter.
11507  * @returns {Object} Trimmed content and front matter lines.
11508  */
11509 function removeFrontMatter(content, frontMatter) {
11510   let frontMatterLines = [];
11511   if (frontMatter) {
11512     const frontMatterMatch = content.match(frontMatter);
11513     if (frontMatterMatch && !frontMatterMatch.index) {
11514       const contentMatched = frontMatterMatch[0];
11515       content = content.slice(contentMatched.length);
11516       frontMatterLines = contentMatched.split(helpers.newLineRe);
11517       if (frontMatterLines.length &&
11518           (frontMatterLines[frontMatterLines.length - 1] === "")) {
11519         frontMatterLines.length--;
11520       }
11521     }
11522   }
11523   return {
11524     "content": content,
11525     "frontMatterLines": frontMatterLines
11526   };
11527 }
11528
11529 /**
11530  * Annotate tokens with line/lineNumber.
11531  *
11532  * @param {MarkdownItToken[]} tokens Array of markdown-it tokens.
11533  * @param {string[]} lines Lines of Markdown content.
11534  * @returns {void}
11535  */
11536 function annotateTokens(tokens, lines) {
11537   let tbodyMap = null;
11538   tokens.forEach(function forToken(token) {
11539     // Handle missing maps for table body
11540     if (token.type === "tbody_open") {
11541       tbodyMap = token.map.slice();
11542     } else if ((token.type === "tr_close") && tbodyMap) {
11543       tbodyMap[0]++;
11544     } else if (token.type === "tbody_close") {
11545       tbodyMap = null;
11546     }
11547     if (tbodyMap && !token.map) {
11548       token.map = tbodyMap.slice();
11549     }
11550     // Update token metadata
11551     if (token.map) {
11552       token.line = lines[token.map[0]];
11553       token.lineNumber = token.map[0] + 1;
11554       // Trim bottom of token to exclude whitespace lines
11555       while (token.map[1] && !((lines[token.map[1] - 1] || "").trim())) {
11556         token.map[1]--;
11557       }
11558       // Annotate children with lineNumber
11559       let lineNumber = token.lineNumber;
11560       const codeSpanExtraLines = [];
11561       helpers.forEachInlineCodeSpan(
11562         token.content,
11563         function handleInlineCodeSpan(code) {
11564           codeSpanExtraLines.push(code.split(helpers.newLineRe).length - 1);
11565         }
11566       );
11567       (token.children || []).forEach(function forChild(child) {
11568         child.lineNumber = lineNumber;
11569         child.line = lines[lineNumber - 1];
11570         if ((child.type === "softbreak") || (child.type === "hardbreak")) {
11571           lineNumber++;
11572         } else if (child.type === "code_inline") {
11573           lineNumber += codeSpanExtraLines.shift();
11574         }
11575       });
11576     }
11577   });
11578 }
11579
11580 /**
11581  * Map rule names/tags to canonical rule name.
11582  *
11583  * @param {Rule[]} ruleList List of rules.
11584  * @returns {Object.<string, string[]>} Map of alias to rule name.
11585  */
11586 function mapAliasToRuleNames(ruleList) {
11587   const aliasToRuleNames = {};
11588   // const tagToRuleNames = {};
11589   ruleList.forEach(function forRule(rule) {
11590     const ruleName = rule.names[0].toUpperCase();
11591     // The following is useful for updating README.md:
11592     // console.log(
11593     //   "* **[" + ruleName + "](doc/Rules.md#" + ruleName.toLowerCase() +
11594     //    ")** *" + rule.names.slice(1).join("/") + "* - " + rule.description);
11595     rule.names.forEach(function forName(name) {
11596       const nameUpper = name.toUpperCase();
11597       aliasToRuleNames[nameUpper] = [ ruleName ];
11598     });
11599     rule.tags.forEach(function forTag(tag) {
11600       const tagUpper = tag.toUpperCase();
11601       const ruleNames = aliasToRuleNames[tagUpper] || [];
11602       ruleNames.push(ruleName);
11603       aliasToRuleNames[tagUpper] = ruleNames;
11604       // tagToRuleNames[tag] = ruleName;
11605     });
11606   });
11607   // The following is useful for updating README.md:
11608   // Object.keys(tagToRuleNames).sort().forEach(function forTag(tag) {
11609   //   console.log("* **" + tag + "** - " +
11610   //     aliasToRuleNames[tag.toUpperCase()].join(", "));
11611   // });
11612   // @ts-ignore
11613   return aliasToRuleNames;
11614 }
11615
11616 /**
11617  * Apply (and normalize) configuration object.
11618  *
11619  * @param {Rule[]} ruleList List of rules.
11620  * @param {Configuration} config Configuration object.
11621  * @param {Object.<string, string[]>} aliasToRuleNames Map of alias to rule
11622  * names.
11623  * @returns {Configuration} Effective configuration.
11624  */
11625 function getEffectiveConfig(ruleList, config, aliasToRuleNames) {
11626   const defaultKey = Object.keys(config).filter(
11627     (key) => key.toUpperCase() === "DEFAULT"
11628   );
11629   const ruleDefault = (defaultKey.length === 0) || !!config[defaultKey[0]];
11630   const effectiveConfig = {};
11631   ruleList.forEach((rule) => {
11632     const ruleName = rule.names[0].toUpperCase();
11633     effectiveConfig[ruleName] = ruleDefault;
11634   });
11635   deprecatedRuleNames.forEach((ruleName) => {
11636     effectiveConfig[ruleName] = false;
11637   });
11638   Object.keys(config).forEach((key) => {
11639     let value = config[key];
11640     if (value) {
11641       if (!(value instanceof Object)) {
11642         value = {};
11643       }
11644     } else {
11645       value = false;
11646     }
11647     const keyUpper = key.toUpperCase();
11648     (aliasToRuleNames[keyUpper] || []).forEach((ruleName) => {
11649       effectiveConfig[ruleName] = value;
11650     });
11651   });
11652   return effectiveConfig;
11653 }
11654
11655 /**
11656  * Create a mapping of enabled rules per line.
11657  *
11658  * @param {Rule[]} ruleList List of rules.
11659  * @param {string[]} lines List of content lines.
11660  * @param {string[]} frontMatterLines List of front matter lines.
11661  * @param {boolean} noInlineConfig Whether to allow inline configuration.
11662  * @param {Configuration} config Configuration object.
11663  * @param {Object.<string, string[]>} aliasToRuleNames Map of alias to rule
11664  * names.
11665  * @returns {Object} Effective configuration and enabled rules per line number.
11666  */
11667 function getEnabledRulesPerLineNumber(
11668   ruleList,
11669   lines,
11670   frontMatterLines,
11671   noInlineConfig,
11672   config,
11673   aliasToRuleNames) {
11674   // Shared variables
11675   let enabledRules = {};
11676   let capturedRules = {};
11677   const allRuleNames = [];
11678   const enabledRulesPerLineNumber = new Array(1 + frontMatterLines.length);
11679   // Helper functions
11680   // eslint-disable-next-line jsdoc/require-jsdoc
11681   function handleInlineConfig(perLine, forEachMatch, forEachLine) {
11682     const input = perLine ? lines : [ lines.join("\n") ];
11683     input.forEach((line) => {
11684       if (!noInlineConfig) {
11685         let match = null;
11686         while ((match = helpers.inlineCommentRe.exec(line))) {
11687           const action = (match[1] || match[3]).toUpperCase();
11688           const parameter = match[2] || match[4];
11689           forEachMatch(action, parameter);
11690         }
11691       }
11692       if (forEachLine) {
11693         forEachLine();
11694       }
11695     });
11696   }
11697   // eslint-disable-next-line jsdoc/require-jsdoc
11698   function configureFile(action, parameter) {
11699     if (action === "CONFIGURE-FILE") {
11700       try {
11701         const json = JSON.parse(parameter);
11702         config = {
11703           ...config,
11704           ...json
11705         };
11706       } catch (ex) {
11707         // Ignore parse errors for inline configuration
11708       }
11709     }
11710   }
11711   // eslint-disable-next-line jsdoc/require-jsdoc
11712   function applyEnableDisable(action, parameter) {
11713     const enabled = (action.startsWith("ENABLE"));
11714     const items = parameter ?
11715       parameter.trim().toUpperCase().split(/\s+/) :
11716       allRuleNames;
11717     items.forEach((nameUpper) => {
11718       (aliasToRuleNames[nameUpper] || []).forEach((ruleName) => {
11719         enabledRules[ruleName] = enabled;
11720       });
11721     });
11722   }
11723   // eslint-disable-next-line jsdoc/require-jsdoc
11724   function enableDisableFile(action, parameter) {
11725     if ((action === "ENABLE-FILE") || (action === "DISABLE-FILE")) {
11726       applyEnableDisable(action, parameter);
11727     }
11728   }
11729   // eslint-disable-next-line jsdoc/require-jsdoc
11730   function captureRestoreEnableDisable(action, parameter) {
11731     if (action === "CAPTURE") {
11732       capturedRules = { ...enabledRules };
11733     } else if (action === "RESTORE") {
11734       enabledRules = { ...capturedRules };
11735     } else if ((action === "ENABLE") || (action === "DISABLE")) {
11736       enabledRules = { ...enabledRules };
11737       applyEnableDisable(action, parameter);
11738     }
11739   }
11740   // eslint-disable-next-line jsdoc/require-jsdoc
11741   function updateLineState() {
11742     enabledRulesPerLineNumber.push(enabledRules);
11743   }
11744   // Handle inline comments
11745   handleInlineConfig(false, configureFile);
11746   const effectiveConfig = getEffectiveConfig(
11747     ruleList, config, aliasToRuleNames);
11748   ruleList.forEach((rule) => {
11749     const ruleName = rule.names[0].toUpperCase();
11750     allRuleNames.push(ruleName);
11751     enabledRules[ruleName] = !!effectiveConfig[ruleName];
11752   });
11753   capturedRules = enabledRules;
11754   handleInlineConfig(true, enableDisableFile);
11755   handleInlineConfig(true, captureRestoreEnableDisable, updateLineState);
11756   // Return results
11757   return {
11758     effectiveConfig,
11759     enabledRulesPerLineNumber
11760   };
11761 }
11762
11763 /**
11764  * Compare function for Array.prototype.sort for ascending order of errors.
11765  *
11766  * @param {LintError} a First error.
11767  * @param {LintError} b Second error.
11768  * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
11769  */
11770 function lineNumberComparison(a, b) {
11771   return a.lineNumber - b.lineNumber;
11772 }
11773
11774 /**
11775  * Filter function to include everything.
11776  *
11777  * @returns {boolean} True.
11778  */
11779 function filterAllValues() {
11780   return true;
11781 }
11782
11783 /**
11784  * Function to return unique values from a sorted errors array.
11785  *
11786  * @param {LintError} value Error instance.
11787  * @param {number} index Index in array.
11788  * @param {LintError[]} array Array of errors.
11789  * @returns {boolean} Filter value.
11790  */
11791 function uniqueFilterForSortedErrors(value, index, array) {
11792   return (index === 0) || (value.lineNumber > array[index - 1].lineNumber);
11793 }
11794
11795 /**
11796  * Lints a string containing Markdown content.
11797  *
11798  * @param {Rule[]} ruleList List of rules.
11799  * @param {string} name Identifier for the content.
11800  * @param {string} content Markdown content
11801  * @param {Object} md markdown-it instance.
11802  * @param {Configuration} config Configuration object.
11803  * @param {RegExp} frontMatter Regular expression for front matter.
11804  * @param {boolean} handleRuleFailures Whether to handle exceptions in rules.
11805  * @param {boolean} noInlineConfig Whether to allow inline configuration.
11806  * @param {number} resultVersion Version of the LintResults object to return.
11807  * @param {Function} callback Callback (err, result) function.
11808  * @returns {void}
11809  */
11810 function lintContent(
11811   ruleList,
11812   name,
11813   content,
11814   md,
11815   config,
11816   frontMatter,
11817   handleRuleFailures,
11818   noInlineConfig,
11819   resultVersion,
11820   callback) {
11821   // Remove UTF-8 byte order marker (if present)
11822   content = content.replace(/^\ufeff/, "");
11823   // Remove front matter
11824   const removeFrontMatterResult = removeFrontMatter(content, frontMatter);
11825   const frontMatterLines = removeFrontMatterResult.frontMatterLines;
11826   // Ignore the content of HTML comments
11827   content = helpers.clearHtmlCommentText(removeFrontMatterResult.content);
11828   // Parse content into tokens and lines
11829   const tokens = md.parse(content, {});
11830   const lines = content.split(helpers.newLineRe);
11831   annotateTokens(tokens, lines);
11832   const aliasToRuleNames = mapAliasToRuleNames(ruleList);
11833   const { effectiveConfig, enabledRulesPerLineNumber } =
11834     getEnabledRulesPerLineNumber(
11835       ruleList,
11836       lines,
11837       frontMatterLines,
11838       noInlineConfig,
11839       config,
11840       aliasToRuleNames
11841     );
11842   // Create parameters for rules
11843   const params = {
11844     name,
11845     tokens,
11846     lines,
11847     frontMatterLines
11848   };
11849   cache.lineMetadata(helpers.getLineMetadata(params));
11850   cache.flattenedLists(helpers.flattenLists(params));
11851   // Function to run for each rule
11852   const result = (resultVersion === 0) ? {} : [];
11853   // eslint-disable-next-line jsdoc/require-jsdoc
11854   function forRule(rule) {
11855     // Configure rule
11856     const ruleNameFriendly = rule.names[0];
11857     const ruleName = ruleNameFriendly.toUpperCase();
11858     params.config = effectiveConfig[ruleName];
11859     // eslint-disable-next-line jsdoc/require-jsdoc
11860     function throwError(property) {
11861       throw new Error(
11862         "Property '" + property + "' of onError parameter is incorrect.");
11863     }
11864     const errors = [];
11865     // eslint-disable-next-line jsdoc/require-jsdoc
11866     function onError(errorInfo) {
11867       if (!errorInfo ||
11868         !helpers.isNumber(errorInfo.lineNumber) ||
11869         (errorInfo.lineNumber < 1) ||
11870         (errorInfo.lineNumber > lines.length)) {
11871         throwError("lineNumber");
11872       }
11873       if (errorInfo.detail &&
11874         !helpers.isString(errorInfo.detail)) {
11875         throwError("detail");
11876       }
11877       if (errorInfo.context &&
11878         !helpers.isString(errorInfo.context)) {
11879         throwError("context");
11880       }
11881       if (errorInfo.range &&
11882         (!Array.isArray(errorInfo.range) ||
11883          (errorInfo.range.length !== 2) ||
11884          !helpers.isNumber(errorInfo.range[0]) ||
11885          (errorInfo.range[0] < 1) ||
11886          !helpers.isNumber(errorInfo.range[1]) ||
11887          (errorInfo.range[1] < 1) ||
11888          ((errorInfo.range[0] + errorInfo.range[1] - 1) >
11889           lines[errorInfo.lineNumber - 1].length))) {
11890         throwError("range");
11891       }
11892       const fixInfo = errorInfo.fixInfo;
11893       const cleanFixInfo = {};
11894       if (fixInfo) {
11895         if (!helpers.isObject(fixInfo)) {
11896           throwError("fixInfo");
11897         }
11898         if (fixInfo.lineNumber !== undefined) {
11899           if ((!helpers.isNumber(fixInfo.lineNumber) ||
11900             (fixInfo.lineNumber < 1) ||
11901             (fixInfo.lineNumber > lines.length))) {
11902             throwError("fixInfo.lineNumber");
11903           }
11904           cleanFixInfo.lineNumber =
11905             fixInfo.lineNumber + frontMatterLines.length;
11906         }
11907         const effectiveLineNumber = fixInfo.lineNumber || errorInfo.lineNumber;
11908         if (fixInfo.editColumn !== undefined) {
11909           if ((!helpers.isNumber(fixInfo.editColumn) ||
11910             (fixInfo.editColumn < 1) ||
11911             (fixInfo.editColumn >
11912               lines[effectiveLineNumber - 1].length + 1))) {
11913             throwError("fixInfo.editColumn");
11914           }
11915           cleanFixInfo.editColumn = fixInfo.editColumn;
11916         }
11917         if (fixInfo.deleteCount !== undefined) {
11918           if ((!helpers.isNumber(fixInfo.deleteCount) ||
11919             (fixInfo.deleteCount < -1) ||
11920             (fixInfo.deleteCount >
11921               lines[effectiveLineNumber - 1].length))) {
11922             throwError("fixInfo.deleteCount");
11923           }
11924           cleanFixInfo.deleteCount = fixInfo.deleteCount;
11925         }
11926         if (fixInfo.insertText !== undefined) {
11927           if (!helpers.isString(fixInfo.insertText)) {
11928             throwError("fixInfo.insertText");
11929           }
11930           cleanFixInfo.insertText = fixInfo.insertText;
11931         }
11932       }
11933       errors.push({
11934         "lineNumber": errorInfo.lineNumber + frontMatterLines.length,
11935         "detail": errorInfo.detail || null,
11936         "context": errorInfo.context || null,
11937         "range": errorInfo.range ? [ ...errorInfo.range ] : null,
11938         "fixInfo": fixInfo ? cleanFixInfo : null
11939       });
11940     }
11941     // Call (possibly external) rule function
11942     if (handleRuleFailures) {
11943       try {
11944         rule.function(params, onError);
11945       } catch (ex) {
11946         onError({
11947           "lineNumber": 1,
11948           "detail": `This rule threw an exception: ${ex.message}`
11949         });
11950       }
11951     } else {
11952       rule.function(params, onError);
11953     }
11954     // Record any errors (significant performance benefit from length check)
11955     if (errors.length) {
11956       errors.sort(lineNumberComparison);
11957       const filteredErrors = errors
11958         .filter((resultVersion === 3) ?
11959           filterAllValues :
11960           uniqueFilterForSortedErrors)
11961         .filter(function removeDisabledRules(error) {
11962           return enabledRulesPerLineNumber[error.lineNumber][ruleName];
11963         })
11964         .map(function formatResults(error) {
11965           if (resultVersion === 0) {
11966             return error.lineNumber;
11967           }
11968           const errorObject = {};
11969           errorObject.lineNumber = error.lineNumber;
11970           if (resultVersion === 1) {
11971             errorObject.ruleName = ruleNameFriendly;
11972             errorObject.ruleAlias = rule.names[1] || rule.names[0];
11973           } else {
11974             errorObject.ruleNames = rule.names;
11975           }
11976           errorObject.ruleDescription = rule.description;
11977           errorObject.ruleInformation =
11978             rule.information ? rule.information.href : null;
11979           errorObject.errorDetail = error.detail;
11980           errorObject.errorContext = error.context;
11981           errorObject.errorRange = error.range;
11982           if (resultVersion === 3) {
11983             errorObject.fixInfo = error.fixInfo;
11984           }
11985           return errorObject;
11986         });
11987       if (filteredErrors.length) {
11988         if (resultVersion === 0) {
11989           result[ruleNameFriendly] = filteredErrors;
11990         } else {
11991           Array.prototype.push.apply(result, filteredErrors);
11992         }
11993       }
11994     }
11995   }
11996   // Run all rules
11997   try {
11998     ruleList.forEach(forRule);
11999   } catch (ex) {
12000     cache.clear();
12001     return callback(ex);
12002   }
12003   cache.clear();
12004   return callback(null, result);
12005 }
12006
12007 /**
12008  * Lints a file containing Markdown content.
12009  *
12010  * @param {Rule[]} ruleList List of rules.
12011  * @param {string} file Path of file to lint.
12012  * @param {Object} md markdown-it instance.
12013  * @param {Configuration} config Configuration object.
12014  * @param {RegExp} frontMatter Regular expression for front matter.
12015  * @param {boolean} handleRuleFailures Whether to handle exceptions in rules.
12016  * @param {boolean} noInlineConfig Whether to allow inline configuration.
12017  * @param {number} resultVersion Version of the LintResults object to return.
12018  * @param {boolean} synchronous Whether to execute synchronously.
12019  * @param {Function} callback Callback (err, result) function.
12020  * @returns {void}
12021  */
12022 function lintFile(
12023   ruleList,
12024   file,
12025   md,
12026   config,
12027   frontMatter,
12028   handleRuleFailures,
12029   noInlineConfig,
12030   resultVersion,
12031   synchronous,
12032   callback) {
12033   // eslint-disable-next-line jsdoc/require-jsdoc
12034   function lintContentWrapper(err, content) {
12035     if (err) {
12036       return callback(err);
12037     }
12038     return lintContent(ruleList, file, content, md, config, frontMatter,
12039       handleRuleFailures, noInlineConfig, resultVersion, callback);
12040   }
12041   // Make a/synchronous call to read file
12042   if (synchronous) {
12043     lintContentWrapper(null, fs.readFileSync(file, helpers.utf8Encoding));
12044   } else {
12045     fs.readFile(file, helpers.utf8Encoding, lintContentWrapper);
12046   }
12047 }
12048
12049 /**
12050  * Lint files and strings specified in the Options object.
12051  *
12052  * @param {Options} options Options object.
12053  * @param {boolean} synchronous Whether to execute synchronously.
12054  * @param {Function} callback Callback (err, result) function.
12055  * @returns {void}
12056  */
12057 function lintInput(options, synchronous, callback) {
12058   // Normalize inputs
12059   options = options || {};
12060   callback = callback || function noop() {};
12061   const ruleList = rules.concat(options.customRules || []);
12062   const ruleErr = validateRuleList(ruleList);
12063   if (ruleErr) {
12064     return callback(ruleErr);
12065   }
12066   let files = [];
12067   if (Array.isArray(options.files)) {
12068     files = options.files.slice();
12069   } else if (options.files) {
12070     files = [ String(options.files) ];
12071   }
12072   const strings = options.strings || {};
12073   const stringsKeys = Object.keys(strings);
12074   const config = options.config || { "default": true };
12075   const frontMatter = (options.frontMatter === undefined) ?
12076     helpers.frontMatterRe : options.frontMatter;
12077   const handleRuleFailures = !!options.handleRuleFailures;
12078   const noInlineConfig = !!options.noInlineConfig;
12079   const resultVersion = (options.resultVersion === undefined) ?
12080     2 : options.resultVersion;
12081   const md = markdownIt({ "html": true });
12082   const markdownItPlugins = options.markdownItPlugins || [];
12083   markdownItPlugins.forEach(function forPlugin(plugin) {
12084     // @ts-ignore
12085     md.use(...plugin);
12086   });
12087   const results = newResults(ruleList);
12088   // Helper to lint the next string or file
12089   /* eslint-disable consistent-return */
12090   // eslint-disable-next-line jsdoc/require-jsdoc
12091   function lintNextItem() {
12092     let iterating = true;
12093     let item = null;
12094     // eslint-disable-next-line jsdoc/require-jsdoc
12095     function lintNextItemCallback(err, result) {
12096       if (err) {
12097         iterating = false;
12098         return callback(err);
12099       }
12100       results[item] = result;
12101       return iterating || lintNextItem();
12102     }
12103     while (iterating) {
12104       if ((item = stringsKeys.shift())) {
12105         lintContent(
12106           ruleList,
12107           item,
12108           strings[item] || "",
12109           md,
12110           config,
12111           frontMatter,
12112           handleRuleFailures,
12113           noInlineConfig,
12114           resultVersion,
12115           lintNextItemCallback);
12116       } else if ((item = files.shift())) {
12117         iterating = synchronous;
12118         lintFile(
12119           ruleList,
12120           item,
12121           md,
12122           config,
12123           frontMatter,
12124           handleRuleFailures,
12125           noInlineConfig,
12126           resultVersion,
12127           synchronous,
12128           lintNextItemCallback);
12129       } else {
12130         return callback(null, results);
12131       }
12132     }
12133   }
12134   return lintNextItem();
12135 }
12136
12137 /**
12138  * Lint specified Markdown files.
12139  *
12140  * @param {Options} options Configuration options.
12141  * @param {LintCallback} callback Callback (err, result) function.
12142  * @returns {void}
12143  */
12144 function markdownlint(options, callback) {
12145   return lintInput(options, false, callback);
12146 }
12147
12148 /**
12149  * Lint specified Markdown files synchronously.
12150  *
12151  * @param {Options} options Configuration options.
12152  * @returns {LintResults} Results object.
12153  */
12154 function markdownlintSync(options) {
12155   let results = null;
12156   lintInput(options, true, function callback(error, res) {
12157     if (error) {
12158       throw error;
12159     }
12160     results = res;
12161   });
12162   return results;
12163 }
12164
12165 /**
12166  * Parse the content of a configuration file.
12167  *
12168  * @param {string} name Name of the configuration file.
12169  * @param {string} content Configuration content.
12170  * @param {ConfigurationParser[]} parsers Parsing function(s).
12171  * @returns {Object} Configuration object and error message.
12172  */
12173 function parseConfiguration(name, content, parsers) {
12174   let config = null;
12175   let message = "";
12176   const errors = [];
12177   // Try each parser
12178   (parsers || [ JSON.parse ]).every((parser) => {
12179     try {
12180       config = parser(content);
12181     } catch (ex) {
12182       errors.push(ex.message);
12183     }
12184     return !config;
12185   });
12186   // Message if unable to parse
12187   if (!config) {
12188     errors.unshift(`Unable to parse '${name}'`);
12189     message = errors.join("; ");
12190   }
12191   return {
12192     config,
12193     message
12194   };
12195 }
12196
12197 /**
12198  * Read specified configuration file.
12199  *
12200  * @param {string} file Configuration file name.
12201  * @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
12202  * function(s).
12203  * @param {ReadConfigCallback} [callback] Callback (err, result) function.
12204  * @returns {void}
12205  */
12206 function readConfig(file, parsers, callback) {
12207   if (!callback) {
12208     // @ts-ignore
12209     callback = parsers;
12210     parsers = null;
12211   }
12212   // Read file
12213   fs.readFile(file, helpers.utf8Encoding, (err, content) => {
12214     if (err) {
12215       return callback(err);
12216     }
12217     // Try to parse file
12218     // @ts-ignore
12219     const { config, message } = parseConfiguration(file, content, parsers);
12220     if (!config) {
12221       return callback(new Error(message));
12222     }
12223     // Extend configuration
12224     const configExtends = config.extends;
12225     if (configExtends) {
12226       delete config.extends;
12227       const extendsFile = path.resolve(path.dirname(file), configExtends);
12228       return readConfig(extendsFile, parsers, (errr, extendsConfig) => {
12229         if (errr) {
12230           return callback(errr);
12231         }
12232         return callback(null, {
12233           ...extendsConfig,
12234           ...config
12235         });
12236       });
12237     }
12238     return callback(null, config);
12239   });
12240 }
12241
12242 /**
12243  * Read specified configuration file synchronously.
12244  *
12245  * @param {string} file Configuration file name.
12246  * @param {ConfigurationParser[]} [parsers] Parsing function(s).
12247  * @returns {Configuration} Configuration object.
12248  */
12249 function readConfigSync(file, parsers) {
12250   // Read file
12251   const content = fs.readFileSync(file, helpers.utf8Encoding);
12252   // Try to parse file
12253   const { config, message } = parseConfiguration(file, content, parsers);
12254   if (!config) {
12255     throw new Error(message);
12256   }
12257   // Extend configuration
12258   const configExtends = config.extends;
12259   if (configExtends) {
12260     delete config.extends;
12261     return {
12262       ...readConfigSync(
12263         path.resolve(path.dirname(file), configExtends),
12264         parsers
12265       ),
12266       ...config
12267     };
12268   }
12269   return config;
12270 }
12271
12272 // Export a/synchronous APIs
12273 markdownlint.sync = markdownlintSync;
12274 markdownlint.readConfig = readConfig;
12275 markdownlint.readConfigSync = readConfigSync;
12276 module.exports = markdownlint;
12277
12278 // Type declarations
12279
12280 /**
12281  * Function to implement rule logic.
12282  *
12283  * @callback RuleFunction
12284  * @param {RuleParams} params Rule parameters.
12285  * @param {RuleOnError} onError Error-reporting callback.
12286  * @returns {void}
12287  */
12288
12289 /**
12290  * Rule parameters.
12291  *
12292  * @typedef {Object} RuleParams
12293  * @property {string} name File/string name.
12294  * @property {MarkdownItToken[]} tokens markdown-it token objects.
12295  * @property {string[]} lines File/string lines.
12296  * @property {string[]} frontMatterLines Front matter lines.
12297  * @property {RuleConfiguration} config Rule configuration.
12298  */
12299
12300 /**
12301  * Markdown-It token.
12302  *
12303  * @typedef {Object} MarkdownItToken
12304  * @property {string[][]} attrs HTML attributes.
12305  * @property {boolean} block Block-level token.
12306  * @property {MarkdownItToken[]} children Child nodes.
12307  * @property {string} content Tag contents.
12308  * @property {boolean} hidden Ignore element.
12309  * @property {string} info Fence info.
12310  * @property {number} level Nesting level.
12311  * @property {number[]} map Beginning/ending line numbers.
12312  * @property {string} markup Markup text.
12313  * @property {Object} meta Arbitrary data.
12314  * @property {number} nesting Level change.
12315  * @property {string} tag HTML tag name.
12316  * @property {string} type Token type.
12317  * @property {number} lineNumber Line number (1-based).
12318  * @property {string} line Line content.
12319  */
12320
12321 /**
12322  * Error-reporting callback.
12323  *
12324  * @callback RuleOnError
12325  * @param {RuleOnErrorInfo} onErrorInfo Error information.
12326  * @returns {void}
12327  */
12328
12329 /**
12330  * Fix information for RuleOnError callback.
12331  *
12332  * @typedef {Object} RuleOnErrorInfo
12333  * @property {number} lineNumber Line number (1-based).
12334  * @property {string} [details] Details about the error.
12335  * @property {string} [context] Context for the error.
12336  * @property {number[]} [range] Column number (1-based) and length.
12337  * @property {RuleOnErrorFixInfo} [fixInfo] Fix information.
12338  */
12339
12340 /**
12341  * Fix information for RuleOnErrorInfo.
12342  *
12343  * @typedef {Object} RuleOnErrorFixInfo
12344  * @property {number} [lineNumber] Line number (1-based).
12345  * @property {number} [editColumn] Column of the fix (1-based).
12346  * @property {number} [deleteCount] Count of characters to delete.
12347  * @property {string} [insertText] Text to insert (after deleting).
12348  */
12349
12350 /**
12351  * Rule definition.
12352  *
12353  * @typedef {Object} Rule
12354  * @property {string[]} names Rule name(s).
12355  * @property {string} description Rule description.
12356  * @property {URL} [information] Link to more information.
12357  * @property {string[]} tags Rule tag(s).
12358  * @property {RuleFunction} function Rule implementation.
12359  */
12360
12361 /**
12362  * Configuration options.
12363  *
12364  * @typedef {Object} Options
12365  * @property {string[] | string} [files] Files to lint.
12366  * @property {Object.<string, string>} [strings] Strings to lint.
12367  * @property {Configuration} [config] Configuration object.
12368  * @property {Rule[] | Rule} [customRules] Custom rules.
12369  * @property {RegExp} [frontMatter] Front matter pattern.
12370  * @property {boolean} [handleRuleFailures] True to catch exceptions.
12371  * @property {boolean} [noInlineConfig] True to ignore HTML directives.
12372  * @property {number} [resultVersion] Results object version.
12373  * @property {Plugin[]} [markdownItPlugins] Additional plugins.
12374  */
12375
12376 /**
12377  * markdown-it plugin.
12378  *
12379  * @typedef {Array} Plugin
12380  */
12381
12382 /**
12383  * Function to pretty-print lint results.
12384  *
12385  * @callback ToStringCallback
12386  * @param {boolean} [ruleAliases] True to use rule aliases.
12387  * @returns {string}
12388  */
12389
12390 /**
12391  * Lint results (for resultVersion 3).
12392  *
12393  * @typedef {Object.<string, LintError[]>} LintResults
12394  */
12395 // The following should be part of the LintResults typedef, but that causes
12396 // TypeScript to "forget" about the string map.
12397 // * @property {ToStringCallback} toString String representation.
12398 // https://github.com/microsoft/TypeScript/issues/34911
12399
12400 /**
12401  * Lint error.
12402  *
12403  * @typedef {Object} LintError
12404  * @property {number} lineNumber Line number (1-based).
12405  * @property {string[]} ruleNames Rule name(s).
12406  * @property {string} ruleDescription Rule description.
12407  * @property {string} ruleInformation Link to more information.
12408  * @property {string} errorDetail Detail about the error.
12409  * @property {string} errorContext Context for the error.
12410  * @property {number[]} errorRange Column number (1-based) and length.
12411  * @property {FixInfo} fixInfo Fix information.
12412  */
12413
12414 /**
12415  * Fix information.
12416  *
12417  * @typedef {Object} FixInfo
12418  * @property {number} [editColumn] Column of the fix (1-based).
12419  * @property {number} [deleteCount] Count of characters to delete.
12420  * @property {string} [insertText] Text to insert (after deleting).
12421  */
12422
12423 /**
12424  * Called with the result of the lint operation.
12425  *
12426  * @callback LintCallback
12427  * @param {Error | null} err Error object or null.
12428  * @param {LintResults} [results] Lint results.
12429  * @returns {void}
12430  */
12431
12432 /**
12433  * Configuration object for linting rules. For a detailed schema, see
12434  * {@link ../schema/markdownlint-config-schema.json}.
12435  *
12436  * @typedef {Object.<string, RuleConfiguration>} Configuration
12437  */
12438
12439 /**
12440  * Rule configuration object.
12441  *
12442  * @typedef {boolean | Object} RuleConfiguration Rule configuration.
12443  */
12444
12445 /**
12446  * Parses a configuration string and returns a configuration object.
12447  *
12448  * @callback ConfigurationParser
12449  * @param {string} text Configuration string.
12450  * @returns {Configuration}
12451  */
12452
12453 /**
12454  * Called with the result of the readConfig operation.
12455  *
12456  * @callback ReadConfigCallback
12457  * @param {Error | null} err Error object or null.
12458  * @param {Configuration} [config] Configuration object.
12459  * @returns {void}
12460  */
12461
12462
12463 /***/ }),
12464 /* 38 */
12465 /***/ (function(module, exports) {
12466
12467 module.exports = require("path");
12468
12469 /***/ }),
12470 /* 39 */
12471 /***/ (function(module, exports) {
12472
12473 module.exports = require("url");
12474
12475 /***/ }),
12476 /* 40 */
12477 /***/ (function(module, exports, __webpack_require__) {
12478
12479 "use strict";
12480
12481
12482
12483 module.exports = __webpack_require__(41);
12484
12485
12486 /***/ }),
12487 /* 41 */
12488 /***/ (function(module, exports, __webpack_require__) {
12489
12490 "use strict";
12491 // Main parser class
12492
12493
12494
12495
12496 var utils        = __webpack_require__(42);
12497 var helpers      = __webpack_require__(56);
12498 var Renderer     = __webpack_require__(60);
12499 var ParserCore   = __webpack_require__(61);
12500 var ParserBlock  = __webpack_require__(71);
12501 var ParserInline = __webpack_require__(86);
12502 var LinkifyIt    = __webpack_require__(101);
12503 var mdurl        = __webpack_require__(46);
12504 var punycode     = __webpack_require__(103);
12505
12506
12507 var config = {
12508   'default': __webpack_require__(104),
12509   zero: __webpack_require__(105),
12510   commonmark: __webpack_require__(106)
12511 };
12512
12513 ////////////////////////////////////////////////////////////////////////////////
12514 //
12515 // This validator can prohibit more than really needed to prevent XSS. It's a
12516 // tradeoff to keep code simple and to be secure by default.
12517 //
12518 // If you need different setup - override validator method as you wish. Or
12519 // replace it with dummy function and use external sanitizer.
12520 //
12521
12522 var BAD_PROTO_RE = /^(vbscript|javascript|file|data):/;
12523 var GOOD_DATA_RE = /^data:image\/(gif|png|jpeg|webp);/;
12524
12525 function validateLink(url) {
12526   // url should be normalized at this point, and existing entities are decoded
12527   var str = url.trim().toLowerCase();
12528
12529   return BAD_PROTO_RE.test(str) ? (GOOD_DATA_RE.test(str) ? true : false) : true;
12530 }
12531
12532 ////////////////////////////////////////////////////////////////////////////////
12533
12534
12535 var RECODE_HOSTNAME_FOR = [ 'http:', 'https:', 'mailto:' ];
12536
12537 function normalizeLink(url) {
12538   var parsed = mdurl.parse(url, true);
12539
12540   if (parsed.hostname) {
12541     // Encode hostnames in urls like:
12542     // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
12543     //
12544     // We don't encode unknown schemas, because it's likely that we encode
12545     // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
12546     //
12547     if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
12548       try {
12549         parsed.hostname = punycode.toASCII(parsed.hostname);
12550       } catch (er) { /**/ }
12551     }
12552   }
12553
12554   return mdurl.encode(mdurl.format(parsed));
12555 }
12556
12557 function normalizeLinkText(url) {
12558   var parsed = mdurl.parse(url, true);
12559
12560   if (parsed.hostname) {
12561     // Encode hostnames in urls like:
12562     // `http://host/`, `https://host/`, `mailto:user@host`, `//host/`
12563     //
12564     // We don't encode unknown schemas, because it's likely that we encode
12565     // something we shouldn't (e.g. `skype:name` treated as `skype:host`)
12566     //
12567     if (!parsed.protocol || RECODE_HOSTNAME_FOR.indexOf(parsed.protocol) >= 0) {
12568       try {
12569         parsed.hostname = punycode.toUnicode(parsed.hostname);
12570       } catch (er) { /**/ }
12571     }
12572   }
12573
12574   return mdurl.decode(mdurl.format(parsed));
12575 }
12576
12577
12578 /**
12579  * class MarkdownIt
12580  *
12581  * Main parser/renderer class.
12582  *
12583  * ##### Usage
12584  *
12585  * ```javascript
12586  * // node.js, "classic" way:
12587  * var MarkdownIt = require('markdown-it'),
12588  *     md = new MarkdownIt();
12589  * var result = md.render('# markdown-it rulezz!');
12590  *
12591  * // node.js, the same, but with sugar:
12592  * var md = require('markdown-it')();
12593  * var result = md.render('# markdown-it rulezz!');
12594  *
12595  * // browser without AMD, added to "window" on script load
12596  * // Note, there are no dash.
12597  * var md = window.markdownit();
12598  * var result = md.render('# markdown-it rulezz!');
12599  * ```
12600  *
12601  * Single line rendering, without paragraph wrap:
12602  *
12603  * ```javascript
12604  * var md = require('markdown-it')();
12605  * var result = md.renderInline('__markdown-it__ rulezz!');
12606  * ```
12607  **/
12608
12609 /**
12610  * new MarkdownIt([presetName, options])
12611  * - presetName (String): optional, `commonmark` / `zero`
12612  * - options (Object)
12613  *
12614  * Creates parser instanse with given config. Can be called without `new`.
12615  *
12616  * ##### presetName
12617  *
12618  * MarkdownIt provides named presets as a convenience to quickly
12619  * enable/disable active syntax rules and options for common use cases.
12620  *
12621  * - ["commonmark"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/commonmark.js) -
12622  *   configures parser to strict [CommonMark](http://commonmark.org/) mode.
12623  * - [default](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/default.js) -
12624  *   similar to GFM, used when no preset name given. Enables all available rules,
12625  *   but still without html, typographer & autolinker.
12626  * - ["zero"](https://github.com/markdown-it/markdown-it/blob/master/lib/presets/zero.js) -
12627  *   all rules disabled. Useful to quickly setup your config via `.enable()`.
12628  *   For example, when you need only `bold` and `italic` markup and nothing else.
12629  *
12630  * ##### options:
12631  *
12632  * - __html__ - `false`. Set `true` to enable HTML tags in source. Be careful!
12633  *   That's not safe! You may need external sanitizer to protect output from XSS.
12634  *   It's better to extend features via plugins, instead of enabling HTML.
12635  * - __xhtmlOut__ - `false`. Set `true` to add '/' when closing single tags
12636  *   (`<br />`). This is needed only for full CommonMark compatibility. In real
12637  *   world you will need HTML output.
12638  * - __breaks__ - `false`. Set `true` to convert `\n` in paragraphs into `<br>`.
12639  * - __langPrefix__ - `language-`. CSS language class prefix for fenced blocks.
12640  *   Can be useful for external highlighters.
12641  * - __linkify__ - `false`. Set `true` to autoconvert URL-like text to links.
12642  * - __typographer__  - `false`. Set `true` to enable [some language-neutral
12643  *   replacement](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.js) +
12644  *   quotes beautification (smartquotes).
12645  * - __quotes__ - `“”‘’`, String or Array. Double + single quotes replacement
12646  *   pairs, when typographer enabled and smartquotes on. For example, you can
12647  *   use `'«»„“'` for Russian, `'„“‚‘'` for German, and
12648  *   `['«\xA0', '\xA0»', '‹\xA0', '\xA0›']` for French (including nbsp).
12649  * - __highlight__ - `null`. Highlighter function for fenced code blocks.
12650  *   Highlighter `function (str, lang)` should return escaped HTML. It can also
12651  *   return empty string if the source was not changed and should be escaped
12652  *   externaly. If result starts with <pre... internal wrapper is skipped.
12653  *
12654  * ##### Example
12655  *
12656  * ```javascript
12657  * // commonmark mode
12658  * var md = require('markdown-it')('commonmark');
12659  *
12660  * // default mode
12661  * var md = require('markdown-it')();
12662  *
12663  * // enable everything
12664  * var md = require('markdown-it')({
12665  *   html: true,
12666  *   linkify: true,
12667  *   typographer: true
12668  * });
12669  * ```
12670  *
12671  * ##### Syntax highlighting
12672  *
12673  * ```js
12674  * var hljs = require('highlight.js') // https://highlightjs.org/
12675  *
12676  * var md = require('markdown-it')({
12677  *   highlight: function (str, lang) {
12678  *     if (lang && hljs.getLanguage(lang)) {
12679  *       try {
12680  *         return hljs.highlight(lang, str, true).value;
12681  *       } catch (__) {}
12682  *     }
12683  *
12684  *     return ''; // use external default escaping
12685  *   }
12686  * });
12687  * ```
12688  *
12689  * Or with full wrapper override (if you need assign class to `<pre>`):
12690  *
12691  * ```javascript
12692  * var hljs = require('highlight.js') // https://highlightjs.org/
12693  *
12694  * // Actual default values
12695  * var md = require('markdown-it')({
12696  *   highlight: function (str, lang) {
12697  *     if (lang && hljs.getLanguage(lang)) {
12698  *       try {
12699  *         return '<pre class="hljs"><code>' +
12700  *                hljs.highlight(lang, str, true).value +
12701  *                '</code></pre>';
12702  *       } catch (__) {}
12703  *     }
12704  *
12705  *     return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
12706  *   }
12707  * });
12708  * ```
12709  *
12710  **/
12711 function MarkdownIt(presetName, options) {
12712   if (!(this instanceof MarkdownIt)) {
12713     return new MarkdownIt(presetName, options);
12714   }
12715
12716   if (!options) {
12717     if (!utils.isString(presetName)) {
12718       options = presetName || {};
12719       presetName = 'default';
12720     }
12721   }
12722
12723   /**
12724    * MarkdownIt#inline -> ParserInline
12725    *
12726    * Instance of [[ParserInline]]. You may need it to add new rules when
12727    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
12728    * [[MarkdownIt.enable]].
12729    **/
12730   this.inline = new ParserInline();
12731
12732   /**
12733    * MarkdownIt#block -> ParserBlock
12734    *
12735    * Instance of [[ParserBlock]]. You may need it to add new rules when
12736    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
12737    * [[MarkdownIt.enable]].
12738    **/
12739   this.block = new ParserBlock();
12740
12741   /**
12742    * MarkdownIt#core -> Core
12743    *
12744    * Instance of [[Core]] chain executor. You may need it to add new rules when
12745    * writing plugins. For simple rules control use [[MarkdownIt.disable]] and
12746    * [[MarkdownIt.enable]].
12747    **/
12748   this.core = new ParserCore();
12749
12750   /**
12751    * MarkdownIt#renderer -> Renderer
12752    *
12753    * Instance of [[Renderer]]. Use it to modify output look. Or to add rendering
12754    * rules for new token types, generated by plugins.
12755    *
12756    * ##### Example
12757    *
12758    * ```javascript
12759    * var md = require('markdown-it')();
12760    *
12761    * function myToken(tokens, idx, options, env, self) {
12762    *   //...
12763    *   return result;
12764    * };
12765    *
12766    * md.renderer.rules['my_token'] = myToken
12767    * ```
12768    *
12769    * See [[Renderer]] docs and [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js).
12770    **/
12771   this.renderer = new Renderer();
12772
12773   /**
12774    * MarkdownIt#linkify -> LinkifyIt
12775    *
12776    * [linkify-it](https://github.com/markdown-it/linkify-it) instance.
12777    * Used by [linkify](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/linkify.js)
12778    * rule.
12779    **/
12780   this.linkify = new LinkifyIt();
12781
12782   /**
12783    * MarkdownIt#validateLink(url) -> Boolean
12784    *
12785    * Link validation function. CommonMark allows too much in links. By default
12786    * we disable `javascript:`, `vbscript:`, `file:` schemas, and almost all `data:...` schemas
12787    * except some embedded image types.
12788    *
12789    * You can change this behaviour:
12790    *
12791    * ```javascript
12792    * var md = require('markdown-it')();
12793    * // enable everything
12794    * md.validateLink = function () { return true; }
12795    * ```
12796    **/
12797   this.validateLink = validateLink;
12798
12799   /**
12800    * MarkdownIt#normalizeLink(url) -> String
12801    *
12802    * Function used to encode link url to a machine-readable format,
12803    * which includes url-encoding, punycode, etc.
12804    **/
12805   this.normalizeLink = normalizeLink;
12806
12807   /**
12808    * MarkdownIt#normalizeLinkText(url) -> String
12809    *
12810    * Function used to decode link url to a human-readable format`
12811    **/
12812   this.normalizeLinkText = normalizeLinkText;
12813
12814
12815   // Expose utils & helpers for easy acces from plugins
12816
12817   /**
12818    * MarkdownIt#utils -> utils
12819    *
12820    * Assorted utility functions, useful to write plugins. See details
12821    * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/common/utils.js).
12822    **/
12823   this.utils = utils;
12824
12825   /**
12826    * MarkdownIt#helpers -> helpers
12827    *
12828    * Link components parser functions, useful to write plugins. See details
12829    * [here](https://github.com/markdown-it/markdown-it/blob/master/lib/helpers).
12830    **/
12831   this.helpers = utils.assign({}, helpers);
12832
12833
12834   this.options = {};
12835   this.configure(presetName);
12836
12837   if (options) { this.set(options); }
12838 }
12839
12840
12841 /** chainable
12842  * MarkdownIt.set(options)
12843  *
12844  * Set parser options (in the same format as in constructor). Probably, you
12845  * will never need it, but you can change options after constructor call.
12846  *
12847  * ##### Example
12848  *
12849  * ```javascript
12850  * var md = require('markdown-it')()
12851  *             .set({ html: true, breaks: true })
12852  *             .set({ typographer, true });
12853  * ```
12854  *
12855  * __Note:__ To achieve the best possible performance, don't modify a
12856  * `markdown-it` instance options on the fly. If you need multiple configurations
12857  * it's best to create multiple instances and initialize each with separate
12858  * config.
12859  **/
12860 MarkdownIt.prototype.set = function (options) {
12861   utils.assign(this.options, options);
12862   return this;
12863 };
12864
12865
12866 /** chainable, internal
12867  * MarkdownIt.configure(presets)
12868  *
12869  * Batch load of all options and compenent settings. This is internal method,
12870  * and you probably will not need it. But if you with - see available presets
12871  * and data structure [here](https://github.com/markdown-it/markdown-it/tree/master/lib/presets)
12872  *
12873  * We strongly recommend to use presets instead of direct config loads. That
12874  * will give better compatibility with next versions.
12875  **/
12876 MarkdownIt.prototype.configure = function (presets) {
12877   var self = this, presetName;
12878
12879   if (utils.isString(presets)) {
12880     presetName = presets;
12881     presets = config[presetName];
12882     if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); }
12883   }
12884
12885   if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); }
12886
12887   if (presets.options) { self.set(presets.options); }
12888
12889   if (presets.components) {
12890     Object.keys(presets.components).forEach(function (name) {
12891       if (presets.components[name].rules) {
12892         self[name].ruler.enableOnly(presets.components[name].rules);
12893       }
12894       if (presets.components[name].rules2) {
12895         self[name].ruler2.enableOnly(presets.components[name].rules2);
12896       }
12897     });
12898   }
12899   return this;
12900 };
12901
12902
12903 /** chainable
12904  * MarkdownIt.enable(list, ignoreInvalid)
12905  * - list (String|Array): rule name or list of rule names to enable
12906  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
12907  *
12908  * Enable list or rules. It will automatically find appropriate components,
12909  * containing rules with given names. If rule not found, and `ignoreInvalid`
12910  * not set - throws exception.
12911  *
12912  * ##### Example
12913  *
12914  * ```javascript
12915  * var md = require('markdown-it')()
12916  *             .enable(['sub', 'sup'])
12917  *             .disable('smartquotes');
12918  * ```
12919  **/
12920 MarkdownIt.prototype.enable = function (list, ignoreInvalid) {
12921   var result = [];
12922
12923   if (!Array.isArray(list)) { list = [ list ]; }
12924
12925   [ 'core', 'block', 'inline' ].forEach(function (chain) {
12926     result = result.concat(this[chain].ruler.enable(list, true));
12927   }, this);
12928
12929   result = result.concat(this.inline.ruler2.enable(list, true));
12930
12931   var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
12932
12933   if (missed.length && !ignoreInvalid) {
12934     throw new Error('MarkdownIt. Failed to enable unknown rule(s): ' + missed);
12935   }
12936
12937   return this;
12938 };
12939
12940
12941 /** chainable
12942  * MarkdownIt.disable(list, ignoreInvalid)
12943  * - list (String|Array): rule name or list of rule names to disable.
12944  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
12945  *
12946  * The same as [[MarkdownIt.enable]], but turn specified rules off.
12947  **/
12948 MarkdownIt.prototype.disable = function (list, ignoreInvalid) {
12949   var result = [];
12950
12951   if (!Array.isArray(list)) { list = [ list ]; }
12952
12953   [ 'core', 'block', 'inline' ].forEach(function (chain) {
12954     result = result.concat(this[chain].ruler.disable(list, true));
12955   }, this);
12956
12957   result = result.concat(this.inline.ruler2.disable(list, true));
12958
12959   var missed = list.filter(function (name) { return result.indexOf(name) < 0; });
12960
12961   if (missed.length && !ignoreInvalid) {
12962     throw new Error('MarkdownIt. Failed to disable unknown rule(s): ' + missed);
12963   }
12964   return this;
12965 };
12966
12967
12968 /** chainable
12969  * MarkdownIt.use(plugin, params)
12970  *
12971  * Load specified plugin with given params into current parser instance.
12972  * It's just a sugar to call `plugin(md, params)` with curring.
12973  *
12974  * ##### Example
12975  *
12976  * ```javascript
12977  * var iterator = require('markdown-it-for-inline');
12978  * var md = require('markdown-it')()
12979  *             .use(iterator, 'foo_replace', 'text', function (tokens, idx) {
12980  *               tokens[idx].content = tokens[idx].content.replace(/foo/g, 'bar');
12981  *             });
12982  * ```
12983  **/
12984 MarkdownIt.prototype.use = function (plugin /*, params, ... */) {
12985   var args = [ this ].concat(Array.prototype.slice.call(arguments, 1));
12986   plugin.apply(plugin, args);
12987   return this;
12988 };
12989
12990
12991 /** internal
12992  * MarkdownIt.parse(src, env) -> Array
12993  * - src (String): source string
12994  * - env (Object): environment sandbox
12995  *
12996  * Parse input string and returns list of block tokens (special token type
12997  * "inline" will contain list of inline tokens). You should not call this
12998  * method directly, until you write custom renderer (for example, to produce
12999  * AST).
13000  *
13001  * `env` is used to pass data between "distributed" rules and return additional
13002  * metadata like reference info, needed for the renderer. It also can be used to
13003  * inject data in specific cases. Usually, you will be ok to pass `{}`,
13004  * and then pass updated object to renderer.
13005  **/
13006 MarkdownIt.prototype.parse = function (src, env) {
13007   if (typeof src !== 'string') {
13008     throw new Error('Input data should be a String');
13009   }
13010
13011   var state = new this.core.State(src, this, env);
13012
13013   this.core.process(state);
13014
13015   return state.tokens;
13016 };
13017
13018
13019 /**
13020  * MarkdownIt.render(src [, env]) -> String
13021  * - src (String): source string
13022  * - env (Object): environment sandbox
13023  *
13024  * Render markdown string into html. It does all magic for you :).
13025  *
13026  * `env` can be used to inject additional metadata (`{}` by default).
13027  * But you will not need it with high probability. See also comment
13028  * in [[MarkdownIt.parse]].
13029  **/
13030 MarkdownIt.prototype.render = function (src, env) {
13031   env = env || {};
13032
13033   return this.renderer.render(this.parse(src, env), this.options, env);
13034 };
13035
13036
13037 /** internal
13038  * MarkdownIt.parseInline(src, env) -> Array
13039  * - src (String): source string
13040  * - env (Object): environment sandbox
13041  *
13042  * The same as [[MarkdownIt.parse]] but skip all block rules. It returns the
13043  * block tokens list with the single `inline` element, containing parsed inline
13044  * tokens in `children` property. Also updates `env` object.
13045  **/
13046 MarkdownIt.prototype.parseInline = function (src, env) {
13047   var state = new this.core.State(src, this, env);
13048
13049   state.inlineMode = true;
13050   this.core.process(state);
13051
13052   return state.tokens;
13053 };
13054
13055
13056 /**
13057  * MarkdownIt.renderInline(src [, env]) -> String
13058  * - src (String): source string
13059  * - env (Object): environment sandbox
13060  *
13061  * Similar to [[MarkdownIt.render]] but for single paragraph content. Result
13062  * will NOT be wrapped into `<p>` tags.
13063  **/
13064 MarkdownIt.prototype.renderInline = function (src, env) {
13065   env = env || {};
13066
13067   return this.renderer.render(this.parseInline(src, env), this.options, env);
13068 };
13069
13070
13071 module.exports = MarkdownIt;
13072
13073
13074 /***/ }),
13075 /* 42 */
13076 /***/ (function(module, exports, __webpack_require__) {
13077
13078 "use strict";
13079 // Utilities
13080 //
13081
13082
13083
13084 function _class(obj) { return Object.prototype.toString.call(obj); }
13085
13086 function isString(obj) { return _class(obj) === '[object String]'; }
13087
13088 var _hasOwnProperty = Object.prototype.hasOwnProperty;
13089
13090 function has(object, key) {
13091   return _hasOwnProperty.call(object, key);
13092 }
13093
13094 // Merge objects
13095 //
13096 function assign(obj /*from1, from2, from3, ...*/) {
13097   var sources = Array.prototype.slice.call(arguments, 1);
13098
13099   sources.forEach(function (source) {
13100     if (!source) { return; }
13101
13102     if (typeof source !== 'object') {
13103       throw new TypeError(source + 'must be object');
13104     }
13105
13106     Object.keys(source).forEach(function (key) {
13107       obj[key] = source[key];
13108     });
13109   });
13110
13111   return obj;
13112 }
13113
13114 // Remove element from array and put another array at those position.
13115 // Useful for some operations with tokens
13116 function arrayReplaceAt(src, pos, newElements) {
13117   return [].concat(src.slice(0, pos), newElements, src.slice(pos + 1));
13118 }
13119
13120 ////////////////////////////////////////////////////////////////////////////////
13121
13122 function isValidEntityCode(c) {
13123   /*eslint no-bitwise:0*/
13124   // broken sequence
13125   if (c >= 0xD800 && c <= 0xDFFF) { return false; }
13126   // never used
13127   if (c >= 0xFDD0 && c <= 0xFDEF) { return false; }
13128   if ((c & 0xFFFF) === 0xFFFF || (c & 0xFFFF) === 0xFFFE) { return false; }
13129   // control codes
13130   if (c >= 0x00 && c <= 0x08) { return false; }
13131   if (c === 0x0B) { return false; }
13132   if (c >= 0x0E && c <= 0x1F) { return false; }
13133   if (c >= 0x7F && c <= 0x9F) { return false; }
13134   // out of range
13135   if (c > 0x10FFFF) { return false; }
13136   return true;
13137 }
13138
13139 function fromCodePoint(c) {
13140   /*eslint no-bitwise:0*/
13141   if (c > 0xffff) {
13142     c -= 0x10000;
13143     var surrogate1 = 0xd800 + (c >> 10),
13144         surrogate2 = 0xdc00 + (c & 0x3ff);
13145
13146     return String.fromCharCode(surrogate1, surrogate2);
13147   }
13148   return String.fromCharCode(c);
13149 }
13150
13151
13152 var UNESCAPE_MD_RE  = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g;
13153 var ENTITY_RE       = /&([a-z#][a-z0-9]{1,31});/gi;
13154 var UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
13155
13156 var DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
13157
13158 var entities = __webpack_require__(43);
13159
13160 function replaceEntityPattern(match, name) {
13161   var code = 0;
13162
13163   if (has(entities, name)) {
13164     return entities[name];
13165   }
13166
13167   if (name.charCodeAt(0) === 0x23/* # */ && DIGITAL_ENTITY_TEST_RE.test(name)) {
13168     code = name[1].toLowerCase() === 'x' ?
13169       parseInt(name.slice(2), 16) : parseInt(name.slice(1), 10);
13170
13171     if (isValidEntityCode(code)) {
13172       return fromCodePoint(code);
13173     }
13174   }
13175
13176   return match;
13177 }
13178
13179 /*function replaceEntities(str) {
13180   if (str.indexOf('&') < 0) { return str; }
13181
13182   return str.replace(ENTITY_RE, replaceEntityPattern);
13183 }*/
13184
13185 function unescapeMd(str) {
13186   if (str.indexOf('\\') < 0) { return str; }
13187   return str.replace(UNESCAPE_MD_RE, '$1');
13188 }
13189
13190 function unescapeAll(str) {
13191   if (str.indexOf('\\') < 0 && str.indexOf('&') < 0) { return str; }
13192
13193   return str.replace(UNESCAPE_ALL_RE, function (match, escaped, entity) {
13194     if (escaped) { return escaped; }
13195     return replaceEntityPattern(match, entity);
13196   });
13197 }
13198
13199 ////////////////////////////////////////////////////////////////////////////////
13200
13201 var HTML_ESCAPE_TEST_RE = /[&<>"]/;
13202 var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
13203 var HTML_REPLACEMENTS = {
13204   '&': '&amp;',
13205   '<': '&lt;',
13206   '>': '&gt;',
13207   '"': '&quot;'
13208 };
13209
13210 function replaceUnsafeChar(ch) {
13211   return HTML_REPLACEMENTS[ch];
13212 }
13213
13214 function escapeHtml(str) {
13215   if (HTML_ESCAPE_TEST_RE.test(str)) {
13216     return str.replace(HTML_ESCAPE_REPLACE_RE, replaceUnsafeChar);
13217   }
13218   return str;
13219 }
13220
13221 ////////////////////////////////////////////////////////////////////////////////
13222
13223 var REGEXP_ESCAPE_RE = /[.?*+^$[\]\\(){}|-]/g;
13224
13225 function escapeRE(str) {
13226   return str.replace(REGEXP_ESCAPE_RE, '\\$&');
13227 }
13228
13229 ////////////////////////////////////////////////////////////////////////////////
13230
13231 function isSpace(code) {
13232   switch (code) {
13233     case 0x09:
13234     case 0x20:
13235       return true;
13236   }
13237   return false;
13238 }
13239
13240 // Zs (unicode class) || [\t\f\v\r\n]
13241 function isWhiteSpace(code) {
13242   if (code >= 0x2000 && code <= 0x200A) { return true; }
13243   switch (code) {
13244     case 0x09: // \t
13245     case 0x0A: // \n
13246     case 0x0B: // \v
13247     case 0x0C: // \f
13248     case 0x0D: // \r
13249     case 0x20:
13250     case 0xA0:
13251     case 0x1680:
13252     case 0x202F:
13253     case 0x205F:
13254     case 0x3000:
13255       return true;
13256   }
13257   return false;
13258 }
13259
13260 ////////////////////////////////////////////////////////////////////////////////
13261
13262 /*eslint-disable max-len*/
13263 var UNICODE_PUNCT_RE = __webpack_require__(45);
13264
13265 // Currently without astral characters support.
13266 function isPunctChar(ch) {
13267   return UNICODE_PUNCT_RE.test(ch);
13268 }
13269
13270
13271 // Markdown ASCII punctuation characters.
13272 //
13273 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
13274 // http://spec.commonmark.org/0.15/#ascii-punctuation-character
13275 //
13276 // Don't confuse with unicode punctuation !!! It lacks some chars in ascii range.
13277 //
13278 function isMdAsciiPunct(ch) {
13279   switch (ch) {
13280     case 0x21/* ! */:
13281     case 0x22/* " */:
13282     case 0x23/* # */:
13283     case 0x24/* $ */:
13284     case 0x25/* % */:
13285     case 0x26/* & */:
13286     case 0x27/* ' */:
13287     case 0x28/* ( */:
13288     case 0x29/* ) */:
13289     case 0x2A/* * */:
13290     case 0x2B/* + */:
13291     case 0x2C/* , */:
13292     case 0x2D/* - */:
13293     case 0x2E/* . */:
13294     case 0x2F/* / */:
13295     case 0x3A/* : */:
13296     case 0x3B/* ; */:
13297     case 0x3C/* < */:
13298     case 0x3D/* = */:
13299     case 0x3E/* > */:
13300     case 0x3F/* ? */:
13301     case 0x40/* @ */:
13302     case 0x5B/* [ */:
13303     case 0x5C/* \ */:
13304     case 0x5D/* ] */:
13305     case 0x5E/* ^ */:
13306     case 0x5F/* _ */:
13307     case 0x60/* ` */:
13308     case 0x7B/* { */:
13309     case 0x7C/* | */:
13310     case 0x7D/* } */:
13311     case 0x7E/* ~ */:
13312       return true;
13313     default:
13314       return false;
13315   }
13316 }
13317
13318 // Hepler to unify [reference labels].
13319 //
13320 function normalizeReference(str) {
13321   // Trim and collapse whitespace
13322   //
13323   str = str.trim().replace(/\s+/g, ' ');
13324
13325   // In node v10 'ẞ'.toLowerCase() === 'Ṿ', which is presumed to be a bug
13326   // fixed in v12 (couldn't find any details).
13327   //
13328   // So treat this one as a special case
13329   // (remove this when node v10 is no longer supported).
13330   //
13331   if ('ẞ'.toLowerCase() === 'Ṿ') {
13332     str = str.replace(/ẞ/g, 'ß');
13333   }
13334
13335   // .toLowerCase().toUpperCase() should get rid of all differences
13336   // between letter variants.
13337   //
13338   // Simple .toLowerCase() doesn't normalize 125 code points correctly,
13339   // and .toUpperCase doesn't normalize 6 of them (list of exceptions:
13340   // İ, ϴ, ẞ, Ω, K, Å - those are already uppercased, but have differently
13341   // uppercased versions).
13342   //
13343   // Here's an example showing how it happens. Lets take greek letter omega:
13344   // uppercase U+0398 (Θ), U+03f4 (ϴ) and lowercase U+03b8 (θ), U+03d1 (ϑ)
13345   //
13346   // Unicode entries:
13347   // 0398;GREEK CAPITAL LETTER THETA;Lu;0;L;;;;;N;;;;03B8;
13348   // 03B8;GREEK SMALL LETTER THETA;Ll;0;L;;;;;N;;;0398;;0398
13349   // 03D1;GREEK THETA SYMBOL;Ll;0;L;<compat> 03B8;;;;N;GREEK SMALL LETTER SCRIPT THETA;;0398;;0398
13350   // 03F4;GREEK CAPITAL THETA SYMBOL;Lu;0;L;<compat> 0398;;;;N;;;;03B8;
13351   //
13352   // Case-insensitive comparison should treat all of them as equivalent.
13353   //
13354   // But .toLowerCase() doesn't change ϑ (it's already lowercase),
13355   // and .toUpperCase() doesn't change ϴ (already uppercase).
13356   //
13357   // Applying first lower then upper case normalizes any character:
13358   // '\u0398\u03f4\u03b8\u03d1'.toLowerCase().toUpperCase() === '\u0398\u0398\u0398\u0398'
13359   //
13360   // Note: this is equivalent to unicode case folding; unicode normalization
13361   // is a different step that is not required here.
13362   //
13363   // Final result should be uppercased, because it's later stored in an object
13364   // (this avoid a conflict with Object.prototype members,
13365   // most notably, `__proto__`)
13366   //
13367   return str.toLowerCase().toUpperCase();
13368 }
13369
13370 ////////////////////////////////////////////////////////////////////////////////
13371
13372 // Re-export libraries commonly used in both markdown-it and its plugins,
13373 // so plugins won't have to depend on them explicitly, which reduces their
13374 // bundled size (e.g. a browser build).
13375 //
13376 exports.lib                 = {};
13377 exports.lib.mdurl           = __webpack_require__(46);
13378 exports.lib.ucmicro         = __webpack_require__(51);
13379
13380 exports.assign              = assign;
13381 exports.isString            = isString;
13382 exports.has                 = has;
13383 exports.unescapeMd          = unescapeMd;
13384 exports.unescapeAll         = unescapeAll;
13385 exports.isValidEntityCode   = isValidEntityCode;
13386 exports.fromCodePoint       = fromCodePoint;
13387 // exports.replaceEntities     = replaceEntities;
13388 exports.escapeHtml          = escapeHtml;
13389 exports.arrayReplaceAt      = arrayReplaceAt;
13390 exports.isSpace             = isSpace;
13391 exports.isWhiteSpace        = isWhiteSpace;
13392 exports.isMdAsciiPunct      = isMdAsciiPunct;
13393 exports.isPunctChar         = isPunctChar;
13394 exports.escapeRE            = escapeRE;
13395 exports.normalizeReference  = normalizeReference;
13396
13397
13398 /***/ }),
13399 /* 43 */
13400 /***/ (function(module, exports, __webpack_require__) {
13401
13402 "use strict";
13403 // HTML5 entities map: { name -> utf16string }
13404 //
13405
13406
13407 /*eslint quotes:0*/
13408 module.exports = __webpack_require__(44);
13409
13410
13411 /***/ }),
13412 /* 44 */
13413 /***/ (function(module) {
13414
13415 module.exports = JSON.parse("{\"Aacute\":\"Á\",\"aacute\":\"á\",\"Abreve\":\"Ă\",\"abreve\":\"ă\",\"ac\":\"∾\",\"acd\":\"∿\",\"acE\":\"∾̳\",\"Acirc\":\"Â\",\"acirc\":\"â\",\"acute\":\"´\",\"Acy\":\"А\",\"acy\":\"а\",\"AElig\":\"Æ\",\"aelig\":\"æ\",\"af\":\"⁡\",\"Afr\":\"𝔄\",\"afr\":\"𝔞\",\"Agrave\":\"À\",\"agrave\":\"à\",\"alefsym\":\"ℵ\",\"aleph\":\"ℵ\",\"Alpha\":\"Α\",\"alpha\":\"α\",\"Amacr\":\"Ā\",\"amacr\":\"ā\",\"amalg\":\"⨿\",\"amp\":\"&\",\"AMP\":\"&\",\"andand\":\"⩕\",\"And\":\"⩓\",\"and\":\"∧\",\"andd\":\"⩜\",\"andslope\":\"⩘\",\"andv\":\"⩚\",\"ang\":\"∠\",\"ange\":\"⦤\",\"angle\":\"∠\",\"angmsdaa\":\"⦨\",\"angmsdab\":\"⦩\",\"angmsdac\":\"⦪\",\"angmsdad\":\"⦫\",\"angmsdae\":\"⦬\",\"angmsdaf\":\"⦭\",\"angmsdag\":\"⦮\",\"angmsdah\":\"⦯\",\"angmsd\":\"∡\",\"angrt\":\"∟\",\"angrtvb\":\"⊾\",\"angrtvbd\":\"⦝\",\"angsph\":\"∢\",\"angst\":\"Å\",\"angzarr\":\"⍼\",\"Aogon\":\"Ą\",\"aogon\":\"ą\",\"Aopf\":\"𝔸\",\"aopf\":\"𝕒\",\"apacir\":\"⩯\",\"ap\":\"≈\",\"apE\":\"⩰\",\"ape\":\"≊\",\"apid\":\"≋\",\"apos\":\"'\",\"ApplyFunction\":\"⁡\",\"approx\":\"≈\",\"approxeq\":\"≊\",\"Aring\":\"Å\",\"aring\":\"å\",\"Ascr\":\"𝒜\",\"ascr\":\"𝒶\",\"Assign\":\"≔\",\"ast\":\"*\",\"asymp\":\"≈\",\"asympeq\":\"≍\",\"Atilde\":\"Ã\",\"atilde\":\"ã\",\"Auml\":\"Ä\",\"auml\":\"ä\",\"awconint\":\"∳\",\"awint\":\"⨑\",\"backcong\":\"≌\",\"backepsilon\":\"϶\",\"backprime\":\"‵\",\"backsim\":\"∽\",\"backsimeq\":\"⋍\",\"Backslash\":\"∖\",\"Barv\":\"⫧\",\"barvee\":\"⊽\",\"barwed\":\"⌅\",\"Barwed\":\"⌆\",\"barwedge\":\"⌅\",\"bbrk\":\"⎵\",\"bbrktbrk\":\"⎶\",\"bcong\":\"≌\",\"Bcy\":\"Б\",\"bcy\":\"б\",\"bdquo\":\"„\",\"becaus\":\"∵\",\"because\":\"∵\",\"Because\":\"∵\",\"bemptyv\":\"⦰\",\"bepsi\":\"϶\",\"bernou\":\"ℬ\",\"Bernoullis\":\"ℬ\",\"Beta\":\"Β\",\"beta\":\"β\",\"beth\":\"ℶ\",\"between\":\"≬\",\"Bfr\":\"𝔅\",\"bfr\":\"𝔟\",\"bigcap\":\"⋂\",\"bigcirc\":\"◯\",\"bigcup\":\"⋃\",\"bigodot\":\"⨀\",\"bigoplus\":\"⨁\",\"bigotimes\":\"⨂\",\"bigsqcup\":\"⨆\",\"bigstar\":\"★\",\"bigtriangledown\":\"▽\",\"bigtriangleup\":\"△\",\"biguplus\":\"⨄\",\"bigvee\":\"⋁\",\"bigwedge\":\"⋀\",\"bkarow\":\"⤍\",\"blacklozenge\":\"⧫\",\"blacksquare\":\"▪\",\"blacktriangle\":\"▴\",\"blacktriangledown\":\"▾\",\"blacktriangleleft\":\"◂\",\"blacktriangleright\":\"▸\",\"blank\":\"␣\",\"blk12\":\"▒\",\"blk14\":\"░\",\"blk34\":\"▓\",\"block\":\"█\",\"bne\":\"=⃥\",\"bnequiv\":\"≡⃥\",\"bNot\":\"⫭\",\"bnot\":\"⌐\",\"Bopf\":\"𝔹\",\"bopf\":\"𝕓\",\"bot\":\"⊥\",\"bottom\":\"⊥\",\"bowtie\":\"⋈\",\"boxbox\":\"⧉\",\"boxdl\":\"┐\",\"boxdL\":\"╕\",\"boxDl\":\"╖\",\"boxDL\":\"╗\",\"boxdr\":\"┌\",\"boxdR\":\"╒\",\"boxDr\":\"╓\",\"boxDR\":\"╔\",\"boxh\":\"─\",\"boxH\":\"═\",\"boxhd\":\"┬\",\"boxHd\":\"╤\",\"boxhD\":\"╥\",\"boxHD\":\"╦\",\"boxhu\":\"┴\",\"boxHu\":\"╧\",\"boxhU\":\"╨\",\"boxHU\":\"╩\",\"boxminus\":\"⊟\",\"boxplus\":\"⊞\",\"boxtimes\":\"⊠\",\"boxul\":\"┘\",\"boxuL\":\"╛\",\"boxUl\":\"╜\",\"boxUL\":\"╝\",\"boxur\":\"└\",\"boxuR\":\"╘\",\"boxUr\":\"╙\",\"boxUR\":\"╚\",\"boxv\":\"│\",\"boxV\":\"║\",\"boxvh\":\"┼\",\"boxvH\":\"╪\",\"boxVh\":\"╫\",\"boxVH\":\"╬\",\"boxvl\":\"┤\",\"boxvL\":\"╡\",\"boxVl\":\"╢\",\"boxVL\":\"╣\",\"boxvr\":\"├\",\"boxvR\":\"╞\",\"boxVr\":\"╟\",\"boxVR\":\"╠\",\"bprime\":\"‵\",\"breve\":\"˘\",\"Breve\":\"˘\",\"brvbar\":\"¦\",\"bscr\":\"𝒷\",\"Bscr\":\"ℬ\",\"bsemi\":\"⁏\",\"bsim\":\"∽\",\"bsime\":\"⋍\",\"bsolb\":\"⧅\",\"bsol\":\"\\\\\",\"bsolhsub\":\"⟈\",\"bull\":\"•\",\"bullet\":\"•\",\"bump\":\"≎\",\"bumpE\":\"⪮\",\"bumpe\":\"≏\",\"Bumpeq\":\"≎\",\"bumpeq\":\"≏\",\"Cacute\":\"Ć\",\"cacute\":\"ć\",\"capand\":\"⩄\",\"capbrcup\":\"⩉\",\"capcap\":\"⩋\",\"cap\":\"∩\",\"Cap\":\"⋒\",\"capcup\":\"⩇\",\"capdot\":\"⩀\",\"CapitalDifferentialD\":\"ⅅ\",\"caps\":\"∩︀\",\"caret\":\"⁁\",\"caron\":\"ˇ\",\"Cayleys\":\"ℭ\",\"ccaps\":\"⩍\",\"Ccaron\":\"Č\",\"ccaron\":\"č\",\"Ccedil\":\"Ç\",\"ccedil\":\"ç\",\"Ccirc\":\"Ĉ\",\"ccirc\":\"ĉ\",\"Cconint\":\"∰\",\"ccups\":\"⩌\",\"ccupssm\":\"⩐\",\"Cdot\":\"Ċ\",\"cdot\":\"ċ\",\"cedil\":\"¸\",\"Cedilla\":\"¸\",\"cemptyv\":\"⦲\",\"cent\":\"¢\",\"centerdot\":\"·\",\"CenterDot\":\"·\",\"cfr\":\"𝔠\",\"Cfr\":\"ℭ\",\"CHcy\":\"Ч\",\"chcy\":\"ч\",\"check\":\"✓\",\"checkmark\":\"✓\",\"Chi\":\"Χ\",\"chi\":\"χ\",\"circ\":\"ˆ\",\"circeq\":\"≗\",\"circlearrowleft\":\"↺\",\"circlearrowright\":\"↻\",\"circledast\":\"⊛\",\"circledcirc\":\"⊚\",\"circleddash\":\"⊝\",\"CircleDot\":\"⊙\",\"circledR\":\"®\",\"circledS\":\"Ⓢ\",\"CircleMinus\":\"⊖\",\"CirclePlus\":\"⊕\",\"CircleTimes\":\"⊗\",\"cir\":\"○\",\"cirE\":\"⧃\",\"cire\":\"≗\",\"cirfnint\":\"⨐\",\"cirmid\":\"⫯\",\"cirscir\":\"⧂\",\"ClockwiseContourIntegral\":\"∲\",\"CloseCurlyDoubleQuote\":\"”\",\"CloseCurlyQuote\":\"’\",\"clubs\":\"♣\",\"clubsuit\":\"♣\",\"colon\":\":\",\"Colon\":\"∷\",\"Colone\":\"⩴\",\"colone\":\"≔\",\"coloneq\":\"≔\",\"comma\":\",\",\"commat\":\"@\",\"comp\":\"∁\",\"compfn\":\"∘\",\"complement\":\"∁\",\"complexes\":\"ℂ\",\"cong\":\"≅\",\"congdot\":\"⩭\",\"Congruent\":\"≡\",\"conint\":\"∮\",\"Conint\":\"∯\",\"ContourIntegral\":\"∮\",\"copf\":\"𝕔\",\"Copf\":\"ℂ\",\"coprod\":\"∐\",\"Coproduct\":\"∐\",\"copy\":\"©\",\"COPY\":\"©\",\"copysr\":\"℗\",\"CounterClockwiseContourIntegral\":\"∳\",\"crarr\":\"↵\",\"cross\":\"✗\",\"Cross\":\"⨯\",\"Cscr\":\"𝒞\",\"cscr\":\"𝒸\",\"csub\":\"⫏\",\"csube\":\"⫑\",\"csup\":\"⫐\",\"csupe\":\"⫒\",\"ctdot\":\"⋯\",\"cudarrl\":\"⤸\",\"cudarrr\":\"⤵\",\"cuepr\":\"⋞\",\"cuesc\":\"⋟\",\"cularr\":\"↶\",\"cularrp\":\"⤽\",\"cupbrcap\":\"⩈\",\"cupcap\":\"⩆\",\"CupCap\":\"≍\",\"cup\":\"∪\",\"Cup\":\"⋓\",\"cupcup\":\"⩊\",\"cupdot\":\"⊍\",\"cupor\":\"⩅\",\"cups\":\"∪︀\",\"curarr\":\"↷\",\"curarrm\":\"⤼\",\"curlyeqprec\":\"⋞\",\"curlyeqsucc\":\"⋟\",\"curlyvee\":\"⋎\",\"curlywedge\":\"⋏\",\"curren\":\"¤\",\"curvearrowleft\":\"↶\",\"curvearrowright\":\"↷\",\"cuvee\":\"⋎\",\"cuwed\":\"⋏\",\"cwconint\":\"∲\",\"cwint\":\"∱\",\"cylcty\":\"⌭\",\"dagger\":\"†\",\"Dagger\":\"‡\",\"daleth\":\"ℸ\",\"darr\":\"↓\",\"Darr\":\"↡\",\"dArr\":\"⇓\",\"dash\":\"‐\",\"Dashv\":\"⫤\",\"dashv\":\"⊣\",\"dbkarow\":\"⤏\",\"dblac\":\"˝\",\"Dcaron\":\"Ď\",\"dcaron\":\"ď\",\"Dcy\":\"Д\",\"dcy\":\"д\",\"ddagger\":\"‡\",\"ddarr\":\"⇊\",\"DD\":\"ⅅ\",\"dd\":\"ⅆ\",\"DDotrahd\":\"⤑\",\"ddotseq\":\"⩷\",\"deg\":\"°\",\"Del\":\"∇\",\"Delta\":\"Δ\",\"delta\":\"δ\",\"demptyv\":\"⦱\",\"dfisht\":\"⥿\",\"Dfr\":\"𝔇\",\"dfr\":\"𝔡\",\"dHar\":\"⥥\",\"dharl\":\"⇃\",\"dharr\":\"⇂\",\"DiacriticalAcute\":\"´\",\"DiacriticalDot\":\"˙\",\"DiacriticalDoubleAcute\":\"˝\",\"DiacriticalGrave\":\"`\",\"DiacriticalTilde\":\"˜\",\"diam\":\"⋄\",\"diamond\":\"⋄\",\"Diamond\":\"⋄\",\"diamondsuit\":\"♦\",\"diams\":\"♦\",\"die\":\"¨\",\"DifferentialD\":\"ⅆ\",\"digamma\":\"ϝ\",\"disin\":\"⋲\",\"div\":\"÷\",\"divide\":\"÷\",\"divideontimes\":\"⋇\",\"divonx\":\"⋇\",\"DJcy\":\"Ђ\",\"djcy\":\"ђ\",\"dlcorn\":\"⌞\",\"dlcrop\":\"⌍\",\"dollar\":\"$\",\"Dopf\":\"𝔻\",\"dopf\":\"𝕕\",\"Dot\":\"¨\",\"dot\":\"˙\",\"DotDot\":\"⃜\",\"doteq\":\"≐\",\"doteqdot\":\"≑\",\"DotEqual\":\"≐\",\"dotminus\":\"∸\",\"dotplus\":\"∔\",\"dotsquare\":\"⊡\",\"doublebarwedge\":\"⌆\",\"DoubleContourIntegral\":\"∯\",\"DoubleDot\":\"¨\",\"DoubleDownArrow\":\"⇓\",\"DoubleLeftArrow\":\"⇐\",\"DoubleLeftRightArrow\":\"⇔\",\"DoubleLeftTee\":\"⫤\",\"DoubleLongLeftArrow\":\"⟸\",\"DoubleLongLeftRightArrow\":\"⟺\",\"DoubleLongRightArrow\":\"⟹\",\"DoubleRightArrow\":\"⇒\",\"DoubleRightTee\":\"⊨\",\"DoubleUpArrow\":\"⇑\",\"DoubleUpDownArrow\":\"⇕\",\"DoubleVerticalBar\":\"∥\",\"DownArrowBar\":\"⤓\",\"downarrow\":\"↓\",\"DownArrow\":\"↓\",\"Downarrow\":\"⇓\",\"DownArrowUpArrow\":\"⇵\",\"DownBreve\":\"̑\",\"downdownarrows\":\"⇊\",\"downharpoonleft\":\"⇃\",\"downharpoonright\":\"⇂\",\"DownLeftRightVector\":\"⥐\",\"DownLeftTeeVector\":\"⥞\",\"DownLeftVectorBar\":\"⥖\",\"DownLeftVector\":\"↽\",\"DownRightTeeVector\":\"⥟\",\"DownRightVectorBar\":\"⥗\",\"DownRightVector\":\"⇁\",\"DownTeeArrow\":\"↧\",\"DownTee\":\"⊤\",\"drbkarow\":\"⤐\",\"drcorn\":\"⌟\",\"drcrop\":\"⌌\",\"Dscr\":\"𝒟\",\"dscr\":\"𝒹\",\"DScy\":\"Ѕ\",\"dscy\":\"ѕ\",\"dsol\":\"⧶\",\"Dstrok\":\"Đ\",\"dstrok\":\"đ\",\"dtdot\":\"⋱\",\"dtri\":\"▿\",\"dtrif\":\"▾\",\"duarr\":\"⇵\",\"duhar\":\"⥯\",\"dwangle\":\"⦦\",\"DZcy\":\"Џ\",\"dzcy\":\"џ\",\"dzigrarr\":\"⟿\",\"Eacute\":\"É\",\"eacute\":\"é\",\"easter\":\"⩮\",\"Ecaron\":\"Ě\",\"ecaron\":\"ě\",\"Ecirc\":\"Ê\",\"ecirc\":\"ê\",\"ecir\":\"≖\",\"ecolon\":\"≕\",\"Ecy\":\"Э\",\"ecy\":\"э\",\"eDDot\":\"⩷\",\"Edot\":\"Ė\",\"edot\":\"ė\",\"eDot\":\"≑\",\"ee\":\"ⅇ\",\"efDot\":\"≒\",\"Efr\":\"𝔈\",\"efr\":\"𝔢\",\"eg\":\"⪚\",\"Egrave\":\"È\",\"egrave\":\"è\",\"egs\":\"⪖\",\"egsdot\":\"⪘\",\"el\":\"⪙\",\"Element\":\"∈\",\"elinters\":\"⏧\",\"ell\":\"ℓ\",\"els\":\"⪕\",\"elsdot\":\"⪗\",\"Emacr\":\"Ē\",\"emacr\":\"ē\",\"empty\":\"∅\",\"emptyset\":\"∅\",\"EmptySmallSquare\":\"◻\",\"emptyv\":\"∅\",\"EmptyVerySmallSquare\":\"▫\",\"emsp13\":\" \",\"emsp14\":\" \",\"emsp\":\" \",\"ENG\":\"Ŋ\",\"eng\":\"ŋ\",\"ensp\":\" \",\"Eogon\":\"Ę\",\"eogon\":\"ę\",\"Eopf\":\"𝔼\",\"eopf\":\"𝕖\",\"epar\":\"⋕\",\"eparsl\":\"⧣\",\"eplus\":\"⩱\",\"epsi\":\"ε\",\"Epsilon\":\"Ε\",\"epsilon\":\"ε\",\"epsiv\":\"ϵ\",\"eqcirc\":\"≖\",\"eqcolon\":\"≕\",\"eqsim\":\"≂\",\"eqslantgtr\":\"⪖\",\"eqslantless\":\"⪕\",\"Equal\":\"⩵\",\"equals\":\"=\",\"EqualTilde\":\"≂\",\"equest\":\"≟\",\"Equilibrium\":\"⇌\",\"equiv\":\"≡\",\"equivDD\":\"⩸\",\"eqvparsl\":\"⧥\",\"erarr\":\"⥱\",\"erDot\":\"≓\",\"escr\":\"ℯ\",\"Escr\":\"ℰ\",\"esdot\":\"≐\",\"Esim\":\"⩳\",\"esim\":\"≂\",\"Eta\":\"Η\",\"eta\":\"η\",\"ETH\":\"Ð\",\"eth\":\"ð\",\"Euml\":\"Ë\",\"euml\":\"ë\",\"euro\":\"€\",\"excl\":\"!\",\"exist\":\"∃\",\"Exists\":\"∃\",\"expectation\":\"ℰ\",\"exponentiale\":\"ⅇ\",\"ExponentialE\":\"ⅇ\",\"fallingdotseq\":\"≒\",\"Fcy\":\"Ф\",\"fcy\":\"ф\",\"female\":\"♀\",\"ffilig\":\"ffi\",\"fflig\":\"ff\",\"ffllig\":\"ffl\",\"Ffr\":\"𝔉\",\"ffr\":\"𝔣\",\"filig\":\"fi\",\"FilledSmallSquare\":\"◼\",\"FilledVerySmallSquare\":\"▪\",\"fjlig\":\"fj\",\"flat\":\"♭\",\"fllig\":\"fl\",\"fltns\":\"▱\",\"fnof\":\"ƒ\",\"Fopf\":\"𝔽\",\"fopf\":\"𝕗\",\"forall\":\"∀\",\"ForAll\":\"∀\",\"fork\":\"⋔\",\"forkv\":\"⫙\",\"Fouriertrf\":\"ℱ\",\"fpartint\":\"⨍\",\"frac12\":\"½\",\"frac13\":\"⅓\",\"frac14\":\"¼\",\"frac15\":\"⅕\",\"frac16\":\"⅙\",\"frac18\":\"⅛\",\"frac23\":\"⅔\",\"frac25\":\"⅖\",\"frac34\":\"¾\",\"frac35\":\"⅗\",\"frac38\":\"⅜\",\"frac45\":\"⅘\",\"frac56\":\"⅚\",\"frac58\":\"⅝\",\"frac78\":\"⅞\",\"frasl\":\"⁄\",\"frown\":\"⌢\",\"fscr\":\"𝒻\",\"Fscr\":\"ℱ\",\"gacute\":\"ǵ\",\"Gamma\":\"Γ\",\"gamma\":\"γ\",\"Gammad\":\"Ϝ\",\"gammad\":\"ϝ\",\"gap\":\"⪆\",\"Gbreve\":\"Ğ\",\"gbreve\":\"ğ\",\"Gcedil\":\"Ģ\",\"Gcirc\":\"Ĝ\",\"gcirc\":\"ĝ\",\"Gcy\":\"Г\",\"gcy\":\"г\",\"Gdot\":\"Ġ\",\"gdot\":\"ġ\",\"ge\":\"≥\",\"gE\":\"≧\",\"gEl\":\"⪌\",\"gel\":\"⋛\",\"geq\":\"≥\",\"geqq\":\"≧\",\"geqslant\":\"⩾\",\"gescc\":\"⪩\",\"ges\":\"⩾\",\"gesdot\":\"⪀\",\"gesdoto\":\"⪂\",\"gesdotol\":\"⪄\",\"gesl\":\"⋛︀\",\"gesles\":\"⪔\",\"Gfr\":\"𝔊\",\"gfr\":\"𝔤\",\"gg\":\"≫\",\"Gg\":\"⋙\",\"ggg\":\"⋙\",\"gimel\":\"ℷ\",\"GJcy\":\"Ѓ\",\"gjcy\":\"ѓ\",\"gla\":\"⪥\",\"gl\":\"≷\",\"glE\":\"⪒\",\"glj\":\"⪤\",\"gnap\":\"⪊\",\"gnapprox\":\"⪊\",\"gne\":\"⪈\",\"gnE\":\"≩\",\"gneq\":\"⪈\",\"gneqq\":\"≩\",\"gnsim\":\"⋧\",\"Gopf\":\"𝔾\",\"gopf\":\"𝕘\",\"grave\":\"`\",\"GreaterEqual\":\"≥\",\"GreaterEqualLess\":\"⋛\",\"GreaterFullEqual\":\"≧\",\"GreaterGreater\":\"⪢\",\"GreaterLess\":\"≷\",\"GreaterSlantEqual\":\"⩾\",\"GreaterTilde\":\"≳\",\"Gscr\":\"𝒢\",\"gscr\":\"ℊ\",\"gsim\":\"≳\",\"gsime\":\"⪎\",\"gsiml\":\"⪐\",\"gtcc\":\"⪧\",\"gtcir\":\"⩺\",\"gt\":\">\",\"GT\":\">\",\"Gt\":\"≫\",\"gtdot\":\"⋗\",\"gtlPar\":\"⦕\",\"gtquest\":\"⩼\",\"gtrapprox\":\"⪆\",\"gtrarr\":\"⥸\",\"gtrdot\":\"⋗\",\"gtreqless\":\"⋛\",\"gtreqqless\":\"⪌\",\"gtrless\":\"≷\",\"gtrsim\":\"≳\",\"gvertneqq\":\"≩︀\",\"gvnE\":\"≩︀\",\"Hacek\":\"ˇ\",\"hairsp\":\" \",\"half\":\"½\",\"hamilt\":\"ℋ\",\"HARDcy\":\"Ъ\",\"hardcy\":\"ъ\",\"harrcir\":\"⥈\",\"harr\":\"↔\",\"hArr\":\"⇔\",\"harrw\":\"↭\",\"Hat\":\"^\",\"hbar\":\"ℏ\",\"Hcirc\":\"Ĥ\",\"hcirc\":\"ĥ\",\"hearts\":\"♥\",\"heartsuit\":\"♥\",\"hellip\":\"…\",\"hercon\":\"⊹\",\"hfr\":\"𝔥\",\"Hfr\":\"ℌ\",\"HilbertSpace\":\"ℋ\",\"hksearow\":\"⤥\",\"hkswarow\":\"⤦\",\"hoarr\":\"⇿\",\"homtht\":\"∻\",\"hookleftarrow\":\"↩\",\"hookrightarrow\":\"↪\",\"hopf\":\"𝕙\",\"Hopf\":\"ℍ\",\"horbar\":\"―\",\"HorizontalLine\":\"─\",\"hscr\":\"𝒽\",\"Hscr\":\"ℋ\",\"hslash\":\"ℏ\",\"Hstrok\":\"Ħ\",\"hstrok\":\"ħ\",\"HumpDownHump\":\"≎\",\"HumpEqual\":\"≏\",\"hybull\":\"⁃\",\"hyphen\":\"‐\",\"Iacute\":\"Í\",\"iacute\":\"í\",\"ic\":\"⁣\",\"Icirc\":\"Î\",\"icirc\":\"î\",\"Icy\":\"И\",\"icy\":\"и\",\"Idot\":\"İ\",\"IEcy\":\"Е\",\"iecy\":\"е\",\"iexcl\":\"¡\",\"iff\":\"⇔\",\"ifr\":\"𝔦\",\"Ifr\":\"ℑ\",\"Igrave\":\"Ì\",\"igrave\":\"ì\",\"ii\":\"ⅈ\",\"iiiint\":\"⨌\",\"iiint\":\"∭\",\"iinfin\":\"⧜\",\"iiota\":\"℩\",\"IJlig\":\"IJ\",\"ijlig\":\"ij\",\"Imacr\":\"Ī\",\"imacr\":\"ī\",\"image\":\"ℑ\",\"ImaginaryI\":\"ⅈ\",\"imagline\":\"ℐ\",\"imagpart\":\"ℑ\",\"imath\":\"ı\",\"Im\":\"ℑ\",\"imof\":\"⊷\",\"imped\":\"Ƶ\",\"Implies\":\"⇒\",\"incare\":\"℅\",\"in\":\"∈\",\"infin\":\"∞\",\"infintie\":\"⧝\",\"inodot\":\"ı\",\"intcal\":\"⊺\",\"int\":\"∫\",\"Int\":\"∬\",\"integers\":\"ℤ\",\"Integral\":\"∫\",\"intercal\":\"⊺\",\"Intersection\":\"⋂\",\"intlarhk\":\"⨗\",\"intprod\":\"⨼\",\"InvisibleComma\":\"⁣\",\"InvisibleTimes\":\"⁢\",\"IOcy\":\"Ё\",\"iocy\":\"ё\",\"Iogon\":\"Į\",\"iogon\":\"į\",\"Iopf\":\"𝕀\",\"iopf\":\"𝕚\",\"Iota\":\"Ι\",\"iota\":\"ι\",\"iprod\":\"⨼\",\"iquest\":\"¿\",\"iscr\":\"𝒾\",\"Iscr\":\"ℐ\",\"isin\":\"∈\",\"isindot\":\"⋵\",\"isinE\":\"⋹\",\"isins\":\"⋴\",\"isinsv\":\"⋳\",\"isinv\":\"∈\",\"it\":\"⁢\",\"Itilde\":\"Ĩ\",\"itilde\":\"ĩ\",\"Iukcy\":\"І\",\"iukcy\":\"і\",\"Iuml\":\"Ï\",\"iuml\":\"ï\",\"Jcirc\":\"Ĵ\",\"jcirc\":\"ĵ\",\"Jcy\":\"Й\",\"jcy\":\"й\",\"Jfr\":\"𝔍\",\"jfr\":\"𝔧\",\"jmath\":\"ȷ\",\"Jopf\":\"𝕁\",\"jopf\":\"𝕛\",\"Jscr\":\"𝒥\",\"jscr\":\"𝒿\",\"Jsercy\":\"Ј\",\"jsercy\":\"ј\",\"Jukcy\":\"Є\",\"jukcy\":\"є\",\"Kappa\":\"Κ\",\"kappa\":\"κ\",\"kappav\":\"ϰ\",\"Kcedil\":\"Ķ\",\"kcedil\":\"ķ\",\"Kcy\":\"К\",\"kcy\":\"к\",\"Kfr\":\"𝔎\",\"kfr\":\"𝔨\",\"kgreen\":\"ĸ\",\"KHcy\":\"Х\",\"khcy\":\"х\",\"KJcy\":\"Ќ\",\"kjcy\":\"ќ\",\"Kopf\":\"𝕂\",\"kopf\":\"𝕜\",\"Kscr\":\"𝒦\",\"kscr\":\"𝓀\",\"lAarr\":\"⇚\",\"Lacute\":\"Ĺ\",\"lacute\":\"ĺ\",\"laemptyv\":\"⦴\",\"lagran\":\"ℒ\",\"Lambda\":\"Λ\",\"lambda\":\"λ\",\"lang\":\"⟨\",\"Lang\":\"⟪\",\"langd\":\"⦑\",\"langle\":\"⟨\",\"lap\":\"⪅\",\"Laplacetrf\":\"ℒ\",\"laquo\":\"«\",\"larrb\":\"⇤\",\"larrbfs\":\"⤟\",\"larr\":\"←\",\"Larr\":\"↞\",\"lArr\":\"⇐\",\"larrfs\":\"⤝\",\"larrhk\":\"↩\",\"larrlp\":\"↫\",\"larrpl\":\"⤹\",\"larrsim\":\"⥳\",\"larrtl\":\"↢\",\"latail\":\"⤙\",\"lAtail\":\"⤛\",\"lat\":\"⪫\",\"late\":\"⪭\",\"lates\":\"⪭︀\",\"lbarr\":\"⤌\",\"lBarr\":\"⤎\",\"lbbrk\":\"❲\",\"lbrace\":\"{\",\"lbrack\":\"[\",\"lbrke\":\"⦋\",\"lbrksld\":\"⦏\",\"lbrkslu\":\"⦍\",\"Lcaron\":\"Ľ\",\"lcaron\":\"ľ\",\"Lcedil\":\"Ļ\",\"lcedil\":\"ļ\",\"lceil\":\"⌈\",\"lcub\":\"{\",\"Lcy\":\"Л\",\"lcy\":\"л\",\"ldca\":\"⤶\",\"ldquo\":\"“\",\"ldquor\":\"„\",\"ldrdhar\":\"⥧\",\"ldrushar\":\"⥋\",\"ldsh\":\"↲\",\"le\":\"≤\",\"lE\":\"≦\",\"LeftAngleBracket\":\"⟨\",\"LeftArrowBar\":\"⇤\",\"leftarrow\":\"←\",\"LeftArrow\":\"←\",\"Leftarrow\":\"⇐\",\"LeftArrowRightArrow\":\"⇆\",\"leftarrowtail\":\"↢\",\"LeftCeiling\":\"⌈\",\"LeftDoubleBracket\":\"⟦\",\"LeftDownTeeVector\":\"⥡\",\"LeftDownVectorBar\":\"⥙\",\"LeftDownVector\":\"⇃\",\"LeftFloor\":\"⌊\",\"leftharpoondown\":\"↽\",\"leftharpoonup\":\"↼\",\"leftleftarrows\":\"⇇\",\"leftrightarrow\":\"↔\",\"LeftRightArrow\":\"↔\",\"Leftrightarrow\":\"⇔\",\"leftrightarrows\":\"⇆\",\"leftrightharpoons\":\"⇋\",\"leftrightsquigarrow\":\"↭\",\"LeftRightVector\":\"⥎\",\"LeftTeeArrow\":\"↤\",\"LeftTee\":\"⊣\",\"LeftTeeVector\":\"⥚\",\"leftthreetimes\":\"⋋\",\"LeftTriangleBar\":\"⧏\",\"LeftTriangle\":\"⊲\",\"LeftTriangleEqual\":\"⊴\",\"LeftUpDownVector\":\"⥑\",\"LeftUpTeeVector\":\"⥠\",\"LeftUpVectorBar\":\"⥘\",\"LeftUpVector\":\"↿\",\"LeftVectorBar\":\"⥒\",\"LeftVector\":\"↼\",\"lEg\":\"⪋\",\"leg\":\"⋚\",\"leq\":\"≤\",\"leqq\":\"≦\",\"leqslant\":\"⩽\",\"lescc\":\"⪨\",\"les\":\"⩽\",\"lesdot\":\"⩿\",\"lesdoto\":\"⪁\",\"lesdotor\":\"⪃\",\"lesg\":\"⋚︀\",\"lesges\":\"⪓\",\"lessapprox\":\"⪅\",\"lessdot\":\"⋖\",\"lesseqgtr\":\"⋚\",\"lesseqqgtr\":\"⪋\",\"LessEqualGreater\":\"⋚\",\"LessFullEqual\":\"≦\",\"LessGreater\":\"≶\",\"lessgtr\":\"≶\",\"LessLess\":\"⪡\",\"lesssim\":\"≲\",\"LessSlantEqual\":\"⩽\",\"LessTilde\":\"≲\",\"lfisht\":\"⥼\",\"lfloor\":\"⌊\",\"Lfr\":\"𝔏\",\"lfr\":\"𝔩\",\"lg\":\"≶\",\"lgE\":\"⪑\",\"lHar\":\"⥢\",\"lhard\":\"↽\",\"lharu\":\"↼\",\"lharul\":\"⥪\",\"lhblk\":\"▄\",\"LJcy\":\"Љ\",\"ljcy\":\"љ\",\"llarr\":\"⇇\",\"ll\":\"≪\",\"Ll\":\"⋘\",\"llcorner\":\"⌞\",\"Lleftarrow\":\"⇚\",\"llhard\":\"⥫\",\"lltri\":\"◺\",\"Lmidot\":\"Ŀ\",\"lmidot\":\"ŀ\",\"lmoustache\":\"⎰\",\"lmoust\":\"⎰\",\"lnap\":\"⪉\",\"lnapprox\":\"⪉\",\"lne\":\"⪇\",\"lnE\":\"≨\",\"lneq\":\"⪇\",\"lneqq\":\"≨\",\"lnsim\":\"⋦\",\"loang\":\"⟬\",\"loarr\":\"⇽\",\"lobrk\":\"⟦\",\"longleftarrow\":\"⟵\",\"LongLeftArrow\":\"⟵\",\"Longleftarrow\":\"⟸\",\"longleftrightarrow\":\"⟷\",\"LongLeftRightArrow\":\"⟷\",\"Longleftrightarrow\":\"⟺\",\"longmapsto\":\"⟼\",\"longrightarrow\":\"⟶\",\"LongRightArrow\":\"⟶\",\"Longrightarrow\":\"⟹\",\"looparrowleft\":\"↫\",\"looparrowright\":\"↬\",\"lopar\":\"⦅\",\"Lopf\":\"𝕃\",\"lopf\":\"𝕝\",\"loplus\":\"⨭\",\"lotimes\":\"⨴\",\"lowast\":\"∗\",\"lowbar\":\"_\",\"LowerLeftArrow\":\"↙\",\"LowerRightArrow\":\"↘\",\"loz\":\"◊\",\"lozenge\":\"◊\",\"lozf\":\"⧫\",\"lpar\":\"(\",\"lparlt\":\"⦓\",\"lrarr\":\"⇆\",\"lrcorner\":\"⌟\",\"lrhar\":\"⇋\",\"lrhard\":\"⥭\",\"lrm\":\"‎\",\"lrtri\":\"⊿\",\"lsaquo\":\"‹\",\"lscr\":\"𝓁\",\"Lscr\":\"ℒ\",\"lsh\":\"↰\",\"Lsh\":\"↰\",\"lsim\":\"≲\",\"lsime\":\"⪍\",\"lsimg\":\"⪏\",\"lsqb\":\"[\",\"lsquo\":\"‘\",\"lsquor\":\"‚\",\"Lstrok\":\"Ł\",\"lstrok\":\"ł\",\"ltcc\":\"⪦\",\"ltcir\":\"⩹\",\"lt\":\"<\",\"LT\":\"<\",\"Lt\":\"≪\",\"ltdot\":\"⋖\",\"lthree\":\"⋋\",\"ltimes\":\"⋉\",\"ltlarr\":\"⥶\",\"ltquest\":\"⩻\",\"ltri\":\"◃\",\"ltrie\":\"⊴\",\"ltrif\":\"◂\",\"ltrPar\":\"⦖\",\"lurdshar\":\"⥊\",\"luruhar\":\"⥦\",\"lvertneqq\":\"≨︀\",\"lvnE\":\"≨︀\",\"macr\":\"¯\",\"male\":\"♂\",\"malt\":\"✠\",\"maltese\":\"✠\",\"Map\":\"⤅\",\"map\":\"↦\",\"mapsto\":\"↦\",\"mapstodown\":\"↧\",\"mapstoleft\":\"↤\",\"mapstoup\":\"↥\",\"marker\":\"▮\",\"mcomma\":\"⨩\",\"Mcy\":\"М\",\"mcy\":\"м\",\"mdash\":\"—\",\"mDDot\":\"∺\",\"measuredangle\":\"∡\",\"MediumSpace\":\" \",\"Mellintrf\":\"ℳ\",\"Mfr\":\"𝔐\",\"mfr\":\"𝔪\",\"mho\":\"℧\",\"micro\":\"µ\",\"midast\":\"*\",\"midcir\":\"⫰\",\"mid\":\"∣\",\"middot\":\"·\",\"minusb\":\"⊟\",\"minus\":\"−\",\"minusd\":\"∸\",\"minusdu\":\"⨪\",\"MinusPlus\":\"∓\",\"mlcp\":\"⫛\",\"mldr\":\"…\",\"mnplus\":\"∓\",\"models\":\"⊧\",\"Mopf\":\"𝕄\",\"mopf\":\"𝕞\",\"mp\":\"∓\",\"mscr\":\"𝓂\",\"Mscr\":\"ℳ\",\"mstpos\":\"∾\",\"Mu\":\"Μ\",\"mu\":\"μ\",\"multimap\":\"⊸\",\"mumap\":\"⊸\",\"nabla\":\"∇\",\"Nacute\":\"Ń\",\"nacute\":\"ń\",\"nang\":\"∠⃒\",\"nap\":\"≉\",\"napE\":\"⩰̸\",\"napid\":\"≋̸\",\"napos\":\"ʼn\",\"napprox\":\"≉\",\"natural\":\"♮\",\"naturals\":\"ℕ\",\"natur\":\"♮\",\"nbsp\":\" \",\"nbump\":\"≎̸\",\"nbumpe\":\"≏̸\",\"ncap\":\"⩃\",\"Ncaron\":\"Ň\",\"ncaron\":\"ň\",\"Ncedil\":\"Ņ\",\"ncedil\":\"ņ\",\"ncong\":\"≇\",\"ncongdot\":\"⩭̸\",\"ncup\":\"⩂\",\"Ncy\":\"Н\",\"ncy\":\"н\",\"ndash\":\"–\",\"nearhk\":\"⤤\",\"nearr\":\"↗\",\"neArr\":\"⇗\",\"nearrow\":\"↗\",\"ne\":\"≠\",\"nedot\":\"≐̸\",\"NegativeMediumSpace\":\"​\",\"NegativeThickSpace\":\"​\",\"NegativeThinSpace\":\"​\",\"NegativeVeryThinSpace\":\"​\",\"nequiv\":\"≢\",\"nesear\":\"⤨\",\"nesim\":\"≂̸\",\"NestedGreaterGreater\":\"≫\",\"NestedLessLess\":\"≪\",\"NewLine\":\"\\n\",\"nexist\":\"∄\",\"nexists\":\"∄\",\"Nfr\":\"𝔑\",\"nfr\":\"𝔫\",\"ngE\":\"≧̸\",\"nge\":\"≱\",\"ngeq\":\"≱\",\"ngeqq\":\"≧̸\",\"ngeqslant\":\"⩾̸\",\"nges\":\"⩾̸\",\"nGg\":\"⋙̸\",\"ngsim\":\"≵\",\"nGt\":\"≫⃒\",\"ngt\":\"≯\",\"ngtr\":\"≯\",\"nGtv\":\"≫̸\",\"nharr\":\"↮\",\"nhArr\":\"⇎\",\"nhpar\":\"⫲\",\"ni\":\"∋\",\"nis\":\"⋼\",\"nisd\":\"⋺\",\"niv\":\"∋\",\"NJcy\":\"Њ\",\"njcy\":\"њ\",\"nlarr\":\"↚\",\"nlArr\":\"⇍\",\"nldr\":\"‥\",\"nlE\":\"≦̸\",\"nle\":\"≰\",\"nleftarrow\":\"↚\",\"nLeftarrow\":\"⇍\",\"nleftrightarrow\":\"↮\",\"nLeftrightarrow\":\"⇎\",\"nleq\":\"≰\",\"nleqq\":\"≦̸\",\"nleqslant\":\"⩽̸\",\"nles\":\"⩽̸\",\"nless\":\"≮\",\"nLl\":\"⋘̸\",\"nlsim\":\"≴\",\"nLt\":\"≪⃒\",\"nlt\":\"≮\",\"nltri\":\"⋪\",\"nltrie\":\"⋬\",\"nLtv\":\"≪̸\",\"nmid\":\"∤\",\"NoBreak\":\"⁠\",\"NonBreakingSpace\":\" \",\"nopf\":\"𝕟\",\"Nopf\":\"ℕ\",\"Not\":\"⫬\",\"not\":\"¬\",\"NotCongruent\":\"≢\",\"NotCupCap\":\"≭\",\"NotDoubleVerticalBar\":\"∦\",\"NotElement\":\"∉\",\"NotEqual\":\"≠\",\"NotEqualTilde\":\"≂̸\",\"NotExists\":\"∄\",\"NotGreater\":\"≯\",\"NotGreaterEqual\":\"≱\",\"NotGreaterFullEqual\":\"≧̸\",\"NotGreaterGreater\":\"≫̸\",\"NotGreaterLess\":\"≹\",\"NotGreaterSlantEqual\":\"⩾̸\",\"NotGreaterTilde\":\"≵\",\"NotHumpDownHump\":\"≎̸\",\"NotHumpEqual\":\"≏̸\",\"notin\":\"∉\",\"notindot\":\"⋵̸\",\"notinE\":\"⋹̸\",\"notinva\":\"∉\",\"notinvb\":\"⋷\",\"notinvc\":\"⋶\",\"NotLeftTriangleBar\":\"⧏̸\",\"NotLeftTriangle\":\"⋪\",\"NotLeftTriangleEqual\":\"⋬\",\"NotLess\":\"≮\",\"NotLessEqual\":\"≰\",\"NotLessGreater\":\"≸\",\"NotLessLess\":\"≪̸\",\"NotLessSlantEqual\":\"⩽̸\",\"NotLessTilde\":\"≴\",\"NotNestedGreaterGreater\":\"⪢̸\",\"NotNestedLessLess\":\"⪡̸\",\"notni\":\"∌\",\"notniva\":\"∌\",\"notnivb\":\"⋾\",\"notnivc\":\"⋽\",\"NotPrecedes\":\"⊀\",\"NotPrecedesEqual\":\"⪯̸\",\"NotPrecedesSlantEqual\":\"⋠\",\"NotReverseElement\":\"∌\",\"NotRightTriangleBar\":\"⧐̸\",\"NotRightTriangle\":\"⋫\",\"NotRightTriangleEqual\":\"⋭\",\"NotSquareSubset\":\"⊏̸\",\"NotSquareSubsetEqual\":\"⋢\",\"NotSquareSuperset\":\"⊐̸\",\"NotSquareSupersetEqual\":\"⋣\",\"NotSubset\":\"⊂⃒\",\"NotSubsetEqual\":\"⊈\",\"NotSucceeds\":\"⊁\",\"NotSucceedsEqual\":\"⪰̸\",\"NotSucceedsSlantEqual\":\"⋡\",\"NotSucceedsTilde\":\"≿̸\",\"NotSuperset\":\"⊃⃒\",\"NotSupersetEqual\":\"⊉\",\"NotTilde\":\"≁\",\"NotTildeEqual\":\"≄\",\"NotTildeFullEqual\":\"≇\",\"NotTildeTilde\":\"≉\",\"NotVerticalBar\":\"∤\",\"nparallel\":\"∦\",\"npar\":\"∦\",\"nparsl\":\"⫽⃥\",\"npart\":\"∂̸\",\"npolint\":\"⨔\",\"npr\":\"⊀\",\"nprcue\":\"⋠\",\"nprec\":\"⊀\",\"npreceq\":\"⪯̸\",\"npre\":\"⪯̸\",\"nrarrc\":\"⤳̸\",\"nrarr\":\"↛\",\"nrArr\":\"⇏\",\"nrarrw\":\"↝̸\",\"nrightarrow\":\"↛\",\"nRightarrow\":\"⇏\",\"nrtri\":\"⋫\",\"nrtrie\":\"⋭\",\"nsc\":\"⊁\",\"nsccue\":\"⋡\",\"nsce\":\"⪰̸\",\"Nscr\":\"𝒩\",\"nscr\":\"𝓃\",\"nshortmid\":\"∤\",\"nshortparallel\":\"∦\",\"nsim\":\"≁\",\"nsime\":\"≄\",\"nsimeq\":\"≄\",\"nsmid\":\"∤\",\"nspar\":\"∦\",\"nsqsube\":\"⋢\",\"nsqsupe\":\"⋣\",\"nsub\":\"⊄\",\"nsubE\":\"⫅̸\",\"nsube\":\"⊈\",\"nsubset\":\"⊂⃒\",\"nsubseteq\":\"⊈\",\"nsubseteqq\":\"⫅̸\",\"nsucc\":\"⊁\",\"nsucceq\":\"⪰̸\",\"nsup\":\"⊅\",\"nsupE\":\"⫆̸\",\"nsupe\":\"⊉\",\"nsupset\":\"⊃⃒\",\"nsupseteq\":\"⊉\",\"nsupseteqq\":\"⫆̸\",\"ntgl\":\"≹\",\"Ntilde\":\"Ñ\",\"ntilde\":\"ñ\",\"ntlg\":\"≸\",\"ntriangleleft\":\"⋪\",\"ntrianglelefteq\":\"⋬\",\"ntriangleright\":\"⋫\",\"ntrianglerighteq\":\"⋭\",\"Nu\":\"Ν\",\"nu\":\"ν\",\"num\":\"#\",\"numero\":\"№\",\"numsp\":\" \",\"nvap\":\"≍⃒\",\"nvdash\":\"⊬\",\"nvDash\":\"⊭\",\"nVdash\":\"⊮\",\"nVDash\":\"⊯\",\"nvge\":\"≥⃒\",\"nvgt\":\">⃒\",\"nvHarr\":\"⤄\",\"nvinfin\":\"⧞\",\"nvlArr\":\"⤂\",\"nvle\":\"≤⃒\",\"nvlt\":\"<⃒\",\"nvltrie\":\"⊴⃒\",\"nvrArr\":\"⤃\",\"nvrtrie\":\"⊵⃒\",\"nvsim\":\"∼⃒\",\"nwarhk\":\"⤣\",\"nwarr\":\"↖\",\"nwArr\":\"⇖\",\"nwarrow\":\"↖\",\"nwnear\":\"⤧\",\"Oacute\":\"Ó\",\"oacute\":\"ó\",\"oast\":\"⊛\",\"Ocirc\":\"Ô\",\"ocirc\":\"ô\",\"ocir\":\"⊚\",\"Ocy\":\"О\",\"ocy\":\"о\",\"odash\":\"⊝\",\"Odblac\":\"Ő\",\"odblac\":\"ő\",\"odiv\":\"⨸\",\"odot\":\"⊙\",\"odsold\":\"⦼\",\"OElig\":\"Œ\",\"oelig\":\"œ\",\"ofcir\":\"⦿\",\"Ofr\":\"𝔒\",\"ofr\":\"𝔬\",\"ogon\":\"˛\",\"Ograve\":\"Ò\",\"ograve\":\"ò\",\"ogt\":\"⧁\",\"ohbar\":\"⦵\",\"ohm\":\"Ω\",\"oint\":\"∮\",\"olarr\":\"↺\",\"olcir\":\"⦾\",\"olcross\":\"⦻\",\"oline\":\"‾\",\"olt\":\"⧀\",\"Omacr\":\"Ō\",\"omacr\":\"ō\",\"Omega\":\"Ω\",\"omega\":\"ω\",\"Omicron\":\"Ο\",\"omicron\":\"ο\",\"omid\":\"⦶\",\"ominus\":\"⊖\",\"Oopf\":\"𝕆\",\"oopf\":\"𝕠\",\"opar\":\"⦷\",\"OpenCurlyDoubleQuote\":\"“\",\"OpenCurlyQuote\":\"‘\",\"operp\":\"⦹\",\"oplus\":\"⊕\",\"orarr\":\"↻\",\"Or\":\"⩔\",\"or\":\"∨\",\"ord\":\"⩝\",\"order\":\"ℴ\",\"orderof\":\"ℴ\",\"ordf\":\"ª\",\"ordm\":\"º\",\"origof\":\"⊶\",\"oror\":\"⩖\",\"orslope\":\"⩗\",\"orv\":\"⩛\",\"oS\":\"Ⓢ\",\"Oscr\":\"𝒪\",\"oscr\":\"ℴ\",\"Oslash\":\"Ø\",\"oslash\":\"ø\",\"osol\":\"⊘\",\"Otilde\":\"Õ\",\"otilde\":\"õ\",\"otimesas\":\"⨶\",\"Otimes\":\"⨷\",\"otimes\":\"⊗\",\"Ouml\":\"Ö\",\"ouml\":\"ö\",\"ovbar\":\"⌽\",\"OverBar\":\"‾\",\"OverBrace\":\"⏞\",\"OverBracket\":\"⎴\",\"OverParenthesis\":\"⏜\",\"para\":\"¶\",\"parallel\":\"∥\",\"par\":\"∥\",\"parsim\":\"⫳\",\"parsl\":\"⫽\",\"part\":\"∂\",\"PartialD\":\"∂\",\"Pcy\":\"П\",\"pcy\":\"п\",\"percnt\":\"%\",\"period\":\".\",\"permil\":\"‰\",\"perp\":\"⊥\",\"pertenk\":\"‱\",\"Pfr\":\"𝔓\",\"pfr\":\"𝔭\",\"Phi\":\"Φ\",\"phi\":\"φ\",\"phiv\":\"ϕ\",\"phmmat\":\"ℳ\",\"phone\":\"☎\",\"Pi\":\"Π\",\"pi\":\"π\",\"pitchfork\":\"⋔\",\"piv\":\"ϖ\",\"planck\":\"ℏ\",\"planckh\":\"ℎ\",\"plankv\":\"ℏ\",\"plusacir\":\"⨣\",\"plusb\":\"⊞\",\"pluscir\":\"⨢\",\"plus\":\"+\",\"plusdo\":\"∔\",\"plusdu\":\"⨥\",\"pluse\":\"⩲\",\"PlusMinus\":\"±\",\"plusmn\":\"±\",\"plussim\":\"⨦\",\"plustwo\":\"⨧\",\"pm\":\"±\",\"Poincareplane\":\"ℌ\",\"pointint\":\"⨕\",\"popf\":\"𝕡\",\"Popf\":\"ℙ\",\"pound\":\"£\",\"prap\":\"⪷\",\"Pr\":\"⪻\",\"pr\":\"≺\",\"prcue\":\"≼\",\"precapprox\":\"⪷\",\"prec\":\"≺\",\"preccurlyeq\":\"≼\",\"Precedes\":\"≺\",\"PrecedesEqual\":\"⪯\",\"PrecedesSlantEqual\":\"≼\",\"PrecedesTilde\":\"≾\",\"preceq\":\"⪯\",\"precnapprox\":\"⪹\",\"precneqq\":\"⪵\",\"precnsim\":\"⋨\",\"pre\":\"⪯\",\"prE\":\"⪳\",\"precsim\":\"≾\",\"prime\":\"′\",\"Prime\":\"″\",\"primes\":\"ℙ\",\"prnap\":\"⪹\",\"prnE\":\"⪵\",\"prnsim\":\"⋨\",\"prod\":\"∏\",\"Product\":\"∏\",\"profalar\":\"⌮\",\"profline\":\"⌒\",\"profsurf\":\"⌓\",\"prop\":\"∝\",\"Proportional\":\"∝\",\"Proportion\":\"∷\",\"propto\":\"∝\",\"prsim\":\"≾\",\"prurel\":\"⊰\",\"Pscr\":\"𝒫\",\"pscr\":\"𝓅\",\"Psi\":\"Ψ\",\"psi\":\"ψ\",\"puncsp\":\" \",\"Qfr\":\"𝔔\",\"qfr\":\"𝔮\",\"qint\":\"⨌\",\"qopf\":\"𝕢\",\"Qopf\":\"ℚ\",\"qprime\":\"⁗\",\"Qscr\":\"𝒬\",\"qscr\":\"𝓆\",\"quaternions\":\"ℍ\",\"quatint\":\"⨖\",\"quest\":\"?\",\"questeq\":\"≟\",\"quot\":\"\\\"\",\"QUOT\":\"\\\"\",\"rAarr\":\"⇛\",\"race\":\"∽̱\",\"Racute\":\"Ŕ\",\"racute\":\"ŕ\",\"radic\":\"√\",\"raemptyv\":\"⦳\",\"rang\":\"⟩\",\"Rang\":\"⟫\",\"rangd\":\"⦒\",\"range\":\"⦥\",\"rangle\":\"⟩\",\"raquo\":\"»\",\"rarrap\":\"⥵\",\"rarrb\":\"⇥\",\"rarrbfs\":\"⤠\",\"rarrc\":\"⤳\",\"rarr\":\"→\",\"Rarr\":\"↠\",\"rArr\":\"⇒\",\"rarrfs\":\"⤞\",\"rarrhk\":\"↪\",\"rarrlp\":\"↬\",\"rarrpl\":\"⥅\",\"rarrsim\":\"⥴\",\"Rarrtl\":\"⤖\",\"rarrtl\":\"↣\",\"rarrw\":\"↝\",\"ratail\":\"⤚\",\"rAtail\":\"⤜\",\"ratio\":\"∶\",\"rationals\":\"ℚ\",\"rbarr\":\"⤍\",\"rBarr\":\"⤏\",\"RBarr\":\"⤐\",\"rbbrk\":\"❳\",\"rbrace\":\"}\",\"rbrack\":\"]\",\"rbrke\":\"⦌\",\"rbrksld\":\"⦎\",\"rbrkslu\":\"⦐\",\"Rcaron\":\"Ř\",\"rcaron\":\"ř\",\"Rcedil\":\"Ŗ\",\"rcedil\":\"ŗ\",\"rceil\":\"⌉\",\"rcub\":\"}\",\"Rcy\":\"Р\",\"rcy\":\"р\",\"rdca\":\"⤷\",\"rdldhar\":\"⥩\",\"rdquo\":\"”\",\"rdquor\":\"”\",\"rdsh\":\"↳\",\"real\":\"ℜ\",\"realine\":\"ℛ\",\"realpart\":\"ℜ\",\"reals\":\"ℝ\",\"Re\":\"ℜ\",\"rect\":\"▭\",\"reg\":\"®\",\"REG\":\"®\",\"ReverseElement\":\"∋\",\"ReverseEquilibrium\":\"⇋\",\"ReverseUpEquilibrium\":\"⥯\",\"rfisht\":\"⥽\",\"rfloor\":\"⌋\",\"rfr\":\"𝔯\",\"Rfr\":\"ℜ\",\"rHar\":\"⥤\",\"rhard\":\"⇁\",\"rharu\":\"⇀\",\"rharul\":\"⥬\",\"Rho\":\"Ρ\",\"rho\":\"ρ\",\"rhov\":\"ϱ\",\"RightAngleBracket\":\"⟩\",\"RightArrowBar\":\"⇥\",\"rightarrow\":\"→\",\"RightArrow\":\"→\",\"Rightarrow\":\"⇒\",\"RightArrowLeftArrow\":\"⇄\",\"rightarrowtail\":\"↣\",\"RightCeiling\":\"⌉\",\"RightDoubleBracket\":\"⟧\",\"RightDownTeeVector\":\"⥝\",\"RightDownVectorBar\":\"⥕\",\"RightDownVector\":\"⇂\",\"RightFloor\":\"⌋\",\"rightharpoondown\":\"⇁\",\"rightharpoonup\":\"⇀\",\"rightleftarrows\":\"⇄\",\"rightleftharpoons\":\"⇌\",\"rightrightarrows\":\"⇉\",\"rightsquigarrow\":\"↝\",\"RightTeeArrow\":\"↦\",\"RightTee\":\"⊢\",\"RightTeeVector\":\"⥛\",\"rightthreetimes\":\"⋌\",\"RightTriangleBar\":\"⧐\",\"RightTriangle\":\"⊳\",\"RightTriangleEqual\":\"⊵\",\"RightUpDownVector\":\"⥏\",\"RightUpTeeVector\":\"⥜\",\"RightUpVectorBar\":\"⥔\",\"RightUpVector\":\"↾\",\"RightVectorBar\":\"⥓\",\"RightVector\":\"⇀\",\"ring\":\"˚\",\"risingdotseq\":\"≓\",\"rlarr\":\"⇄\",\"rlhar\":\"⇌\",\"rlm\":\"‏\",\"rmoustache\":\"⎱\",\"rmoust\":\"⎱\",\"rnmid\":\"⫮\",\"roang\":\"⟭\",\"roarr\":\"⇾\",\"robrk\":\"⟧\",\"ropar\":\"⦆\",\"ropf\":\"𝕣\",\"Ropf\":\"ℝ\",\"roplus\":\"⨮\",\"rotimes\":\"⨵\",\"RoundImplies\":\"⥰\",\"rpar\":\")\",\"rpargt\":\"⦔\",\"rppolint\":\"⨒\",\"rrarr\":\"⇉\",\"Rrightarrow\":\"⇛\",\"rsaquo\":\"›\",\"rscr\":\"𝓇\",\"Rscr\":\"ℛ\",\"rsh\":\"↱\",\"Rsh\":\"↱\",\"rsqb\":\"]\",\"rsquo\":\"’\",\"rsquor\":\"’\",\"rthree\":\"⋌\",\"rtimes\":\"⋊\",\"rtri\":\"▹\",\"rtrie\":\"⊵\",\"rtrif\":\"▸\",\"rtriltri\":\"⧎\",\"RuleDelayed\":\"⧴\",\"ruluhar\":\"⥨\",\"rx\":\"℞\",\"Sacute\":\"Ś\",\"sacute\":\"ś\",\"sbquo\":\"‚\",\"scap\":\"⪸\",\"Scaron\":\"Š\",\"scaron\":\"š\",\"Sc\":\"⪼\",\"sc\":\"≻\",\"sccue\":\"≽\",\"sce\":\"⪰\",\"scE\":\"⪴\",\"Scedil\":\"Ş\",\"scedil\":\"ş\",\"Scirc\":\"Ŝ\",\"scirc\":\"ŝ\",\"scnap\":\"⪺\",\"scnE\":\"⪶\",\"scnsim\":\"⋩\",\"scpolint\":\"⨓\",\"scsim\":\"≿\",\"Scy\":\"С\",\"scy\":\"с\",\"sdotb\":\"⊡\",\"sdot\":\"⋅\",\"sdote\":\"⩦\",\"searhk\":\"⤥\",\"searr\":\"↘\",\"seArr\":\"⇘\",\"searrow\":\"↘\",\"sect\":\"§\",\"semi\":\";\",\"seswar\":\"⤩\",\"setminus\":\"∖\",\"setmn\":\"∖\",\"sext\":\"✶\",\"Sfr\":\"𝔖\",\"sfr\":\"𝔰\",\"sfrown\":\"⌢\",\"sharp\":\"♯\",\"SHCHcy\":\"Щ\",\"shchcy\":\"щ\",\"SHcy\":\"Ш\",\"shcy\":\"ш\",\"ShortDownArrow\":\"↓\",\"ShortLeftArrow\":\"←\",\"shortmid\":\"∣\",\"shortparallel\":\"∥\",\"ShortRightArrow\":\"→\",\"ShortUpArrow\":\"↑\",\"shy\":\"­\",\"Sigma\":\"Σ\",\"sigma\":\"σ\",\"sigmaf\":\"ς\",\"sigmav\":\"ς\",\"sim\":\"∼\",\"simdot\":\"⩪\",\"sime\":\"≃\",\"simeq\":\"≃\",\"simg\":\"⪞\",\"simgE\":\"⪠\",\"siml\":\"⪝\",\"simlE\":\"⪟\",\"simne\":\"≆\",\"simplus\":\"⨤\",\"simrarr\":\"⥲\",\"slarr\":\"←\",\"SmallCircle\":\"∘\",\"smallsetminus\":\"∖\",\"smashp\":\"⨳\",\"smeparsl\":\"⧤\",\"smid\":\"∣\",\"smile\":\"⌣\",\"smt\":\"⪪\",\"smte\":\"⪬\",\"smtes\":\"⪬︀\",\"SOFTcy\":\"Ь\",\"softcy\":\"ь\",\"solbar\":\"⌿\",\"solb\":\"⧄\",\"sol\":\"/\",\"Sopf\":\"𝕊\",\"sopf\":\"𝕤\",\"spades\":\"♠\",\"spadesuit\":\"♠\",\"spar\":\"∥\",\"sqcap\":\"⊓\",\"sqcaps\":\"⊓︀\",\"sqcup\":\"⊔\",\"sqcups\":\"⊔︀\",\"Sqrt\":\"√\",\"sqsub\":\"⊏\",\"sqsube\":\"⊑\",\"sqsubset\":\"⊏\",\"sqsubseteq\":\"⊑\",\"sqsup\":\"⊐\",\"sqsupe\":\"⊒\",\"sqsupset\":\"⊐\",\"sqsupseteq\":\"⊒\",\"square\":\"□\",\"Square\":\"□\",\"SquareIntersection\":\"⊓\",\"SquareSubset\":\"⊏\",\"SquareSubsetEqual\":\"⊑\",\"SquareSuperset\":\"⊐\",\"SquareSupersetEqual\":\"⊒\",\"SquareUnion\":\"⊔\",\"squarf\":\"▪\",\"squ\":\"□\",\"squf\":\"▪\",\"srarr\":\"→\",\"Sscr\":\"𝒮\",\"sscr\":\"𝓈\",\"ssetmn\":\"∖\",\"ssmile\":\"⌣\",\"sstarf\":\"⋆\",\"Star\":\"⋆\",\"star\":\"☆\",\"starf\":\"★\",\"straightepsilon\":\"ϵ\",\"straightphi\":\"ϕ\",\"strns\":\"¯\",\"sub\":\"⊂\",\"Sub\":\"⋐\",\"subdot\":\"⪽\",\"subE\":\"⫅\",\"sube\":\"⊆\",\"subedot\":\"⫃\",\"submult\":\"⫁\",\"subnE\":\"⫋\",\"subne\":\"⊊\",\"subplus\":\"⪿\",\"subrarr\":\"⥹\",\"subset\":\"⊂\",\"Subset\":\"⋐\",\"subseteq\":\"⊆\",\"subseteqq\":\"⫅\",\"SubsetEqual\":\"⊆\",\"subsetneq\":\"⊊\",\"subsetneqq\":\"⫋\",\"subsim\":\"⫇\",\"subsub\":\"⫕\",\"subsup\":\"⫓\",\"succapprox\":\"⪸\",\"succ\":\"≻\",\"succcurlyeq\":\"≽\",\"Succeeds\":\"≻\",\"SucceedsEqual\":\"⪰\",\"SucceedsSlantEqual\":\"≽\",\"SucceedsTilde\":\"≿\",\"succeq\":\"⪰\",\"succnapprox\":\"⪺\",\"succneqq\":\"⪶\",\"succnsim\":\"⋩\",\"succsim\":\"≿\",\"SuchThat\":\"∋\",\"sum\":\"∑\",\"Sum\":\"∑\",\"sung\":\"♪\",\"sup1\":\"¹\",\"sup2\":\"²\",\"sup3\":\"³\",\"sup\":\"⊃\",\"Sup\":\"⋑\",\"supdot\":\"⪾\",\"supdsub\":\"⫘\",\"supE\":\"⫆\",\"supe\":\"⊇\",\"supedot\":\"⫄\",\"Superset\":\"⊃\",\"SupersetEqual\":\"⊇\",\"suphsol\":\"⟉\",\"suphsub\":\"⫗\",\"suplarr\":\"⥻\",\"supmult\":\"⫂\",\"supnE\":\"⫌\",\"supne\":\"⊋\",\"supplus\":\"⫀\",\"supset\":\"⊃\",\"Supset\":\"⋑\",\"supseteq\":\"⊇\",\"supseteqq\":\"⫆\",\"supsetneq\":\"⊋\",\"supsetneqq\":\"⫌\",\"supsim\":\"⫈\",\"supsub\":\"⫔\",\"supsup\":\"⫖\",\"swarhk\":\"⤦\",\"swarr\":\"↙\",\"swArr\":\"⇙\",\"swarrow\":\"↙\",\"swnwar\":\"⤪\",\"szlig\":\"ß\",\"Tab\":\"\\t\",\"target\":\"⌖\",\"Tau\":\"Τ\",\"tau\":\"τ\",\"tbrk\":\"⎴\",\"Tcaron\":\"Ť\",\"tcaron\":\"ť\",\"Tcedil\":\"Ţ\",\"tcedil\":\"ţ\",\"Tcy\":\"Т\",\"tcy\":\"т\",\"tdot\":\"⃛\",\"telrec\":\"⌕\",\"Tfr\":\"𝔗\",\"tfr\":\"𝔱\",\"there4\":\"∴\",\"therefore\":\"∴\",\"Therefore\":\"∴\",\"Theta\":\"Θ\",\"theta\":\"θ\",\"thetasym\":\"ϑ\",\"thetav\":\"ϑ\",\"thickapprox\":\"≈\",\"thicksim\":\"∼\",\"ThickSpace\":\"  \",\"ThinSpace\":\" \",\"thinsp\":\" \",\"thkap\":\"≈\",\"thksim\":\"∼\",\"THORN\":\"Þ\",\"thorn\":\"þ\",\"tilde\":\"˜\",\"Tilde\":\"∼\",\"TildeEqual\":\"≃\",\"TildeFullEqual\":\"≅\",\"TildeTilde\":\"≈\",\"timesbar\":\"⨱\",\"timesb\":\"⊠\",\"times\":\"×\",\"timesd\":\"⨰\",\"tint\":\"∭\",\"toea\":\"⤨\",\"topbot\":\"⌶\",\"topcir\":\"⫱\",\"top\":\"⊤\",\"Topf\":\"𝕋\",\"topf\":\"𝕥\",\"topfork\":\"⫚\",\"tosa\":\"⤩\",\"tprime\":\"‴\",\"trade\":\"™\",\"TRADE\":\"™\",\"triangle\":\"▵\",\"triangledown\":\"▿\",\"triangleleft\":\"◃\",\"trianglelefteq\":\"⊴\",\"triangleq\":\"≜\",\"triangleright\":\"▹\",\"trianglerighteq\":\"⊵\",\"tridot\":\"◬\",\"trie\":\"≜\",\"triminus\":\"⨺\",\"TripleDot\":\"⃛\",\"triplus\":\"⨹\",\"trisb\":\"⧍\",\"tritime\":\"⨻\",\"trpezium\":\"⏢\",\"Tscr\":\"𝒯\",\"tscr\":\"𝓉\",\"TScy\":\"Ц\",\"tscy\":\"ц\",\"TSHcy\":\"Ћ\",\"tshcy\":\"ћ\",\"Tstrok\":\"Ŧ\",\"tstrok\":\"ŧ\",\"twixt\":\"≬\",\"twoheadleftarrow\":\"↞\",\"twoheadrightarrow\":\"↠\",\"Uacute\":\"Ú\",\"uacute\":\"ú\",\"uarr\":\"↑\",\"Uarr\":\"↟\",\"uArr\":\"⇑\",\"Uarrocir\":\"⥉\",\"Ubrcy\":\"Ў\",\"ubrcy\":\"ў\",\"Ubreve\":\"Ŭ\",\"ubreve\":\"ŭ\",\"Ucirc\":\"Û\",\"ucirc\":\"û\",\"Ucy\":\"У\",\"ucy\":\"у\",\"udarr\":\"⇅\",\"Udblac\":\"Ű\",\"udblac\":\"ű\",\"udhar\":\"⥮\",\"ufisht\":\"⥾\",\"Ufr\":\"𝔘\",\"ufr\":\"𝔲\",\"Ugrave\":\"Ù\",\"ugrave\":\"ù\",\"uHar\":\"⥣\",\"uharl\":\"↿\",\"uharr\":\"↾\",\"uhblk\":\"▀\",\"ulcorn\":\"⌜\",\"ulcorner\":\"⌜\",\"ulcrop\":\"⌏\",\"ultri\":\"◸\",\"Umacr\":\"Ū\",\"umacr\":\"ū\",\"uml\":\"¨\",\"UnderBar\":\"_\",\"UnderBrace\":\"⏟\",\"UnderBracket\":\"⎵\",\"UnderParenthesis\":\"⏝\",\"Union\":\"⋃\",\"UnionPlus\":\"⊎\",\"Uogon\":\"Ų\",\"uogon\":\"ų\",\"Uopf\":\"𝕌\",\"uopf\":\"𝕦\",\"UpArrowBar\":\"⤒\",\"uparrow\":\"↑\",\"UpArrow\":\"↑\",\"Uparrow\":\"⇑\",\"UpArrowDownArrow\":\"⇅\",\"updownarrow\":\"↕\",\"UpDownArrow\":\"↕\",\"Updownarrow\":\"⇕\",\"UpEquilibrium\":\"⥮\",\"upharpoonleft\":\"↿\",\"upharpoonright\":\"↾\",\"uplus\":\"⊎\",\"UpperLeftArrow\":\"↖\",\"UpperRightArrow\":\"↗\",\"upsi\":\"υ\",\"Upsi\":\"ϒ\",\"upsih\":\"ϒ\",\"Upsilon\":\"Υ\",\"upsilon\":\"υ\",\"UpTeeArrow\":\"↥\",\"UpTee\":\"⊥\",\"upuparrows\":\"⇈\",\"urcorn\":\"⌝\",\"urcorner\":\"⌝\",\"urcrop\":\"⌎\",\"Uring\":\"Ů\",\"uring\":\"ů\",\"urtri\":\"◹\",\"Uscr\":\"𝒰\",\"uscr\":\"𝓊\",\"utdot\":\"⋰\",\"Utilde\":\"Ũ\",\"utilde\":\"ũ\",\"utri\":\"▵\",\"utrif\":\"▴\",\"uuarr\":\"⇈\",\"Uuml\":\"Ü\",\"uuml\":\"ü\",\"uwangle\":\"⦧\",\"vangrt\":\"⦜\",\"varepsilon\":\"ϵ\",\"varkappa\":\"ϰ\",\"varnothing\":\"∅\",\"varphi\":\"ϕ\",\"varpi\":\"ϖ\",\"varpropto\":\"∝\",\"varr\":\"↕\",\"vArr\":\"⇕\",\"varrho\":\"ϱ\",\"varsigma\":\"ς\",\"varsubsetneq\":\"⊊︀\",\"varsubsetneqq\":\"⫋︀\",\"varsupsetneq\":\"⊋︀\",\"varsupsetneqq\":\"⫌︀\",\"vartheta\":\"ϑ\",\"vartriangleleft\":\"⊲\",\"vartriangleright\":\"⊳\",\"vBar\":\"⫨\",\"Vbar\":\"⫫\",\"vBarv\":\"⫩\",\"Vcy\":\"В\",\"vcy\":\"в\",\"vdash\":\"⊢\",\"vDash\":\"⊨\",\"Vdash\":\"⊩\",\"VDash\":\"⊫\",\"Vdashl\":\"⫦\",\"veebar\":\"⊻\",\"vee\":\"∨\",\"Vee\":\"⋁\",\"veeeq\":\"≚\",\"vellip\":\"⋮\",\"verbar\":\"|\",\"Verbar\":\"‖\",\"vert\":\"|\",\"Vert\":\"‖\",\"VerticalBar\":\"∣\",\"VerticalLine\":\"|\",\"VerticalSeparator\":\"❘\",\"VerticalTilde\":\"≀\",\"VeryThinSpace\":\" \",\"Vfr\":\"𝔙\",\"vfr\":\"𝔳\",\"vltri\":\"⊲\",\"vnsub\":\"⊂⃒\",\"vnsup\":\"⊃⃒\",\"Vopf\":\"𝕍\",\"vopf\":\"𝕧\",\"vprop\":\"∝\",\"vrtri\":\"⊳\",\"Vscr\":\"𝒱\",\"vscr\":\"𝓋\",\"vsubnE\":\"⫋︀\",\"vsubne\":\"⊊︀\",\"vsupnE\":\"⫌︀\",\"vsupne\":\"⊋︀\",\"Vvdash\":\"⊪\",\"vzigzag\":\"⦚\",\"Wcirc\":\"Ŵ\",\"wcirc\":\"ŵ\",\"wedbar\":\"⩟\",\"wedge\":\"∧\",\"Wedge\":\"⋀\",\"wedgeq\":\"≙\",\"weierp\":\"℘\",\"Wfr\":\"𝔚\",\"wfr\":\"𝔴\",\"Wopf\":\"𝕎\",\"wopf\":\"𝕨\",\"wp\":\"℘\",\"wr\":\"≀\",\"wreath\":\"≀\",\"Wscr\":\"𝒲\",\"wscr\":\"𝓌\",\"xcap\":\"⋂\",\"xcirc\":\"◯\",\"xcup\":\"⋃\",\"xdtri\":\"▽\",\"Xfr\":\"𝔛\",\"xfr\":\"𝔵\",\"xharr\":\"⟷\",\"xhArr\":\"⟺\",\"Xi\":\"Ξ\",\"xi\":\"ξ\",\"xlarr\":\"⟵\",\"xlArr\":\"⟸\",\"xmap\":\"⟼\",\"xnis\":\"⋻\",\"xodot\":\"⨀\",\"Xopf\":\"𝕏\",\"xopf\":\"𝕩\",\"xoplus\":\"⨁\",\"xotime\":\"⨂\",\"xrarr\":\"⟶\",\"xrArr\":\"⟹\",\"Xscr\":\"𝒳\",\"xscr\":\"𝓍\",\"xsqcup\":\"⨆\",\"xuplus\":\"⨄\",\"xutri\":\"△\",\"xvee\":\"⋁\",\"xwedge\":\"⋀\",\"Yacute\":\"Ý\",\"yacute\":\"ý\",\"YAcy\":\"Я\",\"yacy\":\"я\",\"Ycirc\":\"Ŷ\",\"ycirc\":\"ŷ\",\"Ycy\":\"Ы\",\"ycy\":\"ы\",\"yen\":\"¥\",\"Yfr\":\"𝔜\",\"yfr\":\"𝔶\",\"YIcy\":\"Ї\",\"yicy\":\"ї\",\"Yopf\":\"𝕐\",\"yopf\":\"𝕪\",\"Yscr\":\"𝒴\",\"yscr\":\"𝓎\",\"YUcy\":\"Ю\",\"yucy\":\"ю\",\"yuml\":\"ÿ\",\"Yuml\":\"Ÿ\",\"Zacute\":\"Ź\",\"zacute\":\"ź\",\"Zcaron\":\"Ž\",\"zcaron\":\"ž\",\"Zcy\":\"З\",\"zcy\":\"з\",\"Zdot\":\"Ż\",\"zdot\":\"ż\",\"zeetrf\":\"ℨ\",\"ZeroWidthSpace\":\"​\",\"Zeta\":\"Ζ\",\"zeta\":\"ζ\",\"zfr\":\"𝔷\",\"Zfr\":\"ℨ\",\"ZHcy\":\"Ж\",\"zhcy\":\"ж\",\"zigrarr\":\"⇝\",\"zopf\":\"𝕫\",\"Zopf\":\"ℤ\",\"Zscr\":\"𝒵\",\"zscr\":\"𝓏\",\"zwj\":\"‍\",\"zwnj\":\"‌\"}");
13416
13417 /***/ }),
13418 /* 45 */
13419 /***/ (function(module, exports) {
13420
13421 module.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\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-\u2E4E\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]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/
13422
13423 /***/ }),
13424 /* 46 */
13425 /***/ (function(module, exports, __webpack_require__) {
13426
13427 "use strict";
13428
13429
13430
13431 module.exports.encode = __webpack_require__(47);
13432 module.exports.decode = __webpack_require__(48);
13433 module.exports.format = __webpack_require__(49);
13434 module.exports.parse  = __webpack_require__(50);
13435
13436
13437 /***/ }),
13438 /* 47 */
13439 /***/ (function(module, exports, __webpack_require__) {
13440
13441 "use strict";
13442
13443
13444
13445
13446 var encodeCache = {};
13447
13448
13449 // Create a lookup array where anything but characters in `chars` string
13450 // and alphanumeric chars is percent-encoded.
13451 //
13452 function getEncodeCache(exclude) {
13453   var i, ch, cache = encodeCache[exclude];
13454   if (cache) { return cache; }
13455
13456   cache = encodeCache[exclude] = [];
13457
13458   for (i = 0; i < 128; i++) {
13459     ch = String.fromCharCode(i);
13460
13461     if (/^[0-9a-z]$/i.test(ch)) {
13462       // always allow unencoded alphanumeric characters
13463       cache.push(ch);
13464     } else {
13465       cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2));
13466     }
13467   }
13468
13469   for (i = 0; i < exclude.length; i++) {
13470     cache[exclude.charCodeAt(i)] = exclude[i];
13471   }
13472
13473   return cache;
13474 }
13475
13476
13477 // Encode unsafe characters with percent-encoding, skipping already
13478 // encoded sequences.
13479 //
13480 //  - string       - string to encode
13481 //  - exclude      - list of characters to ignore (in addition to a-zA-Z0-9)
13482 //  - keepEscaped  - don't encode '%' in a correct escape sequence (default: true)
13483 //
13484 function encode(string, exclude, keepEscaped) {
13485   var i, l, code, nextCode, cache,
13486       result = '';
13487
13488   if (typeof exclude !== 'string') {
13489     // encode(string, keepEscaped)
13490     keepEscaped  = exclude;
13491     exclude = encode.defaultChars;
13492   }
13493
13494   if (typeof keepEscaped === 'undefined') {
13495     keepEscaped = true;
13496   }
13497
13498   cache = getEncodeCache(exclude);
13499
13500   for (i = 0, l = string.length; i < l; i++) {
13501     code = string.charCodeAt(i);
13502
13503     if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) {
13504       if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) {
13505         result += string.slice(i, i + 3);
13506         i += 2;
13507         continue;
13508       }
13509     }
13510
13511     if (code < 128) {
13512       result += cache[code];
13513       continue;
13514     }
13515
13516     if (code >= 0xD800 && code <= 0xDFFF) {
13517       if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) {
13518         nextCode = string.charCodeAt(i + 1);
13519         if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) {
13520           result += encodeURIComponent(string[i] + string[i + 1]);
13521           i++;
13522           continue;
13523         }
13524       }
13525       result += '%EF%BF%BD';
13526       continue;
13527     }
13528
13529     result += encodeURIComponent(string[i]);
13530   }
13531
13532   return result;
13533 }
13534
13535 encode.defaultChars   = ";/?:@&=+$,-_.!~*'()#";
13536 encode.componentChars = "-_.!~*'()";
13537
13538
13539 module.exports = encode;
13540
13541
13542 /***/ }),
13543 /* 48 */
13544 /***/ (function(module, exports, __webpack_require__) {
13545
13546 "use strict";
13547
13548
13549
13550
13551 /* eslint-disable no-bitwise */
13552
13553 var decodeCache = {};
13554
13555 function getDecodeCache(exclude) {
13556   var i, ch, cache = decodeCache[exclude];
13557   if (cache) { return cache; }
13558
13559   cache = decodeCache[exclude] = [];
13560
13561   for (i = 0; i < 128; i++) {
13562     ch = String.fromCharCode(i);
13563     cache.push(ch);
13564   }
13565
13566   for (i = 0; i < exclude.length; i++) {
13567     ch = exclude.charCodeAt(i);
13568     cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2);
13569   }
13570
13571   return cache;
13572 }
13573
13574
13575 // Decode percent-encoded string.
13576 //
13577 function decode(string, exclude) {
13578   var cache;
13579
13580   if (typeof exclude !== 'string') {
13581     exclude = decode.defaultChars;
13582   }
13583
13584   cache = getDecodeCache(exclude);
13585
13586   return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) {
13587     var i, l, b1, b2, b3, b4, chr,
13588         result = '';
13589
13590     for (i = 0, l = seq.length; i < l; i += 3) {
13591       b1 = parseInt(seq.slice(i + 1, i + 3), 16);
13592
13593       if (b1 < 0x80) {
13594         result += cache[b1];
13595         continue;
13596       }
13597
13598       if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) {
13599         // 110xxxxx 10xxxxxx
13600         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
13601
13602         if ((b2 & 0xC0) === 0x80) {
13603           chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F);
13604
13605           if (chr < 0x80) {
13606             result += '\ufffd\ufffd';
13607           } else {
13608             result += String.fromCharCode(chr);
13609           }
13610
13611           i += 3;
13612           continue;
13613         }
13614       }
13615
13616       if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) {
13617         // 1110xxxx 10xxxxxx 10xxxxxx
13618         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
13619         b3 = parseInt(seq.slice(i + 7, i + 9), 16);
13620
13621         if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
13622           chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F);
13623
13624           if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) {
13625             result += '\ufffd\ufffd\ufffd';
13626           } else {
13627             result += String.fromCharCode(chr);
13628           }
13629
13630           i += 6;
13631           continue;
13632         }
13633       }
13634
13635       if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) {
13636         // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
13637         b2 = parseInt(seq.slice(i + 4, i + 6), 16);
13638         b3 = parseInt(seq.slice(i + 7, i + 9), 16);
13639         b4 = parseInt(seq.slice(i + 10, i + 12), 16);
13640
13641         if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) {
13642           chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F);
13643
13644           if (chr < 0x10000 || chr > 0x10FFFF) {
13645             result += '\ufffd\ufffd\ufffd\ufffd';
13646           } else {
13647             chr -= 0x10000;
13648             result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF));
13649           }
13650
13651           i += 9;
13652           continue;
13653         }
13654       }
13655
13656       result += '\ufffd';
13657     }
13658
13659     return result;
13660   });
13661 }
13662
13663
13664 decode.defaultChars   = ';/?:@&=+$,#';
13665 decode.componentChars = '';
13666
13667
13668 module.exports = decode;
13669
13670
13671 /***/ }),
13672 /* 49 */
13673 /***/ (function(module, exports, __webpack_require__) {
13674
13675 "use strict";
13676
13677
13678
13679
13680 module.exports = function format(url) {
13681   var result = '';
13682
13683   result += url.protocol || '';
13684   result += url.slashes ? '//' : '';
13685   result += url.auth ? url.auth + '@' : '';
13686
13687   if (url.hostname && url.hostname.indexOf(':') !== -1) {
13688     // ipv6 address
13689     result += '[' + url.hostname + ']';
13690   } else {
13691     result += url.hostname || '';
13692   }
13693
13694   result += url.port ? ':' + url.port : '';
13695   result += url.pathname || '';
13696   result += url.search || '';
13697   result += url.hash || '';
13698
13699   return result;
13700 };
13701
13702
13703 /***/ }),
13704 /* 50 */
13705 /***/ (function(module, exports, __webpack_require__) {
13706
13707 "use strict";
13708 // Copyright Joyent, Inc. and other Node contributors.
13709 //
13710 // Permission is hereby granted, free of charge, to any person obtaining a
13711 // copy of this software and associated documentation files (the
13712 // "Software"), to deal in the Software without restriction, including
13713 // without limitation the rights to use, copy, modify, merge, publish,
13714 // distribute, sublicense, and/or sell copies of the Software, and to permit
13715 // persons to whom the Software is furnished to do so, subject to the
13716 // following conditions:
13717 //
13718 // The above copyright notice and this permission notice shall be included
13719 // in all copies or substantial portions of the Software.
13720 //
13721 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13722 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
13723 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
13724 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
13725 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
13726 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
13727 // USE OR OTHER DEALINGS IN THE SOFTWARE.
13728
13729
13730
13731 //
13732 // Changes from joyent/node:
13733 //
13734 // 1. No leading slash in paths,
13735 //    e.g. in `url.parse('http://foo?bar')` pathname is ``, not `/`
13736 //
13737 // 2. Backslashes are not replaced with slashes,
13738 //    so `http:\\example.org\` is treated like a relative path
13739 //
13740 // 3. Trailing colon is treated like a part of the path,
13741 //    i.e. in `http://example.org:foo` pathname is `:foo`
13742 //
13743 // 4. Nothing is URL-encoded in the resulting object,
13744 //    (in joyent/node some chars in auth and paths are encoded)
13745 //
13746 // 5. `url.parse()` does not have `parseQueryString` argument
13747 //
13748 // 6. Removed extraneous result properties: `host`, `path`, `query`, etc.,
13749 //    which can be constructed using other parts of the url.
13750 //
13751
13752
13753 function Url() {
13754   this.protocol = null;
13755   this.slashes = null;
13756   this.auth = null;
13757   this.port = null;
13758   this.hostname = null;
13759   this.hash = null;
13760   this.search = null;
13761   this.pathname = null;
13762 }
13763
13764 // Reference: RFC 3986, RFC 1808, RFC 2396
13765
13766 // define these here so at least they only have to be
13767 // compiled once on the first module load.
13768 var protocolPattern = /^([a-z0-9.+-]+:)/i,
13769     portPattern = /:[0-9]*$/,
13770
13771     // Special case for a simple path URL
13772     simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
13773
13774     // RFC 2396: characters reserved for delimiting URLs.
13775     // We actually just auto-escape these.
13776     delims = [ '<', '>', '"', '`', ' ', '\r', '\n', '\t' ],
13777
13778     // RFC 2396: characters not allowed for various reasons.
13779     unwise = [ '{', '}', '|', '\\', '^', '`' ].concat(delims),
13780
13781     // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
13782     autoEscape = [ '\'' ].concat(unwise),
13783     // Characters that are never ever allowed in a hostname.
13784     // Note that any invalid chars are also handled, but these
13785     // are the ones that are *expected* to be seen, so we fast-path
13786     // them.
13787     nonHostChars = [ '%', '/', '?', ';', '#' ].concat(autoEscape),
13788     hostEndingChars = [ '/', '?', '#' ],
13789     hostnameMaxLen = 255,
13790     hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
13791     hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
13792     // protocols that can allow "unsafe" and "unwise" chars.
13793     /* eslint-disable no-script-url */
13794     // protocols that never have a hostname.
13795     hostlessProtocol = {
13796       'javascript': true,
13797       'javascript:': true
13798     },
13799     // protocols that always contain a // bit.
13800     slashedProtocol = {
13801       'http': true,
13802       'https': true,
13803       'ftp': true,
13804       'gopher': true,
13805       'file': true,
13806       'http:': true,
13807       'https:': true,
13808       'ftp:': true,
13809       'gopher:': true,
13810       'file:': true
13811     };
13812     /* eslint-enable no-script-url */
13813
13814 function urlParse(url, slashesDenoteHost) {
13815   if (url && url instanceof Url) { return url; }
13816
13817   var u = new Url();
13818   u.parse(url, slashesDenoteHost);
13819   return u;
13820 }
13821
13822 Url.prototype.parse = function(url, slashesDenoteHost) {
13823   var i, l, lowerProto, hec, slashes,
13824       rest = url;
13825
13826   // trim before proceeding.
13827   // This is to support parse stuff like "  http://foo.com  \n"
13828   rest = rest.trim();
13829
13830   if (!slashesDenoteHost && url.split('#').length === 1) {
13831     // Try fast path regexp
13832     var simplePath = simplePathPattern.exec(rest);
13833     if (simplePath) {
13834       this.pathname = simplePath[1];
13835       if (simplePath[2]) {
13836         this.search = simplePath[2];
13837       }
13838       return this;
13839     }
13840   }
13841
13842   var proto = protocolPattern.exec(rest);
13843   if (proto) {
13844     proto = proto[0];
13845     lowerProto = proto.toLowerCase();
13846     this.protocol = proto;
13847     rest = rest.substr(proto.length);
13848   }
13849
13850   // figure out if it's got a host
13851   // user@server is *always* interpreted as a hostname, and url
13852   // resolution will treat //foo/bar as host=foo,path=bar because that's
13853   // how the browser resolves relative URLs.
13854   if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
13855     slashes = rest.substr(0, 2) === '//';
13856     if (slashes && !(proto && hostlessProtocol[proto])) {
13857       rest = rest.substr(2);
13858       this.slashes = true;
13859     }
13860   }
13861
13862   if (!hostlessProtocol[proto] &&
13863       (slashes || (proto && !slashedProtocol[proto]))) {
13864
13865     // there's a hostname.
13866     // the first instance of /, ?, ;, or # ends the host.
13867     //
13868     // If there is an @ in the hostname, then non-host chars *are* allowed
13869     // to the left of the last @ sign, unless some host-ending character
13870     // comes *before* the @-sign.
13871     // URLs are obnoxious.
13872     //
13873     // ex:
13874     // http://a@b@c/ => user:a@b host:c
13875     // http://a@b?@c => user:a host:c path:/?@c
13876
13877     // v0.12 TODO(isaacs): This is not quite how Chrome does things.
13878     // Review our test case against browsers more comprehensively.
13879
13880     // find the first instance of any hostEndingChars
13881     var hostEnd = -1;
13882     for (i = 0; i < hostEndingChars.length; i++) {
13883       hec = rest.indexOf(hostEndingChars[i]);
13884       if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
13885         hostEnd = hec;
13886       }
13887     }
13888
13889     // at this point, either we have an explicit point where the
13890     // auth portion cannot go past, or the last @ char is the decider.
13891     var auth, atSign;
13892     if (hostEnd === -1) {
13893       // atSign can be anywhere.
13894       atSign = rest.lastIndexOf('@');
13895     } else {
13896       // atSign must be in auth portion.
13897       // http://a@b/c@d => host:b auth:a path:/c@d
13898       atSign = rest.lastIndexOf('@', hostEnd);
13899     }
13900
13901     // Now we have a portion which is definitely the auth.
13902     // Pull that off.
13903     if (atSign !== -1) {
13904       auth = rest.slice(0, atSign);
13905       rest = rest.slice(atSign + 1);
13906       this.auth = auth;
13907     }
13908
13909     // the host is the remaining to the left of the first non-host char
13910     hostEnd = -1;
13911     for (i = 0; i < nonHostChars.length; i++) {
13912       hec = rest.indexOf(nonHostChars[i]);
13913       if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
13914         hostEnd = hec;
13915       }
13916     }
13917     // if we still have not hit it, then the entire thing is a host.
13918     if (hostEnd === -1) {
13919       hostEnd = rest.length;
13920     }
13921
13922     if (rest[hostEnd - 1] === ':') { hostEnd--; }
13923     var host = rest.slice(0, hostEnd);
13924     rest = rest.slice(hostEnd);
13925
13926     // pull out port.
13927     this.parseHost(host);
13928
13929     // we've indicated that there is a hostname,
13930     // so even if it's empty, it has to be present.
13931     this.hostname = this.hostname || '';
13932
13933     // if hostname begins with [ and ends with ]
13934     // assume that it's an IPv6 address.
13935     var ipv6Hostname = this.hostname[0] === '[' &&
13936         this.hostname[this.hostname.length - 1] === ']';
13937
13938     // validate a little.
13939     if (!ipv6Hostname) {
13940       var hostparts = this.hostname.split(/\./);
13941       for (i = 0, l = hostparts.length; i < l; i++) {
13942         var part = hostparts[i];
13943         if (!part) { continue; }
13944         if (!part.match(hostnamePartPattern)) {
13945           var newpart = '';
13946           for (var j = 0, k = part.length; j < k; j++) {
13947             if (part.charCodeAt(j) > 127) {
13948               // we replace non-ASCII char with a temporary placeholder
13949               // we need this to make sure size of hostname is not
13950               // broken by replacing non-ASCII by nothing
13951               newpart += 'x';
13952             } else {
13953               newpart += part[j];
13954             }
13955           }
13956           // we test again with ASCII char only
13957           if (!newpart.match(hostnamePartPattern)) {
13958             var validParts = hostparts.slice(0, i);
13959             var notHost = hostparts.slice(i + 1);
13960             var bit = part.match(hostnamePartStart);
13961             if (bit) {
13962               validParts.push(bit[1]);
13963               notHost.unshift(bit[2]);
13964             }
13965             if (notHost.length) {
13966               rest = notHost.join('.') + rest;
13967             }
13968             this.hostname = validParts.join('.');
13969             break;
13970           }
13971         }
13972       }
13973     }
13974
13975     if (this.hostname.length > hostnameMaxLen) {
13976       this.hostname = '';
13977     }
13978
13979     // strip [ and ] from the hostname
13980     // the host field still retains them, though
13981     if (ipv6Hostname) {
13982       this.hostname = this.hostname.substr(1, this.hostname.length - 2);
13983     }
13984   }
13985
13986   // chop off from the tail first.
13987   var hash = rest.indexOf('#');
13988   if (hash !== -1) {
13989     // got a fragment string.
13990     this.hash = rest.substr(hash);
13991     rest = rest.slice(0, hash);
13992   }
13993   var qm = rest.indexOf('?');
13994   if (qm !== -1) {
13995     this.search = rest.substr(qm);
13996     rest = rest.slice(0, qm);
13997   }
13998   if (rest) { this.pathname = rest; }
13999   if (slashedProtocol[lowerProto] &&
14000       this.hostname && !this.pathname) {
14001     this.pathname = '';
14002   }
14003
14004   return this;
14005 };
14006
14007 Url.prototype.parseHost = function(host) {
14008   var port = portPattern.exec(host);
14009   if (port) {
14010     port = port[0];
14011     if (port !== ':') {
14012       this.port = port.substr(1);
14013     }
14014     host = host.substr(0, host.length - port.length);
14015   }
14016   if (host) { this.hostname = host; }
14017 };
14018
14019 module.exports = urlParse;
14020
14021
14022 /***/ }),
14023 /* 51 */
14024 /***/ (function(module, exports, __webpack_require__) {
14025
14026 "use strict";
14027
14028
14029 exports.Any = __webpack_require__(52);
14030 exports.Cc  = __webpack_require__(53);
14031 exports.Cf  = __webpack_require__(54);
14032 exports.P   = __webpack_require__(45);
14033 exports.Z   = __webpack_require__(55);
14034
14035
14036 /***/ }),
14037 /* 52 */
14038 /***/ (function(module, exports) {
14039
14040 module.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
14041
14042 /***/ }),
14043 /* 53 */
14044 /***/ (function(module, exports) {
14045
14046 module.exports=/[\0-\x1F\x7F-\x9F]/
14047
14048 /***/ }),
14049 /* 54 */
14050 /***/ (function(module, exports) {
14051
14052 module.exports=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/
14053
14054 /***/ }),
14055 /* 55 */
14056 /***/ (function(module, exports) {
14057
14058 module.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/
14059
14060 /***/ }),
14061 /* 56 */
14062 /***/ (function(module, exports, __webpack_require__) {
14063
14064 "use strict";
14065 // Just a shortcut for bulk export
14066
14067
14068
14069 exports.parseLinkLabel       = __webpack_require__(57);
14070 exports.parseLinkDestination = __webpack_require__(58);
14071 exports.parseLinkTitle       = __webpack_require__(59);
14072
14073
14074 /***/ }),
14075 /* 57 */
14076 /***/ (function(module, exports, __webpack_require__) {
14077
14078 "use strict";
14079 // Parse link label
14080 //
14081 // this function assumes that first character ("[") already matches;
14082 // returns the end of the label
14083 //
14084
14085
14086 module.exports = function parseLinkLabel(state, start, disableNested) {
14087   var level, found, marker, prevPos,
14088       labelEnd = -1,
14089       max = state.posMax,
14090       oldPos = state.pos;
14091
14092   state.pos = start + 1;
14093   level = 1;
14094
14095   while (state.pos < max) {
14096     marker = state.src.charCodeAt(state.pos);
14097     if (marker === 0x5D /* ] */) {
14098       level--;
14099       if (level === 0) {
14100         found = true;
14101         break;
14102       }
14103     }
14104
14105     prevPos = state.pos;
14106     state.md.inline.skipToken(state);
14107     if (marker === 0x5B /* [ */) {
14108       if (prevPos === state.pos - 1) {
14109         // increase level if we find text `[`, which is not a part of any token
14110         level++;
14111       } else if (disableNested) {
14112         state.pos = oldPos;
14113         return -1;
14114       }
14115     }
14116   }
14117
14118   if (found) {
14119     labelEnd = state.pos;
14120   }
14121
14122   // restore old state
14123   state.pos = oldPos;
14124
14125   return labelEnd;
14126 };
14127
14128
14129 /***/ }),
14130 /* 58 */
14131 /***/ (function(module, exports, __webpack_require__) {
14132
14133 "use strict";
14134 // Parse link destination
14135 //
14136
14137
14138
14139 var unescapeAll = __webpack_require__(42).unescapeAll;
14140
14141
14142 module.exports = function parseLinkDestination(str, pos, max) {
14143   var code, level,
14144       lines = 0,
14145       start = pos,
14146       result = {
14147         ok: false,
14148         pos: 0,
14149         lines: 0,
14150         str: ''
14151       };
14152
14153   if (str.charCodeAt(pos) === 0x3C /* < */) {
14154     pos++;
14155     while (pos < max) {
14156       code = str.charCodeAt(pos);
14157       if (code === 0x0A /* \n */) { return result; }
14158       if (code === 0x3E /* > */) {
14159         result.pos = pos + 1;
14160         result.str = unescapeAll(str.slice(start + 1, pos));
14161         result.ok = true;
14162         return result;
14163       }
14164       if (code === 0x5C /* \ */ && pos + 1 < max) {
14165         pos += 2;
14166         continue;
14167       }
14168
14169       pos++;
14170     }
14171
14172     // no closing '>'
14173     return result;
14174   }
14175
14176   // this should be ... } else { ... branch
14177
14178   level = 0;
14179   while (pos < max) {
14180     code = str.charCodeAt(pos);
14181
14182     if (code === 0x20) { break; }
14183
14184     // ascii control characters
14185     if (code < 0x20 || code === 0x7F) { break; }
14186
14187     if (code === 0x5C /* \ */ && pos + 1 < max) {
14188       pos += 2;
14189       continue;
14190     }
14191
14192     if (code === 0x28 /* ( */) {
14193       level++;
14194     }
14195
14196     if (code === 0x29 /* ) */) {
14197       if (level === 0) { break; }
14198       level--;
14199     }
14200
14201     pos++;
14202   }
14203
14204   if (start === pos) { return result; }
14205   if (level !== 0) { return result; }
14206
14207   result.str = unescapeAll(str.slice(start, pos));
14208   result.lines = lines;
14209   result.pos = pos;
14210   result.ok = true;
14211   return result;
14212 };
14213
14214
14215 /***/ }),
14216 /* 59 */
14217 /***/ (function(module, exports, __webpack_require__) {
14218
14219 "use strict";
14220 // Parse link title
14221 //
14222
14223
14224
14225 var unescapeAll = __webpack_require__(42).unescapeAll;
14226
14227
14228 module.exports = function parseLinkTitle(str, pos, max) {
14229   var code,
14230       marker,
14231       lines = 0,
14232       start = pos,
14233       result = {
14234         ok: false,
14235         pos: 0,
14236         lines: 0,
14237         str: ''
14238       };
14239
14240   if (pos >= max) { return result; }
14241
14242   marker = str.charCodeAt(pos);
14243
14244   if (marker !== 0x22 /* " */ && marker !== 0x27 /* ' */ && marker !== 0x28 /* ( */) { return result; }
14245
14246   pos++;
14247
14248   // if opening marker is "(", switch it to closing marker ")"
14249   if (marker === 0x28) { marker = 0x29; }
14250
14251   while (pos < max) {
14252     code = str.charCodeAt(pos);
14253     if (code === marker) {
14254       result.pos = pos + 1;
14255       result.lines = lines;
14256       result.str = unescapeAll(str.slice(start + 1, pos));
14257       result.ok = true;
14258       return result;
14259     } else if (code === 0x0A) {
14260       lines++;
14261     } else if (code === 0x5C /* \ */ && pos + 1 < max) {
14262       pos++;
14263       if (str.charCodeAt(pos) === 0x0A) {
14264         lines++;
14265       }
14266     }
14267
14268     pos++;
14269   }
14270
14271   return result;
14272 };
14273
14274
14275 /***/ }),
14276 /* 60 */
14277 /***/ (function(module, exports, __webpack_require__) {
14278
14279 "use strict";
14280 /**
14281  * class Renderer
14282  *
14283  * Generates HTML from parsed token stream. Each instance has independent
14284  * copy of rules. Those can be rewritten with ease. Also, you can add new
14285  * rules if you create plugin and adds new token types.
14286  **/
14287
14288
14289
14290 var assign          = __webpack_require__(42).assign;
14291 var unescapeAll     = __webpack_require__(42).unescapeAll;
14292 var escapeHtml      = __webpack_require__(42).escapeHtml;
14293
14294
14295 ////////////////////////////////////////////////////////////////////////////////
14296
14297 var default_rules = {};
14298
14299
14300 default_rules.code_inline = function (tokens, idx, options, env, slf) {
14301   var token = tokens[idx];
14302
14303   return  '<code' + slf.renderAttrs(token) + '>' +
14304           escapeHtml(tokens[idx].content) +
14305           '</code>';
14306 };
14307
14308
14309 default_rules.code_block = function (tokens, idx, options, env, slf) {
14310   var token = tokens[idx];
14311
14312   return  '<pre' + slf.renderAttrs(token) + '><code>' +
14313           escapeHtml(tokens[idx].content) +
14314           '</code></pre>\n';
14315 };
14316
14317
14318 default_rules.fence = function (tokens, idx, options, env, slf) {
14319   var token = tokens[idx],
14320       info = token.info ? unescapeAll(token.info).trim() : '',
14321       langName = '',
14322       highlighted, i, tmpAttrs, tmpToken;
14323
14324   if (info) {
14325     langName = info.split(/\s+/g)[0];
14326   }
14327
14328   if (options.highlight) {
14329     highlighted = options.highlight(token.content, langName) || escapeHtml(token.content);
14330   } else {
14331     highlighted = escapeHtml(token.content);
14332   }
14333
14334   if (highlighted.indexOf('<pre') === 0) {
14335     return highlighted + '\n';
14336   }
14337
14338   // If language exists, inject class gently, without modifying original token.
14339   // May be, one day we will add .clone() for token and simplify this part, but
14340   // now we prefer to keep things local.
14341   if (info) {
14342     i        = token.attrIndex('class');
14343     tmpAttrs = token.attrs ? token.attrs.slice() : [];
14344
14345     if (i < 0) {
14346       tmpAttrs.push([ 'class', options.langPrefix + langName ]);
14347     } else {
14348       tmpAttrs[i][1] += ' ' + options.langPrefix + langName;
14349     }
14350
14351     // Fake token just to render attributes
14352     tmpToken = {
14353       attrs: tmpAttrs
14354     };
14355
14356     return  '<pre><code' + slf.renderAttrs(tmpToken) + '>'
14357           + highlighted
14358           + '</code></pre>\n';
14359   }
14360
14361
14362   return  '<pre><code' + slf.renderAttrs(token) + '>'
14363         + highlighted
14364         + '</code></pre>\n';
14365 };
14366
14367
14368 default_rules.image = function (tokens, idx, options, env, slf) {
14369   var token = tokens[idx];
14370
14371   // "alt" attr MUST be set, even if empty. Because it's mandatory and
14372   // should be placed on proper position for tests.
14373   //
14374   // Replace content with actual value
14375
14376   token.attrs[token.attrIndex('alt')][1] =
14377     slf.renderInlineAsText(token.children, options, env);
14378
14379   return slf.renderToken(tokens, idx, options);
14380 };
14381
14382
14383 default_rules.hardbreak = function (tokens, idx, options /*, env */) {
14384   return options.xhtmlOut ? '<br />\n' : '<br>\n';
14385 };
14386 default_rules.softbreak = function (tokens, idx, options /*, env */) {
14387   return options.breaks ? (options.xhtmlOut ? '<br />\n' : '<br>\n') : '\n';
14388 };
14389
14390
14391 default_rules.text = function (tokens, idx /*, options, env */) {
14392   return escapeHtml(tokens[idx].content);
14393 };
14394
14395
14396 default_rules.html_block = function (tokens, idx /*, options, env */) {
14397   return tokens[idx].content;
14398 };
14399 default_rules.html_inline = function (tokens, idx /*, options, env */) {
14400   return tokens[idx].content;
14401 };
14402
14403
14404 /**
14405  * new Renderer()
14406  *
14407  * Creates new [[Renderer]] instance and fill [[Renderer#rules]] with defaults.
14408  **/
14409 function Renderer() {
14410
14411   /**
14412    * Renderer#rules -> Object
14413    *
14414    * Contains render rules for tokens. Can be updated and extended.
14415    *
14416    * ##### Example
14417    *
14418    * ```javascript
14419    * var md = require('markdown-it')();
14420    *
14421    * md.renderer.rules.strong_open  = function () { return '<b>'; };
14422    * md.renderer.rules.strong_close = function () { return '</b>'; };
14423    *
14424    * var result = md.renderInline(...);
14425    * ```
14426    *
14427    * Each rule is called as independent static function with fixed signature:
14428    *
14429    * ```javascript
14430    * function my_token_render(tokens, idx, options, env, renderer) {
14431    *   // ...
14432    *   return renderedHTML;
14433    * }
14434    * ```
14435    *
14436    * See [source code](https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js)
14437    * for more details and examples.
14438    **/
14439   this.rules = assign({}, default_rules);
14440 }
14441
14442
14443 /**
14444  * Renderer.renderAttrs(token) -> String
14445  *
14446  * Render token attributes to string.
14447  **/
14448 Renderer.prototype.renderAttrs = function renderAttrs(token) {
14449   var i, l, result;
14450
14451   if (!token.attrs) { return ''; }
14452
14453   result = '';
14454
14455   for (i = 0, l = token.attrs.length; i < l; i++) {
14456     result += ' ' + escapeHtml(token.attrs[i][0]) + '="' + escapeHtml(token.attrs[i][1]) + '"';
14457   }
14458
14459   return result;
14460 };
14461
14462
14463 /**
14464  * Renderer.renderToken(tokens, idx, options) -> String
14465  * - tokens (Array): list of tokens
14466  * - idx (Numbed): token index to render
14467  * - options (Object): params of parser instance
14468  *
14469  * Default token renderer. Can be overriden by custom function
14470  * in [[Renderer#rules]].
14471  **/
14472 Renderer.prototype.renderToken = function renderToken(tokens, idx, options) {
14473   var nextToken,
14474       result = '',
14475       needLf = false,
14476       token = tokens[idx];
14477
14478   // Tight list paragraphs
14479   if (token.hidden) {
14480     return '';
14481   }
14482
14483   // Insert a newline between hidden paragraph and subsequent opening
14484   // block-level tag.
14485   //
14486   // For example, here we should insert a newline before blockquote:
14487   //  - a
14488   //    >
14489   //
14490   if (token.block && token.nesting !== -1 && idx && tokens[idx - 1].hidden) {
14491     result += '\n';
14492   }
14493
14494   // Add token name, e.g. `<img`
14495   result += (token.nesting === -1 ? '</' : '<') + token.tag;
14496
14497   // Encode attributes, e.g. `<img src="foo"`
14498   result += this.renderAttrs(token);
14499
14500   // Add a slash for self-closing tags, e.g. `<img src="foo" /`
14501   if (token.nesting === 0 && options.xhtmlOut) {
14502     result += ' /';
14503   }
14504
14505   // Check if we need to add a newline after this tag
14506   if (token.block) {
14507     needLf = true;
14508
14509     if (token.nesting === 1) {
14510       if (idx + 1 < tokens.length) {
14511         nextToken = tokens[idx + 1];
14512
14513         if (nextToken.type === 'inline' || nextToken.hidden) {
14514           // Block-level tag containing an inline tag.
14515           //
14516           needLf = false;
14517
14518         } else if (nextToken.nesting === -1 && nextToken.tag === token.tag) {
14519           // Opening tag + closing tag of the same type. E.g. `<li></li>`.
14520           //
14521           needLf = false;
14522         }
14523       }
14524     }
14525   }
14526
14527   result += needLf ? '>\n' : '>';
14528
14529   return result;
14530 };
14531
14532
14533 /**
14534  * Renderer.renderInline(tokens, options, env) -> String
14535  * - tokens (Array): list on block tokens to renter
14536  * - options (Object): params of parser instance
14537  * - env (Object): additional data from parsed input (references, for example)
14538  *
14539  * The same as [[Renderer.render]], but for single token of `inline` type.
14540  **/
14541 Renderer.prototype.renderInline = function (tokens, options, env) {
14542   var type,
14543       result = '',
14544       rules = this.rules;
14545
14546   for (var i = 0, len = tokens.length; i < len; i++) {
14547     type = tokens[i].type;
14548
14549     if (typeof rules[type] !== 'undefined') {
14550       result += rules[type](tokens, i, options, env, this);
14551     } else {
14552       result += this.renderToken(tokens, i, options);
14553     }
14554   }
14555
14556   return result;
14557 };
14558
14559
14560 /** internal
14561  * Renderer.renderInlineAsText(tokens, options, env) -> String
14562  * - tokens (Array): list on block tokens to renter
14563  * - options (Object): params of parser instance
14564  * - env (Object): additional data from parsed input (references, for example)
14565  *
14566  * Special kludge for image `alt` attributes to conform CommonMark spec.
14567  * Don't try to use it! Spec requires to show `alt` content with stripped markup,
14568  * instead of simple escaping.
14569  **/
14570 Renderer.prototype.renderInlineAsText = function (tokens, options, env) {
14571   var result = '';
14572
14573   for (var i = 0, len = tokens.length; i < len; i++) {
14574     if (tokens[i].type === 'text') {
14575       result += tokens[i].content;
14576     } else if (tokens[i].type === 'image') {
14577       result += this.renderInlineAsText(tokens[i].children, options, env);
14578     }
14579   }
14580
14581   return result;
14582 };
14583
14584
14585 /**
14586  * Renderer.render(tokens, options, env) -> String
14587  * - tokens (Array): list on block tokens to renter
14588  * - options (Object): params of parser instance
14589  * - env (Object): additional data from parsed input (references, for example)
14590  *
14591  * Takes token stream and generates HTML. Probably, you will never need to call
14592  * this method directly.
14593  **/
14594 Renderer.prototype.render = function (tokens, options, env) {
14595   var i, len, type,
14596       result = '',
14597       rules = this.rules;
14598
14599   for (i = 0, len = tokens.length; i < len; i++) {
14600     type = tokens[i].type;
14601
14602     if (type === 'inline') {
14603       result += this.renderInline(tokens[i].children, options, env);
14604     } else if (typeof rules[type] !== 'undefined') {
14605       result += rules[tokens[i].type](tokens, i, options, env, this);
14606     } else {
14607       result += this.renderToken(tokens, i, options, env);
14608     }
14609   }
14610
14611   return result;
14612 };
14613
14614 module.exports = Renderer;
14615
14616
14617 /***/ }),
14618 /* 61 */
14619 /***/ (function(module, exports, __webpack_require__) {
14620
14621 "use strict";
14622 /** internal
14623  * class Core
14624  *
14625  * Top-level rules executor. Glues block/inline parsers and does intermediate
14626  * transformations.
14627  **/
14628
14629
14630
14631 var Ruler  = __webpack_require__(62);
14632
14633
14634 var _rules = [
14635   [ 'normalize',      __webpack_require__(63)      ],
14636   [ 'block',          __webpack_require__(64)          ],
14637   [ 'inline',         __webpack_require__(65)         ],
14638   [ 'linkify',        __webpack_require__(66)        ],
14639   [ 'replacements',   __webpack_require__(67)   ],
14640   [ 'smartquotes',    __webpack_require__(68)    ]
14641 ];
14642
14643
14644 /**
14645  * new Core()
14646  **/
14647 function Core() {
14648   /**
14649    * Core#ruler -> Ruler
14650    *
14651    * [[Ruler]] instance. Keep configuration of core rules.
14652    **/
14653   this.ruler = new Ruler();
14654
14655   for (var i = 0; i < _rules.length; i++) {
14656     this.ruler.push(_rules[i][0], _rules[i][1]);
14657   }
14658 }
14659
14660
14661 /**
14662  * Core.process(state)
14663  *
14664  * Executes core chain rules.
14665  **/
14666 Core.prototype.process = function (state) {
14667   var i, l, rules;
14668
14669   rules = this.ruler.getRules('');
14670
14671   for (i = 0, l = rules.length; i < l; i++) {
14672     rules[i](state);
14673   }
14674 };
14675
14676 Core.prototype.State = __webpack_require__(69);
14677
14678
14679 module.exports = Core;
14680
14681
14682 /***/ }),
14683 /* 62 */
14684 /***/ (function(module, exports, __webpack_require__) {
14685
14686 "use strict";
14687 /**
14688  * class Ruler
14689  *
14690  * Helper class, used by [[MarkdownIt#core]], [[MarkdownIt#block]] and
14691  * [[MarkdownIt#inline]] to manage sequences of functions (rules):
14692  *
14693  * - keep rules in defined order
14694  * - assign the name to each rule
14695  * - enable/disable rules
14696  * - add/replace rules
14697  * - allow assign rules to additional named chains (in the same)
14698  * - cacheing lists of active rules
14699  *
14700  * You will not need use this class directly until write plugins. For simple
14701  * rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
14702  * [[MarkdownIt.use]].
14703  **/
14704
14705
14706
14707 /**
14708  * new Ruler()
14709  **/
14710 function Ruler() {
14711   // List of added rules. Each element is:
14712   //
14713   // {
14714   //   name: XXX,
14715   //   enabled: Boolean,
14716   //   fn: Function(),
14717   //   alt: [ name2, name3 ]
14718   // }
14719   //
14720   this.__rules__ = [];
14721
14722   // Cached rule chains.
14723   //
14724   // First level - chain name, '' for default.
14725   // Second level - diginal anchor for fast filtering by charcodes.
14726   //
14727   this.__cache__ = null;
14728 }
14729
14730 ////////////////////////////////////////////////////////////////////////////////
14731 // Helper methods, should not be used directly
14732
14733
14734 // Find rule index by name
14735 //
14736 Ruler.prototype.__find__ = function (name) {
14737   for (var i = 0; i < this.__rules__.length; i++) {
14738     if (this.__rules__[i].name === name) {
14739       return i;
14740     }
14741   }
14742   return -1;
14743 };
14744
14745
14746 // Build rules lookup cache
14747 //
14748 Ruler.prototype.__compile__ = function () {
14749   var self = this;
14750   var chains = [ '' ];
14751
14752   // collect unique names
14753   self.__rules__.forEach(function (rule) {
14754     if (!rule.enabled) { return; }
14755
14756     rule.alt.forEach(function (altName) {
14757       if (chains.indexOf(altName) < 0) {
14758         chains.push(altName);
14759       }
14760     });
14761   });
14762
14763   self.__cache__ = {};
14764
14765   chains.forEach(function (chain) {
14766     self.__cache__[chain] = [];
14767     self.__rules__.forEach(function (rule) {
14768       if (!rule.enabled) { return; }
14769
14770       if (chain && rule.alt.indexOf(chain) < 0) { return; }
14771
14772       self.__cache__[chain].push(rule.fn);
14773     });
14774   });
14775 };
14776
14777
14778 /**
14779  * Ruler.at(name, fn [, options])
14780  * - name (String): rule name to replace.
14781  * - fn (Function): new rule function.
14782  * - options (Object): new rule options (not mandatory).
14783  *
14784  * Replace rule by name with new function & options. Throws error if name not
14785  * found.
14786  *
14787  * ##### Options:
14788  *
14789  * - __alt__ - array with names of "alternate" chains.
14790  *
14791  * ##### Example
14792  *
14793  * Replace existing typographer replacement rule with new one:
14794  *
14795  * ```javascript
14796  * var md = require('markdown-it')();
14797  *
14798  * md.core.ruler.at('replacements', function replace(state) {
14799  *   //...
14800  * });
14801  * ```
14802  **/
14803 Ruler.prototype.at = function (name, fn, options) {
14804   var index = this.__find__(name);
14805   var opt = options || {};
14806
14807   if (index === -1) { throw new Error('Parser rule not found: ' + name); }
14808
14809   this.__rules__[index].fn = fn;
14810   this.__rules__[index].alt = opt.alt || [];
14811   this.__cache__ = null;
14812 };
14813
14814
14815 /**
14816  * Ruler.before(beforeName, ruleName, fn [, options])
14817  * - beforeName (String): new rule will be added before this one.
14818  * - ruleName (String): name of added rule.
14819  * - fn (Function): rule function.
14820  * - options (Object): rule options (not mandatory).
14821  *
14822  * Add new rule to chain before one with given name. See also
14823  * [[Ruler.after]], [[Ruler.push]].
14824  *
14825  * ##### Options:
14826  *
14827  * - __alt__ - array with names of "alternate" chains.
14828  *
14829  * ##### Example
14830  *
14831  * ```javascript
14832  * var md = require('markdown-it')();
14833  *
14834  * md.block.ruler.before('paragraph', 'my_rule', function replace(state) {
14835  *   //...
14836  * });
14837  * ```
14838  **/
14839 Ruler.prototype.before = function (beforeName, ruleName, fn, options) {
14840   var index = this.__find__(beforeName);
14841   var opt = options || {};
14842
14843   if (index === -1) { throw new Error('Parser rule not found: ' + beforeName); }
14844
14845   this.__rules__.splice(index, 0, {
14846     name: ruleName,
14847     enabled: true,
14848     fn: fn,
14849     alt: opt.alt || []
14850   });
14851
14852   this.__cache__ = null;
14853 };
14854
14855
14856 /**
14857  * Ruler.after(afterName, ruleName, fn [, options])
14858  * - afterName (String): new rule will be added after this one.
14859  * - ruleName (String): name of added rule.
14860  * - fn (Function): rule function.
14861  * - options (Object): rule options (not mandatory).
14862  *
14863  * Add new rule to chain after one with given name. See also
14864  * [[Ruler.before]], [[Ruler.push]].
14865  *
14866  * ##### Options:
14867  *
14868  * - __alt__ - array with names of "alternate" chains.
14869  *
14870  * ##### Example
14871  *
14872  * ```javascript
14873  * var md = require('markdown-it')();
14874  *
14875  * md.inline.ruler.after('text', 'my_rule', function replace(state) {
14876  *   //...
14877  * });
14878  * ```
14879  **/
14880 Ruler.prototype.after = function (afterName, ruleName, fn, options) {
14881   var index = this.__find__(afterName);
14882   var opt = options || {};
14883
14884   if (index === -1) { throw new Error('Parser rule not found: ' + afterName); }
14885
14886   this.__rules__.splice(index + 1, 0, {
14887     name: ruleName,
14888     enabled: true,
14889     fn: fn,
14890     alt: opt.alt || []
14891   });
14892
14893   this.__cache__ = null;
14894 };
14895
14896 /**
14897  * Ruler.push(ruleName, fn [, options])
14898  * - ruleName (String): name of added rule.
14899  * - fn (Function): rule function.
14900  * - options (Object): rule options (not mandatory).
14901  *
14902  * Push new rule to the end of chain. See also
14903  * [[Ruler.before]], [[Ruler.after]].
14904  *
14905  * ##### Options:
14906  *
14907  * - __alt__ - array with names of "alternate" chains.
14908  *
14909  * ##### Example
14910  *
14911  * ```javascript
14912  * var md = require('markdown-it')();
14913  *
14914  * md.core.ruler.push('my_rule', function replace(state) {
14915  *   //...
14916  * });
14917  * ```
14918  **/
14919 Ruler.prototype.push = function (ruleName, fn, options) {
14920   var opt = options || {};
14921
14922   this.__rules__.push({
14923     name: ruleName,
14924     enabled: true,
14925     fn: fn,
14926     alt: opt.alt || []
14927   });
14928
14929   this.__cache__ = null;
14930 };
14931
14932
14933 /**
14934  * Ruler.enable(list [, ignoreInvalid]) -> Array
14935  * - list (String|Array): list of rule names to enable.
14936  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
14937  *
14938  * Enable rules with given names. If any rule name not found - throw Error.
14939  * Errors can be disabled by second param.
14940  *
14941  * Returns list of found rule names (if no exception happened).
14942  *
14943  * See also [[Ruler.disable]], [[Ruler.enableOnly]].
14944  **/
14945 Ruler.prototype.enable = function (list, ignoreInvalid) {
14946   if (!Array.isArray(list)) { list = [ list ]; }
14947
14948   var result = [];
14949
14950   // Search by name and enable
14951   list.forEach(function (name) {
14952     var idx = this.__find__(name);
14953
14954     if (idx < 0) {
14955       if (ignoreInvalid) { return; }
14956       throw new Error('Rules manager: invalid rule name ' + name);
14957     }
14958     this.__rules__[idx].enabled = true;
14959     result.push(name);
14960   }, this);
14961
14962   this.__cache__ = null;
14963   return result;
14964 };
14965
14966
14967 /**
14968  * Ruler.enableOnly(list [, ignoreInvalid])
14969  * - list (String|Array): list of rule names to enable (whitelist).
14970  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
14971  *
14972  * Enable rules with given names, and disable everything else. If any rule name
14973  * not found - throw Error. Errors can be disabled by second param.
14974  *
14975  * See also [[Ruler.disable]], [[Ruler.enable]].
14976  **/
14977 Ruler.prototype.enableOnly = function (list, ignoreInvalid) {
14978   if (!Array.isArray(list)) { list = [ list ]; }
14979
14980   this.__rules__.forEach(function (rule) { rule.enabled = false; });
14981
14982   this.enable(list, ignoreInvalid);
14983 };
14984
14985
14986 /**
14987  * Ruler.disable(list [, ignoreInvalid]) -> Array
14988  * - list (String|Array): list of rule names to disable.
14989  * - ignoreInvalid (Boolean): set `true` to ignore errors when rule not found.
14990  *
14991  * Disable rules with given names. If any rule name not found - throw Error.
14992  * Errors can be disabled by second param.
14993  *
14994  * Returns list of found rule names (if no exception happened).
14995  *
14996  * See also [[Ruler.enable]], [[Ruler.enableOnly]].
14997  **/
14998 Ruler.prototype.disable = function (list, ignoreInvalid) {
14999   if (!Array.isArray(list)) { list = [ list ]; }
15000
15001   var result = [];
15002
15003   // Search by name and disable
15004   list.forEach(function (name) {
15005     var idx = this.__find__(name);
15006
15007     if (idx < 0) {
15008       if (ignoreInvalid) { return; }
15009       throw new Error('Rules manager: invalid rule name ' + name);
15010     }
15011     this.__rules__[idx].enabled = false;
15012     result.push(name);
15013   }, this);
15014
15015   this.__cache__ = null;
15016   return result;
15017 };
15018
15019
15020 /**
15021  * Ruler.getRules(chainName) -> Array
15022  *
15023  * Return array of active functions (rules) for given chain name. It analyzes
15024  * rules configuration, compiles caches if not exists and returns result.
15025  *
15026  * Default chain name is `''` (empty string). It can't be skipped. That's
15027  * done intentionally, to keep signature monomorphic for high speed.
15028  **/
15029 Ruler.prototype.getRules = function (chainName) {
15030   if (this.__cache__ === null) {
15031     this.__compile__();
15032   }
15033
15034   // Chain can be empty, if rules disabled. But we still have to return Array.
15035   return this.__cache__[chainName] || [];
15036 };
15037
15038 module.exports = Ruler;
15039
15040
15041 /***/ }),
15042 /* 63 */
15043 /***/ (function(module, exports, __webpack_require__) {
15044
15045 "use strict";
15046 // Normalize input string
15047
15048
15049
15050
15051 // https://spec.commonmark.org/0.29/#line-ending
15052 var NEWLINES_RE  = /\r\n?|\n/g;
15053 var NULL_RE      = /\0/g;
15054
15055
15056 module.exports = function normalize(state) {
15057   var str;
15058
15059   // Normalize newlines
15060   str = state.src.replace(NEWLINES_RE, '\n');
15061
15062   // Replace NULL characters
15063   str = str.replace(NULL_RE, '\uFFFD');
15064
15065   state.src = str;
15066 };
15067
15068
15069 /***/ }),
15070 /* 64 */
15071 /***/ (function(module, exports, __webpack_require__) {
15072
15073 "use strict";
15074
15075
15076
15077 module.exports = function block(state) {
15078   var token;
15079
15080   if (state.inlineMode) {
15081     token          = new state.Token('inline', '', 0);
15082     token.content  = state.src;
15083     token.map      = [ 0, 1 ];
15084     token.children = [];
15085     state.tokens.push(token);
15086   } else {
15087     state.md.block.parse(state.src, state.md, state.env, state.tokens);
15088   }
15089 };
15090
15091
15092 /***/ }),
15093 /* 65 */
15094 /***/ (function(module, exports, __webpack_require__) {
15095
15096 "use strict";
15097
15098
15099 module.exports = function inline(state) {
15100   var tokens = state.tokens, tok, i, l;
15101
15102   // Parse inlines
15103   for (i = 0, l = tokens.length; i < l; i++) {
15104     tok = tokens[i];
15105     if (tok.type === 'inline') {
15106       state.md.inline.parse(tok.content, state.md, state.env, tok.children);
15107     }
15108   }
15109 };
15110
15111
15112 /***/ }),
15113 /* 66 */
15114 /***/ (function(module, exports, __webpack_require__) {
15115
15116 "use strict";
15117 // Replace link-like texts with link nodes.
15118 //
15119 // Currently restricted by `md.validateLink()` to http/https/ftp
15120 //
15121
15122
15123
15124 var arrayReplaceAt = __webpack_require__(42).arrayReplaceAt;
15125
15126
15127 function isLinkOpen(str) {
15128   return /^<a[>\s]/i.test(str);
15129 }
15130 function isLinkClose(str) {
15131   return /^<\/a\s*>/i.test(str);
15132 }
15133
15134
15135 module.exports = function linkify(state) {
15136   var i, j, l, tokens, token, currentToken, nodes, ln, text, pos, lastPos,
15137       level, htmlLinkLevel, url, fullUrl, urlText,
15138       blockTokens = state.tokens,
15139       links;
15140
15141   if (!state.md.options.linkify) { return; }
15142
15143   for (j = 0, l = blockTokens.length; j < l; j++) {
15144     if (blockTokens[j].type !== 'inline' ||
15145         !state.md.linkify.pretest(blockTokens[j].content)) {
15146       continue;
15147     }
15148
15149     tokens = blockTokens[j].children;
15150
15151     htmlLinkLevel = 0;
15152
15153     // We scan from the end, to keep position when new tags added.
15154     // Use reversed logic in links start/end match
15155     for (i = tokens.length - 1; i >= 0; i--) {
15156       currentToken = tokens[i];
15157
15158       // Skip content of markdown links
15159       if (currentToken.type === 'link_close') {
15160         i--;
15161         while (tokens[i].level !== currentToken.level && tokens[i].type !== 'link_open') {
15162           i--;
15163         }
15164         continue;
15165       }
15166
15167       // Skip content of html tag links
15168       if (currentToken.type === 'html_inline') {
15169         if (isLinkOpen(currentToken.content) && htmlLinkLevel > 0) {
15170           htmlLinkLevel--;
15171         }
15172         if (isLinkClose(currentToken.content)) {
15173           htmlLinkLevel++;
15174         }
15175       }
15176       if (htmlLinkLevel > 0) { continue; }
15177
15178       if (currentToken.type === 'text' && state.md.linkify.test(currentToken.content)) {
15179
15180         text = currentToken.content;
15181         links = state.md.linkify.match(text);
15182
15183         // Now split string to nodes
15184         nodes = [];
15185         level = currentToken.level;
15186         lastPos = 0;
15187
15188         for (ln = 0; ln < links.length; ln++) {
15189
15190           url = links[ln].url;
15191           fullUrl = state.md.normalizeLink(url);
15192           if (!state.md.validateLink(fullUrl)) { continue; }
15193
15194           urlText = links[ln].text;
15195
15196           // Linkifier might send raw hostnames like "example.com", where url
15197           // starts with domain name. So we prepend http:// in those cases,
15198           // and remove it afterwards.
15199           //
15200           if (!links[ln].schema) {
15201             urlText = state.md.normalizeLinkText('http://' + urlText).replace(/^http:\/\//, '');
15202           } else if (links[ln].schema === 'mailto:' && !/^mailto:/i.test(urlText)) {
15203             urlText = state.md.normalizeLinkText('mailto:' + urlText).replace(/^mailto:/, '');
15204           } else {
15205             urlText = state.md.normalizeLinkText(urlText);
15206           }
15207
15208           pos = links[ln].index;
15209
15210           if (pos > lastPos) {
15211             token         = new state.Token('text', '', 0);
15212             token.content = text.slice(lastPos, pos);
15213             token.level   = level;
15214             nodes.push(token);
15215           }
15216
15217           token         = new state.Token('link_open', 'a', 1);
15218           token.attrs   = [ [ 'href', fullUrl ] ];
15219           token.level   = level++;
15220           token.markup  = 'linkify';
15221           token.info    = 'auto';
15222           nodes.push(token);
15223
15224           token         = new state.Token('text', '', 0);
15225           token.content = urlText;
15226           token.level   = level;
15227           nodes.push(token);
15228
15229           token         = new state.Token('link_close', 'a', -1);
15230           token.level   = --level;
15231           token.markup  = 'linkify';
15232           token.info    = 'auto';
15233           nodes.push(token);
15234
15235           lastPos = links[ln].lastIndex;
15236         }
15237         if (lastPos < text.length) {
15238           token         = new state.Token('text', '', 0);
15239           token.content = text.slice(lastPos);
15240           token.level   = level;
15241           nodes.push(token);
15242         }
15243
15244         // replace current node
15245         blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
15246       }
15247     }
15248   }
15249 };
15250
15251
15252 /***/ }),
15253 /* 67 */
15254 /***/ (function(module, exports, __webpack_require__) {
15255
15256 "use strict";
15257 // Simple typographic replacements
15258 //
15259 // (c) (C) → ©
15260 // (tm) (TM) → ™
15261 // (r) (R) → ®
15262 // +- → ±
15263 // (p) (P) -> §
15264 // ... → … (also ?.... → ?.., !.... → !..)
15265 // ???????? → ???, !!!!! → !!!, `,,` → `,`
15266 // -- → &ndash;, --- → &mdash;
15267 //
15268
15269
15270 // TODO:
15271 // - fractionals 1/2, 1/4, 3/4 -> ½, ¼, ¾
15272 // - miltiplication 2 x 4 -> 2 × 4
15273
15274 var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/;
15275
15276 // Workaround for phantomjs - need regex without /g flag,
15277 // or root check will fail every second time
15278 var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i;
15279
15280 var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
15281 var SCOPED_ABBR = {
15282   c: '©',
15283   r: '®',
15284   p: '§',
15285   tm: '™'
15286 };
15287
15288 function replaceFn(match, name) {
15289   return SCOPED_ABBR[name.toLowerCase()];
15290 }
15291
15292 function replace_scoped(inlineTokens) {
15293   var i, token, inside_autolink = 0;
15294
15295   for (i = inlineTokens.length - 1; i >= 0; i--) {
15296     token = inlineTokens[i];
15297
15298     if (token.type === 'text' && !inside_autolink) {
15299       token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn);
15300     }
15301
15302     if (token.type === 'link_open' && token.info === 'auto') {
15303       inside_autolink--;
15304     }
15305
15306     if (token.type === 'link_close' && token.info === 'auto') {
15307       inside_autolink++;
15308     }
15309   }
15310 }
15311
15312 function replace_rare(inlineTokens) {
15313   var i, token, inside_autolink = 0;
15314
15315   for (i = inlineTokens.length - 1; i >= 0; i--) {
15316     token = inlineTokens[i];
15317
15318     if (token.type === 'text' && !inside_autolink) {
15319       if (RARE_RE.test(token.content)) {
15320         token.content = token.content
15321           .replace(/\+-/g, '±')
15322           // .., ..., ....... -> …
15323           // but ?..... & !..... -> ?.. & !..
15324           .replace(/\.{2,}/g, '…').replace(/([?!])…/g, '$1..')
15325           .replace(/([?!]){4,}/g, '$1$1$1').replace(/,{2,}/g, ',')
15326           // em-dash
15327           .replace(/(^|[^-])---([^-]|$)/mg, '$1\u2014$2')
15328           // en-dash
15329           .replace(/(^|\s)--(\s|$)/mg, '$1\u2013$2')
15330           .replace(/(^|[^-\s])--([^-\s]|$)/mg, '$1\u2013$2');
15331       }
15332     }
15333
15334     if (token.type === 'link_open' && token.info === 'auto') {
15335       inside_autolink--;
15336     }
15337
15338     if (token.type === 'link_close' && token.info === 'auto') {
15339       inside_autolink++;
15340     }
15341   }
15342 }
15343
15344
15345 module.exports = function replace(state) {
15346   var blkIdx;
15347
15348   if (!state.md.options.typographer) { return; }
15349
15350   for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
15351
15352     if (state.tokens[blkIdx].type !== 'inline') { continue; }
15353
15354     if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) {
15355       replace_scoped(state.tokens[blkIdx].children);
15356     }
15357
15358     if (RARE_RE.test(state.tokens[blkIdx].content)) {
15359       replace_rare(state.tokens[blkIdx].children);
15360     }
15361
15362   }
15363 };
15364
15365
15366 /***/ }),
15367 /* 68 */
15368 /***/ (function(module, exports, __webpack_require__) {
15369
15370 "use strict";
15371 // Convert straight quotation marks to typographic ones
15372 //
15373
15374
15375
15376 var isWhiteSpace   = __webpack_require__(42).isWhiteSpace;
15377 var isPunctChar    = __webpack_require__(42).isPunctChar;
15378 var isMdAsciiPunct = __webpack_require__(42).isMdAsciiPunct;
15379
15380 var QUOTE_TEST_RE = /['"]/;
15381 var QUOTE_RE = /['"]/g;
15382 var APOSTROPHE = '\u2019'; /* ’ */
15383
15384
15385 function replaceAt(str, index, ch) {
15386   return str.substr(0, index) + ch + str.substr(index + 1);
15387 }
15388
15389 function process_inlines(tokens, state) {
15390   var i, token, text, t, pos, max, thisLevel, item, lastChar, nextChar,
15391       isLastPunctChar, isNextPunctChar, isLastWhiteSpace, isNextWhiteSpace,
15392       canOpen, canClose, j, isSingle, stack, openQuote, closeQuote;
15393
15394   stack = [];
15395
15396   for (i = 0; i < tokens.length; i++) {
15397     token = tokens[i];
15398
15399     thisLevel = tokens[i].level;
15400
15401     for (j = stack.length - 1; j >= 0; j--) {
15402       if (stack[j].level <= thisLevel) { break; }
15403     }
15404     stack.length = j + 1;
15405
15406     if (token.type !== 'text') { continue; }
15407
15408     text = token.content;
15409     pos = 0;
15410     max = text.length;
15411
15412     /*eslint no-labels:0,block-scoped-var:0*/
15413     OUTER:
15414     while (pos < max) {
15415       QUOTE_RE.lastIndex = pos;
15416       t = QUOTE_RE.exec(text);
15417       if (!t) { break; }
15418
15419       canOpen = canClose = true;
15420       pos = t.index + 1;
15421       isSingle = (t[0] === "'");
15422
15423       // Find previous character,
15424       // default to space if it's the beginning of the line
15425       //
15426       lastChar = 0x20;
15427
15428       if (t.index - 1 >= 0) {
15429         lastChar = text.charCodeAt(t.index - 1);
15430       } else {
15431         for (j = i - 1; j >= 0; j--) {
15432           if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // lastChar defaults to 0x20
15433           if (tokens[j].type !== 'text') continue;
15434
15435           lastChar = tokens[j].content.charCodeAt(tokens[j].content.length - 1);
15436           break;
15437         }
15438       }
15439
15440       // Find next character,
15441       // default to space if it's the end of the line
15442       //
15443       nextChar = 0x20;
15444
15445       if (pos < max) {
15446         nextChar = text.charCodeAt(pos);
15447       } else {
15448         for (j = i + 1; j < tokens.length; j++) {
15449           if (tokens[j].type === 'softbreak' || tokens[j].type === 'hardbreak') break; // nextChar defaults to 0x20
15450           if (tokens[j].type !== 'text') continue;
15451
15452           nextChar = tokens[j].content.charCodeAt(0);
15453           break;
15454         }
15455       }
15456
15457       isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
15458       isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
15459
15460       isLastWhiteSpace = isWhiteSpace(lastChar);
15461       isNextWhiteSpace = isWhiteSpace(nextChar);
15462
15463       if (isNextWhiteSpace) {
15464         canOpen = false;
15465       } else if (isNextPunctChar) {
15466         if (!(isLastWhiteSpace || isLastPunctChar)) {
15467           canOpen = false;
15468         }
15469       }
15470
15471       if (isLastWhiteSpace) {
15472         canClose = false;
15473       } else if (isLastPunctChar) {
15474         if (!(isNextWhiteSpace || isNextPunctChar)) {
15475           canClose = false;
15476         }
15477       }
15478
15479       if (nextChar === 0x22 /* " */ && t[0] === '"') {
15480         if (lastChar >= 0x30 /* 0 */ && lastChar <= 0x39 /* 9 */) {
15481           // special case: 1"" - count first quote as an inch
15482           canClose = canOpen = false;
15483         }
15484       }
15485
15486       if (canOpen && canClose) {
15487         // treat this as the middle of the word
15488         canOpen = false;
15489         canClose = isNextPunctChar;
15490       }
15491
15492       if (!canOpen && !canClose) {
15493         // middle of word
15494         if (isSingle) {
15495           token.content = replaceAt(token.content, t.index, APOSTROPHE);
15496         }
15497         continue;
15498       }
15499
15500       if (canClose) {
15501         // this could be a closing quote, rewind the stack to get a match
15502         for (j = stack.length - 1; j >= 0; j--) {
15503           item = stack[j];
15504           if (stack[j].level < thisLevel) { break; }
15505           if (item.single === isSingle && stack[j].level === thisLevel) {
15506             item = stack[j];
15507
15508             if (isSingle) {
15509               openQuote = state.md.options.quotes[2];
15510               closeQuote = state.md.options.quotes[3];
15511             } else {
15512               openQuote = state.md.options.quotes[0];
15513               closeQuote = state.md.options.quotes[1];
15514             }
15515
15516             // replace token.content *before* tokens[item.token].content,
15517             // because, if they are pointing at the same token, replaceAt
15518             // could mess up indices when quote length != 1
15519             token.content = replaceAt(token.content, t.index, closeQuote);
15520             tokens[item.token].content = replaceAt(
15521               tokens[item.token].content, item.pos, openQuote);
15522
15523             pos += closeQuote.length - 1;
15524             if (item.token === i) { pos += openQuote.length - 1; }
15525
15526             text = token.content;
15527             max = text.length;
15528
15529             stack.length = j;
15530             continue OUTER;
15531           }
15532         }
15533       }
15534
15535       if (canOpen) {
15536         stack.push({
15537           token: i,
15538           pos: t.index,
15539           single: isSingle,
15540           level: thisLevel
15541         });
15542       } else if (canClose && isSingle) {
15543         token.content = replaceAt(token.content, t.index, APOSTROPHE);
15544       }
15545     }
15546   }
15547 }
15548
15549
15550 module.exports = function smartquotes(state) {
15551   /*eslint max-depth:0*/
15552   var blkIdx;
15553
15554   if (!state.md.options.typographer) { return; }
15555
15556   for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) {
15557
15558     if (state.tokens[blkIdx].type !== 'inline' ||
15559         !QUOTE_TEST_RE.test(state.tokens[blkIdx].content)) {
15560       continue;
15561     }
15562
15563     process_inlines(state.tokens[blkIdx].children, state);
15564   }
15565 };
15566
15567
15568 /***/ }),
15569 /* 69 */
15570 /***/ (function(module, exports, __webpack_require__) {
15571
15572 "use strict";
15573 // Core state object
15574 //
15575
15576
15577 var Token = __webpack_require__(70);
15578
15579
15580 function StateCore(src, md, env) {
15581   this.src = src;
15582   this.env = env;
15583   this.tokens = [];
15584   this.inlineMode = false;
15585   this.md = md; // link to parser instance
15586 }
15587
15588 // re-export Token class to use in core rules
15589 StateCore.prototype.Token = Token;
15590
15591
15592 module.exports = StateCore;
15593
15594
15595 /***/ }),
15596 /* 70 */
15597 /***/ (function(module, exports, __webpack_require__) {
15598
15599 "use strict";
15600 // Token class
15601
15602
15603
15604
15605 /**
15606  * class Token
15607  **/
15608
15609 /**
15610  * new Token(type, tag, nesting)
15611  *
15612  * Create new token and fill passed properties.
15613  **/
15614 function Token(type, tag, nesting) {
15615   /**
15616    * Token#type -> String
15617    *
15618    * Type of the token (string, e.g. "paragraph_open")
15619    **/
15620   this.type     = type;
15621
15622   /**
15623    * Token#tag -> String
15624    *
15625    * html tag name, e.g. "p"
15626    **/
15627   this.tag      = tag;
15628
15629   /**
15630    * Token#attrs -> Array
15631    *
15632    * Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
15633    **/
15634   this.attrs    = null;
15635
15636   /**
15637    * Token#map -> Array
15638    *
15639    * Source map info. Format: `[ line_begin, line_end ]`
15640    **/
15641   this.map      = null;
15642
15643   /**
15644    * Token#nesting -> Number
15645    *
15646    * Level change (number in {-1, 0, 1} set), where:
15647    *
15648    * -  `1` means the tag is opening
15649    * -  `0` means the tag is self-closing
15650    * - `-1` means the tag is closing
15651    **/
15652   this.nesting  = nesting;
15653
15654   /**
15655    * Token#level -> Number
15656    *
15657    * nesting level, the same as `state.level`
15658    **/
15659   this.level    = 0;
15660
15661   /**
15662    * Token#children -> Array
15663    *
15664    * An array of child nodes (inline and img tokens)
15665    **/
15666   this.children = null;
15667
15668   /**
15669    * Token#content -> String
15670    *
15671    * In a case of self-closing tag (code, html, fence, etc.),
15672    * it has contents of this tag.
15673    **/
15674   this.content  = '';
15675
15676   /**
15677    * Token#markup -> String
15678    *
15679    * '*' or '_' for emphasis, fence string for fence, etc.
15680    **/
15681   this.markup   = '';
15682
15683   /**
15684    * Token#info -> String
15685    *
15686    * fence infostring
15687    **/
15688   this.info     = '';
15689
15690   /**
15691    * Token#meta -> Object
15692    *
15693    * A place for plugins to store an arbitrary data
15694    **/
15695   this.meta     = null;
15696
15697   /**
15698    * Token#block -> Boolean
15699    *
15700    * True for block-level tokens, false for inline tokens.
15701    * Used in renderer to calculate line breaks
15702    **/
15703   this.block    = false;
15704
15705   /**
15706    * Token#hidden -> Boolean
15707    *
15708    * If it's true, ignore this element when rendering. Used for tight lists
15709    * to hide paragraphs.
15710    **/
15711   this.hidden   = false;
15712 }
15713
15714
15715 /**
15716  * Token.attrIndex(name) -> Number
15717  *
15718  * Search attribute index by name.
15719  **/
15720 Token.prototype.attrIndex = function attrIndex(name) {
15721   var attrs, i, len;
15722
15723   if (!this.attrs) { return -1; }
15724
15725   attrs = this.attrs;
15726
15727   for (i = 0, len = attrs.length; i < len; i++) {
15728     if (attrs[i][0] === name) { return i; }
15729   }
15730   return -1;
15731 };
15732
15733
15734 /**
15735  * Token.attrPush(attrData)
15736  *
15737  * Add `[ name, value ]` attribute to list. Init attrs if necessary
15738  **/
15739 Token.prototype.attrPush = function attrPush(attrData) {
15740   if (this.attrs) {
15741     this.attrs.push(attrData);
15742   } else {
15743     this.attrs = [ attrData ];
15744   }
15745 };
15746
15747
15748 /**
15749  * Token.attrSet(name, value)
15750  *
15751  * Set `name` attribute to `value`. Override old value if exists.
15752  **/
15753 Token.prototype.attrSet = function attrSet(name, value) {
15754   var idx = this.attrIndex(name),
15755       attrData = [ name, value ];
15756
15757   if (idx < 0) {
15758     this.attrPush(attrData);
15759   } else {
15760     this.attrs[idx] = attrData;
15761   }
15762 };
15763
15764
15765 /**
15766  * Token.attrGet(name)
15767  *
15768  * Get the value of attribute `name`, or null if it does not exist.
15769  **/
15770 Token.prototype.attrGet = function attrGet(name) {
15771   var idx = this.attrIndex(name), value = null;
15772   if (idx >= 0) {
15773     value = this.attrs[idx][1];
15774   }
15775   return value;
15776 };
15777
15778
15779 /**
15780  * Token.attrJoin(name, value)
15781  *
15782  * Join value to existing attribute via space. Or create new attribute if not
15783  * exists. Useful to operate with token classes.
15784  **/
15785 Token.prototype.attrJoin = function attrJoin(name, value) {
15786   var idx = this.attrIndex(name);
15787
15788   if (idx < 0) {
15789     this.attrPush([ name, value ]);
15790   } else {
15791     this.attrs[idx][1] = this.attrs[idx][1] + ' ' + value;
15792   }
15793 };
15794
15795
15796 module.exports = Token;
15797
15798
15799 /***/ }),
15800 /* 71 */
15801 /***/ (function(module, exports, __webpack_require__) {
15802
15803 "use strict";
15804 /** internal
15805  * class ParserBlock
15806  *
15807  * Block-level tokenizer.
15808  **/
15809
15810
15811
15812 var Ruler           = __webpack_require__(62);
15813
15814
15815 var _rules = [
15816   // First 2 params - rule name & source. Secondary array - list of rules,
15817   // which can be terminated by this one.
15818   [ 'table',      __webpack_require__(72),      [ 'paragraph', 'reference' ] ],
15819   [ 'code',       __webpack_require__(73) ],
15820   [ 'fence',      __webpack_require__(74),      [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
15821   [ 'blockquote', __webpack_require__(75), [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
15822   [ 'hr',         __webpack_require__(76),         [ 'paragraph', 'reference', 'blockquote', 'list' ] ],
15823   [ 'list',       __webpack_require__(77),       [ 'paragraph', 'reference', 'blockquote' ] ],
15824   [ 'reference',  __webpack_require__(78) ],
15825   [ 'heading',    __webpack_require__(79),    [ 'paragraph', 'reference', 'blockquote' ] ],
15826   [ 'lheading',   __webpack_require__(80) ],
15827   [ 'html_block', __webpack_require__(81), [ 'paragraph', 'reference', 'blockquote' ] ],
15828   [ 'paragraph',  __webpack_require__(84) ]
15829 ];
15830
15831
15832 /**
15833  * new ParserBlock()
15834  **/
15835 function ParserBlock() {
15836   /**
15837    * ParserBlock#ruler -> Ruler
15838    *
15839    * [[Ruler]] instance. Keep configuration of block rules.
15840    **/
15841   this.ruler = new Ruler();
15842
15843   for (var i = 0; i < _rules.length; i++) {
15844     this.ruler.push(_rules[i][0], _rules[i][1], { alt: (_rules[i][2] || []).slice() });
15845   }
15846 }
15847
15848
15849 // Generate tokens for input range
15850 //
15851 ParserBlock.prototype.tokenize = function (state, startLine, endLine) {
15852   var ok, i,
15853       rules = this.ruler.getRules(''),
15854       len = rules.length,
15855       line = startLine,
15856       hasEmptyLines = false,
15857       maxNesting = state.md.options.maxNesting;
15858
15859   while (line < endLine) {
15860     state.line = line = state.skipEmptyLines(line);
15861     if (line >= endLine) { break; }
15862
15863     // Termination condition for nested calls.
15864     // Nested calls currently used for blockquotes & lists
15865     if (state.sCount[line] < state.blkIndent) { break; }
15866
15867     // If nesting level exceeded - skip tail to the end. That's not ordinary
15868     // situation and we should not care about content.
15869     if (state.level >= maxNesting) {
15870       state.line = endLine;
15871       break;
15872     }
15873
15874     // Try all possible rules.
15875     // On success, rule should:
15876     //
15877     // - update `state.line`
15878     // - update `state.tokens`
15879     // - return true
15880
15881     for (i = 0; i < len; i++) {
15882       ok = rules[i](state, line, endLine, false);
15883       if (ok) { break; }
15884     }
15885
15886     // set state.tight if we had an empty line before current tag
15887     // i.e. latest empty line should not count
15888     state.tight = !hasEmptyLines;
15889
15890     // paragraph might "eat" one newline after it in nested lists
15891     if (state.isEmpty(state.line - 1)) {
15892       hasEmptyLines = true;
15893     }
15894
15895     line = state.line;
15896
15897     if (line < endLine && state.isEmpty(line)) {
15898       hasEmptyLines = true;
15899       line++;
15900       state.line = line;
15901     }
15902   }
15903 };
15904
15905
15906 /**
15907  * ParserBlock.parse(str, md, env, outTokens)
15908  *
15909  * Process input string and push block tokens into `outTokens`
15910  **/
15911 ParserBlock.prototype.parse = function (src, md, env, outTokens) {
15912   var state;
15913
15914   if (!src) { return; }
15915
15916   state = new this.State(src, md, env, outTokens);
15917
15918   this.tokenize(state, state.line, state.lineMax);
15919 };
15920
15921
15922 ParserBlock.prototype.State = __webpack_require__(85);
15923
15924
15925 module.exports = ParserBlock;
15926
15927
15928 /***/ }),
15929 /* 72 */
15930 /***/ (function(module, exports, __webpack_require__) {
15931
15932 "use strict";
15933 // GFM table, non-standard
15934
15935
15936
15937 var isSpace = __webpack_require__(42).isSpace;
15938
15939
15940 function getLine(state, line) {
15941   var pos = state.bMarks[line] + state.blkIndent,
15942       max = state.eMarks[line];
15943
15944   return state.src.substr(pos, max - pos);
15945 }
15946
15947 function escapedSplit(str) {
15948   var result = [],
15949       pos = 0,
15950       max = str.length,
15951       ch,
15952       escapes = 0,
15953       lastPos = 0,
15954       backTicked = false,
15955       lastBackTick = 0;
15956
15957   ch  = str.charCodeAt(pos);
15958
15959   while (pos < max) {
15960     if (ch === 0x60/* ` */) {
15961       if (backTicked) {
15962         // make \` close code sequence, but not open it;
15963         // the reason is: `\` is correct code block
15964         backTicked = false;
15965         lastBackTick = pos;
15966       } else if (escapes % 2 === 0) {
15967         backTicked = true;
15968         lastBackTick = pos;
15969       }
15970     } else if (ch === 0x7c/* | */ && (escapes % 2 === 0) && !backTicked) {
15971       result.push(str.substring(lastPos, pos));
15972       lastPos = pos + 1;
15973     }
15974
15975     if (ch === 0x5c/* \ */) {
15976       escapes++;
15977     } else {
15978       escapes = 0;
15979     }
15980
15981     pos++;
15982
15983     // If there was an un-closed backtick, go back to just after
15984     // the last backtick, but as if it was a normal character
15985     if (pos === max && backTicked) {
15986       backTicked = false;
15987       pos = lastBackTick + 1;
15988     }
15989
15990     ch = str.charCodeAt(pos);
15991   }
15992
15993   result.push(str.substring(lastPos));
15994
15995   return result;
15996 }
15997
15998
15999 module.exports = function table(state, startLine, endLine, silent) {
16000   var ch, lineText, pos, i, nextLine, columns, columnCount, token,
16001       aligns, t, tableLines, tbodyLines;
16002
16003   // should have at least two lines
16004   if (startLine + 2 > endLine) { return false; }
16005
16006   nextLine = startLine + 1;
16007
16008   if (state.sCount[nextLine] < state.blkIndent) { return false; }
16009
16010   // if it's indented more than 3 spaces, it should be a code block
16011   if (state.sCount[nextLine] - state.blkIndent >= 4) { return false; }
16012
16013   // first character of the second line should be '|', '-', ':',
16014   // and no other characters are allowed but spaces;
16015   // basically, this is the equivalent of /^[-:|][-:|\s]*$/ regexp
16016
16017   pos = state.bMarks[nextLine] + state.tShift[nextLine];
16018   if (pos >= state.eMarks[nextLine]) { return false; }
16019
16020   ch = state.src.charCodeAt(pos++);
16021   if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; }
16022
16023   while (pos < state.eMarks[nextLine]) {
16024     ch = state.src.charCodeAt(pos);
16025
16026     if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */ && !isSpace(ch)) { return false; }
16027
16028     pos++;
16029   }
16030
16031   lineText = getLine(state, startLine + 1);
16032
16033   columns = lineText.split('|');
16034   aligns = [];
16035   for (i = 0; i < columns.length; i++) {
16036     t = columns[i].trim();
16037     if (!t) {
16038       // allow empty columns before and after table, but not in between columns;
16039       // e.g. allow ` |---| `, disallow ` ---||--- `
16040       if (i === 0 || i === columns.length - 1) {
16041         continue;
16042       } else {
16043         return false;
16044       }
16045     }
16046
16047     if (!/^:?-+:?$/.test(t)) { return false; }
16048     if (t.charCodeAt(t.length - 1) === 0x3A/* : */) {
16049       aligns.push(t.charCodeAt(0) === 0x3A/* : */ ? 'center' : 'right');
16050     } else if (t.charCodeAt(0) === 0x3A/* : */) {
16051       aligns.push('left');
16052     } else {
16053       aligns.push('');
16054     }
16055   }
16056
16057   lineText = getLine(state, startLine).trim();
16058   if (lineText.indexOf('|') === -1) { return false; }
16059   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
16060   columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
16061
16062   // header row will define an amount of columns in the entire table,
16063   // and align row shouldn't be smaller than that (the rest of the rows can)
16064   columnCount = columns.length;
16065   if (columnCount > aligns.length) { return false; }
16066
16067   if (silent) { return true; }
16068
16069   token     = state.push('table_open', 'table', 1);
16070   token.map = tableLines = [ startLine, 0 ];
16071
16072   token     = state.push('thead_open', 'thead', 1);
16073   token.map = [ startLine, startLine + 1 ];
16074
16075   token     = state.push('tr_open', 'tr', 1);
16076   token.map = [ startLine, startLine + 1 ];
16077
16078   for (i = 0; i < columns.length; i++) {
16079     token          = state.push('th_open', 'th', 1);
16080     token.map      = [ startLine, startLine + 1 ];
16081     if (aligns[i]) {
16082       token.attrs  = [ [ 'style', 'text-align:' + aligns[i] ] ];
16083     }
16084
16085     token          = state.push('inline', '', 0);
16086     token.content  = columns[i].trim();
16087     token.map      = [ startLine, startLine + 1 ];
16088     token.children = [];
16089
16090     token          = state.push('th_close', 'th', -1);
16091   }
16092
16093   token     = state.push('tr_close', 'tr', -1);
16094   token     = state.push('thead_close', 'thead', -1);
16095
16096   token     = state.push('tbody_open', 'tbody', 1);
16097   token.map = tbodyLines = [ startLine + 2, 0 ];
16098
16099   for (nextLine = startLine + 2; nextLine < endLine; nextLine++) {
16100     if (state.sCount[nextLine] < state.blkIndent) { break; }
16101
16102     lineText = getLine(state, nextLine).trim();
16103     if (lineText.indexOf('|') === -1) { break; }
16104     if (state.sCount[nextLine] - state.blkIndent >= 4) { break; }
16105     columns = escapedSplit(lineText.replace(/^\||\|$/g, ''));
16106
16107     token = state.push('tr_open', 'tr', 1);
16108     for (i = 0; i < columnCount; i++) {
16109       token          = state.push('td_open', 'td', 1);
16110       if (aligns[i]) {
16111         token.attrs  = [ [ 'style', 'text-align:' + aligns[i] ] ];
16112       }
16113
16114       token          = state.push('inline', '', 0);
16115       token.content  = columns[i] ? columns[i].trim() : '';
16116       token.children = [];
16117
16118       token          = state.push('td_close', 'td', -1);
16119     }
16120     token = state.push('tr_close', 'tr', -1);
16121   }
16122   token = state.push('tbody_close', 'tbody', -1);
16123   token = state.push('table_close', 'table', -1);
16124
16125   tableLines[1] = tbodyLines[1] = nextLine;
16126   state.line = nextLine;
16127   return true;
16128 };
16129
16130
16131 /***/ }),
16132 /* 73 */
16133 /***/ (function(module, exports, __webpack_require__) {
16134
16135 "use strict";
16136 // Code block (4 spaces padded)
16137
16138
16139
16140
16141 module.exports = function code(state, startLine, endLine/*, silent*/) {
16142   var nextLine, last, token;
16143
16144   if (state.sCount[startLine] - state.blkIndent < 4) { return false; }
16145
16146   last = nextLine = startLine + 1;
16147
16148   while (nextLine < endLine) {
16149     if (state.isEmpty(nextLine)) {
16150       nextLine++;
16151       continue;
16152     }
16153
16154     if (state.sCount[nextLine] - state.blkIndent >= 4) {
16155       nextLine++;
16156       last = nextLine;
16157       continue;
16158     }
16159     break;
16160   }
16161
16162   state.line = last;
16163
16164   token         = state.push('code_block', 'code', 0);
16165   token.content = state.getLines(startLine, last, 4 + state.blkIndent, true);
16166   token.map     = [ startLine, state.line ];
16167
16168   return true;
16169 };
16170
16171
16172 /***/ }),
16173 /* 74 */
16174 /***/ (function(module, exports, __webpack_require__) {
16175
16176 "use strict";
16177 // fences (``` lang, ~~~ lang)
16178
16179
16180
16181
16182 module.exports = function fence(state, startLine, endLine, silent) {
16183   var marker, len, params, nextLine, mem, token, markup,
16184       haveEndMarker = false,
16185       pos = state.bMarks[startLine] + state.tShift[startLine],
16186       max = state.eMarks[startLine];
16187
16188   // if it's indented more than 3 spaces, it should be a code block
16189   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
16190
16191   if (pos + 3 > max) { return false; }
16192
16193   marker = state.src.charCodeAt(pos);
16194
16195   if (marker !== 0x7E/* ~ */ && marker !== 0x60 /* ` */) {
16196     return false;
16197   }
16198
16199   // scan marker length
16200   mem = pos;
16201   pos = state.skipChars(pos, marker);
16202
16203   len = pos - mem;
16204
16205   if (len < 3) { return false; }
16206
16207   markup = state.src.slice(mem, pos);
16208   params = state.src.slice(pos, max);
16209
16210   if (marker === 0x60 /* ` */) {
16211     if (params.indexOf(String.fromCharCode(marker)) >= 0) {
16212       return false;
16213     }
16214   }
16215
16216   // Since start is found, we can report success here in validation mode
16217   if (silent) { return true; }
16218
16219   // search end of block
16220   nextLine = startLine;
16221
16222   for (;;) {
16223     nextLine++;
16224     if (nextLine >= endLine) {
16225       // unclosed block should be autoclosed by end of document.
16226       // also block seems to be autoclosed by end of parent
16227       break;
16228     }
16229
16230     pos = mem = state.bMarks[nextLine] + state.tShift[nextLine];
16231     max = state.eMarks[nextLine];
16232
16233     if (pos < max && state.sCount[nextLine] < state.blkIndent) {
16234       // non-empty line with negative indent should stop the list:
16235       // - ```
16236       //  test
16237       break;
16238     }
16239
16240     if (state.src.charCodeAt(pos) !== marker) { continue; }
16241
16242     if (state.sCount[nextLine] - state.blkIndent >= 4) {
16243       // closing fence should be indented less than 4 spaces
16244       continue;
16245     }
16246
16247     pos = state.skipChars(pos, marker);
16248
16249     // closing code fence must be at least as long as the opening one
16250     if (pos - mem < len) { continue; }
16251
16252     // make sure tail has spaces only
16253     pos = state.skipSpaces(pos);
16254
16255     if (pos < max) { continue; }
16256
16257     haveEndMarker = true;
16258     // found!
16259     break;
16260   }
16261
16262   // If a fence has heading spaces, they should be removed from its inner block
16263   len = state.sCount[startLine];
16264
16265   state.line = nextLine + (haveEndMarker ? 1 : 0);
16266
16267   token         = state.push('fence', 'code', 0);
16268   token.info    = params;
16269   token.content = state.getLines(startLine + 1, nextLine, len, true);
16270   token.markup  = markup;
16271   token.map     = [ startLine, state.line ];
16272
16273   return true;
16274 };
16275
16276
16277 /***/ }),
16278 /* 75 */
16279 /***/ (function(module, exports, __webpack_require__) {
16280
16281 "use strict";
16282 // Block quotes
16283
16284
16285
16286 var isSpace = __webpack_require__(42).isSpace;
16287
16288
16289 module.exports = function blockquote(state, startLine, endLine, silent) {
16290   var adjustTab,
16291       ch,
16292       i,
16293       initial,
16294       l,
16295       lastLineEmpty,
16296       lines,
16297       nextLine,
16298       offset,
16299       oldBMarks,
16300       oldBSCount,
16301       oldIndent,
16302       oldParentType,
16303       oldSCount,
16304       oldTShift,
16305       spaceAfterMarker,
16306       terminate,
16307       terminatorRules,
16308       token,
16309       wasOutdented,
16310       oldLineMax = state.lineMax,
16311       pos = state.bMarks[startLine] + state.tShift[startLine],
16312       max = state.eMarks[startLine];
16313
16314   // if it's indented more than 3 spaces, it should be a code block
16315   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
16316
16317   // check the block quote marker
16318   if (state.src.charCodeAt(pos++) !== 0x3E/* > */) { return false; }
16319
16320   // we know that it's going to be a valid blockquote,
16321   // so no point trying to find the end of it in silent mode
16322   if (silent) { return true; }
16323
16324   // skip spaces after ">" and re-calculate offset
16325   initial = offset = state.sCount[startLine] + pos - (state.bMarks[startLine] + state.tShift[startLine]);
16326
16327   // skip one optional space after '>'
16328   if (state.src.charCodeAt(pos) === 0x20 /* space */) {
16329     // ' >   test '
16330     //     ^ -- position start of line here:
16331     pos++;
16332     initial++;
16333     offset++;
16334     adjustTab = false;
16335     spaceAfterMarker = true;
16336   } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
16337     spaceAfterMarker = true;
16338
16339     if ((state.bsCount[startLine] + offset) % 4 === 3) {
16340       // '  >\t  test '
16341       //       ^ -- position start of line here (tab has width===1)
16342       pos++;
16343       initial++;
16344       offset++;
16345       adjustTab = false;
16346     } else {
16347       // ' >\t  test '
16348       //    ^ -- position start of line here + shift bsCount slightly
16349       //         to make extra space appear
16350       adjustTab = true;
16351     }
16352   } else {
16353     spaceAfterMarker = false;
16354   }
16355
16356   oldBMarks = [ state.bMarks[startLine] ];
16357   state.bMarks[startLine] = pos;
16358
16359   while (pos < max) {
16360     ch = state.src.charCodeAt(pos);
16361
16362     if (isSpace(ch)) {
16363       if (ch === 0x09) {
16364         offset += 4 - (offset + state.bsCount[startLine] + (adjustTab ? 1 : 0)) % 4;
16365       } else {
16366         offset++;
16367       }
16368     } else {
16369       break;
16370     }
16371
16372     pos++;
16373   }
16374
16375   oldBSCount = [ state.bsCount[startLine] ];
16376   state.bsCount[startLine] = state.sCount[startLine] + 1 + (spaceAfterMarker ? 1 : 0);
16377
16378   lastLineEmpty = pos >= max;
16379
16380   oldSCount = [ state.sCount[startLine] ];
16381   state.sCount[startLine] = offset - initial;
16382
16383   oldTShift = [ state.tShift[startLine] ];
16384   state.tShift[startLine] = pos - state.bMarks[startLine];
16385
16386   terminatorRules = state.md.block.ruler.getRules('blockquote');
16387
16388   oldParentType = state.parentType;
16389   state.parentType = 'blockquote';
16390   wasOutdented = false;
16391
16392   // Search the end of the block
16393   //
16394   // Block ends with either:
16395   //  1. an empty line outside:
16396   //     ```
16397   //     > test
16398   //
16399   //     ```
16400   //  2. an empty line inside:
16401   //     ```
16402   //     >
16403   //     test
16404   //     ```
16405   //  3. another tag:
16406   //     ```
16407   //     > test
16408   //      - - -
16409   //     ```
16410   for (nextLine = startLine + 1; nextLine < endLine; nextLine++) {
16411     // check if it's outdented, i.e. it's inside list item and indented
16412     // less than said list item:
16413     //
16414     // ```
16415     // 1. anything
16416     //    > current blockquote
16417     // 2. checking this line
16418     // ```
16419     if (state.sCount[nextLine] < state.blkIndent) wasOutdented = true;
16420
16421     pos = state.bMarks[nextLine] + state.tShift[nextLine];
16422     max = state.eMarks[nextLine];
16423
16424     if (pos >= max) {
16425       // Case 1: line is not inside the blockquote, and this line is empty.
16426       break;
16427     }
16428
16429     if (state.src.charCodeAt(pos++) === 0x3E/* > */ && !wasOutdented) {
16430       // This line is inside the blockquote.
16431
16432       // skip spaces after ">" and re-calculate offset
16433       initial = offset = state.sCount[nextLine] + pos - (state.bMarks[nextLine] + state.tShift[nextLine]);
16434
16435       // skip one optional space after '>'
16436       if (state.src.charCodeAt(pos) === 0x20 /* space */) {
16437         // ' >   test '
16438         //     ^ -- position start of line here:
16439         pos++;
16440         initial++;
16441         offset++;
16442         adjustTab = false;
16443         spaceAfterMarker = true;
16444       } else if (state.src.charCodeAt(pos) === 0x09 /* tab */) {
16445         spaceAfterMarker = true;
16446
16447         if ((state.bsCount[nextLine] + offset) % 4 === 3) {
16448           // '  >\t  test '
16449           //       ^ -- position start of line here (tab has width===1)
16450           pos++;
16451           initial++;
16452           offset++;
16453           adjustTab = false;
16454         } else {
16455           // ' >\t  test '
16456           //    ^ -- position start of line here + shift bsCount slightly
16457           //         to make extra space appear
16458           adjustTab = true;
16459         }
16460       } else {
16461         spaceAfterMarker = false;
16462       }
16463
16464       oldBMarks.push(state.bMarks[nextLine]);
16465       state.bMarks[nextLine] = pos;
16466
16467       while (pos < max) {
16468         ch = state.src.charCodeAt(pos);
16469
16470         if (isSpace(ch)) {
16471           if (ch === 0x09) {
16472             offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
16473           } else {
16474             offset++;
16475           }
16476         } else {
16477           break;
16478         }
16479
16480         pos++;
16481       }
16482
16483       lastLineEmpty = pos >= max;
16484
16485       oldBSCount.push(state.bsCount[nextLine]);
16486       state.bsCount[nextLine] = state.sCount[nextLine] + 1 + (spaceAfterMarker ? 1 : 0);
16487
16488       oldSCount.push(state.sCount[nextLine]);
16489       state.sCount[nextLine] = offset - initial;
16490
16491       oldTShift.push(state.tShift[nextLine]);
16492       state.tShift[nextLine] = pos - state.bMarks[nextLine];
16493       continue;
16494     }
16495
16496     // Case 2: line is not inside the blockquote, and the last line was empty.
16497     if (lastLineEmpty) { break; }
16498
16499     // Case 3: another tag found.
16500     terminate = false;
16501     for (i = 0, l = terminatorRules.length; i < l; i++) {
16502       if (terminatorRules[i](state, nextLine, endLine, true)) {
16503         terminate = true;
16504         break;
16505       }
16506     }
16507
16508     if (terminate) {
16509       // Quirk to enforce "hard termination mode" for paragraphs;
16510       // normally if you call `tokenize(state, startLine, nextLine)`,
16511       // paragraphs will look below nextLine for paragraph continuation,
16512       // but if blockquote is terminated by another tag, they shouldn't
16513       state.lineMax = nextLine;
16514
16515       if (state.blkIndent !== 0) {
16516         // state.blkIndent was non-zero, we now set it to zero,
16517         // so we need to re-calculate all offsets to appear as
16518         // if indent wasn't changed
16519         oldBMarks.push(state.bMarks[nextLine]);
16520         oldBSCount.push(state.bsCount[nextLine]);
16521         oldTShift.push(state.tShift[nextLine]);
16522         oldSCount.push(state.sCount[nextLine]);
16523         state.sCount[nextLine] -= state.blkIndent;
16524       }
16525
16526       break;
16527     }
16528
16529     oldBMarks.push(state.bMarks[nextLine]);
16530     oldBSCount.push(state.bsCount[nextLine]);
16531     oldTShift.push(state.tShift[nextLine]);
16532     oldSCount.push(state.sCount[nextLine]);
16533
16534     // A negative indentation means that this is a paragraph continuation
16535     //
16536     state.sCount[nextLine] = -1;
16537   }
16538
16539   oldIndent = state.blkIndent;
16540   state.blkIndent = 0;
16541
16542   token        = state.push('blockquote_open', 'blockquote', 1);
16543   token.markup = '>';
16544   token.map    = lines = [ startLine, 0 ];
16545
16546   state.md.block.tokenize(state, startLine, nextLine);
16547
16548   token        = state.push('blockquote_close', 'blockquote', -1);
16549   token.markup = '>';
16550
16551   state.lineMax = oldLineMax;
16552   state.parentType = oldParentType;
16553   lines[1] = state.line;
16554
16555   // Restore original tShift; this might not be necessary since the parser
16556   // has already been here, but just to make sure we can do that.
16557   for (i = 0; i < oldTShift.length; i++) {
16558     state.bMarks[i + startLine] = oldBMarks[i];
16559     state.tShift[i + startLine] = oldTShift[i];
16560     state.sCount[i + startLine] = oldSCount[i];
16561     state.bsCount[i + startLine] = oldBSCount[i];
16562   }
16563   state.blkIndent = oldIndent;
16564
16565   return true;
16566 };
16567
16568
16569 /***/ }),
16570 /* 76 */
16571 /***/ (function(module, exports, __webpack_require__) {
16572
16573 "use strict";
16574 // Horizontal rule
16575
16576
16577
16578 var isSpace = __webpack_require__(42).isSpace;
16579
16580
16581 module.exports = function hr(state, startLine, endLine, silent) {
16582   var marker, cnt, ch, token,
16583       pos = state.bMarks[startLine] + state.tShift[startLine],
16584       max = state.eMarks[startLine];
16585
16586   // if it's indented more than 3 spaces, it should be a code block
16587   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
16588
16589   marker = state.src.charCodeAt(pos++);
16590
16591   // Check hr marker
16592   if (marker !== 0x2A/* * */ &&
16593       marker !== 0x2D/* - */ &&
16594       marker !== 0x5F/* _ */) {
16595     return false;
16596   }
16597
16598   // markers can be mixed with spaces, but there should be at least 3 of them
16599
16600   cnt = 1;
16601   while (pos < max) {
16602     ch = state.src.charCodeAt(pos++);
16603     if (ch !== marker && !isSpace(ch)) { return false; }
16604     if (ch === marker) { cnt++; }
16605   }
16606
16607   if (cnt < 3) { return false; }
16608
16609   if (silent) { return true; }
16610
16611   state.line = startLine + 1;
16612
16613   token        = state.push('hr', 'hr', 0);
16614   token.map    = [ startLine, state.line ];
16615   token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
16616
16617   return true;
16618 };
16619
16620
16621 /***/ }),
16622 /* 77 */
16623 /***/ (function(module, exports, __webpack_require__) {
16624
16625 "use strict";
16626 // Lists
16627
16628
16629
16630 var isSpace = __webpack_require__(42).isSpace;
16631
16632
16633 // Search `[-+*][\n ]`, returns next pos after marker on success
16634 // or -1 on fail.
16635 function skipBulletListMarker(state, startLine) {
16636   var marker, pos, max, ch;
16637
16638   pos = state.bMarks[startLine] + state.tShift[startLine];
16639   max = state.eMarks[startLine];
16640
16641   marker = state.src.charCodeAt(pos++);
16642   // Check bullet
16643   if (marker !== 0x2A/* * */ &&
16644       marker !== 0x2D/* - */ &&
16645       marker !== 0x2B/* + */) {
16646     return -1;
16647   }
16648
16649   if (pos < max) {
16650     ch = state.src.charCodeAt(pos);
16651
16652     if (!isSpace(ch)) {
16653       // " -test " - is not a list item
16654       return -1;
16655     }
16656   }
16657
16658   return pos;
16659 }
16660
16661 // Search `\d+[.)][\n ]`, returns next pos after marker on success
16662 // or -1 on fail.
16663 function skipOrderedListMarker(state, startLine) {
16664   var ch,
16665       start = state.bMarks[startLine] + state.tShift[startLine],
16666       pos = start,
16667       max = state.eMarks[startLine];
16668
16669   // List marker should have at least 2 chars (digit + dot)
16670   if (pos + 1 >= max) { return -1; }
16671
16672   ch = state.src.charCodeAt(pos++);
16673
16674   if (ch < 0x30/* 0 */ || ch > 0x39/* 9 */) { return -1; }
16675
16676   for (;;) {
16677     // EOL -> fail
16678     if (pos >= max) { return -1; }
16679
16680     ch = state.src.charCodeAt(pos++);
16681
16682     if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) {
16683
16684       // List marker should have no more than 9 digits
16685       // (prevents integer overflow in browsers)
16686       if (pos - start >= 10) { return -1; }
16687
16688       continue;
16689     }
16690
16691     // found valid marker
16692     if (ch === 0x29/* ) */ || ch === 0x2e/* . */) {
16693       break;
16694     }
16695
16696     return -1;
16697   }
16698
16699
16700   if (pos < max) {
16701     ch = state.src.charCodeAt(pos);
16702
16703     if (!isSpace(ch)) {
16704       // " 1.test " - is not a list item
16705       return -1;
16706     }
16707   }
16708   return pos;
16709 }
16710
16711 function markTightParagraphs(state, idx) {
16712   var i, l,
16713       level = state.level + 2;
16714
16715   for (i = idx + 2, l = state.tokens.length - 2; i < l; i++) {
16716     if (state.tokens[i].level === level && state.tokens[i].type === 'paragraph_open') {
16717       state.tokens[i + 2].hidden = true;
16718       state.tokens[i].hidden = true;
16719       i += 2;
16720     }
16721   }
16722 }
16723
16724
16725 module.exports = function list(state, startLine, endLine, silent) {
16726   var ch,
16727       contentStart,
16728       i,
16729       indent,
16730       indentAfterMarker,
16731       initial,
16732       isOrdered,
16733       itemLines,
16734       l,
16735       listLines,
16736       listTokIdx,
16737       markerCharCode,
16738       markerValue,
16739       max,
16740       nextLine,
16741       offset,
16742       oldListIndent,
16743       oldParentType,
16744       oldSCount,
16745       oldTShift,
16746       oldTight,
16747       pos,
16748       posAfterMarker,
16749       prevEmptyEnd,
16750       start,
16751       terminate,
16752       terminatorRules,
16753       token,
16754       isTerminatingParagraph = false,
16755       tight = true;
16756
16757   // if it's indented more than 3 spaces, it should be a code block
16758   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
16759
16760   // Special case:
16761   //  - item 1
16762   //   - item 2
16763   //    - item 3
16764   //     - item 4
16765   //      - this one is a paragraph continuation
16766   if (state.listIndent >= 0 &&
16767       state.sCount[startLine] - state.listIndent >= 4 &&
16768       state.sCount[startLine] < state.blkIndent) {
16769     return false;
16770   }
16771
16772   // limit conditions when list can interrupt
16773   // a paragraph (validation mode only)
16774   if (silent && state.parentType === 'paragraph') {
16775     // Next list item should still terminate previous list item;
16776     //
16777     // This code can fail if plugins use blkIndent as well as lists,
16778     // but I hope the spec gets fixed long before that happens.
16779     //
16780     if (state.tShift[startLine] >= state.blkIndent) {
16781       isTerminatingParagraph = true;
16782     }
16783   }
16784
16785   // Detect list type and position after marker
16786   if ((posAfterMarker = skipOrderedListMarker(state, startLine)) >= 0) {
16787     isOrdered = true;
16788     start = state.bMarks[startLine] + state.tShift[startLine];
16789     markerValue = Number(state.src.substr(start, posAfterMarker - start - 1));
16790
16791     // If we're starting a new ordered list right after
16792     // a paragraph, it should start with 1.
16793     if (isTerminatingParagraph && markerValue !== 1) return false;
16794
16795   } else if ((posAfterMarker = skipBulletListMarker(state, startLine)) >= 0) {
16796     isOrdered = false;
16797
16798   } else {
16799     return false;
16800   }
16801
16802   // If we're starting a new unordered list right after
16803   // a paragraph, first line should not be empty.
16804   if (isTerminatingParagraph) {
16805     if (state.skipSpaces(posAfterMarker) >= state.eMarks[startLine]) return false;
16806   }
16807
16808   // We should terminate list on style change. Remember first one to compare.
16809   markerCharCode = state.src.charCodeAt(posAfterMarker - 1);
16810
16811   // For validation mode we can terminate immediately
16812   if (silent) { return true; }
16813
16814   // Start list
16815   listTokIdx = state.tokens.length;
16816
16817   if (isOrdered) {
16818     token       = state.push('ordered_list_open', 'ol', 1);
16819     if (markerValue !== 1) {
16820       token.attrs = [ [ 'start', markerValue ] ];
16821     }
16822
16823   } else {
16824     token       = state.push('bullet_list_open', 'ul', 1);
16825   }
16826
16827   token.map    = listLines = [ startLine, 0 ];
16828   token.markup = String.fromCharCode(markerCharCode);
16829
16830   //
16831   // Iterate list items
16832   //
16833
16834   nextLine = startLine;
16835   prevEmptyEnd = false;
16836   terminatorRules = state.md.block.ruler.getRules('list');
16837
16838   oldParentType = state.parentType;
16839   state.parentType = 'list';
16840
16841   while (nextLine < endLine) {
16842     pos = posAfterMarker;
16843     max = state.eMarks[nextLine];
16844
16845     initial = offset = state.sCount[nextLine] + posAfterMarker - (state.bMarks[startLine] + state.tShift[startLine]);
16846
16847     while (pos < max) {
16848       ch = state.src.charCodeAt(pos);
16849
16850       if (ch === 0x09) {
16851         offset += 4 - (offset + state.bsCount[nextLine]) % 4;
16852       } else if (ch === 0x20) {
16853         offset++;
16854       } else {
16855         break;
16856       }
16857
16858       pos++;
16859     }
16860
16861     contentStart = pos;
16862
16863     if (contentStart >= max) {
16864       // trimming space in "-    \n  3" case, indent is 1 here
16865       indentAfterMarker = 1;
16866     } else {
16867       indentAfterMarker = offset - initial;
16868     }
16869
16870     // If we have more than 4 spaces, the indent is 1
16871     // (the rest is just indented code block)
16872     if (indentAfterMarker > 4) { indentAfterMarker = 1; }
16873
16874     // "  -  test"
16875     //  ^^^^^ - calculating total length of this thing
16876     indent = initial + indentAfterMarker;
16877
16878     // Run subparser & write tokens
16879     token        = state.push('list_item_open', 'li', 1);
16880     token.markup = String.fromCharCode(markerCharCode);
16881     token.map    = itemLines = [ startLine, 0 ];
16882
16883     // change current state, then restore it after parser subcall
16884     oldTight = state.tight;
16885     oldTShift = state.tShift[startLine];
16886     oldSCount = state.sCount[startLine];
16887
16888     //  - example list
16889     // ^ listIndent position will be here
16890     //   ^ blkIndent position will be here
16891     //
16892     oldListIndent = state.listIndent;
16893     state.listIndent = state.blkIndent;
16894     state.blkIndent = indent;
16895
16896     state.tight = true;
16897     state.tShift[startLine] = contentStart - state.bMarks[startLine];
16898     state.sCount[startLine] = offset;
16899
16900     if (contentStart >= max && state.isEmpty(startLine + 1)) {
16901       // workaround for this case
16902       // (list item is empty, list terminates before "foo"):
16903       // ~~~~~~~~
16904       //   -
16905       //
16906       //     foo
16907       // ~~~~~~~~
16908       state.line = Math.min(state.line + 2, endLine);
16909     } else {
16910       state.md.block.tokenize(state, startLine, endLine, true);
16911     }
16912
16913     // If any of list item is tight, mark list as tight
16914     if (!state.tight || prevEmptyEnd) {
16915       tight = false;
16916     }
16917     // Item become loose if finish with empty line,
16918     // but we should filter last element, because it means list finish
16919     prevEmptyEnd = (state.line - startLine) > 1 && state.isEmpty(state.line - 1);
16920
16921     state.blkIndent = state.listIndent;
16922     state.listIndent = oldListIndent;
16923     state.tShift[startLine] = oldTShift;
16924     state.sCount[startLine] = oldSCount;
16925     state.tight = oldTight;
16926
16927     token        = state.push('list_item_close', 'li', -1);
16928     token.markup = String.fromCharCode(markerCharCode);
16929
16930     nextLine = startLine = state.line;
16931     itemLines[1] = nextLine;
16932     contentStart = state.bMarks[startLine];
16933
16934     if (nextLine >= endLine) { break; }
16935
16936     //
16937     // Try to check if list is terminated or continued.
16938     //
16939     if (state.sCount[nextLine] < state.blkIndent) { break; }
16940
16941     // if it's indented more than 3 spaces, it should be a code block
16942     if (state.sCount[startLine] - state.blkIndent >= 4) { break; }
16943
16944     // fail if terminating block found
16945     terminate = false;
16946     for (i = 0, l = terminatorRules.length; i < l; i++) {
16947       if (terminatorRules[i](state, nextLine, endLine, true)) {
16948         terminate = true;
16949         break;
16950       }
16951     }
16952     if (terminate) { break; }
16953
16954     // fail if list has another type
16955     if (isOrdered) {
16956       posAfterMarker = skipOrderedListMarker(state, nextLine);
16957       if (posAfterMarker < 0) { break; }
16958     } else {
16959       posAfterMarker = skipBulletListMarker(state, nextLine);
16960       if (posAfterMarker < 0) { break; }
16961     }
16962
16963     if (markerCharCode !== state.src.charCodeAt(posAfterMarker - 1)) { break; }
16964   }
16965
16966   // Finalize list
16967   if (isOrdered) {
16968     token = state.push('ordered_list_close', 'ol', -1);
16969   } else {
16970     token = state.push('bullet_list_close', 'ul', -1);
16971   }
16972   token.markup = String.fromCharCode(markerCharCode);
16973
16974   listLines[1] = nextLine;
16975   state.line = nextLine;
16976
16977   state.parentType = oldParentType;
16978
16979   // mark paragraphs tight if needed
16980   if (tight) {
16981     markTightParagraphs(state, listTokIdx);
16982   }
16983
16984   return true;
16985 };
16986
16987
16988 /***/ }),
16989 /* 78 */
16990 /***/ (function(module, exports, __webpack_require__) {
16991
16992 "use strict";
16993
16994
16995
16996 var normalizeReference   = __webpack_require__(42).normalizeReference;
16997 var isSpace              = __webpack_require__(42).isSpace;
16998
16999
17000 module.exports = function reference(state, startLine, _endLine, silent) {
17001   var ch,
17002       destEndPos,
17003       destEndLineNo,
17004       endLine,
17005       href,
17006       i,
17007       l,
17008       label,
17009       labelEnd,
17010       oldParentType,
17011       res,
17012       start,
17013       str,
17014       terminate,
17015       terminatorRules,
17016       title,
17017       lines = 0,
17018       pos = state.bMarks[startLine] + state.tShift[startLine],
17019       max = state.eMarks[startLine],
17020       nextLine = startLine + 1;
17021
17022   // if it's indented more than 3 spaces, it should be a code block
17023   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
17024
17025   if (state.src.charCodeAt(pos) !== 0x5B/* [ */) { return false; }
17026
17027   // Simple check to quickly interrupt scan on [link](url) at the start of line.
17028   // Can be useful on practice: https://github.com/markdown-it/markdown-it/issues/54
17029   while (++pos < max) {
17030     if (state.src.charCodeAt(pos) === 0x5D /* ] */ &&
17031         state.src.charCodeAt(pos - 1) !== 0x5C/* \ */) {
17032       if (pos + 1 === max) { return false; }
17033       if (state.src.charCodeAt(pos + 1) !== 0x3A/* : */) { return false; }
17034       break;
17035     }
17036   }
17037
17038   endLine = state.lineMax;
17039
17040   // jump line-by-line until empty one or EOF
17041   terminatorRules = state.md.block.ruler.getRules('reference');
17042
17043   oldParentType = state.parentType;
17044   state.parentType = 'reference';
17045
17046   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
17047     // this would be a code block normally, but after paragraph
17048     // it's considered a lazy continuation regardless of what's there
17049     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
17050
17051     // quirk for blockquotes, this line should already be checked by that rule
17052     if (state.sCount[nextLine] < 0) { continue; }
17053
17054     // Some tags can terminate paragraph without empty line.
17055     terminate = false;
17056     for (i = 0, l = terminatorRules.length; i < l; i++) {
17057       if (terminatorRules[i](state, nextLine, endLine, true)) {
17058         terminate = true;
17059         break;
17060       }
17061     }
17062     if (terminate) { break; }
17063   }
17064
17065   str = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
17066   max = str.length;
17067
17068   for (pos = 1; pos < max; pos++) {
17069     ch = str.charCodeAt(pos);
17070     if (ch === 0x5B /* [ */) {
17071       return false;
17072     } else if (ch === 0x5D /* ] */) {
17073       labelEnd = pos;
17074       break;
17075     } else if (ch === 0x0A /* \n */) {
17076       lines++;
17077     } else if (ch === 0x5C /* \ */) {
17078       pos++;
17079       if (pos < max && str.charCodeAt(pos) === 0x0A) {
17080         lines++;
17081       }
17082     }
17083   }
17084
17085   if (labelEnd < 0 || str.charCodeAt(labelEnd + 1) !== 0x3A/* : */) { return false; }
17086
17087   // [label]:   destination   'title'
17088   //         ^^^ skip optional whitespace here
17089   for (pos = labelEnd + 2; pos < max; pos++) {
17090     ch = str.charCodeAt(pos);
17091     if (ch === 0x0A) {
17092       lines++;
17093     } else if (isSpace(ch)) {
17094       /*eslint no-empty:0*/
17095     } else {
17096       break;
17097     }
17098   }
17099
17100   // [label]:   destination   'title'
17101   //            ^^^^^^^^^^^ parse this
17102   res = state.md.helpers.parseLinkDestination(str, pos, max);
17103   if (!res.ok) { return false; }
17104
17105   href = state.md.normalizeLink(res.str);
17106   if (!state.md.validateLink(href)) { return false; }
17107
17108   pos = res.pos;
17109   lines += res.lines;
17110
17111   // save cursor state, we could require to rollback later
17112   destEndPos = pos;
17113   destEndLineNo = lines;
17114
17115   // [label]:   destination   'title'
17116   //                       ^^^ skipping those spaces
17117   start = pos;
17118   for (; pos < max; pos++) {
17119     ch = str.charCodeAt(pos);
17120     if (ch === 0x0A) {
17121       lines++;
17122     } else if (isSpace(ch)) {
17123       /*eslint no-empty:0*/
17124     } else {
17125       break;
17126     }
17127   }
17128
17129   // [label]:   destination   'title'
17130   //                          ^^^^^^^ parse this
17131   res = state.md.helpers.parseLinkTitle(str, pos, max);
17132   if (pos < max && start !== pos && res.ok) {
17133     title = res.str;
17134     pos = res.pos;
17135     lines += res.lines;
17136   } else {
17137     title = '';
17138     pos = destEndPos;
17139     lines = destEndLineNo;
17140   }
17141
17142   // skip trailing spaces until the rest of the line
17143   while (pos < max) {
17144     ch = str.charCodeAt(pos);
17145     if (!isSpace(ch)) { break; }
17146     pos++;
17147   }
17148
17149   if (pos < max && str.charCodeAt(pos) !== 0x0A) {
17150     if (title) {
17151       // garbage at the end of the line after title,
17152       // but it could still be a valid reference if we roll back
17153       title = '';
17154       pos = destEndPos;
17155       lines = destEndLineNo;
17156       while (pos < max) {
17157         ch = str.charCodeAt(pos);
17158         if (!isSpace(ch)) { break; }
17159         pos++;
17160       }
17161     }
17162   }
17163
17164   if (pos < max && str.charCodeAt(pos) !== 0x0A) {
17165     // garbage at the end of the line
17166     return false;
17167   }
17168
17169   label = normalizeReference(str.slice(1, labelEnd));
17170   if (!label) {
17171     // CommonMark 0.20 disallows empty labels
17172     return false;
17173   }
17174
17175   // Reference can not terminate anything. This check is for safety only.
17176   /*istanbul ignore if*/
17177   if (silent) { return true; }
17178
17179   if (typeof state.env.references === 'undefined') {
17180     state.env.references = {};
17181   }
17182   if (typeof state.env.references[label] === 'undefined') {
17183     state.env.references[label] = { title: title, href: href };
17184   }
17185
17186   state.parentType = oldParentType;
17187
17188   state.line = startLine + lines + 1;
17189   return true;
17190 };
17191
17192
17193 /***/ }),
17194 /* 79 */
17195 /***/ (function(module, exports, __webpack_require__) {
17196
17197 "use strict";
17198 // heading (#, ##, ...)
17199
17200
17201
17202 var isSpace = __webpack_require__(42).isSpace;
17203
17204
17205 module.exports = function heading(state, startLine, endLine, silent) {
17206   var ch, level, tmp, token,
17207       pos = state.bMarks[startLine] + state.tShift[startLine],
17208       max = state.eMarks[startLine];
17209
17210   // if it's indented more than 3 spaces, it should be a code block
17211   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
17212
17213   ch  = state.src.charCodeAt(pos);
17214
17215   if (ch !== 0x23/* # */ || pos >= max) { return false; }
17216
17217   // count heading level
17218   level = 1;
17219   ch = state.src.charCodeAt(++pos);
17220   while (ch === 0x23/* # */ && pos < max && level <= 6) {
17221     level++;
17222     ch = state.src.charCodeAt(++pos);
17223   }
17224
17225   if (level > 6 || (pos < max && !isSpace(ch))) { return false; }
17226
17227   if (silent) { return true; }
17228
17229   // Let's cut tails like '    ###  ' from the end of string
17230
17231   max = state.skipSpacesBack(max, pos);
17232   tmp = state.skipCharsBack(max, 0x23, pos); // #
17233   if (tmp > pos && isSpace(state.src.charCodeAt(tmp - 1))) {
17234     max = tmp;
17235   }
17236
17237   state.line = startLine + 1;
17238
17239   token        = state.push('heading_open', 'h' + String(level), 1);
17240   token.markup = '########'.slice(0, level);
17241   token.map    = [ startLine, state.line ];
17242
17243   token          = state.push('inline', '', 0);
17244   token.content  = state.src.slice(pos, max).trim();
17245   token.map      = [ startLine, state.line ];
17246   token.children = [];
17247
17248   token        = state.push('heading_close', 'h' + String(level), -1);
17249   token.markup = '########'.slice(0, level);
17250
17251   return true;
17252 };
17253
17254
17255 /***/ }),
17256 /* 80 */
17257 /***/ (function(module, exports, __webpack_require__) {
17258
17259 "use strict";
17260 // lheading (---, ===)
17261
17262
17263
17264
17265 module.exports = function lheading(state, startLine, endLine/*, silent*/) {
17266   var content, terminate, i, l, token, pos, max, level, marker,
17267       nextLine = startLine + 1, oldParentType,
17268       terminatorRules = state.md.block.ruler.getRules('paragraph');
17269
17270   // if it's indented more than 3 spaces, it should be a code block
17271   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
17272
17273   oldParentType = state.parentType;
17274   state.parentType = 'paragraph'; // use paragraph to match terminatorRules
17275
17276   // jump line-by-line until empty one or EOF
17277   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
17278     // this would be a code block normally, but after paragraph
17279     // it's considered a lazy continuation regardless of what's there
17280     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
17281
17282     //
17283     // Check for underline in setext header
17284     //
17285     if (state.sCount[nextLine] >= state.blkIndent) {
17286       pos = state.bMarks[nextLine] + state.tShift[nextLine];
17287       max = state.eMarks[nextLine];
17288
17289       if (pos < max) {
17290         marker = state.src.charCodeAt(pos);
17291
17292         if (marker === 0x2D/* - */ || marker === 0x3D/* = */) {
17293           pos = state.skipChars(pos, marker);
17294           pos = state.skipSpaces(pos);
17295
17296           if (pos >= max) {
17297             level = (marker === 0x3D/* = */ ? 1 : 2);
17298             break;
17299           }
17300         }
17301       }
17302     }
17303
17304     // quirk for blockquotes, this line should already be checked by that rule
17305     if (state.sCount[nextLine] < 0) { continue; }
17306
17307     // Some tags can terminate paragraph without empty line.
17308     terminate = false;
17309     for (i = 0, l = terminatorRules.length; i < l; i++) {
17310       if (terminatorRules[i](state, nextLine, endLine, true)) {
17311         terminate = true;
17312         break;
17313       }
17314     }
17315     if (terminate) { break; }
17316   }
17317
17318   if (!level) {
17319     // Didn't find valid underline
17320     return false;
17321   }
17322
17323   content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
17324
17325   state.line = nextLine + 1;
17326
17327   token          = state.push('heading_open', 'h' + String(level), 1);
17328   token.markup   = String.fromCharCode(marker);
17329   token.map      = [ startLine, state.line ];
17330
17331   token          = state.push('inline', '', 0);
17332   token.content  = content;
17333   token.map      = [ startLine, state.line - 1 ];
17334   token.children = [];
17335
17336   token          = state.push('heading_close', 'h' + String(level), -1);
17337   token.markup   = String.fromCharCode(marker);
17338
17339   state.parentType = oldParentType;
17340
17341   return true;
17342 };
17343
17344
17345 /***/ }),
17346 /* 81 */
17347 /***/ (function(module, exports, __webpack_require__) {
17348
17349 "use strict";
17350 // HTML block
17351
17352
17353
17354
17355 var block_names = __webpack_require__(82);
17356 var HTML_OPEN_CLOSE_TAG_RE = __webpack_require__(83).HTML_OPEN_CLOSE_TAG_RE;
17357
17358 // An array of opening and corresponding closing sequences for html tags,
17359 // last argument defines whether it can terminate a paragraph or not
17360 //
17361 var HTML_SEQUENCES = [
17362   [ /^<(script|pre|style)(?=(\s|>|$))/i, /<\/(script|pre|style)>/i, true ],
17363   [ /^<!--/,        /-->/,   true ],
17364   [ /^<\?/,         /\?>/,   true ],
17365   [ /^<![A-Z]/,     />/,     true ],
17366   [ /^<!\[CDATA\[/, /\]\]>/, true ],
17367   [ new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true ],
17368   [ new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'),  /^$/, false ]
17369 ];
17370
17371
17372 module.exports = function html_block(state, startLine, endLine, silent) {
17373   var i, nextLine, token, lineText,
17374       pos = state.bMarks[startLine] + state.tShift[startLine],
17375       max = state.eMarks[startLine];
17376
17377   // if it's indented more than 3 spaces, it should be a code block
17378   if (state.sCount[startLine] - state.blkIndent >= 4) { return false; }
17379
17380   if (!state.md.options.html) { return false; }
17381
17382   if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
17383
17384   lineText = state.src.slice(pos, max);
17385
17386   for (i = 0; i < HTML_SEQUENCES.length; i++) {
17387     if (HTML_SEQUENCES[i][0].test(lineText)) { break; }
17388   }
17389
17390   if (i === HTML_SEQUENCES.length) { return false; }
17391
17392   if (silent) {
17393     // true if this sequence can be a terminator, false otherwise
17394     return HTML_SEQUENCES[i][2];
17395   }
17396
17397   nextLine = startLine + 1;
17398
17399   // If we are here - we detected HTML block.
17400   // Let's roll down till block end.
17401   if (!HTML_SEQUENCES[i][1].test(lineText)) {
17402     for (; nextLine < endLine; nextLine++) {
17403       if (state.sCount[nextLine] < state.blkIndent) { break; }
17404
17405       pos = state.bMarks[nextLine] + state.tShift[nextLine];
17406       max = state.eMarks[nextLine];
17407       lineText = state.src.slice(pos, max);
17408
17409       if (HTML_SEQUENCES[i][1].test(lineText)) {
17410         if (lineText.length !== 0) { nextLine++; }
17411         break;
17412       }
17413     }
17414   }
17415
17416   state.line = nextLine;
17417
17418   token         = state.push('html_block', '', 0);
17419   token.map     = [ startLine, nextLine ];
17420   token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
17421
17422   return true;
17423 };
17424
17425
17426 /***/ }),
17427 /* 82 */
17428 /***/ (function(module, exports, __webpack_require__) {
17429
17430 "use strict";
17431 // List of valid html blocks names, accorting to commonmark spec
17432 // http://jgm.github.io/CommonMark/spec.html#html-blocks
17433
17434
17435
17436
17437 module.exports = [
17438   'address',
17439   'article',
17440   'aside',
17441   'base',
17442   'basefont',
17443   'blockquote',
17444   'body',
17445   'caption',
17446   'center',
17447   'col',
17448   'colgroup',
17449   'dd',
17450   'details',
17451   'dialog',
17452   'dir',
17453   'div',
17454   'dl',
17455   'dt',
17456   'fieldset',
17457   'figcaption',
17458   'figure',
17459   'footer',
17460   'form',
17461   'frame',
17462   'frameset',
17463   'h1',
17464   'h2',
17465   'h3',
17466   'h4',
17467   'h5',
17468   'h6',
17469   'head',
17470   'header',
17471   'hr',
17472   'html',
17473   'iframe',
17474   'legend',
17475   'li',
17476   'link',
17477   'main',
17478   'menu',
17479   'menuitem',
17480   'meta',
17481   'nav',
17482   'noframes',
17483   'ol',
17484   'optgroup',
17485   'option',
17486   'p',
17487   'param',
17488   'section',
17489   'source',
17490   'summary',
17491   'table',
17492   'tbody',
17493   'td',
17494   'tfoot',
17495   'th',
17496   'thead',
17497   'title',
17498   'tr',
17499   'track',
17500   'ul'
17501 ];
17502
17503
17504 /***/ }),
17505 /* 83 */
17506 /***/ (function(module, exports, __webpack_require__) {
17507
17508 "use strict";
17509 // Regexps to match html elements
17510
17511
17512
17513 var attr_name     = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
17514
17515 var unquoted      = '[^"\'=<>`\\x00-\\x20]+';
17516 var single_quoted = "'[^']*'";
17517 var double_quoted = '"[^"]*"';
17518
17519 var attr_value  = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
17520
17521 var attribute   = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
17522
17523 var open_tag    = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
17524
17525 var close_tag   = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
17526 var comment     = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->';
17527 var processing  = '<[?].*?[?]>';
17528 var declaration = '<![A-Z]+\\s+[^>]*>';
17529 var cdata       = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
17530
17531 var HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
17532                         '|' + processing + '|' + declaration + '|' + cdata + ')');
17533 var HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + ')');
17534
17535 module.exports.HTML_TAG_RE = HTML_TAG_RE;
17536 module.exports.HTML_OPEN_CLOSE_TAG_RE = HTML_OPEN_CLOSE_TAG_RE;
17537
17538
17539 /***/ }),
17540 /* 84 */
17541 /***/ (function(module, exports, __webpack_require__) {
17542
17543 "use strict";
17544 // Paragraph
17545
17546
17547
17548
17549 module.exports = function paragraph(state, startLine/*, endLine*/) {
17550   var content, terminate, i, l, token, oldParentType,
17551       nextLine = startLine + 1,
17552       terminatorRules = state.md.block.ruler.getRules('paragraph'),
17553       endLine = state.lineMax;
17554
17555   oldParentType = state.parentType;
17556   state.parentType = 'paragraph';
17557
17558   // jump line-by-line until empty one or EOF
17559   for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
17560     // this would be a code block normally, but after paragraph
17561     // it's considered a lazy continuation regardless of what's there
17562     if (state.sCount[nextLine] - state.blkIndent > 3) { continue; }
17563
17564     // quirk for blockquotes, this line should already be checked by that rule
17565     if (state.sCount[nextLine] < 0) { continue; }
17566
17567     // Some tags can terminate paragraph without empty line.
17568     terminate = false;
17569     for (i = 0, l = terminatorRules.length; i < l; i++) {
17570       if (terminatorRules[i](state, nextLine, endLine, true)) {
17571         terminate = true;
17572         break;
17573       }
17574     }
17575     if (terminate) { break; }
17576   }
17577
17578   content = state.getLines(startLine, nextLine, state.blkIndent, false).trim();
17579
17580   state.line = nextLine;
17581
17582   token          = state.push('paragraph_open', 'p', 1);
17583   token.map      = [ startLine, state.line ];
17584
17585   token          = state.push('inline', '', 0);
17586   token.content  = content;
17587   token.map      = [ startLine, state.line ];
17588   token.children = [];
17589
17590   token          = state.push('paragraph_close', 'p', -1);
17591
17592   state.parentType = oldParentType;
17593
17594   return true;
17595 };
17596
17597
17598 /***/ }),
17599 /* 85 */
17600 /***/ (function(module, exports, __webpack_require__) {
17601
17602 "use strict";
17603 // Parser state class
17604
17605
17606
17607 var Token = __webpack_require__(70);
17608 var isSpace = __webpack_require__(42).isSpace;
17609
17610
17611 function StateBlock(src, md, env, tokens) {
17612   var ch, s, start, pos, len, indent, offset, indent_found;
17613
17614   this.src = src;
17615
17616   // link to parser instance
17617   this.md     = md;
17618
17619   this.env = env;
17620
17621   //
17622   // Internal state vartiables
17623   //
17624
17625   this.tokens = tokens;
17626
17627   this.bMarks = [];  // line begin offsets for fast jumps
17628   this.eMarks = [];  // line end offsets for fast jumps
17629   this.tShift = [];  // offsets of the first non-space characters (tabs not expanded)
17630   this.sCount = [];  // indents for each line (tabs expanded)
17631
17632   // An amount of virtual spaces (tabs expanded) between beginning
17633   // of each line (bMarks) and real beginning of that line.
17634   //
17635   // It exists only as a hack because blockquotes override bMarks
17636   // losing information in the process.
17637   //
17638   // It's used only when expanding tabs, you can think about it as
17639   // an initial tab length, e.g. bsCount=21 applied to string `\t123`
17640   // means first tab should be expanded to 4-21%4 === 3 spaces.
17641   //
17642   this.bsCount = [];
17643
17644   // block parser variables
17645   this.blkIndent  = 0; // required block content indent (for example, if we are
17646                        // inside a list, it would be positioned after list marker)
17647   this.line       = 0; // line index in src
17648   this.lineMax    = 0; // lines count
17649   this.tight      = false;  // loose/tight mode for lists
17650   this.ddIndent   = -1; // indent of the current dd block (-1 if there isn't any)
17651   this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
17652
17653   // can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
17654   // used in lists to determine if they interrupt a paragraph
17655   this.parentType = 'root';
17656
17657   this.level = 0;
17658
17659   // renderer
17660   this.result = '';
17661
17662   // Create caches
17663   // Generate markers.
17664   s = this.src;
17665   indent_found = false;
17666
17667   for (start = pos = indent = offset = 0, len = s.length; pos < len; pos++) {
17668     ch = s.charCodeAt(pos);
17669
17670     if (!indent_found) {
17671       if (isSpace(ch)) {
17672         indent++;
17673
17674         if (ch === 0x09) {
17675           offset += 4 - offset % 4;
17676         } else {
17677           offset++;
17678         }
17679         continue;
17680       } else {
17681         indent_found = true;
17682       }
17683     }
17684
17685     if (ch === 0x0A || pos === len - 1) {
17686       if (ch !== 0x0A) { pos++; }
17687       this.bMarks.push(start);
17688       this.eMarks.push(pos);
17689       this.tShift.push(indent);
17690       this.sCount.push(offset);
17691       this.bsCount.push(0);
17692
17693       indent_found = false;
17694       indent = 0;
17695       offset = 0;
17696       start = pos + 1;
17697     }
17698   }
17699
17700   // Push fake entry to simplify cache bounds checks
17701   this.bMarks.push(s.length);
17702   this.eMarks.push(s.length);
17703   this.tShift.push(0);
17704   this.sCount.push(0);
17705   this.bsCount.push(0);
17706
17707   this.lineMax = this.bMarks.length - 1; // don't count last fake line
17708 }
17709
17710 // Push new token to "stream".
17711 //
17712 StateBlock.prototype.push = function (type, tag, nesting) {
17713   var token = new Token(type, tag, nesting);
17714   token.block = true;
17715
17716   if (nesting < 0) this.level--; // closing tag
17717   token.level = this.level;
17718   if (nesting > 0) this.level++; // opening tag
17719
17720   this.tokens.push(token);
17721   return token;
17722 };
17723
17724 StateBlock.prototype.isEmpty = function isEmpty(line) {
17725   return this.bMarks[line] + this.tShift[line] >= this.eMarks[line];
17726 };
17727
17728 StateBlock.prototype.skipEmptyLines = function skipEmptyLines(from) {
17729   for (var max = this.lineMax; from < max; from++) {
17730     if (this.bMarks[from] + this.tShift[from] < this.eMarks[from]) {
17731       break;
17732     }
17733   }
17734   return from;
17735 };
17736
17737 // Skip spaces from given position.
17738 StateBlock.prototype.skipSpaces = function skipSpaces(pos) {
17739   var ch;
17740
17741   for (var max = this.src.length; pos < max; pos++) {
17742     ch = this.src.charCodeAt(pos);
17743     if (!isSpace(ch)) { break; }
17744   }
17745   return pos;
17746 };
17747
17748 // Skip spaces from given position in reverse.
17749 StateBlock.prototype.skipSpacesBack = function skipSpacesBack(pos, min) {
17750   if (pos <= min) { return pos; }
17751
17752   while (pos > min) {
17753     if (!isSpace(this.src.charCodeAt(--pos))) { return pos + 1; }
17754   }
17755   return pos;
17756 };
17757
17758 // Skip char codes from given position
17759 StateBlock.prototype.skipChars = function skipChars(pos, code) {
17760   for (var max = this.src.length; pos < max; pos++) {
17761     if (this.src.charCodeAt(pos) !== code) { break; }
17762   }
17763   return pos;
17764 };
17765
17766 // Skip char codes reverse from given position - 1
17767 StateBlock.prototype.skipCharsBack = function skipCharsBack(pos, code, min) {
17768   if (pos <= min) { return pos; }
17769
17770   while (pos > min) {
17771     if (code !== this.src.charCodeAt(--pos)) { return pos + 1; }
17772   }
17773   return pos;
17774 };
17775
17776 // cut lines range from source.
17777 StateBlock.prototype.getLines = function getLines(begin, end, indent, keepLastLF) {
17778   var i, lineIndent, ch, first, last, queue, lineStart,
17779       line = begin;
17780
17781   if (begin >= end) {
17782     return '';
17783   }
17784
17785   queue = new Array(end - begin);
17786
17787   for (i = 0; line < end; line++, i++) {
17788     lineIndent = 0;
17789     lineStart = first = this.bMarks[line];
17790
17791     if (line + 1 < end || keepLastLF) {
17792       // No need for bounds check because we have fake entry on tail.
17793       last = this.eMarks[line] + 1;
17794     } else {
17795       last = this.eMarks[line];
17796     }
17797
17798     while (first < last && lineIndent < indent) {
17799       ch = this.src.charCodeAt(first);
17800
17801       if (isSpace(ch)) {
17802         if (ch === 0x09) {
17803           lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
17804         } else {
17805           lineIndent++;
17806         }
17807       } else if (first - lineStart < this.tShift[line]) {
17808         // patched tShift masked characters to look like spaces (blockquotes, list markers)
17809         lineIndent++;
17810       } else {
17811         break;
17812       }
17813
17814       first++;
17815     }
17816
17817     if (lineIndent > indent) {
17818       // partially expanding tabs in code blocks, e.g '\t\tfoobar'
17819       // with indent=2 becomes '  \tfoobar'
17820       queue[i] = new Array(lineIndent - indent + 1).join(' ') + this.src.slice(first, last);
17821     } else {
17822       queue[i] = this.src.slice(first, last);
17823     }
17824   }
17825
17826   return queue.join('');
17827 };
17828
17829 // re-export Token class to use in block rules
17830 StateBlock.prototype.Token = Token;
17831
17832
17833 module.exports = StateBlock;
17834
17835
17836 /***/ }),
17837 /* 86 */
17838 /***/ (function(module, exports, __webpack_require__) {
17839
17840 "use strict";
17841 /** internal
17842  * class ParserInline
17843  *
17844  * Tokenizes paragraph content.
17845  **/
17846
17847
17848
17849 var Ruler           = __webpack_require__(62);
17850
17851
17852 ////////////////////////////////////////////////////////////////////////////////
17853 // Parser rules
17854
17855 var _rules = [
17856   [ 'text',            __webpack_require__(87) ],
17857   [ 'newline',         __webpack_require__(88) ],
17858   [ 'escape',          __webpack_require__(89) ],
17859   [ 'backticks',       __webpack_require__(90) ],
17860   [ 'strikethrough',   __webpack_require__(91).tokenize ],
17861   [ 'emphasis',        __webpack_require__(92).tokenize ],
17862   [ 'link',            __webpack_require__(93) ],
17863   [ 'image',           __webpack_require__(94) ],
17864   [ 'autolink',        __webpack_require__(95) ],
17865   [ 'html_inline',     __webpack_require__(96) ],
17866   [ 'entity',          __webpack_require__(97) ]
17867 ];
17868
17869 var _rules2 = [
17870   [ 'balance_pairs',   __webpack_require__(98) ],
17871   [ 'strikethrough',   __webpack_require__(91).postProcess ],
17872   [ 'emphasis',        __webpack_require__(92).postProcess ],
17873   [ 'text_collapse',   __webpack_require__(99) ]
17874 ];
17875
17876
17877 /**
17878  * new ParserInline()
17879  **/
17880 function ParserInline() {
17881   var i;
17882
17883   /**
17884    * ParserInline#ruler -> Ruler
17885    *
17886    * [[Ruler]] instance. Keep configuration of inline rules.
17887    **/
17888   this.ruler = new Ruler();
17889
17890   for (i = 0; i < _rules.length; i++) {
17891     this.ruler.push(_rules[i][0], _rules[i][1]);
17892   }
17893
17894   /**
17895    * ParserInline#ruler2 -> Ruler
17896    *
17897    * [[Ruler]] instance. Second ruler used for post-processing
17898    * (e.g. in emphasis-like rules).
17899    **/
17900   this.ruler2 = new Ruler();
17901
17902   for (i = 0; i < _rules2.length; i++) {
17903     this.ruler2.push(_rules2[i][0], _rules2[i][1]);
17904   }
17905 }
17906
17907
17908 // Skip single token by running all rules in validation mode;
17909 // returns `true` if any rule reported success
17910 //
17911 ParserInline.prototype.skipToken = function (state) {
17912   var ok, i, pos = state.pos,
17913       rules = this.ruler.getRules(''),
17914       len = rules.length,
17915       maxNesting = state.md.options.maxNesting,
17916       cache = state.cache;
17917
17918
17919   if (typeof cache[pos] !== 'undefined') {
17920     state.pos = cache[pos];
17921     return;
17922   }
17923
17924   if (state.level < maxNesting) {
17925     for (i = 0; i < len; i++) {
17926       // Increment state.level and decrement it later to limit recursion.
17927       // It's harmless to do here, because no tokens are created. But ideally,
17928       // we'd need a separate private state variable for this purpose.
17929       //
17930       state.level++;
17931       ok = rules[i](state, true);
17932       state.level--;
17933
17934       if (ok) { break; }
17935     }
17936   } else {
17937     // Too much nesting, just skip until the end of the paragraph.
17938     //
17939     // NOTE: this will cause links to behave incorrectly in the following case,
17940     //       when an amount of `[` is exactly equal to `maxNesting + 1`:
17941     //
17942     //       [[[[[[[[[[[[[[[[[[[[[foo]()
17943     //
17944     // TODO: remove this workaround when CM standard will allow nested links
17945     //       (we can replace it by preventing links from being parsed in
17946     //       validation mode)
17947     //
17948     state.pos = state.posMax;
17949   }
17950
17951   if (!ok) { state.pos++; }
17952   cache[pos] = state.pos;
17953 };
17954
17955
17956 // Generate tokens for input range
17957 //
17958 ParserInline.prototype.tokenize = function (state) {
17959   var ok, i,
17960       rules = this.ruler.getRules(''),
17961       len = rules.length,
17962       end = state.posMax,
17963       maxNesting = state.md.options.maxNesting;
17964
17965   while (state.pos < end) {
17966     // Try all possible rules.
17967     // On success, rule should:
17968     //
17969     // - update `state.pos`
17970     // - update `state.tokens`
17971     // - return true
17972
17973     if (state.level < maxNesting) {
17974       for (i = 0; i < len; i++) {
17975         ok = rules[i](state, false);
17976         if (ok) { break; }
17977       }
17978     }
17979
17980     if (ok) {
17981       if (state.pos >= end) { break; }
17982       continue;
17983     }
17984
17985     state.pending += state.src[state.pos++];
17986   }
17987
17988   if (state.pending) {
17989     state.pushPending();
17990   }
17991 };
17992
17993
17994 /**
17995  * ParserInline.parse(str, md, env, outTokens)
17996  *
17997  * Process input string and push inline tokens into `outTokens`
17998  **/
17999 ParserInline.prototype.parse = function (str, md, env, outTokens) {
18000   var i, rules, len;
18001   var state = new this.State(str, md, env, outTokens);
18002
18003   this.tokenize(state);
18004
18005   rules = this.ruler2.getRules('');
18006   len = rules.length;
18007
18008   for (i = 0; i < len; i++) {
18009     rules[i](state);
18010   }
18011 };
18012
18013
18014 ParserInline.prototype.State = __webpack_require__(100);
18015
18016
18017 module.exports = ParserInline;
18018
18019
18020 /***/ }),
18021 /* 87 */
18022 /***/ (function(module, exports, __webpack_require__) {
18023
18024 "use strict";
18025 // Skip text characters for text token, place those to pending buffer
18026 // and increment current pos
18027
18028
18029
18030
18031 // Rule to skip pure text
18032 // '{}$%@~+=:' reserved for extentions
18033
18034 // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, :, ;, <, =, >, ?, @, [, \, ], ^, _, `, {, |, }, or ~
18035
18036 // !!!! Don't confuse with "Markdown ASCII Punctuation" chars
18037 // http://spec.commonmark.org/0.15/#ascii-punctuation-character
18038 function isTerminatorChar(ch) {
18039   switch (ch) {
18040     case 0x0A/* \n */:
18041     case 0x21/* ! */:
18042     case 0x23/* # */:
18043     case 0x24/* $ */:
18044     case 0x25/* % */:
18045     case 0x26/* & */:
18046     case 0x2A/* * */:
18047     case 0x2B/* + */:
18048     case 0x2D/* - */:
18049     case 0x3A/* : */:
18050     case 0x3C/* < */:
18051     case 0x3D/* = */:
18052     case 0x3E/* > */:
18053     case 0x40/* @ */:
18054     case 0x5B/* [ */:
18055     case 0x5C/* \ */:
18056     case 0x5D/* ] */:
18057     case 0x5E/* ^ */:
18058     case 0x5F/* _ */:
18059     case 0x60/* ` */:
18060     case 0x7B/* { */:
18061     case 0x7D/* } */:
18062     case 0x7E/* ~ */:
18063       return true;
18064     default:
18065       return false;
18066   }
18067 }
18068
18069 module.exports = function text(state, silent) {
18070   var pos = state.pos;
18071
18072   while (pos < state.posMax && !isTerminatorChar(state.src.charCodeAt(pos))) {
18073     pos++;
18074   }
18075
18076   if (pos === state.pos) { return false; }
18077
18078   if (!silent) { state.pending += state.src.slice(state.pos, pos); }
18079
18080   state.pos = pos;
18081
18082   return true;
18083 };
18084
18085 // Alternative implementation, for memory.
18086 //
18087 // It costs 10% of performance, but allows extend terminators list, if place it
18088 // to `ParcerInline` property. Probably, will switch to it sometime, such
18089 // flexibility required.
18090
18091 /*
18092 var TERMINATOR_RE = /[\n!#$%&*+\-:<=>@[\\\]^_`{}~]/;
18093
18094 module.exports = function text(state, silent) {
18095   var pos = state.pos,
18096       idx = state.src.slice(pos).search(TERMINATOR_RE);
18097
18098   // first char is terminator -> empty text
18099   if (idx === 0) { return false; }
18100
18101   // no terminator -> text till end of string
18102   if (idx < 0) {
18103     if (!silent) { state.pending += state.src.slice(pos); }
18104     state.pos = state.src.length;
18105     return true;
18106   }
18107
18108   if (!silent) { state.pending += state.src.slice(pos, pos + idx); }
18109
18110   state.pos += idx;
18111
18112   return true;
18113 };*/
18114
18115
18116 /***/ }),
18117 /* 88 */
18118 /***/ (function(module, exports, __webpack_require__) {
18119
18120 "use strict";
18121 // Proceess '\n'
18122
18123
18124
18125 var isSpace = __webpack_require__(42).isSpace;
18126
18127
18128 module.exports = function newline(state, silent) {
18129   var pmax, max, pos = state.pos;
18130
18131   if (state.src.charCodeAt(pos) !== 0x0A/* \n */) { return false; }
18132
18133   pmax = state.pending.length - 1;
18134   max = state.posMax;
18135
18136   // '  \n' -> hardbreak
18137   // Lookup in pending chars is bad practice! Don't copy to other rules!
18138   // Pending string is stored in concat mode, indexed lookups will cause
18139   // convertion to flat mode.
18140   if (!silent) {
18141     if (pmax >= 0 && state.pending.charCodeAt(pmax) === 0x20) {
18142       if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 0x20) {
18143         state.pending = state.pending.replace(/ +$/, '');
18144         state.push('hardbreak', 'br', 0);
18145       } else {
18146         state.pending = state.pending.slice(0, -1);
18147         state.push('softbreak', 'br', 0);
18148       }
18149
18150     } else {
18151       state.push('softbreak', 'br', 0);
18152     }
18153   }
18154
18155   pos++;
18156
18157   // skip heading spaces for next line
18158   while (pos < max && isSpace(state.src.charCodeAt(pos))) { pos++; }
18159
18160   state.pos = pos;
18161   return true;
18162 };
18163
18164
18165 /***/ }),
18166 /* 89 */
18167 /***/ (function(module, exports, __webpack_require__) {
18168
18169 "use strict";
18170 // Process escaped chars and hardbreaks
18171
18172
18173
18174 var isSpace = __webpack_require__(42).isSpace;
18175
18176 var ESCAPED = [];
18177
18178 for (var i = 0; i < 256; i++) { ESCAPED.push(0); }
18179
18180 '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-'
18181   .split('').forEach(function (ch) { ESCAPED[ch.charCodeAt(0)] = 1; });
18182
18183
18184 module.exports = function escape(state, silent) {
18185   var ch, pos = state.pos, max = state.posMax;
18186
18187   if (state.src.charCodeAt(pos) !== 0x5C/* \ */) { return false; }
18188
18189   pos++;
18190
18191   if (pos < max) {
18192     ch = state.src.charCodeAt(pos);
18193
18194     if (ch < 256 && ESCAPED[ch] !== 0) {
18195       if (!silent) { state.pending += state.src[pos]; }
18196       state.pos += 2;
18197       return true;
18198     }
18199
18200     if (ch === 0x0A) {
18201       if (!silent) {
18202         state.push('hardbreak', 'br', 0);
18203       }
18204
18205       pos++;
18206       // skip leading whitespaces from next line
18207       while (pos < max) {
18208         ch = state.src.charCodeAt(pos);
18209         if (!isSpace(ch)) { break; }
18210         pos++;
18211       }
18212
18213       state.pos = pos;
18214       return true;
18215     }
18216   }
18217
18218   if (!silent) { state.pending += '\\'; }
18219   state.pos++;
18220   return true;
18221 };
18222
18223
18224 /***/ }),
18225 /* 90 */
18226 /***/ (function(module, exports, __webpack_require__) {
18227
18228 "use strict";
18229 // Parse backticks
18230
18231
18232
18233 module.exports = function backtick(state, silent) {
18234   var start, max, marker, matchStart, matchEnd, token,
18235       pos = state.pos,
18236       ch = state.src.charCodeAt(pos);
18237
18238   if (ch !== 0x60/* ` */) { return false; }
18239
18240   start = pos;
18241   pos++;
18242   max = state.posMax;
18243
18244   while (pos < max && state.src.charCodeAt(pos) === 0x60/* ` */) { pos++; }
18245
18246   marker = state.src.slice(start, pos);
18247
18248   matchStart = matchEnd = pos;
18249
18250   while ((matchStart = state.src.indexOf('`', matchEnd)) !== -1) {
18251     matchEnd = matchStart + 1;
18252
18253     while (matchEnd < max && state.src.charCodeAt(matchEnd) === 0x60/* ` */) { matchEnd++; }
18254
18255     if (matchEnd - matchStart === marker.length) {
18256       if (!silent) {
18257         token         = state.push('code_inline', 'code', 0);
18258         token.markup  = marker;
18259         token.content = state.src.slice(pos, matchStart)
18260           .replace(/\n/g, ' ')
18261           .replace(/^ (.+) $/, '$1');
18262       }
18263       state.pos = matchEnd;
18264       return true;
18265     }
18266   }
18267
18268   if (!silent) { state.pending += marker; }
18269   state.pos += marker.length;
18270   return true;
18271 };
18272
18273
18274 /***/ }),
18275 /* 91 */
18276 /***/ (function(module, exports, __webpack_require__) {
18277
18278 "use strict";
18279 // ~~strike through~~
18280 //
18281
18282
18283
18284 // Insert each marker as a separate text token, and add it to delimiter list
18285 //
18286 module.exports.tokenize = function strikethrough(state, silent) {
18287   var i, scanned, token, len, ch,
18288       start = state.pos,
18289       marker = state.src.charCodeAt(start);
18290
18291   if (silent) { return false; }
18292
18293   if (marker !== 0x7E/* ~ */) { return false; }
18294
18295   scanned = state.scanDelims(state.pos, true);
18296   len = scanned.length;
18297   ch = String.fromCharCode(marker);
18298
18299   if (len < 2) { return false; }
18300
18301   if (len % 2) {
18302     token         = state.push('text', '', 0);
18303     token.content = ch;
18304     len--;
18305   }
18306
18307   for (i = 0; i < len; i += 2) {
18308     token         = state.push('text', '', 0);
18309     token.content = ch + ch;
18310
18311     state.delimiters.push({
18312       marker: marker,
18313       length: 0, // disable "rule of 3" length checks meant for emphasis
18314       jump:   i,
18315       token:  state.tokens.length - 1,
18316       end:    -1,
18317       open:   scanned.can_open,
18318       close:  scanned.can_close
18319     });
18320   }
18321
18322   state.pos += scanned.length;
18323
18324   return true;
18325 };
18326
18327
18328 function postProcess(state, delimiters) {
18329   var i, j,
18330       startDelim,
18331       endDelim,
18332       token,
18333       loneMarkers = [],
18334       max = delimiters.length;
18335
18336   for (i = 0; i < max; i++) {
18337     startDelim = delimiters[i];
18338
18339     if (startDelim.marker !== 0x7E/* ~ */) {
18340       continue;
18341     }
18342
18343     if (startDelim.end === -1) {
18344       continue;
18345     }
18346
18347     endDelim = delimiters[startDelim.end];
18348
18349     token         = state.tokens[startDelim.token];
18350     token.type    = 's_open';
18351     token.tag     = 's';
18352     token.nesting = 1;
18353     token.markup  = '~~';
18354     token.content = '';
18355
18356     token         = state.tokens[endDelim.token];
18357     token.type    = 's_close';
18358     token.tag     = 's';
18359     token.nesting = -1;
18360     token.markup  = '~~';
18361     token.content = '';
18362
18363     if (state.tokens[endDelim.token - 1].type === 'text' &&
18364         state.tokens[endDelim.token - 1].content === '~') {
18365
18366       loneMarkers.push(endDelim.token - 1);
18367     }
18368   }
18369
18370   // If a marker sequence has an odd number of characters, it's splitted
18371   // like this: `~~~~~` -> `~` + `~~` + `~~`, leaving one marker at the
18372   // start of the sequence.
18373   //
18374   // So, we have to move all those markers after subsequent s_close tags.
18375   //
18376   while (loneMarkers.length) {
18377     i = loneMarkers.pop();
18378     j = i + 1;
18379
18380     while (j < state.tokens.length && state.tokens[j].type === 's_close') {
18381       j++;
18382     }
18383
18384     j--;
18385
18386     if (i !== j) {
18387       token = state.tokens[j];
18388       state.tokens[j] = state.tokens[i];
18389       state.tokens[i] = token;
18390     }
18391   }
18392 }
18393
18394
18395 // Walk through delimiter list and replace text tokens with tags
18396 //
18397 module.exports.postProcess = function strikethrough(state) {
18398   var curr,
18399       tokens_meta = state.tokens_meta,
18400       max = state.tokens_meta.length;
18401
18402   postProcess(state, state.delimiters);
18403
18404   for (curr = 0; curr < max; curr++) {
18405     if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
18406       postProcess(state, tokens_meta[curr].delimiters);
18407     }
18408   }
18409 };
18410
18411
18412 /***/ }),
18413 /* 92 */
18414 /***/ (function(module, exports, __webpack_require__) {
18415
18416 "use strict";
18417 // Process *this* and _that_
18418 //
18419
18420
18421
18422 // Insert each marker as a separate text token, and add it to delimiter list
18423 //
18424 module.exports.tokenize = function emphasis(state, silent) {
18425   var i, scanned, token,
18426       start = state.pos,
18427       marker = state.src.charCodeAt(start);
18428
18429   if (silent) { return false; }
18430
18431   if (marker !== 0x5F /* _ */ && marker !== 0x2A /* * */) { return false; }
18432
18433   scanned = state.scanDelims(state.pos, marker === 0x2A);
18434
18435   for (i = 0; i < scanned.length; i++) {
18436     token         = state.push('text', '', 0);
18437     token.content = String.fromCharCode(marker);
18438
18439     state.delimiters.push({
18440       // Char code of the starting marker (number).
18441       //
18442       marker: marker,
18443
18444       // Total length of these series of delimiters.
18445       //
18446       length: scanned.length,
18447
18448       // An amount of characters before this one that's equivalent to
18449       // current one. In plain English: if this delimiter does not open
18450       // an emphasis, neither do previous `jump` characters.
18451       //
18452       // Used to skip sequences like "*****" in one step, for 1st asterisk
18453       // value will be 0, for 2nd it's 1 and so on.
18454       //
18455       jump:   i,
18456
18457       // A position of the token this delimiter corresponds to.
18458       //
18459       token:  state.tokens.length - 1,
18460
18461       // If this delimiter is matched as a valid opener, `end` will be
18462       // equal to its position, otherwise it's `-1`.
18463       //
18464       end:    -1,
18465
18466       // Boolean flags that determine if this delimiter could open or close
18467       // an emphasis.
18468       //
18469       open:   scanned.can_open,
18470       close:  scanned.can_close
18471     });
18472   }
18473
18474   state.pos += scanned.length;
18475
18476   return true;
18477 };
18478
18479
18480 function postProcess(state, delimiters) {
18481   var i,
18482       startDelim,
18483       endDelim,
18484       token,
18485       ch,
18486       isStrong,
18487       max = delimiters.length;
18488
18489   for (i = max - 1; i >= 0; i--) {
18490     startDelim = delimiters[i];
18491
18492     if (startDelim.marker !== 0x5F/* _ */ && startDelim.marker !== 0x2A/* * */) {
18493       continue;
18494     }
18495
18496     // Process only opening markers
18497     if (startDelim.end === -1) {
18498       continue;
18499     }
18500
18501     endDelim = delimiters[startDelim.end];
18502
18503     // If the previous delimiter has the same marker and is adjacent to this one,
18504     // merge those into one strong delimiter.
18505     //
18506     // `<em><em>whatever</em></em>` -> `<strong>whatever</strong>`
18507     //
18508     isStrong = i > 0 &&
18509                delimiters[i - 1].end === startDelim.end + 1 &&
18510                delimiters[i - 1].token === startDelim.token - 1 &&
18511                delimiters[startDelim.end + 1].token === endDelim.token + 1 &&
18512                delimiters[i - 1].marker === startDelim.marker;
18513
18514     ch = String.fromCharCode(startDelim.marker);
18515
18516     token         = state.tokens[startDelim.token];
18517     token.type    = isStrong ? 'strong_open' : 'em_open';
18518     token.tag     = isStrong ? 'strong' : 'em';
18519     token.nesting = 1;
18520     token.markup  = isStrong ? ch + ch : ch;
18521     token.content = '';
18522
18523     token         = state.tokens[endDelim.token];
18524     token.type    = isStrong ? 'strong_close' : 'em_close';
18525     token.tag     = isStrong ? 'strong' : 'em';
18526     token.nesting = -1;
18527     token.markup  = isStrong ? ch + ch : ch;
18528     token.content = '';
18529
18530     if (isStrong) {
18531       state.tokens[delimiters[i - 1].token].content = '';
18532       state.tokens[delimiters[startDelim.end + 1].token].content = '';
18533       i--;
18534     }
18535   }
18536 }
18537
18538
18539 // Walk through delimiter list and replace text tokens with tags
18540 //
18541 module.exports.postProcess = function emphasis(state) {
18542   var curr,
18543       tokens_meta = state.tokens_meta,
18544       max = state.tokens_meta.length;
18545
18546   postProcess(state, state.delimiters);
18547
18548   for (curr = 0; curr < max; curr++) {
18549     if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
18550       postProcess(state, tokens_meta[curr].delimiters);
18551     }
18552   }
18553 };
18554
18555
18556 /***/ }),
18557 /* 93 */
18558 /***/ (function(module, exports, __webpack_require__) {
18559
18560 "use strict";
18561 // Process [link](<to> "stuff")
18562
18563
18564
18565 var normalizeReference   = __webpack_require__(42).normalizeReference;
18566 var isSpace              = __webpack_require__(42).isSpace;
18567
18568
18569 module.exports = function link(state, silent) {
18570   var attrs,
18571       code,
18572       label,
18573       labelEnd,
18574       labelStart,
18575       pos,
18576       res,
18577       ref,
18578       title,
18579       token,
18580       href = '',
18581       oldPos = state.pos,
18582       max = state.posMax,
18583       start = state.pos,
18584       parseReference = true;
18585
18586   if (state.src.charCodeAt(state.pos) !== 0x5B/* [ */) { return false; }
18587
18588   labelStart = state.pos + 1;
18589   labelEnd = state.md.helpers.parseLinkLabel(state, state.pos, true);
18590
18591   // parser failed to find ']', so it's not a valid link
18592   if (labelEnd < 0) { return false; }
18593
18594   pos = labelEnd + 1;
18595   if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
18596     //
18597     // Inline link
18598     //
18599
18600     // might have found a valid shortcut link, disable reference parsing
18601     parseReference = false;
18602
18603     // [link](  <href>  "title"  )
18604     //        ^^ skipping these spaces
18605     pos++;
18606     for (; pos < max; pos++) {
18607       code = state.src.charCodeAt(pos);
18608       if (!isSpace(code) && code !== 0x0A) { break; }
18609     }
18610     if (pos >= max) { return false; }
18611
18612     // [link](  <href>  "title"  )
18613     //          ^^^^^^ parsing link destination
18614     start = pos;
18615     res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
18616     if (res.ok) {
18617       href = state.md.normalizeLink(res.str);
18618       if (state.md.validateLink(href)) {
18619         pos = res.pos;
18620       } else {
18621         href = '';
18622       }
18623     }
18624
18625     // [link](  <href>  "title"  )
18626     //                ^^ skipping these spaces
18627     start = pos;
18628     for (; pos < max; pos++) {
18629       code = state.src.charCodeAt(pos);
18630       if (!isSpace(code) && code !== 0x0A) { break; }
18631     }
18632
18633     // [link](  <href>  "title"  )
18634     //                  ^^^^^^^ parsing link title
18635     res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
18636     if (pos < max && start !== pos && res.ok) {
18637       title = res.str;
18638       pos = res.pos;
18639
18640       // [link](  <href>  "title"  )
18641       //                         ^^ skipping these spaces
18642       for (; pos < max; pos++) {
18643         code = state.src.charCodeAt(pos);
18644         if (!isSpace(code) && code !== 0x0A) { break; }
18645       }
18646     } else {
18647       title = '';
18648     }
18649
18650     if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
18651       // parsing a valid shortcut link failed, fallback to reference
18652       parseReference = true;
18653     }
18654     pos++;
18655   }
18656
18657   if (parseReference) {
18658     //
18659     // Link reference
18660     //
18661     if (typeof state.env.references === 'undefined') { return false; }
18662
18663     if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
18664       start = pos + 1;
18665       pos = state.md.helpers.parseLinkLabel(state, pos);
18666       if (pos >= 0) {
18667         label = state.src.slice(start, pos++);
18668       } else {
18669         pos = labelEnd + 1;
18670       }
18671     } else {
18672       pos = labelEnd + 1;
18673     }
18674
18675     // covers label === '' and label === undefined
18676     // (collapsed reference link and shortcut reference link respectively)
18677     if (!label) { label = state.src.slice(labelStart, labelEnd); }
18678
18679     ref = state.env.references[normalizeReference(label)];
18680     if (!ref) {
18681       state.pos = oldPos;
18682       return false;
18683     }
18684     href = ref.href;
18685     title = ref.title;
18686   }
18687
18688   //
18689   // We found the end of the link, and know for a fact it's a valid link;
18690   // so all that's left to do is to call tokenizer.
18691   //
18692   if (!silent) {
18693     state.pos = labelStart;
18694     state.posMax = labelEnd;
18695
18696     token        = state.push('link_open', 'a', 1);
18697     token.attrs  = attrs = [ [ 'href', href ] ];
18698     if (title) {
18699       attrs.push([ 'title', title ]);
18700     }
18701
18702     state.md.inline.tokenize(state);
18703
18704     token        = state.push('link_close', 'a', -1);
18705   }
18706
18707   state.pos = pos;
18708   state.posMax = max;
18709   return true;
18710 };
18711
18712
18713 /***/ }),
18714 /* 94 */
18715 /***/ (function(module, exports, __webpack_require__) {
18716
18717 "use strict";
18718 // Process ![image](<src> "title")
18719
18720
18721
18722 var normalizeReference   = __webpack_require__(42).normalizeReference;
18723 var isSpace              = __webpack_require__(42).isSpace;
18724
18725
18726 module.exports = function image(state, silent) {
18727   var attrs,
18728       code,
18729       content,
18730       label,
18731       labelEnd,
18732       labelStart,
18733       pos,
18734       ref,
18735       res,
18736       title,
18737       token,
18738       tokens,
18739       start,
18740       href = '',
18741       oldPos = state.pos,
18742       max = state.posMax;
18743
18744   if (state.src.charCodeAt(state.pos) !== 0x21/* ! */) { return false; }
18745   if (state.src.charCodeAt(state.pos + 1) !== 0x5B/* [ */) { return false; }
18746
18747   labelStart = state.pos + 2;
18748   labelEnd = state.md.helpers.parseLinkLabel(state, state.pos + 1, false);
18749
18750   // parser failed to find ']', so it's not a valid link
18751   if (labelEnd < 0) { return false; }
18752
18753   pos = labelEnd + 1;
18754   if (pos < max && state.src.charCodeAt(pos) === 0x28/* ( */) {
18755     //
18756     // Inline link
18757     //
18758
18759     // [link](  <href>  "title"  )
18760     //        ^^ skipping these spaces
18761     pos++;
18762     for (; pos < max; pos++) {
18763       code = state.src.charCodeAt(pos);
18764       if (!isSpace(code) && code !== 0x0A) { break; }
18765     }
18766     if (pos >= max) { return false; }
18767
18768     // [link](  <href>  "title"  )
18769     //          ^^^^^^ parsing link destination
18770     start = pos;
18771     res = state.md.helpers.parseLinkDestination(state.src, pos, state.posMax);
18772     if (res.ok) {
18773       href = state.md.normalizeLink(res.str);
18774       if (state.md.validateLink(href)) {
18775         pos = res.pos;
18776       } else {
18777         href = '';
18778       }
18779     }
18780
18781     // [link](  <href>  "title"  )
18782     //                ^^ skipping these spaces
18783     start = pos;
18784     for (; pos < max; pos++) {
18785       code = state.src.charCodeAt(pos);
18786       if (!isSpace(code) && code !== 0x0A) { break; }
18787     }
18788
18789     // [link](  <href>  "title"  )
18790     //                  ^^^^^^^ parsing link title
18791     res = state.md.helpers.parseLinkTitle(state.src, pos, state.posMax);
18792     if (pos < max && start !== pos && res.ok) {
18793       title = res.str;
18794       pos = res.pos;
18795
18796       // [link](  <href>  "title"  )
18797       //                         ^^ skipping these spaces
18798       for (; pos < max; pos++) {
18799         code = state.src.charCodeAt(pos);
18800         if (!isSpace(code) && code !== 0x0A) { break; }
18801       }
18802     } else {
18803       title = '';
18804     }
18805
18806     if (pos >= max || state.src.charCodeAt(pos) !== 0x29/* ) */) {
18807       state.pos = oldPos;
18808       return false;
18809     }
18810     pos++;
18811   } else {
18812     //
18813     // Link reference
18814     //
18815     if (typeof state.env.references === 'undefined') { return false; }
18816
18817     if (pos < max && state.src.charCodeAt(pos) === 0x5B/* [ */) {
18818       start = pos + 1;
18819       pos = state.md.helpers.parseLinkLabel(state, pos);
18820       if (pos >= 0) {
18821         label = state.src.slice(start, pos++);
18822       } else {
18823         pos = labelEnd + 1;
18824       }
18825     } else {
18826       pos = labelEnd + 1;
18827     }
18828
18829     // covers label === '' and label === undefined
18830     // (collapsed reference link and shortcut reference link respectively)
18831     if (!label) { label = state.src.slice(labelStart, labelEnd); }
18832
18833     ref = state.env.references[normalizeReference(label)];
18834     if (!ref) {
18835       state.pos = oldPos;
18836       return false;
18837     }
18838     href = ref.href;
18839     title = ref.title;
18840   }
18841
18842   //
18843   // We found the end of the link, and know for a fact it's a valid link;
18844   // so all that's left to do is to call tokenizer.
18845   //
18846   if (!silent) {
18847     content = state.src.slice(labelStart, labelEnd);
18848
18849     state.md.inline.parse(
18850       content,
18851       state.md,
18852       state.env,
18853       tokens = []
18854     );
18855
18856     token          = state.push('image', 'img', 0);
18857     token.attrs    = attrs = [ [ 'src', href ], [ 'alt', '' ] ];
18858     token.children = tokens;
18859     token.content  = content;
18860
18861     if (title) {
18862       attrs.push([ 'title', title ]);
18863     }
18864   }
18865
18866   state.pos = pos;
18867   state.posMax = max;
18868   return true;
18869 };
18870
18871
18872 /***/ }),
18873 /* 95 */
18874 /***/ (function(module, exports, __webpack_require__) {
18875
18876 "use strict";
18877 // Process autolinks '<protocol:...>'
18878
18879
18880
18881
18882 /*eslint max-len:0*/
18883 var EMAIL_RE    = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/;
18884 var AUTOLINK_RE = /^<([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)>/;
18885
18886
18887 module.exports = function autolink(state, silent) {
18888   var tail, linkMatch, emailMatch, url, fullUrl, token,
18889       pos = state.pos;
18890
18891   if (state.src.charCodeAt(pos) !== 0x3C/* < */) { return false; }
18892
18893   tail = state.src.slice(pos);
18894
18895   if (tail.indexOf('>') < 0) { return false; }
18896
18897   if (AUTOLINK_RE.test(tail)) {
18898     linkMatch = tail.match(AUTOLINK_RE);
18899
18900     url = linkMatch[0].slice(1, -1);
18901     fullUrl = state.md.normalizeLink(url);
18902     if (!state.md.validateLink(fullUrl)) { return false; }
18903
18904     if (!silent) {
18905       token         = state.push('link_open', 'a', 1);
18906       token.attrs   = [ [ 'href', fullUrl ] ];
18907       token.markup  = 'autolink';
18908       token.info    = 'auto';
18909
18910       token         = state.push('text', '', 0);
18911       token.content = state.md.normalizeLinkText(url);
18912
18913       token         = state.push('link_close', 'a', -1);
18914       token.markup  = 'autolink';
18915       token.info    = 'auto';
18916     }
18917
18918     state.pos += linkMatch[0].length;
18919     return true;
18920   }
18921
18922   if (EMAIL_RE.test(tail)) {
18923     emailMatch = tail.match(EMAIL_RE);
18924
18925     url = emailMatch[0].slice(1, -1);
18926     fullUrl = state.md.normalizeLink('mailto:' + url);
18927     if (!state.md.validateLink(fullUrl)) { return false; }
18928
18929     if (!silent) {
18930       token         = state.push('link_open', 'a', 1);
18931       token.attrs   = [ [ 'href', fullUrl ] ];
18932       token.markup  = 'autolink';
18933       token.info    = 'auto';
18934
18935       token         = state.push('text', '', 0);
18936       token.content = state.md.normalizeLinkText(url);
18937
18938       token         = state.push('link_close', 'a', -1);
18939       token.markup  = 'autolink';
18940       token.info    = 'auto';
18941     }
18942
18943     state.pos += emailMatch[0].length;
18944     return true;
18945   }
18946
18947   return false;
18948 };
18949
18950
18951 /***/ }),
18952 /* 96 */
18953 /***/ (function(module, exports, __webpack_require__) {
18954
18955 "use strict";
18956 // Process html tags
18957
18958
18959
18960
18961 var HTML_TAG_RE = __webpack_require__(83).HTML_TAG_RE;
18962
18963
18964 function isLetter(ch) {
18965   /*eslint no-bitwise:0*/
18966   var lc = ch | 0x20; // to lower case
18967   return (lc >= 0x61/* a */) && (lc <= 0x7a/* z */);
18968 }
18969
18970
18971 module.exports = function html_inline(state, silent) {
18972   var ch, match, max, token,
18973       pos = state.pos;
18974
18975   if (!state.md.options.html) { return false; }
18976
18977   // Check start
18978   max = state.posMax;
18979   if (state.src.charCodeAt(pos) !== 0x3C/* < */ ||
18980       pos + 2 >= max) {
18981     return false;
18982   }
18983
18984   // Quick fail on second char
18985   ch = state.src.charCodeAt(pos + 1);
18986   if (ch !== 0x21/* ! */ &&
18987       ch !== 0x3F/* ? */ &&
18988       ch !== 0x2F/* / */ &&
18989       !isLetter(ch)) {
18990     return false;
18991   }
18992
18993   match = state.src.slice(pos).match(HTML_TAG_RE);
18994   if (!match) { return false; }
18995
18996   if (!silent) {
18997     token         = state.push('html_inline', '', 0);
18998     token.content = state.src.slice(pos, pos + match[0].length);
18999   }
19000   state.pos += match[0].length;
19001   return true;
19002 };
19003
19004
19005 /***/ }),
19006 /* 97 */
19007 /***/ (function(module, exports, __webpack_require__) {
19008
19009 "use strict";
19010 // Process html entity - &#123;, &#xAF;, &quot;, ...
19011
19012
19013
19014 var entities          = __webpack_require__(43);
19015 var has               = __webpack_require__(42).has;
19016 var isValidEntityCode = __webpack_require__(42).isValidEntityCode;
19017 var fromCodePoint     = __webpack_require__(42).fromCodePoint;
19018
19019
19020 var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
19021 var NAMED_RE   = /^&([a-z][a-z0-9]{1,31});/i;
19022
19023
19024 module.exports = function entity(state, silent) {
19025   var ch, code, match, pos = state.pos, max = state.posMax;
19026
19027   if (state.src.charCodeAt(pos) !== 0x26/* & */) { return false; }
19028
19029   if (pos + 1 < max) {
19030     ch = state.src.charCodeAt(pos + 1);
19031
19032     if (ch === 0x23 /* # */) {
19033       match = state.src.slice(pos).match(DIGITAL_RE);
19034       if (match) {
19035         if (!silent) {
19036           code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
19037           state.pending += isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
19038         }
19039         state.pos += match[0].length;
19040         return true;
19041       }
19042     } else {
19043       match = state.src.slice(pos).match(NAMED_RE);
19044       if (match) {
19045         if (has(entities, match[1])) {
19046           if (!silent) { state.pending += entities[match[1]]; }
19047           state.pos += match[0].length;
19048           return true;
19049         }
19050       }
19051     }
19052   }
19053
19054   if (!silent) { state.pending += '&'; }
19055   state.pos++;
19056   return true;
19057 };
19058
19059
19060 /***/ }),
19061 /* 98 */
19062 /***/ (function(module, exports, __webpack_require__) {
19063
19064 "use strict";
19065 // For each opening emphasis-like marker find a matching closing one
19066 //
19067
19068
19069
19070 function processDelimiters(state, delimiters) {
19071   var closerIdx, openerIdx, closer, opener, minOpenerIdx, newMinOpenerIdx,
19072       isOddMatch, lastJump,
19073       openersBottom = {},
19074       max = delimiters.length;
19075
19076   for (closerIdx = 0; closerIdx < max; closerIdx++) {
19077     closer = delimiters[closerIdx];
19078
19079     // Length is only used for emphasis-specific "rule of 3",
19080     // if it's not defined (in strikethrough or 3rd party plugins),
19081     // we can default it to 0 to disable those checks.
19082     //
19083     closer.length = closer.length || 0;
19084
19085     if (!closer.close) continue;
19086
19087     // Previously calculated lower bounds (previous fails)
19088     // for each marker and each delimiter length modulo 3.
19089     if (!openersBottom.hasOwnProperty(closer.marker)) {
19090       openersBottom[closer.marker] = [ -1, -1, -1 ];
19091     }
19092
19093     minOpenerIdx = openersBottom[closer.marker][closer.length % 3];
19094     newMinOpenerIdx = -1;
19095
19096     openerIdx = closerIdx - closer.jump - 1;
19097
19098     for (; openerIdx > minOpenerIdx; openerIdx -= opener.jump + 1) {
19099       opener = delimiters[openerIdx];
19100
19101       if (opener.marker !== closer.marker) continue;
19102
19103       if (newMinOpenerIdx === -1) newMinOpenerIdx = openerIdx;
19104
19105       if (opener.open &&
19106           opener.end < 0 &&
19107           opener.level === closer.level) {
19108
19109         isOddMatch = false;
19110
19111         // from spec:
19112         //
19113         // If one of the delimiters can both open and close emphasis, then the
19114         // sum of the lengths of the delimiter runs containing the opening and
19115         // closing delimiters must not be a multiple of 3 unless both lengths
19116         // are multiples of 3.
19117         //
19118         if (opener.close || closer.open) {
19119           if ((opener.length + closer.length) % 3 === 0) {
19120             if (opener.length % 3 !== 0 || closer.length % 3 !== 0) {
19121               isOddMatch = true;
19122             }
19123           }
19124         }
19125
19126         if (!isOddMatch) {
19127           // If previous delimiter cannot be an opener, we can safely skip
19128           // the entire sequence in future checks. This is required to make
19129           // sure algorithm has linear complexity (see *_*_*_*_*_... case).
19130           //
19131           lastJump = openerIdx > 0 && !delimiters[openerIdx - 1].open ?
19132             delimiters[openerIdx - 1].jump + 1 :
19133             0;
19134
19135           closer.jump  = closerIdx - openerIdx + lastJump;
19136           closer.open  = false;
19137           opener.end   = closerIdx;
19138           opener.jump  = lastJump;
19139           opener.close = false;
19140           newMinOpenerIdx = -1;
19141           break;
19142         }
19143       }
19144     }
19145
19146     if (newMinOpenerIdx !== -1) {
19147       // If match for this delimiter run failed, we want to set lower bound for
19148       // future lookups. This is required to make sure algorithm has linear
19149       // complexity.
19150       //
19151       // See details here:
19152       // https://github.com/commonmark/cmark/issues/178#issuecomment-270417442
19153       //
19154       openersBottom[closer.marker][(closer.length || 0) % 3] = newMinOpenerIdx;
19155     }
19156   }
19157 }
19158
19159
19160 module.exports = function link_pairs(state) {
19161   var curr,
19162       tokens_meta = state.tokens_meta,
19163       max = state.tokens_meta.length;
19164
19165   processDelimiters(state, state.delimiters);
19166
19167   for (curr = 0; curr < max; curr++) {
19168     if (tokens_meta[curr] && tokens_meta[curr].delimiters) {
19169       processDelimiters(state, tokens_meta[curr].delimiters);
19170     }
19171   }
19172 };
19173
19174
19175 /***/ }),
19176 /* 99 */
19177 /***/ (function(module, exports, __webpack_require__) {
19178
19179 "use strict";
19180 // Clean up tokens after emphasis and strikethrough postprocessing:
19181 // merge adjacent text nodes into one and re-calculate all token levels
19182 //
19183 // This is necessary because initially emphasis delimiter markers (*, _, ~)
19184 // are treated as their own separate text tokens. Then emphasis rule either
19185 // leaves them as text (needed to merge with adjacent text) or turns them
19186 // into opening/closing tags (which messes up levels inside).
19187 //
19188
19189
19190
19191 module.exports = function text_collapse(state) {
19192   var curr, last,
19193       level = 0,
19194       tokens = state.tokens,
19195       max = state.tokens.length;
19196
19197   for (curr = last = 0; curr < max; curr++) {
19198     // re-calculate levels after emphasis/strikethrough turns some text nodes
19199     // into opening/closing tags
19200     if (tokens[curr].nesting < 0) level--; // closing tag
19201     tokens[curr].level = level;
19202     if (tokens[curr].nesting > 0) level++; // opening tag
19203
19204     if (tokens[curr].type === 'text' &&
19205         curr + 1 < max &&
19206         tokens[curr + 1].type === 'text') {
19207
19208       // collapse two adjacent text nodes
19209       tokens[curr + 1].content = tokens[curr].content + tokens[curr + 1].content;
19210     } else {
19211       if (curr !== last) { tokens[last] = tokens[curr]; }
19212
19213       last++;
19214     }
19215   }
19216
19217   if (curr !== last) {
19218     tokens.length = last;
19219   }
19220 };
19221
19222
19223 /***/ }),
19224 /* 100 */
19225 /***/ (function(module, exports, __webpack_require__) {
19226
19227 "use strict";
19228 // Inline parser state
19229
19230
19231
19232
19233 var Token          = __webpack_require__(70);
19234 var isWhiteSpace   = __webpack_require__(42).isWhiteSpace;
19235 var isPunctChar    = __webpack_require__(42).isPunctChar;
19236 var isMdAsciiPunct = __webpack_require__(42).isMdAsciiPunct;
19237
19238
19239 function StateInline(src, md, env, outTokens) {
19240   this.src = src;
19241   this.env = env;
19242   this.md = md;
19243   this.tokens = outTokens;
19244   this.tokens_meta = Array(outTokens.length);
19245
19246   this.pos = 0;
19247   this.posMax = this.src.length;
19248   this.level = 0;
19249   this.pending = '';
19250   this.pendingLevel = 0;
19251
19252   // Stores { start: end } pairs. Useful for backtrack
19253   // optimization of pairs parse (emphasis, strikes).
19254   this.cache = {};
19255
19256   // List of emphasis-like delimiters for current tag
19257   this.delimiters = [];
19258
19259   // Stack of delimiter lists for upper level tags
19260   this._prev_delimiters = [];
19261 }
19262
19263
19264 // Flush pending text
19265 //
19266 StateInline.prototype.pushPending = function () {
19267   var token = new Token('text', '', 0);
19268   token.content = this.pending;
19269   token.level = this.pendingLevel;
19270   this.tokens.push(token);
19271   this.pending = '';
19272   return token;
19273 };
19274
19275
19276 // Push new token to "stream".
19277 // If pending text exists - flush it as text token
19278 //
19279 StateInline.prototype.push = function (type, tag, nesting) {
19280   if (this.pending) {
19281     this.pushPending();
19282   }
19283
19284   var token = new Token(type, tag, nesting);
19285   var token_meta = null;
19286
19287   if (nesting < 0) {
19288     // closing tag
19289     this.level--;
19290     this.delimiters = this._prev_delimiters.pop();
19291   }
19292
19293   token.level = this.level;
19294
19295   if (nesting > 0) {
19296     // opening tag
19297     this.level++;
19298     this._prev_delimiters.push(this.delimiters);
19299     this.delimiters = [];
19300     token_meta = { delimiters: this.delimiters };
19301   }
19302
19303   this.pendingLevel = this.level;
19304   this.tokens.push(token);
19305   this.tokens_meta.push(token_meta);
19306   return token;
19307 };
19308
19309
19310 // Scan a sequence of emphasis-like markers, and determine whether
19311 // it can start an emphasis sequence or end an emphasis sequence.
19312 //
19313 //  - start - position to scan from (it should point at a valid marker);
19314 //  - canSplitWord - determine if these markers can be found inside a word
19315 //
19316 StateInline.prototype.scanDelims = function (start, canSplitWord) {
19317   var pos = start, lastChar, nextChar, count, can_open, can_close,
19318       isLastWhiteSpace, isLastPunctChar,
19319       isNextWhiteSpace, isNextPunctChar,
19320       left_flanking = true,
19321       right_flanking = true,
19322       max = this.posMax,
19323       marker = this.src.charCodeAt(start);
19324
19325   // treat beginning of the line as a whitespace
19326   lastChar = start > 0 ? this.src.charCodeAt(start - 1) : 0x20;
19327
19328   while (pos < max && this.src.charCodeAt(pos) === marker) { pos++; }
19329
19330   count = pos - start;
19331
19332   // treat end of the line as a whitespace
19333   nextChar = pos < max ? this.src.charCodeAt(pos) : 0x20;
19334
19335   isLastPunctChar = isMdAsciiPunct(lastChar) || isPunctChar(String.fromCharCode(lastChar));
19336   isNextPunctChar = isMdAsciiPunct(nextChar) || isPunctChar(String.fromCharCode(nextChar));
19337
19338   isLastWhiteSpace = isWhiteSpace(lastChar);
19339   isNextWhiteSpace = isWhiteSpace(nextChar);
19340
19341   if (isNextWhiteSpace) {
19342     left_flanking = false;
19343   } else if (isNextPunctChar) {
19344     if (!(isLastWhiteSpace || isLastPunctChar)) {
19345       left_flanking = false;
19346     }
19347   }
19348
19349   if (isLastWhiteSpace) {
19350     right_flanking = false;
19351   } else if (isLastPunctChar) {
19352     if (!(isNextWhiteSpace || isNextPunctChar)) {
19353       right_flanking = false;
19354     }
19355   }
19356
19357   if (!canSplitWord) {
19358     can_open  = left_flanking  && (!right_flanking || isLastPunctChar);
19359     can_close = right_flanking && (!left_flanking  || isNextPunctChar);
19360   } else {
19361     can_open  = left_flanking;
19362     can_close = right_flanking;
19363   }
19364
19365   return {
19366     can_open:  can_open,
19367     can_close: can_close,
19368     length:    count
19369   };
19370 };
19371
19372
19373 // re-export Token class to use in block rules
19374 StateInline.prototype.Token = Token;
19375
19376
19377 module.exports = StateInline;
19378
19379
19380 /***/ }),
19381 /* 101 */
19382 /***/ (function(module, exports, __webpack_require__) {
19383
19384 "use strict";
19385
19386
19387
19388 ////////////////////////////////////////////////////////////////////////////////
19389 // Helpers
19390
19391 // Merge objects
19392 //
19393 function assign(obj /*from1, from2, from3, ...*/) {
19394   var sources = Array.prototype.slice.call(arguments, 1);
19395
19396   sources.forEach(function (source) {
19397     if (!source) { return; }
19398
19399     Object.keys(source).forEach(function (key) {
19400       obj[key] = source[key];
19401     });
19402   });
19403
19404   return obj;
19405 }
19406
19407 function _class(obj) { return Object.prototype.toString.call(obj); }
19408 function isString(obj) { return _class(obj) === '[object String]'; }
19409 function isObject(obj) { return _class(obj) === '[object Object]'; }
19410 function isRegExp(obj) { return _class(obj) === '[object RegExp]'; }
19411 function isFunction(obj) { return _class(obj) === '[object Function]'; }
19412
19413
19414 function escapeRE(str) { return str.replace(/[.?*+^$[\]\\(){}|-]/g, '\\$&'); }
19415
19416 ////////////////////////////////////////////////////////////////////////////////
19417
19418
19419 var defaultOptions = {
19420   fuzzyLink: true,
19421   fuzzyEmail: true,
19422   fuzzyIP: false
19423 };
19424
19425
19426 function isOptionsObj(obj) {
19427   return Object.keys(obj || {}).reduce(function (acc, k) {
19428     return acc || defaultOptions.hasOwnProperty(k);
19429   }, false);
19430 }
19431
19432
19433 var defaultSchemas = {
19434   'http:': {
19435     validate: function (text, pos, self) {
19436       var tail = text.slice(pos);
19437
19438       if (!self.re.http) {
19439         // compile lazily, because "host"-containing variables can change on tlds update.
19440         self.re.http =  new RegExp(
19441           '^\\/\\/' + self.re.src_auth + self.re.src_host_port_strict + self.re.src_path, 'i'
19442         );
19443       }
19444       if (self.re.http.test(tail)) {
19445         return tail.match(self.re.http)[0].length;
19446       }
19447       return 0;
19448     }
19449   },
19450   'https:':  'http:',
19451   'ftp:':    'http:',
19452   '//':      {
19453     validate: function (text, pos, self) {
19454       var tail = text.slice(pos);
19455
19456       if (!self.re.no_http) {
19457       // compile lazily, because "host"-containing variables can change on tlds update.
19458         self.re.no_http =  new RegExp(
19459           '^' +
19460           self.re.src_auth +
19461           // Don't allow single-level domains, because of false positives like '//test'
19462           // with code comments
19463           '(?:localhost|(?:(?:' + self.re.src_domain + ')\\.)+' + self.re.src_domain_root + ')' +
19464           self.re.src_port +
19465           self.re.src_host_terminator +
19466           self.re.src_path,
19467
19468           'i'
19469         );
19470       }
19471
19472       if (self.re.no_http.test(tail)) {
19473         // should not be `://` & `///`, that protects from errors in protocol name
19474         if (pos >= 3 && text[pos - 3] === ':') { return 0; }
19475         if (pos >= 3 && text[pos - 3] === '/') { return 0; }
19476         return tail.match(self.re.no_http)[0].length;
19477       }
19478       return 0;
19479     }
19480   },
19481   'mailto:': {
19482     validate: function (text, pos, self) {
19483       var tail = text.slice(pos);
19484
19485       if (!self.re.mailto) {
19486         self.re.mailto =  new RegExp(
19487           '^' + self.re.src_email_name + '@' + self.re.src_host_strict, 'i'
19488         );
19489       }
19490       if (self.re.mailto.test(tail)) {
19491         return tail.match(self.re.mailto)[0].length;
19492       }
19493       return 0;
19494     }
19495   }
19496 };
19497
19498 /*eslint-disable max-len*/
19499
19500 // RE pattern for 2-character tlds (autogenerated by ./support/tlds_2char_gen.js)
19501 var tlds_2ch_src_re = 'a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
19502
19503 // DON'T try to make PRs with changes. Extend TLDs with LinkifyIt.tlds() instead
19504 var tlds_default = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
19505
19506 /*eslint-enable max-len*/
19507
19508 ////////////////////////////////////////////////////////////////////////////////
19509
19510 function resetScanCache(self) {
19511   self.__index__ = -1;
19512   self.__text_cache__   = '';
19513 }
19514
19515 function createValidator(re) {
19516   return function (text, pos) {
19517     var tail = text.slice(pos);
19518
19519     if (re.test(tail)) {
19520       return tail.match(re)[0].length;
19521     }
19522     return 0;
19523   };
19524 }
19525
19526 function createNormalizer() {
19527   return function (match, self) {
19528     self.normalize(match);
19529   };
19530 }
19531
19532 // Schemas compiler. Build regexps.
19533 //
19534 function compile(self) {
19535
19536   // Load & clone RE patterns.
19537   var re = self.re = __webpack_require__(102)(self.__opts__);
19538
19539   // Define dynamic patterns
19540   var tlds = self.__tlds__.slice();
19541
19542   self.onCompile();
19543
19544   if (!self.__tlds_replaced__) {
19545     tlds.push(tlds_2ch_src_re);
19546   }
19547   tlds.push(re.src_xn);
19548
19549   re.src_tlds = tlds.join('|');
19550
19551   function untpl(tpl) { return tpl.replace('%TLDS%', re.src_tlds); }
19552
19553   re.email_fuzzy      = RegExp(untpl(re.tpl_email_fuzzy), 'i');
19554   re.link_fuzzy       = RegExp(untpl(re.tpl_link_fuzzy), 'i');
19555   re.link_no_ip_fuzzy = RegExp(untpl(re.tpl_link_no_ip_fuzzy), 'i');
19556   re.host_fuzzy_test  = RegExp(untpl(re.tpl_host_fuzzy_test), 'i');
19557
19558   //
19559   // Compile each schema
19560   //
19561
19562   var aliases = [];
19563
19564   self.__compiled__ = {}; // Reset compiled data
19565
19566   function schemaError(name, val) {
19567     throw new Error('(LinkifyIt) Invalid schema "' + name + '": ' + val);
19568   }
19569
19570   Object.keys(self.__schemas__).forEach(function (name) {
19571     var val = self.__schemas__[name];
19572
19573     // skip disabled methods
19574     if (val === null) { return; }
19575
19576     var compiled = { validate: null, link: null };
19577
19578     self.__compiled__[name] = compiled;
19579
19580     if (isObject(val)) {
19581       if (isRegExp(val.validate)) {
19582         compiled.validate = createValidator(val.validate);
19583       } else if (isFunction(val.validate)) {
19584         compiled.validate = val.validate;
19585       } else {
19586         schemaError(name, val);
19587       }
19588
19589       if (isFunction(val.normalize)) {
19590         compiled.normalize = val.normalize;
19591       } else if (!val.normalize) {
19592         compiled.normalize = createNormalizer();
19593       } else {
19594         schemaError(name, val);
19595       }
19596
19597       return;
19598     }
19599
19600     if (isString(val)) {
19601       aliases.push(name);
19602       return;
19603     }
19604
19605     schemaError(name, val);
19606   });
19607
19608   //
19609   // Compile postponed aliases
19610   //
19611
19612   aliases.forEach(function (alias) {
19613     if (!self.__compiled__[self.__schemas__[alias]]) {
19614       // Silently fail on missed schemas to avoid errons on disable.
19615       // schemaError(alias, self.__schemas__[alias]);
19616       return;
19617     }
19618
19619     self.__compiled__[alias].validate =
19620       self.__compiled__[self.__schemas__[alias]].validate;
19621     self.__compiled__[alias].normalize =
19622       self.__compiled__[self.__schemas__[alias]].normalize;
19623   });
19624
19625   //
19626   // Fake record for guessed links
19627   //
19628   self.__compiled__[''] = { validate: null, normalize: createNormalizer() };
19629
19630   //
19631   // Build schema condition
19632   //
19633   var slist = Object.keys(self.__compiled__)
19634                       .filter(function (name) {
19635                         // Filter disabled & fake schemas
19636                         return name.length > 0 && self.__compiled__[name];
19637                       })
19638                       .map(escapeRE)
19639                       .join('|');
19640   // (?!_) cause 1.5x slowdown
19641   self.re.schema_test   = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'i');
19642   self.re.schema_search = RegExp('(^|(?!_)(?:[><\uff5c]|' + re.src_ZPCc + '))(' + slist + ')', 'ig');
19643
19644   self.re.pretest = RegExp(
19645     '(' + self.re.schema_test.source + ')|(' + self.re.host_fuzzy_test.source + ')|@',
19646     'i'
19647   );
19648
19649   //
19650   // Cleanup
19651   //
19652
19653   resetScanCache(self);
19654 }
19655
19656 /**
19657  * class Match
19658  *
19659  * Match result. Single element of array, returned by [[LinkifyIt#match]]
19660  **/
19661 function Match(self, shift) {
19662   var start = self.__index__,
19663       end   = self.__last_index__,
19664       text  = self.__text_cache__.slice(start, end);
19665
19666   /**
19667    * Match#schema -> String
19668    *
19669    * Prefix (protocol) for matched string.
19670    **/
19671   this.schema    = self.__schema__.toLowerCase();
19672   /**
19673    * Match#index -> Number
19674    *
19675    * First position of matched string.
19676    **/
19677   this.index     = start + shift;
19678   /**
19679    * Match#lastIndex -> Number
19680    *
19681    * Next position after matched string.
19682    **/
19683   this.lastIndex = end + shift;
19684   /**
19685    * Match#raw -> String
19686    *
19687    * Matched string.
19688    **/
19689   this.raw       = text;
19690   /**
19691    * Match#text -> String
19692    *
19693    * Notmalized text of matched string.
19694    **/
19695   this.text      = text;
19696   /**
19697    * Match#url -> String
19698    *
19699    * Normalized url of matched string.
19700    **/
19701   this.url       = text;
19702 }
19703
19704 function createMatch(self, shift) {
19705   var match = new Match(self, shift);
19706
19707   self.__compiled__[match.schema].normalize(match, self);
19708
19709   return match;
19710 }
19711
19712
19713 /**
19714  * class LinkifyIt
19715  **/
19716
19717 /**
19718  * new LinkifyIt(schemas, options)
19719  * - schemas (Object): Optional. Additional schemas to validate (prefix/validator)
19720  * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
19721  *
19722  * Creates new linkifier instance with optional additional schemas.
19723  * Can be called without `new` keyword for convenience.
19724  *
19725  * By default understands:
19726  *
19727  * - `http(s)://...` , `ftp://...`, `mailto:...` & `//...` links
19728  * - "fuzzy" links and emails (example.com, foo@bar.com).
19729  *
19730  * `schemas` is an object, where each key/value describes protocol/rule:
19731  *
19732  * - __key__ - link prefix (usually, protocol name with `:` at the end, `skype:`
19733  *   for example). `linkify-it` makes shure that prefix is not preceeded with
19734  *   alphanumeric char and symbols. Only whitespaces and punctuation allowed.
19735  * - __value__ - rule to check tail after link prefix
19736  *   - _String_ - just alias to existing rule
19737  *   - _Object_
19738  *     - _validate_ - validator function (should return matched length on success),
19739  *       or `RegExp`.
19740  *     - _normalize_ - optional function to normalize text & url of matched result
19741  *       (for example, for @twitter mentions).
19742  *
19743  * `options`:
19744  *
19745  * - __fuzzyLink__ - recognige URL-s without `http(s):` prefix. Default `true`.
19746  * - __fuzzyIP__ - allow IPs in fuzzy links above. Can conflict with some texts
19747  *   like version numbers. Default `false`.
19748  * - __fuzzyEmail__ - recognize emails without `mailto:` prefix.
19749  *
19750  **/
19751 function LinkifyIt(schemas, options) {
19752   if (!(this instanceof LinkifyIt)) {
19753     return new LinkifyIt(schemas, options);
19754   }
19755
19756   if (!options) {
19757     if (isOptionsObj(schemas)) {
19758       options = schemas;
19759       schemas = {};
19760     }
19761   }
19762
19763   this.__opts__           = assign({}, defaultOptions, options);
19764
19765   // Cache last tested result. Used to skip repeating steps on next `match` call.
19766   this.__index__          = -1;
19767   this.__last_index__     = -1; // Next scan position
19768   this.__schema__         = '';
19769   this.__text_cache__     = '';
19770
19771   this.__schemas__        = assign({}, defaultSchemas, schemas);
19772   this.__compiled__       = {};
19773
19774   this.__tlds__           = tlds_default;
19775   this.__tlds_replaced__  = false;
19776
19777   this.re = {};
19778
19779   compile(this);
19780 }
19781
19782
19783 /** chainable
19784  * LinkifyIt#add(schema, definition)
19785  * - schema (String): rule name (fixed pattern prefix)
19786  * - definition (String|RegExp|Object): schema definition
19787  *
19788  * Add new rule definition. See constructor description for details.
19789  **/
19790 LinkifyIt.prototype.add = function add(schema, definition) {
19791   this.__schemas__[schema] = definition;
19792   compile(this);
19793   return this;
19794 };
19795
19796
19797 /** chainable
19798  * LinkifyIt#set(options)
19799  * - options (Object): { fuzzyLink|fuzzyEmail|fuzzyIP: true|false }
19800  *
19801  * Set recognition options for links without schema.
19802  **/
19803 LinkifyIt.prototype.set = function set(options) {
19804   this.__opts__ = assign(this.__opts__, options);
19805   return this;
19806 };
19807
19808
19809 /**
19810  * LinkifyIt#test(text) -> Boolean
19811  *
19812  * Searches linkifiable pattern and returns `true` on success or `false` on fail.
19813  **/
19814 LinkifyIt.prototype.test = function test(text) {
19815   // Reset scan cache
19816   this.__text_cache__ = text;
19817   this.__index__      = -1;
19818
19819   if (!text.length) { return false; }
19820
19821   var m, ml, me, len, shift, next, re, tld_pos, at_pos;
19822
19823   // try to scan for link with schema - that's the most simple rule
19824   if (this.re.schema_test.test(text)) {
19825     re = this.re.schema_search;
19826     re.lastIndex = 0;
19827     while ((m = re.exec(text)) !== null) {
19828       len = this.testSchemaAt(text, m[2], re.lastIndex);
19829       if (len) {
19830         this.__schema__     = m[2];
19831         this.__index__      = m.index + m[1].length;
19832         this.__last_index__ = m.index + m[0].length + len;
19833         break;
19834       }
19835     }
19836   }
19837
19838   if (this.__opts__.fuzzyLink && this.__compiled__['http:']) {
19839     // guess schemaless links
19840     tld_pos = text.search(this.re.host_fuzzy_test);
19841     if (tld_pos >= 0) {
19842       // if tld is located after found link - no need to check fuzzy pattern
19843       if (this.__index__ < 0 || tld_pos < this.__index__) {
19844         if ((ml = text.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) !== null) {
19845
19846           shift = ml.index + ml[1].length;
19847
19848           if (this.__index__ < 0 || shift < this.__index__) {
19849             this.__schema__     = '';
19850             this.__index__      = shift;
19851             this.__last_index__ = ml.index + ml[0].length;
19852           }
19853         }
19854       }
19855     }
19856   }
19857
19858   if (this.__opts__.fuzzyEmail && this.__compiled__['mailto:']) {
19859     // guess schemaless emails
19860     at_pos = text.indexOf('@');
19861     if (at_pos >= 0) {
19862       // We can't skip this check, because this cases are possible:
19863       // 192.168.1.1@gmail.com, my.in@example.com
19864       if ((me = text.match(this.re.email_fuzzy)) !== null) {
19865
19866         shift = me.index + me[1].length;
19867         next  = me.index + me[0].length;
19868
19869         if (this.__index__ < 0 || shift < this.__index__ ||
19870             (shift === this.__index__ && next > this.__last_index__)) {
19871           this.__schema__     = 'mailto:';
19872           this.__index__      = shift;
19873           this.__last_index__ = next;
19874         }
19875       }
19876     }
19877   }
19878
19879   return this.__index__ >= 0;
19880 };
19881
19882
19883 /**
19884  * LinkifyIt#pretest(text) -> Boolean
19885  *
19886  * Very quick check, that can give false positives. Returns true if link MAY BE
19887  * can exists. Can be used for speed optimization, when you need to check that
19888  * link NOT exists.
19889  **/
19890 LinkifyIt.prototype.pretest = function pretest(text) {
19891   return this.re.pretest.test(text);
19892 };
19893
19894
19895 /**
19896  * LinkifyIt#testSchemaAt(text, name, position) -> Number
19897  * - text (String): text to scan
19898  * - name (String): rule (schema) name
19899  * - position (Number): text offset to check from
19900  *
19901  * Similar to [[LinkifyIt#test]] but checks only specific protocol tail exactly
19902  * at given position. Returns length of found pattern (0 on fail).
19903  **/
19904 LinkifyIt.prototype.testSchemaAt = function testSchemaAt(text, schema, pos) {
19905   // If not supported schema check requested - terminate
19906   if (!this.__compiled__[schema.toLowerCase()]) {
19907     return 0;
19908   }
19909   return this.__compiled__[schema.toLowerCase()].validate(text, pos, this);
19910 };
19911
19912
19913 /**
19914  * LinkifyIt#match(text) -> Array|null
19915  *
19916  * Returns array of found link descriptions or `null` on fail. We strongly
19917  * recommend to use [[LinkifyIt#test]] first, for best speed.
19918  *
19919  * ##### Result match description
19920  *
19921  * - __schema__ - link schema, can be empty for fuzzy links, or `//` for
19922  *   protocol-neutral  links.
19923  * - __index__ - offset of matched text
19924  * - __lastIndex__ - index of next char after mathch end
19925  * - __raw__ - matched text
19926  * - __text__ - normalized text
19927  * - __url__ - link, generated from matched text
19928  **/
19929 LinkifyIt.prototype.match = function match(text) {
19930   var shift = 0, result = [];
19931
19932   // Try to take previous element from cache, if .test() called before
19933   if (this.__index__ >= 0 && this.__text_cache__ === text) {
19934     result.push(createMatch(this, shift));
19935     shift = this.__last_index__;
19936   }
19937
19938   // Cut head if cache was used
19939   var tail = shift ? text.slice(shift) : text;
19940
19941   // Scan string until end reached
19942   while (this.test(tail)) {
19943     result.push(createMatch(this, shift));
19944
19945     tail = tail.slice(this.__last_index__);
19946     shift += this.__last_index__;
19947   }
19948
19949   if (result.length) {
19950     return result;
19951   }
19952
19953   return null;
19954 };
19955
19956
19957 /** chainable
19958  * LinkifyIt#tlds(list [, keepOld]) -> this
19959  * - list (Array): list of tlds
19960  * - keepOld (Boolean): merge with current list if `true` (`false` by default)
19961  *
19962  * Load (or merge) new tlds list. Those are user for fuzzy links (without prefix)
19963  * to avoid false positives. By default this algorythm used:
19964  *
19965  * - hostname with any 2-letter root zones are ok.
19966  * - biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф
19967  *   are ok.
19968  * - encoded (`xn--...`) root zones are ok.
19969  *
19970  * If list is replaced, then exact match for 2-chars root zones will be checked.
19971  **/
19972 LinkifyIt.prototype.tlds = function tlds(list, keepOld) {
19973   list = Array.isArray(list) ? list : [ list ];
19974
19975   if (!keepOld) {
19976     this.__tlds__ = list.slice();
19977     this.__tlds_replaced__ = true;
19978     compile(this);
19979     return this;
19980   }
19981
19982   this.__tlds__ = this.__tlds__.concat(list)
19983                                   .sort()
19984                                   .filter(function (el, idx, arr) {
19985                                     return el !== arr[idx - 1];
19986                                   })
19987                                   .reverse();
19988
19989   compile(this);
19990   return this;
19991 };
19992
19993 /**
19994  * LinkifyIt#normalize(match)
19995  *
19996  * Default normalizer (if schema does not define it's own).
19997  **/
19998 LinkifyIt.prototype.normalize = function normalize(match) {
19999
20000   // Do minimal possible changes by default. Need to collect feedback prior
20001   // to move forward https://github.com/markdown-it/linkify-it/issues/1
20002
20003   if (!match.schema) { match.url = 'http://' + match.url; }
20004
20005   if (match.schema === 'mailto:' && !/^mailto:/i.test(match.url)) {
20006     match.url = 'mailto:' + match.url;
20007   }
20008 };
20009
20010
20011 /**
20012  * LinkifyIt#onCompile()
20013  *
20014  * Override to modify basic RegExp-s.
20015  **/
20016 LinkifyIt.prototype.onCompile = function onCompile() {
20017 };
20018
20019
20020 module.exports = LinkifyIt;
20021
20022
20023 /***/ }),
20024 /* 102 */
20025 /***/ (function(module, exports, __webpack_require__) {
20026
20027 "use strict";
20028
20029
20030
20031 module.exports = function (opts) {
20032   var re = {};
20033
20034   // Use direct extract instead of `regenerate` to reduse browserified size
20035   re.src_Any = __webpack_require__(52).source;
20036   re.src_Cc  = __webpack_require__(53).source;
20037   re.src_Z   = __webpack_require__(55).source;
20038   re.src_P   = __webpack_require__(45).source;
20039
20040   // \p{\Z\P\Cc\CF} (white spaces + control + format + punctuation)
20041   re.src_ZPCc = [ re.src_Z, re.src_P, re.src_Cc ].join('|');
20042
20043   // \p{\Z\Cc} (white spaces + control)
20044   re.src_ZCc = [ re.src_Z, re.src_Cc ].join('|');
20045
20046   // Experimental. List of chars, completely prohibited in links
20047   // because can separate it from other part of text
20048   var text_separators = '[><\uff5c]';
20049
20050   // All possible word characters (everything without punctuation, spaces & controls)
20051   // Defined via punctuation & spaces to save space
20052   // Should be something like \p{\L\N\S\M} (\w but without `_`)
20053   re.src_pseudo_letter       = '(?:(?!' + text_separators + '|' + re.src_ZPCc + ')' + re.src_Any + ')';
20054   // The same as abothe but without [0-9]
20055   // var src_pseudo_letter_non_d = '(?:(?![0-9]|' + src_ZPCc + ')' + src_Any + ')';
20056
20057   ////////////////////////////////////////////////////////////////////////////////
20058
20059   re.src_ip4 =
20060
20061     '(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
20062
20063   // Prohibit any of "@/[]()" in user/pass to avoid wrong domain fetch.
20064   re.src_auth    = '(?:(?:(?!' + re.src_ZCc + '|[@/\\[\\]()]).)+@)?';
20065
20066   re.src_port =
20067
20068     '(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?';
20069
20070   re.src_host_terminator =
20071
20072     '(?=$|' + text_separators + '|' + re.src_ZPCc + ')(?!-|_|:\\d|\\.-|\\.(?!$|' + re.src_ZPCc + '))';
20073
20074   re.src_path =
20075
20076     '(?:' +
20077       '[/?#]' +
20078         '(?:' +
20079           '(?!' + re.src_ZCc + '|' + text_separators + '|[()[\\]{}.,"\'?!\\-]).|' +
20080           '\\[(?:(?!' + re.src_ZCc + '|\\]).)*\\]|' +
20081           '\\((?:(?!' + re.src_ZCc + '|[)]).)*\\)|' +
20082           '\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
20083           '\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
20084           "\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
20085           "\\'(?=" + re.src_pseudo_letter + '|[-]).|' +  // allow `I'm_king` if no pair found
20086           '\\.{2,4}[a-zA-Z0-9%/]|' + // github has ... in commit range links,
20087                                      // google has .... in links (issue #66)
20088                                      // Restrict to
20089                                      // - english
20090                                      // - percent-encoded
20091                                      // - parts of file path
20092                                      // until more examples found.
20093           '\\.(?!' + re.src_ZCc + '|[.]).|' +
20094           (opts && opts['---'] ?
20095             '\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
20096             :
20097             '\\-+|'
20098           ) +
20099           '\\,(?!' + re.src_ZCc + ').|' +      // allow `,,,` in paths
20100           '\\!(?!' + re.src_ZCc + '|[!]).|' +
20101           '\\?(?!' + re.src_ZCc + '|[?]).' +
20102         ')+' +
20103       '|\\/' +
20104     ')?';
20105
20106   // Allow anything in markdown spec, forbid quote (") at the first position
20107   // because emails enclosed in quotes are far more common
20108   re.src_email_name =
20109
20110     '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*';
20111
20112   re.src_xn =
20113
20114     'xn--[a-z0-9\\-]{1,59}';
20115
20116   // More to read about domain names
20117   // http://serverfault.com/questions/638260/
20118
20119   re.src_domain_root =
20120
20121     // Allow letters & digits (http://test1)
20122     '(?:' +
20123       re.src_xn +
20124       '|' +
20125       re.src_pseudo_letter + '{1,63}' +
20126     ')';
20127
20128   re.src_domain =
20129
20130     '(?:' +
20131       re.src_xn +
20132       '|' +
20133       '(?:' + re.src_pseudo_letter + ')' +
20134       '|' +
20135       '(?:' + re.src_pseudo_letter + '(?:-|' + re.src_pseudo_letter + '){0,61}' + re.src_pseudo_letter + ')' +
20136     ')';
20137
20138   re.src_host =
20139
20140     '(?:' +
20141     // Don't need IP check, because digits are already allowed in normal domain names
20142     //   src_ip4 +
20143     // '|' +
20144       '(?:(?:(?:' + re.src_domain + ')\\.)*' + re.src_domain/*_root*/ + ')' +
20145     ')';
20146
20147   re.tpl_host_fuzzy =
20148
20149     '(?:' +
20150       re.src_ip4 +
20151     '|' +
20152       '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))' +
20153     ')';
20154
20155   re.tpl_host_no_ip_fuzzy =
20156
20157     '(?:(?:(?:' + re.src_domain + ')\\.)+(?:%TLDS%))';
20158
20159   re.src_host_strict =
20160
20161     re.src_host + re.src_host_terminator;
20162
20163   re.tpl_host_fuzzy_strict =
20164
20165     re.tpl_host_fuzzy + re.src_host_terminator;
20166
20167   re.src_host_port_strict =
20168
20169     re.src_host + re.src_port + re.src_host_terminator;
20170
20171   re.tpl_host_port_fuzzy_strict =
20172
20173     re.tpl_host_fuzzy + re.src_port + re.src_host_terminator;
20174
20175   re.tpl_host_port_no_ip_fuzzy_strict =
20176
20177     re.tpl_host_no_ip_fuzzy + re.src_port + re.src_host_terminator;
20178
20179
20180   ////////////////////////////////////////////////////////////////////////////////
20181   // Main rules
20182
20183   // Rude test fuzzy links by host, for quick deny
20184   re.tpl_host_fuzzy_test =
20185
20186     'localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:' + re.src_ZPCc + '|>|$))';
20187
20188   re.tpl_email_fuzzy =
20189
20190       '(^|' + text_separators + '|"|\\(|' + re.src_ZCc + ')' +
20191       '(' + re.src_email_name + '@' + re.tpl_host_fuzzy_strict + ')';
20192
20193   re.tpl_link_fuzzy =
20194       // Fuzzy link can't be prepended with .:/\- and non punctuation.
20195       // but can start with > (markdown blockquote)
20196       '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
20197       '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_fuzzy_strict + re.src_path + ')';
20198
20199   re.tpl_link_no_ip_fuzzy =
20200       // Fuzzy link can't be prepended with .:/\- and non punctuation.
20201       // but can start with > (markdown blockquote)
20202       '(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|' + re.src_ZPCc + '))' +
20203       '((?![$+<=>^`|\uff5c])' + re.tpl_host_port_no_ip_fuzzy_strict + re.src_path + ')';
20204
20205   return re;
20206 };
20207
20208
20209 /***/ }),
20210 /* 103 */
20211 /***/ (function(module, exports) {
20212
20213 module.exports = require("punycode");
20214
20215 /***/ }),
20216 /* 104 */
20217 /***/ (function(module, exports, __webpack_require__) {
20218
20219 "use strict";
20220 // markdown-it default options
20221
20222
20223
20224
20225 module.exports = {
20226   options: {
20227     html:         false,        // Enable HTML tags in source
20228     xhtmlOut:     false,        // Use '/' to close single tags (<br />)
20229     breaks:       false,        // Convert '\n' in paragraphs into <br>
20230     langPrefix:   'language-',  // CSS language prefix for fenced blocks
20231     linkify:      false,        // autoconvert URL-like texts to links
20232
20233     // Enable some language-neutral replacements + quotes beautification
20234     typographer:  false,
20235
20236     // Double + single quotes replacement pairs, when typographer enabled,
20237     // and smartquotes on. Could be either a String or an Array.
20238     //
20239     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
20240     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
20241     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
20242
20243     // Highlighter function. Should return escaped HTML,
20244     // or '' if the source string is not changed and should be escaped externaly.
20245     // If result starts with <pre... internal wrapper is skipped.
20246     //
20247     // function (/*str, lang*/) { return ''; }
20248     //
20249     highlight: null,
20250
20251     maxNesting:   100            // Internal protection, recursion limit
20252   },
20253
20254   components: {
20255
20256     core: {},
20257     block: {},
20258     inline: {}
20259   }
20260 };
20261
20262
20263 /***/ }),
20264 /* 105 */
20265 /***/ (function(module, exports, __webpack_require__) {
20266
20267 "use strict";
20268 // "Zero" preset, with nothing enabled. Useful for manual configuring of simple
20269 // modes. For example, to parse bold/italic only.
20270
20271
20272
20273
20274 module.exports = {
20275   options: {
20276     html:         false,        // Enable HTML tags in source
20277     xhtmlOut:     false,        // Use '/' to close single tags (<br />)
20278     breaks:       false,        // Convert '\n' in paragraphs into <br>
20279     langPrefix:   'language-',  // CSS language prefix for fenced blocks
20280     linkify:      false,        // autoconvert URL-like texts to links
20281
20282     // Enable some language-neutral replacements + quotes beautification
20283     typographer:  false,
20284
20285     // Double + single quotes replacement pairs, when typographer enabled,
20286     // and smartquotes on. Could be either a String or an Array.
20287     //
20288     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
20289     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
20290     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
20291
20292     // Highlighter function. Should return escaped HTML,
20293     // or '' if the source string is not changed and should be escaped externaly.
20294     // If result starts with <pre... internal wrapper is skipped.
20295     //
20296     // function (/*str, lang*/) { return ''; }
20297     //
20298     highlight: null,
20299
20300     maxNesting:   20            // Internal protection, recursion limit
20301   },
20302
20303   components: {
20304
20305     core: {
20306       rules: [
20307         'normalize',
20308         'block',
20309         'inline'
20310       ]
20311     },
20312
20313     block: {
20314       rules: [
20315         'paragraph'
20316       ]
20317     },
20318
20319     inline: {
20320       rules: [
20321         'text'
20322       ],
20323       rules2: [
20324         'balance_pairs',
20325         'text_collapse'
20326       ]
20327     }
20328   }
20329 };
20330
20331
20332 /***/ }),
20333 /* 106 */
20334 /***/ (function(module, exports, __webpack_require__) {
20335
20336 "use strict";
20337 // Commonmark default options
20338
20339
20340
20341
20342 module.exports = {
20343   options: {
20344     html:         true,         // Enable HTML tags in source
20345     xhtmlOut:     true,         // Use '/' to close single tags (<br />)
20346     breaks:       false,        // Convert '\n' in paragraphs into <br>
20347     langPrefix:   'language-',  // CSS language prefix for fenced blocks
20348     linkify:      false,        // autoconvert URL-like texts to links
20349
20350     // Enable some language-neutral replacements + quotes beautification
20351     typographer:  false,
20352
20353     // Double + single quotes replacement pairs, when typographer enabled,
20354     // and smartquotes on. Could be either a String or an Array.
20355     //
20356     // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
20357     // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
20358     quotes: '\u201c\u201d\u2018\u2019', /* “”‘’ */
20359
20360     // Highlighter function. Should return escaped HTML,
20361     // or '' if the source string is not changed and should be escaped externaly.
20362     // If result starts with <pre... internal wrapper is skipped.
20363     //
20364     // function (/*str, lang*/) { return ''; }
20365     //
20366     highlight: null,
20367
20368     maxNesting:   20            // Internal protection, recursion limit
20369   },
20370
20371   components: {
20372
20373     core: {
20374       rules: [
20375         'normalize',
20376         'block',
20377         'inline'
20378       ]
20379     },
20380
20381     block: {
20382       rules: [
20383         'blockquote',
20384         'code',
20385         'fence',
20386         'heading',
20387         'hr',
20388         'html_block',
20389         'lheading',
20390         'list',
20391         'reference',
20392         'paragraph'
20393       ]
20394     },
20395
20396     inline: {
20397       rules: [
20398         'autolink',
20399         'backticks',
20400         'emphasis',
20401         'entity',
20402         'escape',
20403         'html_inline',
20404         'image',
20405         'link',
20406         'newline',
20407         'text'
20408       ],
20409       rules2: [
20410         'balance_pairs',
20411         'emphasis',
20412         'text_collapse'
20413       ]
20414     }
20415   }
20416 };
20417
20418
20419 /***/ }),
20420 /* 107 */
20421 /***/ (function(module, exports, __webpack_require__) {
20422
20423 "use strict";
20424 // @ts-check
20425
20426
20427
20428 const { URL } = __webpack_require__(39);
20429 const packageJson = __webpack_require__(108);
20430 const homepage = packageJson.homepage;
20431 const version = packageJson.version;
20432
20433 const rules = [
20434   __webpack_require__(109),
20435   __webpack_require__(112),
20436   __webpack_require__(113),
20437   __webpack_require__(114),
20438   __webpack_require__(116),
20439   __webpack_require__(117),
20440   __webpack_require__(118),
20441   __webpack_require__(119),
20442   __webpack_require__(120),
20443   __webpack_require__(121),
20444   __webpack_require__(122),
20445   __webpack_require__(123),
20446   __webpack_require__(124),
20447   __webpack_require__(125),
20448   __webpack_require__(126),
20449   __webpack_require__(127),
20450   __webpack_require__(128),
20451   __webpack_require__(129),
20452   __webpack_require__(130),
20453   __webpack_require__(131),
20454   __webpack_require__(132),
20455   __webpack_require__(133),
20456   __webpack_require__(134),
20457   __webpack_require__(135),
20458   __webpack_require__(136),
20459   __webpack_require__(137),
20460   __webpack_require__(138),
20461   __webpack_require__(139),
20462   __webpack_require__(140),
20463   __webpack_require__(141),
20464   __webpack_require__(142),
20465   __webpack_require__(143),
20466   __webpack_require__(144),
20467   __webpack_require__(145),
20468   __webpack_require__(146),
20469   __webpack_require__(147),
20470   __webpack_require__(148),
20471   __webpack_require__(149),
20472   __webpack_require__(150),
20473   __webpack_require__(151),
20474   __webpack_require__(152),
20475   __webpack_require__(153),
20476   __webpack_require__(154),
20477   __webpack_require__(155)
20478 ];
20479 rules.forEach((rule) => {
20480   const name = rule.names[0].toLowerCase();
20481   rule.information =
20482     new URL(`${homepage}/blob/v${version}/doc/Rules.md#${name}`);
20483 });
20484 module.exports = rules;
20485
20486
20487 /***/ }),
20488 /* 108 */
20489 /***/ (function(module) {
20490
20491 module.exports = JSON.parse("{\"name\":\"markdownlint\",\"version\":\"0.20.4\",\"description\":\"A Node.js style checker and lint tool for Markdown/CommonMark files.\",\"main\":\"lib/markdownlint.js\",\"types\":\"lib/markdownlint.d.ts\",\"author\":\"David Anson (https://dlaa.me/)\",\"license\":\"MIT\",\"homepage\":\"https://github.com/DavidAnson/markdownlint\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/DavidAnson/markdownlint.git\"},\"bugs\":\"https://github.com/DavidAnson/markdownlint/issues\",\"scripts\":{\"test\":\"node test/markdownlint-test.js\",\"test-cover\":\"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 node test/markdownlint-test.js\",\"test-declaration\":\"cd example/typescript && tsc && node type-check.js\",\"test-extra\":\"node test/markdownlint-test-extra.js\",\"debug\":\"node debug node_modules/nodeunit/bin/nodeunit\",\"lint\":\"eslint --max-warnings 0 lib helpers test schema && eslint --env browser --global markdownit --global markdownlint --rule \\\"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0\\\" demo && eslint --rule \\\"no-console: 0, no-invalid-this: 0, no-shadow: 0, object-property-newline: 0\\\" example\",\"ci\":\"npm run test-cover && npm run lint && npm run test-declaration\",\"build-config-schema\":\"node schema/build-config-schema.js\",\"build-declaration\":\"tsc --allowJs --declaration --outDir declaration --resolveJsonModule lib/markdownlint.js && cpy declaration/lib/markdownlint.d.ts lib && rimraf declaration\",\"build-demo\":\"cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && cpy file-header.js . --rename=markdownlint-browser.js && tsc --allowJs --resolveJsonModule --outDir ../lib-es3 ../lib/markdownlint.js && cpy ../helpers/package.json ../lib-es3/helpers && browserify ../lib-es3/lib/markdownlint.js --standalone markdownlint >> markdownlint-browser.js && uglifyjs markdownlint-browser.js --compress --mangle --comments --output markdownlint-browser.min.js\",\"build-example\":\"npm install --no-save --ignore-scripts grunt grunt-cli gulp through2\",\"example\":\"cd example && node standalone.js && grunt markdownlint --force && gulp markdownlint\",\"clone-test-repos\":\"make-dir test-repos && cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet && git clone https://github.com/pi-hole/docs pi-hole-docs --depth 1 --no-tags --quiet\",\"clone-test-repos-large\":\"npm run clone-test-repos && cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet\",\"lint-test-repos\":\"node test/markdownlint-test-repos.js\",\"clean-test-repos\":\"rimraf test-repos\"},\"engines\":{\"node\":\">=10\"},\"dependencies\":{\"markdown-it\":\"10.0.0\"},\"devDependencies\":{\"@types/node\":\"~13.11.1\",\"browserify\":\"~16.5.1\",\"c8\":\"~7.1.2\",\"cpy-cli\":\"~3.1.0\",\"eslint\":\"~6.8.0\",\"eslint-plugin-jsdoc\":\"~22.1.0\",\"globby\":\"~11.0.0\",\"js-yaml\":\"~3.13.1\",\"make-dir-cli\":\"~2.0.0\",\"markdown-it-for-inline\":\"~0.1.1\",\"markdown-it-katex\":\"~2.0.3\",\"markdown-it-sub\":\"~1.0.0\",\"markdown-it-sup\":\"~1.0.0\",\"markdownlint-rule-helpers\":\"~0.7.0\",\"rimraf\":\"~3.0.2\",\"strip-json-comments\":\"~3.1.0\",\"tape\":\"~4.13.2\",\"tape-player\":\"~0.1.0\",\"toml\":\"~3.0.0\",\"tv4\":\"~1.3.0\",\"typescript\":\"~3.8.3\",\"uglify-js\":\"~3.8.1\"},\"keywords\":[\"markdown\",\"lint\",\"md\",\"CommonMark\",\"markdownlint\"],\"browser\":{\"markdown-it\":\"../demo/markdown-it-stub.js\"}}");
20492
20493 /***/ }),
20494 /* 109 */
20495 /***/ (function(module, exports, __webpack_require__) {
20496
20497 "use strict";
20498 // @ts-check
20499
20500
20501
20502 const { addErrorDetailIf, filterTokens } = __webpack_require__(110);
20503
20504 module.exports = {
20505   "names": [ "MD001", "heading-increment", "header-increment" ],
20506   "description": "Heading levels should only increment by one level at a time",
20507   "tags": [ "headings", "headers" ],
20508   "function": function MD001(params, onError) {
20509     let prevLevel = 0;
20510     filterTokens(params, "heading_open", function forToken(token) {
20511       const level = parseInt(token.tag.slice(1), 10);
20512       if (prevLevel && (level > prevLevel)) {
20513         addErrorDetailIf(onError, token.lineNumber,
20514           "h" + (prevLevel + 1), "h" + level);
20515       }
20516       prevLevel = level;
20517     });
20518   }
20519 };
20520
20521
20522 /***/ }),
20523 /* 110 */
20524 /***/ (function(module, exports, __webpack_require__) {
20525
20526 "use strict";
20527 // @ts-check
20528
20529
20530
20531 const os = __webpack_require__(111);
20532
20533 // Regular expression for matching common newline characters
20534 // See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js
20535 const newLineRe = /\r\n?|\n/g;
20536 module.exports.newLineRe = newLineRe;
20537
20538 // Regular expression for matching common front matter (YAML and TOML)
20539 module.exports.frontMatterRe =
20540   // eslint-disable-next-line max-len
20541   /((^---\s*$[^]*?^---\s*$)|(^\+\+\+\s*$[^]*?^(\+\+\+|\.\.\.)\s*$))(\r\n|\r|\n|$)/m;
20542
20543 // Regular expression for matching inline disable/enable comments
20544 const inlineCommentRe =
20545   // eslint-disable-next-line max-len
20546   /<!--\s*markdownlint-(?:(?:(disable|enable|capture|restore|disable-file|enable-file)((?:\s+[a-z0-9_-]+)*))|(?:(configure-file)\s+([\s\S]*?)))\s*-->/ig;
20547 module.exports.inlineCommentRe = inlineCommentRe;
20548
20549 // Regular expressions for range matching
20550 module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
20551 module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
20552 module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
20553
20554 // Regular expression for all instances of emphasis markers
20555 const emphasisMarkersRe = /[_*]/g;
20556
20557 // Regular expression for inline links and shortcut reference links
20558 const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g;
20559
20560 // readFile options for reading with the UTF-8 encoding
20561 module.exports.utf8Encoding = { "encoding": "utf8" };
20562
20563 // All punctuation characters (normal and full-width)
20564 module.exports.allPunctuation = ".,;:!?。,;:!?";
20565
20566 // Returns true iff the input is a number
20567 module.exports.isNumber = function isNumber(obj) {
20568   return typeof obj === "number";
20569 };
20570
20571 // Returns true iff the input is a string
20572 module.exports.isString = function isString(obj) {
20573   return typeof obj === "string";
20574 };
20575
20576 // Returns true iff the input string is empty
20577 module.exports.isEmptyString = function isEmptyString(str) {
20578   return str.length === 0;
20579 };
20580
20581 // Returns true iff the input is an object
20582 module.exports.isObject = function isObject(obj) {
20583   return (obj !== null) && (typeof obj === "object") && !Array.isArray(obj);
20584 };
20585
20586 // Returns true iff the input line is blank (no content)
20587 // Example: Contains nothing, whitespace, or comments
20588 const blankLineRe = />|(?:<!--.*?-->)/g;
20589 module.exports.isBlankLine = function isBlankLine(line) {
20590   return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
20591 };
20592
20593 /**
20594  * Compare function for Array.prototype.sort for ascending order of numbers.
20595  *
20596  * @param {number} a First number.
20597  * @param {number} b Second number.
20598  * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
20599  */
20600 module.exports.numericSortAscending = function numericSortAscending(a, b) {
20601   return a - b;
20602 };
20603
20604 // Returns true iff the sorted array contains the specified element
20605 module.exports.includesSorted = function includesSorted(array, element) {
20606   let left = 0;
20607   let right = array.length - 1;
20608   while (left <= right) {
20609     /* eslint-disable no-bitwise */
20610     const mid = (left + right) >> 1;
20611     if (array[mid] < element) {
20612       left = mid + 1;
20613     } else if (array[mid] > element) {
20614       right = mid - 1;
20615     } else {
20616       return true;
20617     }
20618   }
20619   return false;
20620 };
20621
20622 // Replaces the text of all properly-formatted HTML comments with whitespace
20623 // This preserves the line/column information for the rest of the document
20624 // Trailing whitespace is avoided with a '\' character in the last column
20625 // See https://www.w3.org/TR/html5/syntax.html#comments for details
20626 const htmlCommentBegin = "<!--";
20627 const htmlCommentEnd = "-->";
20628 module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
20629   let i = 0;
20630   while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
20631     const j = text.indexOf(htmlCommentEnd, i);
20632     if (j === -1) {
20633       // Un-terminated comments are treated as text
20634       break;
20635     }
20636     const comment = text.slice(i + htmlCommentBegin.length, j);
20637     if ((comment.length > 0) &&
20638         (comment[0] !== ">") &&
20639         (comment[comment.length - 1] !== "-") &&
20640         !comment.includes("--") &&
20641         (text.slice(i, j + htmlCommentEnd.length)
20642           .search(inlineCommentRe) === -1)) {
20643       const blanks = comment
20644         .replace(/[^\r\n]/g, " ")
20645         .replace(/ ([\r\n])/g, "\\$1");
20646       text = text.slice(0, i + htmlCommentBegin.length) +
20647         blanks + text.slice(j);
20648     }
20649     i = j + htmlCommentEnd.length;
20650   }
20651   return text;
20652 };
20653
20654 // Escapes a string for use in a RegExp
20655 module.exports.escapeForRegExp = function escapeForRegExp(str) {
20656   return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
20657 };
20658
20659 // Un-escapes Markdown content (simple algorithm; not a parser)
20660 const escapedMarkdownRe = /\\./g;
20661 module.exports.unescapeMarkdown =
20662   function unescapeMarkdown(markdown, replacement) {
20663     return markdown.replace(escapedMarkdownRe, (match) => {
20664       const char = match[1];
20665       if ("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".includes(char)) {
20666         return replacement || char;
20667       }
20668       return match;
20669     });
20670   };
20671
20672 /**
20673  * Return the string representation of a fence markup character.
20674  *
20675  * @param {string} markup Fence string.
20676  * @returns {string} String representation.
20677  */
20678 module.exports.fencedCodeBlockStyleFor =
20679   function fencedCodeBlockStyleFor(markup) {
20680     switch (markup[0]) {
20681       case "~":
20682         return "tilde";
20683       default:
20684         return "backtick";
20685     }
20686   };
20687
20688 /**
20689  * Return the number of characters of indent for a token.
20690  *
20691  * @param {Object} token MarkdownItToken instance.
20692  * @returns {number} Characters of indent.
20693  */
20694 function indentFor(token) {
20695   const line = token.line.replace(/^[\s>]*(> |>)/, "");
20696   return line.length - line.trimLeft().length;
20697 }
20698 module.exports.indentFor = indentFor;
20699
20700 // Returns the heading style for a heading token
20701 module.exports.headingStyleFor = function headingStyleFor(token) {
20702   if ((token.map[1] - token.map[0]) === 1) {
20703     if (/[^\\]#\s*$/.test(token.line)) {
20704       return "atx_closed";
20705     }
20706     return "atx";
20707   }
20708   return "setext";
20709 };
20710
20711 /**
20712  * Return the string representation of an unordered list marker.
20713  *
20714  * @param {Object} token MarkdownItToken instance.
20715  * @returns {string} String representation.
20716  */
20717 module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
20718   switch (token.markup) {
20719     case "-":
20720       return "dash";
20721     case "+":
20722       return "plus";
20723     // case "*":
20724     default:
20725       return "asterisk";
20726   }
20727 };
20728
20729 /**
20730  * Calls the provided function for each matching token.
20731  *
20732  * @param {Object} params RuleParams instance.
20733  * @param {string} type Token type identifier.
20734  * @param {Function} handler Callback function.
20735  * @returns {void}
20736  */
20737 function filterTokens(params, type, handler) {
20738   params.tokens.forEach(function forToken(token) {
20739     if (token.type === type) {
20740       handler(token);
20741     }
20742   });
20743 }
20744 module.exports.filterTokens = filterTokens;
20745
20746 // Get line metadata array
20747 module.exports.getLineMetadata = function getLineMetadata(params) {
20748   const lineMetadata = params.lines.map(function mapLine(line, index) {
20749     return [ line, index, false, 0, false, false ];
20750   });
20751   filterTokens(params, "fence", function forToken(token) {
20752     lineMetadata[token.map[0]][3] = 1;
20753     lineMetadata[token.map[1] - 1][3] = -1;
20754     for (let i = token.map[0] + 1; i < token.map[1] - 1; i++) {
20755       lineMetadata[i][2] = true;
20756     }
20757   });
20758   filterTokens(params, "code_block", function forToken(token) {
20759     for (let i = token.map[0]; i < token.map[1]; i++) {
20760       lineMetadata[i][2] = true;
20761     }
20762   });
20763   filterTokens(params, "table_open", function forToken(token) {
20764     for (let i = token.map[0]; i < token.map[1]; i++) {
20765       lineMetadata[i][4] = true;
20766     }
20767   });
20768   filterTokens(params, "list_item_open", function forToken(token) {
20769     let count = 1;
20770     for (let i = token.map[0]; i < token.map[1]; i++) {
20771       lineMetadata[i][5] = count;
20772       count++;
20773     }
20774   });
20775   filterTokens(params, "hr", function forToken(token) {
20776     lineMetadata[token.map[0]][6] = true;
20777   });
20778   return lineMetadata;
20779 };
20780
20781 // Calls the provided function for each line (with context)
20782 module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
20783   lineMetadata.forEach(function forMetadata(metadata) {
20784     // Parameters: line, lineIndex, inCode, onFence, inTable, inItem, inBreak
20785     handler(...metadata);
20786   });
20787 };
20788
20789 // Returns (nested) lists as a flat array (in order)
20790 module.exports.flattenLists = function flattenLists(params) {
20791   const flattenedLists = [];
20792   const stack = [];
20793   let current = null;
20794   let nesting = 0;
20795   const nestingStack = [];
20796   let lastWithMap = { "map": [ 0, 1 ] };
20797   params.tokens.forEach(function forToken(token) {
20798     if ((token.type === "bullet_list_open") ||
20799         (token.type === "ordered_list_open")) {
20800       // Save current context and start a new one
20801       stack.push(current);
20802       current = {
20803         "unordered": (token.type === "bullet_list_open"),
20804         "parentsUnordered": !current ||
20805           (current.unordered && current.parentsUnordered),
20806         "open": token,
20807         "indent": indentFor(token),
20808         "parentIndent": (current && current.indent) || 0,
20809         "items": [],
20810         "nesting": nesting,
20811         "lastLineIndex": -1,
20812         "insert": flattenedLists.length
20813       };
20814       nesting++;
20815     } else if ((token.type === "bullet_list_close") ||
20816                (token.type === "ordered_list_close")) {
20817       // Finalize current context and restore previous
20818       current.lastLineIndex = lastWithMap.map[1];
20819       flattenedLists.splice(current.insert, 0, current);
20820       delete current.insert;
20821       current = stack.pop();
20822       nesting--;
20823     } else if (token.type === "list_item_open") {
20824       // Add list item
20825       current.items.push(token);
20826     } else if (token.type === "blockquote_open") {
20827       nestingStack.push(nesting);
20828       nesting = 0;
20829     } else if (token.type === "blockquote_close") {
20830       nesting = nestingStack.pop();
20831     } else if (token.map) {
20832       // Track last token with map
20833       lastWithMap = token;
20834     }
20835   });
20836   return flattenedLists;
20837 };
20838
20839 // Calls the provided function for each specified inline child token
20840 module.exports.forEachInlineChild =
20841 function forEachInlineChild(params, type, handler) {
20842   filterTokens(params, "inline", function forToken(token) {
20843     token.children.forEach(function forChild(child) {
20844       if (child.type === type) {
20845         handler(child, token);
20846       }
20847     });
20848   });
20849 };
20850
20851 // Calls the provided function for each heading's content
20852 module.exports.forEachHeading = function forEachHeading(params, handler) {
20853   let heading = null;
20854   params.tokens.forEach(function forToken(token) {
20855     if (token.type === "heading_open") {
20856       heading = token;
20857     } else if (token.type === "heading_close") {
20858       heading = null;
20859     } else if ((token.type === "inline") && heading) {
20860       handler(heading, token.content);
20861     }
20862   });
20863 };
20864
20865 /**
20866  * Calls the provided function for each inline code span's content.
20867  *
20868  * @param {string} input Markdown content.
20869  * @param {Function} handler Callback function.
20870  * @returns {void}
20871  */
20872 function forEachInlineCodeSpan(input, handler) {
20873   let currentLine = 0;
20874   let currentColumn = 0;
20875   let index = 0;
20876   while (index < input.length) {
20877     let startIndex = -1;
20878     let startLine = -1;
20879     let startColumn = -1;
20880     let tickCount = 0;
20881     let currentTicks = 0;
20882     let state = "normal";
20883     // Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
20884     for (; index <= input.length; index++) {
20885       const char = input[index];
20886       // Ignore backticks in link destination
20887       if ((char === "[") && (state === "normal")) {
20888         state = "linkTextOpen";
20889       } else if ((char === "]") && (state === "linkTextOpen")) {
20890         state = "linkTextClosed";
20891       } else if ((char === "(") && (state === "linkTextClosed")) {
20892         state = "linkDestinationOpen";
20893       } else if (
20894         ((char === "(") && (state === "linkDestinationOpen")) ||
20895         ((char === ")") && (state === "linkDestinationOpen")) ||
20896         (state === "linkTextClosed")) {
20897         state = "normal";
20898       }
20899       // Parse backtick open/close
20900       if ((char === "`") && (state !== "linkDestinationOpen")) {
20901         // Count backticks at start or end of code span
20902         currentTicks++;
20903         if ((startIndex === -1) || (startColumn === -1)) {
20904           startIndex = index + 1;
20905         }
20906       } else {
20907         if ((startIndex >= 0) &&
20908           (startColumn >= 0) &&
20909           (tickCount === currentTicks)) {
20910           // Found end backticks; invoke callback for code span
20911           handler(
20912             input.substring(startIndex, index - currentTicks),
20913             startLine, startColumn, tickCount);
20914           startIndex = -1;
20915           startColumn = -1;
20916         } else if ((startIndex >= 0) && (startColumn === -1)) {
20917           // Found start backticks
20918           tickCount = currentTicks;
20919           startLine = currentLine;
20920           startColumn = currentColumn;
20921         }
20922         // Not in backticks
20923         currentTicks = 0;
20924       }
20925       if (char === "\n") {
20926         // On next line
20927         currentLine++;
20928         currentColumn = 0;
20929       } else if ((char === "\\") &&
20930         ((startIndex === -1) || (startColumn === -1)) &&
20931         (input[index + 1] !== "\n")) {
20932         // Escape character outside code, skip next
20933         index++;
20934         currentColumn += 2;
20935       } else {
20936         // On next column
20937         currentColumn++;
20938       }
20939     }
20940     if (startIndex >= 0) {
20941       // Restart loop after unmatched start backticks (ex: "`text``code``")
20942       index = startIndex;
20943       currentLine = startLine;
20944       currentColumn = startColumn;
20945     }
20946   }
20947 }
20948 module.exports.forEachInlineCodeSpan = forEachInlineCodeSpan;
20949
20950 /**
20951  * Adds a generic error object via the onError callback.
20952  *
20953  * @param {Object} onError RuleOnError instance.
20954  * @param {number} lineNumber Line number.
20955  * @param {string} [detail] Error details.
20956  * @param {string} [context] Error context.
20957  * @param {number[]} [range] Column and length of error.
20958  * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
20959  * @returns {void}
20960  */
20961 function addError(onError, lineNumber, detail, context, range, fixInfo) {
20962   onError({
20963     lineNumber,
20964     detail,
20965     context,
20966     range,
20967     fixInfo
20968   });
20969 }
20970 module.exports.addError = addError;
20971
20972 // Adds an error object with details conditionally via the onError callback
20973 module.exports.addErrorDetailIf = function addErrorDetailIf(
20974   onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
20975   if (expected !== actual) {
20976     addError(
20977       onError,
20978       lineNumber,
20979       "Expected: " + expected + "; Actual: " + actual +
20980         (detail ? "; " + detail : ""),
20981       context,
20982       range,
20983       fixInfo);
20984   }
20985 };
20986
20987 // Adds an error object with context via the onError callback
20988 module.exports.addErrorContext = function addErrorContext(
20989   onError, lineNumber, context, left, right, range, fixInfo) {
20990   if (context.length <= 30) {
20991     // Nothing to do
20992   } else if (left && right) {
20993     context = context.substr(0, 15) + "..." + context.substr(-15);
20994   } else if (right) {
20995     context = "..." + context.substr(-30);
20996   } else {
20997     context = context.substr(0, 30) + "...";
20998   }
20999   addError(onError, lineNumber, null, context, range, fixInfo);
21000 };
21001
21002 // Returns a range object for a line by applying a RegExp
21003 module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
21004   let range = null;
21005   const match = line.match(regexp);
21006   if (match) {
21007     const column = match.index + 1;
21008     const length = match[0].length;
21009     range = [ column, length ];
21010   }
21011   return range;
21012 };
21013
21014 // Determines if the front matter includes a title
21015 module.exports.frontMatterHasTitle =
21016   function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
21017     const ignoreFrontMatter =
21018       (frontMatterTitlePattern !== undefined) && !frontMatterTitlePattern;
21019     const frontMatterTitleRe =
21020       new RegExp(String(frontMatterTitlePattern || "^\\s*title\\s*[:=]"), "i");
21021     return !ignoreFrontMatter &&
21022       frontMatterLines.some((line) => frontMatterTitleRe.test(line));
21023   };
21024
21025 /**
21026  * Returns a list of emphasis markers in code spans and links.
21027  *
21028  * @param {Object} params RuleParams instance.
21029  * @returns {number[][]} List of markers.
21030  */
21031 function emphasisMarkersInContent(params) {
21032   const { lines } = params;
21033   const byLine = new Array(lines.length);
21034   // Search code spans
21035   filterTokens(params, "inline", (token) => {
21036     const { children, lineNumber, map } = token;
21037     if (children.some((child) => child.type === "code_inline")) {
21038       const tokenLines = lines.slice(map[0], map[1]);
21039       forEachInlineCodeSpan(
21040         tokenLines.join("\n"),
21041         (code, lineIndex, column, tickCount) => {
21042           const codeLines = code.split(newLineRe);
21043           codeLines.forEach((codeLine, codeLineIndex) => {
21044             let match = null;
21045             while ((match = emphasisMarkersRe.exec(codeLine))) {
21046               const byLineIndex = lineNumber - 1 + lineIndex + codeLineIndex;
21047               const inLine = byLine[byLineIndex] || [];
21048               const codeLineOffset = codeLineIndex ? 0 : column - 1 + tickCount;
21049               inLine.push(codeLineOffset + match.index);
21050               byLine[byLineIndex] = inLine;
21051             }
21052           });
21053         }
21054       );
21055     }
21056   });
21057   // Search links
21058   lines.forEach((tokenLine, tokenLineIndex) => {
21059     let linkMatch = null;
21060     while ((linkMatch = linkRe.exec(tokenLine))) {
21061       let markerMatch = null;
21062       while ((markerMatch = emphasisMarkersRe.exec(linkMatch[0]))) {
21063         const inLine = byLine[tokenLineIndex] || [];
21064         inLine.push(linkMatch.index + markerMatch.index);
21065         byLine[tokenLineIndex] = inLine;
21066       }
21067     }
21068   });
21069   return byLine;
21070 }
21071 module.exports.emphasisMarkersInContent = emphasisMarkersInContent;
21072
21073 /**
21074  * Gets the most common line ending, falling back to the platform default.
21075  *
21076  * @param {string} input Markdown content to analyze.
21077  * @returns {string} Preferred line ending.
21078  */
21079 function getPreferredLineEnding(input) {
21080   let cr = 0;
21081   let lf = 0;
21082   let crlf = 0;
21083   const endings = input.match(newLineRe) || [];
21084   endings.forEach((ending) => {
21085     // eslint-disable-next-line default-case
21086     switch (ending) {
21087       case "\r":
21088         cr++;
21089         break;
21090       case "\n":
21091         lf++;
21092         break;
21093       case "\r\n":
21094         crlf++;
21095         break;
21096     }
21097   });
21098   let preferredLineEnding = null;
21099   if (!cr && !lf && !crlf) {
21100     preferredLineEnding = os.EOL;
21101   } else if ((lf >= crlf) && (lf >= cr)) {
21102     preferredLineEnding = "\n";
21103   } else if (crlf >= cr) {
21104     preferredLineEnding = "\r\n";
21105   } else {
21106     preferredLineEnding = "\r";
21107   }
21108   return preferredLineEnding;
21109 }
21110 module.exports.getPreferredLineEnding = getPreferredLineEnding;
21111
21112 /**
21113  * Normalizes the fields of a RuleOnErrorFixInfo instance.
21114  *
21115  * @param {Object} fixInfo RuleOnErrorFixInfo instance.
21116  * @param {number} [lineNumber] Line number.
21117  * @returns {Object} Normalized RuleOnErrorFixInfo instance.
21118  */
21119 function normalizeFixInfo(fixInfo, lineNumber) {
21120   return {
21121     "lineNumber": fixInfo.lineNumber || lineNumber,
21122     "editColumn": fixInfo.editColumn || 1,
21123     "deleteCount": fixInfo.deleteCount || 0,
21124     "insertText": fixInfo.insertText || ""
21125   };
21126 }
21127
21128 /**
21129  * Fixes the specified error on a line of Markdown content.
21130  *
21131  * @param {string} line Line of Markdown content.
21132  * @param {Object} fixInfo RuleOnErrorFixInfo instance.
21133  * @param {string} lineEnding Line ending to use.
21134  * @returns {string} Fixed content.
21135  */
21136 function applyFix(line, fixInfo, lineEnding) {
21137   const { editColumn, deleteCount, insertText } = normalizeFixInfo(fixInfo);
21138   const editIndex = editColumn - 1;
21139   return (deleteCount === -1) ?
21140     null :
21141     line.slice(0, editIndex) +
21142     insertText.replace(/\n/g, lineEnding || "\n") +
21143     line.slice(editIndex + deleteCount);
21144 }
21145 module.exports.applyFix = applyFix;
21146
21147 // Applies as many fixes as possible to the input lines
21148 module.exports.applyFixes = function applyFixes(input, errors) {
21149   const lineEnding = getPreferredLineEnding(input);
21150   const lines = input.split(newLineRe);
21151   // Normalize fixInfo objects
21152   let fixInfos = errors
21153     .filter((error) => error.fixInfo)
21154     .map((error) => normalizeFixInfo(error.fixInfo, error.lineNumber));
21155   // Sort bottom-to-top, line-deletes last, right-to-left, long-to-short
21156   fixInfos.sort((a, b) => {
21157     const aDeletingLine = (a.deleteCount === -1);
21158     const bDeletingLine = (b.deleteCount === -1);
21159     return (
21160       (b.lineNumber - a.lineNumber) ||
21161       (aDeletingLine ? 1 : (bDeletingLine ? -1 : 0)) ||
21162       (b.editColumn - a.editColumn) ||
21163       (b.insertText.length - a.insertText.length)
21164     );
21165   });
21166   // Remove duplicate entries (needed for following collapse step)
21167   let lastFixInfo = {};
21168   fixInfos = fixInfos.filter((fixInfo) => {
21169     const unique = (
21170       (fixInfo.lineNumber !== lastFixInfo.lineNumber) ||
21171       (fixInfo.editColumn !== lastFixInfo.editColumn) ||
21172       (fixInfo.deleteCount !== lastFixInfo.deleteCount) ||
21173       (fixInfo.insertText !== lastFixInfo.insertText)
21174     );
21175     lastFixInfo = fixInfo;
21176     return unique;
21177   });
21178   // Collapse insert/no-delete and no-insert/delete for same line/column
21179   lastFixInfo = {};
21180   fixInfos.forEach((fixInfo) => {
21181     if (
21182       (fixInfo.lineNumber === lastFixInfo.lineNumber) &&
21183       (fixInfo.editColumn === lastFixInfo.editColumn) &&
21184       !fixInfo.insertText &&
21185       (fixInfo.deleteCount > 0) &&
21186       lastFixInfo.insertText &&
21187       !lastFixInfo.deleteCount) {
21188       fixInfo.insertText = lastFixInfo.insertText;
21189       lastFixInfo.lineNumber = 0;
21190     }
21191     lastFixInfo = fixInfo;
21192   });
21193   fixInfos = fixInfos.filter((fixInfo) => fixInfo.lineNumber);
21194   // Apply all (remaining/updated) fixes
21195   let lastLineIndex = -1;
21196   let lastEditIndex = -1;
21197   fixInfos.forEach((fixInfo) => {
21198     const { lineNumber, editColumn, deleteCount } = fixInfo;
21199     const lineIndex = lineNumber - 1;
21200     const editIndex = editColumn - 1;
21201     if (
21202       (lineIndex !== lastLineIndex) ||
21203       ((editIndex + deleteCount) < lastEditIndex) ||
21204       (deleteCount === -1)
21205     ) {
21206       lines[lineIndex] = applyFix(lines[lineIndex], fixInfo, lineEnding);
21207     }
21208     lastLineIndex = lineIndex;
21209     lastEditIndex = editIndex;
21210   });
21211   // Return corrected input
21212   return lines.filter((line) => line !== null).join(lineEnding);
21213 };
21214
21215
21216 /***/ }),
21217 /* 111 */
21218 /***/ (function(module, exports) {
21219
21220 module.exports = require("os");
21221
21222 /***/ }),
21223 /* 112 */
21224 /***/ (function(module, exports, __webpack_require__) {
21225
21226 "use strict";
21227 // @ts-check
21228
21229
21230
21231 const { addErrorDetailIf } = __webpack_require__(110);
21232
21233 module.exports = {
21234   "names": [ "MD002", "first-heading-h1", "first-header-h1" ],
21235   "description": "First heading should be a top level heading",
21236   "tags": [ "headings", "headers" ],
21237   "function": function MD002(params, onError) {
21238     const level = Number(params.config.level || 1);
21239     const tag = "h" + level;
21240     params.tokens.every(function forToken(token) {
21241       if (token.type === "heading_open") {
21242         addErrorDetailIf(onError, token.lineNumber, tag, token.tag);
21243         return false;
21244       }
21245       return true;
21246     });
21247   }
21248 };
21249
21250
21251 /***/ }),
21252 /* 113 */
21253 /***/ (function(module, exports, __webpack_require__) {
21254
21255 "use strict";
21256 // @ts-check
21257
21258
21259
21260 const { addErrorDetailIf, filterTokens, headingStyleFor } =
21261   __webpack_require__(110);
21262
21263 module.exports = {
21264   "names": [ "MD003", "heading-style", "header-style" ],
21265   "description": "Heading style",
21266   "tags": [ "headings", "headers" ],
21267   "function": function MD003(params, onError) {
21268     let style = String(params.config.style || "consistent");
21269     filterTokens(params, "heading_open", function forToken(token) {
21270       const styleForToken = headingStyleFor(token);
21271       if (style === "consistent") {
21272         style = styleForToken;
21273       }
21274       if (styleForToken !== style) {
21275         const h12 = /h[12]/.test(token.tag);
21276         const setextWithAtx =
21277           (style === "setext_with_atx") &&
21278             ((h12 && (styleForToken === "setext")) ||
21279             (!h12 && (styleForToken === "atx")));
21280         const setextWithAtxClosed =
21281           (style === "setext_with_atx_closed") &&
21282             ((h12 && (styleForToken === "setext")) ||
21283             (!h12 && (styleForToken === "atx_closed")));
21284         if (!setextWithAtx && !setextWithAtxClosed) {
21285           let expected = style;
21286           if (style === "setext_with_atx") {
21287             expected = h12 ? "setext" : "atx";
21288           } else if (style === "setext_with_atx_closed") {
21289             expected = h12 ? "setext" : "atx_closed";
21290           }
21291           addErrorDetailIf(onError, token.lineNumber,
21292             expected, styleForToken);
21293         }
21294       }
21295     });
21296   }
21297 };
21298
21299
21300 /***/ }),
21301 /* 114 */
21302 /***/ (function(module, exports, __webpack_require__) {
21303
21304 "use strict";
21305 // @ts-check
21306
21307
21308
21309 const { addErrorDetailIf, listItemMarkerRe,
21310   rangeFromRegExp, unorderedListStyleFor } = __webpack_require__(110);
21311 const { flattenedLists } = __webpack_require__(115);
21312
21313 module.exports = {
21314   "names": [ "MD004", "ul-style" ],
21315   "description": "Unordered list style",
21316   "tags": [ "bullet", "ul" ],
21317   "function": function MD004(params, onError) {
21318     const style = String(params.config.style || "consistent");
21319     let expectedStyle = style;
21320     const nestingStyles = [];
21321     flattenedLists().forEach((list) => {
21322       if (list.unordered) {
21323         if (expectedStyle === "consistent") {
21324           expectedStyle = unorderedListStyleFor(list.items[0]);
21325         }
21326         list.items.forEach((item) => {
21327           const itemStyle = unorderedListStyleFor(item);
21328           if (style === "sublist") {
21329             const nesting = list.nesting;
21330             if (!nestingStyles[nesting] &&
21331               (itemStyle !== nestingStyles[nesting - 1])) {
21332               nestingStyles[nesting] = itemStyle;
21333             } else {
21334               addErrorDetailIf(onError, item.lineNumber,
21335                 nestingStyles[nesting], itemStyle, null, null,
21336                 rangeFromRegExp(item.line, listItemMarkerRe));
21337             }
21338           } else {
21339             addErrorDetailIf(onError, item.lineNumber,
21340               expectedStyle, itemStyle, null, null,
21341               rangeFromRegExp(item.line, listItemMarkerRe));
21342           }
21343         });
21344       }
21345     });
21346   }
21347 };
21348
21349
21350 /***/ }),
21351 /* 115 */
21352 /***/ (function(module, exports, __webpack_require__) {
21353
21354 "use strict";
21355 // @ts-check
21356
21357
21358
21359 let lineMetadata = null;
21360 module.exports.lineMetadata = (value) => {
21361   if (value) {
21362     lineMetadata = value;
21363   }
21364   return lineMetadata;
21365 };
21366
21367 let flattenedLists = null;
21368 module.exports.flattenedLists = (value) => {
21369   if (value) {
21370     flattenedLists = value;
21371   }
21372   return flattenedLists;
21373 };
21374
21375 module.exports.clear = () => {
21376   lineMetadata = null;
21377   flattenedLists = null;
21378 };
21379
21380
21381 /***/ }),
21382 /* 116 */
21383 /***/ (function(module, exports, __webpack_require__) {
21384
21385 "use strict";
21386 // @ts-check
21387
21388
21389
21390 const { addError, addErrorDetailIf, indentFor, listItemMarkerRe,
21391   orderedListItemMarkerRe, rangeFromRegExp } = __webpack_require__(110);
21392 const { flattenedLists } = __webpack_require__(115);
21393
21394 module.exports = {
21395   "names": [ "MD005", "list-indent" ],
21396   "description": "Inconsistent indentation for list items at the same level",
21397   "tags": [ "bullet", "ul", "indentation" ],
21398   "function": function MD005(params, onError) {
21399     flattenedLists().forEach((list) => {
21400       const expectedIndent = list.indent;
21401       let expectedEnd = 0;
21402       let actualEnd = -1;
21403       let endMatching = false;
21404       list.items.forEach((item) => {
21405         const { line, lineNumber } = item;
21406         const actualIndent = indentFor(item);
21407         let match = null;
21408         if (list.unordered) {
21409           addErrorDetailIf(
21410             onError,
21411             lineNumber,
21412             expectedIndent,
21413             actualIndent,
21414             null,
21415             null,
21416             rangeFromRegExp(line, listItemMarkerRe)
21417             // No fixInfo; MD007 handles this scenario better
21418           );
21419         } else if ((match = orderedListItemMarkerRe.exec(line))) {
21420           actualEnd = match[0].length;
21421           expectedEnd = expectedEnd || actualEnd;
21422           const markerLength = match[1].length + 1;
21423           if ((expectedIndent !== actualIndent) || endMatching) {
21424             if (expectedEnd === actualEnd) {
21425               endMatching = true;
21426             } else {
21427               const detail = endMatching ?
21428                 `Expected: (${expectedEnd}); Actual: (${actualEnd})` :
21429                 `Expected: ${expectedIndent}; Actual: ${actualIndent}`;
21430               const expected = endMatching ?
21431                 expectedEnd - markerLength :
21432                 expectedIndent;
21433               const actual = endMatching ?
21434                 actualEnd - markerLength :
21435                 actualIndent;
21436               addError(
21437                 onError,
21438                 lineNumber,
21439                 detail,
21440                 null,
21441                 rangeFromRegExp(line, listItemMarkerRe),
21442                 {
21443                   "editColumn": Math.min(actual, expected) + 1,
21444                   "deleteCount": Math.max(actual - expected, 0),
21445                   "insertText": "".padEnd(Math.max(expected - actual, 0))
21446                 }
21447               );
21448             }
21449           }
21450         }
21451       });
21452     });
21453   }
21454 };
21455
21456
21457 /***/ }),
21458 /* 117 */
21459 /***/ (function(module, exports, __webpack_require__) {
21460
21461 "use strict";
21462 // @ts-check
21463
21464
21465
21466 const { addErrorDetailIf, listItemMarkerRe, rangeFromRegExp } =
21467   __webpack_require__(110);
21468 const { flattenedLists } = __webpack_require__(115);
21469
21470 module.exports = {
21471   "names": [ "MD006", "ul-start-left" ],
21472   "description":
21473     "Consider starting bulleted lists at the beginning of the line",
21474   "tags": [ "bullet", "ul", "indentation" ],
21475   "function": function MD006(params, onError) {
21476     flattenedLists().forEach((list) => {
21477       if (list.unordered && !list.nesting && (list.indent !== 0)) {
21478         list.items.forEach((item) => {
21479           const { lineNumber, line } = item;
21480           addErrorDetailIf(
21481             onError,
21482             lineNumber,
21483             0,
21484             list.indent,
21485             null,
21486             null,
21487             rangeFromRegExp(line, listItemMarkerRe),
21488             {
21489               "deleteCount": line.length - line.trimLeft().length
21490             });
21491         });
21492       }
21493     });
21494   }
21495 };
21496
21497
21498 /***/ }),
21499 /* 118 */
21500 /***/ (function(module, exports, __webpack_require__) {
21501
21502 "use strict";
21503 // @ts-check
21504
21505
21506
21507 const { addErrorDetailIf, indentFor, listItemMarkerRe } =
21508   __webpack_require__(110);
21509 const { flattenedLists } = __webpack_require__(115);
21510
21511 module.exports = {
21512   "names": [ "MD007", "ul-indent" ],
21513   "description": "Unordered list indentation",
21514   "tags": [ "bullet", "ul", "indentation" ],
21515   "function": function MD007(params, onError) {
21516     const indent = Number(params.config.indent || 2);
21517     const startIndented = !!params.config.start_indented;
21518     flattenedLists().forEach((list) => {
21519       if (list.unordered && list.parentsUnordered) {
21520         list.items.forEach((item) => {
21521           const { lineNumber, line } = item;
21522           const expectedNesting = list.nesting + (startIndented ? 1 : 0);
21523           const expectedIndent = expectedNesting * indent;
21524           const actualIndent = indentFor(item);
21525           let range = null;
21526           let editColumn = 1;
21527           const match = line.match(listItemMarkerRe);
21528           if (match) {
21529             range = [ 1, match[0].length ];
21530             editColumn += match[1].length - actualIndent;
21531           }
21532           addErrorDetailIf(
21533             onError,
21534             lineNumber,
21535             expectedIndent,
21536             actualIndent,
21537             null,
21538             null,
21539             range,
21540             {
21541               editColumn,
21542               "deleteCount": actualIndent,
21543               "insertText": "".padEnd(expectedIndent)
21544             });
21545         });
21546       }
21547     });
21548   }
21549 };
21550
21551
21552 /***/ }),
21553 /* 119 */
21554 /***/ (function(module, exports, __webpack_require__) {
21555
21556 "use strict";
21557 // @ts-check
21558
21559
21560
21561 const { addError, filterTokens, forEachInlineCodeSpan, forEachLine,
21562   includesSorted, newLineRe, numericSortAscending } = __webpack_require__(110);
21563 const { lineMetadata } = __webpack_require__(115);
21564
21565 module.exports = {
21566   "names": [ "MD009", "no-trailing-spaces" ],
21567   "description": "Trailing spaces",
21568   "tags": [ "whitespace" ],
21569   "function": function MD009(params, onError) {
21570     let brSpaces = params.config.br_spaces;
21571     brSpaces = Number((brSpaces === undefined) ? 2 : brSpaces);
21572     const listItemEmptyLines = !!params.config.list_item_empty_lines;
21573     const strict = !!params.config.strict;
21574     const listItemLineNumbers = [];
21575     if (listItemEmptyLines) {
21576       filterTokens(params, "list_item_open", (token) => {
21577         for (let i = token.map[0]; i < token.map[1]; i++) {
21578           listItemLineNumbers.push(i + 1);
21579         }
21580       });
21581       listItemLineNumbers.sort(numericSortAscending);
21582     }
21583     const paragraphLineNumbers = [];
21584     const codeInlineLineNumbers = [];
21585     if (strict) {
21586       filterTokens(params, "paragraph_open", (token) => {
21587         for (let i = token.map[0]; i < token.map[1] - 1; i++) {
21588           paragraphLineNumbers.push(i + 1);
21589         }
21590       });
21591       paragraphLineNumbers.sort(numericSortAscending);
21592       filterTokens(params, "inline", (token) => {
21593         if (token.children.some((child) => child.type === "code_inline")) {
21594           const tokenLines = params.lines.slice(token.map[0], token.map[1]);
21595           forEachInlineCodeSpan(tokenLines.join("\n"), (code, lineIndex) => {
21596             const codeLineCount = code.split(newLineRe).length;
21597             for (let i = 0; i < codeLineCount; i++) {
21598               codeInlineLineNumbers.push(token.lineNumber + lineIndex + i);
21599             }
21600           });
21601         }
21602       });
21603       codeInlineLineNumbers.sort(numericSortAscending);
21604     }
21605     const expected = (brSpaces < 2) ? 0 : brSpaces;
21606     let inFencedCode = 0;
21607     forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence) => {
21608       inFencedCode += onFence;
21609       const lineNumber = lineIndex + 1;
21610       const trailingSpaces = line.length - line.trimRight().length;
21611       if ((!inCode || inFencedCode) && trailingSpaces &&
21612         !includesSorted(listItemLineNumbers, lineNumber)) {
21613         if ((expected !== trailingSpaces) ||
21614             (strict &&
21615              (!includesSorted(paragraphLineNumbers, lineNumber) ||
21616               includesSorted(codeInlineLineNumbers, lineNumber)))) {
21617           const column = line.length - trailingSpaces + 1;
21618           addError(
21619             onError,
21620             lineNumber,
21621             "Expected: " + (expected === 0 ? "" : "0 or ") +
21622               expected + "; Actual: " + trailingSpaces,
21623             null,
21624             [ column, trailingSpaces ],
21625             {
21626               "editColumn": column,
21627               "deleteCount": trailingSpaces
21628             });
21629         }
21630       }
21631     });
21632   }
21633 };
21634
21635
21636 /***/ }),
21637 /* 120 */
21638 /***/ (function(module, exports, __webpack_require__) {
21639
21640 "use strict";
21641 // @ts-check
21642
21643
21644
21645 const { addError, forEachLine } = __webpack_require__(110);
21646 const { lineMetadata } = __webpack_require__(115);
21647
21648 const tabRe = /\t+/g;
21649
21650 module.exports = {
21651   "names": [ "MD010", "no-hard-tabs" ],
21652   "description": "Hard tabs",
21653   "tags": [ "whitespace", "hard_tab" ],
21654   "function": function MD010(params, onError) {
21655     const codeBlocks = params.config.code_blocks;
21656     const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
21657     forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
21658       if (!inCode || includeCodeBlocks) {
21659         let match = null;
21660         while ((match = tabRe.exec(line)) !== null) {
21661           const column = match.index + 1;
21662           const length = match[0].length;
21663           addError(
21664             onError,
21665             lineIndex + 1,
21666             "Column: " + column,
21667             null,
21668             [ column, length ],
21669             {
21670               "editColumn": column,
21671               "deleteCount": length,
21672               "insertText": "".padEnd(length)
21673             });
21674         }
21675       }
21676     });
21677   }
21678 };
21679
21680
21681 /***/ }),
21682 /* 121 */
21683 /***/ (function(module, exports, __webpack_require__) {
21684
21685 "use strict";
21686 // @ts-check
21687
21688
21689
21690 const { addError, forEachInlineChild, unescapeMarkdown } =
21691   __webpack_require__(110);
21692
21693 const reversedLinkRe = /\(([^)]+)\)\[([^\]^][^\]]*)]/g;
21694
21695 module.exports = {
21696   "names": [ "MD011", "no-reversed-links" ],
21697   "description": "Reversed link syntax",
21698   "tags": [ "links" ],
21699   "function": function MD011(params, onError) {
21700     forEachInlineChild(params, "text", (token) => {
21701       const { lineNumber, content } = token;
21702       let match = null;
21703       while ((match = reversedLinkRe.exec(content)) !== null) {
21704         const [ reversedLink, linkText, linkDestination ] = match;
21705         const line = params.lines[lineNumber - 1];
21706         const column = unescapeMarkdown(line).indexOf(reversedLink) + 1;
21707         const length = reversedLink.length;
21708         addError(
21709           onError,
21710           lineNumber,
21711           reversedLink,
21712           null,
21713           [ column, length ],
21714           {
21715             "editColumn": column,
21716             "deleteCount": length,
21717             "insertText": `[${linkText}](${linkDestination})`
21718           }
21719         );
21720       }
21721     });
21722   }
21723 };
21724
21725
21726 /***/ }),
21727 /* 122 */
21728 /***/ (function(module, exports, __webpack_require__) {
21729
21730 "use strict";
21731 // @ts-check
21732
21733
21734
21735 const { addErrorDetailIf, forEachLine } = __webpack_require__(110);
21736 const { lineMetadata } = __webpack_require__(115);
21737
21738 module.exports = {
21739   "names": [ "MD012", "no-multiple-blanks" ],
21740   "description": "Multiple consecutive blank lines",
21741   "tags": [ "whitespace", "blank_lines" ],
21742   "function": function MD012(params, onError) {
21743     const maximum = Number(params.config.maximum || 1);
21744     let count = 0;
21745     forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
21746       count = (inCode || line.trim().length) ? 0 : count + 1;
21747       if (maximum < count) {
21748         addErrorDetailIf(
21749           onError,
21750           lineIndex + 1,
21751           maximum,
21752           count,
21753           null,
21754           null,
21755           null,
21756           {
21757             "deleteCount": -1
21758           });
21759       }
21760     });
21761   }
21762 };
21763
21764
21765 /***/ }),
21766 /* 123 */
21767 /***/ (function(module, exports, __webpack_require__) {
21768
21769 "use strict";
21770 // @ts-check
21771
21772
21773
21774 const { addErrorDetailIf, filterTokens, forEachHeading, forEachLine,
21775   includesSorted } = __webpack_require__(110);
21776 const { lineMetadata } = __webpack_require__(115);
21777
21778 const longLineRePrefix = "^.{";
21779 const longLineRePostfixRelaxed = "}.*\\s.*$";
21780 const longLineRePostfixStrict = "}.+$";
21781 const labelRe = /^\s*\[.*[^\\]]:/;
21782 const linkOrImageOnlyLineRe = /^[es]*(lT?L|I)[ES]*$/;
21783 const sternModeRe = /^([#>\s]*\s)?\S*$/;
21784 const tokenTypeMap = {
21785   "em_open": "e",
21786   "em_close": "E",
21787   "image": "I",
21788   "link_open": "l",
21789   "link_close": "L",
21790   "strong_open": "s",
21791   "strong_close": "S",
21792   "text": "T"
21793 };
21794
21795 module.exports = {
21796   "names": [ "MD013", "line-length" ],
21797   "description": "Line length",
21798   "tags": [ "line_length" ],
21799   "function": function MD013(params, onError) {
21800     const lineLength = Number(params.config.line_length || 80);
21801     const headingLineLength =
21802       Number(params.config.heading_line_length || lineLength);
21803     const codeLineLength =
21804       Number(params.config.code_block_line_length || lineLength);
21805     const strict = !!params.config.strict;
21806     const stern = !!params.config.stern;
21807     const longLineRePostfix =
21808       (strict || stern) ? longLineRePostfixStrict : longLineRePostfixRelaxed;
21809     const longLineRe =
21810       new RegExp(longLineRePrefix + lineLength + longLineRePostfix);
21811     const longHeadingLineRe =
21812       new RegExp(longLineRePrefix + headingLineLength + longLineRePostfix);
21813     const longCodeLineRe =
21814       new RegExp(longLineRePrefix + codeLineLength + longLineRePostfix);
21815     const codeBlocks = params.config.code_blocks;
21816     const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
21817     const tables = params.config.tables;
21818     const includeTables = (tables === undefined) ? true : !!tables;
21819     let headings = params.config.headings;
21820     if (headings === undefined) {
21821       headings = params.config.headers;
21822     }
21823     const includeHeadings = (headings === undefined) ? true : !!headings;
21824     const headingLineNumbers = [];
21825     forEachHeading(params, (heading) => {
21826       headingLineNumbers.push(heading.lineNumber);
21827     });
21828     const linkOnlyLineNumbers = [];
21829     filterTokens(params, "inline", (token) => {
21830       let childTokenTypes = "";
21831       token.children.forEach((child) => {
21832         if (child.type !== "text" || child.content !== "") {
21833           childTokenTypes += tokenTypeMap[child.type] || "x";
21834         }
21835       });
21836       if (linkOrImageOnlyLineRe.test(childTokenTypes)) {
21837         linkOnlyLineNumbers.push(token.lineNumber);
21838       }
21839     });
21840     forEachLine(lineMetadata(), (line, lineIndex, inCode, onFence, inTable) => {
21841       const lineNumber = lineIndex + 1;
21842       const isHeading = includesSorted(headingLineNumbers, lineNumber);
21843       const length = inCode ?
21844         codeLineLength :
21845         (isHeading ? headingLineLength : lineLength);
21846       const lengthRe = inCode ?
21847         longCodeLineRe :
21848         (isHeading ? longHeadingLineRe : longLineRe);
21849       if ((includeCodeBlocks || !inCode) &&
21850           (includeTables || !inTable) &&
21851           (includeHeadings || !isHeading) &&
21852           (strict ||
21853            (!(stern && sternModeRe.test(line)) &&
21854             !includesSorted(linkOnlyLineNumbers, lineNumber) &&
21855             !labelRe.test(line))) &&
21856           lengthRe.test(line)) {
21857         addErrorDetailIf(
21858           onError,
21859           lineNumber,
21860           length,
21861           line.length,
21862           null,
21863           null,
21864           [ length + 1, line.length - length ]);
21865       }
21866     });
21867   }
21868 };
21869
21870
21871 /***/ }),
21872 /* 124 */
21873 /***/ (function(module, exports, __webpack_require__) {
21874
21875 "use strict";
21876 // @ts-check
21877
21878
21879
21880 const { addErrorContext, filterTokens } = __webpack_require__(110);
21881
21882 const dollarCommandRe = /^(\s*)(\$\s+)/;
21883
21884 module.exports = {
21885   "names": [ "MD014", "commands-show-output" ],
21886   "description": "Dollar signs used before commands without showing output",
21887   "tags": [ "code" ],
21888   "function": function MD014(params, onError) {
21889     [ "code_block", "fence" ].forEach((type) => {
21890       filterTokens(params, type, (token) => {
21891         const margin = (token.type === "fence") ? 1 : 0;
21892         const dollarInstances = [];
21893         let allDollars = true;
21894         for (let i = token.map[0] + margin; i < token.map[1] - margin; i++) {
21895           const line = params.lines[i];
21896           const lineTrim = line.trim();
21897           if (lineTrim) {
21898             const match = dollarCommandRe.exec(line);
21899             if (match) {
21900               const column = match[1].length + 1;
21901               const length = match[2].length;
21902               dollarInstances.push([ i, lineTrim, column, length ]);
21903             } else {
21904               allDollars = false;
21905             }
21906           }
21907         }
21908         if (allDollars) {
21909           dollarInstances.forEach((instance) => {
21910             const [ i, lineTrim, column, length ] = instance;
21911             addErrorContext(
21912               onError,
21913               i + 1,
21914               lineTrim,
21915               null,
21916               null,
21917               [ column, length ],
21918               {
21919                 "editColumn": column,
21920                 "deleteCount": length
21921               }
21922             );
21923           });
21924         }
21925       });
21926     });
21927   }
21928 };
21929
21930
21931 /***/ }),
21932 /* 125 */
21933 /***/ (function(module, exports, __webpack_require__) {
21934
21935 "use strict";
21936 // @ts-check
21937
21938
21939
21940 const { addErrorContext, forEachLine } = __webpack_require__(110);
21941 const { lineMetadata } = __webpack_require__(115);
21942
21943 module.exports = {
21944   "names": [ "MD018", "no-missing-space-atx" ],
21945   "description": "No space after hash on atx style heading",
21946   "tags": [ "headings", "headers", "atx", "spaces" ],
21947   "function": function MD018(params, onError) {
21948     forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
21949       if (!inCode &&
21950         /^#+[^#\s]/.test(line) &&
21951         !/#\s*$/.test(line) &&
21952         !line.startsWith("#️⃣")) {
21953         const hashCount = /^#+/.exec(line)[0].length;
21954         addErrorContext(
21955           onError,
21956           lineIndex + 1,
21957           line.trim(),
21958           null,
21959           null,
21960           [ 1, hashCount + 1 ],
21961           {
21962             "editColumn": hashCount + 1,
21963             "insertText": " "
21964           }
21965         );
21966       }
21967     });
21968   }
21969 };
21970
21971
21972 /***/ }),
21973 /* 126 */
21974 /***/ (function(module, exports, __webpack_require__) {
21975
21976 "use strict";
21977 // @ts-check
21978
21979
21980
21981 const { addErrorContext, filterTokens, headingStyleFor } =
21982   __webpack_require__(110);
21983
21984 module.exports = {
21985   "names": [ "MD019", "no-multiple-space-atx" ],
21986   "description": "Multiple spaces after hash on atx style heading",
21987   "tags": [ "headings", "headers", "atx", "spaces" ],
21988   "function": function MD019(params, onError) {
21989     filterTokens(params, "heading_open", (token) => {
21990       if (headingStyleFor(token) === "atx") {
21991         const { line, lineNumber } = token;
21992         const match = /^(#+)(\s{2,})(?:\S)/.exec(line);
21993         if (match) {
21994           const [
21995             ,
21996             { "length": hashLength },
21997             { "length": spacesLength }
21998           ] = match;
21999           addErrorContext(
22000             onError,
22001             lineNumber,
22002             line.trim(),
22003             null,
22004             null,
22005             [ 1, hashLength + spacesLength + 1 ],
22006             {
22007               "editColumn": hashLength + 1,
22008               "deleteCount": spacesLength - 1
22009             }
22010           );
22011         }
22012       }
22013     });
22014   }
22015 };
22016
22017
22018 /***/ }),
22019 /* 127 */
22020 /***/ (function(module, exports, __webpack_require__) {
22021
22022 "use strict";
22023 // @ts-check
22024
22025
22026
22027 const { addErrorContext, forEachLine } = __webpack_require__(110);
22028 const { lineMetadata } = __webpack_require__(115);
22029
22030 module.exports = {
22031   "names": [ "MD020", "no-missing-space-closed-atx" ],
22032   "description": "No space inside hashes on closed atx style heading",
22033   "tags": [ "headings", "headers", "atx_closed", "spaces" ],
22034   "function": function MD020(params, onError) {
22035     forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
22036       if (!inCode) {
22037         const match =
22038           /^(#+)(\s*)([^#]*?[^#\\])(\s*)((?:\\#)?)(#+)(\s*)$/.exec(line);
22039         if (match) {
22040           const [
22041             ,
22042             leftHash,
22043             { "length": leftSpaceLength },
22044             content,
22045             { "length": rightSpaceLength },
22046             rightEscape,
22047             rightHash,
22048             { "length": trailSpaceLength }
22049           ] = match;
22050           const leftHashLength = leftHash.length;
22051           const rightHashLength = rightHash.length;
22052           const left = !leftSpaceLength;
22053           const right = !rightSpaceLength || rightEscape;
22054           const rightEscapeReplacement = rightEscape ? `${rightEscape} ` : "";
22055           if (left || right) {
22056             const range = left ?
22057               [
22058                 1,
22059                 leftHashLength + 1
22060               ] :
22061               [
22062                 line.length - trailSpaceLength - rightHashLength,
22063                 rightHashLength + 1
22064               ];
22065             addErrorContext(
22066               onError,
22067               lineIndex + 1,
22068               line.trim(),
22069               left,
22070               right,
22071               range,
22072               {
22073                 "editColumn": 1,
22074                 "deleteCount": line.length,
22075                 "insertText":
22076                   `${leftHash} ${content} ${rightEscapeReplacement}${rightHash}`
22077               }
22078             );
22079           }
22080         }
22081       }
22082     });
22083   }
22084 };
22085
22086
22087 /***/ }),
22088 /* 128 */
22089 /***/ (function(module, exports, __webpack_require__) {
22090
22091 "use strict";
22092 // @ts-check
22093
22094
22095
22096 const { addErrorContext, filterTokens, headingStyleFor } =
22097   __webpack_require__(110);
22098
22099 module.exports = {
22100   "names": [ "MD021", "no-multiple-space-closed-atx" ],
22101   "description": "Multiple spaces inside hashes on closed atx style heading",
22102   "tags": [ "headings", "headers", "atx_closed", "spaces" ],
22103   "function": function MD021(params, onError) {
22104     filterTokens(params, "heading_open", (token) => {
22105       if (headingStyleFor(token) === "atx_closed") {
22106         const { line, lineNumber } = token;
22107         const match = /^(#+)(\s+)([^#]+?)(\s+)(#+)(\s*)$/.exec(line);
22108         if (match) {
22109           const [
22110             ,
22111             leftHash,
22112             { "length": leftSpaceLength },
22113             content,
22114             { "length": rightSpaceLength },
22115             rightHash,
22116             { "length": trailSpaceLength }
22117           ] = match;
22118           const left = leftSpaceLength > 1;
22119           const right = rightSpaceLength > 1;
22120           if (left || right) {
22121             const length = line.length;
22122             const leftHashLength = leftHash.length;
22123             const rightHashLength = rightHash.length;
22124             const range = left ?
22125               [
22126                 1,
22127                 leftHashLength + leftSpaceLength + 1
22128               ] :
22129               [
22130                 length - trailSpaceLength - rightHashLength - rightSpaceLength,
22131                 rightSpaceLength + rightHashLength + 1
22132               ];
22133             addErrorContext(
22134               onError,
22135               lineNumber,
22136               line.trim(),
22137               left,
22138               right,
22139               range,
22140               {
22141                 "editColumn": 1,
22142                 "deleteCount": length,
22143                 "insertText": `${leftHash} ${content} ${rightHash}`
22144               }
22145             );
22146           }
22147         }
22148       }
22149     });
22150   }
22151 };
22152
22153
22154 /***/ }),
22155 /* 129 */
22156 /***/ (function(module, exports, __webpack_require__) {
22157
22158 "use strict";
22159 // @ts-check
22160
22161
22162
22163 const { addErrorDetailIf, filterTokens, isBlankLine } = __webpack_require__(110);
22164
22165 module.exports = {
22166   "names": [ "MD022", "blanks-around-headings", "blanks-around-headers" ],
22167   "description": "Headings should be surrounded by blank lines",
22168   "tags": [ "headings", "headers", "blank_lines" ],
22169   "function": function MD022(params, onError) {
22170     let linesAbove = params.config.lines_above;
22171     linesAbove = Number((linesAbove === undefined) ? 1 : linesAbove);
22172     let linesBelow = params.config.lines_below;
22173     linesBelow = Number((linesBelow === undefined) ? 1 : linesBelow);
22174     const { lines } = params;
22175     filterTokens(params, "heading_open", (token) => {
22176       const [ topIndex, nextIndex ] = token.map;
22177       let actualAbove = 0;
22178       for (let i = 0; i < linesAbove; i++) {
22179         if (isBlankLine(lines[topIndex - i - 1])) {
22180           actualAbove++;
22181         }
22182       }
22183       addErrorDetailIf(
22184         onError,
22185         topIndex + 1,
22186         linesAbove,
22187         actualAbove,
22188         "Above",
22189         lines[topIndex].trim(),
22190         null,
22191         {
22192           "insertText": "".padEnd(linesAbove - actualAbove, "\n")
22193         });
22194       let actualBelow = 0;
22195       for (let i = 0; i < linesBelow; i++) {
22196         if (isBlankLine(lines[nextIndex + i])) {
22197           actualBelow++;
22198         }
22199       }
22200       addErrorDetailIf(
22201         onError,
22202         topIndex + 1,
22203         linesBelow,
22204         actualBelow,
22205         "Below",
22206         lines[topIndex].trim(),
22207         null,
22208         {
22209           "lineNumber": nextIndex + 1,
22210           "insertText": "".padEnd(linesBelow - actualBelow, "\n")
22211         });
22212     });
22213   }
22214 };
22215
22216
22217 /***/ }),
22218 /* 130 */
22219 /***/ (function(module, exports, __webpack_require__) {
22220
22221 "use strict";
22222 // @ts-check
22223
22224
22225
22226 const { addErrorContext, filterTokens } = __webpack_require__(110);
22227
22228 const spaceBeforeHeadingRe = /^((?:\s+)|(?:[>\s]+\s\s))[^>\s]/;
22229
22230 module.exports = {
22231   "names": [ "MD023", "heading-start-left", "header-start-left" ],
22232   "description": "Headings must start at the beginning of the line",
22233   "tags": [ "headings", "headers", "spaces" ],
22234   "function": function MD023(params, onError) {
22235     filterTokens(params, "heading_open", function forToken(token) {
22236       const { lineNumber, line } = token;
22237       const match = line.match(spaceBeforeHeadingRe);
22238       if (match) {
22239         const [ prefixAndFirstChar, prefix ] = match;
22240         let deleteCount = prefix.length;
22241         const prefixLengthNoSpace = prefix.trimRight().length;
22242         if (prefixLengthNoSpace) {
22243           deleteCount -= prefixLengthNoSpace - 1;
22244         }
22245         addErrorContext(
22246           onError,
22247           lineNumber,
22248           line,
22249           null,
22250           null,
22251           [ 1, prefixAndFirstChar.length ],
22252           {
22253             "editColumn": prefixLengthNoSpace + 1,
22254             "deleteCount": deleteCount
22255           });
22256       }
22257     });
22258   }
22259 };
22260
22261
22262 /***/ }),
22263 /* 131 */
22264 /***/ (function(module, exports, __webpack_require__) {
22265
22266 "use strict";
22267 // @ts-check
22268
22269
22270
22271 const { addErrorContext, forEachHeading } = __webpack_require__(110);
22272
22273 module.exports = {
22274   "names": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ],
22275   "description": "Multiple headings with the same content",
22276   "tags": [ "headings", "headers" ],
22277   "function": function MD024(params, onError) {
22278     const siblingsOnly = !!params.config.siblings_only ||
22279       !!params.config.allow_different_nesting || false;
22280     const knownContents = [ null, [] ];
22281     let lastLevel = 1;
22282     let knownContent = knownContents[lastLevel];
22283     forEachHeading(params, (heading, content) => {
22284       if (siblingsOnly) {
22285         const newLevel = heading.tag.slice(1);
22286         while (lastLevel < newLevel) {
22287           lastLevel++;
22288           knownContents[lastLevel] = [];
22289         }
22290         while (lastLevel > newLevel) {
22291           knownContents[lastLevel] = [];
22292           lastLevel--;
22293         }
22294         knownContent = knownContents[newLevel];
22295       }
22296       if (knownContent.includes(content)) {
22297         addErrorContext(onError, heading.lineNumber,
22298           heading.line.trim());
22299       } else {
22300         knownContent.push(content);
22301       }
22302     });
22303   }
22304 };
22305
22306
22307 /***/ }),
22308 /* 132 */
22309 /***/ (function(module, exports, __webpack_require__) {
22310
22311 "use strict";
22312 // @ts-check
22313
22314
22315
22316 const { addErrorContext, filterTokens, frontMatterHasTitle } =
22317   __webpack_require__(110);
22318
22319 module.exports = {
22320   "names": [ "MD025", "single-title", "single-h1" ],
22321   "description": "Multiple top level headings in the same document",
22322   "tags": [ "headings", "headers" ],
22323   "function": function MD025(params, onError) {
22324     const level = Number(params.config.level || 1);
22325     const tag = "h" + level;
22326     const foundFrontMatterTitle =
22327       frontMatterHasTitle(
22328         params.frontMatterLines,
22329         params.config.front_matter_title
22330       );
22331     let hasTopLevelHeading = false;
22332     filterTokens(params, "heading_open", function forToken(token) {
22333       if (token.tag === tag) {
22334         if (hasTopLevelHeading || foundFrontMatterTitle) {
22335           addErrorContext(onError, token.lineNumber,
22336             token.line.trim());
22337         } else if (token.lineNumber === 1) {
22338           hasTopLevelHeading = true;
22339         }
22340       }
22341     });
22342   }
22343 };
22344
22345
22346 /***/ }),
22347 /* 133 */
22348 /***/ (function(module, exports, __webpack_require__) {
22349
22350 "use strict";
22351 // @ts-check
22352
22353
22354
22355 const { addError, allPunctuation, escapeForRegExp, forEachHeading } =
22356   __webpack_require__(110);
22357
22358 module.exports = {
22359   "names": [ "MD026", "no-trailing-punctuation" ],
22360   "description": "Trailing punctuation in heading",
22361   "tags": [ "headings", "headers" ],
22362   "function": function MD026(params, onError) {
22363     let punctuation = params.config.punctuation;
22364     punctuation =
22365       String((punctuation === undefined) ? allPunctuation : punctuation);
22366     const trailingPunctuationRe =
22367       new RegExp("\\s*[" + escapeForRegExp(punctuation) + "]+$");
22368     forEachHeading(params, (heading) => {
22369       const { line, lineNumber } = heading;
22370       const trimmedLine = line.replace(/[\s#]*$/, "");
22371       const match = trailingPunctuationRe.exec(trimmedLine);
22372       if (match) {
22373         const fullMatch = match[0];
22374         const column = match.index + 1;
22375         const length = fullMatch.length;
22376         addError(
22377           onError,
22378           lineNumber,
22379           `Punctuation: '${fullMatch}'`,
22380           null,
22381           [ column, length ],
22382           {
22383             "editColumn": column,
22384             "deleteCount": length
22385           }
22386         );
22387       }
22388     });
22389   }
22390 };
22391
22392
22393 /***/ }),
22394 /* 134 */
22395 /***/ (function(module, exports, __webpack_require__) {
22396
22397 "use strict";
22398 // @ts-check
22399
22400
22401
22402 const { addErrorContext, newLineRe } = __webpack_require__(110);
22403
22404 const spaceAfterBlockQuoteRe = /^((?:\s*>)+)(\s{2,})\S/;
22405
22406 module.exports = {
22407   "names": [ "MD027", "no-multiple-space-blockquote" ],
22408   "description": "Multiple spaces after blockquote symbol",
22409   "tags": [ "blockquote", "whitespace", "indentation" ],
22410   "function": function MD027(params, onError) {
22411     let blockquoteNesting = 0;
22412     let listItemNesting = 0;
22413     params.tokens.forEach((token) => {
22414       const { content, lineNumber, type } = token;
22415       if (type === "blockquote_open") {
22416         blockquoteNesting++;
22417       } else if (type === "blockquote_close") {
22418         blockquoteNesting--;
22419       } else if (type === "list_item_open") {
22420         listItemNesting++;
22421       } else if (type === "list_item_close") {
22422         listItemNesting--;
22423       } else if ((type === "inline") && blockquoteNesting) {
22424         const lineCount = content.split(newLineRe).length;
22425         for (let i = 0; i < lineCount; i++) {
22426           const line = params.lines[lineNumber + i - 1];
22427           const match = line.match(spaceAfterBlockQuoteRe);
22428           if (match) {
22429             const [
22430               fullMatch,
22431               { "length": blockquoteLength },
22432               { "length": spaceLength }
22433             ] = match;
22434             if (!listItemNesting || (fullMatch[fullMatch.length - 1] === ">")) {
22435               addErrorContext(
22436                 onError,
22437                 lineNumber + i,
22438                 line,
22439                 null,
22440                 null,
22441                 [ 1, fullMatch.length ],
22442                 {
22443                   "editColumn": blockquoteLength + 1,
22444                   "deleteCount": spaceLength - 1
22445                 }
22446               );
22447             }
22448           }
22449         }
22450       }
22451     });
22452   }
22453 };
22454
22455
22456 /***/ }),
22457 /* 135 */
22458 /***/ (function(module, exports, __webpack_require__) {
22459
22460 "use strict";
22461 // @ts-check
22462
22463
22464
22465 const { addError } = __webpack_require__(110);
22466
22467 module.exports = {
22468   "names": [ "MD028", "no-blanks-blockquote" ],
22469   "description": "Blank line inside blockquote",
22470   "tags": [ "blockquote", "whitespace" ],
22471   "function": function MD028(params, onError) {
22472     let prevToken = {};
22473     let prevLineNumber = null;
22474     params.tokens.forEach(function forToken(token) {
22475       if ((token.type === "blockquote_open") &&
22476           (prevToken.type === "blockquote_close")) {
22477         for (
22478           let lineNumber = prevLineNumber;
22479           lineNumber < token.lineNumber;
22480           lineNumber++) {
22481           addError(
22482             onError,
22483             lineNumber,
22484             null,
22485             null,
22486             null,
22487             {
22488               "deleteCount": -1
22489             });
22490         }
22491       }
22492       prevToken = token;
22493       if (token.type === "blockquote_open") {
22494         prevLineNumber = token.map[1] + 1;
22495       }
22496     });
22497   }
22498 };
22499
22500
22501 /***/ }),
22502 /* 136 */
22503 /***/ (function(module, exports, __webpack_require__) {
22504
22505 "use strict";
22506 // @ts-check
22507
22508
22509
22510 const { addErrorDetailIf, listItemMarkerRe, orderedListItemMarkerRe,
22511   rangeFromRegExp } = __webpack_require__(110);
22512 const { flattenedLists } = __webpack_require__(115);
22513
22514 const listStyleExamples = {
22515   "one": "1/1/1",
22516   "ordered": "1/2/3",
22517   "zero": "0/0/0"
22518 };
22519
22520 module.exports = {
22521   "names": [ "MD029", "ol-prefix" ],
22522   "description": "Ordered list item prefix",
22523   "tags": [ "ol" ],
22524   "function": function MD029(params, onError) {
22525     const style = String(params.config.style || "one_or_ordered");
22526     flattenedLists().filter((list) => !list.unordered).forEach((list) => {
22527       const { items } = list;
22528       let current = 1;
22529       let incrementing = false;
22530       // Check for incrementing number pattern 1/2/3 or 0/1/2
22531       if (items.length >= 2) {
22532         const first = orderedListItemMarkerRe.exec(items[0].line);
22533         const second = orderedListItemMarkerRe.exec(items[1].line);
22534         if (first && second) {
22535           const [ , firstNumber ] = first;
22536           const [ , secondNumber ] = second;
22537           if ((secondNumber !== "1") || (firstNumber === "0")) {
22538             incrementing = true;
22539             if (firstNumber === "0") {
22540               current = 0;
22541             }
22542           }
22543         }
22544       }
22545       // Determine effective style
22546       let listStyle = style;
22547       if (listStyle === "one_or_ordered") {
22548         listStyle = incrementing ? "ordered" : "one";
22549       }
22550       // Force expected value for 0/0/0 and 1/1/1 patterns
22551       if (listStyle === "zero") {
22552         current = 0;
22553       } else if (listStyle === "one") {
22554         current = 1;
22555       }
22556       // Validate each list item marker
22557       items.forEach((item) => {
22558         const match = orderedListItemMarkerRe.exec(item.line);
22559         if (match) {
22560           addErrorDetailIf(onError, item.lineNumber,
22561             String(current), match[1],
22562             "Style: " + listStyleExamples[listStyle], null,
22563             rangeFromRegExp(item.line, listItemMarkerRe));
22564           if (listStyle === "ordered") {
22565             current++;
22566           }
22567         }
22568       });
22569     });
22570   }
22571 };
22572
22573
22574 /***/ }),
22575 /* 137 */
22576 /***/ (function(module, exports, __webpack_require__) {
22577
22578 "use strict";
22579 // @ts-check
22580
22581
22582
22583 const { addErrorDetailIf } = __webpack_require__(110);
22584 const { flattenedLists } = __webpack_require__(115);
22585
22586 module.exports = {
22587   "names": [ "MD030", "list-marker-space" ],
22588   "description": "Spaces after list markers",
22589   "tags": [ "ol", "ul", "whitespace" ],
22590   "function": function MD030(params, onError) {
22591     const ulSingle = Number(params.config.ul_single || 1);
22592     const olSingle = Number(params.config.ol_single || 1);
22593     const ulMulti = Number(params.config.ul_multi || 1);
22594     const olMulti = Number(params.config.ol_multi || 1);
22595     flattenedLists().forEach((list) => {
22596       const lineCount = list.lastLineIndex - list.open.map[0];
22597       const allSingle = lineCount === list.items.length;
22598       const expectedSpaces = list.unordered ?
22599         (allSingle ? ulSingle : ulMulti) :
22600         (allSingle ? olSingle : olMulti);
22601       list.items.forEach((item) => {
22602         const { line, lineNumber } = item;
22603         const match = /^[\s>]*\S+(\s*)/.exec(line);
22604         const [ { "length": matchLength }, { "length": actualSpaces } ] = match;
22605         if (matchLength < line.length) {
22606           let fixInfo = null;
22607           if (expectedSpaces !== actualSpaces) {
22608             fixInfo = {
22609               "editColumn": matchLength - actualSpaces + 1,
22610               "deleteCount": actualSpaces,
22611               "insertText": "".padEnd(expectedSpaces)
22612             };
22613           }
22614           addErrorDetailIf(
22615             onError,
22616             lineNumber,
22617             expectedSpaces,
22618             actualSpaces,
22619             null,
22620             null,
22621             [ 1, matchLength ],
22622             fixInfo
22623           );
22624         }
22625       });
22626     });
22627   }
22628 };
22629
22630
22631 /***/ }),
22632 /* 138 */
22633 /***/ (function(module, exports, __webpack_require__) {
22634
22635 "use strict";
22636 // @ts-check
22637
22638
22639
22640 const { addErrorContext, forEachLine, isBlankLine } = __webpack_require__(110);
22641 const { lineMetadata } = __webpack_require__(115);
22642
22643 const codeFencePrefixRe = /^(.*?)\s*[`~]/;
22644
22645 module.exports = {
22646   "names": [ "MD031", "blanks-around-fences" ],
22647   "description": "Fenced code blocks should be surrounded by blank lines",
22648   "tags": [ "code", "blank_lines" ],
22649   "function": function MD031(params, onError) {
22650     const listItems = params.config.list_items;
22651     const includeListItems = (listItems === undefined) ? true : !!listItems;
22652     const { lines } = params;
22653     forEachLine(lineMetadata(), (line, i, inCode, onFence, inTable, inItem) => {
22654       const onTopFence = (onFence > 0);
22655       const onBottomFence = (onFence < 0);
22656       if ((includeListItems || !inItem) &&
22657           ((onTopFence && !isBlankLine(lines[i - 1])) ||
22658            (onBottomFence && !isBlankLine(lines[i + 1])))) {
22659         const [ , prefix ] = line.match(codeFencePrefixRe);
22660         addErrorContext(
22661           onError,
22662           i + 1,
22663           lines[i].trim(),
22664           null,
22665           null,
22666           null,
22667           {
22668             "lineNumber": i + (onTopFence ? 1 : 2),
22669             "insertText": `${prefix}\n`
22670           });
22671       }
22672     });
22673   }
22674 };
22675
22676
22677 /***/ }),
22678 /* 139 */
22679 /***/ (function(module, exports, __webpack_require__) {
22680
22681 "use strict";
22682 // @ts-check
22683
22684
22685
22686 const { addErrorContext, isBlankLine } = __webpack_require__(110);
22687 const { flattenedLists } = __webpack_require__(115);
22688
22689 const quotePrefixRe = /^[>\s]*/;
22690
22691 module.exports = {
22692   "names": [ "MD032", "blanks-around-lists" ],
22693   "description": "Lists should be surrounded by blank lines",
22694   "tags": [ "bullet", "ul", "ol", "blank_lines" ],
22695   "function": function MD032(params, onError) {
22696     const { lines } = params;
22697     flattenedLists().filter((list) => !list.nesting).forEach((list) => {
22698       const firstIndex = list.open.map[0];
22699       if (!isBlankLine(lines[firstIndex - 1])) {
22700         const line = lines[firstIndex];
22701         const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
22702         addErrorContext(
22703           onError,
22704           firstIndex + 1,
22705           line.trim(),
22706           null,
22707           null,
22708           null,
22709           {
22710             "insertText": `${quotePrefix}\n`
22711           });
22712       }
22713       const lastIndex = list.lastLineIndex - 1;
22714       if (!isBlankLine(lines[lastIndex + 1])) {
22715         const line = lines[lastIndex];
22716         const quotePrefix = line.match(quotePrefixRe)[0].trimRight();
22717         addErrorContext(
22718           onError,
22719           lastIndex + 1,
22720           line.trim(),
22721           null,
22722           null,
22723           null,
22724           {
22725             "lineNumber": lastIndex + 2,
22726             "insertText": `${quotePrefix}\n`
22727           });
22728       }
22729     });
22730   }
22731 };
22732
22733
22734 /***/ }),
22735 /* 140 */
22736 /***/ (function(module, exports, __webpack_require__) {
22737
22738 "use strict";
22739 // @ts-check
22740
22741
22742
22743 const { addError, forEachLine, unescapeMarkdown } = __webpack_require__(110);
22744 const { lineMetadata } = __webpack_require__(115);
22745
22746 const htmlElementRe = /<(([A-Za-z][A-Za-z0-9-]*)(?:\s[^>]*)?)\/?>/g;
22747 const linkDestinationRe = /]\(\s*$/;
22748 const inlineCodeRe = /^[^`]*(`+[^`]+`+[^`]+)*`+[^`]*$/;
22749 // See https://spec.commonmark.org/0.29/#autolinks
22750 const emailAddressRe =
22751   // eslint-disable-next-line max-len
22752   /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
22753
22754 module.exports = {
22755   "names": [ "MD033", "no-inline-html" ],
22756   "description": "Inline HTML",
22757   "tags": [ "html" ],
22758   "function": function MD033(params, onError) {
22759     let allowedElements = params.config.allowed_elements;
22760     allowedElements = Array.isArray(allowedElements) ? allowedElements : [];
22761     allowedElements = allowedElements.map((element) => element.toLowerCase());
22762     forEachLine(lineMetadata(), (line, lineIndex, inCode) => {
22763       let match = null;
22764       // eslint-disable-next-line no-unmodified-loop-condition
22765       while (!inCode && ((match = htmlElementRe.exec(line)) !== null)) {
22766         const [ tag, content, element ] = match;
22767         if (!allowedElements.includes(element.toLowerCase()) &&
22768           !tag.endsWith("\\>") &&
22769           !emailAddressRe.test(content)) {
22770           const prefix = line.substring(0, match.index);
22771           if (!linkDestinationRe.test(prefix) && !inlineCodeRe.test(prefix)) {
22772             const unescaped = unescapeMarkdown(prefix + "<", "_");
22773             if (!unescaped.endsWith("_") &&
22774               ((unescaped + "`").match(/`/g).length % 2)) {
22775               addError(onError, lineIndex + 1, "Element: " + element,
22776                 null, [ match.index + 1, tag.length ]);
22777             }
22778           }
22779         }
22780       }
22781     });
22782   }
22783 };
22784
22785
22786 /***/ }),
22787 /* 141 */
22788 /***/ (function(module, exports, __webpack_require__) {
22789
22790 "use strict";
22791 // @ts-check
22792
22793
22794
22795 const { addErrorContext, bareUrlRe, filterTokens } = __webpack_require__(110);
22796
22797 module.exports = {
22798   "names": [ "MD034", "no-bare-urls" ],
22799   "description": "Bare URL used",
22800   "tags": [ "links", "url" ],
22801   "function": function MD034(params, onError) {
22802     filterTokens(params, "inline", (token) => {
22803       let inLink = false;
22804       token.children.forEach((child) => {
22805         const { content, line, lineNumber, type } = child;
22806         let match = null;
22807         if (type === "link_open") {
22808           inLink = true;
22809         } else if (type === "link_close") {
22810           inLink = false;
22811         } else if ((type === "text") && !inLink) {
22812           while ((match = bareUrlRe.exec(content)) !== null) {
22813             const [ bareUrl ] = match;
22814             const matchIndex = match.index;
22815             const bareUrlLength = bareUrl.length;
22816             // Allow "[https://example.com]" to avoid conflicts with
22817             // MD011/no-reversed-links; allow quoting as another way
22818             // of deliberately including a bare URL
22819             const leftChar = content[matchIndex - 1];
22820             const rightChar = content[matchIndex + bareUrlLength];
22821             if (
22822               !((leftChar === "[") && (rightChar === "]")) &&
22823               !((leftChar === "\"") && (rightChar === "\"")) &&
22824               !((leftChar === "'") && (rightChar === "'"))
22825             ) {
22826               const index = line.indexOf(content);
22827               const range = (index === -1) ? null : [
22828                 index + matchIndex + 1,
22829                 bareUrlLength
22830               ];
22831               const fixInfo = range ? {
22832                 "editColumn": range[0],
22833                 "deleteCount": range[1],
22834                 "insertText": `<${bareUrl}>`
22835               } : null;
22836               addErrorContext(
22837                 onError,
22838                 lineNumber,
22839                 bareUrl,
22840                 null,
22841                 null,
22842                 range,
22843                 fixInfo
22844               );
22845             }
22846           }
22847         }
22848       });
22849     });
22850   }
22851 };
22852
22853
22854 /***/ }),
22855 /* 142 */
22856 /***/ (function(module, exports, __webpack_require__) {
22857
22858 "use strict";
22859 // @ts-check
22860
22861
22862
22863 const { addErrorDetailIf, filterTokens } = __webpack_require__(110);
22864
22865 module.exports = {
22866   "names": [ "MD035", "hr-style" ],
22867   "description": "Horizontal rule style",
22868   "tags": [ "hr" ],
22869   "function": function MD035(params, onError) {
22870     let style = String(params.config.style || "consistent");
22871     filterTokens(params, "hr", function forToken(token) {
22872       const lineTrim = token.line.trim();
22873       if (style === "consistent") {
22874         style = lineTrim;
22875       }
22876       addErrorDetailIf(onError, token.lineNumber, style, lineTrim);
22877     });
22878   }
22879 };
22880
22881
22882 /***/ }),
22883 /* 143 */
22884 /***/ (function(module, exports, __webpack_require__) {
22885
22886 "use strict";
22887 // @ts-check
22888
22889
22890
22891 const { addErrorContext, allPunctuation } = __webpack_require__(110);
22892
22893 module.exports = {
22894   "names": [ "MD036", "no-emphasis-as-heading", "no-emphasis-as-header" ],
22895   "description": "Emphasis used instead of a heading",
22896   "tags": [ "headings", "headers", "emphasis" ],
22897   "function": function MD036(params, onError) {
22898     let punctuation = params.config.punctuation;
22899     punctuation =
22900       String((punctuation === undefined) ? allPunctuation : punctuation);
22901     const re = new RegExp("[" + punctuation + "]$");
22902     // eslint-disable-next-line jsdoc/require-jsdoc
22903     function base(token) {
22904       if (token.type === "paragraph_open") {
22905         return function inParagraph(t) {
22906           // Always paragraph_open/inline/paragraph_close,
22907           const children = t.children.filter(function notEmptyText(child) {
22908             return (child.type !== "text") || (child.content !== "");
22909           });
22910           if ((children.length === 3) &&
22911               ((children[0].type === "strong_open") ||
22912                 (children[0].type === "em_open")) &&
22913               (children[1].type === "text") &&
22914               !re.test(children[1].content)) {
22915             addErrorContext(onError, t.lineNumber,
22916               children[1].content);
22917           }
22918           return base;
22919         };
22920       } else if (token.type === "blockquote_open") {
22921         return function inBlockquote(t) {
22922           if (t.type !== "blockquote_close") {
22923             return inBlockquote;
22924           }
22925           return base;
22926         };
22927       } else if (token.type === "list_item_open") {
22928         return function inListItem(t) {
22929           if (t.type !== "list_item_close") {
22930             return inListItem;
22931           }
22932           return base;
22933         };
22934       }
22935       return base;
22936     }
22937     let state = base;
22938     params.tokens.forEach(function forToken(token) {
22939       state = state(token);
22940     });
22941   }
22942 };
22943
22944
22945 /***/ }),
22946 /* 144 */
22947 /***/ (function(module, exports, __webpack_require__) {
22948
22949 "use strict";
22950 // @ts-check
22951
22952
22953
22954 const { addErrorContext, emphasisMarkersInContent, forEachLine, isBlankLine } =
22955   __webpack_require__(110);
22956 const { lineMetadata } = __webpack_require__(115);
22957
22958 const emphasisRe = /(^|[^\\]|\\\\)(?:(\*\*?\*?)|(__?_?))/g;
22959 const asteriskListItemMarkerRe = /^([\s>]*)\*(\s+)/;
22960 const leftSpaceRe = /^\s+/;
22961 const rightSpaceRe = /\s+$/;
22962
22963 module.exports = {
22964   "names": [ "MD037", "no-space-in-emphasis" ],
22965   "description": "Spaces inside emphasis markers",
22966   "tags": [ "whitespace", "emphasis" ],
22967   "function": function MD037(params, onError) {
22968     // eslint-disable-next-line init-declarations
22969     let effectiveEmphasisLength, emphasisIndex, emphasisKind, emphasisLength,
22970       pendingError = null;
22971     // eslint-disable-next-line jsdoc/require-jsdoc
22972     function resetRunTracking() {
22973       emphasisIndex = -1;
22974       emphasisLength = 0;
22975       emphasisKind = "";
22976       effectiveEmphasisLength = 0;
22977       pendingError = null;
22978     }
22979     // eslint-disable-next-line jsdoc/require-jsdoc
22980     function handleRunEnd(line, lineIndex, contextLength, match, matchIndex) {
22981       // Close current run
22982       let content = line.substring(emphasisIndex, matchIndex);
22983       if (!emphasisLength) {
22984         content = content.trimStart();
22985       }
22986       if (!match) {
22987         content = content.trimEnd();
22988       }
22989       const leftSpace = leftSpaceRe.test(content);
22990       const rightSpace = rightSpaceRe.test(content);
22991       if (leftSpace || rightSpace) {
22992         // Report the violation
22993         const contextStart = emphasisIndex - emphasisLength;
22994         const contextEnd = matchIndex + contextLength;
22995         const context = line.substring(contextStart, contextEnd);
22996         const column = contextStart + 1;
22997         const length = contextEnd - contextStart;
22998         const leftMarker = line.substring(contextStart, emphasisIndex);
22999         const rightMarker = match ? (match[2] || match[3]) : "";
23000         const fixedText = `${leftMarker}${content.trim()}${rightMarker}`;
23001         return [
23002           onError,
23003           lineIndex + 1,
23004           context,
23005           leftSpace,
23006           rightSpace,
23007           [ column, length ],
23008           {
23009             "editColumn": column,
23010             "deleteCount": length,
23011             "insertText": fixedText
23012           }
23013         ];
23014       }
23015       return null;
23016     }
23017     // Initialize
23018     const ignoreMarkersByLine = emphasisMarkersInContent(params);
23019     resetRunTracking();
23020     forEachLine(
23021       lineMetadata(),
23022       (line, lineIndex, inCode, onFence, inTable, inItem, onBreak) => {
23023         const onItemStart = (inItem === 1);
23024         if (inCode || inTable || onBreak || onItemStart || isBlankLine(line)) {
23025           // Emphasis resets when leaving a block
23026           resetRunTracking();
23027         }
23028         if (inCode || onBreak) {
23029           // Emphasis has no meaning here
23030           return;
23031         }
23032         if (onItemStart) {
23033           // Trim overlapping '*' list item marker
23034           line = line.replace(asteriskListItemMarkerRe, "$1 $2");
23035         }
23036         let match = null;
23037         // Match all emphasis-looking runs in the line...
23038         while ((match = emphasisRe.exec(line))) {
23039           const ignoreMarkersForLine = ignoreMarkersByLine[lineIndex] || [];
23040           const matchIndex = match.index + match[1].length;
23041           if (ignoreMarkersForLine.includes(matchIndex)) {
23042             // Ignore emphasis markers inside code spans and links
23043             continue;
23044           }
23045           const matchLength = match[0].length - match[1].length;
23046           const matchKind = (match[2] || match[3])[0];
23047           if (emphasisIndex === -1) {
23048             // New run
23049             emphasisIndex = matchIndex + matchLength;
23050             emphasisLength = matchLength;
23051             emphasisKind = matchKind;
23052             effectiveEmphasisLength = matchLength;
23053           } else if (matchKind === emphasisKind) {
23054             // Matching emphasis markers
23055             if (matchLength === effectiveEmphasisLength) {
23056               // Ending an existing run, report any pending error
23057               if (pendingError) {
23058                 addErrorContext(...pendingError);
23059                 pendingError = null;
23060               }
23061               const error = handleRunEnd(
23062                 line, lineIndex, effectiveEmphasisLength, match, matchIndex);
23063               if (error) {
23064                 addErrorContext(...error);
23065               }
23066               // Reset
23067               resetRunTracking();
23068             } else if (matchLength === 3) {
23069               // Swap internal run length (1->2 or 2->1)
23070               effectiveEmphasisLength = matchLength - effectiveEmphasisLength;
23071             } else if (effectiveEmphasisLength === 3) {
23072               // Downgrade internal run (3->1 or 3->2)
23073               effectiveEmphasisLength -= matchLength;
23074             } else {
23075               // Upgrade to internal run (1->3 or 2->3)
23076               effectiveEmphasisLength += matchLength;
23077             }
23078             // Back up one character so RegExp has a chance to match the
23079             // next marker (ex: "**star**_underscore_")
23080             if (emphasisRe.lastIndex > 1) {
23081               emphasisRe.lastIndex--;
23082             }
23083           } else if (emphasisRe.lastIndex > 1) {
23084             // Back up one character so RegExp has a chance to match the
23085             // mis-matched marker (ex: "*text_*")
23086             emphasisRe.lastIndex--;
23087           }
23088         }
23089         if (emphasisIndex !== -1) {
23090           pendingError = pendingError ||
23091             handleRunEnd(line, lineIndex, 0, null, line.length);
23092           // Adjust for pending run on new line
23093           emphasisIndex = 0;
23094           emphasisLength = 0;
23095         }
23096       }
23097     );
23098   }
23099 };
23100
23101
23102 /***/ }),
23103 /* 145 */
23104 /***/ (function(module, exports, __webpack_require__) {
23105
23106 "use strict";
23107 // @ts-check
23108
23109
23110
23111 const { addErrorContext, filterTokens, forEachInlineCodeSpan, newLineRe } =
23112   __webpack_require__(110);
23113
23114 const leftSpaceRe = /^\s([^`]|$)/;
23115 const rightSpaceRe = /[^`]\s$/;
23116 const singleLeftRightSpaceRe = /^\s(?:\S.*\S|\S)\s$/;
23117
23118 module.exports = {
23119   "names": [ "MD038", "no-space-in-code" ],
23120   "description": "Spaces inside code span elements",
23121   "tags": [ "whitespace", "code" ],
23122   "function": function MD038(params, onError) {
23123     filterTokens(params, "inline", (token) => {
23124       if (token.children.some((child) => child.type === "code_inline")) {
23125         const tokenLines = params.lines.slice(token.map[0], token.map[1]);
23126         forEachInlineCodeSpan(
23127           tokenLines.join("\n"),
23128           (code, lineIndex, columnIndex, tickCount) => {
23129             let rangeIndex = columnIndex - tickCount;
23130             let rangeLength = code.length + (2 * tickCount);
23131             let rangeLineOffset = 0;
23132             let fixIndex = columnIndex;
23133             let fixLength = code.length;
23134             const codeLines = code.split(newLineRe);
23135             const left = leftSpaceRe.test(code);
23136             const right = !left && rightSpaceRe.test(code);
23137             if (right && (codeLines.length > 1)) {
23138               rangeIndex = 0;
23139               rangeLineOffset = codeLines.length - 1;
23140               fixIndex = 0;
23141             }
23142             const allowed = singleLeftRightSpaceRe.test(code);
23143             if ((left || right) && !allowed) {
23144               const codeLinesRange = codeLines[rangeLineOffset];
23145               if (codeLines.length > 1) {
23146                 rangeLength = codeLinesRange.length + tickCount;
23147                 fixLength = codeLinesRange.length;
23148               }
23149               const context = tokenLines[lineIndex + rangeLineOffset]
23150                 .substring(rangeIndex, rangeIndex + rangeLength);
23151               const codeLinesRangeTrim = codeLinesRange.trim();
23152               const fixText =
23153                 (codeLinesRangeTrim.startsWith("`") ? " " : "") +
23154                 codeLinesRangeTrim +
23155                 (codeLinesRangeTrim.endsWith("`") ? " " : "");
23156               addErrorContext(
23157                 onError,
23158                 token.lineNumber + lineIndex + rangeLineOffset,
23159                 context,
23160                 left,
23161                 right,
23162                 [ rangeIndex + 1, rangeLength ],
23163                 {
23164                   "editColumn": fixIndex + 1,
23165                   "deleteCount": fixLength,
23166                   "insertText": fixText
23167                 }
23168               );
23169             }
23170           });
23171       }
23172     });
23173   }
23174 };
23175
23176
23177 /***/ }),
23178 /* 146 */
23179 /***/ (function(module, exports, __webpack_require__) {
23180
23181 "use strict";
23182 // @ts-check
23183
23184
23185
23186 const { addErrorContext, filterTokens } = __webpack_require__(110);
23187
23188 const spaceInLinkRe = /\[(?:\s+(?:[^\]]*?)\s*|(?:[^\]]*?)\s+)](?=\(\S*\))/;
23189
23190 module.exports = {
23191   "names": [ "MD039", "no-space-in-links" ],
23192   "description": "Spaces inside link text",
23193   "tags": [ "whitespace", "links" ],
23194   "function": function MD039(params, onError) {
23195     filterTokens(params, "inline", (token) => {
23196       const { children } = token;
23197       let { lineNumber } = token;
23198       let inLink = false;
23199       let linkText = "";
23200       let lineIndex = 0;
23201       children.forEach((child) => {
23202         const { content, type } = child;
23203         if (type === "link_open") {
23204           inLink = true;
23205           linkText = "";
23206         } else if (type === "link_close") {
23207           inLink = false;
23208           const left = linkText.trimLeft().length !== linkText.length;
23209           const right = linkText.trimRight().length !== linkText.length;
23210           if (left || right) {
23211             const line = params.lines[lineNumber - 1];
23212             let range = null;
23213             let fixInfo = null;
23214             const match = line.slice(lineIndex).match(spaceInLinkRe);
23215             if (match) {
23216               const column = match.index + lineIndex + 1;
23217               const length = match[0].length;
23218               range = [ column, length ];
23219               fixInfo = {
23220                 "editColumn": column + 1,
23221                 "deleteCount": length - 2,
23222                 "insertText": linkText.trim()
23223               };
23224               lineIndex = column + length - 1;
23225             }
23226             addErrorContext(
23227               onError,
23228               lineNumber,
23229               `[${linkText}]`,
23230               left,
23231               right,
23232               range,
23233               fixInfo
23234             );
23235           }
23236         } else if ((type === "softbreak") || (type === "hardbreak")) {
23237           lineNumber++;
23238           lineIndex = 0;
23239         } else if (inLink) {
23240           linkText += content;
23241         }
23242       });
23243     });
23244   }
23245 };
23246
23247
23248 /***/ }),
23249 /* 147 */
23250 /***/ (function(module, exports, __webpack_require__) {
23251
23252 "use strict";
23253 // @ts-check
23254
23255
23256
23257 const { addErrorContext, filterTokens } = __webpack_require__(110);
23258
23259 module.exports = {
23260   "names": [ "MD040", "fenced-code-language" ],
23261   "description": "Fenced code blocks should have a language specified",
23262   "tags": [ "code", "language" ],
23263   "function": function MD040(params, onError) {
23264     filterTokens(params, "fence", function forToken(token) {
23265       if (!token.info.trim()) {
23266         addErrorContext(onError, token.lineNumber, token.line);
23267       }
23268     });
23269   }
23270 };
23271
23272
23273 /***/ }),
23274 /* 148 */
23275 /***/ (function(module, exports, __webpack_require__) {
23276
23277 "use strict";
23278 // @ts-check
23279
23280
23281
23282 const { addErrorContext, frontMatterHasTitle } = __webpack_require__(110);
23283
23284 module.exports = {
23285   "names": [ "MD041", "first-line-heading", "first-line-h1" ],
23286   "description": "First line in file should be a top level heading",
23287   "tags": [ "headings", "headers" ],
23288   "function": function MD041(params, onError) {
23289     const level = Number(params.config.level || 1);
23290     const tag = "h" + level;
23291     const foundFrontMatterTitle =
23292       frontMatterHasTitle(
23293         params.frontMatterLines,
23294         params.config.front_matter_title
23295       );
23296     if (!foundFrontMatterTitle) {
23297       params.tokens.every((token) => {
23298         if (token.type === "html_block") {
23299           return true;
23300         }
23301         if ((token.type !== "heading_open") || (token.tag !== tag)) {
23302           addErrorContext(onError, token.lineNumber, token.line);
23303         }
23304         return false;
23305       });
23306     }
23307   }
23308 };
23309
23310
23311 /***/ }),
23312 /* 149 */
23313 /***/ (function(module, exports, __webpack_require__) {
23314
23315 "use strict";
23316 // @ts-check
23317
23318
23319
23320 const { addErrorContext, filterTokens, rangeFromRegExp } =
23321   __webpack_require__(110);
23322
23323 const emptyLinkRe = /\[[^\]]*](?:\((?:#?|(?:<>))\))/;
23324
23325 module.exports = {
23326   "names": [ "MD042", "no-empty-links" ],
23327   "description": "No empty links",
23328   "tags": [ "links" ],
23329   "function": function MD042(params, onError) {
23330     filterTokens(params, "inline", function forToken(token) {
23331       let inLink = false;
23332       let linkText = "";
23333       let emptyLink = false;
23334       token.children.forEach(function forChild(child) {
23335         if (child.type === "link_open") {
23336           inLink = true;
23337           linkText = "";
23338           child.attrs.forEach(function forAttr(attr) {
23339             if (attr[0] === "href" && (!attr[1] || (attr[1] === "#"))) {
23340               emptyLink = true;
23341             }
23342           });
23343         } else if (child.type === "link_close") {
23344           inLink = false;
23345           if (emptyLink) {
23346             addErrorContext(onError, child.lineNumber,
23347               "[" + linkText + "]()", null, null,
23348               rangeFromRegExp(child.line, emptyLinkRe));
23349           }
23350         } else if (inLink) {
23351           linkText += child.content;
23352         }
23353       });
23354     });
23355   }
23356 };
23357
23358
23359 /***/ }),
23360 /* 150 */
23361 /***/ (function(module, exports, __webpack_require__) {
23362
23363 "use strict";
23364 // @ts-check
23365
23366
23367
23368 const { addErrorContext, addErrorDetailIf, forEachHeading } =
23369   __webpack_require__(110);
23370
23371 module.exports = {
23372   "names": [ "MD043", "required-headings", "required-headers" ],
23373   "description": "Required heading structure",
23374   "tags": [ "headings", "headers" ],
23375   "function": function MD043(params, onError) {
23376     const requiredHeadings = params.config.headings || params.config.headers;
23377     if (Array.isArray(requiredHeadings)) {
23378       const levels = {};
23379       [ 1, 2, 3, 4, 5, 6 ].forEach(function forLevel(level) {
23380         levels["h" + level] = "######".substr(-level);
23381       });
23382       let i = 0;
23383       let optional = false;
23384       let errorCount = 0;
23385       forEachHeading(params, function forHeading(heading, content) {
23386         if (!errorCount) {
23387           const actual = levels[heading.tag] + " " + content;
23388           const expected = requiredHeadings[i++] || "[None]";
23389           if (expected === "*") {
23390             optional = true;
23391           } else if (expected.toLowerCase() === actual.toLowerCase()) {
23392             optional = false;
23393           } else if (optional) {
23394             i--;
23395           } else {
23396             addErrorDetailIf(onError, heading.lineNumber,
23397               expected, actual);
23398             errorCount++;
23399           }
23400         }
23401       });
23402       if ((i < requiredHeadings.length) && !errorCount) {
23403         addErrorContext(onError, params.lines.length,
23404           requiredHeadings[i]);
23405       }
23406     }
23407   }
23408 };
23409
23410
23411 /***/ }),
23412 /* 151 */
23413 /***/ (function(module, exports, __webpack_require__) {
23414
23415 "use strict";
23416 // @ts-check
23417
23418
23419
23420 const { addErrorDetailIf, bareUrlRe, escapeForRegExp, filterTokens,
23421   forEachInlineChild, newLineRe } = __webpack_require__(110);
23422
23423 const startNonWordRe = /^\W/;
23424 const endNonWordRe = /\W$/;
23425
23426 module.exports = {
23427   "names": [ "MD044", "proper-names" ],
23428   "description": "Proper names should have the correct capitalization",
23429   "tags": [ "spelling" ],
23430   "function": function MD044(params, onError) {
23431     let names = params.config.names;
23432     names = Array.isArray(names) ? names : [];
23433     const codeBlocks = params.config.code_blocks;
23434     const includeCodeBlocks = (codeBlocks === undefined) ? true : !!codeBlocks;
23435     names.forEach((name) => {
23436       const escapedName = escapeForRegExp(name);
23437       const startNamePattern = startNonWordRe.test(name) ? "" : "\\S*\\b";
23438       const endNamePattern = endNonWordRe.test(name) ? "" : "\\b\\S*";
23439       const namePattern =
23440         `(${startNamePattern})(${escapedName})(${endNamePattern})`;
23441       const anyNameRe = new RegExp(namePattern, "gi");
23442       // eslint-disable-next-line jsdoc/require-jsdoc
23443       function forToken(token) {
23444         const fenceOffset = (token.type === "fence") ? 1 : 0;
23445         token.content.split(newLineRe)
23446           .forEach((line, index) => {
23447             let match = null;
23448             while ((match = anyNameRe.exec(line)) !== null) {
23449               const [ fullMatch, leftMatch, nameMatch, rightMatch ] = match;
23450               if (fullMatch.search(bareUrlRe) === -1) {
23451                 const wordMatch = fullMatch
23452                   .replace(new RegExp(`^\\W{0,${leftMatch.length}}`), "")
23453                   .replace(new RegExp(`\\W{0,${rightMatch.length}}$`), "");
23454                 if (!names.includes(wordMatch)) {
23455                   const lineNumber = token.lineNumber + index + fenceOffset;
23456                   const fullLine = params.lines[lineNumber - 1];
23457                   const matchLength = wordMatch.length;
23458                   const matchIndex = fullLine.indexOf(wordMatch);
23459                   const range = (matchIndex === -1) ?
23460                     null :
23461                     [ matchIndex + 1, matchLength ];
23462                   const fixInfo = (matchIndex === -1) ?
23463                     null :
23464                     {
23465                       "editColumn": matchIndex + 1,
23466                       "deleteCount": matchLength,
23467                       "insertText": name
23468                     };
23469                   addErrorDetailIf(
23470                     onError,
23471                     lineNumber,
23472                     name,
23473                     nameMatch,
23474                     null,
23475                     null,
23476                     range,
23477                     fixInfo
23478                   );
23479                 }
23480               }
23481             }
23482           });
23483       }
23484       forEachInlineChild(params, "text", forToken);
23485       if (includeCodeBlocks) {
23486         forEachInlineChild(params, "code_inline", forToken);
23487         filterTokens(params, "code_block", forToken);
23488         filterTokens(params, "fence", forToken);
23489       }
23490     });
23491   }
23492 };
23493
23494
23495 /***/ }),
23496 /* 152 */
23497 /***/ (function(module, exports, __webpack_require__) {
23498
23499 "use strict";
23500 // @ts-check
23501
23502
23503
23504 const { addError, forEachInlineChild } = __webpack_require__(110);
23505
23506 module.exports = {
23507   "names": [ "MD045", "no-alt-text" ],
23508   "description": "Images should have alternate text (alt text)",
23509   "tags": [ "accessibility", "images" ],
23510   "function": function MD045(params, onError) {
23511     forEachInlineChild(params, "image", function forToken(token) {
23512       if (token.content === "") {
23513         addError(onError, token.lineNumber);
23514       }
23515     });
23516   }
23517 };
23518
23519
23520 /***/ }),
23521 /* 153 */
23522 /***/ (function(module, exports, __webpack_require__) {
23523
23524 "use strict";
23525 // @ts-check
23526
23527
23528
23529 const { addErrorDetailIf } = __webpack_require__(110);
23530
23531 const tokenTypeToStyle = {
23532   "fence": "fenced",
23533   "code_block": "indented"
23534 };
23535
23536 module.exports = {
23537   "names": [ "MD046", "code-block-style" ],
23538   "description": "Code block style",
23539   "tags": [ "code" ],
23540   "function": function MD046(params, onError) {
23541     let expectedStyle = String(params.config.style || "consistent");
23542     params.tokens
23543       .filter((token) => token.type === "code_block" || token.type === "fence")
23544       .forEach((token) => {
23545         const { lineNumber, type } = token;
23546         if (expectedStyle === "consistent") {
23547           expectedStyle = tokenTypeToStyle[type];
23548         }
23549         addErrorDetailIf(
23550           onError,
23551           lineNumber,
23552           expectedStyle,
23553           tokenTypeToStyle[type]);
23554       });
23555   }
23556 };
23557
23558
23559 /***/ }),
23560 /* 154 */
23561 /***/ (function(module, exports, __webpack_require__) {
23562
23563 "use strict";
23564 // @ts-check
23565
23566
23567
23568 const { addError, isBlankLine } = __webpack_require__(110);
23569
23570 module.exports = {
23571   "names": [ "MD047", "single-trailing-newline" ],
23572   "description": "Files should end with a single newline character",
23573   "tags": [ "blank_lines" ],
23574   "function": function MD047(params, onError) {
23575     const lastLineNumber = params.lines.length;
23576     const lastLine = params.lines[lastLineNumber - 1];
23577     if (!isBlankLine(lastLine)) {
23578       addError(
23579         onError,
23580         lastLineNumber,
23581         null,
23582         null,
23583         [ lastLine.length, 1 ],
23584         {
23585           "insertText": "\n",
23586           "editColumn": lastLine.length + 1
23587         }
23588       );
23589     }
23590   }
23591 };
23592
23593
23594 /***/ }),
23595 /* 155 */
23596 /***/ (function(module, exports, __webpack_require__) {
23597
23598 "use strict";
23599 // @ts-check
23600
23601
23602
23603 const { addErrorDetailIf, fencedCodeBlockStyleFor } = __webpack_require__(110);
23604
23605 module.exports = {
23606   "names": [ "MD048", "code-fence-style" ],
23607   "description": "Code fence style",
23608   "tags": [ "code" ],
23609   "function": function MD048(params, onError) {
23610     const style = String(params.config.style || "consistent");
23611     let expectedStyle = style;
23612     params.tokens
23613       .filter((token) => token.type === "fence")
23614       .forEach((fenceToken) => {
23615         const { lineNumber, markup } = fenceToken;
23616         if (expectedStyle === "consistent") {
23617           expectedStyle = fencedCodeBlockStyleFor(markup);
23618         }
23619         addErrorDetailIf(
23620           onError,
23621           lineNumber,
23622           expectedStyle,
23623           fencedCodeBlockStyleFor(markup)
23624         );
23625       });
23626   }
23627 };
23628
23629
23630 /***/ }),
23631 /* 156 */
23632 /***/ (function(module, exports, __webpack_require__) {
23633
23634 "use strict";
23635 // @ts-check
23636
23637
23638
23639 const os = __webpack_require__(111);
23640
23641 // Regular expression for matching common newline characters
23642 // See NEWLINES_RE in markdown-it/lib/rules_core/normalize.js
23643 const newLineRe = /\r\n?|\n/g;
23644 module.exports.newLineRe = newLineRe;
23645
23646 // Regular expression for matching common front matter (YAML and TOML)
23647 module.exports.frontMatterRe =
23648   // eslint-disable-next-line max-len
23649   /((^---\s*$[^]*?^---\s*$)|(^\+\+\+\s*$[^]*?^(\+\+\+|\.\.\.)\s*$))(\r\n|\r|\n|$)/m;
23650
23651 // Regular expression for matching inline disable/enable comments
23652 const inlineCommentRe =
23653   // eslint-disable-next-line max-len
23654   /<!--\s*markdownlint-(?:(?:(disable|enable|capture|restore|disable-file|enable-file)((?:\s+[a-z0-9_-]+)*))|(?:(configure-file)\s+([\s\S]*?)))\s*-->/ig;
23655 module.exports.inlineCommentRe = inlineCommentRe;
23656
23657 // Regular expressions for range matching
23658 module.exports.bareUrlRe = /(?:http|ftp)s?:\/\/[^\s\]"']*(?:\/|[^\s\]"'\W])/ig;
23659 module.exports.listItemMarkerRe = /^([\s>]*)(?:[*+-]|\d+[.)])\s+/;
23660 module.exports.orderedListItemMarkerRe = /^[\s>]*0*(\d+)[.)]/;
23661
23662 // Regular expression for all instances of emphasis markers
23663 const emphasisMarkersRe = /[_*]/g;
23664
23665 // Regular expression for inline links and shortcut reference links
23666 const linkRe = /\[(?:[^[\]]|\[[^\]]*\])*\](?:\(\S*\))?/g;
23667
23668 // readFile options for reading with the UTF-8 encoding
23669 module.exports.utf8Encoding = { "encoding": "utf8" };
23670
23671 // All punctuation characters (normal and full-width)
23672 module.exports.allPunctuation = ".,;:!?。,;:!?";
23673
23674 // Returns true iff the input is a number
23675 module.exports.isNumber = function isNumber(obj) {
23676   return typeof obj === "number";
23677 };
23678
23679 // Returns true iff the input is a string
23680 module.exports.isString = function isString(obj) {
23681   return typeof obj === "string";
23682 };
23683
23684 // Returns true iff the input string is empty
23685 module.exports.isEmptyString = function isEmptyString(str) {
23686   return str.length === 0;
23687 };
23688
23689 // Returns true iff the input is an object
23690 module.exports.isObject = function isObject(obj) {
23691   return (obj !== null) && (typeof obj === "object") && !Array.isArray(obj);
23692 };
23693
23694 // Returns true iff the input line is blank (no content)
23695 // Example: Contains nothing, whitespace, or comments
23696 const blankLineRe = />|(?:<!--.*?-->)/g;
23697 module.exports.isBlankLine = function isBlankLine(line) {
23698   return !line || !line.trim() || !line.replace(blankLineRe, "").trim();
23699 };
23700
23701 /**
23702  * Compare function for Array.prototype.sort for ascending order of numbers.
23703  *
23704  * @param {number} a First number.
23705  * @param {number} b Second number.
23706  * @returns {number} Positive value if a>b, negative value if b<a, 0 otherwise.
23707  */
23708 module.exports.numericSortAscending = function numericSortAscending(a, b) {
23709   return a - b;
23710 };
23711
23712 // Returns true iff the sorted array contains the specified element
23713 module.exports.includesSorted = function includesSorted(array, element) {
23714   let left = 0;
23715   let right = array.length - 1;
23716   while (left <= right) {
23717     /* eslint-disable no-bitwise */
23718     const mid = (left + right) >> 1;
23719     if (array[mid] < element) {
23720       left = mid + 1;
23721     } else if (array[mid] > element) {
23722       right = mid - 1;
23723     } else {
23724       return true;
23725     }
23726   }
23727   return false;
23728 };
23729
23730 // Replaces the text of all properly-formatted HTML comments with whitespace
23731 // This preserves the line/column information for the rest of the document
23732 // Trailing whitespace is avoided with a '\' character in the last column
23733 // See https://www.w3.org/TR/html5/syntax.html#comments for details
23734 const htmlCommentBegin = "<!--";
23735 const htmlCommentEnd = "-->";
23736 module.exports.clearHtmlCommentText = function clearHtmlCommentText(text) {
23737   let i = 0;
23738   while ((i = text.indexOf(htmlCommentBegin, i)) !== -1) {
23739     const j = text.indexOf(htmlCommentEnd, i);
23740     if (j === -1) {
23741       // Un-terminated comments are treated as text
23742       break;
23743     }
23744     const comment = text.slice(i + htmlCommentBegin.length, j);
23745     if ((comment.length > 0) &&
23746         (comment[0] !== ">") &&
23747         (comment[comment.length - 1] !== "-") &&
23748         !comment.includes("--") &&
23749         (text.slice(i, j + htmlCommentEnd.length)
23750           .search(inlineCommentRe) === -1)) {
23751       const blanks = comment
23752         .replace(/[^\r\n]/g, " ")
23753         .replace(/ ([\r\n])/g, "\\$1");
23754       text = text.slice(0, i + htmlCommentBegin.length) +
23755         blanks + text.slice(j);
23756     }
23757     i = j + htmlCommentEnd.length;
23758   }
23759   return text;
23760 };
23761
23762 // Escapes a string for use in a RegExp
23763 module.exports.escapeForRegExp = function escapeForRegExp(str) {
23764   return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
23765 };
23766
23767 // Un-escapes Markdown content (simple algorithm; not a parser)
23768 const escapedMarkdownRe = /\\./g;
23769 module.exports.unescapeMarkdown =
23770   function unescapeMarkdown(markdown, replacement) {
23771     return markdown.replace(escapedMarkdownRe, (match) => {
23772       const char = match[1];
23773       if ("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".includes(char)) {
23774         return replacement || char;
23775       }
23776       return match;
23777     });
23778   };
23779
23780 /**
23781  * Return the string representation of a fence markup character.
23782  *
23783  * @param {string} markup Fence string.
23784  * @returns {string} String representation.
23785  */
23786 module.exports.fencedCodeBlockStyleFor =
23787   function fencedCodeBlockStyleFor(markup) {
23788     switch (markup[0]) {
23789       case "~":
23790         return "tilde";
23791       default:
23792         return "backtick";
23793     }
23794   };
23795
23796 /**
23797  * Return the number of characters of indent for a token.
23798  *
23799  * @param {Object} token MarkdownItToken instance.
23800  * @returns {number} Characters of indent.
23801  */
23802 function indentFor(token) {
23803   const line = token.line.replace(/^[\s>]*(> |>)/, "");
23804   return line.length - line.trimLeft().length;
23805 }
23806 module.exports.indentFor = indentFor;
23807
23808 // Returns the heading style for a heading token
23809 module.exports.headingStyleFor = function headingStyleFor(token) {
23810   if ((token.map[1] - token.map[0]) === 1) {
23811     if (/[^\\]#\s*$/.test(token.line)) {
23812       return "atx_closed";
23813     }
23814     return "atx";
23815   }
23816   return "setext";
23817 };
23818
23819 /**
23820  * Return the string representation of an unordered list marker.
23821  *
23822  * @param {Object} token MarkdownItToken instance.
23823  * @returns {string} String representation.
23824  */
23825 module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
23826   switch (token.markup) {
23827     case "-":
23828       return "dash";
23829     case "+":
23830       return "plus";
23831     // case "*":
23832     default:
23833       return "asterisk";
23834   }
23835 };
23836
23837 /**
23838  * Calls the provided function for each matching token.
23839  *
23840  * @param {Object} params RuleParams instance.
23841  * @param {string} type Token type identifier.
23842  * @param {Function} handler Callback function.
23843  * @returns {void}
23844  */
23845 function filterTokens(params, type, handler) {
23846   params.tokens.forEach(function forToken(token) {
23847     if (token.type === type) {
23848       handler(token);
23849     }
23850   });
23851 }
23852 module.exports.filterTokens = filterTokens;
23853
23854 // Get line metadata array
23855 module.exports.getLineMetadata = function getLineMetadata(params) {
23856   const lineMetadata = params.lines.map(function mapLine(line, index) {
23857     return [ line, index, false, 0, false, false ];
23858   });
23859   filterTokens(params, "fence", function forToken(token) {
23860     lineMetadata[token.map[0]][3] = 1;
23861     lineMetadata[token.map[1] - 1][3] = -1;
23862     for (let i = token.map[0] + 1; i < token.map[1] - 1; i++) {
23863       lineMetadata[i][2] = true;
23864     }
23865   });
23866   filterTokens(params, "code_block", function forToken(token) {
23867     for (let i = token.map[0]; i < token.map[1]; i++) {
23868       lineMetadata[i][2] = true;
23869     }
23870   });
23871   filterTokens(params, "table_open", function forToken(token) {
23872     for (let i = token.map[0]; i < token.map[1]; i++) {
23873       lineMetadata[i][4] = true;
23874     }
23875   });
23876   filterTokens(params, "list_item_open", function forToken(token) {
23877     let count = 1;
23878     for (let i = token.map[0]; i < token.map[1]; i++) {
23879       lineMetadata[i][5] = count;
23880       count++;
23881     }
23882   });
23883   filterTokens(params, "hr", function forToken(token) {
23884     lineMetadata[token.map[0]][6] = true;
23885   });
23886   return lineMetadata;
23887 };
23888
23889 // Calls the provided function for each line (with context)
23890 module.exports.forEachLine = function forEachLine(lineMetadata, handler) {
23891   lineMetadata.forEach(function forMetadata(metadata) {
23892     // Parameters: line, lineIndex, inCode, onFence, inTable, inItem, inBreak
23893     handler(...metadata);
23894   });
23895 };
23896
23897 // Returns (nested) lists as a flat array (in order)
23898 module.exports.flattenLists = function flattenLists(params) {
23899   const flattenedLists = [];
23900   const stack = [];
23901   let current = null;
23902   let nesting = 0;
23903   const nestingStack = [];
23904   let lastWithMap = { "map": [ 0, 1 ] };
23905   params.tokens.forEach(function forToken(token) {
23906     if ((token.type === "bullet_list_open") ||
23907         (token.type === "ordered_list_open")) {
23908       // Save current context and start a new one
23909       stack.push(current);
23910       current = {
23911         "unordered": (token.type === "bullet_list_open"),
23912         "parentsUnordered": !current ||
23913           (current.unordered && current.parentsUnordered),
23914         "open": token,
23915         "indent": indentFor(token),
23916         "parentIndent": (current && current.indent) || 0,
23917         "items": [],
23918         "nesting": nesting,
23919         "lastLineIndex": -1,
23920         "insert": flattenedLists.length
23921       };
23922       nesting++;
23923     } else if ((token.type === "bullet_list_close") ||
23924                (token.type === "ordered_list_close")) {
23925       // Finalize current context and restore previous
23926       current.lastLineIndex = lastWithMap.map[1];
23927       flattenedLists.splice(current.insert, 0, current);
23928       delete current.insert;
23929       current = stack.pop();
23930       nesting--;
23931     } else if (token.type === "list_item_open") {
23932       // Add list item
23933       current.items.push(token);
23934     } else if (token.type === "blockquote_open") {
23935       nestingStack.push(nesting);
23936       nesting = 0;
23937     } else if (token.type === "blockquote_close") {
23938       nesting = nestingStack.pop();
23939     } else if (token.map) {
23940       // Track last token with map
23941       lastWithMap = token;
23942     }
23943   });
23944   return flattenedLists;
23945 };
23946
23947 // Calls the provided function for each specified inline child token
23948 module.exports.forEachInlineChild =
23949 function forEachInlineChild(params, type, handler) {
23950   filterTokens(params, "inline", function forToken(token) {
23951     token.children.forEach(function forChild(child) {
23952       if (child.type === type) {
23953         handler(child, token);
23954       }
23955     });
23956   });
23957 };
23958
23959 // Calls the provided function for each heading's content
23960 module.exports.forEachHeading = function forEachHeading(params, handler) {
23961   let heading = null;
23962   params.tokens.forEach(function forToken(token) {
23963     if (token.type === "heading_open") {
23964       heading = token;
23965     } else if (token.type === "heading_close") {
23966       heading = null;
23967     } else if ((token.type === "inline") && heading) {
23968       handler(heading, token.content);
23969     }
23970   });
23971 };
23972
23973 /**
23974  * Calls the provided function for each inline code span's content.
23975  *
23976  * @param {string} input Markdown content.
23977  * @param {Function} handler Callback function.
23978  * @returns {void}
23979  */
23980 function forEachInlineCodeSpan(input, handler) {
23981   let currentLine = 0;
23982   let currentColumn = 0;
23983   let index = 0;
23984   while (index < input.length) {
23985     let startIndex = -1;
23986     let startLine = -1;
23987     let startColumn = -1;
23988     let tickCount = 0;
23989     let currentTicks = 0;
23990     let state = "normal";
23991     // Deliberate <= so trailing 0 completes the last span (ex: "text `code`")
23992     for (; index <= input.length; index++) {
23993       const char = input[index];
23994       // Ignore backticks in link destination
23995       if ((char === "[") && (state === "normal")) {
23996         state = "linkTextOpen";
23997       } else if ((char === "]") && (state === "linkTextOpen")) {
23998         state = "linkTextClosed";
23999       } else if ((char === "(") && (state === "linkTextClosed")) {
24000         state = "linkDestinationOpen";
24001       } else if (
24002         ((char === "(") && (state === "linkDestinationOpen")) ||
24003         ((char === ")") && (state === "linkDestinationOpen")) ||
24004         (state === "linkTextClosed")) {
24005         state = "normal";
24006       }
24007       // Parse backtick open/close
24008       if ((char === "`") && (state !== "linkDestinationOpen")) {
24009         // Count backticks at start or end of code span
24010         currentTicks++;
24011         if ((startIndex === -1) || (startColumn === -1)) {
24012           startIndex = index + 1;
24013         }
24014       } else {
24015         if ((startIndex >= 0) &&
24016           (startColumn >= 0) &&
24017           (tickCount === currentTicks)) {
24018           // Found end backticks; invoke callback for code span
24019           handler(
24020             input.substring(startIndex, index - currentTicks),
24021             startLine, startColumn, tickCount);
24022           startIndex = -1;
24023           startColumn = -1;
24024         } else if ((startIndex >= 0) && (startColumn === -1)) {
24025           // Found start backticks
24026           tickCount = currentTicks;
24027           startLine = currentLine;
24028           startColumn = currentColumn;
24029         }
24030         // Not in backticks
24031         currentTicks = 0;
24032       }
24033       if (char === "\n") {
24034         // On next line
24035         currentLine++;
24036         currentColumn = 0;
24037       } else if ((char === "\\") &&
24038         ((startIndex === -1) || (startColumn === -1)) &&
24039         (input[index + 1] !== "\n")) {
24040         // Escape character outside code, skip next
24041         index++;
24042         currentColumn += 2;
24043       } else {
24044         // On next column
24045         currentColumn++;
24046       }
24047     }
24048     if (startIndex >= 0) {
24049       // Restart loop after unmatched start backticks (ex: "`text``code``")
24050       index = startIndex;
24051       currentLine = startLine;
24052       currentColumn = startColumn;
24053     }
24054   }
24055 }
24056 module.exports.forEachInlineCodeSpan = forEachInlineCodeSpan;
24057
24058 /**
24059  * Adds a generic error object via the onError callback.
24060  *
24061  * @param {Object} onError RuleOnError instance.
24062  * @param {number} lineNumber Line number.
24063  * @param {string} [detail] Error details.
24064  * @param {string} [context] Error context.
24065  * @param {number[]} [range] Column and length of error.
24066  * @param {Object} [fixInfo] RuleOnErrorFixInfo instance.
24067  * @returns {void}
24068  */
24069 function addError(onError, lineNumber, detail, context, range, fixInfo) {
24070   onError({
24071     lineNumber,
24072     detail,
24073     context,
24074     range,
24075     fixInfo
24076   });
24077 }
24078 module.exports.addError = addError;
24079
24080 // Adds an error object with details conditionally via the onError callback
24081 module.exports.addErrorDetailIf = function addErrorDetailIf(
24082   onError, lineNumber, expected, actual, detail, context, range, fixInfo) {
24083   if (expected !== actual) {
24084     addError(
24085       onError,
24086       lineNumber,
24087       "Expected: " + expected + "; Actual: " + actual +
24088         (detail ? "; " + detail : ""),
24089       context,
24090       range,
24091       fixInfo);
24092   }
24093 };
24094
24095 // Adds an error object with context via the onError callback
24096 module.exports.addErrorContext = function addErrorContext(
24097   onError, lineNumber, context, left, right, range, fixInfo) {
24098   if (context.length <= 30) {
24099     // Nothing to do
24100   } else if (left && right) {
24101     context = context.substr(0, 15) + "..." + context.substr(-15);
24102   } else if (right) {
24103     context = "..." + context.substr(-30);
24104   } else {
24105     context = context.substr(0, 30) + "...";
24106   }
24107   addError(onError, lineNumber, null, context, range, fixInfo);
24108 };
24109
24110 // Returns a range object for a line by applying a RegExp
24111 module.exports.rangeFromRegExp = function rangeFromRegExp(line, regexp) {
24112   let range = null;
24113   const match = line.match(regexp);
24114   if (match) {
24115     const column = match.index + 1;
24116     const length = match[0].length;
24117     range = [ column, length ];
24118   }
24119   return range;
24120 };
24121
24122 // Determines if the front matter includes a title
24123 module.exports.frontMatterHasTitle =
24124   function frontMatterHasTitle(frontMatterLines, frontMatterTitlePattern) {
24125     const ignoreFrontMatter =
24126       (frontMatterTitlePattern !== undefined) && !frontMatterTitlePattern;
24127     const frontMatterTitleRe =
24128       new RegExp(String(frontMatterTitlePattern || "^\\s*title\\s*[:=]"), "i");
24129     return !ignoreFrontMatter &&
24130       frontMatterLines.some((line) => frontMatterTitleRe.test(line));
24131   };
24132
24133 /**
24134  * Returns a list of emphasis markers in code spans and links.
24135  *
24136  * @param {Object} params RuleParams instance.
24137  * @returns {number[][]} List of markers.
24138  */
24139 function emphasisMarkersInContent(params) {
24140   const { lines } = params;
24141   const byLine = new Array(lines.length);
24142   // Search code spans
24143   filterTokens(params, "inline", (token) => {
24144     const { children, lineNumber, map } = token;
24145     if (children.some((child) => child.type === "code_inline")) {
24146       const tokenLines = lines.slice(map[0], map[1]);
24147       forEachInlineCodeSpan(
24148         tokenLines.join("\n"),
24149         (code, lineIndex, column, tickCount) => {
24150           const codeLines = code.split(newLineRe);
24151           codeLines.forEach((codeLine, codeLineIndex) => {
24152             let match = null;
24153             while ((match = emphasisMarkersRe.exec(codeLine))) {
24154               const byLineIndex = lineNumber - 1 + lineIndex + codeLineIndex;
24155               const inLine = byLine[byLineIndex] || [];
24156               const codeLineOffset = codeLineIndex ? 0 : column - 1 + tickCount;
24157               inLine.push(codeLineOffset + match.index);
24158               byLine[byLineIndex] = inLine;
24159             }
24160           });
24161         }
24162       );
24163     }
24164   });
24165   // Search links
24166   lines.forEach((tokenLine, tokenLineIndex) => {
24167     let linkMatch = null;
24168     while ((linkMatch = linkRe.exec(tokenLine))) {
24169       let markerMatch = null;
24170       while ((markerMatch = emphasisMarkersRe.exec(linkMatch[0]))) {
24171         const inLine = byLine[tokenLineIndex] || [];
24172         inLine.push(linkMatch.index + markerMatch.index);
24173         byLine[tokenLineIndex] = inLine;
24174       }
24175     }
24176   });
24177   return byLine;
24178 }
24179 module.exports.emphasisMarkersInContent = emphasisMarkersInContent;
24180
24181 /**
24182  * Gets the most common line ending, falling back to the platform default.
24183  *
24184  * @param {string} input Markdown content to analyze.
24185  * @returns {string} Preferred line ending.
24186  */
24187 function getPreferredLineEnding(input) {
24188   let cr = 0;
24189   let lf = 0;
24190   let crlf = 0;
24191   const endings = input.match(newLineRe) || [];
24192   endings.forEach((ending) => {
24193     // eslint-disable-next-line default-case
24194     switch (ending) {
24195       case "\r":
24196         cr++;
24197         break;
24198       case "\n":
24199         lf++;
24200         break;
24201       case "\r\n":
24202         crlf++;
24203         break;
24204     }
24205   });
24206   let preferredLineEnding = null;
24207   if (!cr && !lf && !crlf) {
24208     preferredLineEnding = os.EOL;
24209   } else if ((lf >= crlf) && (lf >= cr)) {
24210     preferredLineEnding = "\n";
24211   } else if (crlf >= cr) {
24212     preferredLineEnding = "\r\n";
24213   } else {
24214     preferredLineEnding = "\r";
24215   }
24216   return preferredLineEnding;
24217 }
24218 module.exports.getPreferredLineEnding = getPreferredLineEnding;
24219
24220 /**
24221  * Normalizes the fields of a RuleOnErrorFixInfo instance.
24222  *
24223  * @param {Object} fixInfo RuleOnErrorFixInfo instance.
24224  * @param {number} [lineNumber] Line number.
24225  * @returns {Object} Normalized RuleOnErrorFixInfo instance.
24226  */
24227 function normalizeFixInfo(fixInfo, lineNumber) {
24228   return {
24229     "lineNumber": fixInfo.lineNumber || lineNumber,
24230     "editColumn": fixInfo.editColumn || 1,
24231     "deleteCount": fixInfo.deleteCount || 0,
24232     "insertText": fixInfo.insertText || ""
24233   };
24234 }
24235
24236 /**
24237  * Fixes the specified error on a line of Markdown content.
24238  *
24239  * @param {string} line Line of Markdown content.
24240  * @param {Object} fixInfo RuleOnErrorFixInfo instance.
24241  * @param {string} lineEnding Line ending to use.
24242  * @returns {string} Fixed content.
24243  */
24244 function applyFix(line, fixInfo, lineEnding) {
24245   const { editColumn, deleteCount, insertText } = normalizeFixInfo(fixInfo);
24246   const editIndex = editColumn - 1;
24247   return (deleteCount === -1) ?
24248     null :
24249     line.slice(0, editIndex) +
24250     insertText.replace(/\n/g, lineEnding || "\n") +
24251     line.slice(editIndex + deleteCount);
24252 }
24253 module.exports.applyFix = applyFix;
24254
24255 // Applies as many fixes as possible to the input lines
24256 module.exports.applyFixes = function applyFixes(input, errors) {
24257   const lineEnding = getPreferredLineEnding(input);
24258   const lines = input.split(newLineRe);
24259   // Normalize fixInfo objects
24260   let fixInfos = errors
24261     .filter((error) => error.fixInfo)
24262     .map((error) => normalizeFixInfo(error.fixInfo, error.lineNumber));
24263   // Sort bottom-to-top, line-deletes last, right-to-left, long-to-short
24264   fixInfos.sort((a, b) => {
24265     const aDeletingLine = (a.deleteCount === -1);
24266     const bDeletingLine = (b.deleteCount === -1);
24267     return (
24268       (b.lineNumber - a.lineNumber) ||
24269       (aDeletingLine ? 1 : (bDeletingLine ? -1 : 0)) ||
24270       (b.editColumn - a.editColumn) ||
24271       (b.insertText.length - a.insertText.length)
24272     );
24273   });
24274   // Remove duplicate entries (needed for following collapse step)
24275   let lastFixInfo = {};
24276   fixInfos = fixInfos.filter((fixInfo) => {
24277     const unique = (
24278       (fixInfo.lineNumber !== lastFixInfo.lineNumber) ||
24279       (fixInfo.editColumn !== lastFixInfo.editColumn) ||
24280       (fixInfo.deleteCount !== lastFixInfo.deleteCount) ||
24281       (fixInfo.insertText !== lastFixInfo.insertText)
24282     );
24283     lastFixInfo = fixInfo;
24284     return unique;
24285   });
24286   // Collapse insert/no-delete and no-insert/delete for same line/column
24287   lastFixInfo = {};
24288   fixInfos.forEach((fixInfo) => {
24289     if (
24290       (fixInfo.lineNumber === lastFixInfo.lineNumber) &&
24291       (fixInfo.editColumn === lastFixInfo.editColumn) &&
24292       !fixInfo.insertText &&
24293       (fixInfo.deleteCount > 0) &&
24294       lastFixInfo.insertText &&
24295       !lastFixInfo.deleteCount) {
24296       fixInfo.insertText = lastFixInfo.insertText;
24297       lastFixInfo.lineNumber = 0;
24298     }
24299     lastFixInfo = fixInfo;
24300   });
24301   fixInfos = fixInfos.filter((fixInfo) => fixInfo.lineNumber);
24302   // Apply all (remaining/updated) fixes
24303   let lastLineIndex = -1;
24304   let lastEditIndex = -1;
24305   fixInfos.forEach((fixInfo) => {
24306     const { lineNumber, editColumn, deleteCount } = fixInfo;
24307     const lineIndex = lineNumber - 1;
24308     const editIndex = editColumn - 1;
24309     if (
24310       (lineIndex !== lastLineIndex) ||
24311       ((editIndex + deleteCount) < lastEditIndex) ||
24312       (deleteCount === -1)
24313     ) {
24314       lines[lineIndex] = applyFix(lines[lineIndex], fixInfo, lineEnding);
24315     }
24316     lastLineIndex = lineIndex;
24317     lastEditIndex = editIndex;
24318   });
24319   // Return corrected input
24320   return lines.filter((line) => line !== null).join(lineEnding);
24321 };
24322
24323
24324 /***/ }),
24325 /* 157 */
24326 /***/ (function(module, exports, __webpack_require__) {
24327
24328 var cc   = __webpack_require__(158)
24329 var join = __webpack_require__(38).join
24330 var deepExtend = __webpack_require__(3)
24331 var etc = '/etc'
24332 var win = process.platform === "win32"
24333 var home = win
24334            ? process.env.USERPROFILE
24335            : process.env.HOME
24336
24337 module.exports = function (name, defaults, argv, parse) {
24338   if('string' !== typeof name)
24339     throw new Error('rc(name): name *must* be string')
24340   if(!argv)
24341     argv = __webpack_require__(161)(process.argv.slice(2))
24342   defaults = (
24343       'string' === typeof defaults
24344     ? cc.json(defaults) : defaults
24345     ) || {}
24346
24347   parse = parse || cc.parse
24348
24349   var env = cc.env(name + '_')
24350
24351   var configs = [defaults]
24352   var configFiles = []
24353   function addConfigFile (file) {
24354     if (configFiles.indexOf(file) >= 0) return
24355     var fileConfig = cc.file(file)
24356     if (fileConfig) {
24357       configs.push(parse(fileConfig))
24358       configFiles.push(file)
24359     }
24360   }
24361
24362   // which files do we look at?
24363   if (!win)
24364    [join(etc, name, 'config'),
24365     join(etc, name + 'rc')].forEach(addConfigFile)
24366   if (home)
24367    [join(home, '.config', name, 'config'),
24368     join(home, '.config', name),
24369     join(home, '.' + name, 'config'),
24370     join(home, '.' + name + 'rc')].forEach(addConfigFile)
24371   addConfigFile(cc.find('.'+name+'rc'))
24372   if (env.config) addConfigFile(env.config)
24373   if (argv.config) addConfigFile(argv.config)
24374
24375   return deepExtend.apply(null, configs.concat([
24376     env,
24377     argv,
24378     configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
24379   ]))
24380 }
24381
24382
24383 /***/ }),
24384 /* 158 */
24385 /***/ (function(module, exports, __webpack_require__) {
24386
24387 "use strict";
24388
24389 var fs   = __webpack_require__(4)
24390 var ini  = __webpack_require__(159)
24391 var path = __webpack_require__(38)
24392 var stripJsonComments = __webpack_require__(160)
24393
24394 var parse = exports.parse = function (content) {
24395
24396   //if it ends in .json or starts with { then it must be json.
24397   //must be done this way, because ini accepts everything.
24398   //can't just try and parse it and let it throw if it's not ini.
24399   //everything is ini. even json with a syntax error.
24400
24401   if(/^\s*{/.test(content))
24402     return JSON.parse(stripJsonComments(content))
24403   return ini.parse(content)
24404
24405 }
24406
24407 var file = exports.file = function () {
24408   var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
24409
24410   //path.join breaks if it's a not a string, so just skip this.
24411   for(var i in args)
24412     if('string' !== typeof args[i])
24413       return
24414
24415   var file = path.join.apply(null, args)
24416   var content
24417   try {
24418     return fs.readFileSync(file,'utf-8')
24419   } catch (err) {
24420     return
24421   }
24422 }
24423
24424 var json = exports.json = function () {
24425   var content = file.apply(null, arguments)
24426   return content ? parse(content) : null
24427 }
24428
24429 var env = exports.env = function (prefix, env) {
24430   env = env || process.env
24431   var obj = {}
24432   var l = prefix.length
24433   for(var k in env) {
24434     if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
24435
24436       var keypath = k.substring(l).split('__')
24437
24438       // Trim empty strings from keypath array
24439       var _emptyStringIndex
24440       while ((_emptyStringIndex=keypath.indexOf('')) > -1) {
24441         keypath.splice(_emptyStringIndex, 1)
24442       }
24443
24444       var cursor = obj
24445       keypath.forEach(function _buildSubObj(_subkey,i){
24446
24447         // (check for _subkey first so we ignore empty strings)
24448         // (check for cursor to avoid assignment to primitive objects)
24449         if (!_subkey || typeof cursor !== 'object')
24450           return
24451
24452         // If this is the last key, just stuff the value in there
24453         // Assigns actual value from env variable to final key
24454         // (unless it's just an empty string- in that case use the last valid key)
24455         if (i === keypath.length-1)
24456           cursor[_subkey] = env[k]
24457
24458
24459         // Build sub-object if nothing already exists at the keypath
24460         if (cursor[_subkey] === undefined)
24461           cursor[_subkey] = {}
24462
24463         // Increment cursor used to track the object at the current depth
24464         cursor = cursor[_subkey]
24465
24466       })
24467
24468     }
24469
24470   }
24471
24472   return obj
24473 }
24474
24475 var find = exports.find = function () {
24476   var rel = path.join.apply(null, [].slice.call(arguments))
24477
24478   function find(start, rel) {
24479     var file = path.join(start, rel)
24480     try {
24481       fs.statSync(file)
24482       return file
24483     } catch (err) {
24484       if(path.dirname(start) !== start) // root
24485         return find(path.dirname(start), rel)
24486     }
24487   }
24488   return find(process.cwd(), rel)
24489 }
24490
24491
24492
24493
24494 /***/ }),
24495 /* 159 */
24496 /***/ (function(module, exports) {
24497
24498 exports.parse = exports.decode = decode
24499
24500 exports.stringify = exports.encode = encode
24501
24502 exports.safe = safe
24503 exports.unsafe = unsafe
24504
24505 var eol = typeof process !== 'undefined' &&
24506   process.platform === 'win32' ? '\r\n' : '\n'
24507
24508 function encode (obj, opt) {
24509   var children = []
24510   var out = ''
24511
24512   if (typeof opt === 'string') {
24513     opt = {
24514       section: opt,
24515       whitespace: false
24516     }
24517   } else {
24518     opt = opt || {}
24519     opt.whitespace = opt.whitespace === true
24520   }
24521
24522   var separator = opt.whitespace ? ' = ' : '='
24523
24524   Object.keys(obj).forEach(function (k, _, __) {
24525     var val = obj[k]
24526     if (val && Array.isArray(val)) {
24527       val.forEach(function (item) {
24528         out += safe(k + '[]') + separator + safe(item) + '\n'
24529       })
24530     } else if (val && typeof val === 'object') {
24531       children.push(k)
24532     } else {
24533       out += safe(k) + separator + safe(val) + eol
24534     }
24535   })
24536
24537   if (opt.section && out.length) {
24538     out = '[' + safe(opt.section) + ']' + eol + out
24539   }
24540
24541   children.forEach(function (k, _, __) {
24542     var nk = dotSplit(k).join('\\.')
24543     var section = (opt.section ? opt.section + '.' : '') + nk
24544     var child = encode(obj[k], {
24545       section: section,
24546       whitespace: opt.whitespace
24547     })
24548     if (out.length && child.length) {
24549       out += eol
24550     }
24551     out += child
24552   })
24553
24554   return out
24555 }
24556
24557 function dotSplit (str) {
24558   return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
24559     .replace(/\\\./g, '\u0001')
24560     .split(/\./).map(function (part) {
24561       return part.replace(/\1/g, '\\.')
24562       .replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
24563     })
24564 }
24565
24566 function decode (str) {
24567   var out = {}
24568   var p = out
24569   var section = null
24570   //          section     |key      = value
24571   var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
24572   var lines = str.split(/[\r\n]+/g)
24573
24574   lines.forEach(function (line, _, __) {
24575     if (!line || line.match(/^\s*[;#]/)) return
24576     var match = line.match(re)
24577     if (!match) return
24578     if (match[1] !== undefined) {
24579       section = unsafe(match[1])
24580       p = out[section] = out[section] || {}
24581       return
24582     }
24583     var key = unsafe(match[2])
24584     var value = match[3] ? unsafe(match[4]) : true
24585     switch (value) {
24586       case 'true':
24587       case 'false':
24588       case 'null': value = JSON.parse(value)
24589     }
24590
24591     // Convert keys with '[]' suffix to an array
24592     if (key.length > 2 && key.slice(-2) === '[]') {
24593       key = key.substring(0, key.length - 2)
24594       if (!p[key]) {
24595         p[key] = []
24596       } else if (!Array.isArray(p[key])) {
24597         p[key] = [p[key]]
24598       }
24599     }
24600
24601     // safeguard against resetting a previously defined
24602     // array by accidentally forgetting the brackets
24603     if (Array.isArray(p[key])) {
24604       p[key].push(value)
24605     } else {
24606       p[key] = value
24607     }
24608   })
24609
24610   // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
24611   // use a filter to return the keys that have to be deleted.
24612   Object.keys(out).filter(function (k, _, __) {
24613     if (!out[k] ||
24614       typeof out[k] !== 'object' ||
24615       Array.isArray(out[k])) {
24616       return false
24617     }
24618     // see if the parent section is also an object.
24619     // if so, add it to that, and mark this one for deletion
24620     var parts = dotSplit(k)
24621     var p = out
24622     var l = parts.pop()
24623     var nl = l.replace(/\\\./g, '.')
24624     parts.forEach(function (part, _, __) {
24625       if (!p[part] || typeof p[part] !== 'object') p[part] = {}
24626       p = p[part]
24627     })
24628     if (p === out && nl === l) {
24629       return false
24630     }
24631     p[nl] = out[k]
24632     return true
24633   }).forEach(function (del, _, __) {
24634     delete out[del]
24635   })
24636
24637   return out
24638 }
24639
24640 function isQuoted (val) {
24641   return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
24642     (val.charAt(0) === "'" && val.slice(-1) === "'")
24643 }
24644
24645 function safe (val) {
24646   return (typeof val !== 'string' ||
24647     val.match(/[=\r\n]/) ||
24648     val.match(/^\[/) ||
24649     (val.length > 1 &&
24650      isQuoted(val)) ||
24651     val !== val.trim())
24652       ? JSON.stringify(val)
24653       : val.replace(/;/g, '\\;').replace(/#/g, '\\#')
24654 }
24655
24656 function unsafe (val, doUnesc) {
24657   val = (val || '').trim()
24658   if (isQuoted(val)) {
24659     // remove the single quotes before calling JSON.parse
24660     if (val.charAt(0) === "'") {
24661       val = val.substr(1, val.length - 2)
24662     }
24663     try { val = JSON.parse(val) } catch (_) {}
24664   } else {
24665     // walk the val to find the first not-escaped ; character
24666     var esc = false
24667     var unesc = ''
24668     for (var i = 0, l = val.length; i < l; i++) {
24669       var c = val.charAt(i)
24670       if (esc) {
24671         if ('\\;#'.indexOf(c) !== -1) {
24672           unesc += c
24673         } else {
24674           unesc += '\\' + c
24675         }
24676         esc = false
24677       } else if (';#'.indexOf(c) !== -1) {
24678         break
24679       } else if (c === '\\') {
24680         esc = true
24681       } else {
24682         unesc += c
24683       }
24684     }
24685     if (esc) {
24686       unesc += '\\'
24687     }
24688     return unesc.trim()
24689   }
24690   return val
24691 }
24692
24693
24694 /***/ }),
24695 /* 160 */
24696 /***/ (function(module, exports, __webpack_require__) {
24697
24698 "use strict";
24699
24700 var singleComment = 1;
24701 var multiComment = 2;
24702
24703 function stripWithoutWhitespace() {
24704         return '';
24705 }
24706
24707 function stripWithWhitespace(str, start, end) {
24708         return str.slice(start, end).replace(/\S/g, ' ');
24709 }
24710
24711 module.exports = function (str, opts) {
24712         opts = opts || {};
24713
24714         var currentChar;
24715         var nextChar;
24716         var insideString = false;
24717         var insideComment = false;
24718         var offset = 0;
24719         var ret = '';
24720         var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
24721
24722         for (var i = 0; i < str.length; i++) {
24723                 currentChar = str[i];
24724                 nextChar = str[i + 1];
24725
24726                 if (!insideComment && currentChar === '"') {
24727                         var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
24728                         if (!escaped) {
24729                                 insideString = !insideString;
24730                         }
24731                 }
24732
24733                 if (insideString) {
24734                         continue;
24735                 }
24736
24737                 if (!insideComment && currentChar + nextChar === '//') {
24738                         ret += str.slice(offset, i);
24739                         offset = i;
24740                         insideComment = singleComment;
24741                         i++;
24742                 } else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
24743                         i++;
24744                         insideComment = false;
24745                         ret += strip(str, offset, i);
24746                         offset = i;
24747                         continue;
24748                 } else if (insideComment === singleComment && currentChar === '\n') {
24749                         insideComment = false;
24750                         ret += strip(str, offset, i);
24751                         offset = i;
24752                 } else if (!insideComment && currentChar + nextChar === '/*') {
24753                         ret += str.slice(offset, i);
24754                         offset = i;
24755                         insideComment = multiComment;
24756                         i++;
24757                         continue;
24758                 } else if (insideComment === multiComment && currentChar + nextChar === '*/') {
24759                         i++;
24760                         insideComment = false;
24761                         ret += strip(str, offset, i + 1);
24762                         offset = i + 1;
24763                         continue;
24764                 }
24765         }
24766
24767         return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
24768 };
24769
24770
24771 /***/ }),
24772 /* 161 */
24773 /***/ (function(module, exports) {
24774
24775 module.exports = function (args, opts) {
24776     if (!opts) opts = {};
24777     
24778     var flags = { bools : {}, strings : {}, unknownFn: null };
24779
24780     if (typeof opts['unknown'] === 'function') {
24781         flags.unknownFn = opts['unknown'];
24782     }
24783
24784     if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
24785       flags.allBools = true;
24786     } else {
24787       [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
24788           flags.bools[key] = true;
24789       });
24790     }
24791     
24792     var aliases = {};
24793     Object.keys(opts.alias || {}).forEach(function (key) {
24794         aliases[key] = [].concat(opts.alias[key]);
24795         aliases[key].forEach(function (x) {
24796             aliases[x] = [key].concat(aliases[key].filter(function (y) {
24797                 return x !== y;
24798             }));
24799         });
24800     });
24801
24802     [].concat(opts.string).filter(Boolean).forEach(function (key) {
24803         flags.strings[key] = true;
24804         if (aliases[key]) {
24805             flags.strings[aliases[key]] = true;
24806         }
24807      });
24808
24809     var defaults = opts['default'] || {};
24810     
24811     var argv = { _ : [] };
24812     Object.keys(flags.bools).forEach(function (key) {
24813         setArg(key, defaults[key] === undefined ? false : defaults[key]);
24814     });
24815     
24816     var notFlags = [];
24817
24818     if (args.indexOf('--') !== -1) {
24819         notFlags = args.slice(args.indexOf('--')+1);
24820         args = args.slice(0, args.indexOf('--'));
24821     }
24822
24823     function argDefined(key, arg) {
24824         return (flags.allBools && /^--[^=]+$/.test(arg)) ||
24825             flags.strings[key] || flags.bools[key] || aliases[key];
24826     }
24827
24828     function setArg (key, val, arg) {
24829         if (arg && flags.unknownFn && !argDefined(key, arg)) {
24830             if (flags.unknownFn(arg) === false) return;
24831         }
24832
24833         var value = !flags.strings[key] && isNumber(val)
24834             ? Number(val) : val
24835         ;
24836         setKey(argv, key.split('.'), value);
24837         
24838         (aliases[key] || []).forEach(function (x) {
24839             setKey(argv, x.split('.'), value);
24840         });
24841     }
24842
24843     function setKey (obj, keys, value) {
24844         var o = obj;
24845         for (var i = 0; i < keys.length-1; i++) {
24846             var key = keys[i];
24847             if (key === '__proto__') return;
24848             if (o[key] === undefined) o[key] = {};
24849             if (o[key] === Object.prototype || o[key] === Number.prototype
24850                 || o[key] === String.prototype) o[key] = {};
24851             if (o[key] === Array.prototype) o[key] = [];
24852             o = o[key];
24853         }
24854
24855         var key = keys[keys.length - 1];
24856         if (key === '__proto__') return;
24857         if (o === Object.prototype || o === Number.prototype
24858             || o === String.prototype) o = {};
24859         if (o === Array.prototype) o = [];
24860         if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
24861             o[key] = value;
24862         }
24863         else if (Array.isArray(o[key])) {
24864             o[key].push(value);
24865         }
24866         else {
24867             o[key] = [ o[key], value ];
24868         }
24869     }
24870     
24871     function aliasIsBoolean(key) {
24872       return aliases[key].some(function (x) {
24873           return flags.bools[x];
24874       });
24875     }
24876
24877     for (var i = 0; i < args.length; i++) {
24878         var arg = args[i];
24879         
24880         if (/^--.+=/.test(arg)) {
24881             // Using [\s\S] instead of . because js doesn't support the
24882             // 'dotall' regex modifier. See:
24883             // http://stackoverflow.com/a/1068308/13216
24884             var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
24885             var key = m[1];
24886             var value = m[2];
24887             if (flags.bools[key]) {
24888                 value = value !== 'false';
24889             }
24890             setArg(key, value, arg);
24891         }
24892         else if (/^--no-.+/.test(arg)) {
24893             var key = arg.match(/^--no-(.+)/)[1];
24894             setArg(key, false, arg);
24895         }
24896         else if (/^--.+/.test(arg)) {
24897             var key = arg.match(/^--(.+)/)[1];
24898             var next = args[i + 1];
24899             if (next !== undefined && !/^-/.test(next)
24900             && !flags.bools[key]
24901             && !flags.allBools
24902             && (aliases[key] ? !aliasIsBoolean(key) : true)) {
24903                 setArg(key, next, arg);
24904                 i++;
24905             }
24906             else if (/^(true|false)$/.test(next)) {
24907                 setArg(key, next === 'true', arg);
24908                 i++;
24909             }
24910             else {
24911                 setArg(key, flags.strings[key] ? '' : true, arg);
24912             }
24913         }
24914         else if (/^-[^-]+/.test(arg)) {
24915             var letters = arg.slice(1,-1).split('');
24916             
24917             var broken = false;
24918             for (var j = 0; j < letters.length; j++) {
24919                 var next = arg.slice(j+2);
24920                 
24921                 if (next === '-') {
24922                     setArg(letters[j], next, arg)
24923                     continue;
24924                 }
24925                 
24926                 if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
24927                     setArg(letters[j], next.split('=')[1], arg);
24928                     broken = true;
24929                     break;
24930                 }
24931                 
24932                 if (/[A-Za-z]/.test(letters[j])
24933                 && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
24934                     setArg(letters[j], next, arg);
24935                     broken = true;
24936                     break;
24937                 }
24938                 
24939                 if (letters[j+1] && letters[j+1].match(/\W/)) {
24940                     setArg(letters[j], arg.slice(j+2), arg);
24941                     broken = true;
24942                     break;
24943                 }
24944                 else {
24945                     setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
24946                 }
24947             }
24948             
24949             var key = arg.slice(-1)[0];
24950             if (!broken && key !== '-') {
24951                 if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
24952                 && !flags.bools[key]
24953                 && (aliases[key] ? !aliasIsBoolean(key) : true)) {
24954                     setArg(key, args[i+1], arg);
24955                     i++;
24956                 }
24957                 else if (args[i+1] && /^(true|false)$/.test(args[i+1])) {
24958                     setArg(key, args[i+1] === 'true', arg);
24959                     i++;
24960                 }
24961                 else {
24962                     setArg(key, flags.strings[key] ? '' : true, arg);
24963                 }
24964             }
24965         }
24966         else {
24967             if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
24968                 argv._.push(
24969                     flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
24970                 );
24971             }
24972             if (opts.stopEarly) {
24973                 argv._.push.apply(argv._, args.slice(i + 1));
24974                 break;
24975             }
24976         }
24977     }
24978     
24979     Object.keys(defaults).forEach(function (key) {
24980         if (!hasKey(argv, key.split('.'))) {
24981             setKey(argv, key.split('.'), defaults[key]);
24982             
24983             (aliases[key] || []).forEach(function (x) {
24984                 setKey(argv, x.split('.'), defaults[key]);
24985             });
24986         }
24987     });
24988     
24989     if (opts['--']) {
24990         argv['--'] = new Array();
24991         notFlags.forEach(function(key) {
24992             argv['--'].push(key);
24993         });
24994     }
24995     else {
24996         notFlags.forEach(function(key) {
24997             argv._.push(key);
24998         });
24999     }
25000
25001     return argv;
25002 };
25003
25004 function hasKey (obj, keys) {
25005     var o = obj;
25006     keys.slice(0,-1).forEach(function (key) {
25007         o = (o[key] || {});
25008     });
25009
25010     var key = keys[keys.length - 1];
25011     return key in o;
25012 }
25013
25014 function isNumber (x) {
25015     if (typeof x === 'number') return true;
25016     if (/^0x[0-9a-f]+$/i.test(x)) return true;
25017     return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
25018 }
25019
25020
25021
25022 /***/ }),
25023 /* 162 */
25024 /***/ (function(module, exports, __webpack_require__) {
25025
25026 "use strict";
25027 /* --------------------------------------------------------------------------------------------\r
25028  * Copyright (c) Microsoft Corporation. All rights reserved.\r
25029  * Licensed under the MIT License. See License.txt in the project root for license information.\r
25030  * ------------------------------------------------------------------------------------------ */\r
25031 \r
25032 function __export(m) {\r
25033     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
25034 }\r
25035 Object.defineProperty(exports, "__esModule", { value: true });\r
25036 const vscode_jsonrpc_1 = __webpack_require__(163);\r
25037 exports.ErrorCodes = vscode_jsonrpc_1.ErrorCodes;\r
25038 exports.ResponseError = vscode_jsonrpc_1.ResponseError;\r
25039 exports.CancellationToken = vscode_jsonrpc_1.CancellationToken;\r
25040 exports.CancellationTokenSource = vscode_jsonrpc_1.CancellationTokenSource;\r
25041 exports.Disposable = vscode_jsonrpc_1.Disposable;\r
25042 exports.Event = vscode_jsonrpc_1.Event;\r
25043 exports.Emitter = vscode_jsonrpc_1.Emitter;\r
25044 exports.Trace = vscode_jsonrpc_1.Trace;\r
25045 exports.TraceFormat = vscode_jsonrpc_1.TraceFormat;\r
25046 exports.SetTraceNotification = vscode_jsonrpc_1.SetTraceNotification;\r
25047 exports.LogTraceNotification = vscode_jsonrpc_1.LogTraceNotification;\r
25048 exports.RequestType = vscode_jsonrpc_1.RequestType;\r
25049 exports.RequestType0 = vscode_jsonrpc_1.RequestType0;\r
25050 exports.NotificationType = vscode_jsonrpc_1.NotificationType;\r
25051 exports.NotificationType0 = vscode_jsonrpc_1.NotificationType0;\r
25052 exports.MessageReader = vscode_jsonrpc_1.MessageReader;\r
25053 exports.MessageWriter = vscode_jsonrpc_1.MessageWriter;\r
25054 exports.ConnectionStrategy = vscode_jsonrpc_1.ConnectionStrategy;\r
25055 exports.StreamMessageReader = vscode_jsonrpc_1.StreamMessageReader;\r
25056 exports.StreamMessageWriter = vscode_jsonrpc_1.StreamMessageWriter;\r
25057 exports.IPCMessageReader = vscode_jsonrpc_1.IPCMessageReader;\r
25058 exports.IPCMessageWriter = vscode_jsonrpc_1.IPCMessageWriter;\r
25059 exports.createClientPipeTransport = vscode_jsonrpc_1.createClientPipeTransport;\r
25060 exports.createServerPipeTransport = vscode_jsonrpc_1.createServerPipeTransport;\r
25061 exports.generateRandomPipeName = vscode_jsonrpc_1.generateRandomPipeName;\r
25062 exports.createClientSocketTransport = vscode_jsonrpc_1.createClientSocketTransport;\r
25063 exports.createServerSocketTransport = vscode_jsonrpc_1.createServerSocketTransport;\r
25064 exports.ProgressType = vscode_jsonrpc_1.ProgressType;\r
25065 __export(__webpack_require__(175));\r
25066 __export(__webpack_require__(176));\r
25067 const callHierarchy = __webpack_require__(188);\r
25068 const st = __webpack_require__(189);\r
25069 var Proposed;\r
25070 (function (Proposed) {\r
25071     let CallHierarchyPrepareRequest;\r
25072     (function (CallHierarchyPrepareRequest) {\r
25073         CallHierarchyPrepareRequest.method = callHierarchy.CallHierarchyPrepareRequest.method;\r
25074         CallHierarchyPrepareRequest.type = callHierarchy.CallHierarchyPrepareRequest.type;\r
25075     })(CallHierarchyPrepareRequest = Proposed.CallHierarchyPrepareRequest || (Proposed.CallHierarchyPrepareRequest = {}));\r
25076     let CallHierarchyIncomingCallsRequest;\r
25077     (function (CallHierarchyIncomingCallsRequest) {\r
25078         CallHierarchyIncomingCallsRequest.method = callHierarchy.CallHierarchyIncomingCallsRequest.method;\r
25079         CallHierarchyIncomingCallsRequest.type = callHierarchy.CallHierarchyIncomingCallsRequest.type;\r
25080     })(CallHierarchyIncomingCallsRequest = Proposed.CallHierarchyIncomingCallsRequest || (Proposed.CallHierarchyIncomingCallsRequest = {}));\r
25081     let CallHierarchyOutgoingCallsRequest;\r
25082     (function (CallHierarchyOutgoingCallsRequest) {\r
25083         CallHierarchyOutgoingCallsRequest.method = callHierarchy.CallHierarchyOutgoingCallsRequest.method;\r
25084         CallHierarchyOutgoingCallsRequest.type = callHierarchy.CallHierarchyOutgoingCallsRequest.type;\r
25085     })(CallHierarchyOutgoingCallsRequest = Proposed.CallHierarchyOutgoingCallsRequest || (Proposed.CallHierarchyOutgoingCallsRequest = {}));\r
25086     Proposed.SemanticTokenTypes = st.SemanticTokenTypes;\r
25087     Proposed.SemanticTokenModifiers = st.SemanticTokenModifiers;\r
25088     Proposed.SemanticTokens = st.SemanticTokens;\r
25089     let SemanticTokensRequest;\r
25090     (function (SemanticTokensRequest) {\r
25091         SemanticTokensRequest.method = st.SemanticTokensRequest.method;\r
25092         SemanticTokensRequest.type = st.SemanticTokensRequest.type;\r
25093     })(SemanticTokensRequest = Proposed.SemanticTokensRequest || (Proposed.SemanticTokensRequest = {}));\r
25094     let SemanticTokensEditsRequest;\r
25095     (function (SemanticTokensEditsRequest) {\r
25096         SemanticTokensEditsRequest.method = st.SemanticTokensEditsRequest.method;\r
25097         SemanticTokensEditsRequest.type = st.SemanticTokensEditsRequest.type;\r
25098     })(SemanticTokensEditsRequest = Proposed.SemanticTokensEditsRequest || (Proposed.SemanticTokensEditsRequest = {}));\r
25099     let SemanticTokensRangeRequest;\r
25100     (function (SemanticTokensRangeRequest) {\r
25101         SemanticTokensRangeRequest.method = st.SemanticTokensRangeRequest.method;\r
25102         SemanticTokensRangeRequest.type = st.SemanticTokensRangeRequest.type;\r
25103     })(SemanticTokensRangeRequest = Proposed.SemanticTokensRangeRequest || (Proposed.SemanticTokensRangeRequest = {}));\r
25104 })(Proposed = exports.Proposed || (exports.Proposed = {}));\r
25105 function createProtocolConnection(reader, writer, logger, strategy) {\r
25106     return vscode_jsonrpc_1.createMessageConnection(reader, writer, logger, strategy);\r
25107 }\r
25108 exports.createProtocolConnection = createProtocolConnection;\r
25109
25110
25111 /***/ }),
25112 /* 163 */
25113 /***/ (function(module, exports, __webpack_require__) {
25114
25115 "use strict";
25116 /* --------------------------------------------------------------------------------------------\r
25117  * Copyright (c) Microsoft Corporation. All rights reserved.\r
25118  * Licensed under the MIT License. See License.txt in the project root for license information.\r
25119  * ------------------------------------------------------------------------------------------ */\r
25120 /// <reference path="../typings/thenable.d.ts" />\r
25121 \r
25122 function __export(m) {\r
25123     for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r
25124 }\r
25125 Object.defineProperty(exports, "__esModule", { value: true });\r
25126 const Is = __webpack_require__(164);\r
25127 const messages_1 = __webpack_require__(165);\r
25128 exports.RequestType = messages_1.RequestType;\r
25129 exports.RequestType0 = messages_1.RequestType0;\r
25130 exports.RequestType1 = messages_1.RequestType1;\r
25131 exports.RequestType2 = messages_1.RequestType2;\r
25132 exports.RequestType3 = messages_1.RequestType3;\r
25133 exports.RequestType4 = messages_1.RequestType4;\r
25134 exports.RequestType5 = messages_1.RequestType5;\r
25135 exports.RequestType6 = messages_1.RequestType6;\r
25136 exports.RequestType7 = messages_1.RequestType7;\r
25137 exports.RequestType8 = messages_1.RequestType8;\r
25138 exports.RequestType9 = messages_1.RequestType9;\r
25139 exports.ResponseError = messages_1.ResponseError;\r
25140 exports.ErrorCodes = messages_1.ErrorCodes;\r
25141 exports.NotificationType = messages_1.NotificationType;\r
25142 exports.NotificationType0 = messages_1.NotificationType0;\r
25143 exports.NotificationType1 = messages_1.NotificationType1;\r
25144 exports.NotificationType2 = messages_1.NotificationType2;\r
25145 exports.NotificationType3 = messages_1.NotificationType3;\r
25146 exports.NotificationType4 = messages_1.NotificationType4;\r
25147 exports.NotificationType5 = messages_1.NotificationType5;\r
25148 exports.NotificationType6 = messages_1.NotificationType6;\r
25149 exports.NotificationType7 = messages_1.NotificationType7;\r
25150 exports.NotificationType8 = messages_1.NotificationType8;\r
25151 exports.NotificationType9 = messages_1.NotificationType9;\r
25152 const messageReader_1 = __webpack_require__(166);\r
25153 exports.MessageReader = messageReader_1.MessageReader;\r
25154 exports.StreamMessageReader = messageReader_1.StreamMessageReader;\r
25155 exports.IPCMessageReader = messageReader_1.IPCMessageReader;\r
25156 exports.SocketMessageReader = messageReader_1.SocketMessageReader;\r
25157 const messageWriter_1 = __webpack_require__(168);\r
25158 exports.MessageWriter = messageWriter_1.MessageWriter;\r
25159 exports.StreamMessageWriter = messageWriter_1.StreamMessageWriter;\r
25160 exports.IPCMessageWriter = messageWriter_1.IPCMessageWriter;\r
25161 exports.SocketMessageWriter = messageWriter_1.SocketMessageWriter;\r
25162 const events_1 = __webpack_require__(167);\r
25163 exports.Disposable = events_1.Disposable;\r
25164 exports.Event = events_1.Event;\r
25165 exports.Emitter = events_1.Emitter;\r
25166 const cancellation_1 = __webpack_require__(169);\r
25167 exports.CancellationTokenSource = cancellation_1.CancellationTokenSource;\r
25168 exports.CancellationToken = cancellation_1.CancellationToken;\r
25169 const linkedMap_1 = __webpack_require__(170);\r
25170 __export(__webpack_require__(171));\r
25171 __export(__webpack_require__(174));\r
25172 var CancelNotification;\r
25173 (function (CancelNotification) {\r
25174     CancelNotification.type = new messages_1.NotificationType('$/cancelRequest');\r
25175 })(CancelNotification || (CancelNotification = {}));\r
25176 var ProgressNotification;\r
25177 (function (ProgressNotification) {\r
25178     ProgressNotification.type = new messages_1.NotificationType('$/progress');\r
25179 })(ProgressNotification || (ProgressNotification = {}));\r
25180 class ProgressType {\r
25181     constructor() {\r
25182     }\r
25183 }\r
25184 exports.ProgressType = ProgressType;\r
25185 exports.NullLogger = Object.freeze({\r
25186     error: () => { },\r
25187     warn: () => { },\r
25188     info: () => { },\r
25189     log: () => { }\r
25190 });\r
25191 var Trace;\r
25192 (function (Trace) {\r
25193     Trace[Trace["Off"] = 0] = "Off";\r
25194     Trace[Trace["Messages"] = 1] = "Messages";\r
25195     Trace[Trace["Verbose"] = 2] = "Verbose";\r
25196 })(Trace = exports.Trace || (exports.Trace = {}));\r
25197 (function (Trace) {\r
25198     function fromString(value) {\r
25199         if (!Is.string(value)) {\r
25200             return Trace.Off;\r
25201         }\r
25202         value = value.toLowerCase();\r
25203         switch (value) {\r
25204             case 'off':\r
25205                 return Trace.Off;\r
25206             case 'messages':\r
25207                 return Trace.Messages;\r
25208             case 'verbose':\r
25209                 return Trace.Verbose;\r
25210             default:\r
25211                 return Trace.Off;\r
25212         }\r
25213     }\r
25214     Trace.fromString = fromString;\r
25215     function toString(value) {\r
25216         switch (value) {\r
25217             case Trace.Off:\r
25218                 return 'off';\r
25219             case Trace.Messages:\r
25220                 return 'messages';\r
25221             case Trace.Verbose:\r
25222                 return 'verbose';\r
25223             default:\r
25224                 return 'off';\r
25225         }\r
25226     }\r
25227     Trace.toString = toString;\r
25228 })(Trace = exports.Trace || (exports.Trace = {}));\r
25229 var TraceFormat;\r
25230 (function (TraceFormat) {\r
25231     TraceFormat["Text"] = "text";\r
25232     TraceFormat["JSON"] = "json";\r
25233 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
25234 (function (TraceFormat) {\r
25235     function fromString(value) {\r
25236         value = value.toLowerCase();\r
25237         if (value === 'json') {\r
25238             return TraceFormat.JSON;\r
25239         }\r
25240         else {\r
25241             return TraceFormat.Text;\r
25242         }\r
25243     }\r
25244     TraceFormat.fromString = fromString;\r
25245 })(TraceFormat = exports.TraceFormat || (exports.TraceFormat = {}));\r
25246 var SetTraceNotification;\r
25247 (function (SetTraceNotification) {\r
25248     SetTraceNotification.type = new messages_1.NotificationType('$/setTraceNotification');\r
25249 })(SetTraceNotification = exports.SetTraceNotification || (exports.SetTraceNotification = {}));\r
25250 var LogTraceNotification;\r
25251 (function (LogTraceNotification) {\r
25252     LogTraceNotification.type = new messages_1.NotificationType('$/logTraceNotification');\r
25253 })(LogTraceNotification = exports.LogTraceNotification || (exports.LogTraceNotification = {}));\r
25254 var ConnectionErrors;\r
25255 (function (ConnectionErrors) {\r
25256     /**\r
25257      * The connection is closed.\r
25258      */\r
25259     ConnectionErrors[ConnectionErrors["Closed"] = 1] = "Closed";\r
25260     /**\r
25261      * The connection got disposed.\r
25262      */\r
25263     ConnectionErrors[ConnectionErrors["Disposed"] = 2] = "Disposed";\r
25264     /**\r
25265      * The connection is already in listening mode.\r
25266      */\r
25267     ConnectionErrors[ConnectionErrors["AlreadyListening"] = 3] = "AlreadyListening";\r
25268 })(ConnectionErrors = exports.ConnectionErrors || (exports.ConnectionErrors = {}));\r
25269 class ConnectionError extends Error {\r
25270     constructor(code, message) {\r
25271         super(message);\r
25272         this.code = code;\r
25273         Object.setPrototypeOf(this, ConnectionError.prototype);\r
25274     }\r
25275 }\r
25276 exports.ConnectionError = ConnectionError;\r
25277 var ConnectionStrategy;\r
25278 (function (ConnectionStrategy) {\r
25279     function is(value) {\r
25280         let candidate = value;\r
25281         return candidate && Is.func(candidate.cancelUndispatched);\r
25282     }\r
25283     ConnectionStrategy.is = is;\r
25284 })(ConnectionStrategy = exports.ConnectionStrategy || (exports.ConnectionStrategy = {}));\r
25285 var ConnectionState;\r
25286 (function (ConnectionState) {\r
25287     ConnectionState[ConnectionState["New"] = 1] = "New";\r
25288     ConnectionState[ConnectionState["Listening"] = 2] = "Listening";\r
25289     ConnectionState[ConnectionState["Closed"] = 3] = "Closed";\r
25290     ConnectionState[ConnectionState["Disposed"] = 4] = "Disposed";\r
25291 })(ConnectionState || (ConnectionState = {}));\r
25292 function _createMessageConnection(messageReader, messageWriter, logger, strategy) {\r
25293     let sequenceNumber = 0;\r
25294     let notificationSquenceNumber = 0;\r
25295     let unknownResponseSquenceNumber = 0;\r
25296     const version = '2.0';\r
25297     let starRequestHandler = undefined;\r
25298     let requestHandlers = Object.create(null);\r
25299     let starNotificationHandler = undefined;\r
25300     let notificationHandlers = Object.create(null);\r
25301     let progressHandlers = new Map();\r
25302     let timer;\r
25303     let messageQueue = new linkedMap_1.LinkedMap();\r
25304     let responsePromises = Object.create(null);\r
25305     let requestTokens = Object.create(null);\r
25306     let trace = Trace.Off;\r
25307     let traceFormat = TraceFormat.Text;\r
25308     let tracer;\r
25309     let state = ConnectionState.New;\r
25310     let errorEmitter = new events_1.Emitter();\r
25311     let closeEmitter = new events_1.Emitter();\r
25312     let unhandledNotificationEmitter = new events_1.Emitter();\r
25313     let unhandledProgressEmitter = new events_1.Emitter();\r
25314     let disposeEmitter = new events_1.Emitter();\r
25315     function createRequestQueueKey(id) {\r
25316         return 'req-' + id.toString();\r
25317     }\r
25318     function createResponseQueueKey(id) {\r
25319         if (id === null) {\r
25320             return 'res-unknown-' + (++unknownResponseSquenceNumber).toString();\r
25321         }\r
25322         else {\r
25323             return 'res-' + id.toString();\r
25324         }\r
25325     }\r
25326     function createNotificationQueueKey() {\r
25327         return 'not-' + (++notificationSquenceNumber).toString();\r
25328     }\r
25329     function addMessageToQueue(queue, message) {\r
25330         if (messages_1.isRequestMessage(message)) {\r
25331             queue.set(createRequestQueueKey(message.id), message);\r
25332         }\r
25333         else if (messages_1.isResponseMessage(message)) {\r
25334             queue.set(createResponseQueueKey(message.id), message);\r
25335         }\r
25336         else {\r
25337             queue.set(createNotificationQueueKey(), message);\r
25338         }\r
25339     }\r
25340     function cancelUndispatched(_message) {\r
25341         return undefined;\r
25342     }\r
25343     function isListening() {\r
25344         return state === ConnectionState.Listening;\r
25345     }\r
25346     function isClosed() {\r
25347         return state === ConnectionState.Closed;\r
25348     }\r
25349     function isDisposed() {\r
25350         return state === ConnectionState.Disposed;\r
25351     }\r
25352     function closeHandler() {\r
25353         if (state === ConnectionState.New || state === ConnectionState.Listening) {\r
25354             state = ConnectionState.Closed;\r
25355             closeEmitter.fire(undefined);\r
25356         }\r
25357         // If the connection is disposed don't sent close events.\r
25358     }\r
25359     function readErrorHandler(error) {\r
25360         errorEmitter.fire([error, undefined, undefined]);\r
25361     }\r
25362     function writeErrorHandler(data) {\r
25363         errorEmitter.fire(data);\r
25364     }\r
25365     messageReader.onClose(closeHandler);\r
25366     messageReader.onError(readErrorHandler);\r
25367     messageWriter.onClose(closeHandler);\r
25368     messageWriter.onError(writeErrorHandler);\r
25369     function triggerMessageQueue() {\r
25370         if (timer || messageQueue.size === 0) {\r
25371             return;\r
25372         }\r
25373         timer = setImmediate(() => {\r
25374             timer = undefined;\r
25375             processMessageQueue();\r
25376         });\r
25377     }\r
25378     function processMessageQueue() {\r
25379         if (messageQueue.size === 0) {\r
25380             return;\r
25381         }\r
25382         let message = messageQueue.shift();\r
25383         try {\r
25384             if (messages_1.isRequestMessage(message)) {\r
25385                 handleRequest(message);\r
25386             }\r
25387             else if (messages_1.isNotificationMessage(message)) {\r
25388                 handleNotification(message);\r
25389             }\r
25390             else if (messages_1.isResponseMessage(message)) {\r
25391                 handleResponse(message);\r
25392             }\r
25393             else {\r
25394                 handleInvalidMessage(message);\r
25395             }\r
25396         }\r
25397         finally {\r
25398             triggerMessageQueue();\r
25399         }\r
25400     }\r
25401     let callback = (message) => {\r
25402         try {\r
25403             // We have received a cancellation message. Check if the message is still in the queue\r
25404             // and cancel it if allowed to do so.\r
25405             if (messages_1.isNotificationMessage(message) && message.method === CancelNotification.type.method) {\r
25406                 let key = createRequestQueueKey(message.params.id);\r
25407                 let toCancel = messageQueue.get(key);\r
25408                 if (messages_1.isRequestMessage(toCancel)) {\r
25409                     let response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : cancelUndispatched(toCancel);\r
25410                     if (response && (response.error !== void 0 || response.result !== void 0)) {\r
25411                         messageQueue.delete(key);\r
25412                         response.id = toCancel.id;\r
25413                         traceSendingResponse(response, message.method, Date.now());\r
25414                         messageWriter.write(response);\r
25415                         return;\r
25416                     }\r
25417                 }\r
25418             }\r
25419             addMessageToQueue(messageQueue, message);\r
25420         }\r
25421         finally {\r
25422             triggerMessageQueue();\r
25423         }\r
25424     };\r
25425     function handleRequest(requestMessage) {\r
25426         if (isDisposed()) {\r
25427             // we return here silently since we fired an event when the\r
25428             // connection got disposed.\r
25429             return;\r
25430         }\r
25431         function reply(resultOrError, method, startTime) {\r
25432             let message = {\r
25433                 jsonrpc: version,\r
25434                 id: requestMessage.id\r
25435             };\r
25436             if (resultOrError instanceof messages_1.ResponseError) {\r
25437                 message.error = resultOrError.toJson();\r
25438             }\r
25439             else {\r
25440                 message.result = resultOrError === void 0 ? null : resultOrError;\r
25441             }\r
25442             traceSendingResponse(message, method, startTime);\r
25443             messageWriter.write(message);\r
25444         }\r
25445         function replyError(error, method, startTime) {\r
25446             let message = {\r
25447                 jsonrpc: version,\r
25448                 id: requestMessage.id,\r
25449                 error: error.toJson()\r
25450             };\r
25451             traceSendingResponse(message, method, startTime);\r
25452             messageWriter.write(message);\r
25453         }\r
25454         function replySuccess(result, method, startTime) {\r
25455             // The JSON RPC defines that a response must either have a result or an error\r
25456             // So we can't treat undefined as a valid response result.\r
25457             if (result === void 0) {\r
25458                 result = null;\r
25459             }\r
25460             let message = {\r
25461                 jsonrpc: version,\r
25462                 id: requestMessage.id,\r
25463                 result: result\r
25464             };\r
25465             traceSendingResponse(message, method, startTime);\r
25466             messageWriter.write(message);\r
25467         }\r
25468         traceReceivedRequest(requestMessage);\r
25469         let element = requestHandlers[requestMessage.method];\r
25470         let type;\r
25471         let requestHandler;\r
25472         if (element) {\r
25473             type = element.type;\r
25474             requestHandler = element.handler;\r
25475         }\r
25476         let startTime = Date.now();\r
25477         if (requestHandler || starRequestHandler) {\r
25478             let cancellationSource = new cancellation_1.CancellationTokenSource();\r
25479             let tokenKey = String(requestMessage.id);\r
25480             requestTokens[tokenKey] = cancellationSource;\r
25481             try {\r
25482                 let handlerResult;\r
25483                 if (requestMessage.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
25484                     handlerResult = requestHandler\r
25485                         ? requestHandler(cancellationSource.token)\r
25486                         : starRequestHandler(requestMessage.method, cancellationSource.token);\r
25487                 }\r
25488                 else if (Is.array(requestMessage.params) && (type === void 0 || type.numberOfParams > 1)) {\r
25489                     handlerResult = requestHandler\r
25490                         ? requestHandler(...requestMessage.params, cancellationSource.token)\r
25491                         : starRequestHandler(requestMessage.method, ...requestMessage.params, cancellationSource.token);\r
25492                 }\r
25493                 else {\r
25494                     handlerResult = requestHandler\r
25495                         ? requestHandler(requestMessage.params, cancellationSource.token)\r
25496                         : starRequestHandler(requestMessage.method, requestMessage.params, cancellationSource.token);\r
25497                 }\r
25498                 let promise = handlerResult;\r
25499                 if (!handlerResult) {\r
25500                     delete requestTokens[tokenKey];\r
25501                     replySuccess(handlerResult, requestMessage.method, startTime);\r
25502                 }\r
25503                 else if (promise.then) {\r
25504                     promise.then((resultOrError) => {\r
25505                         delete requestTokens[tokenKey];\r
25506                         reply(resultOrError, requestMessage.method, startTime);\r
25507                     }, error => {\r
25508                         delete requestTokens[tokenKey];\r
25509                         if (error instanceof messages_1.ResponseError) {\r
25510                             replyError(error, requestMessage.method, startTime);\r
25511                         }\r
25512                         else if (error && Is.string(error.message)) {\r
25513                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
25514                         }\r
25515                         else {\r
25516                             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
25517                         }\r
25518                     });\r
25519                 }\r
25520                 else {\r
25521                     delete requestTokens[tokenKey];\r
25522                     reply(handlerResult, requestMessage.method, startTime);\r
25523                 }\r
25524             }\r
25525             catch (error) {\r
25526                 delete requestTokens[tokenKey];\r
25527                 if (error instanceof messages_1.ResponseError) {\r
25528                     reply(error, requestMessage.method, startTime);\r
25529                 }\r
25530                 else if (error && Is.string(error.message)) {\r
25531                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed with message: ${error.message}`), requestMessage.method, startTime);\r
25532                 }\r
25533                 else {\r
25534                     replyError(new messages_1.ResponseError(messages_1.ErrorCodes.InternalError, `Request ${requestMessage.method} failed unexpectedly without providing any details.`), requestMessage.method, startTime);\r
25535                 }\r
25536             }\r
25537         }\r
25538         else {\r
25539             replyError(new messages_1.ResponseError(messages_1.ErrorCodes.MethodNotFound, `Unhandled method ${requestMessage.method}`), requestMessage.method, startTime);\r
25540         }\r
25541     }\r
25542     function handleResponse(responseMessage) {\r
25543         if (isDisposed()) {\r
25544             // See handle request.\r
25545             return;\r
25546         }\r
25547         if (responseMessage.id === null) {\r
25548             if (responseMessage.error) {\r
25549                 logger.error(`Received response message without id: Error is: \n${JSON.stringify(responseMessage.error, undefined, 4)}`);\r
25550             }\r
25551             else {\r
25552                 logger.error(`Received response message without id. No further error information provided.`);\r
25553             }\r
25554         }\r
25555         else {\r
25556             let key = String(responseMessage.id);\r
25557             let responsePromise = responsePromises[key];\r
25558             traceReceivedResponse(responseMessage, responsePromise);\r
25559             if (responsePromise) {\r
25560                 delete responsePromises[key];\r
25561                 try {\r
25562                     if (responseMessage.error) {\r
25563                         let error = responseMessage.error;\r
25564                         responsePromise.reject(new messages_1.ResponseError(error.code, error.message, error.data));\r
25565                     }\r
25566                     else if (responseMessage.result !== void 0) {\r
25567                         responsePromise.resolve(responseMessage.result);\r
25568                     }\r
25569                     else {\r
25570                         throw new Error('Should never happen.');\r
25571                     }\r
25572                 }\r
25573                 catch (error) {\r
25574                     if (error.message) {\r
25575                         logger.error(`Response handler '${responsePromise.method}' failed with message: ${error.message}`);\r
25576                     }\r
25577                     else {\r
25578                         logger.error(`Response handler '${responsePromise.method}' failed unexpectedly.`);\r
25579                     }\r
25580                 }\r
25581             }\r
25582         }\r
25583     }\r
25584     function handleNotification(message) {\r
25585         if (isDisposed()) {\r
25586             // See handle request.\r
25587             return;\r
25588         }\r
25589         let type = undefined;\r
25590         let notificationHandler;\r
25591         if (message.method === CancelNotification.type.method) {\r
25592             notificationHandler = (params) => {\r
25593                 let id = params.id;\r
25594                 let source = requestTokens[String(id)];\r
25595                 if (source) {\r
25596                     source.cancel();\r
25597                 }\r
25598             };\r
25599         }\r
25600         else {\r
25601             let element = notificationHandlers[message.method];\r
25602             if (element) {\r
25603                 notificationHandler = element.handler;\r
25604                 type = element.type;\r
25605             }\r
25606         }\r
25607         if (notificationHandler || starNotificationHandler) {\r
25608             try {\r
25609                 traceReceivedNotification(message);\r
25610                 if (message.params === void 0 || (type !== void 0 && type.numberOfParams === 0)) {\r
25611                     notificationHandler ? notificationHandler() : starNotificationHandler(message.method);\r
25612                 }\r
25613                 else if (Is.array(message.params) && (type === void 0 || type.numberOfParams > 1)) {\r
25614                     notificationHandler ? notificationHandler(...message.params) : starNotificationHandler(message.method, ...message.params);\r
25615                 }\r
25616                 else {\r
25617                     notificationHandler ? notificationHandler(message.params) : starNotificationHandler(message.method, message.params);\r
25618                 }\r
25619             }\r
25620             catch (error) {\r
25621                 if (error.message) {\r
25622                     logger.error(`Notification handler '${message.method}' failed with message: ${error.message}`);\r
25623                 }\r
25624                 else {\r
25625                     logger.error(`Notification handler '${message.method}' failed unexpectedly.`);\r
25626                 }\r
25627             }\r
25628         }\r
25629         else {\r
25630             unhandledNotificationEmitter.fire(message);\r
25631         }\r
25632     }\r
25633     function handleInvalidMessage(message) {\r
25634         if (!message) {\r
25635             logger.error('Received empty message.');\r
25636             return;\r
25637         }\r
25638         logger.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(message, null, 4)}`);\r
25639         // Test whether we find an id to reject the promise\r
25640         let responseMessage = message;\r
25641         if (Is.string(responseMessage.id) || Is.number(responseMessage.id)) {\r
25642             let key = String(responseMessage.id);\r
25643             let responseHandler = responsePromises[key];\r
25644             if (responseHandler) {\r
25645                 responseHandler.reject(new Error('The received response has neither a result nor an error property.'));\r
25646             }\r
25647         }\r
25648     }\r
25649     function traceSendingRequest(message) {\r
25650         if (trace === Trace.Off || !tracer) {\r
25651             return;\r
25652         }\r
25653         if (traceFormat === TraceFormat.Text) {\r
25654             let data = undefined;\r
25655             if (trace === Trace.Verbose && message.params) {\r
25656                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
25657             }\r
25658             tracer.log(`Sending request '${message.method} - (${message.id})'.`, data);\r
25659         }\r
25660         else {\r
25661             logLSPMessage('send-request', message);\r
25662         }\r
25663     }\r
25664     function traceSendingNotification(message) {\r
25665         if (trace === Trace.Off || !tracer) {\r
25666             return;\r
25667         }\r
25668         if (traceFormat === TraceFormat.Text) {\r
25669             let data = undefined;\r
25670             if (trace === Trace.Verbose) {\r
25671                 if (message.params) {\r
25672                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
25673                 }\r
25674                 else {\r
25675                     data = 'No parameters provided.\n\n';\r
25676                 }\r
25677             }\r
25678             tracer.log(`Sending notification '${message.method}'.`, data);\r
25679         }\r
25680         else {\r
25681             logLSPMessage('send-notification', message);\r
25682         }\r
25683     }\r
25684     function traceSendingResponse(message, method, startTime) {\r
25685         if (trace === Trace.Off || !tracer) {\r
25686             return;\r
25687         }\r
25688         if (traceFormat === TraceFormat.Text) {\r
25689             let data = undefined;\r
25690             if (trace === Trace.Verbose) {\r
25691                 if (message.error && message.error.data) {\r
25692                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
25693                 }\r
25694                 else {\r
25695                     if (message.result) {\r
25696                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
25697                     }\r
25698                     else if (message.error === void 0) {\r
25699                         data = 'No result returned.\n\n';\r
25700                     }\r
25701                 }\r
25702             }\r
25703             tracer.log(`Sending response '${method} - (${message.id})'. Processing request took ${Date.now() - startTime}ms`, data);\r
25704         }\r
25705         else {\r
25706             logLSPMessage('send-response', message);\r
25707         }\r
25708     }\r
25709     function traceReceivedRequest(message) {\r
25710         if (trace === Trace.Off || !tracer) {\r
25711             return;\r
25712         }\r
25713         if (traceFormat === TraceFormat.Text) {\r
25714             let data = undefined;\r
25715             if (trace === Trace.Verbose && message.params) {\r
25716                 data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
25717             }\r
25718             tracer.log(`Received request '${message.method} - (${message.id})'.`, data);\r
25719         }\r
25720         else {\r
25721             logLSPMessage('receive-request', message);\r
25722         }\r
25723     }\r
25724     function traceReceivedNotification(message) {\r
25725         if (trace === Trace.Off || !tracer || message.method === LogTraceNotification.type.method) {\r
25726             return;\r
25727         }\r
25728         if (traceFormat === TraceFormat.Text) {\r
25729             let data = undefined;\r
25730             if (trace === Trace.Verbose) {\r
25731                 if (message.params) {\r
25732                     data = `Params: ${JSON.stringify(message.params, null, 4)}\n\n`;\r
25733                 }\r
25734                 else {\r
25735                     data = 'No parameters provided.\n\n';\r
25736                 }\r
25737             }\r
25738             tracer.log(`Received notification '${message.method}'.`, data);\r
25739         }\r
25740         else {\r
25741             logLSPMessage('receive-notification', message);\r
25742         }\r
25743     }\r
25744     function traceReceivedResponse(message, responsePromise) {\r
25745         if (trace === Trace.Off || !tracer) {\r
25746             return;\r
25747         }\r
25748         if (traceFormat === TraceFormat.Text) {\r
25749             let data = undefined;\r
25750             if (trace === Trace.Verbose) {\r
25751                 if (message.error && message.error.data) {\r
25752                     data = `Error data: ${JSON.stringify(message.error.data, null, 4)}\n\n`;\r
25753                 }\r
25754                 else {\r
25755                     if (message.result) {\r
25756                         data = `Result: ${JSON.stringify(message.result, null, 4)}\n\n`;\r
25757                     }\r
25758                     else if (message.error === void 0) {\r
25759                         data = 'No result returned.\n\n';\r
25760                     }\r
25761                 }\r
25762             }\r
25763             if (responsePromise) {\r
25764                 let error = message.error ? ` Request failed: ${message.error.message} (${message.error.code}).` : '';\r
25765                 tracer.log(`Received response '${responsePromise.method} - (${message.id})' in ${Date.now() - responsePromise.timerStart}ms.${error}`, data);\r
25766             }\r
25767             else {\r
25768                 tracer.log(`Received response ${message.id} without active response promise.`, data);\r
25769             }\r
25770         }\r
25771         else {\r
25772             logLSPMessage('receive-response', message);\r
25773         }\r
25774     }\r
25775     function logLSPMessage(type, message) {\r
25776         if (!tracer || trace === Trace.Off) {\r
25777             return;\r
25778         }\r
25779         const lspMessage = {\r
25780             isLSPMessage: true,\r
25781             type,\r
25782             message,\r
25783             timestamp: Date.now()\r
25784         };\r
25785         tracer.log(lspMessage);\r
25786     }\r
25787     function throwIfClosedOrDisposed() {\r
25788         if (isClosed()) {\r
25789             throw new ConnectionError(ConnectionErrors.Closed, 'Connection is closed.');\r
25790         }\r
25791         if (isDisposed()) {\r
25792             throw new ConnectionError(ConnectionErrors.Disposed, 'Connection is disposed.');\r
25793         }\r
25794     }\r
25795     function throwIfListening() {\r
25796         if (isListening()) {\r
25797             throw new ConnectionError(ConnectionErrors.AlreadyListening, 'Connection is already listening');\r
25798         }\r
25799     }\r
25800     function throwIfNotListening() {\r
25801         if (!isListening()) {\r
25802             throw new Error('Call listen() first.');\r
25803         }\r
25804     }\r
25805     function undefinedToNull(param) {\r
25806         if (param === void 0) {\r
25807             return null;\r
25808         }\r
25809         else {\r
25810             return param;\r
25811         }\r
25812     }\r
25813     function computeMessageParams(type, params) {\r
25814         let result;\r
25815         let numberOfParams = type.numberOfParams;\r
25816         switch (numberOfParams) {\r
25817             case 0:\r
25818                 result = null;\r
25819                 break;\r
25820             case 1:\r
25821                 result = undefinedToNull(params[0]);\r
25822                 break;\r
25823             default:\r
25824                 result = [];\r
25825                 for (let i = 0; i < params.length && i < numberOfParams; i++) {\r
25826                     result.push(undefinedToNull(params[i]));\r
25827                 }\r
25828                 if (params.length < numberOfParams) {\r
25829                     for (let i = params.length; i < numberOfParams; i++) {\r
25830                         result.push(null);\r
25831                     }\r
25832                 }\r
25833                 break;\r
25834         }\r
25835         return result;\r
25836     }\r
25837     let connection = {\r
25838         sendNotification: (type, ...params) => {\r
25839             throwIfClosedOrDisposed();\r
25840             let method;\r
25841             let messageParams;\r
25842             if (Is.string(type)) {\r
25843                 method = type;\r
25844                 switch (params.length) {\r
25845                     case 0:\r
25846                         messageParams = null;\r
25847                         break;\r
25848                     case 1:\r
25849                         messageParams = params[0];\r
25850                         break;\r
25851                     default:\r
25852                         messageParams = params;\r
25853                         break;\r
25854                 }\r
25855             }\r
25856             else {\r
25857                 method = type.method;\r
25858                 messageParams = computeMessageParams(type, params);\r
25859             }\r
25860             let notificationMessage = {\r
25861                 jsonrpc: version,\r
25862                 method: method,\r
25863                 params: messageParams\r
25864             };\r
25865             traceSendingNotification(notificationMessage);\r
25866             messageWriter.write(notificationMessage);\r
25867         },\r
25868         onNotification: (type, handler) => {\r
25869             throwIfClosedOrDisposed();\r
25870             if (Is.func(type)) {\r
25871                 starNotificationHandler = type;\r
25872             }\r
25873             else if (handler) {\r
25874                 if (Is.string(type)) {\r
25875                     notificationHandlers[type] = { type: undefined, handler };\r
25876                 }\r
25877                 else {\r
25878                     notificationHandlers[type.method] = { type, handler };\r
25879                 }\r
25880             }\r
25881         },\r
25882         onProgress: (_type, token, handler) => {\r
25883             if (progressHandlers.has(token)) {\r
25884                 throw new Error(`Progress handler for token ${token} already registered`);\r
25885             }\r
25886             progressHandlers.set(token, handler);\r
25887             return {\r
25888                 dispose: () => {\r
25889                     progressHandlers.delete(token);\r
25890                 }\r
25891             };\r
25892         },\r
25893         sendProgress: (_type, token, value) => {\r
25894             connection.sendNotification(ProgressNotification.type, { token, value });\r
25895         },\r
25896         onUnhandledProgress: unhandledProgressEmitter.event,\r
25897         sendRequest: (type, ...params) => {\r
25898             throwIfClosedOrDisposed();\r
25899             throwIfNotListening();\r
25900             let method;\r
25901             let messageParams;\r
25902             let token = undefined;\r
25903             if (Is.string(type)) {\r
25904                 method = type;\r
25905                 switch (params.length) {\r
25906                     case 0:\r
25907                         messageParams = null;\r
25908                         break;\r
25909                     case 1:\r
25910                         // The cancellation token is optional so it can also be undefined.\r
25911                         if (cancellation_1.CancellationToken.is(params[0])) {\r
25912                             messageParams = null;\r
25913                             token = params[0];\r
25914                         }\r
25915                         else {\r
25916                             messageParams = undefinedToNull(params[0]);\r
25917                         }\r
25918                         break;\r
25919                     default:\r
25920                         const last = params.length - 1;\r
25921                         if (cancellation_1.CancellationToken.is(params[last])) {\r
25922                             token = params[last];\r
25923                             if (params.length === 2) {\r
25924                                 messageParams = undefinedToNull(params[0]);\r
25925                             }\r
25926                             else {\r
25927                                 messageParams = params.slice(0, last).map(value => undefinedToNull(value));\r
25928                             }\r
25929                         }\r
25930                         else {\r
25931                             messageParams = params.map(value => undefinedToNull(value));\r
25932                         }\r
25933                         break;\r
25934                 }\r
25935             }\r
25936             else {\r
25937                 method = type.method;\r
25938                 messageParams = computeMessageParams(type, params);\r
25939                 let numberOfParams = type.numberOfParams;\r
25940                 token = cancellation_1.CancellationToken.is(params[numberOfParams]) ? params[numberOfParams] : undefined;\r
25941             }\r
25942             let id = sequenceNumber++;\r
25943             let result = new Promise((resolve, reject) => {\r
25944                 let requestMessage = {\r
25945                     jsonrpc: version,\r
25946                     id: id,\r
25947                     method: method,\r
25948                     params: messageParams\r
25949                 };\r
25950                 let responsePromise = { method: method, timerStart: Date.now(), resolve, reject };\r
25951                 traceSendingRequest(requestMessage);\r
25952                 try {\r
25953                     messageWriter.write(requestMessage);\r
25954                 }\r
25955                 catch (e) {\r
25956                     // Writing the message failed. So we need to reject the promise.\r
25957                     responsePromise.reject(new messages_1.ResponseError(messages_1.ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));\r
25958                     responsePromise = null;\r
25959                 }\r
25960                 if (responsePromise) {\r
25961                     responsePromises[String(id)] = responsePromise;\r
25962                 }\r
25963             });\r
25964             if (token) {\r
25965                 token.onCancellationRequested(() => {\r
25966                     connection.sendNotification(CancelNotification.type, { id });\r
25967                 });\r
25968             }\r
25969             return result;\r
25970         },\r
25971         onRequest: (type, handler) => {\r
25972             throwIfClosedOrDisposed();\r
25973             if (Is.func(type)) {\r
25974                 starRequestHandler = type;\r
25975             }\r
25976             else if (handler) {\r
25977                 if (Is.string(type)) {\r
25978                     requestHandlers[type] = { type: undefined, handler };\r
25979                 }\r
25980                 else {\r
25981                     requestHandlers[type.method] = { type, handler };\r
25982                 }\r
25983             }\r
25984         },\r
25985         trace: (_value, _tracer, sendNotificationOrTraceOptions) => {\r
25986             let _sendNotification = false;\r
25987             let _traceFormat = TraceFormat.Text;\r
25988             if (sendNotificationOrTraceOptions !== void 0) {\r
25989                 if (Is.boolean(sendNotificationOrTraceOptions)) {\r
25990                     _sendNotification = sendNotificationOrTraceOptions;\r
25991                 }\r
25992                 else {\r
25993                     _sendNotification = sendNotificationOrTraceOptions.sendNotification || false;\r
25994                     _traceFormat = sendNotificationOrTraceOptions.traceFormat || TraceFormat.Text;\r
25995                 }\r
25996             }\r
25997             trace = _value;\r
25998             traceFormat = _traceFormat;\r
25999             if (trace === Trace.Off) {\r
26000                 tracer = undefined;\r
26001             }\r
26002             else {\r
26003                 tracer = _tracer;\r
26004             }\r
26005             if (_sendNotification && !isClosed() && !isDisposed()) {\r
26006                 connection.sendNotification(SetTraceNotification.type, { value: Trace.toString(_value) });\r
26007             }\r
26008         },\r
26009         onError: errorEmitter.event,\r
26010         onClose: closeEmitter.event,\r
26011         onUnhandledNotification: unhandledNotificationEmitter.event,\r
26012         onDispose: disposeEmitter.event,\r
26013         dispose: () => {\r
26014             if (isDisposed()) {\r
26015                 return;\r
26016             }\r
26017             state = ConnectionState.Disposed;\r
26018             disposeEmitter.fire(undefined);\r
26019             let error = new Error('Connection got disposed.');\r
26020             Object.keys(responsePromises).forEach((key) => {\r
26021                 responsePromises[key].reject(error);\r
26022             });\r
26023             responsePromises = Object.create(null);\r
26024             requestTokens = Object.create(null);\r
26025             messageQueue = new linkedMap_1.LinkedMap();\r
26026             // Test for backwards compatibility\r
26027             if (Is.func(messageWriter.dispose)) {\r
26028                 messageWriter.dispose();\r
26029             }\r
26030             if (Is.func(messageReader.dispose)) {\r
26031                 messageReader.dispose();\r
26032             }\r
26033         },\r
26034         listen: () => {\r
26035             throwIfClosedOrDisposed();\r
26036             throwIfListening();\r
26037             state = ConnectionState.Listening;\r
26038             messageReader.listen(callback);\r
26039         },\r
26040         inspect: () => {\r
26041             // eslint-disable-next-line no-console\r
26042             console.log('inspect');\r
26043         }\r
26044     };\r
26045     connection.onNotification(LogTraceNotification.type, (params) => {\r
26046         if (trace === Trace.Off || !tracer) {\r
26047             return;\r
26048         }\r
26049         tracer.log(params.message, trace === Trace.Verbose ? params.verbose : undefined);\r
26050     });\r
26051     connection.onNotification(ProgressNotification.type, (params) => {\r
26052         const handler = progressHandlers.get(params.token);\r
26053         if (handler) {\r
26054             handler(params.value);\r
26055         }\r
26056         else {\r
26057             unhandledProgressEmitter.fire(params);\r
26058         }\r
26059     });\r
26060     return connection;\r
26061 }\r
26062 function isMessageReader(value) {\r
26063     return value.listen !== void 0 && value.read === void 0;\r
26064 }\r
26065 function isMessageWriter(value) {\r
26066     return value.write !== void 0 && value.end === void 0;\r
26067 }\r
26068 function createMessageConnection(input, output, logger, strategy) {\r
26069     if (!logger) {\r
26070         logger = exports.NullLogger;\r
26071     }\r
26072     let reader = isMessageReader(input) ? input : new messageReader_1.StreamMessageReader(input);\r
26073     let writer = isMessageWriter(output) ? output : new messageWriter_1.StreamMessageWriter(output);\r
26074     return _createMessageConnection(reader, writer, logger, strategy);\r
26075 }\r
26076 exports.createMessageConnection = createMessageConnection;\r
26077
26078
26079 /***/ }),
26080 /* 164 */
26081 /***/ (function(module, exports, __webpack_require__) {
26082
26083 "use strict";
26084 /* --------------------------------------------------------------------------------------------\r
26085  * Copyright (c) Microsoft Corporation. All rights reserved.\r
26086  * Licensed under the MIT License. See License.txt in the project root for license information.\r
26087  * ------------------------------------------------------------------------------------------ */\r
26088 \r
26089 Object.defineProperty(exports, "__esModule", { value: true });\r
26090 function boolean(value) {\r
26091     return value === true || value === false;\r
26092 }\r
26093 exports.boolean = boolean;\r
26094 function string(value) {\r
26095     return typeof value === 'string' || value instanceof String;\r
26096 }\r
26097 exports.string = string;\r
26098 function number(value) {\r
26099     return typeof value === 'number' || value instanceof Number;\r
26100 }\r
26101 exports.number = number;\r
26102 function error(value) {\r
26103     return value instanceof Error;\r
26104 }\r
26105 exports.error = error;\r
26106 function func(value) {\r
26107     return typeof value === 'function';\r
26108 }\r
26109 exports.func = func;\r
26110 function array(value) {\r
26111     return Array.isArray(value);\r
26112 }\r
26113 exports.array = array;\r
26114 function stringArray(value) {\r
26115     return array(value) && value.every(elem => string(elem));\r
26116 }\r
26117 exports.stringArray = stringArray;\r
26118
26119
26120 /***/ }),
26121 /* 165 */
26122 /***/ (function(module, exports, __webpack_require__) {
26123
26124 "use strict";
26125 /* --------------------------------------------------------------------------------------------\r
26126  * Copyright (c) Microsoft Corporation. All rights reserved.\r
26127  * Licensed under the MIT License. See License.txt in the project root for license information.\r
26128  * ------------------------------------------------------------------------------------------ */\r
26129 \r
26130 Object.defineProperty(exports, "__esModule", { value: true });\r
26131 const is = __webpack_require__(164);\r
26132 /**\r
26133  * Predefined error codes.\r
26134  */\r
26135 var ErrorCodes;\r
26136 (function (ErrorCodes) {\r
26137     // Defined by JSON RPC\r
26138     ErrorCodes.ParseError = -32700;\r
26139     ErrorCodes.InvalidRequest = -32600;\r
26140     ErrorCodes.MethodNotFound = -32601;\r
26141     ErrorCodes.InvalidParams = -32602;\r
26142     ErrorCodes.InternalError = -32603;\r
26143     ErrorCodes.serverErrorStart = -32099;\r
26144     ErrorCodes.serverErrorEnd = -32000;\r
26145     ErrorCodes.ServerNotInitialized = -32002;\r
26146     ErrorCodes.UnknownErrorCode = -32001;\r
26147     // Defined by the protocol.\r
26148     ErrorCodes.RequestCancelled = -32800;\r
26149     ErrorCodes.ContentModified = -32801;\r
26150     // Defined by VSCode library.\r
26151     ErrorCodes.MessageWriteError = 1;\r
26152     ErrorCodes.MessageReadError = 2;\r
26153 })(ErrorCodes = exports.ErrorCodes || (exports.ErrorCodes = {}));\r
26154 /**\r
26155  * An error object return in a response in case a request\r
26156  * has failed.\r
26157  */\r
26158 class ResponseError extends Error {\r
26159     constructor(code, message, data) {\r
26160         super(message);\r
26161         this.code = is.number(code) ? code : ErrorCodes.UnknownErrorCode;\r
26162         this.data = data;\r
26163         Object.setPrototypeOf(this, ResponseError.prototype);\r
26164     }\r
26165     toJson() {\r
26166         return {\r
26167             code: this.code,\r
26168             message: this.message,\r
26169             data: this.data,\r
26170         };\r
26171     }\r
26172 }\r
26173 exports.ResponseError = ResponseError;\r
26174 /**\r
26175  * An abstract implementation of a MessageType.\r
26176  */\r
26177 class AbstractMessageType {\r
26178     constructor(_method, _numberOfParams) {\r
26179         this._method = _method;\r
26180         this._numberOfParams = _numberOfParams;\r
26181     }\r
26182     get method() {\r
26183         return this._method;\r
26184     }\r
26185     get numberOfParams() {\r
26186         return this._numberOfParams;\r
26187     }\r
26188 }\r
26189 exports.AbstractMessageType = AbstractMessageType;\r
26190 /**\r
26191  * Classes to type request response pairs\r
26192  *\r
26193  * The type parameter RO will be removed in the next major version\r
26194  * of the JSON RPC library since it is a LSP concept and doesn't\r
26195  * belong here. For now it is tagged as default never.\r
26196  */\r
26197 class RequestType0 extends AbstractMessageType {\r
26198     constructor(method) {\r
26199         super(method, 0);\r
26200     }\r
26201 }\r
26202 exports.RequestType0 = RequestType0;\r
26203 class RequestType extends AbstractMessageType {\r
26204     constructor(method) {\r
26205         super(method, 1);\r
26206     }\r
26207 }\r
26208 exports.RequestType = RequestType;\r
26209 class RequestType1 extends AbstractMessageType {\r
26210     constructor(method) {\r
26211         super(method, 1);\r
26212     }\r
26213 }\r
26214 exports.RequestType1 = RequestType1;\r
26215 class RequestType2 extends AbstractMessageType {\r
26216     constructor(method) {\r
26217         super(method, 2);\r
26218     }\r
26219 }\r
26220 exports.RequestType2 = RequestType2;\r
26221 class RequestType3 extends AbstractMessageType {\r
26222     constructor(method) {\r
26223         super(method, 3);\r
26224     }\r
26225 }\r
26226 exports.RequestType3 = RequestType3;\r
26227 class RequestType4 extends AbstractMessageType {\r
26228     constructor(method) {\r
26229         super(method, 4);\r
26230     }\r
26231 }\r
26232 exports.RequestType4 = RequestType4;\r
26233 class RequestType5 extends AbstractMessageType {\r
26234     constructor(method) {\r
26235         super(method, 5);\r
26236     }\r
26237 }\r
26238 exports.RequestType5 = RequestType5;\r
26239 class RequestType6 extends AbstractMessageType {\r
26240     constructor(method) {\r
26241         super(method, 6);\r
26242     }\r
26243 }\r
26244 exports.RequestType6 = RequestType6;\r
26245 class RequestType7 extends AbstractMessageType {\r
26246     constructor(method) {\r
26247         super(method, 7);\r
26248     }\r
26249 }\r
26250 exports.RequestType7 = RequestType7;\r
26251 class RequestType8 extends AbstractMessageType {\r
26252     constructor(method) {\r
26253         super(method, 8);\r
26254     }\r
26255 }\r
26256 exports.RequestType8 = RequestType8;\r
26257 class RequestType9 extends AbstractMessageType {\r
26258     constructor(method) {\r
26259         super(method, 9);\r
26260     }\r
26261 }\r
26262 exports.RequestType9 = RequestType9;\r
26263 /**\r
26264  * The type parameter RO will be removed in the next major version\r
26265  * of the JSON RPC library since it is a LSP concept and doesn't\r
26266  * belong here. For now it is tagged as default never.\r
26267  */\r
26268 class NotificationType extends AbstractMessageType {\r
26269     constructor(method) {\r
26270         super(method, 1);\r
26271         this._ = undefined;\r
26272     }\r
26273 }\r
26274 exports.NotificationType = NotificationType;\r
26275 class NotificationType0 extends AbstractMessageType {\r
26276     constructor(method) {\r
26277         super(method, 0);\r
26278     }\r
26279 }\r
26280 exports.NotificationType0 = NotificationType0;\r
26281 class NotificationType1 extends AbstractMessageType {\r
26282     constructor(method) {\r
26283         super(method, 1);\r
26284     }\r
26285 }\r
26286 exports.NotificationType1 = NotificationType1;\r
26287 class NotificationType2 extends AbstractMessageType {\r
26288     constructor(method) {\r
26289         super(method, 2);\r
26290     }\r
26291 }\r
26292 exports.NotificationType2 = NotificationType2;\r
26293 class NotificationType3 extends AbstractMessageType {\r
26294     constructor(method) {\r
26295         super(method, 3);\r
26296     }\r
26297 }\r
26298 exports.NotificationType3 = NotificationType3;\r
26299 class NotificationType4 extends AbstractMessageType {\r
26300     constructor(method) {\r
26301         super(method, 4);\r
26302     }\r
26303 }\r
26304 exports.NotificationType4 = NotificationType4;\r
26305 class NotificationType5 extends AbstractMessageType {\r
26306     constructor(method) {\r
26307         super(method, 5);\r
26308     }\r
26309 }\r
26310 exports.NotificationType5 = NotificationType5;\r
26311 class NotificationType6 extends AbstractMessageType {\r
26312     constructor(method) {\r
26313         super(method, 6);\r
26314     }\r
26315 }\r
26316 exports.NotificationType6 = NotificationType6;\r
26317 class NotificationType7 extends AbstractMessageType {\r
26318     constructor(method) {\r
26319         super(method, 7);\r
26320     }\r
26321 }\r
26322 exports.NotificationType7 = NotificationType7;\r
26323 class NotificationType8 extends AbstractMessageType {\r
26324     constructor(method) {\r
26325         super(method, 8);\r
26326     }\r
26327 }\r
26328 exports.NotificationType8 = NotificationType8;\r
26329 class NotificationType9 extends AbstractMessageType {\r
26330     constructor(method) {\r
26331         super(method, 9);\r
26332     }\r
26333 }\r
26334 exports.NotificationType9 = NotificationType9;\r
26335 /**\r
26336  * Tests if the given message is a request message\r
26337  */\r
26338 function isRequestMessage(message) {\r
26339     let candidate = message;\r
26340     return candidate && is.string(candidate.method) && (is.string(candidate.id) || is.number(candidate.id));\r
26341 }\r
26342 exports.isRequestMessage = isRequestMessage;\r
26343 /**\r
26344  * Tests if the given message is a notification message\r
26345  */\r
26346 function isNotificationMessage(message) {\r
26347     let candidate = message;\r
26348     return candidate && is.string(candidate.method) && message.id === void 0;\r
26349 }\r
26350 exports.isNotificationMessage = isNotificationMessage;\r
26351 /**\r
26352  * Tests if the given message is a response message\r
26353  */\r
26354 function isResponseMessage(message) {\r
26355     let candidate = message;\r
26356     return candidate && (candidate.result !== void 0 || !!candidate.error) && (is.string(candidate.id) || is.number(candidate.id) || candidate.id === null);\r
26357 }\r
26358 exports.isResponseMessage = isResponseMessage;\r
26359
26360
26361 /***/ }),
26362 /* 166 */
26363 /***/ (function(module, exports, __webpack_require__) {
26364
26365 "use strict";
26366 /* --------------------------------------------------------------------------------------------\r
26367  * Copyright (c) Microsoft Corporation. All rights reserved.\r
26368  * Licensed under the MIT License. See License.txt in the project root for license information.\r
26369  * ------------------------------------------------------------------------------------------ */\r
26370 \r
26371 Object.defineProperty(exports, "__esModule", { value: true });\r
26372 const events_1 = __webpack_require__(167);\r
26373 const Is = __webpack_require__(164);\r
26374 let DefaultSize = 8192;\r
26375 let CR = Buffer.from('\r', 'ascii')[0];\r
26376 let LF = Buffer.from('\n', 'ascii')[0];\r
26377 let CRLF = '\r\n';\r
26378 class MessageBuffer {\r
26379     constructor(encoding = 'utf8') {\r
26380         this.encoding = encoding;\r
26381         this.index = 0;\r
26382         this.buffer = Buffer.allocUnsafe(DefaultSize);\r
26383     }\r
26384     append(chunk) {\r
26385         var toAppend = chunk;\r
26386         if (typeof (chunk) === 'string') {\r
26387             var str = chunk;\r
26388             var bufferLen = Buffer.byteLength(str, this.encoding);\r
26389             toAppend = Buffer.allocUnsafe(bufferLen);\r
26390             toAppend.write(str, 0, bufferLen, this.encoding);\r
26391         }\r
26392         if (this.buffer.length - this.index >= toAppend.length) {\r
26393             toAppend.copy(this.buffer, this.index, 0, toAppend.length);\r
26394         }\r
26395         else {\r
26396             var newSize = (Math.ceil((this.index + toAppend.length) / DefaultSize) + 1) * DefaultSize;\r
26397             if (this.index === 0) {\r
26398                 this.buffer = Buffer.allocUnsafe(newSize);\r
26399                 toAppend.copy(this.buffer, 0, 0, toAppend.length);\r
26400             }\r
26401             else {\r
26402                 this.buffer = Buffer.concat([this.buffer.slice(0, this.index), toAppend], newSize);\r
26403             }\r
26404         }\r
26405         this.index += toAppend.length;\r
26406     }\r
26407     tryReadHeaders() {\r
26408         let result = undefined;\r
26409         let current = 0;\r
26410         while (current + 3 < this.index && (this.buffer[current] !== CR || this.buffer[current + 1] !== LF || this.buffer[current + 2] !== CR || this.buffer[current + 3] !== LF)) {\r
26411             current++;\r
26412         }\r
26413         // No header / body separator found (e.g CRLFCRLF)\r
26414         if (current + 3 >= this.index) {\r
26415             return result;\r
26416         }\r
26417         result = Object.create(null);\r
26418         let headers = this.buffer.toString('ascii', 0, current).split(CRLF);\r
26419         headers.forEach((header) => {\r
26420             let index = header.indexOf(':');\r
26421             if (index === -1) {\r
26422                 throw new Error('Message header must separate key and value using :');\r
26423             }\r
26424             let key = header.substr(0, index);\r
26425             let value = header.substr(index + 1).trim();\r
26426             result[key] = value;\r
26427         });\r
26428         let nextStart = current + 4;\r
26429         this.buffer = this.buffer.slice(nextStart);\r
26430         this.index = this.index - nextStart;\r
26431         return result;\r
26432     }\r
26433     tryReadContent(length) {\r
26434         if (this.index < length) {\r
26435             return null;\r
26436         }\r
26437         let result = this.buffer.toString(this.encoding, 0, length);\r
26438         let nextStart = length;\r
26439         this.buffer.copy(this.buffer, 0, nextStart);\r
26440         this.index = this.index - nextStart;\r
26441         return result;\r
26442     }\r
26443     get numberOfBytes() {\r
26444         return this.index;\r
26445     }\r
26446 }\r
26447 var MessageReader;\r
26448 (function (MessageReader) {\r
26449     function is(value) {\r
26450         let candidate = value;\r
26451         return candidate && Is.func(candidate.listen) && Is.func(candidate.dispose) &&\r
26452             Is.func(candidate.onError) && Is.func(candidate.onClose) && Is.func(candidate.onPartialMessage);\r
26453     }\r
26454     MessageReader.is = is;\r
26455 })(MessageReader = exports.MessageReader || (exports.MessageReader = {}));\r
26456 class AbstractMessageReader {\r
26457     constructor() {\r
26458         this.errorEmitter = new events_1.Emitter();\r
26459         this.closeEmitter = new events_1.Emitter();\r
26460         this.partialMessageEmitter = new events_1.Emitter();\r
26461     }\r
26462     dispose() {\r
26463         this.errorEmitter.dispose();\r
26464         this.closeEmitter.dispose();\r
26465     }\r
26466     get onError() {\r
26467         return this.errorEmitter.event;\r
26468     }\r
26469     fireError(error) {\r
26470         this.errorEmitter.fire(this.asError(error));\r
26471     }\r
26472     get onClose() {\r
26473         return this.closeEmitter.event;\r
26474     }\r
26475     fireClose() {\r
26476         this.closeEmitter.fire(undefined);\r
26477     }\r
26478     get onPartialMessage() {\r
26479         return this.partialMessageEmitter.event;\r
26480     }\r
26481     firePartialMessage(info) {\r
26482         this.partialMessageEmitter.fire(info);\r
26483     }\r
26484     asError(error) {\r
26485         if (error instanceof Error) {\r
26486             return error;\r
26487         }\r
26488         else {\r
26489             return new Error(`Reader received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
26490         }\r
26491     }\r
26492 }\r
26493 exports.AbstractMessageReader = AbstractMessageReader;\r
26494 class StreamMessageReader extends AbstractMessageReader {\r
26495     constructor(readable, encoding = 'utf8') {\r
26496         super();\r
26497         this.readable = readable;\r
26498         this.buffer = new MessageBuffer(encoding);\r
26499         this._partialMessageTimeout = 10000;\r
26500     }\r
26501     set partialMessageTimeout(timeout) {\r
26502         this._partialMessageTimeout = timeout;\r
26503     }\r
26504     get partialMessageTimeout() {\r
26505         return this._partialMessageTimeout;\r
26506     }\r
26507     listen(callback) {\r
26508         this.nextMessageLength = -1;\r
26509         this.messageToken = 0;\r
26510         this.partialMessageTimer = undefined;\r
26511         this.callback = callback;\r
26512         this.readable.on('data', (data) => {\r
26513             this.onData(data);\r
26514         });\r
26515         this.readable.on('error', (error) => this.fireError(error));\r
26516         this.readable.on('close', () => this.fireClose());\r
26517     }\r
26518     onData(data) {\r
26519         this.buffer.append(data);\r
26520         while (true) {\r
26521             if (this.nextMessageLength === -1) {\r
26522                 let headers = this.buffer.tryReadHeaders();\r
26523                 if (!headers) {\r
26524                     return;\r
26525                 }\r
26526                 let contentLength = headers['Content-Length'];\r
26527                 if (!contentLength) {\r
26528                     throw new Error('Header must provide a Content-Length property.');\r
26529                 }\r
26530                 let length = parseInt(contentLength);\r
26531                 if (isNaN(length)) {\r
26532                     throw new Error('Content-Length value must be a number.');\r
26533                 }\r
26534                 this.nextMessageLength = length;\r
26535                 // Take the encoding form the header. For compatibility\r
26536                 // treat both utf-8 and utf8 as node utf8\r
26537             }\r
26538             var msg = this.buffer.tryReadContent(this.nextMessageLength);\r
26539             if (msg === null) {\r
26540                 /** We haven't received the full message yet. */\r
26541                 this.setPartialMessageTimer();\r
26542                 return;\r
26543             }\r
26544             this.clearPartialMessageTimer();\r
26545             this.nextMessageLength = -1;\r
26546             this.messageToken++;\r
26547             var json = JSON.parse(msg);\r
26548             this.callback(json);\r
26549         }\r
26550     }\r
26551     clearPartialMessageTimer() {\r
26552         if (this.partialMessageTimer) {\r
26553             clearTimeout(this.partialMessageTimer);\r
26554             this.partialMessageTimer = undefined;\r
26555         }\r
26556     }\r
26557     setPartialMessageTimer() {\r
26558         this.clearPartialMessageTimer();\r
26559         if (this._partialMessageTimeout <= 0) {\r
26560             return;\r
26561         }\r
26562         this.partialMessageTimer = setTimeout((token, timeout) => {\r
26563             this.partialMessageTimer = undefined;\r
26564             if (token === this.messageToken) {\r
26565                 this.firePartialMessage({ messageToken: token, waitingTime: timeout });\r
26566                 this.setPartialMessageTimer();\r
26567             }\r
26568         }, this._partialMessageTimeout, this.messageToken, this._partialMessageTimeout);\r
26569     }\r
26570 }\r
26571 exports.StreamMessageReader = StreamMessageReader;\r
26572 class IPCMessageReader extends AbstractMessageReader {\r
26573     constructor(process) {\r
26574         super();\r
26575         this.process = process;\r
26576         let eventEmitter = this.process;\r
26577         eventEmitter.on('error', (error) => this.fireError(error));\r
26578         eventEmitter.on('close', () => this.fireClose());\r
26579     }\r
26580     listen(callback) {\r
26581         this.process.on('message', callback);\r
26582     }\r
26583 }\r
26584 exports.IPCMessageReader = IPCMessageReader;\r
26585 class SocketMessageReader extends StreamMessageReader {\r
26586     constructor(socket, encoding = 'utf-8') {\r
26587         super(socket, encoding);\r
26588     }\r
26589 }\r
26590 exports.SocketMessageReader = SocketMessageReader;\r
26591
26592
26593 /***/ }),
26594 /* 167 */
26595 /***/ (function(module, exports, __webpack_require__) {
26596
26597 "use strict";
26598 /* --------------------------------------------------------------------------------------------\r
26599  * Copyright (c) Microsoft Corporation. All rights reserved.\r
26600  * Licensed under the MIT License. See License.txt in the project root for license information.\r
26601  * ------------------------------------------------------------------------------------------ */\r
26602 \r
26603 Object.defineProperty(exports, "__esModule", { value: true });\r
26604 var Disposable;\r
26605 (function (Disposable) {\r
26606     function create(func) {\r
26607         return {\r
26608             dispose: func\r
26609         };\r
26610     }\r
26611     Disposable.create = create;\r
26612 })(Disposable = exports.Disposable || (exports.Disposable = {}));\r
26613 var Event;\r
26614 (function (Event) {\r
26615     const _disposable = { dispose() { } };\r
26616     Event.None = function () { return _disposable; };\r
26617 })(Event = exports.Event || (exports.Event = {}));\r
26618 class CallbackList {\r
26619     add(callback, context = null, bucket) {\r
26620         if (!this._callbacks) {\r
26621             this._callbacks = [];\r
26622             this._contexts = [];\r
26623         }\r
26624         this._callbacks.push(callback);\r
26625         this._contexts.push(context);\r
26626         if (Array.isArray(bucket)) {\r
26627             bucket.push({ dispose: () => this.remove(callback, context) });\r
26628         }\r
26629     }\r
26630     remove(callback, context = null) {\r
26631         if (!this._callbacks) {\r
26632             return;\r
26633         }\r
26634         var foundCallbackWithDifferentContext = false;\r
26635         for (var i = 0, len = this._callbacks.length; i < len; i++) {\r
26636             if (this._callbacks[i] === callback) {\r
26637                 if (this._contexts[i] === context) {\r
26638                     // callback & context match => remove it\r
26639                     this._callbacks.splice(i, 1);\r
26640                     this._contexts.splice(i, 1);\r
26641                     return;\r
26642                 }\r
26643                 else {\r
26644                     foundCallbackWithDifferentContext = true;\r
26645                 }\r
26646             }\r
26647         }\r
26648         if (foundCallbackWithDifferentContext) {\r
26649             throw new Error('When adding a listener with a context, you should remove it with the same context');\r
26650         }\r
26651     }\r
26652     invoke(...args) {\r
26653         if (!this._callbacks) {\r
26654             return [];\r
26655         }\r
26656         var ret = [], callbacks = this._callbacks.slice(0), contexts = this._contexts.slice(0);\r
26657         for (var i = 0, len = callbacks.length; i < len; i++) {\r
26658             try {\r
26659                 ret.push(callbacks[i].apply(contexts[i], args));\r
26660             }\r
26661             catch (e) {\r
26662                 // eslint-disable-next-line no-console\r
26663                 console.error(e);\r
26664             }\r
26665         }\r
26666         return ret;\r
26667     }\r
26668     isEmpty() {\r
26669         return !this._callbacks || this._callbacks.length === 0;\r
26670     }\r
26671     dispose() {\r
26672         this._callbacks = undefined;\r
26673         this._contexts = undefined;\r
26674     }\r
26675 }\r
26676 class Emitter {\r
26677     constructor(_options) {\r
26678         this._options = _options;\r
26679     }\r
26680     /**\r
26681      * For the public to allow to subscribe\r
26682      * to events from this Emitter\r
26683      */\r
26684     get event() {\r
26685         if (!this._event) {\r
26686             this._event = (listener, thisArgs, disposables) => {\r
26687                 if (!this._callbacks) {\r
26688                     this._callbacks = new CallbackList();\r
26689                 }\r
26690                 if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {\r
26691                     this._options.onFirstListenerAdd(this);\r
26692                 }\r
26693                 this._callbacks.add(listener, thisArgs);\r
26694                 let result;\r
26695                 result = {\r
26696                     dispose: () => {\r
26697                         this._callbacks.remove(listener, thisArgs);\r
26698                         result.dispose = Emitter._noop;\r
26699                         if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {\r
26700                             this._options.onLastListenerRemove(this);\r
26701                         }\r
26702                     }\r
26703                 };\r
26704                 if (Array.isArray(disposables)) {\r
26705                     disposables.push(result);\r
26706                 }\r
26707                 return result;\r
26708             };\r
26709         }\r
26710         return this._event;\r
26711     }\r
26712     /**\r
26713      * To be kept private to fire an event to\r
26714      * subscribers\r
26715      */\r
26716     fire(event) {\r
26717         if (this._callbacks) {\r
26718             this._callbacks.invoke.call(this._callbacks, event);\r
26719         }\r
26720     }\r
26721     dispose() {\r
26722         if (this._callbacks) {\r
26723             this._callbacks.dispose();\r
26724             this._callbacks = undefined;\r
26725         }\r
26726     }\r
26727 }\r
26728 exports.Emitter = Emitter;\r
26729 Emitter._noop = function () { };\r
26730
26731
26732 /***/ }),
26733 /* 168 */
26734 /***/ (function(module, exports, __webpack_require__) {
26735
26736 "use strict";
26737 /* --------------------------------------------------------------------------------------------\r
26738  * Copyright (c) Microsoft Corporation. All rights reserved.\r
26739  * Licensed under the MIT License. See License.txt in the project root for license information.\r
26740  * ------------------------------------------------------------------------------------------ */\r
26741 \r
26742 Object.defineProperty(exports, "__esModule", { value: true });\r
26743 const events_1 = __webpack_require__(167);\r
26744 const Is = __webpack_require__(164);\r
26745 let ContentLength = 'Content-Length: ';\r
26746 let CRLF = '\r\n';\r
26747 var MessageWriter;\r
26748 (function (MessageWriter) {\r
26749     function is(value) {\r
26750         let candidate = value;\r
26751         return candidate && Is.func(candidate.dispose) && Is.func(candidate.onClose) &&\r
26752             Is.func(candidate.onError) && Is.func(candidate.write);\r
26753     }\r
26754     MessageWriter.is = is;\r
26755 })(MessageWriter = exports.MessageWriter || (exports.MessageWriter = {}));\r
26756 class AbstractMessageWriter {\r
26757     constructor() {\r
26758         this.errorEmitter = new events_1.Emitter();\r
26759         this.closeEmitter = new events_1.Emitter();\r
26760     }\r
26761     dispose() {\r
26762         this.errorEmitter.dispose();\r
26763         this.closeEmitter.dispose();\r
26764     }\r
26765     get onError() {\r
26766         return this.errorEmitter.event;\r
26767     }\r
26768     fireError(error, message, count) {\r
26769         this.errorEmitter.fire([this.asError(error), message, count]);\r
26770     }\r
26771     get onClose() {\r
26772         return this.closeEmitter.event;\r
26773     }\r
26774     fireClose() {\r
26775         this.closeEmitter.fire(undefined);\r
26776     }\r
26777     asError(error) {\r
26778         if (error instanceof Error) {\r
26779             return error;\r
26780         }\r
26781         else {\r
26782             return new Error(`Writer received error. Reason: ${Is.string(error.message) ? error.message : 'unknown'}`);\r
26783         }\r
26784     }\r
26785 }\r
26786 exports.AbstractMessageWriter = AbstractMessageWriter;\r
26787 class StreamMessageWriter extends AbstractMessageWriter {\r
26788     constructor(writable, encoding = 'utf8') {\r
26789         super();\r
26790         this.writable = writable;\r
26791         this.encoding = encoding;\r
26792         this.errorCount = 0;\r
26793         this.writable.on('error', (error) => this.fireError(error));\r
26794         this.writable.on('close', () => this.fireClose());\r
26795     }\r
26796     write(msg) {\r
26797         let json = JSON.stringify(msg);\r
26798         let contentLength = Buffer.byteLength(json, this.encoding);\r
26799         let headers = [\r
26800             ContentLength, contentLength.toString(), CRLF,\r
26801             CRLF\r
26802         ];\r
26803         try {\r
26804             // Header must be written in ASCII encoding\r
26805             this.writable.write(headers.join(''), 'ascii');\r
26806             // Now write the content. This can be written in any encoding\r
26807             this.writable.write(json, this.encoding);\r
26808             this.errorCount = 0;\r
26809         }\r
26810         catch (error) {\r
26811             this.errorCount++;\r
26812             this.fireError(error, msg, this.errorCount);\r
26813         }\r
26814     }\r
26815 }\r
26816 exports.StreamMessageWriter = StreamMessageWriter;\r
26817 class IPCMessageWriter extends AbstractMessageWriter {\r
26818     constructor(process) {\r
26819         super();\r
26820         this.process = process;\r
26821         this.errorCount = 0;\r
26822         this.queue = [];\r
26823         this.sending = false;\r
26824         let eventEmitter = this.process;\r
26825         eventEmitter.on('error', (error) => this.fireError(error));\r
26826         eventEmitter.on('close', () => this.fireClose);\r
26827     }\r
26828     write(msg) {\r
26829         if (!this.sending && this.queue.length === 0) {\r
26830             // See https://github.com/nodejs/node/issues/7657\r
26831             this.doWriteMessage(msg);\r
26832         }\r
26833         else {\r
26834             this.queue.push(msg);\r
26835         }\r
26836     }\r
26837     doWriteMessage(msg) {\r
26838         try {\r
26839             if (this.process.send) {\r
26840                 this.sending = true;\r
26841                 this.process.send(msg, undefined, undefined, (error) => {\r
26842                     this.sending = false;\r
26843                     if (error) {\r
26844                         this.errorCount++;\r
26845                         this.fireError(error, msg, this.errorCount);\r
26846                     }\r
26847                     else {\r
26848                         this.errorCount = 0;\r
26849                     }\r
26850                     if (this.queue.length > 0) {\r
26851                         this.doWriteMessage(this.queue.shift());\r
26852                     }\r
26853                 });\r
26854             }\r
26855         }\r
26856         catch (error) {\r
26857             this.errorCount++;\r
26858             this.fireError(error, msg, this.errorCount);\r
26859         }\r
26860     }\r
26861 }\r
26862 exports.IPCMessageWriter = IPCMessageWriter;\r
26863 class SocketMessageWriter extends AbstractMessageWriter {\r
26864     constructor(socket, encoding = 'utf8') {\r
26865         super();\r
26866         this.socket = socket;\r
26867         this.queue = [];\r
26868         this.sending = false;\r
26869         this.encoding = encoding;\r
26870         this.errorCount = 0;\r
26871         this.socket.on('error', (error) => this.fireError(error));\r
26872         this.socket.on('close', () => this.fireClose());\r
26873     }\r
26874     dispose() {\r
26875         super.dispose();\r
26876         this.socket.destroy();\r
26877     }\r
26878     write(msg) {\r
26879         if (!this.sending && this.queue.length === 0) {\r
26880             // See https://github.com/nodejs/node/issues/7657\r
26881             this.doWriteMessage(msg);\r
26882         }\r
26883         else {\r
26884             this.queue.push(msg);\r
26885         }\r
26886     }\r
26887     doWriteMessage(msg) {\r
26888         let json = JSON.stringify(msg);\r
26889         let contentLength = Buffer.byteLength(json, this.encoding);\r
26890         let headers = [\r
26891             ContentLength, contentLength.toString(), CRLF,\r
26892             CRLF\r
26893         ];\r
26894         try {\r
26895             // Header must be written in ASCII encoding\r
26896             this.sending = true;\r
26897             this.socket.write(headers.join(''), 'ascii', (error) => {\r
26898                 if (error) {\r
26899                     this.handleError(error, msg);\r
26900                 }\r
26901                 try {\r
26902                     // Now write the content. This can be written in any encoding\r
26903                     this.socket.write(json, this.encoding, (error) => {\r
26904                         this.sending = false;\r
26905                         if (error) {\r
26906                             this.handleError(error, msg);\r
26907                         }\r
26908                         else {\r
26909                             this.errorCount = 0;\r
26910                         }\r
26911                         if (this.queue.length > 0) {\r
26912                             this.doWriteMessage(this.queue.shift());\r
26913                         }\r
26914                     });\r
26915                 }\r
26916                 catch (error) {\r
26917                     this.handleError(error, msg);\r
26918                 }\r
26919             });\r
26920         }\r
26921         catch (error) {\r
26922             this.handleError(error, msg);\r
26923         }\r
26924     }\r
26925     handleError(error, msg) {\r
26926         this.errorCount++;\r
26927         this.fireError(error, msg, this.errorCount);\r
26928     }\r
26929 }\r
26930 exports.SocketMessageWriter = SocketMessageWriter;\r
26931
26932
26933 /***/ }),
26934 /* 169 */
26935 /***/ (function(module, exports, __webpack_require__) {
26936
26937 "use strict";
26938 /*---------------------------------------------------------------------------------------------\r
26939  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
26940  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
26941  *--------------------------------------------------------------------------------------------*/\r
26942 \r
26943 Object.defineProperty(exports, "__esModule", { value: true });\r
26944 const events_1 = __webpack_require__(167);\r
26945 const Is = __webpack_require__(164);\r
26946 var CancellationToken;\r
26947 (function (CancellationToken) {\r
26948     CancellationToken.None = Object.freeze({\r
26949         isCancellationRequested: false,\r
26950         onCancellationRequested: events_1.Event.None\r
26951     });\r
26952     CancellationToken.Cancelled = Object.freeze({\r
26953         isCancellationRequested: true,\r
26954         onCancellationRequested: events_1.Event.None\r
26955     });\r
26956     function is(value) {\r
26957         let candidate = value;\r
26958         return candidate && (candidate === CancellationToken.None\r
26959             || candidate === CancellationToken.Cancelled\r
26960             || (Is.boolean(candidate.isCancellationRequested) && !!candidate.onCancellationRequested));\r
26961     }\r
26962     CancellationToken.is = is;\r
26963 })(CancellationToken = exports.CancellationToken || (exports.CancellationToken = {}));\r
26964 const shortcutEvent = Object.freeze(function (callback, context) {\r
26965     let handle = setTimeout(callback.bind(context), 0);\r
26966     return { dispose() { clearTimeout(handle); } };\r
26967 });\r
26968 class MutableToken {\r
26969     constructor() {\r
26970         this._isCancelled = false;\r
26971     }\r
26972     cancel() {\r
26973         if (!this._isCancelled) {\r
26974             this._isCancelled = true;\r
26975             if (this._emitter) {\r
26976                 this._emitter.fire(undefined);\r
26977                 this.dispose();\r
26978             }\r
26979         }\r
26980     }\r
26981     get isCancellationRequested() {\r
26982         return this._isCancelled;\r
26983     }\r
26984     get onCancellationRequested() {\r
26985         if (this._isCancelled) {\r
26986             return shortcutEvent;\r
26987         }\r
26988         if (!this._emitter) {\r
26989             this._emitter = new events_1.Emitter();\r
26990         }\r
26991         return this._emitter.event;\r
26992     }\r
26993     dispose() {\r
26994         if (this._emitter) {\r
26995             this._emitter.dispose();\r
26996             this._emitter = undefined;\r
26997         }\r
26998     }\r
26999 }\r
27000 class CancellationTokenSource {\r
27001     get token() {\r
27002         if (!this._token) {\r
27003             // be lazy and create the token only when\r
27004             // actually needed\r
27005             this._token = new MutableToken();\r
27006         }\r
27007         return this._token;\r
27008     }\r
27009     cancel() {\r
27010         if (!this._token) {\r
27011             // save an object by returning the default\r
27012             // cancelled token when cancellation happens\r
27013             // before someone asks for the token\r
27014             this._token = CancellationToken.Cancelled;\r
27015         }\r
27016         else {\r
27017             this._token.cancel();\r
27018         }\r
27019     }\r
27020     dispose() {\r
27021         if (!this._token) {\r
27022             // ensure to initialize with an empty token if we had none\r
27023             this._token = CancellationToken.None;\r
27024         }\r
27025         else if (this._token instanceof MutableToken) {\r
27026             // actually dispose\r
27027             this._token.dispose();\r
27028         }\r
27029     }\r
27030 }\r
27031 exports.CancellationTokenSource = CancellationTokenSource;\r
27032
27033
27034 /***/ }),
27035 /* 170 */
27036 /***/ (function(module, exports, __webpack_require__) {
27037
27038 "use strict";
27039 \r
27040 /*---------------------------------------------------------------------------------------------\r
27041  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
27042  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
27043  *--------------------------------------------------------------------------------------------*/\r
27044 Object.defineProperty(exports, "__esModule", { value: true });\r
27045 var Touch;\r
27046 (function (Touch) {\r
27047     Touch.None = 0;\r
27048     Touch.First = 1;\r
27049     Touch.Last = 2;\r
27050 })(Touch = exports.Touch || (exports.Touch = {}));\r
27051 class LinkedMap {\r
27052     constructor() {\r
27053         this._map = new Map();\r
27054         this._head = undefined;\r
27055         this._tail = undefined;\r
27056         this._size = 0;\r
27057     }\r
27058     clear() {\r
27059         this._map.clear();\r
27060         this._head = undefined;\r
27061         this._tail = undefined;\r
27062         this._size = 0;\r
27063     }\r
27064     isEmpty() {\r
27065         return !this._head && !this._tail;\r
27066     }\r
27067     get size() {\r
27068         return this._size;\r
27069     }\r
27070     has(key) {\r
27071         return this._map.has(key);\r
27072     }\r
27073     get(key) {\r
27074         const item = this._map.get(key);\r
27075         if (!item) {\r
27076             return undefined;\r
27077         }\r
27078         return item.value;\r
27079     }\r
27080     set(key, value, touch = Touch.None) {\r
27081         let item = this._map.get(key);\r
27082         if (item) {\r
27083             item.value = value;\r
27084             if (touch !== Touch.None) {\r
27085                 this.touch(item, touch);\r
27086             }\r
27087         }\r
27088         else {\r
27089             item = { key, value, next: undefined, previous: undefined };\r
27090             switch (touch) {\r
27091                 case Touch.None:\r
27092                     this.addItemLast(item);\r
27093                     break;\r
27094                 case Touch.First:\r
27095                     this.addItemFirst(item);\r
27096                     break;\r
27097                 case Touch.Last:\r
27098                     this.addItemLast(item);\r
27099                     break;\r
27100                 default:\r
27101                     this.addItemLast(item);\r
27102                     break;\r
27103             }\r
27104             this._map.set(key, item);\r
27105             this._size++;\r
27106         }\r
27107     }\r
27108     delete(key) {\r
27109         const item = this._map.get(key);\r
27110         if (!item) {\r
27111             return false;\r
27112         }\r
27113         this._map.delete(key);\r
27114         this.removeItem(item);\r
27115         this._size--;\r
27116         return true;\r
27117     }\r
27118     shift() {\r
27119         if (!this._head && !this._tail) {\r
27120             return undefined;\r
27121         }\r
27122         if (!this._head || !this._tail) {\r
27123             throw new Error('Invalid list');\r
27124         }\r
27125         const item = this._head;\r
27126         this._map.delete(item.key);\r
27127         this.removeItem(item);\r
27128         this._size--;\r
27129         return item.value;\r
27130     }\r
27131     forEach(callbackfn, thisArg) {\r
27132         let current = this._head;\r
27133         while (current) {\r
27134             if (thisArg) {\r
27135                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
27136             }\r
27137             else {\r
27138                 callbackfn(current.value, current.key, this);\r
27139             }\r
27140             current = current.next;\r
27141         }\r
27142     }\r
27143     forEachReverse(callbackfn, thisArg) {\r
27144         let current = this._tail;\r
27145         while (current) {\r
27146             if (thisArg) {\r
27147                 callbackfn.bind(thisArg)(current.value, current.key, this);\r
27148             }\r
27149             else {\r
27150                 callbackfn(current.value, current.key, this);\r
27151             }\r
27152             current = current.previous;\r
27153         }\r
27154     }\r
27155     values() {\r
27156         let result = [];\r
27157         let current = this._head;\r
27158         while (current) {\r
27159             result.push(current.value);\r
27160             current = current.next;\r
27161         }\r
27162         return result;\r
27163     }\r
27164     keys() {\r
27165         let result = [];\r
27166         let current = this._head;\r
27167         while (current) {\r
27168             result.push(current.key);\r
27169             current = current.next;\r
27170         }\r
27171         return result;\r
27172     }\r
27173     /* JSON RPC run on es5 which has no Symbol.iterator\r
27174     public keys(): IterableIterator<K> {\r
27175         let current = this._head;\r
27176         let iterator: IterableIterator<K> = {\r
27177             [Symbol.iterator]() {\r
27178                 return iterator;\r
27179             },\r
27180             next():IteratorResult<K> {\r
27181                 if (current) {\r
27182                     let result = { value: current.key, done: false };\r
27183                     current = current.next;\r
27184                     return result;\r
27185                 } else {\r
27186                     return { value: undefined, done: true };\r
27187                 }\r
27188             }\r
27189         };\r
27190         return iterator;\r
27191     }\r
27192 \r
27193     public values(): IterableIterator<V> {\r
27194         let current = this._head;\r
27195         let iterator: IterableIterator<V> = {\r
27196             [Symbol.iterator]() {\r
27197                 return iterator;\r
27198             },\r
27199             next():IteratorResult<V> {\r
27200                 if (current) {\r
27201                     let result = { value: current.value, done: false };\r
27202                     current = current.next;\r
27203                     return result;\r
27204                 } else {\r
27205                     return { value: undefined, done: true };\r
27206                 }\r
27207             }\r
27208         };\r
27209         return iterator;\r
27210     }\r
27211     */\r
27212     addItemFirst(item) {\r
27213         // First time Insert\r
27214         if (!this._head && !this._tail) {\r
27215             this._tail = item;\r
27216         }\r
27217         else if (!this._head) {\r
27218             throw new Error('Invalid list');\r
27219         }\r
27220         else {\r
27221             item.next = this._head;\r
27222             this._head.previous = item;\r
27223         }\r
27224         this._head = item;\r
27225     }\r
27226     addItemLast(item) {\r
27227         // First time Insert\r
27228         if (!this._head && !this._tail) {\r
27229             this._head = item;\r
27230         }\r
27231         else if (!this._tail) {\r
27232             throw new Error('Invalid list');\r
27233         }\r
27234         else {\r
27235             item.previous = this._tail;\r
27236             this._tail.next = item;\r
27237         }\r
27238         this._tail = item;\r
27239     }\r
27240     removeItem(item) {\r
27241         if (item === this._head && item === this._tail) {\r
27242             this._head = undefined;\r
27243             this._tail = undefined;\r
27244         }\r
27245         else if (item === this._head) {\r
27246             this._head = item.next;\r
27247         }\r
27248         else if (item === this._tail) {\r
27249             this._tail = item.previous;\r
27250         }\r
27251         else {\r
27252             const next = item.next;\r
27253             const previous = item.previous;\r
27254             if (!next || !previous) {\r
27255                 throw new Error('Invalid list');\r
27256             }\r
27257             next.previous = previous;\r
27258             previous.next = next;\r
27259         }\r
27260     }\r
27261     touch(item, touch) {\r
27262         if (!this._head || !this._tail) {\r
27263             throw new Error('Invalid list');\r
27264         }\r
27265         if ((touch !== Touch.First && touch !== Touch.Last)) {\r
27266             return;\r
27267         }\r
27268         if (touch === Touch.First) {\r
27269             if (item === this._head) {\r
27270                 return;\r
27271             }\r
27272             const next = item.next;\r
27273             const previous = item.previous;\r
27274             // Unlink the item\r
27275             if (item === this._tail) {\r
27276                 // previous must be defined since item was not head but is tail\r
27277                 // So there are more than on item in the map\r
27278                 previous.next = undefined;\r
27279                 this._tail = previous;\r
27280             }\r
27281             else {\r
27282                 // Both next and previous are not undefined since item was neither head nor tail.\r
27283                 next.previous = previous;\r
27284                 previous.next = next;\r
27285             }\r
27286             // Insert the node at head\r
27287             item.previous = undefined;\r
27288             item.next = this._head;\r
27289             this._head.previous = item;\r
27290             this._head = item;\r
27291         }\r
27292         else if (touch === Touch.Last) {\r
27293             if (item === this._tail) {\r
27294                 return;\r
27295             }\r
27296             const next = item.next;\r
27297             const previous = item.previous;\r
27298             // Unlink the item.\r
27299             if (item === this._head) {\r
27300                 // next must be defined since item was not tail but is head\r
27301                 // So there are more than on item in the map\r
27302                 next.previous = undefined;\r
27303                 this._head = next;\r
27304             }\r
27305             else {\r
27306                 // Both next and previous are not undefined since item was neither head nor tail.\r
27307                 next.previous = previous;\r
27308                 previous.next = next;\r
27309             }\r
27310             item.next = undefined;\r
27311             item.previous = this._tail;\r
27312             this._tail.next = item;\r
27313             this._tail = item;\r
27314         }\r
27315     }\r
27316 }\r
27317 exports.LinkedMap = LinkedMap;\r
27318
27319
27320 /***/ }),
27321 /* 171 */
27322 /***/ (function(module, exports, __webpack_require__) {
27323
27324 "use strict";
27325 /* --------------------------------------------------------------------------------------------\r
27326  * Copyright (c) Microsoft Corporation. All rights reserved.\r
27327  * Licensed under the MIT License. See License.txt in the project root for license information.\r
27328  * ------------------------------------------------------------------------------------------ */\r
27329 \r
27330 Object.defineProperty(exports, "__esModule", { value: true });\r
27331 const path_1 = __webpack_require__(38);\r
27332 const os_1 = __webpack_require__(111);\r
27333 const crypto_1 = __webpack_require__(172);\r
27334 const net_1 = __webpack_require__(173);\r
27335 const messageReader_1 = __webpack_require__(166);\r
27336 const messageWriter_1 = __webpack_require__(168);\r
27337 function generateRandomPipeName() {\r
27338     const randomSuffix = crypto_1.randomBytes(21).toString('hex');\r
27339     if (process.platform === 'win32') {\r
27340         return `\\\\.\\pipe\\vscode-jsonrpc-${randomSuffix}-sock`;\r
27341     }\r
27342     else {\r
27343         // Mac/Unix: use socket file\r
27344         return path_1.join(os_1.tmpdir(), `vscode-${randomSuffix}.sock`);\r
27345     }\r
27346 }\r
27347 exports.generateRandomPipeName = generateRandomPipeName;\r
27348 function createClientPipeTransport(pipeName, encoding = 'utf-8') {\r
27349     let connectResolve;\r
27350     let connected = new Promise((resolve, _reject) => {\r
27351         connectResolve = resolve;\r
27352     });\r
27353     return new Promise((resolve, reject) => {\r
27354         let server = net_1.createServer((socket) => {\r
27355             server.close();\r
27356             connectResolve([\r
27357                 new messageReader_1.SocketMessageReader(socket, encoding),\r
27358                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
27359             ]);\r
27360         });\r
27361         server.on('error', reject);\r
27362         server.listen(pipeName, () => {\r
27363             server.removeListener('error', reject);\r
27364             resolve({\r
27365                 onConnected: () => { return connected; }\r
27366             });\r
27367         });\r
27368     });\r
27369 }\r
27370 exports.createClientPipeTransport = createClientPipeTransport;\r
27371 function createServerPipeTransport(pipeName, encoding = 'utf-8') {\r
27372     const socket = net_1.createConnection(pipeName);\r
27373     return [\r
27374         new messageReader_1.SocketMessageReader(socket, encoding),\r
27375         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
27376     ];\r
27377 }\r
27378 exports.createServerPipeTransport = createServerPipeTransport;\r
27379
27380
27381 /***/ }),
27382 /* 172 */
27383 /***/ (function(module, exports) {
27384
27385 module.exports = require("crypto");
27386
27387 /***/ }),
27388 /* 173 */
27389 /***/ (function(module, exports) {
27390
27391 module.exports = require("net");
27392
27393 /***/ }),
27394 /* 174 */
27395 /***/ (function(module, exports, __webpack_require__) {
27396
27397 "use strict";
27398 /* --------------------------------------------------------------------------------------------\r
27399  * Copyright (c) Microsoft Corporation. All rights reserved.\r
27400  * Licensed under the MIT License. See License.txt in the project root for license information.\r
27401  * ------------------------------------------------------------------------------------------ */\r
27402 \r
27403 Object.defineProperty(exports, "__esModule", { value: true });\r
27404 const net_1 = __webpack_require__(173);\r
27405 const messageReader_1 = __webpack_require__(166);\r
27406 const messageWriter_1 = __webpack_require__(168);\r
27407 function createClientSocketTransport(port, encoding = 'utf-8') {\r
27408     let connectResolve;\r
27409     let connected = new Promise((resolve, _reject) => {\r
27410         connectResolve = resolve;\r
27411     });\r
27412     return new Promise((resolve, reject) => {\r
27413         let server = net_1.createServer((socket) => {\r
27414             server.close();\r
27415             connectResolve([\r
27416                 new messageReader_1.SocketMessageReader(socket, encoding),\r
27417                 new messageWriter_1.SocketMessageWriter(socket, encoding)\r
27418             ]);\r
27419         });\r
27420         server.on('error', reject);\r
27421         server.listen(port, '127.0.0.1', () => {\r
27422             server.removeListener('error', reject);\r
27423             resolve({\r
27424                 onConnected: () => { return connected; }\r
27425             });\r
27426         });\r
27427     });\r
27428 }\r
27429 exports.createClientSocketTransport = createClientSocketTransport;\r
27430 function createServerSocketTransport(port, encoding = 'utf-8') {\r
27431     const socket = net_1.createConnection(port, '127.0.0.1');\r
27432     return [\r
27433         new messageReader_1.SocketMessageReader(socket, encoding),\r
27434         new messageWriter_1.SocketMessageWriter(socket, encoding)\r
27435     ];\r
27436 }\r
27437 exports.createServerSocketTransport = createServerSocketTransport;\r
27438
27439
27440 /***/ }),
27441 /* 175 */
27442 /***/ (function(module, __webpack_exports__, __webpack_require__) {
27443
27444 "use strict";
27445 __webpack_require__.r(__webpack_exports__);
27446 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Position", function() { return Position; });
27447 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Range", function() { return Range; });
27448 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
27449 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationLink", function() { return LocationLink; });
27450 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return Color; });
27451 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorInformation", function() { return ColorInformation; });
27452 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColorPresentation", function() { return ColorPresentation; });
27453 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRangeKind", function() { return FoldingRangeKind; });
27454 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FoldingRange", function() { return FoldingRange; });
27455 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticRelatedInformation", function() { return DiagnosticRelatedInformation; });
27456 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticSeverity", function() { return DiagnosticSeverity; });
27457 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DiagnosticTag", function() { return DiagnosticTag; });
27458 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Diagnostic", function() { return Diagnostic; });
27459 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
27460 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextEdit", function() { return TextEdit; });
27461 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentEdit", function() { return TextDocumentEdit; });
27462 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateFile", function() { return CreateFile; });
27463 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenameFile", function() { return RenameFile; });
27464 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeleteFile", function() { return DeleteFile; });
27465 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceEdit", function() { return WorkspaceEdit; });
27466 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WorkspaceChange", function() { return WorkspaceChange; });
27467 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentIdentifier", function() { return TextDocumentIdentifier; });
27468 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VersionedTextDocumentIdentifier", function() { return VersionedTextDocumentIdentifier; });
27469 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocumentItem", function() { return TextDocumentItem; });
27470 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupKind", function() { return MarkupKind; });
27471 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkupContent", function() { return MarkupContent; });
27472 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemKind", function() { return CompletionItemKind; });
27473 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InsertTextFormat", function() { return InsertTextFormat; });
27474 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItemTag", function() { return CompletionItemTag; });
27475 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionItem", function() { return CompletionItem; });
27476 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompletionList", function() { return CompletionList; });
27477 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarkedString", function() { return MarkedString; });
27478 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Hover", function() { return Hover; });
27479 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParameterInformation", function() { return ParameterInformation; });
27480 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignatureInformation", function() { return SignatureInformation; });
27481 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlightKind", function() { return DocumentHighlightKind; });
27482 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentHighlight", function() { return DocumentHighlight; });
27483 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolKind", function() { return SymbolKind; });
27484 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolTag", function() { return SymbolTag; });
27485 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SymbolInformation", function() { return SymbolInformation; });
27486 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentSymbol", function() { return DocumentSymbol; });
27487 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionKind", function() { return CodeActionKind; });
27488 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeActionContext", function() { return CodeActionContext; });
27489 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeAction", function() { return CodeAction; });
27490 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CodeLens", function() { return CodeLens; });
27491 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormattingOptions", function() { return FormattingOptions; });
27492 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DocumentLink", function() { return DocumentLink; });
27493 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionRange", function() { return SelectionRange; });
27494 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOL", function() { return EOL; });
27495 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextDocument", function() { return TextDocument; });
27496 /* --------------------------------------------------------------------------------------------\r
27497  * Copyright (c) Microsoft Corporation. All rights reserved.\r
27498  * Licensed under the MIT License. See License.txt in the project root for license information.\r
27499  * ------------------------------------------------------------------------------------------ */\r
27500 \r
27501 /**\r
27502  * The Position namespace provides helper functions to work with\r
27503  * [Position](#Position) literals.\r
27504  */\r
27505 var Position;\r
27506 (function (Position) {\r
27507     /**\r
27508      * Creates a new Position literal from the given line and character.\r
27509      * @param line The position's line.\r
27510      * @param character The position's character.\r
27511      */\r
27512     function create(line, character) {\r
27513         return { line: line, character: character };\r
27514     }\r
27515     Position.create = create;\r
27516     /**\r
27517      * Checks whether the given liternal conforms to the [Position](#Position) interface.\r
27518      */\r
27519     function is(value) {\r
27520         var candidate = value;\r
27521         return Is.objectLiteral(candidate) && Is.number(candidate.line) && Is.number(candidate.character);\r
27522     }\r
27523     Position.is = is;\r
27524 })(Position || (Position = {}));\r
27525 /**\r
27526  * The Range namespace provides helper functions to work with\r
27527  * [Range](#Range) literals.\r
27528  */\r
27529 var Range;\r
27530 (function (Range) {\r
27531     function create(one, two, three, four) {\r
27532         if (Is.number(one) && Is.number(two) && Is.number(three) && Is.number(four)) {\r
27533             return { start: Position.create(one, two), end: Position.create(three, four) };\r
27534         }\r
27535         else if (Position.is(one) && Position.is(two)) {\r
27536             return { start: one, end: two };\r
27537         }\r
27538         else {\r
27539             throw new Error("Range#create called with invalid arguments[" + one + ", " + two + ", " + three + ", " + four + "]");\r
27540         }\r
27541     }\r
27542     Range.create = create;\r
27543     /**\r
27544      * Checks whether the given literal conforms to the [Range](#Range) interface.\r
27545      */\r
27546     function is(value) {\r
27547         var candidate = value;\r
27548         return Is.objectLiteral(candidate) && Position.is(candidate.start) && Position.is(candidate.end);\r
27549     }\r
27550     Range.is = is;\r
27551 })(Range || (Range = {}));\r
27552 /**\r
27553  * The Location namespace provides helper functions to work with\r
27554  * [Location](#Location) literals.\r
27555  */\r
27556 var Location;\r
27557 (function (Location) {\r
27558     /**\r
27559      * Creates a Location literal.\r
27560      * @param uri The location's uri.\r
27561      * @param range The location's range.\r
27562      */\r
27563     function create(uri, range) {\r
27564         return { uri: uri, range: range };\r
27565     }\r
27566     Location.create = create;\r
27567     /**\r
27568      * Checks whether the given literal conforms to the [Location](#Location) interface.\r
27569      */\r
27570     function is(value) {\r
27571         var candidate = value;\r
27572         return Is.defined(candidate) && Range.is(candidate.range) && (Is.string(candidate.uri) || Is.undefined(candidate.uri));\r
27573     }\r
27574     Location.is = is;\r
27575 })(Location || (Location = {}));\r
27576 /**\r
27577  * The LocationLink namespace provides helper functions to work with\r
27578  * [LocationLink](#LocationLink) literals.\r
27579  */\r
27580 var LocationLink;\r
27581 (function (LocationLink) {\r
27582     /**\r
27583      * Creates a LocationLink literal.\r
27584      * @param targetUri The definition's uri.\r
27585      * @param targetRange The full range of the definition.\r
27586      * @param targetSelectionRange The span of the symbol definition at the target.\r
27587      * @param originSelectionRange The span of the symbol being defined in the originating source file.\r
27588      */\r
27589     function create(targetUri, targetRange, targetSelectionRange, originSelectionRange) {\r
27590         return { targetUri: targetUri, targetRange: targetRange, targetSelectionRange: targetSelectionRange, originSelectionRange: originSelectionRange };\r
27591     }\r
27592     LocationLink.create = create;\r
27593     /**\r
27594      * Checks whether the given literal conforms to the [LocationLink](#LocationLink) interface.\r
27595      */\r
27596     function is(value) {\r
27597         var candidate = value;\r
27598         return Is.defined(candidate) && Range.is(candidate.targetRange) && Is.string(candidate.targetUri)\r
27599             && (Range.is(candidate.targetSelectionRange) || Is.undefined(candidate.targetSelectionRange))\r
27600             && (Range.is(candidate.originSelectionRange) || Is.undefined(candidate.originSelectionRange));\r
27601     }\r
27602     LocationLink.is = is;\r
27603 })(LocationLink || (LocationLink = {}));\r
27604 /**\r
27605  * The Color namespace provides helper functions to work with\r
27606  * [Color](#Color) literals.\r
27607  */\r
27608 var Color;\r
27609 (function (Color) {\r
27610     /**\r
27611      * Creates a new Color literal.\r
27612      */\r
27613     function create(red, green, blue, alpha) {\r
27614         return {\r
27615             red: red,\r
27616             green: green,\r
27617             blue: blue,\r
27618             alpha: alpha,\r
27619         };\r
27620     }\r
27621     Color.create = create;\r
27622     /**\r
27623      * Checks whether the given literal conforms to the [Color](#Color) interface.\r
27624      */\r
27625     function is(value) {\r
27626         var candidate = value;\r
27627         return Is.number(candidate.red)\r
27628             && Is.number(candidate.green)\r
27629             && Is.number(candidate.blue)\r
27630             && Is.number(candidate.alpha);\r
27631     }\r
27632     Color.is = is;\r
27633 })(Color || (Color = {}));\r
27634 /**\r
27635  * The ColorInformation namespace provides helper functions to work with\r
27636  * [ColorInformation](#ColorInformation) literals.\r
27637  */\r
27638 var ColorInformation;\r
27639 (function (ColorInformation) {\r
27640     /**\r
27641      * Creates a new ColorInformation literal.\r
27642      */\r
27643     function create(range, color) {\r
27644         return {\r
27645             range: range,\r
27646             color: color,\r
27647         };\r
27648     }\r
27649     ColorInformation.create = create;\r
27650     /**\r
27651      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
27652      */\r
27653     function is(value) {\r
27654         var candidate = value;\r
27655         return Range.is(candidate.range) && Color.is(candidate.color);\r
27656     }\r
27657     ColorInformation.is = is;\r
27658 })(ColorInformation || (ColorInformation = {}));\r
27659 /**\r
27660  * The Color namespace provides helper functions to work with\r
27661  * [ColorPresentation](#ColorPresentation) literals.\r
27662  */\r
27663 var ColorPresentation;\r
27664 (function (ColorPresentation) {\r
27665     /**\r
27666      * Creates a new ColorInformation literal.\r
27667      */\r
27668     function create(label, textEdit, additionalTextEdits) {\r
27669         return {\r
27670             label: label,\r
27671             textEdit: textEdit,\r
27672             additionalTextEdits: additionalTextEdits,\r
27673         };\r
27674     }\r
27675     ColorPresentation.create = create;\r
27676     /**\r
27677      * Checks whether the given literal conforms to the [ColorInformation](#ColorInformation) interface.\r
27678      */\r
27679     function is(value) {\r
27680         var candidate = value;\r
27681         return Is.string(candidate.label)\r
27682             && (Is.undefined(candidate.textEdit) || TextEdit.is(candidate))\r
27683             && (Is.undefined(candidate.additionalTextEdits) || Is.typedArray(candidate.additionalTextEdits, TextEdit.is));\r
27684     }\r
27685     ColorPresentation.is = is;\r
27686 })(ColorPresentation || (ColorPresentation = {}));\r
27687 /**\r
27688  * Enum of known range kinds\r
27689  */\r
27690 var FoldingRangeKind;\r
27691 (function (FoldingRangeKind) {\r
27692     /**\r
27693      * Folding range for a comment\r
27694      */\r
27695     FoldingRangeKind["Comment"] = "comment";\r
27696     /**\r
27697      * Folding range for a imports or includes\r
27698      */\r
27699     FoldingRangeKind["Imports"] = "imports";\r
27700     /**\r
27701      * Folding range for a region (e.g. `#region`)\r
27702      */\r
27703     FoldingRangeKind["Region"] = "region";\r
27704 })(FoldingRangeKind || (FoldingRangeKind = {}));\r
27705 /**\r
27706  * The folding range namespace provides helper functions to work with\r
27707  * [FoldingRange](#FoldingRange) literals.\r
27708  */\r
27709 var FoldingRange;\r
27710 (function (FoldingRange) {\r
27711     /**\r
27712      * Creates a new FoldingRange literal.\r
27713      */\r
27714     function create(startLine, endLine, startCharacter, endCharacter, kind) {\r
27715         var result = {\r
27716             startLine: startLine,\r
27717             endLine: endLine\r
27718         };\r
27719         if (Is.defined(startCharacter)) {\r
27720             result.startCharacter = startCharacter;\r
27721         }\r
27722         if (Is.defined(endCharacter)) {\r
27723             result.endCharacter = endCharacter;\r
27724         }\r
27725         if (Is.defined(kind)) {\r
27726             result.kind = kind;\r
27727         }\r
27728         return result;\r
27729     }\r
27730     FoldingRange.create = create;\r
27731     /**\r
27732      * Checks whether the given literal conforms to the [FoldingRange](#FoldingRange) interface.\r
27733      */\r
27734     function is(value) {\r
27735         var candidate = value;\r
27736         return Is.number(candidate.startLine) && Is.number(candidate.startLine)\r
27737             && (Is.undefined(candidate.startCharacter) || Is.number(candidate.startCharacter))\r
27738             && (Is.undefined(candidate.endCharacter) || Is.number(candidate.endCharacter))\r
27739             && (Is.undefined(candidate.kind) || Is.string(candidate.kind));\r
27740     }\r
27741     FoldingRange.is = is;\r
27742 })(FoldingRange || (FoldingRange = {}));\r
27743 /**\r
27744  * The DiagnosticRelatedInformation namespace provides helper functions to work with\r
27745  * [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) literals.\r
27746  */\r
27747 var DiagnosticRelatedInformation;\r
27748 (function (DiagnosticRelatedInformation) {\r
27749     /**\r
27750      * Creates a new DiagnosticRelatedInformation literal.\r
27751      */\r
27752     function create(location, message) {\r
27753         return {\r
27754             location: location,\r
27755             message: message\r
27756         };\r
27757     }\r
27758     DiagnosticRelatedInformation.create = create;\r
27759     /**\r
27760      * Checks whether the given literal conforms to the [DiagnosticRelatedInformation](#DiagnosticRelatedInformation) interface.\r
27761      */\r
27762     function is(value) {\r
27763         var candidate = value;\r
27764         return Is.defined(candidate) && Location.is(candidate.location) && Is.string(candidate.message);\r
27765     }\r
27766     DiagnosticRelatedInformation.is = is;\r
27767 })(DiagnosticRelatedInformation || (DiagnosticRelatedInformation = {}));\r
27768 /**\r
27769  * The diagnostic's severity.\r
27770  */\r
27771 var DiagnosticSeverity;\r
27772 (function (DiagnosticSeverity) {\r
27773     /**\r
27774      * Reports an error.\r
27775      */\r
27776     DiagnosticSeverity.Error = 1;\r
27777     /**\r
27778      * Reports a warning.\r
27779      */\r
27780     DiagnosticSeverity.Warning = 2;\r
27781     /**\r
27782      * Reports an information.\r
27783      */\r
27784     DiagnosticSeverity.Information = 3;\r
27785     /**\r
27786      * Reports a hint.\r
27787      */\r
27788     DiagnosticSeverity.Hint = 4;\r
27789 })(DiagnosticSeverity || (DiagnosticSeverity = {}));\r
27790 /**\r
27791  * The diagnostic tags.\r
27792  *\r
27793  * @since 3.15.0\r
27794  */\r
27795 var DiagnosticTag;\r
27796 (function (DiagnosticTag) {\r
27797     /**\r
27798      * Unused or unnecessary code.\r
27799      *\r
27800      * Clients are allowed to render diagnostics with this tag faded out instead of having\r
27801      * an error squiggle.\r
27802      */\r
27803     DiagnosticTag.Unnecessary = 1;\r
27804     /**\r
27805      * Deprecated or obsolete code.\r
27806      *\r
27807      * Clients are allowed to rendered diagnostics with this tag strike through.\r
27808      */\r
27809     DiagnosticTag.Deprecated = 2;\r
27810 })(DiagnosticTag || (DiagnosticTag = {}));\r
27811 /**\r
27812  * The Diagnostic namespace provides helper functions to work with\r
27813  * [Diagnostic](#Diagnostic) literals.\r
27814  */\r
27815 var Diagnostic;\r
27816 (function (Diagnostic) {\r
27817     /**\r
27818      * Creates a new Diagnostic literal.\r
27819      */\r
27820     function create(range, message, severity, code, source, relatedInformation) {\r
27821         var result = { range: range, message: message };\r
27822         if (Is.defined(severity)) {\r
27823             result.severity = severity;\r
27824         }\r
27825         if (Is.defined(code)) {\r
27826             result.code = code;\r
27827         }\r
27828         if (Is.defined(source)) {\r
27829             result.source = source;\r
27830         }\r
27831         if (Is.defined(relatedInformation)) {\r
27832             result.relatedInformation = relatedInformation;\r
27833         }\r
27834         return result;\r
27835     }\r
27836     Diagnostic.create = create;\r
27837     /**\r
27838      * Checks whether the given literal conforms to the [Diagnostic](#Diagnostic) interface.\r
27839      */\r
27840     function is(value) {\r
27841         var candidate = value;\r
27842         return Is.defined(candidate)\r
27843             && Range.is(candidate.range)\r
27844             && Is.string(candidate.message)\r
27845             && (Is.number(candidate.severity) || Is.undefined(candidate.severity))\r
27846             && (Is.number(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code))\r
27847             && (Is.string(candidate.source) || Is.undefined(candidate.source))\r
27848             && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));\r
27849     }\r
27850     Diagnostic.is = is;\r
27851 })(Diagnostic || (Diagnostic = {}));\r
27852 /**\r
27853  * The Command namespace provides helper functions to work with\r
27854  * [Command](#Command) literals.\r
27855  */\r
27856 var Command;\r
27857 (function (Command) {\r
27858     /**\r
27859      * Creates a new Command literal.\r
27860      */\r
27861     function create(title, command) {\r
27862         var args = [];\r
27863         for (var _i = 2; _i < arguments.length; _i++) {\r
27864             args[_i - 2] = arguments[_i];\r
27865         }\r
27866         var result = { title: title, command: command };\r
27867         if (Is.defined(args) && args.length > 0) {\r
27868             result.arguments = args;\r
27869         }\r
27870         return result;\r
27871     }\r
27872     Command.create = create;\r
27873     /**\r
27874      * Checks whether the given literal conforms to the [Command](#Command) interface.\r
27875      */\r
27876     function is(value) {\r
27877         var candidate = value;\r
27878         return Is.defined(candidate) && Is.string(candidate.title) && Is.string(candidate.command);\r
27879     }\r
27880     Command.is = is;\r
27881 })(Command || (Command = {}));\r
27882 /**\r
27883  * The TextEdit namespace provides helper function to create replace,\r
27884  * insert and delete edits more easily.\r
27885  */\r
27886 var TextEdit;\r
27887 (function (TextEdit) {\r
27888     /**\r
27889      * Creates a replace text edit.\r
27890      * @param range The range of text to be replaced.\r
27891      * @param newText The new text.\r
27892      */\r
27893     function replace(range, newText) {\r
27894         return { range: range, newText: newText };\r
27895     }\r
27896     TextEdit.replace = replace;\r
27897     /**\r
27898      * Creates a insert text edit.\r
27899      * @param position The position to insert the text at.\r
27900      * @param newText The text to be inserted.\r
27901      */\r
27902     function insert(position, newText) {\r
27903         return { range: { start: position, end: position }, newText: newText };\r
27904     }\r
27905     TextEdit.insert = insert;\r
27906     /**\r
27907      * Creates a delete text edit.\r
27908      * @param range The range of text to be deleted.\r
27909      */\r
27910     function del(range) {\r
27911         return { range: range, newText: '' };\r
27912     }\r
27913     TextEdit.del = del;\r
27914     function is(value) {\r
27915         var candidate = value;\r
27916         return Is.objectLiteral(candidate)\r
27917             && Is.string(candidate.newText)\r
27918             && Range.is(candidate.range);\r
27919     }\r
27920     TextEdit.is = is;\r
27921 })(TextEdit || (TextEdit = {}));\r
27922 /**\r
27923  * The TextDocumentEdit namespace provides helper function to create\r
27924  * an edit that manipulates a text document.\r
27925  */\r
27926 var TextDocumentEdit;\r
27927 (function (TextDocumentEdit) {\r
27928     /**\r
27929      * Creates a new `TextDocumentEdit`\r
27930      */\r
27931     function create(textDocument, edits) {\r
27932         return { textDocument: textDocument, edits: edits };\r
27933     }\r
27934     TextDocumentEdit.create = create;\r
27935     function is(value) {\r
27936         var candidate = value;\r
27937         return Is.defined(candidate)\r
27938             && VersionedTextDocumentIdentifier.is(candidate.textDocument)\r
27939             && Array.isArray(candidate.edits);\r
27940     }\r
27941     TextDocumentEdit.is = is;\r
27942 })(TextDocumentEdit || (TextDocumentEdit = {}));\r
27943 var CreateFile;\r
27944 (function (CreateFile) {\r
27945     function create(uri, options) {\r
27946         var result = {\r
27947             kind: 'create',\r
27948             uri: uri\r
27949         };\r
27950         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
27951             result.options = options;\r
27952         }\r
27953         return result;\r
27954     }\r
27955     CreateFile.create = create;\r
27956     function is(value) {\r
27957         var candidate = value;\r
27958         return candidate && candidate.kind === 'create' && Is.string(candidate.uri) &&\r
27959             (candidate.options === void 0 ||\r
27960                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
27961     }\r
27962     CreateFile.is = is;\r
27963 })(CreateFile || (CreateFile = {}));\r
27964 var RenameFile;\r
27965 (function (RenameFile) {\r
27966     function create(oldUri, newUri, options) {\r
27967         var result = {\r
27968             kind: 'rename',\r
27969             oldUri: oldUri,\r
27970             newUri: newUri\r
27971         };\r
27972         if (options !== void 0 && (options.overwrite !== void 0 || options.ignoreIfExists !== void 0)) {\r
27973             result.options = options;\r
27974         }\r
27975         return result;\r
27976     }\r
27977     RenameFile.create = create;\r
27978     function is(value) {\r
27979         var candidate = value;\r
27980         return candidate && candidate.kind === 'rename' && Is.string(candidate.oldUri) && Is.string(candidate.newUri) &&\r
27981             (candidate.options === void 0 ||\r
27982                 ((candidate.options.overwrite === void 0 || Is.boolean(candidate.options.overwrite)) && (candidate.options.ignoreIfExists === void 0 || Is.boolean(candidate.options.ignoreIfExists))));\r
27983     }\r
27984     RenameFile.is = is;\r
27985 })(RenameFile || (RenameFile = {}));\r
27986 var DeleteFile;\r
27987 (function (DeleteFile) {\r
27988     function create(uri, options) {\r
27989         var result = {\r
27990             kind: 'delete',\r
27991             uri: uri\r
27992         };\r
27993         if (options !== void 0 && (options.recursive !== void 0 || options.ignoreIfNotExists !== void 0)) {\r
27994             result.options = options;\r
27995         }\r
27996         return result;\r
27997     }\r
27998     DeleteFile.create = create;\r
27999     function is(value) {\r
28000         var candidate = value;\r
28001         return candidate && candidate.kind === 'delete' && Is.string(candidate.uri) &&\r
28002             (candidate.options === void 0 ||\r
28003                 ((candidate.options.recursive === void 0 || Is.boolean(candidate.options.recursive)) && (candidate.options.ignoreIfNotExists === void 0 || Is.boolean(candidate.options.ignoreIfNotExists))));\r
28004     }\r
28005     DeleteFile.is = is;\r
28006 })(DeleteFile || (DeleteFile = {}));\r
28007 var WorkspaceEdit;\r
28008 (function (WorkspaceEdit) {\r
28009     function is(value) {\r
28010         var candidate = value;\r
28011         return candidate &&\r
28012             (candidate.changes !== void 0 || candidate.documentChanges !== void 0) &&\r
28013             (candidate.documentChanges === void 0 || candidate.documentChanges.every(function (change) {\r
28014                 if (Is.string(change.kind)) {\r
28015                     return CreateFile.is(change) || RenameFile.is(change) || DeleteFile.is(change);\r
28016                 }\r
28017                 else {\r
28018                     return TextDocumentEdit.is(change);\r
28019                 }\r
28020             }));\r
28021     }\r
28022     WorkspaceEdit.is = is;\r
28023 })(WorkspaceEdit || (WorkspaceEdit = {}));\r
28024 var TextEditChangeImpl = /** @class */ (function () {\r
28025     function TextEditChangeImpl(edits) {\r
28026         this.edits = edits;\r
28027     }\r
28028     TextEditChangeImpl.prototype.insert = function (position, newText) {\r
28029         this.edits.push(TextEdit.insert(position, newText));\r
28030     };\r
28031     TextEditChangeImpl.prototype.replace = function (range, newText) {\r
28032         this.edits.push(TextEdit.replace(range, newText));\r
28033     };\r
28034     TextEditChangeImpl.prototype.delete = function (range) {\r
28035         this.edits.push(TextEdit.del(range));\r
28036     };\r
28037     TextEditChangeImpl.prototype.add = function (edit) {\r
28038         this.edits.push(edit);\r
28039     };\r
28040     TextEditChangeImpl.prototype.all = function () {\r
28041         return this.edits;\r
28042     };\r
28043     TextEditChangeImpl.prototype.clear = function () {\r
28044         this.edits.splice(0, this.edits.length);\r
28045     };\r
28046     return TextEditChangeImpl;\r
28047 }());\r
28048 /**\r
28049  * A workspace change helps constructing changes to a workspace.\r
28050  */\r
28051 var WorkspaceChange = /** @class */ (function () {\r
28052     function WorkspaceChange(workspaceEdit) {\r
28053         var _this = this;\r
28054         this._textEditChanges = Object.create(null);\r
28055         if (workspaceEdit) {\r
28056             this._workspaceEdit = workspaceEdit;\r
28057             if (workspaceEdit.documentChanges) {\r
28058                 workspaceEdit.documentChanges.forEach(function (change) {\r
28059                     if (TextDocumentEdit.is(change)) {\r
28060                         var textEditChange = new TextEditChangeImpl(change.edits);\r
28061                         _this._textEditChanges[change.textDocument.uri] = textEditChange;\r
28062                     }\r
28063                 });\r
28064             }\r
28065             else if (workspaceEdit.changes) {\r
28066                 Object.keys(workspaceEdit.changes).forEach(function (key) {\r
28067                     var textEditChange = new TextEditChangeImpl(workspaceEdit.changes[key]);\r
28068                     _this._textEditChanges[key] = textEditChange;\r
28069                 });\r
28070             }\r
28071         }\r
28072     }\r
28073     Object.defineProperty(WorkspaceChange.prototype, "edit", {\r
28074         /**\r
28075          * Returns the underlying [WorkspaceEdit](#WorkspaceEdit) literal\r
28076          * use to be returned from a workspace edit operation like rename.\r
28077          */\r
28078         get: function () {\r
28079             return this._workspaceEdit;\r
28080         },\r
28081         enumerable: true,\r
28082         configurable: true\r
28083     });\r
28084     WorkspaceChange.prototype.getTextEditChange = function (key) {\r
28085         if (VersionedTextDocumentIdentifier.is(key)) {\r
28086             if (!this._workspaceEdit) {\r
28087                 this._workspaceEdit = {\r
28088                     documentChanges: []\r
28089                 };\r
28090             }\r
28091             if (!this._workspaceEdit.documentChanges) {\r
28092                 throw new Error('Workspace edit is not configured for document changes.');\r
28093             }\r
28094             var textDocument = key;\r
28095             var result = this._textEditChanges[textDocument.uri];\r
28096             if (!result) {\r
28097                 var edits = [];\r
28098                 var textDocumentEdit = {\r
28099                     textDocument: textDocument,\r
28100                     edits: edits\r
28101                 };\r
28102                 this._workspaceEdit.documentChanges.push(textDocumentEdit);\r
28103                 result = new TextEditChangeImpl(edits);\r
28104                 this._textEditChanges[textDocument.uri] = result;\r
28105             }\r
28106             return result;\r
28107         }\r
28108         else {\r
28109             if (!this._workspaceEdit) {\r
28110                 this._workspaceEdit = {\r
28111                     changes: Object.create(null)\r
28112                 };\r
28113             }\r
28114             if (!this._workspaceEdit.changes) {\r
28115                 throw new Error('Workspace edit is not configured for normal text edit changes.');\r
28116             }\r
28117             var result = this._textEditChanges[key];\r
28118             if (!result) {\r
28119                 var edits = [];\r
28120                 this._workspaceEdit.changes[key] = edits;\r
28121                 result = new TextEditChangeImpl(edits);\r
28122                 this._textEditChanges[key] = result;\r
28123             }\r
28124             return result;\r
28125         }\r
28126     };\r
28127     WorkspaceChange.prototype.createFile = function (uri, options) {\r
28128         this.checkDocumentChanges();\r
28129         this._workspaceEdit.documentChanges.push(CreateFile.create(uri, options));\r
28130     };\r
28131     WorkspaceChange.prototype.renameFile = function (oldUri, newUri, options) {\r
28132         this.checkDocumentChanges();\r
28133         this._workspaceEdit.documentChanges.push(RenameFile.create(oldUri, newUri, options));\r
28134     };\r
28135     WorkspaceChange.prototype.deleteFile = function (uri, options) {\r
28136         this.checkDocumentChanges();\r
28137         this._workspaceEdit.documentChanges.push(DeleteFile.create(uri, options));\r
28138     };\r
28139     WorkspaceChange.prototype.checkDocumentChanges = function () {\r
28140         if (!this._workspaceEdit || !this._workspaceEdit.documentChanges) {\r
28141             throw new Error('Workspace edit is not configured for document changes.');\r
28142         }\r
28143     };\r
28144     return WorkspaceChange;\r
28145 }());\r
28146 \r
28147 /**\r
28148  * The TextDocumentIdentifier namespace provides helper functions to work with\r
28149  * [TextDocumentIdentifier](#TextDocumentIdentifier) literals.\r
28150  */\r
28151 var TextDocumentIdentifier;\r
28152 (function (TextDocumentIdentifier) {\r
28153     /**\r
28154      * Creates a new TextDocumentIdentifier literal.\r
28155      * @param uri The document's uri.\r
28156      */\r
28157     function create(uri) {\r
28158         return { uri: uri };\r
28159     }\r
28160     TextDocumentIdentifier.create = create;\r
28161     /**\r
28162      * Checks whether the given literal conforms to the [TextDocumentIdentifier](#TextDocumentIdentifier) interface.\r
28163      */\r
28164     function is(value) {\r
28165         var candidate = value;\r
28166         return Is.defined(candidate) && Is.string(candidate.uri);\r
28167     }\r
28168     TextDocumentIdentifier.is = is;\r
28169 })(TextDocumentIdentifier || (TextDocumentIdentifier = {}));\r
28170 /**\r
28171  * The VersionedTextDocumentIdentifier namespace provides helper functions to work with\r
28172  * [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) literals.\r
28173  */\r
28174 var VersionedTextDocumentIdentifier;\r
28175 (function (VersionedTextDocumentIdentifier) {\r
28176     /**\r
28177      * Creates a new VersionedTextDocumentIdentifier literal.\r
28178      * @param uri The document's uri.\r
28179      * @param uri The document's text.\r
28180      */\r
28181     function create(uri, version) {\r
28182         return { uri: uri, version: version };\r
28183     }\r
28184     VersionedTextDocumentIdentifier.create = create;\r
28185     /**\r
28186      * Checks whether the given literal conforms to the [VersionedTextDocumentIdentifier](#VersionedTextDocumentIdentifier) interface.\r
28187      */\r
28188     function is(value) {\r
28189         var candidate = value;\r
28190         return Is.defined(candidate) && Is.string(candidate.uri) && (candidate.version === null || Is.number(candidate.version));\r
28191     }\r
28192     VersionedTextDocumentIdentifier.is = is;\r
28193 })(VersionedTextDocumentIdentifier || (VersionedTextDocumentIdentifier = {}));\r
28194 /**\r
28195  * The TextDocumentItem namespace provides helper functions to work with\r
28196  * [TextDocumentItem](#TextDocumentItem) literals.\r
28197  */\r
28198 var TextDocumentItem;\r
28199 (function (TextDocumentItem) {\r
28200     /**\r
28201      * Creates a new TextDocumentItem literal.\r
28202      * @param uri The document's uri.\r
28203      * @param languageId The document's language identifier.\r
28204      * @param version The document's version number.\r
28205      * @param text The document's text.\r
28206      */\r
28207     function create(uri, languageId, version, text) {\r
28208         return { uri: uri, languageId: languageId, version: version, text: text };\r
28209     }\r
28210     TextDocumentItem.create = create;\r
28211     /**\r
28212      * Checks whether the given literal conforms to the [TextDocumentItem](#TextDocumentItem) interface.\r
28213      */\r
28214     function is(value) {\r
28215         var candidate = value;\r
28216         return Is.defined(candidate) && Is.string(candidate.uri) && Is.string(candidate.languageId) && Is.number(candidate.version) && Is.string(candidate.text);\r
28217     }\r
28218     TextDocumentItem.is = is;\r
28219 })(TextDocumentItem || (TextDocumentItem = {}));\r
28220 /**\r
28221  * Describes the content type that a client supports in various\r
28222  * result literals like `Hover`, `ParameterInfo` or `CompletionItem`.\r
28223  *\r
28224  * Please note that `MarkupKinds` must not start with a `$`. This kinds\r
28225  * are reserved for internal usage.\r
28226  */\r
28227 var MarkupKind;\r
28228 (function (MarkupKind) {\r
28229     /**\r
28230      * Plain text is supported as a content format\r
28231      */\r
28232     MarkupKind.PlainText = 'plaintext';\r
28233     /**\r
28234      * Markdown is supported as a content format\r
28235      */\r
28236     MarkupKind.Markdown = 'markdown';\r
28237 })(MarkupKind || (MarkupKind = {}));\r
28238 (function (MarkupKind) {\r
28239     /**\r
28240      * Checks whether the given value is a value of the [MarkupKind](#MarkupKind) type.\r
28241      */\r
28242     function is(value) {\r
28243         var candidate = value;\r
28244         return candidate === MarkupKind.PlainText || candidate === MarkupKind.Markdown;\r
28245     }\r
28246     MarkupKind.is = is;\r
28247 })(MarkupKind || (MarkupKind = {}));\r
28248 var MarkupContent;\r
28249 (function (MarkupContent) {\r
28250     /**\r
28251      * Checks whether the given value conforms to the [MarkupContent](#MarkupContent) interface.\r
28252      */\r
28253     function is(value) {\r
28254         var candidate = value;\r
28255         return Is.objectLiteral(value) && MarkupKind.is(candidate.kind) && Is.string(candidate.value);\r
28256     }\r
28257     MarkupContent.is = is;\r
28258 })(MarkupContent || (MarkupContent = {}));\r
28259 /**\r
28260  * The kind of a completion entry.\r
28261  */\r
28262 var CompletionItemKind;\r
28263 (function (CompletionItemKind) {\r
28264     CompletionItemKind.Text = 1;\r
28265     CompletionItemKind.Method = 2;\r
28266     CompletionItemKind.Function = 3;\r
28267     CompletionItemKind.Constructor = 4;\r
28268     CompletionItemKind.Field = 5;\r
28269     CompletionItemKind.Variable = 6;\r
28270     CompletionItemKind.Class = 7;\r
28271     CompletionItemKind.Interface = 8;\r
28272     CompletionItemKind.Module = 9;\r
28273     CompletionItemKind.Property = 10;\r
28274     CompletionItemKind.Unit = 11;\r
28275     CompletionItemKind.Value = 12;\r
28276     CompletionItemKind.Enum = 13;\r
28277     CompletionItemKind.Keyword = 14;\r
28278     CompletionItemKind.Snippet = 15;\r
28279     CompletionItemKind.Color = 16;\r
28280     CompletionItemKind.File = 17;\r
28281     CompletionItemKind.Reference = 18;\r
28282     CompletionItemKind.Folder = 19;\r
28283     CompletionItemKind.EnumMember = 20;\r
28284     CompletionItemKind.Constant = 21;\r
28285     CompletionItemKind.Struct = 22;\r
28286     CompletionItemKind.Event = 23;\r
28287     CompletionItemKind.Operator = 24;\r
28288     CompletionItemKind.TypeParameter = 25;\r
28289 })(CompletionItemKind || (CompletionItemKind = {}));\r
28290 /**\r
28291  * Defines whether the insert text in a completion item should be interpreted as\r
28292  * plain text or a snippet.\r
28293  */\r
28294 var InsertTextFormat;\r
28295 (function (InsertTextFormat) {\r
28296     /**\r
28297      * The primary text to be inserted is treated as a plain string.\r
28298      */\r
28299     InsertTextFormat.PlainText = 1;\r
28300     /**\r
28301      * The primary text to be inserted is treated as a snippet.\r
28302      *\r
28303      * A snippet can define tab stops and placeholders with `$1`, `$2`\r
28304      * and `${3:foo}`. `$0` defines the final tab stop, it defaults to\r
28305      * the end of the snippet. Placeholders with equal identifiers are linked,\r
28306      * that is typing in one will update others too.\r
28307      *\r
28308      * See also: https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/snippet/common/snippet.md\r
28309      */\r
28310     InsertTextFormat.Snippet = 2;\r
28311 })(InsertTextFormat || (InsertTextFormat = {}));\r
28312 /**\r
28313  * Completion item tags are extra annotations that tweak the rendering of a completion\r
28314  * item.\r
28315  *\r
28316  * @since 3.15.0\r
28317  */\r
28318 var CompletionItemTag;\r
28319 (function (CompletionItemTag) {\r
28320     /**\r
28321      * Render a completion as obsolete, usually using a strike-out.\r
28322      */\r
28323     CompletionItemTag.Deprecated = 1;\r
28324 })(CompletionItemTag || (CompletionItemTag = {}));\r
28325 /**\r
28326  * The CompletionItem namespace provides functions to deal with\r
28327  * completion items.\r
28328  */\r
28329 var CompletionItem;\r
28330 (function (CompletionItem) {\r
28331     /**\r
28332      * Create a completion item and seed it with a label.\r
28333      * @param label The completion item's label\r
28334      */\r
28335     function create(label) {\r
28336         return { label: label };\r
28337     }\r
28338     CompletionItem.create = create;\r
28339 })(CompletionItem || (CompletionItem = {}));\r
28340 /**\r
28341  * The CompletionList namespace provides functions to deal with\r
28342  * completion lists.\r
28343  */\r
28344 var CompletionList;\r
28345 (function (CompletionList) {\r
28346     /**\r
28347      * Creates a new completion list.\r
28348      *\r
28349      * @param items The completion items.\r
28350      * @param isIncomplete The list is not complete.\r
28351      */\r
28352     function create(items, isIncomplete) {\r
28353         return { items: items ? items : [], isIncomplete: !!isIncomplete };\r
28354     }\r
28355     CompletionList.create = create;\r
28356 })(CompletionList || (CompletionList = {}));\r
28357 var MarkedString;\r
28358 (function (MarkedString) {\r
28359     /**\r
28360      * Creates a marked string from plain text.\r
28361      *\r
28362      * @param plainText The plain text.\r
28363      */\r
28364     function fromPlainText(plainText) {\r
28365         return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash\r
28366     }\r
28367     MarkedString.fromPlainText = fromPlainText;\r
28368     /**\r
28369      * Checks whether the given value conforms to the [MarkedString](#MarkedString) type.\r
28370      */\r
28371     function is(value) {\r
28372         var candidate = value;\r
28373         return Is.string(candidate) || (Is.objectLiteral(candidate) && Is.string(candidate.language) && Is.string(candidate.value));\r
28374     }\r
28375     MarkedString.is = is;\r
28376 })(MarkedString || (MarkedString = {}));\r
28377 var Hover;\r
28378 (function (Hover) {\r
28379     /**\r
28380      * Checks whether the given value conforms to the [Hover](#Hover) interface.\r
28381      */\r
28382     function is(value) {\r
28383         var candidate = value;\r
28384         return !!candidate && Is.objectLiteral(candidate) && (MarkupContent.is(candidate.contents) ||\r
28385             MarkedString.is(candidate.contents) ||\r
28386             Is.typedArray(candidate.contents, MarkedString.is)) && (value.range === void 0 || Range.is(value.range));\r
28387     }\r
28388     Hover.is = is;\r
28389 })(Hover || (Hover = {}));\r
28390 /**\r
28391  * The ParameterInformation namespace provides helper functions to work with\r
28392  * [ParameterInformation](#ParameterInformation) literals.\r
28393  */\r
28394 var ParameterInformation;\r
28395 (function (ParameterInformation) {\r
28396     /**\r
28397      * Creates a new parameter information literal.\r
28398      *\r
28399      * @param label A label string.\r
28400      * @param documentation A doc string.\r
28401      */\r
28402     function create(label, documentation) {\r
28403         return documentation ? { label: label, documentation: documentation } : { label: label };\r
28404     }\r
28405     ParameterInformation.create = create;\r
28406 })(ParameterInformation || (ParameterInformation = {}));\r
28407 /**\r
28408  * The SignatureInformation namespace provides helper functions to work with\r
28409  * [SignatureInformation](#SignatureInformation) literals.\r
28410  */\r
28411 var SignatureInformation;\r
28412 (function (SignatureInformation) {\r
28413     function create(label, documentation) {\r
28414         var parameters = [];\r
28415         for (var _i = 2; _i < arguments.length; _i++) {\r
28416             parameters[_i - 2] = arguments[_i];\r
28417         }\r
28418         var result = { label: label };\r
28419         if (Is.defined(documentation)) {\r
28420             result.documentation = documentation;\r
28421         }\r
28422         if (Is.defined(parameters)) {\r
28423             result.parameters = parameters;\r
28424         }\r
28425         else {\r
28426             result.parameters = [];\r
28427         }\r
28428         return result;\r
28429     }\r
28430     SignatureInformation.create = create;\r
28431 })(SignatureInformation || (SignatureInformation = {}));\r
28432 /**\r
28433  * A document highlight kind.\r
28434  */\r
28435 var DocumentHighlightKind;\r
28436 (function (DocumentHighlightKind) {\r
28437     /**\r
28438      * A textual occurrence.\r
28439      */\r
28440     DocumentHighlightKind.Text = 1;\r
28441     /**\r
28442      * Read-access of a symbol, like reading a variable.\r
28443      */\r
28444     DocumentHighlightKind.Read = 2;\r
28445     /**\r
28446      * Write-access of a symbol, like writing to a variable.\r
28447      */\r
28448     DocumentHighlightKind.Write = 3;\r
28449 })(DocumentHighlightKind || (DocumentHighlightKind = {}));\r
28450 /**\r
28451  * DocumentHighlight namespace to provide helper functions to work with\r
28452  * [DocumentHighlight](#DocumentHighlight) literals.\r
28453  */\r
28454 var DocumentHighlight;\r
28455 (function (DocumentHighlight) {\r
28456     /**\r
28457      * Create a DocumentHighlight object.\r
28458      * @param range The range the highlight applies to.\r
28459      */\r
28460     function create(range, kind) {\r
28461         var result = { range: range };\r
28462         if (Is.number(kind)) {\r
28463             result.kind = kind;\r
28464         }\r
28465         return result;\r
28466     }\r
28467     DocumentHighlight.create = create;\r
28468 })(DocumentHighlight || (DocumentHighlight = {}));\r
28469 /**\r
28470  * A symbol kind.\r
28471  */\r
28472 var SymbolKind;\r
28473 (function (SymbolKind) {\r
28474     SymbolKind.File = 1;\r
28475     SymbolKind.Module = 2;\r
28476     SymbolKind.Namespace = 3;\r
28477     SymbolKind.Package = 4;\r
28478     SymbolKind.Class = 5;\r
28479     SymbolKind.Method = 6;\r
28480     SymbolKind.Property = 7;\r
28481     SymbolKind.Field = 8;\r
28482     SymbolKind.Constructor = 9;\r
28483     SymbolKind.Enum = 10;\r
28484     SymbolKind.Interface = 11;\r
28485     SymbolKind.Function = 12;\r
28486     SymbolKind.Variable = 13;\r
28487     SymbolKind.Constant = 14;\r
28488     SymbolKind.String = 15;\r
28489     SymbolKind.Number = 16;\r
28490     SymbolKind.Boolean = 17;\r
28491     SymbolKind.Array = 18;\r
28492     SymbolKind.Object = 19;\r
28493     SymbolKind.Key = 20;\r
28494     SymbolKind.Null = 21;\r
28495     SymbolKind.EnumMember = 22;\r
28496     SymbolKind.Struct = 23;\r
28497     SymbolKind.Event = 24;\r
28498     SymbolKind.Operator = 25;\r
28499     SymbolKind.TypeParameter = 26;\r
28500 })(SymbolKind || (SymbolKind = {}));\r
28501 /**\r
28502  * Symbol tags are extra annotations that tweak the rendering of a symbol.\r
28503  * @since 3.15\r
28504  */\r
28505 var SymbolTag;\r
28506 (function (SymbolTag) {\r
28507     /**\r
28508      * Render a symbol as obsolete, usually using a strike-out.\r
28509      */\r
28510     SymbolTag.Deprecated = 1;\r
28511 })(SymbolTag || (SymbolTag = {}));\r
28512 var SymbolInformation;\r
28513 (function (SymbolInformation) {\r
28514     /**\r
28515      * Creates a new symbol information literal.\r
28516      *\r
28517      * @param name The name of the symbol.\r
28518      * @param kind The kind of the symbol.\r
28519      * @param range The range of the location of the symbol.\r
28520      * @param uri The resource of the location of symbol, defaults to the current document.\r
28521      * @param containerName The name of the symbol containing the symbol.\r
28522      */\r
28523     function create(name, kind, range, uri, containerName) {\r
28524         var result = {\r
28525             name: name,\r
28526             kind: kind,\r
28527             location: { uri: uri, range: range }\r
28528         };\r
28529         if (containerName) {\r
28530             result.containerName = containerName;\r
28531         }\r
28532         return result;\r
28533     }\r
28534     SymbolInformation.create = create;\r
28535 })(SymbolInformation || (SymbolInformation = {}));\r
28536 var DocumentSymbol;\r
28537 (function (DocumentSymbol) {\r
28538     /**\r
28539      * Creates a new symbol information literal.\r
28540      *\r
28541      * @param name The name of the symbol.\r
28542      * @param detail The detail of the symbol.\r
28543      * @param kind The kind of the symbol.\r
28544      * @param range The range of the symbol.\r
28545      * @param selectionRange The selectionRange of the symbol.\r
28546      * @param children Children of the symbol.\r
28547      */\r
28548     function create(name, detail, kind, range, selectionRange, children) {\r
28549         var result = {\r
28550             name: name,\r
28551             detail: detail,\r
28552             kind: kind,\r
28553             range: range,\r
28554             selectionRange: selectionRange\r
28555         };\r
28556         if (children !== void 0) {\r
28557             result.children = children;\r
28558         }\r
28559         return result;\r
28560     }\r
28561     DocumentSymbol.create = create;\r
28562     /**\r
28563      * Checks whether the given literal conforms to the [DocumentSymbol](#DocumentSymbol) interface.\r
28564      */\r
28565     function is(value) {\r
28566         var candidate = value;\r
28567         return candidate &&\r
28568             Is.string(candidate.name) && Is.number(candidate.kind) &&\r
28569             Range.is(candidate.range) && Range.is(candidate.selectionRange) &&\r
28570             (candidate.detail === void 0 || Is.string(candidate.detail)) &&\r
28571             (candidate.deprecated === void 0 || Is.boolean(candidate.deprecated)) &&\r
28572             (candidate.children === void 0 || Array.isArray(candidate.children));\r
28573     }\r
28574     DocumentSymbol.is = is;\r
28575 })(DocumentSymbol || (DocumentSymbol = {}));\r
28576 /**\r
28577  * A set of predefined code action kinds\r
28578  */\r
28579 var CodeActionKind;\r
28580 (function (CodeActionKind) {\r
28581     /**\r
28582      * Empty kind.\r
28583      */\r
28584     CodeActionKind.Empty = '';\r
28585     /**\r
28586      * Base kind for quickfix actions: 'quickfix'\r
28587      */\r
28588     CodeActionKind.QuickFix = 'quickfix';\r
28589     /**\r
28590      * Base kind for refactoring actions: 'refactor'\r
28591      */\r
28592     CodeActionKind.Refactor = 'refactor';\r
28593     /**\r
28594      * Base kind for refactoring extraction actions: 'refactor.extract'\r
28595      *\r
28596      * Example extract actions:\r
28597      *\r
28598      * - Extract method\r
28599      * - Extract function\r
28600      * - Extract variable\r
28601      * - Extract interface from class\r
28602      * - ...\r
28603      */\r
28604     CodeActionKind.RefactorExtract = 'refactor.extract';\r
28605     /**\r
28606      * Base kind for refactoring inline actions: 'refactor.inline'\r
28607      *\r
28608      * Example inline actions:\r
28609      *\r
28610      * - Inline function\r
28611      * - Inline variable\r
28612      * - Inline constant\r
28613      * - ...\r
28614      */\r
28615     CodeActionKind.RefactorInline = 'refactor.inline';\r
28616     /**\r
28617      * Base kind for refactoring rewrite actions: 'refactor.rewrite'\r
28618      *\r
28619      * Example rewrite actions:\r
28620      *\r
28621      * - Convert JavaScript function to class\r
28622      * - Add or remove parameter\r
28623      * - Encapsulate field\r
28624      * - Make method static\r
28625      * - Move method to base class\r
28626      * - ...\r
28627      */\r
28628     CodeActionKind.RefactorRewrite = 'refactor.rewrite';\r
28629     /**\r
28630      * Base kind for source actions: `source`\r
28631      *\r
28632      * Source code actions apply to the entire file.\r
28633      */\r
28634     CodeActionKind.Source = 'source';\r
28635     /**\r
28636      * Base kind for an organize imports source action: `source.organizeImports`\r
28637      */\r
28638     CodeActionKind.SourceOrganizeImports = 'source.organizeImports';\r
28639     /**\r
28640      * Base kind for auto-fix source actions: `source.fixAll`.\r
28641      *\r
28642      * Fix all actions automatically fix errors that have a clear fix that do not require user input.\r
28643      * They should not suppress errors or perform unsafe fixes such as generating new types or classes.\r
28644      *\r
28645      * @since 3.15.0\r
28646      */\r
28647     CodeActionKind.SourceFixAll = 'source.fixAll';\r
28648 })(CodeActionKind || (CodeActionKind = {}));\r
28649 /**\r
28650  * The CodeActionContext namespace provides helper functions to work with\r
28651  * [CodeActionContext](#CodeActionContext) literals.\r
28652  */\r
28653 var CodeActionContext;\r
28654 (function (CodeActionContext) {\r
28655     /**\r
28656      * Creates a new CodeActionContext literal.\r
28657      */\r
28658     function create(diagnostics, only) {\r
28659         var result = { diagnostics: diagnostics };\r
28660         if (only !== void 0 && only !== null) {\r
28661             result.only = only;\r
28662         }\r
28663         return result;\r
28664     }\r
28665     CodeActionContext.create = create;\r
28666     /**\r
28667      * Checks whether the given literal conforms to the [CodeActionContext](#CodeActionContext) interface.\r
28668      */\r
28669     function is(value) {\r
28670         var candidate = value;\r
28671         return Is.defined(candidate) && Is.typedArray(candidate.diagnostics, Diagnostic.is) && (candidate.only === void 0 || Is.typedArray(candidate.only, Is.string));\r
28672     }\r
28673     CodeActionContext.is = is;\r
28674 })(CodeActionContext || (CodeActionContext = {}));\r
28675 var CodeAction;\r
28676 (function (CodeAction) {\r
28677     function create(title, commandOrEdit, kind) {\r
28678         var result = { title: title };\r
28679         if (Command.is(commandOrEdit)) {\r
28680             result.command = commandOrEdit;\r
28681         }\r
28682         else {\r
28683             result.edit = commandOrEdit;\r
28684         }\r
28685         if (kind !== void 0) {\r
28686             result.kind = kind;\r
28687         }\r
28688         return result;\r
28689     }\r
28690     CodeAction.create = create;\r
28691     function is(value) {\r
28692         var candidate = value;\r
28693         return candidate && Is.string(candidate.title) &&\r
28694             (candidate.diagnostics === void 0 || Is.typedArray(candidate.diagnostics, Diagnostic.is)) &&\r
28695             (candidate.kind === void 0 || Is.string(candidate.kind)) &&\r
28696             (candidate.edit !== void 0 || candidate.command !== void 0) &&\r
28697             (candidate.command === void 0 || Command.is(candidate.command)) &&\r
28698             (candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&\r
28699             (candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));\r
28700     }\r
28701     CodeAction.is = is;\r
28702 })(CodeAction || (CodeAction = {}));\r
28703 /**\r
28704  * The CodeLens namespace provides helper functions to work with\r
28705  * [CodeLens](#CodeLens) literals.\r
28706  */\r
28707 var CodeLens;\r
28708 (function (CodeLens) {\r
28709     /**\r
28710      * Creates a new CodeLens literal.\r
28711      */\r
28712     function create(range, data) {\r
28713         var result = { range: range };\r
28714         if (Is.defined(data)) {\r
28715             result.data = data;\r
28716         }\r
28717         return result;\r
28718     }\r
28719     CodeLens.create = create;\r
28720     /**\r
28721      * Checks whether the given literal conforms to the [CodeLens](#CodeLens) interface.\r
28722      */\r
28723     function is(value) {\r
28724         var candidate = value;\r
28725         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.command) || Command.is(candidate.command));\r
28726     }\r
28727     CodeLens.is = is;\r
28728 })(CodeLens || (CodeLens = {}));\r
28729 /**\r
28730  * The FormattingOptions namespace provides helper functions to work with\r
28731  * [FormattingOptions](#FormattingOptions) literals.\r
28732  */\r
28733 var FormattingOptions;\r
28734 (function (FormattingOptions) {\r
28735     /**\r
28736      * Creates a new FormattingOptions literal.\r
28737      */\r
28738     function create(tabSize, insertSpaces) {\r
28739         return { tabSize: tabSize, insertSpaces: insertSpaces };\r
28740     }\r
28741     FormattingOptions.create = create;\r
28742     /**\r
28743      * Checks whether the given literal conforms to the [FormattingOptions](#FormattingOptions) interface.\r
28744      */\r
28745     function is(value) {\r
28746         var candidate = value;\r
28747         return Is.defined(candidate) && Is.number(candidate.tabSize) && Is.boolean(candidate.insertSpaces);\r
28748     }\r
28749     FormattingOptions.is = is;\r
28750 })(FormattingOptions || (FormattingOptions = {}));\r
28751 /**\r
28752  * The DocumentLink namespace provides helper functions to work with\r
28753  * [DocumentLink](#DocumentLink) literals.\r
28754  */\r
28755 var DocumentLink;\r
28756 (function (DocumentLink) {\r
28757     /**\r
28758      * Creates a new DocumentLink literal.\r
28759      */\r
28760     function create(range, target, data) {\r
28761         return { range: range, target: target, data: data };\r
28762     }\r
28763     DocumentLink.create = create;\r
28764     /**\r
28765      * Checks whether the given literal conforms to the [DocumentLink](#DocumentLink) interface.\r
28766      */\r
28767     function is(value) {\r
28768         var candidate = value;\r
28769         return Is.defined(candidate) && Range.is(candidate.range) && (Is.undefined(candidate.target) || Is.string(candidate.target));\r
28770     }\r
28771     DocumentLink.is = is;\r
28772 })(DocumentLink || (DocumentLink = {}));\r
28773 /**\r
28774  * The SelectionRange namespace provides helper function to work with\r
28775  * SelectionRange literals.\r
28776  */\r
28777 var SelectionRange;\r
28778 (function (SelectionRange) {\r
28779     /**\r
28780      * Creates a new SelectionRange\r
28781      * @param range the range.\r
28782      * @param parent an optional parent.\r
28783      */\r
28784     function create(range, parent) {\r
28785         return { range: range, parent: parent };\r
28786     }\r
28787     SelectionRange.create = create;\r
28788     function is(value) {\r
28789         var candidate = value;\r
28790         return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));\r
28791     }\r
28792     SelectionRange.is = is;\r
28793 })(SelectionRange || (SelectionRange = {}));\r
28794 var EOL = ['\n', '\r\n', '\r'];\r
28795 /**\r
28796  * @deprecated Use the text document from the new vscode-languageserver-textdocument package.\r
28797  */\r
28798 var TextDocument;\r
28799 (function (TextDocument) {\r
28800     /**\r
28801      * Creates a new ITextDocument literal from the given uri and content.\r
28802      * @param uri The document's uri.\r
28803      * @param languageId  The document's language Id.\r
28804      * @param content The document's content.\r
28805      */\r
28806     function create(uri, languageId, version, content) {\r
28807         return new FullTextDocument(uri, languageId, version, content);\r
28808     }\r
28809     TextDocument.create = create;\r
28810     /**\r
28811      * Checks whether the given literal conforms to the [ITextDocument](#ITextDocument) interface.\r
28812      */\r
28813     function is(value) {\r
28814         var candidate = value;\r
28815         return Is.defined(candidate) && Is.string(candidate.uri) && (Is.undefined(candidate.languageId) || Is.string(candidate.languageId)) && Is.number(candidate.lineCount)\r
28816             && Is.func(candidate.getText) && Is.func(candidate.positionAt) && Is.func(candidate.offsetAt) ? true : false;\r
28817     }\r
28818     TextDocument.is = is;\r
28819     function applyEdits(document, edits) {\r
28820         var text = document.getText();\r
28821         var sortedEdits = mergeSort(edits, function (a, b) {\r
28822             var diff = a.range.start.line - b.range.start.line;\r
28823             if (diff === 0) {\r
28824                 return a.range.start.character - b.range.start.character;\r
28825             }\r
28826             return diff;\r
28827         });\r
28828         var lastModifiedOffset = text.length;\r
28829         for (var i = sortedEdits.length - 1; i >= 0; i--) {\r
28830             var e = sortedEdits[i];\r
28831             var startOffset = document.offsetAt(e.range.start);\r
28832             var endOffset = document.offsetAt(e.range.end);\r
28833             if (endOffset <= lastModifiedOffset) {\r
28834                 text = text.substring(0, startOffset) + e.newText + text.substring(endOffset, text.length);\r
28835             }\r
28836             else {\r
28837                 throw new Error('Overlapping edit');\r
28838             }\r
28839             lastModifiedOffset = startOffset;\r
28840         }\r
28841         return text;\r
28842     }\r
28843     TextDocument.applyEdits = applyEdits;\r
28844     function mergeSort(data, compare) {\r
28845         if (data.length <= 1) {\r
28846             // sorted\r
28847             return data;\r
28848         }\r
28849         var p = (data.length / 2) | 0;\r
28850         var left = data.slice(0, p);\r
28851         var right = data.slice(p);\r
28852         mergeSort(left, compare);\r
28853         mergeSort(right, compare);\r
28854         var leftIdx = 0;\r
28855         var rightIdx = 0;\r
28856         var i = 0;\r
28857         while (leftIdx < left.length && rightIdx < right.length) {\r
28858             var ret = compare(left[leftIdx], right[rightIdx]);\r
28859             if (ret <= 0) {\r
28860                 // smaller_equal -> take left to preserve order\r
28861                 data[i++] = left[leftIdx++];\r
28862             }\r
28863             else {\r
28864                 // greater -> take right\r
28865                 data[i++] = right[rightIdx++];\r
28866             }\r
28867         }\r
28868         while (leftIdx < left.length) {\r
28869             data[i++] = left[leftIdx++];\r
28870         }\r
28871         while (rightIdx < right.length) {\r
28872             data[i++] = right[rightIdx++];\r
28873         }\r
28874         return data;\r
28875     }\r
28876 })(TextDocument || (TextDocument = {}));\r
28877 var FullTextDocument = /** @class */ (function () {\r
28878     function FullTextDocument(uri, languageId, version, content) {\r
28879         this._uri = uri;\r
28880         this._languageId = languageId;\r
28881         this._version = version;\r
28882         this._content = content;\r
28883         this._lineOffsets = undefined;\r
28884     }\r
28885     Object.defineProperty(FullTextDocument.prototype, "uri", {\r
28886         get: function () {\r
28887             return this._uri;\r
28888         },\r
28889         enumerable: true,\r
28890         configurable: true\r
28891     });\r
28892     Object.defineProperty(FullTextDocument.prototype, "languageId", {\r
28893         get: function () {\r
28894             return this._languageId;\r
28895         },\r
28896         enumerable: true,\r
28897         configurable: true\r
28898     });\r
28899     Object.defineProperty(FullTextDocument.prototype, "version", {\r
28900         get: function () {\r
28901             return this._version;\r
28902         },\r
28903         enumerable: true,\r
28904         configurable: true\r
28905     });\r
28906     FullTextDocument.prototype.getText = function (range) {\r
28907         if (range) {\r
28908             var start = this.offsetAt(range.start);\r
28909             var end = this.offsetAt(range.end);\r
28910             return this._content.substring(start, end);\r
28911         }\r
28912         return this._content;\r
28913     };\r
28914     FullTextDocument.prototype.update = function (event, version) {\r
28915         this._content = event.text;\r
28916         this._version = version;\r
28917         this._lineOffsets = undefined;\r
28918     };\r
28919     FullTextDocument.prototype.getLineOffsets = function () {\r
28920         if (this._lineOffsets === undefined) {\r
28921             var lineOffsets = [];\r
28922             var text = this._content;\r
28923             var isLineStart = true;\r
28924             for (var i = 0; i < text.length; i++) {\r
28925                 if (isLineStart) {\r
28926                     lineOffsets.push(i);\r
28927                     isLineStart = false;\r
28928                 }\r
28929                 var ch = text.charAt(i);\r
28930                 isLineStart = (ch === '\r' || ch === '\n');\r
28931                 if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {\r
28932                     i++;\r
28933                 }\r
28934             }\r
28935             if (isLineStart && text.length > 0) {\r
28936                 lineOffsets.push(text.length);\r
28937             }\r
28938             this._lineOffsets = lineOffsets;\r
28939         }\r
28940         return this._lineOffsets;\r
28941     };\r
28942     FullTextDocument.prototype.positionAt = function (offset) {\r
28943         offset = Math.max(Math.min(offset, this._content.length), 0);\r
28944         var lineOffsets = this.getLineOffsets();\r
28945         var low = 0, high = lineOffsets.length;\r
28946         if (high === 0) {\r
28947             return Position.create(0, offset);\r
28948         }\r
28949         while (low < high) {\r
28950             var mid = Math.floor((low + high) / 2);\r
28951             if (lineOffsets[mid] > offset) {\r
28952                 high = mid;\r
28953             }\r
28954             else {\r
28955                 low = mid + 1;\r
28956             }\r
28957         }\r
28958         // low is the least x for which the line offset is larger than the current offset\r
28959         // or array.length if no line offset is larger than the current offset\r
28960         var line = low - 1;\r
28961         return Position.create(line, offset - lineOffsets[line]);\r
28962     };\r
28963     FullTextDocument.prototype.offsetAt = function (position) {\r
28964         var lineOffsets = this.getLineOffsets();\r
28965         if (position.line >= lineOffsets.length) {\r
28966             return this._content.length;\r
28967         }\r
28968         else if (position.line < 0) {\r
28969             return 0;\r
28970         }\r
28971         var lineOffset = lineOffsets[position.line];\r
28972         var nextLineOffset = (position.line + 1 < lineOffsets.length) ? lineOffsets[position.line + 1] : this._content.length;\r
28973         return Math.max(Math.min(lineOffset + position.character, nextLineOffset), lineOffset);\r
28974     };\r
28975     Object.defineProperty(FullTextDocument.prototype, "lineCount", {\r
28976         get: function () {\r
28977             return this.getLineOffsets().length;\r
28978         },\r
28979         enumerable: true,\r
28980         configurable: true\r
28981     });\r
28982     return FullTextDocument;\r
28983 }());\r
28984 var Is;\r
28985 (function (Is) {\r
28986     var toString = Object.prototype.toString;\r
28987     function defined(value) {\r
28988         return typeof value !== 'undefined';\r
28989     }\r
28990     Is.defined = defined;\r
28991     function undefined(value) {\r
28992         return typeof value === 'undefined';\r
28993     }\r
28994     Is.undefined = undefined;\r
28995     function boolean(value) {\r
28996         return value === true || value === false;\r
28997     }\r
28998     Is.boolean = boolean;\r
28999     function string(value) {\r
29000         return toString.call(value) === '[object String]';\r
29001     }\r
29002     Is.string = string;\r
29003     function number(value) {\r
29004         return toString.call(value) === '[object Number]';\r
29005     }\r
29006     Is.number = number;\r
29007     function func(value) {\r
29008         return toString.call(value) === '[object Function]';\r
29009     }\r
29010     Is.func = func;\r
29011     function objectLiteral(value) {\r
29012         // Strictly speaking class instances pass this check as well. Since the LSP\r
29013         // doesn't use classes we ignore this for now. If we do we need to add something\r
29014         // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
29015         return value !== null && typeof value === 'object';\r
29016     }\r
29017     Is.objectLiteral = objectLiteral;\r
29018     function typedArray(value, check) {\r
29019         return Array.isArray(value) && value.every(check);\r
29020     }\r
29021     Is.typedArray = typedArray;\r
29022 })(Is || (Is = {}));\r
29023
29024
29025 /***/ }),
29026 /* 176 */
29027 /***/ (function(module, exports, __webpack_require__) {
29028
29029 "use strict";
29030 /* --------------------------------------------------------------------------------------------\r
29031  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29032  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29033  * ------------------------------------------------------------------------------------------ */\r
29034 \r
29035 Object.defineProperty(exports, "__esModule", { value: true });\r
29036 const Is = __webpack_require__(177);\r
29037 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29038 const messages_1 = __webpack_require__(178);\r
29039 const protocol_implementation_1 = __webpack_require__(179);\r
29040 exports.ImplementationRequest = protocol_implementation_1.ImplementationRequest;\r
29041 const protocol_typeDefinition_1 = __webpack_require__(180);\r
29042 exports.TypeDefinitionRequest = protocol_typeDefinition_1.TypeDefinitionRequest;\r
29043 const protocol_workspaceFolders_1 = __webpack_require__(181);\r
29044 exports.WorkspaceFoldersRequest = protocol_workspaceFolders_1.WorkspaceFoldersRequest;\r
29045 exports.DidChangeWorkspaceFoldersNotification = protocol_workspaceFolders_1.DidChangeWorkspaceFoldersNotification;\r
29046 const protocol_configuration_1 = __webpack_require__(182);\r
29047 exports.ConfigurationRequest = protocol_configuration_1.ConfigurationRequest;\r
29048 const protocol_colorProvider_1 = __webpack_require__(183);\r
29049 exports.DocumentColorRequest = protocol_colorProvider_1.DocumentColorRequest;\r
29050 exports.ColorPresentationRequest = protocol_colorProvider_1.ColorPresentationRequest;\r
29051 const protocol_foldingRange_1 = __webpack_require__(184);\r
29052 exports.FoldingRangeRequest = protocol_foldingRange_1.FoldingRangeRequest;\r
29053 const protocol_declaration_1 = __webpack_require__(185);\r
29054 exports.DeclarationRequest = protocol_declaration_1.DeclarationRequest;\r
29055 const protocol_selectionRange_1 = __webpack_require__(186);\r
29056 exports.SelectionRangeRequest = protocol_selectionRange_1.SelectionRangeRequest;\r
29057 const protocol_progress_1 = __webpack_require__(187);\r
29058 exports.WorkDoneProgress = protocol_progress_1.WorkDoneProgress;\r
29059 exports.WorkDoneProgressCreateRequest = protocol_progress_1.WorkDoneProgressCreateRequest;\r
29060 exports.WorkDoneProgressCancelNotification = protocol_progress_1.WorkDoneProgressCancelNotification;\r
29061 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
29062 let __noDynamicImport;\r
29063 /**\r
29064  * The DocumentFilter namespace provides helper functions to work with\r
29065  * [DocumentFilter](#DocumentFilter) literals.\r
29066  */\r
29067 var DocumentFilter;\r
29068 (function (DocumentFilter) {\r
29069     function is(value) {\r
29070         const candidate = value;\r
29071         return Is.string(candidate.language) || Is.string(candidate.scheme) || Is.string(candidate.pattern);\r
29072     }\r
29073     DocumentFilter.is = is;\r
29074 })(DocumentFilter = exports.DocumentFilter || (exports.DocumentFilter = {}));\r
29075 /**\r
29076  * The DocumentSelector namespace provides helper functions to work with\r
29077  * [DocumentSelector](#DocumentSelector)s.\r
29078  */\r
29079 var DocumentSelector;\r
29080 (function (DocumentSelector) {\r
29081     function is(value) {\r
29082         if (!Array.isArray(value)) {\r
29083             return false;\r
29084         }\r
29085         for (let elem of value) {\r
29086             if (!Is.string(elem) && !DocumentFilter.is(elem)) {\r
29087                 return false;\r
29088             }\r
29089         }\r
29090         return true;\r
29091     }\r
29092     DocumentSelector.is = is;\r
29093 })(DocumentSelector = exports.DocumentSelector || (exports.DocumentSelector = {}));\r
29094 /**\r
29095  * The `client/registerCapability` request is sent from the server to the client to register a new capability\r
29096  * handler on the client side.\r
29097  */\r
29098 var RegistrationRequest;\r
29099 (function (RegistrationRequest) {\r
29100     RegistrationRequest.type = new messages_1.ProtocolRequestType('client/registerCapability');\r
29101 })(RegistrationRequest = exports.RegistrationRequest || (exports.RegistrationRequest = {}));\r
29102 /**\r
29103  * The `client/unregisterCapability` request is sent from the server to the client to unregister a previously registered capability\r
29104  * handler on the client side.\r
29105  */\r
29106 var UnregistrationRequest;\r
29107 (function (UnregistrationRequest) {\r
29108     UnregistrationRequest.type = new messages_1.ProtocolRequestType('client/unregisterCapability');\r
29109 })(UnregistrationRequest = exports.UnregistrationRequest || (exports.UnregistrationRequest = {}));\r
29110 var ResourceOperationKind;\r
29111 (function (ResourceOperationKind) {\r
29112     /**\r
29113      * Supports creating new files and folders.\r
29114      */\r
29115     ResourceOperationKind.Create = 'create';\r
29116     /**\r
29117      * Supports renaming existing files and folders.\r
29118      */\r
29119     ResourceOperationKind.Rename = 'rename';\r
29120     /**\r
29121      * Supports deleting existing files and folders.\r
29122      */\r
29123     ResourceOperationKind.Delete = 'delete';\r
29124 })(ResourceOperationKind = exports.ResourceOperationKind || (exports.ResourceOperationKind = {}));\r
29125 var FailureHandlingKind;\r
29126 (function (FailureHandlingKind) {\r
29127     /**\r
29128      * Applying the workspace change is simply aborted if one of the changes provided\r
29129      * fails. All operations executed before the failing operation stay executed.\r
29130      */\r
29131     FailureHandlingKind.Abort = 'abort';\r
29132     /**\r
29133      * All operations are executed transactional. That means they either all\r
29134      * succeed or no changes at all are applied to the workspace.\r
29135      */\r
29136     FailureHandlingKind.Transactional = 'transactional';\r
29137     /**\r
29138      * If the workspace edit contains only textual file changes they are executed transactional.\r
29139      * If resource changes (create, rename or delete file) are part of the change the failure\r
29140      * handling startegy is abort.\r
29141      */\r
29142     FailureHandlingKind.TextOnlyTransactional = 'textOnlyTransactional';\r
29143     /**\r
29144      * The client tries to undo the operations already executed. But there is no\r
29145      * guarantee that this is succeeding.\r
29146      */\r
29147     FailureHandlingKind.Undo = 'undo';\r
29148 })(FailureHandlingKind = exports.FailureHandlingKind || (exports.FailureHandlingKind = {}));\r
29149 /**\r
29150  * The StaticRegistrationOptions namespace provides helper functions to work with\r
29151  * [StaticRegistrationOptions](#StaticRegistrationOptions) literals.\r
29152  */\r
29153 var StaticRegistrationOptions;\r
29154 (function (StaticRegistrationOptions) {\r
29155     function hasId(value) {\r
29156         const candidate = value;\r
29157         return candidate && Is.string(candidate.id) && candidate.id.length > 0;\r
29158     }\r
29159     StaticRegistrationOptions.hasId = hasId;\r
29160 })(StaticRegistrationOptions = exports.StaticRegistrationOptions || (exports.StaticRegistrationOptions = {}));\r
29161 /**\r
29162  * The TextDocumentRegistrationOptions namespace provides helper functions to work with\r
29163  * [TextDocumentRegistrationOptions](#TextDocumentRegistrationOptions) literals.\r
29164  */\r
29165 var TextDocumentRegistrationOptions;\r
29166 (function (TextDocumentRegistrationOptions) {\r
29167     function is(value) {\r
29168         const candidate = value;\r
29169         return candidate && (candidate.documentSelector === null || DocumentSelector.is(candidate.documentSelector));\r
29170     }\r
29171     TextDocumentRegistrationOptions.is = is;\r
29172 })(TextDocumentRegistrationOptions = exports.TextDocumentRegistrationOptions || (exports.TextDocumentRegistrationOptions = {}));\r
29173 /**\r
29174  * The WorkDoneProgressOptions namespace provides helper functions to work with\r
29175  * [WorkDoneProgressOptions](#WorkDoneProgressOptions) literals.\r
29176  */\r
29177 var WorkDoneProgressOptions;\r
29178 (function (WorkDoneProgressOptions) {\r
29179     function is(value) {\r
29180         const candidate = value;\r
29181         return Is.objectLiteral(candidate) && (candidate.workDoneProgress === undefined || Is.boolean(candidate.workDoneProgress));\r
29182     }\r
29183     WorkDoneProgressOptions.is = is;\r
29184     function hasWorkDoneProgress(value) {\r
29185         const candidate = value;\r
29186         return candidate && Is.boolean(candidate.workDoneProgress);\r
29187     }\r
29188     WorkDoneProgressOptions.hasWorkDoneProgress = hasWorkDoneProgress;\r
29189 })(WorkDoneProgressOptions = exports.WorkDoneProgressOptions || (exports.WorkDoneProgressOptions = {}));\r
29190 /**\r
29191  * The initialize request is sent from the client to the server.\r
29192  * It is sent once as the request after starting up the server.\r
29193  * The requests parameter is of type [InitializeParams](#InitializeParams)\r
29194  * the response if of type [InitializeResult](#InitializeResult) of a Thenable that\r
29195  * resolves to such.\r
29196  */\r
29197 var InitializeRequest;\r
29198 (function (InitializeRequest) {\r
29199     InitializeRequest.type = new messages_1.ProtocolRequestType('initialize');\r
29200 })(InitializeRequest = exports.InitializeRequest || (exports.InitializeRequest = {}));\r
29201 /**\r
29202  * Known error codes for an `InitializeError`;\r
29203  */\r
29204 var InitializeError;\r
29205 (function (InitializeError) {\r
29206     /**\r
29207      * If the protocol version provided by the client can't be handled by the server.\r
29208      * @deprecated This initialize error got replaced by client capabilities. There is\r
29209      * no version handshake in version 3.0x\r
29210      */\r
29211     InitializeError.unknownProtocolVersion = 1;\r
29212 })(InitializeError = exports.InitializeError || (exports.InitializeError = {}));\r
29213 /**\r
29214  * The intialized notification is sent from the client to the\r
29215  * server after the client is fully initialized and the server\r
29216  * is allowed to send requests from the server to the client.\r
29217  */\r
29218 var InitializedNotification;\r
29219 (function (InitializedNotification) {\r
29220     InitializedNotification.type = new messages_1.ProtocolNotificationType('initialized');\r
29221 })(InitializedNotification = exports.InitializedNotification || (exports.InitializedNotification = {}));\r
29222 //---- Shutdown Method ----\r
29223 /**\r
29224  * A shutdown request is sent from the client to the server.\r
29225  * It is sent once when the client decides to shutdown the\r
29226  * server. The only notification that is sent after a shutdown request\r
29227  * is the exit event.\r
29228  */\r
29229 var ShutdownRequest;\r
29230 (function (ShutdownRequest) {\r
29231     ShutdownRequest.type = new messages_1.ProtocolRequestType0('shutdown');\r
29232 })(ShutdownRequest = exports.ShutdownRequest || (exports.ShutdownRequest = {}));\r
29233 //---- Exit Notification ----\r
29234 /**\r
29235  * The exit event is sent from the client to the server to\r
29236  * ask the server to exit its process.\r
29237  */\r
29238 var ExitNotification;\r
29239 (function (ExitNotification) {\r
29240     ExitNotification.type = new messages_1.ProtocolNotificationType0('exit');\r
29241 })(ExitNotification = exports.ExitNotification || (exports.ExitNotification = {}));\r
29242 /**\r
29243  * The configuration change notification is sent from the client to the server\r
29244  * when the client's configuration has changed. The notification contains\r
29245  * the changed configuration as defined by the language client.\r
29246  */\r
29247 var DidChangeConfigurationNotification;\r
29248 (function (DidChangeConfigurationNotification) {\r
29249     DidChangeConfigurationNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeConfiguration');\r
29250 })(DidChangeConfigurationNotification = exports.DidChangeConfigurationNotification || (exports.DidChangeConfigurationNotification = {}));\r
29251 //---- Message show and log notifications ----\r
29252 /**\r
29253  * The message type\r
29254  */\r
29255 var MessageType;\r
29256 (function (MessageType) {\r
29257     /**\r
29258      * An error message.\r
29259      */\r
29260     MessageType.Error = 1;\r
29261     /**\r
29262      * A warning message.\r
29263      */\r
29264     MessageType.Warning = 2;\r
29265     /**\r
29266      * An information message.\r
29267      */\r
29268     MessageType.Info = 3;\r
29269     /**\r
29270      * A log message.\r
29271      */\r
29272     MessageType.Log = 4;\r
29273 })(MessageType = exports.MessageType || (exports.MessageType = {}));\r
29274 /**\r
29275  * The show message notification is sent from a server to a client to ask\r
29276  * the client to display a particular message in the user interface.\r
29277  */\r
29278 var ShowMessageNotification;\r
29279 (function (ShowMessageNotification) {\r
29280     ShowMessageNotification.type = new messages_1.ProtocolNotificationType('window/showMessage');\r
29281 })(ShowMessageNotification = exports.ShowMessageNotification || (exports.ShowMessageNotification = {}));\r
29282 /**\r
29283  * The show message request is sent from the server to the client to show a message\r
29284  * and a set of options actions to the user.\r
29285  */\r
29286 var ShowMessageRequest;\r
29287 (function (ShowMessageRequest) {\r
29288     ShowMessageRequest.type = new messages_1.ProtocolRequestType('window/showMessageRequest');\r
29289 })(ShowMessageRequest = exports.ShowMessageRequest || (exports.ShowMessageRequest = {}));\r
29290 /**\r
29291  * The log message notification is sent from the server to the client to ask\r
29292  * the client to log a particular message.\r
29293  */\r
29294 var LogMessageNotification;\r
29295 (function (LogMessageNotification) {\r
29296     LogMessageNotification.type = new messages_1.ProtocolNotificationType('window/logMessage');\r
29297 })(LogMessageNotification = exports.LogMessageNotification || (exports.LogMessageNotification = {}));\r
29298 //---- Telemetry notification\r
29299 /**\r
29300  * The telemetry event notification is sent from the server to the client to ask\r
29301  * the client to log telemetry data.\r
29302  */\r
29303 var TelemetryEventNotification;\r
29304 (function (TelemetryEventNotification) {\r
29305     TelemetryEventNotification.type = new messages_1.ProtocolNotificationType('telemetry/event');\r
29306 })(TelemetryEventNotification = exports.TelemetryEventNotification || (exports.TelemetryEventNotification = {}));\r
29307 /**\r
29308  * Defines how the host (editor) should sync\r
29309  * document changes to the language server.\r
29310  */\r
29311 var TextDocumentSyncKind;\r
29312 (function (TextDocumentSyncKind) {\r
29313     /**\r
29314      * Documents should not be synced at all.\r
29315      */\r
29316     TextDocumentSyncKind.None = 0;\r
29317     /**\r
29318      * Documents are synced by always sending the full content\r
29319      * of the document.\r
29320      */\r
29321     TextDocumentSyncKind.Full = 1;\r
29322     /**\r
29323      * Documents are synced by sending the full content on open.\r
29324      * After that only incremental updates to the document are\r
29325      * send.\r
29326      */\r
29327     TextDocumentSyncKind.Incremental = 2;\r
29328 })(TextDocumentSyncKind = exports.TextDocumentSyncKind || (exports.TextDocumentSyncKind = {}));\r
29329 /**\r
29330  * The document open notification is sent from the client to the server to signal\r
29331  * newly opened text documents. The document's truth is now managed by the client\r
29332  * and the server must not try to read the document's truth using the document's\r
29333  * uri. Open in this sense means it is managed by the client. It doesn't necessarily\r
29334  * mean that its content is presented in an editor. An open notification must not\r
29335  * be sent more than once without a corresponding close notification send before.\r
29336  * This means open and close notification must be balanced and the max open count\r
29337  * is one.\r
29338  */\r
29339 var DidOpenTextDocumentNotification;\r
29340 (function (DidOpenTextDocumentNotification) {\r
29341     DidOpenTextDocumentNotification.method = 'textDocument/didOpen';\r
29342     DidOpenTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidOpenTextDocumentNotification.method);\r
29343 })(DidOpenTextDocumentNotification = exports.DidOpenTextDocumentNotification || (exports.DidOpenTextDocumentNotification = {}));\r
29344 /**\r
29345  * The document change notification is sent from the client to the server to signal\r
29346  * changes to a text document.\r
29347  */\r
29348 var DidChangeTextDocumentNotification;\r
29349 (function (DidChangeTextDocumentNotification) {\r
29350     DidChangeTextDocumentNotification.method = 'textDocument/didChange';\r
29351     DidChangeTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidChangeTextDocumentNotification.method);\r
29352 })(DidChangeTextDocumentNotification = exports.DidChangeTextDocumentNotification || (exports.DidChangeTextDocumentNotification = {}));\r
29353 /**\r
29354  * The document close notification is sent from the client to the server when\r
29355  * the document got closed in the client. The document's truth now exists where\r
29356  * the document's uri points to (e.g. if the document's uri is a file uri the\r
29357  * truth now exists on disk). As with the open notification the close notification\r
29358  * is about managing the document's content. Receiving a close notification\r
29359  * doesn't mean that the document was open in an editor before. A close\r
29360  * notification requires a previous open notification to be sent.\r
29361  */\r
29362 var DidCloseTextDocumentNotification;\r
29363 (function (DidCloseTextDocumentNotification) {\r
29364     DidCloseTextDocumentNotification.method = 'textDocument/didClose';\r
29365     DidCloseTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidCloseTextDocumentNotification.method);\r
29366 })(DidCloseTextDocumentNotification = exports.DidCloseTextDocumentNotification || (exports.DidCloseTextDocumentNotification = {}));\r
29367 /**\r
29368  * The document save notification is sent from the client to the server when\r
29369  * the document got saved in the client.\r
29370  */\r
29371 var DidSaveTextDocumentNotification;\r
29372 (function (DidSaveTextDocumentNotification) {\r
29373     DidSaveTextDocumentNotification.method = 'textDocument/didSave';\r
29374     DidSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(DidSaveTextDocumentNotification.method);\r
29375 })(DidSaveTextDocumentNotification = exports.DidSaveTextDocumentNotification || (exports.DidSaveTextDocumentNotification = {}));\r
29376 /**\r
29377  * Represents reasons why a text document is saved.\r
29378  */\r
29379 var TextDocumentSaveReason;\r
29380 (function (TextDocumentSaveReason) {\r
29381     /**\r
29382      * Manually triggered, e.g. by the user pressing save, by starting debugging,\r
29383      * or by an API call.\r
29384      */\r
29385     TextDocumentSaveReason.Manual = 1;\r
29386     /**\r
29387      * Automatic after a delay.\r
29388      */\r
29389     TextDocumentSaveReason.AfterDelay = 2;\r
29390     /**\r
29391      * When the editor lost focus.\r
29392      */\r
29393     TextDocumentSaveReason.FocusOut = 3;\r
29394 })(TextDocumentSaveReason = exports.TextDocumentSaveReason || (exports.TextDocumentSaveReason = {}));\r
29395 /**\r
29396  * A document will save notification is sent from the client to the server before\r
29397  * the document is actually saved.\r
29398  */\r
29399 var WillSaveTextDocumentNotification;\r
29400 (function (WillSaveTextDocumentNotification) {\r
29401     WillSaveTextDocumentNotification.method = 'textDocument/willSave';\r
29402     WillSaveTextDocumentNotification.type = new messages_1.ProtocolNotificationType(WillSaveTextDocumentNotification.method);\r
29403 })(WillSaveTextDocumentNotification = exports.WillSaveTextDocumentNotification || (exports.WillSaveTextDocumentNotification = {}));\r
29404 /**\r
29405  * A document will save request is sent from the client to the server before\r
29406  * the document is actually saved. The request can return an array of TextEdits\r
29407  * which will be applied to the text document before it is saved. Please note that\r
29408  * clients might drop results if computing the text edits took too long or if a\r
29409  * server constantly fails on this request. This is done to keep the save fast and\r
29410  * reliable.\r
29411  */\r
29412 var WillSaveTextDocumentWaitUntilRequest;\r
29413 (function (WillSaveTextDocumentWaitUntilRequest) {\r
29414     WillSaveTextDocumentWaitUntilRequest.method = 'textDocument/willSaveWaitUntil';\r
29415     WillSaveTextDocumentWaitUntilRequest.type = new messages_1.ProtocolRequestType(WillSaveTextDocumentWaitUntilRequest.method);\r
29416 })(WillSaveTextDocumentWaitUntilRequest = exports.WillSaveTextDocumentWaitUntilRequest || (exports.WillSaveTextDocumentWaitUntilRequest = {}));\r
29417 /**\r
29418  * The watched files notification is sent from the client to the server when\r
29419  * the client detects changes to file watched by the language client.\r
29420  */\r
29421 var DidChangeWatchedFilesNotification;\r
29422 (function (DidChangeWatchedFilesNotification) {\r
29423     DidChangeWatchedFilesNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWatchedFiles');\r
29424 })(DidChangeWatchedFilesNotification = exports.DidChangeWatchedFilesNotification || (exports.DidChangeWatchedFilesNotification = {}));\r
29425 /**\r
29426  * The file event type\r
29427  */\r
29428 var FileChangeType;\r
29429 (function (FileChangeType) {\r
29430     /**\r
29431      * The file got created.\r
29432      */\r
29433     FileChangeType.Created = 1;\r
29434     /**\r
29435      * The file got changed.\r
29436      */\r
29437     FileChangeType.Changed = 2;\r
29438     /**\r
29439      * The file got deleted.\r
29440      */\r
29441     FileChangeType.Deleted = 3;\r
29442 })(FileChangeType = exports.FileChangeType || (exports.FileChangeType = {}));\r
29443 var WatchKind;\r
29444 (function (WatchKind) {\r
29445     /**\r
29446      * Interested in create events.\r
29447      */\r
29448     WatchKind.Create = 1;\r
29449     /**\r
29450      * Interested in change events\r
29451      */\r
29452     WatchKind.Change = 2;\r
29453     /**\r
29454      * Interested in delete events\r
29455      */\r
29456     WatchKind.Delete = 4;\r
29457 })(WatchKind = exports.WatchKind || (exports.WatchKind = {}));\r
29458 /**\r
29459  * Diagnostics notification are sent from the server to the client to signal\r
29460  * results of validation runs.\r
29461  */\r
29462 var PublishDiagnosticsNotification;\r
29463 (function (PublishDiagnosticsNotification) {\r
29464     PublishDiagnosticsNotification.type = new messages_1.ProtocolNotificationType('textDocument/publishDiagnostics');\r
29465 })(PublishDiagnosticsNotification = exports.PublishDiagnosticsNotification || (exports.PublishDiagnosticsNotification = {}));\r
29466 /**\r
29467  * How a completion was triggered\r
29468  */\r
29469 var CompletionTriggerKind;\r
29470 (function (CompletionTriggerKind) {\r
29471     /**\r
29472      * Completion was triggered by typing an identifier (24x7 code\r
29473      * complete), manual invocation (e.g Ctrl+Space) or via API.\r
29474      */\r
29475     CompletionTriggerKind.Invoked = 1;\r
29476     /**\r
29477      * Completion was triggered by a trigger character specified by\r
29478      * the `triggerCharacters` properties of the `CompletionRegistrationOptions`.\r
29479      */\r
29480     CompletionTriggerKind.TriggerCharacter = 2;\r
29481     /**\r
29482      * Completion was re-triggered as current completion list is incomplete\r
29483      */\r
29484     CompletionTriggerKind.TriggerForIncompleteCompletions = 3;\r
29485 })(CompletionTriggerKind = exports.CompletionTriggerKind || (exports.CompletionTriggerKind = {}));\r
29486 /**\r
29487  * Request to request completion at a given text document position. The request's\r
29488  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response\r
29489  * is of type [CompletionItem[]](#CompletionItem) or [CompletionList](#CompletionList)\r
29490  * or a Thenable that resolves to such.\r
29491  *\r
29492  * The request can delay the computation of the [`detail`](#CompletionItem.detail)\r
29493  * and [`documentation`](#CompletionItem.documentation) properties to the `completionItem/resolve`\r
29494  * request. However, properties that are needed for the initial sorting and filtering, like `sortText`,\r
29495  * `filterText`, `insertText`, and `textEdit`, must not be changed during resolve.\r
29496  */\r
29497 var CompletionRequest;\r
29498 (function (CompletionRequest) {\r
29499     CompletionRequest.method = 'textDocument/completion';\r
29500     CompletionRequest.type = new messages_1.ProtocolRequestType(CompletionRequest.method);\r
29501     /** @deprecated Use CompletionRequest.type */\r
29502     CompletionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29503 })(CompletionRequest = exports.CompletionRequest || (exports.CompletionRequest = {}));\r
29504 /**\r
29505  * Request to resolve additional information for a given completion item.The request's\r
29506  * parameter is of type [CompletionItem](#CompletionItem) the response\r
29507  * is of type [CompletionItem](#CompletionItem) or a Thenable that resolves to such.\r
29508  */\r
29509 var CompletionResolveRequest;\r
29510 (function (CompletionResolveRequest) {\r
29511     CompletionResolveRequest.method = 'completionItem/resolve';\r
29512     CompletionResolveRequest.type = new messages_1.ProtocolRequestType(CompletionResolveRequest.method);\r
29513 })(CompletionResolveRequest = exports.CompletionResolveRequest || (exports.CompletionResolveRequest = {}));\r
29514 /**\r
29515  * Request to request hover information at a given text document position. The request's\r
29516  * parameter is of type [TextDocumentPosition](#TextDocumentPosition) the response is of\r
29517  * type [Hover](#Hover) or a Thenable that resolves to such.\r
29518  */\r
29519 var HoverRequest;\r
29520 (function (HoverRequest) {\r
29521     HoverRequest.method = 'textDocument/hover';\r
29522     HoverRequest.type = new messages_1.ProtocolRequestType(HoverRequest.method);\r
29523 })(HoverRequest = exports.HoverRequest || (exports.HoverRequest = {}));\r
29524 /**\r
29525  * How a signature help was triggered.\r
29526  *\r
29527  * @since 3.15.0\r
29528  */\r
29529 var SignatureHelpTriggerKind;\r
29530 (function (SignatureHelpTriggerKind) {\r
29531     /**\r
29532      * Signature help was invoked manually by the user or by a command.\r
29533      */\r
29534     SignatureHelpTriggerKind.Invoked = 1;\r
29535     /**\r
29536      * Signature help was triggered by a trigger character.\r
29537      */\r
29538     SignatureHelpTriggerKind.TriggerCharacter = 2;\r
29539     /**\r
29540      * Signature help was triggered by the cursor moving or by the document content changing.\r
29541      */\r
29542     SignatureHelpTriggerKind.ContentChange = 3;\r
29543 })(SignatureHelpTriggerKind = exports.SignatureHelpTriggerKind || (exports.SignatureHelpTriggerKind = {}));\r
29544 var SignatureHelpRequest;\r
29545 (function (SignatureHelpRequest) {\r
29546     SignatureHelpRequest.method = 'textDocument/signatureHelp';\r
29547     SignatureHelpRequest.type = new messages_1.ProtocolRequestType(SignatureHelpRequest.method);\r
29548 })(SignatureHelpRequest = exports.SignatureHelpRequest || (exports.SignatureHelpRequest = {}));\r
29549 /**\r
29550  * A request to resolve the definition location of a symbol at a given text\r
29551  * document position. The request's parameter is of type [TextDocumentPosition]\r
29552  * (#TextDocumentPosition) the response is of either type [Definition](#Definition)\r
29553  * or a typed array of [DefinitionLink](#DefinitionLink) or a Thenable that resolves\r
29554  * to such.\r
29555  */\r
29556 var DefinitionRequest;\r
29557 (function (DefinitionRequest) {\r
29558     DefinitionRequest.method = 'textDocument/definition';\r
29559     DefinitionRequest.type = new messages_1.ProtocolRequestType(DefinitionRequest.method);\r
29560     /** @deprecated Use DefinitionRequest.type */\r
29561     DefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29562 })(DefinitionRequest = exports.DefinitionRequest || (exports.DefinitionRequest = {}));\r
29563 /**\r
29564  * A request to resolve project-wide references for the symbol denoted\r
29565  * by the given text document position. The request's parameter is of\r
29566  * type [ReferenceParams](#ReferenceParams) the response is of type\r
29567  * [Location[]](#Location) or a Thenable that resolves to such.\r
29568  */\r
29569 var ReferencesRequest;\r
29570 (function (ReferencesRequest) {\r
29571     ReferencesRequest.method = 'textDocument/references';\r
29572     ReferencesRequest.type = new messages_1.ProtocolRequestType(ReferencesRequest.method);\r
29573     /** @deprecated Use ReferencesRequest.type */\r
29574     ReferencesRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29575 })(ReferencesRequest = exports.ReferencesRequest || (exports.ReferencesRequest = {}));\r
29576 /**\r
29577  * Request to resolve a [DocumentHighlight](#DocumentHighlight) for a given\r
29578  * text document position. The request's parameter is of type [TextDocumentPosition]\r
29579  * (#TextDocumentPosition) the request response is of type [DocumentHighlight[]]\r
29580  * (#DocumentHighlight) or a Thenable that resolves to such.\r
29581  */\r
29582 var DocumentHighlightRequest;\r
29583 (function (DocumentHighlightRequest) {\r
29584     DocumentHighlightRequest.method = 'textDocument/documentHighlight';\r
29585     DocumentHighlightRequest.type = new messages_1.ProtocolRequestType(DocumentHighlightRequest.method);\r
29586     /** @deprecated Use DocumentHighlightRequest.type */\r
29587     DocumentHighlightRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29588 })(DocumentHighlightRequest = exports.DocumentHighlightRequest || (exports.DocumentHighlightRequest = {}));\r
29589 /**\r
29590  * A request to list all symbols found in a given text document. The request's\r
29591  * parameter is of type [TextDocumentIdentifier](#TextDocumentIdentifier) the\r
29592  * response is of type [SymbolInformation[]](#SymbolInformation) or a Thenable\r
29593  * that resolves to such.\r
29594  */\r
29595 var DocumentSymbolRequest;\r
29596 (function (DocumentSymbolRequest) {\r
29597     DocumentSymbolRequest.method = 'textDocument/documentSymbol';\r
29598     DocumentSymbolRequest.type = new messages_1.ProtocolRequestType(DocumentSymbolRequest.method);\r
29599     /** @deprecated Use DocumentSymbolRequest.type */\r
29600     DocumentSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29601 })(DocumentSymbolRequest = exports.DocumentSymbolRequest || (exports.DocumentSymbolRequest = {}));\r
29602 /**\r
29603  * A request to provide commands for the given text document and range.\r
29604  */\r
29605 var CodeActionRequest;\r
29606 (function (CodeActionRequest) {\r
29607     CodeActionRequest.method = 'textDocument/codeAction';\r
29608     CodeActionRequest.type = new messages_1.ProtocolRequestType(CodeActionRequest.method);\r
29609     /** @deprecated Use CodeActionRequest.type */\r
29610     CodeActionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29611 })(CodeActionRequest = exports.CodeActionRequest || (exports.CodeActionRequest = {}));\r
29612 /**\r
29613  * A request to list project-wide symbols matching the query string given\r
29614  * by the [WorkspaceSymbolParams](#WorkspaceSymbolParams). The response is\r
29615  * of type [SymbolInformation[]](#SymbolInformation) or a Thenable that\r
29616  * resolves to such.\r
29617  */\r
29618 var WorkspaceSymbolRequest;\r
29619 (function (WorkspaceSymbolRequest) {\r
29620     WorkspaceSymbolRequest.method = 'workspace/symbol';\r
29621     WorkspaceSymbolRequest.type = new messages_1.ProtocolRequestType(WorkspaceSymbolRequest.method);\r
29622     /** @deprecated Use WorkspaceSymbolRequest.type */\r
29623     WorkspaceSymbolRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29624 })(WorkspaceSymbolRequest = exports.WorkspaceSymbolRequest || (exports.WorkspaceSymbolRequest = {}));\r
29625 /**\r
29626  * A request to provide code lens for the given text document.\r
29627  */\r
29628 var CodeLensRequest;\r
29629 (function (CodeLensRequest) {\r
29630     CodeLensRequest.type = new messages_1.ProtocolRequestType('textDocument/codeLens');\r
29631     /** @deprecated Use CodeLensRequest.type */\r
29632     CodeLensRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29633 })(CodeLensRequest = exports.CodeLensRequest || (exports.CodeLensRequest = {}));\r
29634 /**\r
29635  * A request to resolve a command for a given code lens.\r
29636  */\r
29637 var CodeLensResolveRequest;\r
29638 (function (CodeLensResolveRequest) {\r
29639     CodeLensResolveRequest.type = new messages_1.ProtocolRequestType('codeLens/resolve');\r
29640 })(CodeLensResolveRequest = exports.CodeLensResolveRequest || (exports.CodeLensResolveRequest = {}));\r
29641 /**\r
29642  * A request to provide document links\r
29643  */\r
29644 var DocumentLinkRequest;\r
29645 (function (DocumentLinkRequest) {\r
29646     DocumentLinkRequest.method = 'textDocument/documentLink';\r
29647     DocumentLinkRequest.type = new messages_1.ProtocolRequestType(DocumentLinkRequest.method);\r
29648     /** @deprecated Use DocumentLinkRequest.type */\r
29649     DocumentLinkRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29650 })(DocumentLinkRequest = exports.DocumentLinkRequest || (exports.DocumentLinkRequest = {}));\r
29651 /**\r
29652  * Request to resolve additional information for a given document link. The request's\r
29653  * parameter is of type [DocumentLink](#DocumentLink) the response\r
29654  * is of type [DocumentLink](#DocumentLink) or a Thenable that resolves to such.\r
29655  */\r
29656 var DocumentLinkResolveRequest;\r
29657 (function (DocumentLinkResolveRequest) {\r
29658     DocumentLinkResolveRequest.type = new messages_1.ProtocolRequestType('documentLink/resolve');\r
29659 })(DocumentLinkResolveRequest = exports.DocumentLinkResolveRequest || (exports.DocumentLinkResolveRequest = {}));\r
29660 /**\r
29661  * A request to to format a whole document.\r
29662  */\r
29663 var DocumentFormattingRequest;\r
29664 (function (DocumentFormattingRequest) {\r
29665     DocumentFormattingRequest.method = 'textDocument/formatting';\r
29666     DocumentFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentFormattingRequest.method);\r
29667 })(DocumentFormattingRequest = exports.DocumentFormattingRequest || (exports.DocumentFormattingRequest = {}));\r
29668 /**\r
29669  * A request to to format a range in a document.\r
29670  */\r
29671 var DocumentRangeFormattingRequest;\r
29672 (function (DocumentRangeFormattingRequest) {\r
29673     DocumentRangeFormattingRequest.method = 'textDocument/rangeFormatting';\r
29674     DocumentRangeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentRangeFormattingRequest.method);\r
29675 })(DocumentRangeFormattingRequest = exports.DocumentRangeFormattingRequest || (exports.DocumentRangeFormattingRequest = {}));\r
29676 /**\r
29677  * A request to format a document on type.\r
29678  */\r
29679 var DocumentOnTypeFormattingRequest;\r
29680 (function (DocumentOnTypeFormattingRequest) {\r
29681     DocumentOnTypeFormattingRequest.method = 'textDocument/onTypeFormatting';\r
29682     DocumentOnTypeFormattingRequest.type = new messages_1.ProtocolRequestType(DocumentOnTypeFormattingRequest.method);\r
29683 })(DocumentOnTypeFormattingRequest = exports.DocumentOnTypeFormattingRequest || (exports.DocumentOnTypeFormattingRequest = {}));\r
29684 /**\r
29685  * A request to rename a symbol.\r
29686  */\r
29687 var RenameRequest;\r
29688 (function (RenameRequest) {\r
29689     RenameRequest.method = 'textDocument/rename';\r
29690     RenameRequest.type = new messages_1.ProtocolRequestType(RenameRequest.method);\r
29691 })(RenameRequest = exports.RenameRequest || (exports.RenameRequest = {}));\r
29692 /**\r
29693  * A request to test and perform the setup necessary for a rename.\r
29694  */\r
29695 var PrepareRenameRequest;\r
29696 (function (PrepareRenameRequest) {\r
29697     PrepareRenameRequest.method = 'textDocument/prepareRename';\r
29698     PrepareRenameRequest.type = new messages_1.ProtocolRequestType(PrepareRenameRequest.method);\r
29699 })(PrepareRenameRequest = exports.PrepareRenameRequest || (exports.PrepareRenameRequest = {}));\r
29700 /**\r
29701  * A request send from the client to the server to execute a command. The request might return\r
29702  * a workspace edit which the client will apply to the workspace.\r
29703  */\r
29704 var ExecuteCommandRequest;\r
29705 (function (ExecuteCommandRequest) {\r
29706     ExecuteCommandRequest.type = new messages_1.ProtocolRequestType('workspace/executeCommand');\r
29707 })(ExecuteCommandRequest = exports.ExecuteCommandRequest || (exports.ExecuteCommandRequest = {}));\r
29708 /**\r
29709  * A request sent from the server to the client to modified certain resources.\r
29710  */\r
29711 var ApplyWorkspaceEditRequest;\r
29712 (function (ApplyWorkspaceEditRequest) {\r
29713     ApplyWorkspaceEditRequest.type = new messages_1.ProtocolRequestType('workspace/applyEdit');\r
29714 })(ApplyWorkspaceEditRequest = exports.ApplyWorkspaceEditRequest || (exports.ApplyWorkspaceEditRequest = {}));\r
29715
29716
29717 /***/ }),
29718 /* 177 */
29719 /***/ (function(module, exports, __webpack_require__) {
29720
29721 "use strict";
29722 /* --------------------------------------------------------------------------------------------\r
29723  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29724  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29725  * ------------------------------------------------------------------------------------------ */\r
29726 \r
29727 Object.defineProperty(exports, "__esModule", { value: true });\r
29728 function boolean(value) {\r
29729     return value === true || value === false;\r
29730 }\r
29731 exports.boolean = boolean;\r
29732 function string(value) {\r
29733     return typeof value === 'string' || value instanceof String;\r
29734 }\r
29735 exports.string = string;\r
29736 function number(value) {\r
29737     return typeof value === 'number' || value instanceof Number;\r
29738 }\r
29739 exports.number = number;\r
29740 function error(value) {\r
29741     return value instanceof Error;\r
29742 }\r
29743 exports.error = error;\r
29744 function func(value) {\r
29745     return typeof value === 'function';\r
29746 }\r
29747 exports.func = func;\r
29748 function array(value) {\r
29749     return Array.isArray(value);\r
29750 }\r
29751 exports.array = array;\r
29752 function stringArray(value) {\r
29753     return array(value) && value.every(elem => string(elem));\r
29754 }\r
29755 exports.stringArray = stringArray;\r
29756 function typedArray(value, check) {\r
29757     return Array.isArray(value) && value.every(check);\r
29758 }\r
29759 exports.typedArray = typedArray;\r
29760 function objectLiteral(value) {\r
29761     // Strictly speaking class instances pass this check as well. Since the LSP\r
29762     // doesn't use classes we ignore this for now. If we do we need to add something\r
29763     // like this: `Object.getPrototypeOf(Object.getPrototypeOf(x)) === null`\r
29764     return value !== null && typeof value === 'object';\r
29765 }\r
29766 exports.objectLiteral = objectLiteral;\r
29767
29768
29769 /***/ }),
29770 /* 178 */
29771 /***/ (function(module, exports, __webpack_require__) {
29772
29773 "use strict";
29774 /* --------------------------------------------------------------------------------------------\r
29775  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29776  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29777  * ------------------------------------------------------------------------------------------ */\r
29778 \r
29779 Object.defineProperty(exports, "__esModule", { value: true });\r
29780 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29781 class ProtocolRequestType0 extends vscode_jsonrpc_1.RequestType0 {\r
29782     constructor(method) {\r
29783         super(method);\r
29784     }\r
29785 }\r
29786 exports.ProtocolRequestType0 = ProtocolRequestType0;\r
29787 class ProtocolRequestType extends vscode_jsonrpc_1.RequestType {\r
29788     constructor(method) {\r
29789         super(method);\r
29790     }\r
29791 }\r
29792 exports.ProtocolRequestType = ProtocolRequestType;\r
29793 class ProtocolNotificationType extends vscode_jsonrpc_1.NotificationType {\r
29794     constructor(method) {\r
29795         super(method);\r
29796     }\r
29797 }\r
29798 exports.ProtocolNotificationType = ProtocolNotificationType;\r
29799 class ProtocolNotificationType0 extends vscode_jsonrpc_1.NotificationType0 {\r
29800     constructor(method) {\r
29801         super(method);\r
29802     }\r
29803 }\r
29804 exports.ProtocolNotificationType0 = ProtocolNotificationType0;\r
29805
29806
29807 /***/ }),
29808 /* 179 */
29809 /***/ (function(module, exports, __webpack_require__) {
29810
29811 "use strict";
29812 /* --------------------------------------------------------------------------------------------\r
29813  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29814  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29815  * ------------------------------------------------------------------------------------------ */\r
29816 \r
29817 Object.defineProperty(exports, "__esModule", { value: true });\r
29818 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29819 const messages_1 = __webpack_require__(178);\r
29820 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
29821 let __noDynamicImport;\r
29822 /**\r
29823  * A request to resolve the implementation locations of a symbol at a given text\r
29824  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
29825  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
29826  * Thenable that resolves to such.\r
29827  */\r
29828 var ImplementationRequest;\r
29829 (function (ImplementationRequest) {\r
29830     ImplementationRequest.method = 'textDocument/implementation';\r
29831     ImplementationRequest.type = new messages_1.ProtocolRequestType(ImplementationRequest.method);\r
29832     /** @deprecated Use ImplementationRequest.type */\r
29833     ImplementationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29834 })(ImplementationRequest = exports.ImplementationRequest || (exports.ImplementationRequest = {}));\r
29835
29836
29837 /***/ }),
29838 /* 180 */
29839 /***/ (function(module, exports, __webpack_require__) {
29840
29841 "use strict";
29842 /* --------------------------------------------------------------------------------------------\r
29843  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29844  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29845  * ------------------------------------------------------------------------------------------ */\r
29846 \r
29847 Object.defineProperty(exports, "__esModule", { value: true });\r
29848 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29849 const messages_1 = __webpack_require__(178);\r
29850 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
29851 let __noDynamicImport;\r
29852 /**\r
29853  * A request to resolve the type definition locations of a symbol at a given text\r
29854  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
29855  * (#TextDocumentPositionParams) the response is of type [Definition](#Definition) or a\r
29856  * Thenable that resolves to such.\r
29857  */\r
29858 var TypeDefinitionRequest;\r
29859 (function (TypeDefinitionRequest) {\r
29860     TypeDefinitionRequest.method = 'textDocument/typeDefinition';\r
29861     TypeDefinitionRequest.type = new messages_1.ProtocolRequestType(TypeDefinitionRequest.method);\r
29862     /** @deprecated Use TypeDefinitionRequest.type */\r
29863     TypeDefinitionRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29864 })(TypeDefinitionRequest = exports.TypeDefinitionRequest || (exports.TypeDefinitionRequest = {}));\r
29865
29866
29867 /***/ }),
29868 /* 181 */
29869 /***/ (function(module, exports, __webpack_require__) {
29870
29871 "use strict";
29872 /* --------------------------------------------------------------------------------------------\r
29873  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29874  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29875  * ------------------------------------------------------------------------------------------ */\r
29876 \r
29877 Object.defineProperty(exports, "__esModule", { value: true });\r
29878 const messages_1 = __webpack_require__(178);\r
29879 /**\r
29880  * The `workspace/workspaceFolders` is sent from the server to the client to fetch the open workspace folders.\r
29881  */\r
29882 var WorkspaceFoldersRequest;\r
29883 (function (WorkspaceFoldersRequest) {\r
29884     WorkspaceFoldersRequest.type = new messages_1.ProtocolRequestType0('workspace/workspaceFolders');\r
29885 })(WorkspaceFoldersRequest = exports.WorkspaceFoldersRequest || (exports.WorkspaceFoldersRequest = {}));\r
29886 /**\r
29887  * The `workspace/didChangeWorkspaceFolders` notification is sent from the client to the server when the workspace\r
29888  * folder configuration changes.\r
29889  */\r
29890 var DidChangeWorkspaceFoldersNotification;\r
29891 (function (DidChangeWorkspaceFoldersNotification) {\r
29892     DidChangeWorkspaceFoldersNotification.type = new messages_1.ProtocolNotificationType('workspace/didChangeWorkspaceFolders');\r
29893 })(DidChangeWorkspaceFoldersNotification = exports.DidChangeWorkspaceFoldersNotification || (exports.DidChangeWorkspaceFoldersNotification = {}));\r
29894
29895
29896 /***/ }),
29897 /* 182 */
29898 /***/ (function(module, exports, __webpack_require__) {
29899
29900 "use strict";
29901 /* --------------------------------------------------------------------------------------------\r
29902  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29903  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29904  * ------------------------------------------------------------------------------------------ */\r
29905 \r
29906 Object.defineProperty(exports, "__esModule", { value: true });\r
29907 const messages_1 = __webpack_require__(178);\r
29908 /**\r
29909  * The 'workspace/configuration' request is sent from the server to the client to fetch a certain\r
29910  * configuration setting.\r
29911  *\r
29912  * This pull model replaces the old push model were the client signaled configuration change via an\r
29913  * event. If the server still needs to react to configuration changes (since the server caches the\r
29914  * result of `workspace/configuration` requests) the server should register for an empty configuration\r
29915  * change event and empty the cache if such an event is received.\r
29916  */\r
29917 var ConfigurationRequest;\r
29918 (function (ConfigurationRequest) {\r
29919     ConfigurationRequest.type = new messages_1.ProtocolRequestType('workspace/configuration');\r
29920 })(ConfigurationRequest = exports.ConfigurationRequest || (exports.ConfigurationRequest = {}));\r
29921
29922
29923 /***/ }),
29924 /* 183 */
29925 /***/ (function(module, exports, __webpack_require__) {
29926
29927 "use strict";
29928 /* --------------------------------------------------------------------------------------------\r
29929  * Copyright (c) Microsoft Corporation. All rights reserved.\r
29930  * Licensed under the MIT License. See License.txt in the project root for license information.\r
29931  * ------------------------------------------------------------------------------------------ */\r
29932 \r
29933 Object.defineProperty(exports, "__esModule", { value: true });\r
29934 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29935 const messages_1 = __webpack_require__(178);\r
29936 /**\r
29937  * A request to list all color symbols found in a given text document. The request's\r
29938  * parameter is of type [DocumentColorParams](#DocumentColorParams) the\r
29939  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
29940  * that resolves to such.\r
29941  */\r
29942 var DocumentColorRequest;\r
29943 (function (DocumentColorRequest) {\r
29944     DocumentColorRequest.method = 'textDocument/documentColor';\r
29945     DocumentColorRequest.type = new messages_1.ProtocolRequestType(DocumentColorRequest.method);\r
29946     /** @deprecated Use DocumentColorRequest.type */\r
29947     DocumentColorRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
29948 })(DocumentColorRequest = exports.DocumentColorRequest || (exports.DocumentColorRequest = {}));\r
29949 /**\r
29950  * A request to list all presentation for a color. The request's\r
29951  * parameter is of type [ColorPresentationParams](#ColorPresentationParams) the\r
29952  * response is of type [ColorInformation[]](#ColorInformation) or a Thenable\r
29953  * that resolves to such.\r
29954  */\r
29955 var ColorPresentationRequest;\r
29956 (function (ColorPresentationRequest) {\r
29957     ColorPresentationRequest.type = new messages_1.ProtocolRequestType('textDocument/colorPresentation');\r
29958 })(ColorPresentationRequest = exports.ColorPresentationRequest || (exports.ColorPresentationRequest = {}));\r
29959
29960
29961 /***/ }),
29962 /* 184 */
29963 /***/ (function(module, exports, __webpack_require__) {
29964
29965 "use strict";
29966 \r
29967 /*---------------------------------------------------------------------------------------------\r
29968  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
29969  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
29970  *--------------------------------------------------------------------------------------------*/\r
29971 Object.defineProperty(exports, "__esModule", { value: true });\r
29972 const vscode_jsonrpc_1 = __webpack_require__(163);\r
29973 const messages_1 = __webpack_require__(178);\r
29974 /**\r
29975  * Enum of known range kinds\r
29976  */\r
29977 var FoldingRangeKind;\r
29978 (function (FoldingRangeKind) {\r
29979     /**\r
29980      * Folding range for a comment\r
29981      */\r
29982     FoldingRangeKind["Comment"] = "comment";\r
29983     /**\r
29984      * Folding range for a imports or includes\r
29985      */\r
29986     FoldingRangeKind["Imports"] = "imports";\r
29987     /**\r
29988      * Folding range for a region (e.g. `#region`)\r
29989      */\r
29990     FoldingRangeKind["Region"] = "region";\r
29991 })(FoldingRangeKind = exports.FoldingRangeKind || (exports.FoldingRangeKind = {}));\r
29992 /**\r
29993  * A request to provide folding ranges in a document. The request's\r
29994  * parameter is of type [FoldingRangeParams](#FoldingRangeParams), the\r
29995  * response is of type [FoldingRangeList](#FoldingRangeList) or a Thenable\r
29996  * that resolves to such.\r
29997  */\r
29998 var FoldingRangeRequest;\r
29999 (function (FoldingRangeRequest) {\r
30000     FoldingRangeRequest.method = 'textDocument/foldingRange';\r
30001     FoldingRangeRequest.type = new messages_1.ProtocolRequestType(FoldingRangeRequest.method);\r
30002     /** @deprecated Use FoldingRangeRequest.type */\r
30003     FoldingRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
30004 })(FoldingRangeRequest = exports.FoldingRangeRequest || (exports.FoldingRangeRequest = {}));\r
30005
30006
30007 /***/ }),
30008 /* 185 */
30009 /***/ (function(module, exports, __webpack_require__) {
30010
30011 "use strict";
30012 /* --------------------------------------------------------------------------------------------\r
30013  * Copyright (c) Microsoft Corporation. All rights reserved.\r
30014  * Licensed under the MIT License. See License.txt in the project root for license information.\r
30015  * ------------------------------------------------------------------------------------------ */\r
30016 \r
30017 Object.defineProperty(exports, "__esModule", { value: true });\r
30018 const vscode_jsonrpc_1 = __webpack_require__(163);\r
30019 const messages_1 = __webpack_require__(178);\r
30020 // @ts-ignore: to avoid inlining LocatioLink as dynamic import\r
30021 let __noDynamicImport;\r
30022 /**\r
30023  * A request to resolve the type definition locations of a symbol at a given text\r
30024  * document position. The request's parameter is of type [TextDocumentPositioParams]\r
30025  * (#TextDocumentPositionParams) the response is of type [Declaration](#Declaration)\r
30026  * or a typed array of [DeclarationLink](#DeclarationLink) or a Thenable that resolves\r
30027  * to such.\r
30028  */\r
30029 var DeclarationRequest;\r
30030 (function (DeclarationRequest) {\r
30031     DeclarationRequest.method = 'textDocument/declaration';\r
30032     DeclarationRequest.type = new messages_1.ProtocolRequestType(DeclarationRequest.method);\r
30033     /** @deprecated Use DeclarationRequest.type */\r
30034     DeclarationRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
30035 })(DeclarationRequest = exports.DeclarationRequest || (exports.DeclarationRequest = {}));\r
30036
30037
30038 /***/ }),
30039 /* 186 */
30040 /***/ (function(module, exports, __webpack_require__) {
30041
30042 "use strict";
30043 \r
30044 /*---------------------------------------------------------------------------------------------\r
30045  *  Copyright (c) Microsoft Corporation. All rights reserved.\r
30046  *  Licensed under the MIT License. See License.txt in the project root for license information.\r
30047  *--------------------------------------------------------------------------------------------*/\r
30048 Object.defineProperty(exports, "__esModule", { value: true });\r
30049 const vscode_jsonrpc_1 = __webpack_require__(163);\r
30050 const messages_1 = __webpack_require__(178);\r
30051 /**\r
30052  * A request to provide selection ranges in a document. The request's\r
30053  * parameter is of type [SelectionRangeParams](#SelectionRangeParams), the\r
30054  * response is of type [SelectionRange[]](#SelectionRange[]) or a Thenable\r
30055  * that resolves to such.\r
30056  */\r
30057 var SelectionRangeRequest;\r
30058 (function (SelectionRangeRequest) {\r
30059     SelectionRangeRequest.method = 'textDocument/selectionRange';\r
30060     SelectionRangeRequest.type = new messages_1.ProtocolRequestType(SelectionRangeRequest.method);\r
30061     /** @deprecated  Use SelectionRangeRequest.type */\r
30062     SelectionRangeRequest.resultType = new vscode_jsonrpc_1.ProgressType();\r
30063 })(SelectionRangeRequest = exports.SelectionRangeRequest || (exports.SelectionRangeRequest = {}));\r
30064
30065
30066 /***/ }),
30067 /* 187 */
30068 /***/ (function(module, exports, __webpack_require__) {
30069
30070 "use strict";
30071 /* --------------------------------------------------------------------------------------------\r
30072  * Copyright (c) Microsoft Corporation. All rights reserved.\r
30073  * Licensed under the MIT License. See License.txt in the project root for license information.\r
30074  * ------------------------------------------------------------------------------------------ */\r
30075 \r
30076 Object.defineProperty(exports, "__esModule", { value: true });\r
30077 const vscode_jsonrpc_1 = __webpack_require__(163);\r
30078 const messages_1 = __webpack_require__(178);\r
30079 var WorkDoneProgress;\r
30080 (function (WorkDoneProgress) {\r
30081     WorkDoneProgress.type = new vscode_jsonrpc_1.ProgressType();\r
30082 })(WorkDoneProgress = exports.WorkDoneProgress || (exports.WorkDoneProgress = {}));\r
30083 /**\r
30084  * The `window/workDoneProgress/create` request is sent from the server to the client to initiate progress\r
30085  * reporting from the server.\r
30086  */\r
30087 var WorkDoneProgressCreateRequest;\r
30088 (function (WorkDoneProgressCreateRequest) {\r
30089     WorkDoneProgressCreateRequest.type = new messages_1.ProtocolRequestType('window/workDoneProgress/create');\r
30090 })(WorkDoneProgressCreateRequest = exports.WorkDoneProgressCreateRequest || (exports.WorkDoneProgressCreateRequest = {}));\r
30091 /**\r
30092  * The `window/workDoneProgress/cancel` notification is sent from  the client to the server to cancel a progress\r
30093  * initiated on the server side.\r
30094  */\r
30095 var WorkDoneProgressCancelNotification;\r
30096 (function (WorkDoneProgressCancelNotification) {\r
30097     WorkDoneProgressCancelNotification.type = new messages_1.ProtocolNotificationType('window/workDoneProgress/cancel');\r
30098 })(WorkDoneProgressCancelNotification = exports.WorkDoneProgressCancelNotification || (exports.WorkDoneProgressCancelNotification = {}));\r
30099
30100
30101 /***/ }),
30102 /* 188 */
30103 /***/ (function(module, exports, __webpack_require__) {
30104
30105 "use strict";
30106 /* --------------------------------------------------------------------------------------------\r
30107  * Copyright (c) TypeFox and others. All rights reserved.\r
30108  * Licensed under the MIT License. See License.txt in the project root for license information.\r
30109  * ------------------------------------------------------------------------------------------ */\r
30110 \r
30111 Object.defineProperty(exports, "__esModule", { value: true });\r
30112 const messages_1 = __webpack_require__(178);\r
30113 /**\r
30114  * A request to result a `CallHierarchyItem` in a document at a given position.\r
30115  * Can be used as an input to a incoming or outgoing call hierarchy.\r
30116  *\r
30117  * @since 3.16.0 - Proposed state\r
30118  */\r
30119 var CallHierarchyPrepareRequest;\r
30120 (function (CallHierarchyPrepareRequest) {\r
30121     CallHierarchyPrepareRequest.method = 'textDocument/prepareCallHierarchy';\r
30122     CallHierarchyPrepareRequest.type = new messages_1.ProtocolRequestType(CallHierarchyPrepareRequest.method);\r
30123 })(CallHierarchyPrepareRequest = exports.CallHierarchyPrepareRequest || (exports.CallHierarchyPrepareRequest = {}));\r
30124 /**\r
30125  * A request to resolve the incoming calls for a given `CallHierarchyItem`.\r
30126  *\r
30127  * @since 3.16.0 - Proposed state\r
30128  */\r
30129 var CallHierarchyIncomingCallsRequest;\r
30130 (function (CallHierarchyIncomingCallsRequest) {\r
30131     CallHierarchyIncomingCallsRequest.method = 'callHierarchy/incomingCalls';\r
30132     CallHierarchyIncomingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyIncomingCallsRequest.method);\r
30133 })(CallHierarchyIncomingCallsRequest = exports.CallHierarchyIncomingCallsRequest || (exports.CallHierarchyIncomingCallsRequest = {}));\r
30134 /**\r
30135  * A request to resolve the outgoing calls for a given `CallHierarchyItem`.\r
30136  *\r
30137  * @since 3.16.0 - Proposed state\r
30138  */\r
30139 var CallHierarchyOutgoingCallsRequest;\r
30140 (function (CallHierarchyOutgoingCallsRequest) {\r
30141     CallHierarchyOutgoingCallsRequest.method = 'callHierarchy/outgoingCalls';\r
30142     CallHierarchyOutgoingCallsRequest.type = new messages_1.ProtocolRequestType(CallHierarchyOutgoingCallsRequest.method);\r
30143 })(CallHierarchyOutgoingCallsRequest = exports.CallHierarchyOutgoingCallsRequest || (exports.CallHierarchyOutgoingCallsRequest = {}));\r
30144
30145
30146 /***/ }),
30147 /* 189 */
30148 /***/ (function(module, exports, __webpack_require__) {
30149
30150 "use strict";
30151 /* --------------------------------------------------------------------------------------------\r
30152  * Copyright (c) Microsoft Corporation. All rights reserved.\r
30153  * Licensed under the MIT License. See License.txt in the project root for license information.\r
30154  * ------------------------------------------------------------------------------------------ */\r
30155 \r
30156 Object.defineProperty(exports, "__esModule", { value: true });\r
30157 const messages_1 = __webpack_require__(178);\r
30158 /**\r
30159  * A set of predefined token types. This set is not fixed\r
30160  * an clients can specify additional token types via the\r
30161  * corresponding client capabilities.\r
30162  *\r
30163  * @since 3.16.0 - Proposed state\r
30164  */\r
30165 var SemanticTokenTypes;\r
30166 (function (SemanticTokenTypes) {\r
30167     SemanticTokenTypes["comment"] = "comment";\r
30168     SemanticTokenTypes["keyword"] = "keyword";\r
30169     SemanticTokenTypes["string"] = "string";\r
30170     SemanticTokenTypes["number"] = "number";\r
30171     SemanticTokenTypes["regexp"] = "regexp";\r
30172     SemanticTokenTypes["operator"] = "operator";\r
30173     SemanticTokenTypes["namespace"] = "namespace";\r
30174     SemanticTokenTypes["type"] = "type";\r
30175     SemanticTokenTypes["struct"] = "struct";\r
30176     SemanticTokenTypes["class"] = "class";\r
30177     SemanticTokenTypes["interface"] = "interface";\r
30178     SemanticTokenTypes["enum"] = "enum";\r
30179     SemanticTokenTypes["typeParameter"] = "typeParameter";\r
30180     SemanticTokenTypes["function"] = "function";\r
30181     SemanticTokenTypes["member"] = "member";\r
30182     SemanticTokenTypes["property"] = "property";\r
30183     SemanticTokenTypes["macro"] = "macro";\r
30184     SemanticTokenTypes["variable"] = "variable";\r
30185     SemanticTokenTypes["parameter"] = "parameter";\r
30186     SemanticTokenTypes["label"] = "label";\r
30187 })(SemanticTokenTypes = exports.SemanticTokenTypes || (exports.SemanticTokenTypes = {}));\r
30188 /**\r
30189  * A set of predefined token modifiers. This set is not fixed\r
30190  * an clients can specify additional token types via the\r
30191  * corresponding client capabilities.\r
30192  *\r
30193  * @since 3.16.0 - Proposed state\r
30194  */\r
30195 var SemanticTokenModifiers;\r
30196 (function (SemanticTokenModifiers) {\r
30197     SemanticTokenModifiers["documentation"] = "documentation";\r
30198     SemanticTokenModifiers["declaration"] = "declaration";\r
30199     SemanticTokenModifiers["definition"] = "definition";\r
30200     SemanticTokenModifiers["reference"] = "reference";\r
30201     SemanticTokenModifiers["static"] = "static";\r
30202     SemanticTokenModifiers["abstract"] = "abstract";\r
30203     SemanticTokenModifiers["deprecated"] = "deprecated";\r
30204     SemanticTokenModifiers["async"] = "async";\r
30205     SemanticTokenModifiers["volatile"] = "volatile";\r
30206     SemanticTokenModifiers["readonly"] = "readonly";\r
30207 })(SemanticTokenModifiers = exports.SemanticTokenModifiers || (exports.SemanticTokenModifiers = {}));\r
30208 /**\r
30209  * @since 3.16.0 - Proposed state\r
30210  */\r
30211 var SemanticTokens;\r
30212 (function (SemanticTokens) {\r
30213     function is(value) {\r
30214         const candidate = value;\r
30215         return candidate !== undefined && (candidate.resultId === undefined || typeof candidate.resultId === 'string') &&\r
30216             Array.isArray(candidate.data) && (candidate.data.length === 0 || typeof candidate.data[0] === 'number');\r
30217     }\r
30218     SemanticTokens.is = is;\r
30219 })(SemanticTokens = exports.SemanticTokens || (exports.SemanticTokens = {}));\r
30220 /**\r
30221  * @since 3.16.0 - Proposed state\r
30222  */\r
30223 var SemanticTokensRequest;\r
30224 (function (SemanticTokensRequest) {\r
30225     SemanticTokensRequest.method = 'textDocument/semanticTokens';\r
30226     SemanticTokensRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRequest.method);\r
30227 })(SemanticTokensRequest = exports.SemanticTokensRequest || (exports.SemanticTokensRequest = {}));\r
30228 /**\r
30229  * @since 3.16.0 - Proposed state\r
30230  */\r
30231 var SemanticTokensEditsRequest;\r
30232 (function (SemanticTokensEditsRequest) {\r
30233     SemanticTokensEditsRequest.method = 'textDocument/semanticTokens/edits';\r
30234     SemanticTokensEditsRequest.type = new messages_1.ProtocolRequestType(SemanticTokensEditsRequest.method);\r
30235 })(SemanticTokensEditsRequest = exports.SemanticTokensEditsRequest || (exports.SemanticTokensEditsRequest = {}));\r
30236 /**\r
30237  * @since 3.16.0 - Proposed state\r
30238  */\r
30239 var SemanticTokensRangeRequest;\r
30240 (function (SemanticTokensRangeRequest) {\r
30241     SemanticTokensRangeRequest.method = 'textDocument/semanticTokens/range';\r
30242     SemanticTokensRangeRequest.type = new messages_1.ProtocolRequestType(SemanticTokensRangeRequest.method);\r
30243 })(SemanticTokensRangeRequest = exports.SemanticTokensRangeRequest || (exports.SemanticTokensRangeRequest = {}));\r
30244
30245
30246 /***/ })
30247 /******/ ])));