From b819a11703e3bc80e8e606afee9c7ddbdaa2ba8c Mon Sep 17 00:00:00 2001 From: Kryptonite <1535820963@qq.com> Date: Sat, 25 Feb 2023 21:27:17 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20client=E7=AA=97=E4=BD=93=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/main.js | 26 +++++++++++++++++++++++--- client/markdown/basic.md | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 client/markdown/basic.md diff --git a/client/main.js b/client/main.js index ad658d16..f41476ea 100644 --- a/client/main.js +++ b/client/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { dialog, app, BrowserWindow } = require('electron') function createWindow() { const win = new BrowserWindow({ @@ -7,16 +7,36 @@ function createWindow() { }) win.loadFile('index.html'); + return win; // win.webContents.openDevTools(); } app.whenReady().then(() => { - createWindow() + mainWindow = createWindow() app.on('activate', function () { if (BrowserWindow.getAllWindows().length === 0) createWindow() }) + mainWindow.on('close', function(e) { + e.preventDefault(); + dialog.showMessageBox({ + type: 'info', + title: '提示', + message:'确认退出?', + buttons: ['确认', '取消'], + cancelId: 1, + }).then(idx => { + console.log(idx) + if (idx.response == 1) { + e.preventDefault(); + } else { + mainWindow = null + app.exit(); + } + }) + }) }) app.on('window-all-closed', function () { - if (process.platform !== 'darwin') app.quit() + // if (process.platform !== 'darwin') app.quit() + app.quit() }) diff --git a/client/markdown/basic.md b/client/markdown/basic.md new file mode 100644 index 00000000..3e446a9e --- /dev/null +++ b/client/markdown/basic.md @@ -0,0 +1 @@ +# Test Markdown \ No newline at end of file From a3001685044b962569fa9296fccd533d3e9468be Mon Sep 17 00:00:00 2001 From: Kryptonite <1535820963@qq.com> Date: Sat, 25 Feb 2023 21:33:53 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=87=BAmarkdown=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/main.js | 3 +- client/markdown/basic.md | 55 ++++++++++++++++++++++++++++++- client/scripts/cherry-markdown.js | 36 ++++++++++++++++---- 3 files changed, 85 insertions(+), 9 deletions(-) diff --git a/client/main.js b/client/main.js index f41476ea..c519f29d 100644 --- a/client/main.js +++ b/client/main.js @@ -24,8 +24,7 @@ app.whenReady().then(() => { message:'确认退出?', buttons: ['确认', '取消'], cancelId: 1, - }).then(idx => { - console.log(idx) + }).then(idx => { if (idx.response == 1) { e.preventDefault(); } else { diff --git a/client/markdown/basic.md b/client/markdown/basic.md index 3e446a9e..6628f8a0 100644 --- a/client/markdown/basic.md +++ b/client/markdown/basic.md @@ -1 +1,54 @@ -# Test Markdown \ No newline at end of file +# Test Markdown h1 + +## Test Markdown h2 + +- unordered list item 1 +- unordered list item 2 + +1. ordered list item 1 +2. ordered list item 2 + +> blockquote +> +> blockquote + +`inline code` + +```javascript +// code block +var foo = 'bar'; +``` + +[link](http://baidu.com) + +![image](https://upload.wikimedia.org/wikipedia/zh/3/34/Lenna.jpg) + +**bold** + +*italic* + +***bold italic*** + +~~strikethrough~~ + +| table | header | +| ----- | ------ | +| cell | cell | + +--- + +$E=mc^2$ + +$$ +\begin{aligned} +\frac{\partial u}{\partial t} + c \frac{\partial u}{\partial x} &= 0 \\ +\frac{\partial v}{\partial t} + c \frac{\partial v}{\partial x} &= 0 +\end{aligned} +$$ + +--- + +- [x] task list item 1 +- [ ] task list item 2 + +-------- END OF FILE -------- \ No newline at end of file diff --git a/client/scripts/cherry-markdown.js b/client/scripts/cherry-markdown.js index fd2b05fd..923ebe43 100644 --- a/client/scripts/cherry-markdown.js +++ b/client/scripts/cherry-markdown.js @@ -27786,7 +27786,7 @@ // '(?:(?:(?:https?|ftp):)?\\/\\/)' + "(?:\\/\\/)".concat(URL_INLINE_NO_SLASH.source)); var URL_NO_SLASH = new RegExp("^".concat(URL_INLINE_NO_SLASH.source, "$")); - var URL = new RegExp("^".concat(URL_INLINE.source, "$")); + var URL_ = new RegExp("^".concat(URL_INLINE.source, "$")); // 为啥要覆盖 global URL 啊??? function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } @@ -30318,7 +30318,7 @@ } // 可识别任意协议的URL,或不以斜杠开头的URL - if (URL.test(address) || URL_NO_SLASH.test(address)) { + if (URL_.test(address) || URL_NO_SLASH.test(address)) { return _this2.renderLink(address); } // 其他非法 @@ -30328,7 +30328,7 @@ default: // 协议头不为空时的非法URL - if (!URL.test(address)) { + if (!URL_.test(address)) { return match; } // TODO: Url Validator @@ -50030,13 +50030,23 @@ document.body.removeChild(aLink); }; + var mdDownload = function mdDownload(blob) { + var aLink = document.createElement('a'); + aLink.style.display = 'none'; + aLink.href = URL.createObjectURL(blob); + aLink.download = 'cherry.md'; + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); + }; + var Export = /*#__PURE__*/function (_MenuBase) { _inherits(Export, _MenuBase); var _super = _createSuper$U(Export); function Export(editor) { - var _context2, _context3; + var _context2, _context3, _context4; var _this; @@ -50055,7 +50065,11 @@ noIcon: true, name: '导出长图', onclick: bind$2(_context3 = _this.bindSubClick).call(_context3, _assertThisInitialized(_this), 'screenShot') - }]; + }, { + noIcon: true, + name: '导出Markdown', + onclick: bind$2(_context4 = _this.bindSubClick).call(_context4, _assertThisInitialized(_this), 'markdown') + }]; return _this; } @@ -50066,7 +50080,9 @@ /** @type {HTMLElement}*/ document.querySelector('.cherry-dropdown[name=export]').style.display = 'none'; - if (type === 'pdf') this.exportPDF();else if (type === 'screenShot') this.exportScreenShot(); + if (type === 'pdf') this.exportPDF(); + else if (type === 'screenShot') this.exportScreenShot(); + else if (type === 'markdown') this.exportMarkdownFile(); } }, { key: "exportPDF", @@ -50105,6 +50121,14 @@ document.body.style.overflow = ''; }); } + }, { + key: "exportMarkdownFile", + value: function exportMarkdownFile() { + let plainText = document.getElementById("code").innerText + console.log(plainText) + let blob = new Blob([plainText], {type: "text/markdown;charset=utf-8"}); + mdDownload(blob); + } }]); return Export; From 4c7a5ed23edcd2ee81b0a251d02c65da65d51e8e Mon Sep 17 00:00:00 2001 From: Kryptonite <1535820963@qq.com> Date: Sat, 25 Feb 2023 23:23:34 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=BC=E5=87=BAmarkdown=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=88src/=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/index.html | 2 +- src/Previewer.js | 6 ++++-- src/locales/en_US.js | 1 + src/locales/zh_CN.js | 1 + src/toolbars/hooks/Export.js | 1 + src/utils/export.js | 15 +++++++++++++++ 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/client/index.html b/client/index.html index 43a500fc..8ab76730 100644 --- a/client/index.html +++ b/client/index.html @@ -36,7 +36,7 @@
- + diff --git a/src/Previewer.js b/src/Previewer.js index 8761086c..05993e04 100644 --- a/src/Previewer.js +++ b/src/Previewer.js @@ -22,7 +22,7 @@ import Logger from './Logger'; import Event from './Event'; // import locale from './utils/locale'; import { addEvent, removeEvent } from './utils/event'; -import { exportPDF, exportScreenShot } from './utils/export'; +import { exportPDF, exportScreenShot, exportMarkdownFile } from './utils/export'; import PreviewerBubble from './toolbars/PreviewerBubble'; import LazyLoadImg from '@/utils/lazyLoadImg'; @@ -872,8 +872,10 @@ export default class Previewer { export(type = 'pdf') { if (type === 'pdf') { exportPDF(this.getDomContainer()); - } else { + } else if (type === 'screenShot') { exportScreenShot(this.getDomContainer()); + } else if (type === 'markdown') { + exportMarkdownFile(this.getValue()); } } } diff --git a/src/locales/en_US.js b/src/locales/en_US.js index 6e57c320..505a22c4 100644 --- a/src/locales/en_US.js +++ b/src/locales/en_US.js @@ -78,4 +78,5 @@ export default { hide: 'Hide (ctrl+0)', exportToPdf: 'Export to PDF', exportScreenshot: 'Screenshot', + exportMarkdownFile: 'Export Markdown File', }; diff --git a/src/locales/zh_CN.js b/src/locales/zh_CN.js index e8bd016f..23e8da46 100644 --- a/src/locales/zh_CN.js +++ b/src/locales/zh_CN.js @@ -79,6 +79,7 @@ export default { hide: '隐藏(ctrl+0)', // 隐藏(ctrl+0) exportToPdf: '导出PDF', // 导出PDF exportScreenshot: '导出长图', // 导出长图 + exportMarkdownFile: '导出markdown文件', // 导出markdown文件 theme: '主题', // 导出长图 panel: '面板', // 导出长图 }; diff --git a/src/toolbars/hooks/Export.js b/src/toolbars/hooks/Export.js index fef38221..16464865 100644 --- a/src/toolbars/hooks/Export.js +++ b/src/toolbars/hooks/Export.js @@ -24,6 +24,7 @@ export default class Export extends MenuBase { this.subMenuConfig = [ { noIcon: true, name: 'exportToPdf', onclick: this.bindSubClick.bind(this, 'pdf') }, { noIcon: true, name: 'exportScreenshot', onclick: this.bindSubClick.bind(this, 'screenShot') }, + { noIcon: true, name: 'exportMarkdownFile', onclick: this.bindSubClick.bind(this, 'markdown') }, ]; } diff --git a/src/utils/export.js b/src/utils/export.js index d44fbff0..da57e6f4 100644 --- a/src/utils/export.js +++ b/src/utils/export.js @@ -105,3 +105,18 @@ export function exportScreenShot(previeweDom) { }); }); } + +/** + * 导出markdown文件 + * @param {String} markdownText markdown文本 + */ +export function exportMarkdownFile(markdownText) { + const blob = new Blob([markdownText], { type: 'text/markdown;charset=utf-8' }); + const aLink = document.createElement('a'); + aLink.style.display = 'none'; + aLink.href = URL.createObjectURL(blob); + aLink.download = 'cherry.md'; + document.body.appendChild(aLink); + aLink.click(); + document.body.removeChild(aLink); +} From bb396810292a073fbfa16ae3d6ade01d044d2194 Mon Sep 17 00:00:00 2001 From: Kryptonite <1535820963@qq.com> Date: Sun, 26 Feb 2023 10:18:22 +0800 Subject: [PATCH 4/6] fix: const mainWindow --- client/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/main.js b/client/main.js index c519f29d..5419460c 100644 --- a/client/main.js +++ b/client/main.js @@ -12,7 +12,7 @@ function createWindow() { } app.whenReady().then(() => { - mainWindow = createWindow() + const mainWindow = createWindow() app.on('activate', function () { if (BrowserWindow.getAllWindows().length === 0) createWindow() }) @@ -28,8 +28,7 @@ app.whenReady().then(() => { if (idx.response == 1) { e.preventDefault(); } else { - mainWindow = null - app.exit(); + mainWindow.destroy(); } }) }) From edeb1f89a6ccdd15cbb7e515c20411c3fb411b6a Mon Sep 17 00:00:00 2001 From: Kryptonite <1535820963@qq.com> Date: Sun, 26 Feb 2023 11:22:52 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E4=BA=86=E5=AF=BC?= =?UTF-8?q?=E5=87=BAmarkdown=E5=8D=B4=E5=AF=BC=E5=87=BAhtml=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=90=8C=E6=97=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E5=AF=BC=E5=87=BAhtml=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/scripts/cherry-markdown.js | 36 +- dist/cherry-markdown.css | 172 +- dist/cherry-markdown.js | 18507 ++++++++++++++++------------ dist/cherry-markdown.js.map | 2 +- src/Previewer.js | 6 +- src/locales/en_US.js | 1 + src/locales/zh_CN.js | 3 +- src/toolbars/hooks/Export.js | 1 + src/utils/export.js | 17 +- 9 files changed, 10527 insertions(+), 8218 deletions(-) diff --git a/client/scripts/cherry-markdown.js b/client/scripts/cherry-markdown.js index 923ebe43..fd2b05fd 100644 --- a/client/scripts/cherry-markdown.js +++ b/client/scripts/cherry-markdown.js @@ -27786,7 +27786,7 @@ // '(?:(?:(?:https?|ftp):)?\\/\\/)' + "(?:\\/\\/)".concat(URL_INLINE_NO_SLASH.source)); var URL_NO_SLASH = new RegExp("^".concat(URL_INLINE_NO_SLASH.source, "$")); - var URL_ = new RegExp("^".concat(URL_INLINE.source, "$")); // 为啥要覆盖 global URL 啊??? + var URL = new RegExp("^".concat(URL_INLINE.source, "$")); function _createSuper$9(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$9(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } @@ -30318,7 +30318,7 @@ } // 可识别任意协议的URL,或不以斜杠开头的URL - if (URL_.test(address) || URL_NO_SLASH.test(address)) { + if (URL.test(address) || URL_NO_SLASH.test(address)) { return _this2.renderLink(address); } // 其他非法 @@ -30328,7 +30328,7 @@ default: // 协议头不为空时的非法URL - if (!URL_.test(address)) { + if (!URL.test(address)) { return match; } // TODO: Url Validator @@ -50030,23 +50030,13 @@ document.body.removeChild(aLink); }; - var mdDownload = function mdDownload(blob) { - var aLink = document.createElement('a'); - aLink.style.display = 'none'; - aLink.href = URL.createObjectURL(blob); - aLink.download = 'cherry.md'; - document.body.appendChild(aLink); - aLink.click(); - document.body.removeChild(aLink); - }; - var Export = /*#__PURE__*/function (_MenuBase) { _inherits(Export, _MenuBase); var _super = _createSuper$U(Export); function Export(editor) { - var _context2, _context3, _context4; + var _context2, _context3; var _this; @@ -50065,11 +50055,7 @@ noIcon: true, name: '导出长图', onclick: bind$2(_context3 = _this.bindSubClick).call(_context3, _assertThisInitialized(_this), 'screenShot') - }, { - noIcon: true, - name: '导出Markdown', - onclick: bind$2(_context4 = _this.bindSubClick).call(_context4, _assertThisInitialized(_this), 'markdown') - }]; + }]; return _this; } @@ -50080,9 +50066,7 @@ /** @type {HTMLElement}*/ document.querySelector('.cherry-dropdown[name=export]').style.display = 'none'; - if (type === 'pdf') this.exportPDF(); - else if (type === 'screenShot') this.exportScreenShot(); - else if (type === 'markdown') this.exportMarkdownFile(); + if (type === 'pdf') this.exportPDF();else if (type === 'screenShot') this.exportScreenShot(); } }, { key: "exportPDF", @@ -50121,14 +50105,6 @@ document.body.style.overflow = ''; }); } - }, { - key: "exportMarkdownFile", - value: function exportMarkdownFile() { - let plainText = document.getElementById("code").innerText - console.log(plainText) - let blob = new Blob([plainText], {type: "text/markdown;charset=utf-8"}); - mdDownload(blob); - } }]); return Export; diff --git a/dist/cherry-markdown.css b/dist/cherry-markdown.css index 2ef438cd..27c889ac 100644 --- a/dist/cherry-markdown.css +++ b/dist/cherry-markdown.css @@ -34,6 +34,18 @@ -moz-osx-font-smoothing: grayscale; } +.ch-icon-danger:before { + content: "\ea68"; +} + +.ch-icon-info:before { + content: "\ea69"; +} + +.ch-icon-primary:before { + content: "\ea6a"; +} + .ch-icon-list:before { content: "\ea03"; } @@ -290,6 +302,66 @@ content: "\ea59"; } +.ch-icon-create:before { + content: "\ea5a"; +} + +.ch-icon-download:before { + content: "\ea5b"; +} + +.ch-icon-edit:before { + content: "\ea5c"; +} + +.ch-icon-export:before { + content: "\ea5d"; +} + +.ch-icon-folder-open:before { + content: "\ea5e"; +} + +.ch-icon-folder:before { + content: "\ea5f"; +} + +.ch-icon-help:before { + content: "\ea60"; +} + +.ch-icon-pen-fill:before { + content: "\ea61"; +} + +.ch-icon-pen:before { + content: "\ea62"; +} + +.ch-icon-search:before { + content: "\ea63"; +} + +.ch-icon-tips:before { + content: "\ea64"; +} + +.ch-icon-warn:before { + content: "\ea65"; +} + +.ch-icon-mistake:before { + content: "\ea66"; +} + +.ch-icon-success:before { + content: "\ea67"; +} + +.ch-icon-warning:before { + content: "\ea6b"; +} + .cherry-markdown { word-break: break-all; /* Specify class=linenums on a pre to get line numbering */ @@ -440,8 +512,22 @@ .cherry-markdown table th { background-color: #eee; } +.cherry-markdown .link-quote { + color: #3582fb; +} .cherry-markdown a { color: #3582fb; + position: relative; + text-decoration: none; +} +.cherry-markdown a[target=_blank] { + padding: 0 2px; +} +.cherry-markdown a[target=_blank]::after { + content: "\ea10"; + font-size: 12px; + font-family: "ch-icon"; + margin: 0 2px; } .cherry-markdown a:hover { color: #056bad; @@ -687,7 +773,12 @@ .cherry-markdown.head-num { counter-reset: level1; } -.cherry-markdown.head-num h1 .anchor:before, .cherry-markdown.head-num h2 .anchor:before, .cherry-markdown.head-num h3 .anchor:before, .cherry-markdown.head-num h4 .anchor:before, .cherry-markdown.head-num h5 .anchor:before, .cherry-markdown.head-num h6 .anchor:before { +.cherry-markdown.head-num h1 .anchor:before, +.cherry-markdown.head-num h2 .anchor:before, +.cherry-markdown.head-num h3 .anchor:before, +.cherry-markdown.head-num h4 .anchor:before, +.cherry-markdown.head-num h5 .anchor:before, +.cherry-markdown.head-num h6 .anchor:before { width: auto; font-size: inherit; vertical-align: inherit; @@ -1809,6 +1900,81 @@ div[data-type=codeBlock] .token.inserted { cursor: help; } +.cherry-panel { + margin: 10px 0; + overflow: hidden; + border-radius: 8px; + box-sizing: border-box; + border: 0.5px solid; +} +.cherry-panel .cherry-panel--title { + color: #fff; + padding: 5px 20px; +} +.cherry-panel .cherry-panel--title.cherry-panel--title__not-empty::before { + font-family: "ch-icon"; + margin: 0 12px 0 -6px; + vertical-align: bottom; +} +.cherry-panel .cherry-panel--body { + padding: 5px 20px; +} + +.cherry-panel__primary { + background-color: #cfe2ff; + color: #0a58ca; +} +.cherry-panel__primary .cherry-panel--title { + background-color: #0d6dfe; +} +.cherry-panel__primary .cherry-panel--title.cherry-panel--title__not-empty::before { + content: "\ea6a"; +} + +.cherry-panel__info { + background-color: #cff4fc; + color: #087990; +} +.cherry-panel__info .cherry-panel--title { + background-color: #099cba; +} +.cherry-panel__info .cherry-panel--title.cherry-panel--title__not-empty::before { + content: "\ea69"; +} + +.cherry-panel__warning { + background-color: #fff3cd; + color: #997404; +} +.cherry-panel__warning .cherry-panel--title { + background-color: #b38806; +} +.cherry-panel__warning .cherry-panel--title.cherry-panel--title__not-empty::before { + content: "\ea6b"; +} + +.cherry-panel__danger { + background-color: #f8d7da; + color: #b02a37; +} +.cherry-panel__danger .cherry-panel--title { + background-color: #dc3545; +} +.cherry-panel__danger .cherry-panel--title.cherry-panel--title__not-empty::before { + content: "\ea68"; +} + +.cherry-panel__success { + background-color: #d1e7dd; + color: #146c43; +} +.cherry-panel__success .cherry-panel--title { + background-color: #198754; +} +.cherry-panel__success .cherry-panel--title.cherry-panel--title__not-empty::before { + content: "\ea67"; +} + .cherry .doing-resize-img { -moz-user-select: none; -webkit-user-select: none; @@ -1962,7 +2128,7 @@ div[data-type=codeBlock] .token.inserted { } .cherry .cherry-insert-table-menu { display: block; - position: absolute; + position: fixed; top: 40px; left: 40px; border-collapse: separate; @@ -2418,7 +2584,7 @@ div[data-type=codeBlock] .token.inserted { } .cherry-previewer { - padding: 20px 34px; + padding: 20px 45px 20px 20px; border-left: 2px solid #ebedee; width: 50%; box-sizing: border-box; diff --git a/dist/cherry-markdown.js b/dist/cherry-markdown.js index d0be8c8e..e00e71ef 100644 --- a/dist/cherry-markdown.js +++ b/dist/cherry-markdown.js @@ -1,3 +1,5 @@ + +(function(l, r) { if (l.getElementById('livereloadscript')) return; r = l.createElement('script'); r.async = 1; r.src = '//' + (window.location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1'; r.id = 'livereloadscript'; l.getElementsByTagName('head')[0].appendChild(r) })(window.document); (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -20267,7 +20269,7 @@ * @returns {string} str */ pParser: function pParser(obj, str) { - var $str = str.replace(/\t/g, ''); + var $str = str; if (/\n$/.test($str)) { return $str; @@ -20283,7 +20285,7 @@ * @returns {string} str */ divParser: function divParser(obj, str) { - var $str = str.replace(/\t/g, ''); + var $str = str; if (/\n$/.test($str)) { return $str; @@ -20800,11 +20802,11 @@ convertU: function convertU(str) { return /^\s*$/.test(str) ? '' : " /".concat(str, "/ "); }, - convertImg: function convertImg(str, attr) { + convertImg: function convertImg(alt, src) { var _context13; - var $str = str && str.length > 0 ? $str : 'image'; - return concat$5(_context13 = "![".concat($str, "](")).call(_context13, attr, ")"); + var $alt = alt && alt.length > 0 ? alt : 'image'; + return concat$5(_context13 = "![".concat($alt, "](")).call(_context13, src, ")"); }, convertGraph: function convertGraph(str, attr, data, obj) { var _context16, _context17, _context18; @@ -22818,1915 +22820,1964 @@ return preLineCount + contentLines; } - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } - var cacheCounter = 0; // ~~C${cacheCounter}I${cacheIndex}$ - // let cacheMap = {}; - - var ParagraphBase = /*#__PURE__*/function (_SyntaxBase) { - _inherits(ParagraphBase, _SyntaxBase); - - var _super = _createSuper(ParagraphBase); - - // 不需要排他的sign前缀,如~~C0I${IN_PARAGRAPH_CACHE_KEY_PREFIX}sign$ - function ParagraphBase() { - var _this; - - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - needCache: false - }, - needCache = _ref.needCache, - _ref$defaultCache = _ref.defaultCache, - defaultCache = _ref$defaultCache === void 0 ? {} : _ref$defaultCache; - - _classCallCheck(this, ParagraphBase); - - _this = _super.call(this, {}); - _this.needCache = !!needCache; - _this.sign = ''; + var isArray$8 = isArray$3; - if (needCache) { - _this.cache = defaultCache || {}; - _this.cacheKey = "~~C".concat(cacheCounter); - cacheCounter += 1; - } + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ - return _this; + /** + * 用于lodash.mergeWith的customizer + * @param {any} objValue + * @param {any} srcValue + * @returns + */ + function customizer(objValue, srcValue) { + if (isArray$8(srcValue)) { + return srcValue; } + } + /** + * 检查本地有没有值 + * @param {string} key + */ - _createClass(ParagraphBase, [{ - key: "toHtml", - value: function toHtml(str, sentenceMakeFunc) { - return str; - } - }, { - key: "makeHtml", - value: function makeHtml(str, sentenceMakeFunc) { - return sentenceMakeFunc(str).html; - } - }, { - key: "afterMakeHtml", - value: function afterMakeHtml(html) { - return this.restoreCache(html); - } - }, { - key: "isContainsCache", - value: function isContainsCache(str, fullMatch) { - if (fullMatch) { - // 如果是全匹配:不能包含CherryINPRAGRAPH - var containsParagraphCache = /^(\s*~~C\d+I\w+\$\s*)+$/g.test(str); - var containsInParagraphCache = new RegExp("~~C\\d+I".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, "\\w+\\$"), 'g').test(str); - return containsParagraphCache && !containsInParagraphCache; - } // 如果是局部匹配: 不能只包含CherryINPRAGRAPH - // const containsParagraphCache = /~~C\d+I\w+\$/g.test(str); - // const containsInParagraphCache = new RegExp( - // `~~C\\d+I${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX}\\w+\\$`, 'g').test(str); - - - var containsNonInParagraphCache = new RegExp("~~C\\d+I(?!".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")\\w+\\$"), 'g').test(str); - return containsNonInParagraphCache; // return fullMatch ? - // /^(\s*~~C\d+I\w+\$\s*)+$/g.test(str) && !/^(\s*~~C\d+ICherryINPRAGRAPH\w+\$\s*)+$/g.test(str) : - // /~~C\d+I\w+\$/g.test(str) && !(/~~C\d+ICherryINPRAGRAPH\w+\$/g.test(str) - // && !/~~C\d+I(?!CherryINPRAGRAPH)\w+\$/g.test(str)); - } - /** - * - * @param {string} html - * @return - */ - - }, { - key: "$splitHtmlByCache", - value: function $splitHtmlByCache(html) { - // ~~C0I(?!prefix)sign$ - var regex = new RegExp("\\n*~~C\\d+I(?!".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")\\w+\\$\\n?"), 'g'); - return { - caches: html.match(regex), - contents: html.split(regex) - }; - } - }, { - key: "makeExcludingCached", - value: function makeExcludingCached(content, processor) { - var _this$$splitHtmlByCac = this.$splitHtmlByCache(content), - caches = _this$$splitHtmlByCac.caches, - contents = _this$$splitHtmlByCac.contents; - - var paragraphs = map$3(contents).call(contents, processor); - - var ret = ''; - - for (var i = 0; i < paragraphs.length; i++) { - ret += paragraphs[i]; - - if (caches && caches[i]) { - var _context; - - ret += trim$3(_context = caches[i]).call(_context); - } - } - - return ret; - } - /** - * 获取非捕获匹配丢掉的换行,适用于能被【嵌套】的段落语法 - * - * @param {string} cache 需要返回的cache - * @param {string} md 原始的md字符串 - * @param {boolean} alwaysAlone 是否能被【嵌套】,true:不能被嵌套,如标题、注释等;false:能被嵌套,如代码块、有序列表等 - * @return {string} str - */ - - }, { - key: "getCacheWithSpace", - value: function getCacheWithSpace(cache, md) { - var _md$match$, _md$match, _md$match$2, _md$match2, _context2, _context3; - - var alwaysAlone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var preSpace = (_md$match$ = (_md$match = md.match(/^\n+/)) === null || _md$match === void 0 ? void 0 : _md$match[0]) !== null && _md$match$ !== void 0 ? _md$match$ : ''; - var afterSpace = (_md$match$2 = (_md$match2 = md.match(/\n+$/)) === null || _md$match2 === void 0 ? void 0 : _md$match2[0]) !== null && _md$match$2 !== void 0 ? _md$match$2 : ''; - - if (alwaysAlone) { - return prependLineFeedForParagraph(md, cache); - } - - return concat$5(_context2 = concat$5(_context3 = "".concat(preSpace)).call(_context3, cache)).call(_context2, afterSpace); - } - /** - * 获取行号,只负责向上计算\n - * 会计算cache的行号 - * - * @param {string} md md内容 - * @param {string} preSpace 前置换行 - * @return {number} 行数 - */ - - }, { - key: "getLineCount", - value: function getLineCount(md) { - var _preSpace$match$0$len, _preSpace$match, _preSpace$match$; - - var preSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var content = md; - /** - * 前置换行个数,【注意】:前置换行个数不包括上文的最后一个\n - * 例: - * - aa\n - * - bb\n - * \n - * cc\n - * - * cc的前置换行个数为 1,bb后的\n不计算在内 - * cc的正则为:/(?:^|\n)(\n*)xxxxxx/ - */ - - var preLineCount = (_preSpace$match$0$len = (_preSpace$match = preSpace.match(/^\n+/g)) === null || _preSpace$match === void 0 ? void 0 : (_preSpace$match$ = _preSpace$match[0]) === null || _preSpace$match$ === void 0 ? void 0 : _preSpace$match$.length) !== null && _preSpace$match$0$len !== void 0 ? _preSpace$match$0$len : 0; - preLineCount = preLineCount === 1 ? 1 : 0; // 前置换行超过2个就交给BR进行渲染 - - content = content.replace(/^\n+/g, ''); - var regex = new RegExp("\n*~~C\\d+I(?:".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")?\\w+?_L(\\d+)\\$"), 'g'); - var cacheLineCount = 0; - content = content.replace(regex, function (match, lineCount) { - cacheLineCount += _parseInt$2(lineCount, 10); - return match.replace(/^\n+/g, ''); - }); - return preLineCount + cacheLineCount + (content.match(/\n/g) || []).length + 1; // 实际内容所占行数,至少为1行 - } - /** - * - * @param {string} str 渲染后的内容 - * @param {string} sign 签名 - * @param {number} lineCount md原文的行数 - * @return {string} cacheKey ~~C0I0_L1$ - */ - - }, { - key: "pushCache", - value: function pushCache(str) { - var _context4, _context5; - - var sign = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var lineCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - - if (!this.needCache) { - return; - } - - var $sign = sign || this.$engine.md5(str); - this.cache[$sign] = { - content: str, - using: true - }; - return concat$5(_context4 = concat$5(_context5 = "".concat(this.cacheKey, "I")).call(_context5, $sign, "_L")).call(_context4, lineCount, "$"); - } - }, { - key: "popCache", - value: function popCache(sign) { - if (!this.needCache) { - return; - } - - return this.cache[sign].content || ''; - } - }, { - key: "resetCache", - value: function resetCache() { - if (!this.needCache) { - return; - } - - for (var _i = 0, _Object$keys = keys$3(this.cache); _i < _Object$keys.length; _i++) { - var key = _Object$keys[_i]; - if (!this.cache[key].using) delete this.cache[key]; - } - - for (var _i2 = 0, _Object$keys3 = keys$3(this.cache); _i2 < _Object$keys3.length; _i2++) { - var _key = _Object$keys3[_i2]; - this.cache[_key].using = false; - } - } - }, { - key: "restoreCache", - value: function restoreCache(html) { - var _context6, - _this2 = this; + function testKeyInLocal(key) { + if (typeof localStorage !== 'undefined') { + return localStorage.getItem("cherry-".concat(key)) !== null; + } - // restore cached content - if (!this.needCache) { - return html; - } + return false; + } + /** + * 保存是否经典换行 + * @param {boolean} isClassicBr + */ - var regex = new RegExp(concat$5(_context6 = "".concat(this.cacheKey, "I((?:")).call(_context6, ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")?\\w+)\\$"), 'g'); - var $html = html.replace(regex, function (match, cacheSign) { - return _this2.popCache(cacheSign.replace(/_L\d+$/, '')); - }); - this.resetCache(); - return $html; - } - /** - * - * @param {string} wholeMatch whole match - */ + function saveIsClassicBrToLocal(isClassicBr) { + if (typeof localStorage !== 'undefined') { + localStorage.setItem('cherry-classicBr', isClassicBr ? 'true' : 'false'); + } + } + /** + * 是否经典换行 + */ - }, { - key: "checkCache", - value: function checkCache(wholeMatch, sentenceMakeFunc) { - var _context7, _context8; + function getIsClassicBrFromLocal() { + var ret = 'false'; - var lineCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - this.sign = this.$engine.md5(wholeMatch); // miss cache + if (typeof localStorage !== 'undefined') { + ret = localStorage.getItem('cherry-classicBr'); + } - if (!this.cache[this.sign]) { - return this.toHtml(wholeMatch, sentenceMakeFunc); - } // hit & mark cache + return ret === 'true'; + } + /** + * 保存当前主题 + * @param {string} theme + */ + function saveThemeToLocal(theme) { + if (typeof localStorage !== 'undefined') { + localStorage.setItem('cherry-theme', theme); + } + } + /** + * 获取当前主题 + * @returns {string} 主题名 + */ - this.cache[this.sign].using = true; - return concat$5(_context7 = concat$5(_context8 = "".concat(this.cacheKey, "I")).call(_context8, this.sign, "_L")).call(_context7, lineCount, "$"); - } - }, { - key: "mounted", - value: function mounted() {// console.log('base mounted'); - } - }, { - key: "signWithCache", - value: function signWithCache(html) { - return false; - } - }]); - return ParagraphBase; - }(SyntaxBase); + function getThemeFromLocal() { + var fullClass = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var ret = 'default'; - _defineProperty(ParagraphBase, "HOOK_TYPE", HOOKS_TYPE_LIST.PAR); + if (typeof localStorage !== 'undefined') { + ret = localStorage.getItem('cherry-theme'); + } - _defineProperty(ParagraphBase, "IN_PARAGRAPH_CACHE_KEY_PREFIX", '!'); + return fullClass ? "theme__".concat(ret) : ret; + } + /** + * 修改主题 + * @param {object} $cherry + * @param {string} theme 如果没有传theme,则从本地缓存里取 + */ - _defineProperty(ParagraphBase, "IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX", '\\!'); + function changeTheme($cherry) { + var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var newTheme = (theme ? theme : getThemeFromLocal()).replace(/^.*theme__/, ''); + var newClass = " theme__".concat(newTheme); + $cherry.wrapperDom.className = $cherry.wrapperDom.className.replace(/ theme__[^ $]+?( |$)/g, '') + newClass; + $cherry.previewer.getDomContainer().className = $cherry.previewer.getDomContainer().className.replace(/ theme__[^ $]+?( |$)/g, '') + newClass; + saveThemeToLocal(newTheme); + } - // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it + var RangeError$1 = global_1.RangeError; + var fromCharCode = String.fromCharCode; + // eslint-disable-next-line es-x/no-string-fromcodepoint -- required for testing + var $fromCodePoint = String.fromCodePoint; + var join$1 = functionUncurryThis([].join); + // length should be 1, old FF problem + var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1; - var arrayBufferNonExtensible = fails(function () { - if (typeof ArrayBuffer == 'function') { - var buffer = new ArrayBuffer(8); - // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe - if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); + // `String.fromCodePoint` method + // https://tc39.es/ecma262/#sec-string.fromcodepoint + _export({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + fromCodePoint: function fromCodePoint(x) { + var elements = []; + var length = arguments.length; + var i = 0; + var code; + while (length > i) { + code = +arguments[i++]; + if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError$1(code + ' is not a valid code point'); + elements[i] = code < 0x10000 + ? fromCharCode(code) + : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); + } return join$1(elements, ''); } }); - // eslint-disable-next-line es-x/no-object-isextensible -- safe - var $isExtensible = Object.isExtensible; - var FAILS_ON_PRIMITIVES$3 = fails(function () { $isExtensible(1); }); - - // `Object.isExtensible` method - // https://tc39.es/ecma262/#sec-object.isextensible - var objectIsExtensible = (FAILS_ON_PRIMITIVES$3 || arrayBufferNonExtensible) ? function isExtensible(it) { - if (!isObject(it)) return false; - if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') return false; - return $isExtensible ? $isExtensible(it) : true; - } : $isExtensible; - - var freezing = !fails(function () { - // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing - return Object.isExtensible(Object.preventExtensions({})); - }); - - var internalMetadata = createCommonjsModule(function (module) { - var defineProperty = objectDefineProperty.f; - - - - + var fromCodePoint = path.String.fromCodePoint; + var fromCodePoint$1 = fromCodePoint; - var REQUIRED = false; - var METADATA = uid('meta'); - var id = 0; + var fromCodePoint$2 = fromCodePoint$1; - var setMetadata = function (it) { - defineProperty(it, METADATA, { value: { - objectID: 'O' + id++, // object ID - weakData: {} // weak collections IDs - } }); - }; + var _context, _context2; - var fastKey = function (it, create) { - // return a primitive with prefix - if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!hasOwnProperty_1(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!objectIsExtensible(it)) return 'F'; - // not necessary to add metadata - if (!create) return 'E'; - // add missing metadata - setMetadata(it); - // return object ID - } return it[METADATA].objectID; - }; + function ownKeys$1(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } - var getWeakData = function (it, create) { - if (!hasOwnProperty_1(it, METADATA)) { - // can't set metadata to uncaught frozen object - if (!objectIsExtensible(it)) return true; - // not necessary to add metadata - if (!create) return false; - // add missing metadata - setMetadata(it); - // return the store of weak collections IDs - } return it[METADATA].weakData; - }; + function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context3 = ownKeys$1(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context4 = ownKeys$1(Object(source))).call(_context4, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; } - // add metadata on freeze-family methods calling - var onFreeze = function (it) { - if (freezing && REQUIRED && objectIsExtensible(it) && !hasOwnProperty_1(it, METADATA)) setMetadata(it); - return it; + /** + * Copyright (C) 2021 THL A29 Limited, a Tencent company. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + var escapeMap = { + '<': '<', + '>': '>', + '&': '&', + '"': '"', + "'": ''' }; + var unescapeMap = { + lt: '<', + gt: '>', + amp: '&', + quot: '"', + apos: "'" + }; // refs: https://www.freeformatter.com/html-entities.html - var enable = function () { - meta.enable = function () { /* empty */ }; - REQUIRED = true; - var getOwnPropertyNames = objectGetOwnPropertyNames.f; - var splice = functionUncurryThis([].splice); - var test = {}; - test[METADATA] = 1; - - // prevent exposing of metadata key - if (getOwnPropertyNames(test).length) { - objectGetOwnPropertyNames.f = function (it) { - var result = getOwnPropertyNames(it); - for (var i = 0, length = result.length; i < length; i++) { - if (result[i] === METADATA) { - splice(result, i, 1); - break; - } - } return result; - }; - - _export({ target: 'Object', stat: true, forced: true }, { - getOwnPropertyNames: objectGetOwnPropertyNamesExternal.f - }); - } + var ASCIICharacters = { + 34: '"', + 38: '&', + 39: ''', + 60: '<', + 62: '>' }; - - var meta = module.exports = { - enable: enable, - fastKey: fastKey, - getWeakData: getWeakData, - onFreeze: onFreeze + var ISO88591Characters = { + 192: 'À', + 193: 'Á', + 194: 'Â', + 195: 'Ã', + 196: 'Ä', + 197: 'Å', + 198: 'Æ', + 199: 'Ç', + 200: 'È', + 201: 'É', + 202: 'Ê', + 203: 'Ë', + 204: 'Ì', + 205: 'Í', + 206: 'Î', + 207: 'Ï', + 208: 'Ð', + 209: 'Ñ', + 210: 'Ò', + 211: 'Ó', + 212: 'Ô', + 213: 'Õ', + 214: 'Ö', + 216: 'Ø', + 217: 'Ù', + 218: 'Ú', + 219: 'Û', + 220: 'Ü', + 221: 'Ý', + 222: 'Þ', + 223: 'ß', + 224: 'à', + 225: 'á', + 226: 'â', + 227: 'ã', + 228: 'ä', + 229: 'å', + 230: 'æ', + 231: 'ç', + 232: 'è', + 233: 'é', + 234: 'ê', + 235: 'ë', + 236: 'ì', + 237: 'í', + 238: 'î', + 239: 'ï', + 240: 'ð', + 241: 'ñ', + 242: 'ò', + 243: 'ó', + 244: 'ô', + 245: 'õ', + 246: 'ö', + 248: 'ø', + 249: 'ù', + 250: 'ú', + 251: 'û', + 252: 'ü', + 253: 'ý', + 254: 'þ', + 255: 'ÿ' + }; + var ISO88591Symbols = { + 160: ' ', + 161: '¡', + 162: '¢', + 163: '£', + 164: '¤', + 165: '¥', + 166: '¦', + 167: '§', + 168: '¨', + 169: '©', + 170: 'ª', + 171: '«', + 172: '¬', + 173: '­', + 174: '®', + 175: '¯', + 176: '°', + 177: '±', + 178: '²', + 179: '³', + 180: '´', + 181: 'µ', + 182: '¶', + 184: '¸', + 185: '¹', + 186: 'º', + 187: '»', + 188: '¼', + 189: '½', + 190: '¾', + 191: '¿', + 215: '×', + 247: '÷' + }; + var MathSymbols = { + 8704: '∀', + 8706: '∂', + 8707: '∃', + 8709: '∅', + 8711: '∇', + 8712: '∈', + 8713: '∉', + 8715: '∋', + 8719: '∏', + 8721: '∑', + 8722: '−', + 8727: '∗', + 8730: '√', + 8733: '∝', + 8734: '∞', + 8736: '∠', + 8743: '∧', + 8744: '∨', + 8745: '∩', + 8746: '∪', + 8747: '∫', + 8756: '∴', + 8764: '∼', + 8773: '≅', + 8776: '≈', + 8800: '≠', + 8801: '≡', + 8804: '≤', + 8805: '≥', + 8834: '⊂', + 8835: '⊃', + 8836: '⊄', + 8838: '⊆', + 8839: '⊇', + 8853: '⊕', + 8855: '⊗', + 8869: '⊥', + 8901: '⋅' + }; + var GreekLetters = { + 913: 'Α', + 914: 'Β', + 915: 'Γ', + 916: 'Δ', + 917: 'Ε', + 918: 'Ζ', + 919: 'Η', + 920: 'Θ', + 921: 'Ι', + 922: 'Κ', + 923: 'Λ', + 924: 'Μ', + 925: 'Ν', + 926: 'Ξ', + 927: 'Ο', + 928: 'Π', + 929: 'Ρ', + 931: 'Σ', + 932: 'Τ', + 933: 'Υ', + 934: 'Φ', + 935: 'Χ', + 936: 'Ψ', + 937: 'Ω', + 945: 'α', + 946: 'β', + 947: 'γ', + 948: 'δ', + 949: 'ε', + 950: 'ζ', + 951: 'η', + 952: 'θ', + 953: 'ι', + 954: 'κ', + 955: 'λ', + 956: 'μ', + 957: 'ν', + 958: 'ξ', + 959: 'ο', + 960: 'π', + 961: 'ρ', + 962: 'ς', + 963: 'σ', + 964: 'τ', + 965: 'υ', + 966: 'φ', + 967: 'χ', + 968: 'ψ', + 969: 'ω', + 977: 'ϑ', + 978: 'ϒ', + 982: 'ϖ' }; + var MiscellaneousHTMLEntities = { + 338: 'Œ', + 339: 'œ', + 352: 'Š', + 353: 'š', + 376: 'Ÿ', + 402: 'ƒ', + 710: 'ˆ', + 732: '˜', + 8194: ' ', + 8195: ' ', + 8201: ' ', + 8204: '‌', + 8205: '‍', + 8206: '‎', + 8207: '‏', + 8211: '–', + 8212: '—', + 8216: '‘', + 8217: '’', + 8218: '‚', + 8220: '“', + 8221: '”', + 8222: '„', + 8224: '†', + 8225: '‡', + 8226: '•', + 8230: '…', + 8240: '‰', + 8242: '′', + 8243: '″', + 8249: '‹', + 8250: '›', + 8254: '‾', + 8364: '€', + 8482: '™', + 8592: '←', + 8593: '↑', + 8594: '→', + 8595: '↓', + 8596: '↔', + 8629: '↵', + 8968: '⌈', + 8969: '⌉', + 8970: '⌊', + 8971: '⌋', + 9674: '◊', + 9824: '♠', + 9827: '♣', + 9829: '♥', + 9830: '♦' + }; // TODO: 使用whatwg的entities.json - hiddenKeys[METADATA] = true; + var htmlEntitiesMap = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, ASCIICharacters), ISO88591Characters), ISO88591Symbols), MathSymbols), GreekLetters), MiscellaneousHTMLEntities); + + var htmlEntitiesCodePoint = keys$3(htmlEntitiesMap); + + var htmlEntitiesWithoutSemicolon = map$3(htmlEntitiesCodePoint).call(htmlEntitiesCodePoint, function (code) { + return htmlEntitiesMap[code].replace(/^&(\w+);$/g, function (match, name) { + return name.toLowerCase(); + }); }); - var internalMetadata_1 = internalMetadata.enable; - var internalMetadata_2 = internalMetadata.fastKey; - var internalMetadata_3 = internalMetadata.getWeakData; - var internalMetadata_4 = internalMetadata.onFreeze; + /** + * 非字符串类型与长度为0的字符串都认为是空串 + * @param {any} str 需要判断的字符串 + * @returns {boolean} + */ - var TypeError$g = global_1.TypeError; - var Result = function (stopped, result) { - this.stopped = stopped; - this.result = result; + var isEmptyString = function isEmptyString(str) { + return typeof str !== 'string' || str.length <= 0; }; - var ResultPrototype = Result.prototype; - - var iterate = function (iterable, unboundFunction, options) { - var that = options && options.that; - var AS_ENTRIES = !!(options && options.AS_ENTRIES); - var IS_ITERATOR = !!(options && options.IS_ITERATOR); - var INTERRUPTED = !!(options && options.INTERRUPTED); - var fn = functionBindContext(unboundFunction, that); - var iterator, iterFn, index, length, result, next, step; + var isValidStringCodePoint = function isValidStringCodePoint(codePoint) { + try { + var string = fromCodePoint$2(codePoint); - var stop = function (condition) { - if (iterator) iteratorClose(iterator, 'normal', condition); - return new Result(true, condition); - }; + return !isEmptyString(string); // 如果转换的为空串,说明CodePoint不合法 + } catch (e) { + // 转换出错,也是不合法的CodePoint + return false; + } + }; - var callFn = function (value) { - if (AS_ENTRIES) { - anObject(value); - return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); - } return INTERRUPTED ? fn(value, stop) : fn(value); - }; + function escapeHTMLEntitiesWithoutSemicolon(content) { + if (typeof content !== 'string') { + return ''; + } // 先处理字符实体 - if (IS_ITERATOR) { - iterator = iterable; - } else { - iterFn = getIteratorMethod(iterable); - if (!iterFn) throw TypeError$g(tryToString(iterable) + ' is not iterable'); - // optimisation for array iterators - if (isArrayIteratorMethod(iterFn)) { - for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { - result = callFn(iterable[index]); - if (result && objectIsPrototypeOf(ResultPrototype, result)) return result; - } return new Result(false); - } - iterator = getIterator(iterable, iterFn); - } - next = iterator.next; - while (!(step = functionCall(next, iterator)).done) { - try { - result = callFn(step.value); - } catch (error) { - iteratorClose(iterator, 'throw', error); + var namedRegex = /&(\w+);?/g; + var escaped = content.replace(namedRegex, function (match, name) { + // 不在合法列表里的全部转义,无分号的情况也转义 + if (indexOf$8(match).call(match, ';') === -1 || indexOf$8(htmlEntitiesWithoutSemicolon).call(htmlEntitiesWithoutSemicolon, name.toLowerCase()) === -1) { + return match.replace(/&/g, '&'); } - if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result; - } return new Result(false); - }; - - var TypeError$h = global_1.TypeError; - var anInstance = function (it, Prototype) { - if (objectIsPrototypeOf(Prototype, it)) return it; - throw TypeError$h('Incorrect invocation'); - }; + return match; + }); // 处理十进制数字实体,需要防止误匹配16进制 - var defineProperty$d = objectDefineProperty.f; - var forEach$4 = arrayIteration.forEach; + var numericRegex = /&#(?!x)(\d*);?/gi; + escaped = escaped.replace(numericRegex, function (match, decimalCodePoint) { + // 不在合法列表里的全部转义,无分号的情况也转义 + // 且位数不能大于7,否则可能导致溢出: https://spec.commonmark.org/0.29/#decimal-numeric-character + if (isEmptyString(decimalCodePoint) || indexOf$8(match).call(match, ';') === -1 || decimalCodePoint.lenth > 7 || // Object.keys(htmlEntitiesMap).indexOf(+decimalCodePoint) === -1 || + !isValidStringCodePoint(decimalCodePoint)) { + return match.replace(/&/g, '&'); + } + return match; + }); // 处理十六进制数字实体 + var hexRegex = /&#x([0-9a-f]*);?/gi; + escaped = escaped.replace(hexRegex, function (match, hexCodePoint) { + if (isEmptyString(hexCodePoint)) { + return match.replace(/&/g, '&'); + } - var setInternalState$3 = internalState.set; - var internalStateGetterFor = internalState.getterFor; + var hexCode = "0x".concat(hexCodePoint); - var collection = function (CONSTRUCTOR_NAME, wrapper, common) { - var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; - var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; - var ADDER = IS_MAP ? 'set' : 'add'; - var NativeConstructor = global_1[CONSTRUCTOR_NAME]; - var NativePrototype = NativeConstructor && NativeConstructor.prototype; - var exported = {}; - var Constructor; + var decimalCodePoint = _parseInt$2(hexCode, 16); // parseInt非数字、不在合法列表里、无分号的情况全部转义 + // 且位数不能大于6: https://spec.commonmark.org/0.29/#hexadecimal-numeric-character - if (!descriptors || !isCallable(NativeConstructor) - || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) - ) { - // create collection constructor - Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); - internalMetadata.enable(); - } else { - Constructor = wrapper(function (target, iterable) { - setInternalState$3(anInstance(target, Prototype), { - type: CONSTRUCTOR_NAME, - collection: new NativeConstructor() - }); - if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); - }); - var Prototype = Constructor.prototype; + if (isNaN(decimalCodePoint) || indexOf$8(match).call(match, ';') === -1 || hexCodePoint.lenth > 6 || // Object.keys(htmlEntitiesMap).indexOf(decimalCodePoint) === -1 + !isValidStringCodePoint(hexCode)) { + return match.replace(/&/g, '&'); + } - var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); + return match; + }); + return escaped; + } + var blockNames = ['h1|h2|h3|h4|h5|h6', 'ul|ol|li|dd|dl|dt', 'table|thead|tbody|tfoot|col|colgroup|th|td|tr', 'div|article|section|footer|aside|details|summary|code|audio|video|canvas|figure', 'address|center|cite|p|pre|blockquote|marquee|caption|figcaption|track|source|output|svg'].join('|'); + var inlineNames = ['span|a|link|b|s|i|del|u|em|strong|sup|sub|kbd', 'nav|font|bdi|samp|map|area|small|time|bdo|var|wbr|meter|dfn', 'ruby|rt|rp|mark|q|progress|input|textarea|select|ins'].join('|'); + var inlineBlock = 'br|img|hr'; + var whiteList = new RegExp(concat$5(_context = concat$5(_context2 = "^(".concat(blockNames, "|")).call(_context2, inlineNames, "|")).call(_context, inlineBlock, ")( |$|/)"), 'i'); + function escapeHTMLSpecialChar(content, enableQuote) { + if (typeof content !== 'string') { + return ''; + } - forEach$4(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) { - var IS_ADDER = KEY == 'add' || KEY == 'set'; - if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) { - createNonEnumerableProperty(Prototype, KEY, function (a, b) { - var collection = getInternalState(this).collection; - if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; - var result = collection[KEY](a === 0 ? 0 : a, b); - return IS_ADDER ? this : result; - }); - } + if (enableQuote) { + return content.replace(/[<>&]/g, function (_char) { + return escapeMap[_char] || _char; }); + } - IS_WEAK || defineProperty$d(Prototype, 'size', { - configurable: true, - get: function () { - return getInternalState(this).collection.size; - } - }); + return content.replace(/[<>&"']/g, function (_char2) { + return escapeMap[_char2] || _char2; + }); + } + function unescapeHTMLSpecialChar(content) { + if (typeof content !== 'string') { + return ''; } - setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true); + return content.replace(/&(\w+);?/g, function (escaped, name) { + return unescapeMap[name] || escaped; + }); + } + function escapeHTMLSpecialCharOnce(content, enableQuote) { + if (typeof content !== 'string') { + return ''; + } - exported[CONSTRUCTOR_NAME] = Constructor; - _export({ global: true, forced: true }, exported); + var str = convertHTMLNumberToName(content); + str = unescapeHTMLSpecialChar(str); + return escapeHTMLSpecialChar(str, enableQuote); + } + function convertHTMLNumberToName(html) { + var entities = /&#(\d+);?/g; + return html.replace(entities, function (match, codePoint) { + return htmlEntitiesMap[codePoint] || match; + }); + } + function unescapeHTMLNumberEntities(html) { + var entities = /&#(\d+);?/g; + return html.replace(entities, function (match, codePoint) { + try { + var escaped = fromCodePoint$2(codePoint); - if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); + return escaped; + } catch (e) { + return match; + } + }); + } + function unescapeHTMLHexEntities(html) { + var entities = /&#x([0-9a-f]+);?/gi; + return html.replace(entities, function (match, codePoint) { + var hexCode = _parseInt$2("0x".concat(codePoint), 16); - return Constructor; - }; + try { + var escaped = fromCodePoint$2(hexCode); - var defineBuiltIns = function (target, src, options) { - for (var key in src) { - if (options && options.unsafe && target[key]) target[key] = src[key]; - else defineBuiltIn(target, key, src[key], options); - } return target; - }; + return escaped; + } catch (e) { + return match; + } + }); + } + function isValidScheme(url) { + var regex = /^\s*([\w\W]+?)(?=:)/i; + var match = unescapeHTMLHexEntities(unescapeHTMLNumberEntities(url)).match(regex); - var SPECIES$3 = wellKnownSymbol('species'); + if (!match) { + return true; + } - var setSpecies = function (CONSTRUCTOR_NAME) { - var Constructor = getBuiltIn(CONSTRUCTOR_NAME); - var defineProperty = objectDefineProperty.f; + var SCHEME_BLACKLIST = ['javascript', 'data']; + var scheme = match[1].replace(/[\s]/g, ''); // 协议中间可能会出现空白字符绕过检查 - if (descriptors && Constructor && !Constructor[SPECIES$3]) { - defineProperty(Constructor, SPECIES$3, { - configurable: true, - get: function () { return this; } - }); + if (indexOf$8(SCHEME_BLACKLIST).call(SCHEME_BLACKLIST, scheme.toLowerCase()) !== -1) { + return false; } - }; - - var defineProperty$e = objectDefineProperty.f; + return true; + } + /** + * ref: https://stackoverflow.com/questions/9245333/should-encodeuri-ever-be-used + * @param {string} str + */ + function encodeURIOnce(str) { + return encodeURI(str).replace(/[!'()*]/g, function (_char4) { + return "%".concat(_char4.charCodeAt(0).toString(16)); + }).replace(/%25/g, '%'); + } + function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + var cacheCounter = 0; // ~~C${cacheCounter}I${cacheIndex}$ + // let cacheMap = {}; + var ParagraphBase = /*#__PURE__*/function (_SyntaxBase) { + _inherits(ParagraphBase, _SyntaxBase); + var _super = _createSuper(ParagraphBase); + // 不需要排他的sign前缀,如~~C0I${IN_PARAGRAPH_CACHE_KEY_PREFIX}sign$ + function ParagraphBase() { + var _this; - var fastKey = internalMetadata.fastKey; + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + needCache: false + }, + needCache = _ref.needCache, + _ref$defaultCache = _ref.defaultCache, + defaultCache = _ref$defaultCache === void 0 ? {} : _ref$defaultCache; + _classCallCheck(this, ParagraphBase); - var setInternalState$4 = internalState.set; - var internalStateGetterFor$1 = internalState.getterFor; + _this = _super.call(this, {}); + _this.needCache = !!needCache; + _this.sign = ''; - var collectionStrong = { - getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { - var Constructor = wrapper(function (that, iterable) { - anInstance(that, Prototype); - setInternalState$4(that, { - type: CONSTRUCTOR_NAME, - index: objectCreate(null), - first: undefined, - last: undefined, - size: 0 - }); - if (!descriptors) that.size = 0; - if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); - }); + if (needCache) { + _this.cache = defaultCache || {}; + _this.cacheKey = "~~C".concat(cacheCounter); + cacheCounter += 1; + } - var Prototype = Constructor.prototype; + return _this; + } - var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); + _createClass(ParagraphBase, [{ + key: "initBrReg", + value: function initBrReg() { + var classicBr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + // 是否启用经典换行逻辑 + // true:一个换行会被忽略,两个以上连续换行会分割成段落, + // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落 + this.classicBr = testKeyInLocal('classicBr') ? getIsClassicBrFromLocal() : classicBr; + this.removeBrAfterBlock = null; + this.removeBrBeforeBlock = null; + this.removeNewlinesBetweenTags = null; + } + /** + * 处理经典换行问题 + * @param {string} str markdown源码 + * @returns markdown源码 + */ - var define = function (that, key, value) { - var state = getInternalState(that); - var entry = getEntry(that, key); - var previous, index; - // change existing entry - if (entry) { - entry.value = value; - // create new entry - } else { - state.last = entry = { - index: index = fastKey(key, true), - key: key, - value: value, - previous: previous = state.last, - next: undefined, - removed: false - }; - if (!state.first) state.first = entry; - if (previous) previous.next = entry; - if (descriptors) state.size++; - else that.size++; - // add to index - if (index !== 'F') state.index[index] = entry; - } return that; - }; + }, { + key: "$cleanParagraph", + value: function $cleanParagraph(str) { + // remove leading and trailing newlines + var trimedPar = str.replace(/^\n+/, '').replace(/\n+$/, ''); - var getEntry = function (that, key) { - var state = getInternalState(that); - // fast case - var index = fastKey(key); - var entry; - if (index !== 'F') return state.index[index]; - // frozen object case - for (entry = state.first; entry; entry = entry.next) { - if (entry.key == key) return entry; + if (this.classicBr) { + return trimedPar; } - }; - defineBuiltIns(Prototype, { - // `{ Map, Set }.prototype.clear()` methods - // https://tc39.es/ecma262/#sec-map.prototype.clear - // https://tc39.es/ecma262/#sec-set.prototype.clear - clear: function clear() { - var that = this; - var state = getInternalState(that); - var data = state.index; - var entry = state.first; - while (entry) { - entry.removed = true; - if (entry.previous) entry.previous = entry.previous.next = undefined; - delete data[entry.index]; - entry = entry.next; - } - state.first = state.last = undefined; - if (descriptors) state.size = 0; - else that.size = 0; - }, - // `{ Map, Set }.prototype.delete(key)` methods - // https://tc39.es/ecma262/#sec-map.prototype.delete - // https://tc39.es/ecma262/#sec-set.prototype.delete - 'delete': function (key) { - var that = this; - var state = getInternalState(that); - var entry = getEntry(that, key); - if (entry) { - var next = entry.next; - var prev = entry.previous; - delete state.index[entry.index]; - entry.removed = true; - if (prev) prev.next = next; - if (next) next.previous = prev; - if (state.first == entry) state.first = next; - if (state.last == entry) state.last = prev; - if (descriptors) state.size--; - else that.size--; - } return !!entry; - }, - // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods - // https://tc39.es/ecma262/#sec-map.prototype.foreach - // https://tc39.es/ecma262/#sec-set.prototype.foreach - forEach: function forEach(callbackfn /* , that = undefined */) { - var state = getInternalState(this); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - var entry; - while (entry = entry ? entry.next : state.first) { - boundFunction(entry.value, entry.key, this); - // revert to the last existing entry - while (entry && entry.removed) entry = entry.previous; - } - }, - // `{ Map, Set}.prototype.has(key)` methods - // https://tc39.es/ecma262/#sec-map.prototype.has - // https://tc39.es/ecma262/#sec-set.prototype.has - has: function has(key) { - return !!getEntry(this, key); - } - }); + var minifiedPar = this.joinRawHtml(trimedPar); + return minifiedPar.replace(/\n/g, '
').replace(/\r/g, '\n'); // recover \n from \r + } + /** + * remove all newlines in html text + * + * @param {string} textContainsHtml + */ - defineBuiltIns(Prototype, IS_MAP ? { - // `Map.prototype.get(key)` method - // https://tc39.es/ecma262/#sec-map.prototype.get - get: function get(key) { - var entry = getEntry(this, key); - return entry && entry.value; - }, - // `Map.prototype.set(key, value)` method - // https://tc39.es/ecma262/#sec-map.prototype.set - set: function set(key, value) { - return define(this, key === 0 ? 0 : key, value); - } - } : { - // `Set.prototype.add(value)` method - // https://tc39.es/ecma262/#sec-set.prototype.add - add: function add(value) { - return define(this, value = value === 0 ? 0 : value, value); - } - }); - if (descriptors) defineProperty$e(Prototype, 'size', { - get: function () { - return getInternalState(this).size; - } - }); - return Constructor; - }, - setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { - var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; - var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME); - var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME); - // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods - // https://tc39.es/ecma262/#sec-map.prototype.entries - // https://tc39.es/ecma262/#sec-map.prototype.keys - // https://tc39.es/ecma262/#sec-map.prototype.values - // https://tc39.es/ecma262/#sec-map.prototype-@@iterator - // https://tc39.es/ecma262/#sec-set.prototype.entries - // https://tc39.es/ecma262/#sec-set.prototype.keys - // https://tc39.es/ecma262/#sec-set.prototype.values - // https://tc39.es/ecma262/#sec-set.prototype-@@iterator - defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { - setInternalState$4(this, { - type: ITERATOR_NAME, - target: iterated, - state: getInternalCollectionState(iterated), - kind: kind, - last: undefined - }); - }, function () { - var state = getInternalIteratorState(this); - var kind = state.kind; - var entry = state.last; - // revert to the last existing entry - while (entry && entry.removed) entry = entry.previous; - // get next entry - if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { - // or finish the iteration - state.target = undefined; - return { value: undefined, done: true }; - } - // return step by kind - if (kind == 'keys') return { value: entry.key, done: false }; - if (kind == 'values') return { value: entry.value, done: false }; - return { value: [entry.key, entry.value], done: false }; - }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); + }, { + key: "joinRawHtml", + value: function joinRawHtml(textContainsHtml) { + if (!this.removeBrAfterBlock) { + var _this$$engine$htmlWhi, _this$$engine$htmlWhi2, _context, _context2; - // `{ Map, Set }.prototype[@@species]` accessors - // https://tc39.es/ecma262/#sec-get-map-@@species - // https://tc39.es/ecma262/#sec-get-set-@@species - setSpecies(CONSTRUCTOR_NAME); - } - }; + // preprocess custom white list + var customTagWhiteList = (_this$$engine$htmlWhi = (_this$$engine$htmlWhi2 = this.$engine.htmlWhiteListAppend) === null || _this$$engine$htmlWhi2 === void 0 ? void 0 : _this$$engine$htmlWhi2.split('|')) !== null && _this$$engine$htmlWhi !== void 0 ? _this$$engine$htmlWhi : []; + customTagWhiteList = filter$3(_context = map$3(customTagWhiteList).call(customTagWhiteList, function (tag) { + if (/[a-z-]+/gi.test(tag)) { + return tag; + } - // `Map` constructor - // https://tc39.es/ecma262/#sec-map-objects - collection('Map', function (init) { - return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; - }, collectionStrong); + return null; + })).call(_context, function (tag) { + return tag !== null; + }); // concat all white list - var map$4 = path.Map; + var allBlockNames = concat$5(customTagWhiteList).call(customTagWhiteList, blockNames).join('|'); // 段落标签自然换行,所以去掉段落标签两边的换行符 - var map$5 = map$4; + /** + * remove newlines after start tag, and remove whitespaces before newline + * e.g. + *

\n text

=>

text

+ * ^^ + * $1$2 + */ - var map$6 = map$5; - // https://tc39.github.io/proposal-setmap-offrom/ + this.removeBrAfterBlock = new RegExp("<(".concat(allBlockNames, ")(>| [^>]*?>)[^\\S\\n]*?\\n"), 'ig'); + /** + * remove newlines before end tag, and whitespaces before end tag will be preserved + * e.g. + *

text\n

=>

text

+ * ^ + * $1 + */ + this.removeBrBeforeBlock = new RegExp("\\n[^\\S\\n]*?<\\/(".concat(allBlockNames, ")>[^\\S\\n]*?\\n"), 'ig'); + /** + * remove newlines between end tag & start tag + * e.g. + *

\n

=>

\r

+ * ^ ^^ ^ ^^^^^^^^^^^^ + * $1 $2 $3 $4 + */ + this.removeNewlinesBetweenTags = new RegExp(concat$5(_context2 = "<\\/(".concat(allBlockNames, ")>[^\\S\\n]*?\\n([^\\S\\n]*?)<(")).call(_context2, allBlockNames, ")(>| [^>]*?>)"), 'ig'); + } + return textContainsHtml.replace(this.removeBrAfterBlock, '<$1$2').replace(this.removeBrBeforeBlock, '').replace(this.removeNewlinesBetweenTags, '\r$2<$3$4'); // replace \n to \r + } + }, { + key: "toHtml", + value: function toHtml(str, sentenceMakeFunc) { + return str; + } + }, { + key: "makeHtml", + value: function makeHtml(str, sentenceMakeFunc) { + return sentenceMakeFunc(str).html; + } + }, { + key: "afterMakeHtml", + value: function afterMakeHtml(html) { + return this.restoreCache(html); + } + }, { + key: "isContainsCache", + value: function isContainsCache(str, fullMatch) { + if (fullMatch) { + // 如果是全匹配:不能包含CherryINPRAGRAPH + var containsParagraphCache = /^(\s*~~C\d+I\w+\$\s*)+$/g.test(str); + var containsInParagraphCache = new RegExp("~~C\\d+I".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, "\\w+\\$"), 'g').test(str); + return containsParagraphCache && !containsInParagraphCache; + } // 如果是局部匹配: 不能只包含CherryINPRAGRAPH + // const containsParagraphCache = /~~C\d+I\w+\$/g.test(str); + // const containsInParagraphCache = new RegExp( + // `~~C\\d+I${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX}\\w+\\$`, 'g').test(str); + var containsNonInParagraphCache = new RegExp("~~C\\d+I(?!".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")\\w+\\$"), 'g').test(str); + return containsNonInParagraphCache; // return fullMatch ? + // /^(\s*~~C\d+I\w+\$\s*)+$/g.test(str) && !/^(\s*~~C\d+ICherryINPRAGRAPH\w+\$\s*)+$/g.test(str) : + // /~~C\d+I\w+\$/g.test(str) && !(/~~C\d+ICherryINPRAGRAPH\w+\$/g.test(str) + // && !/~~C\d+I(?!CherryINPRAGRAPH)\w+\$/g.test(str)); + } + /** + * + * @param {string} html + * @return + */ - var push$4 = [].push; + }, { + key: "$splitHtmlByCache", + value: function $splitHtmlByCache(html) { + // ~~C0I(?!prefix)sign$ + var regex = new RegExp("\\n*~~C\\d+I(?!".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")\\w+\\$\\n?"), 'g'); + return { + caches: html.match(regex), + contents: html.split(regex) + }; + } + }, { + key: "makeExcludingCached", + value: function makeExcludingCached(content, processor) { + var _this$$splitHtmlByCac = this.$splitHtmlByCache(content), + caches = _this$$splitHtmlByCac.caches, + contents = _this$$splitHtmlByCac.contents; - var collectionFrom = function from(source /* , mapFn, thisArg */) { - var length = arguments.length; - var mapFn = length > 1 ? arguments[1] : undefined; - var mapping, array, n, boundFunction; - aConstructor(this); - mapping = mapFn !== undefined; - if (mapping) aCallable(mapFn); - if (source == undefined) return new this(); - array = []; - if (mapping) { - n = 0; - boundFunction = functionBindContext(mapFn, length > 2 ? arguments[2] : undefined); - iterate(source, function (nextItem) { - functionCall(push$4, array, boundFunction(nextItem, n++)); - }); - } else { - iterate(source, push$4, { that: array }); - } - return new this(array); - }; + var paragraphs = map$3(contents).call(contents, processor); - // `Map.from` method - // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from - _export({ target: 'Map', stat: true, forced: true }, { - from: collectionFrom - }); + var ret = ''; - // https://tc39.github.io/proposal-setmap-offrom/ - var collectionOf = function of() { - return new this(arraySlice(arguments)); - }; + for (var i = 0; i < paragraphs.length; i++) { + ret += paragraphs[i]; - // `Map.of` method - // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of - _export({ target: 'Map', stat: true, forced: true }, { - of: collectionOf - }); + if (caches && caches[i]) { + var _context3; - // https://github.com/tc39/collection-methods - var collectionDeleteAll = function deleteAll(/* ...elements */) { - var collection = anObject(this); - var remover = aCallable(collection['delete']); - var allDeleted = true; - var wasDeleted; - for (var k = 0, len = arguments.length; k < len; k++) { - wasDeleted = functionCall(remover, collection, arguments[k]); - allDeleted = allDeleted && wasDeleted; - } - return !!allDeleted; - }; + ret += trim$3(_context3 = caches[i]).call(_context3); + } + } - // `Map.prototype.deleteAll` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - deleteAll: collectionDeleteAll - }); + return ret; + } + /** + * 获取非捕获匹配丢掉的换行,适用于能被【嵌套】的段落语法 + * + * @param {string} cache 需要返回的cache + * @param {string} md 原始的md字符串 + * @param {boolean} alwaysAlone 是否能被【嵌套】,true:不能被嵌套,如标题、注释等;false:能被嵌套,如代码块、有序列表等 + * @return {string} str + */ - // `Map.prototype.emplace` method - // https://github.com/thumbsupep/proposal-upsert - var mapEmplace = function emplace(key, handler) { - var map = anObject(this); - var get = aCallable(map.get); - var has = aCallable(map.has); - var set = aCallable(map.set); - var value = (functionCall(has, map, key) && 'update' in handler) - ? handler.update(functionCall(get, map, key), key, map) - : handler.insert(key, map); - functionCall(set, map, key, value); - return value; - }; + }, { + key: "getCacheWithSpace", + value: function getCacheWithSpace(cache, md) { + var _md$match$, _md$match, _md$match$2, _md$match2, _context4, _context5; - // `Map.prototype.emplace` method - // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: true }, { - emplace: mapEmplace - }); + var alwaysAlone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var preSpace = (_md$match$ = (_md$match = md.match(/^\n+/)) === null || _md$match === void 0 ? void 0 : _md$match[0]) !== null && _md$match$ !== void 0 ? _md$match$ : ''; + var afterSpace = (_md$match$2 = (_md$match2 = md.match(/\n+$/)) === null || _md$match2 === void 0 ? void 0 : _md$match2[0]) !== null && _md$match$2 !== void 0 ? _md$match$2 : ''; - var getMapIterator = getIterator; + if (alwaysAlone) { + return prependLineFeedForParagraph(md, cache); + } - // `Map.prototype.every` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - every: function every(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return !iterate(iterator, function (key, value, stop) { - if (!boundFunction(value, key, map)) return stop(); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; - } - }); + return concat$5(_context4 = concat$5(_context5 = "".concat(preSpace)).call(_context5, cache)).call(_context4, afterSpace); + } + /** + * 获取行号,只负责向上计算\n + * 会计算cache的行号 + * + * @param {string} md md内容 + * @param {string} preSpace 前置换行 + * @return {number} 行数 + */ - var SPECIES$4 = wellKnownSymbol('species'); + }, { + key: "getLineCount", + value: function getLineCount(md) { + var _preSpace$match$0$len, _preSpace$match, _preSpace$match$; - // `SpeciesConstructor` abstract operation - // https://tc39.es/ecma262/#sec-speciesconstructor - var speciesConstructor = function (O, defaultConstructor) { - var C = anObject(O).constructor; - var S; - return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aConstructor(S); - }; + var preSpace = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var content = md; + /** + * 前置换行个数,【注意】:前置换行个数不包括上文的最后一个\n + * 例: + * - aa\n + * - bb\n + * \n + * cc\n + * + * cc的前置换行个数为 1,bb后的\n不计算在内 + * cc的正则为:/(?:^|\n)(\n*)xxxxxx/ + */ - // `Map.prototype.filter` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - filter: function filter(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); - var setter = aCallable(newMap.set); - iterate(iterator, function (key, value) { - if (boundFunction(value, key, map)) functionCall(setter, newMap, key, value); - }, { AS_ENTRIES: true, IS_ITERATOR: true }); - return newMap; - } - }); + var preLineCount = (_preSpace$match$0$len = (_preSpace$match = preSpace.match(/^\n+/g)) === null || _preSpace$match === void 0 ? void 0 : (_preSpace$match$ = _preSpace$match[0]) === null || _preSpace$match$ === void 0 ? void 0 : _preSpace$match$.length) !== null && _preSpace$match$0$len !== void 0 ? _preSpace$match$0$len : 0; + preLineCount = preLineCount === 1 ? 1 : 0; // 前置换行超过2个就交给BR进行渲染 - // `Map.prototype.find` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - find: function find(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return iterate(iterator, function (key, value, stop) { - if (boundFunction(value, key, map)) return stop(value); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; - } - }); - - // `Map.prototype.findKey` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - findKey: function findKey(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return iterate(iterator, function (key, value, stop) { - if (boundFunction(value, key, map)) return stop(key); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; - } - }); + content = content.replace(/^\n+/g, ''); + var regex = new RegExp("\n*~~C\\d+I(?:".concat(ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")?\\w+?_L(\\d+)\\$"), 'g'); + var cacheLineCount = 0; + content = content.replace(regex, function (match, lineCount) { + cacheLineCount += _parseInt$2(lineCount, 10); + return match.replace(/^\n+/g, ''); + }); + return preLineCount + cacheLineCount + (content.match(/\n/g) || []).length + 1; // 实际内容所占行数,至少为1行 + } + /** + * + * @param {string} str 渲染后的内容 + * @param {string} sign 签名 + * @param {number} lineCount md原文的行数 + * @return {string} cacheKey ~~C0I0_L1$ + */ - var push$5 = functionUncurryThis([].push); + }, { + key: "pushCache", + value: function pushCache(str) { + var _context6, _context7; - // `Map.groupBy` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true, forced: true }, { - groupBy: function groupBy(iterable, keyDerivative) { - aCallable(keyDerivative); - var iterator = getIterator(iterable); - var newMap = new this(); - var has = aCallable(newMap.has); - var get = aCallable(newMap.get); - var set = aCallable(newMap.set); - iterate(iterator, function (element) { - var derivedKey = keyDerivative(element); - if (!functionCall(has, newMap, derivedKey)) functionCall(set, newMap, derivedKey, [element]); - else push$5(functionCall(get, newMap, derivedKey), element); - }, { IS_ITERATOR: true }); - return newMap; - } - }); + var sign = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var lineCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - // `SameValueZero` abstract operation - // https://tc39.es/ecma262/#sec-samevaluezero - var sameValueZero = function (x, y) { - // eslint-disable-next-line no-self-compare -- NaN check - return x === y || x != x && y != y; - }; + if (!this.needCache) { + return; + } - // `Map.prototype.includes` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - includes: function includes(searchElement) { - return iterate(getMapIterator(anObject(this)), function (key, value, stop) { - if (sameValueZero(value, searchElement)) return stop(); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; - } - }); + var $sign = sign || this.$engine.md5(str); + this.cache[$sign] = { + content: str, + using: true + }; + return concat$5(_context6 = concat$5(_context7 = "".concat(this.cacheKey, "I")).call(_context7, $sign, "_L")).call(_context6, lineCount, "$"); + } + }, { + key: "popCache", + value: function popCache(sign) { + if (!this.needCache) { + return; + } - // `Map.keyBy` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', stat: true, forced: true }, { - keyBy: function keyBy(iterable, keyDerivative) { - var newMap = new this(); - aCallable(keyDerivative); - var setter = aCallable(newMap.set); - iterate(iterable, function (element) { - functionCall(setter, newMap, keyDerivative(element), element); - }); - return newMap; - } - }); + return this.cache[sign].content || ''; + } + }, { + key: "resetCache", + value: function resetCache() { + if (!this.needCache) { + return; + } - // `Map.prototype.keyOf` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - keyOf: function keyOf(searchElement) { - return iterate(getMapIterator(anObject(this)), function (key, value, stop) { - if (value === searchElement) return stop(key); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; - } - }); + for (var _i = 0, _Object$keys = keys$3(this.cache); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + if (!this.cache[key].using) delete this.cache[key]; + } - // `Map.prototype.mapKeys` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - mapKeys: function mapKeys(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); - var setter = aCallable(newMap.set); - iterate(iterator, function (key, value) { - functionCall(setter, newMap, boundFunction(value, key, map), value); - }, { AS_ENTRIES: true, IS_ITERATOR: true }); - return newMap; - } - }); + for (var _i2 = 0, _Object$keys3 = keys$3(this.cache); _i2 < _Object$keys3.length; _i2++) { + var _key = _Object$keys3[_i2]; + this.cache[_key].using = false; + } + } + }, { + key: "restoreCache", + value: function restoreCache(html) { + var _context8, + _this2 = this; - // `Map.prototype.mapValues` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - mapValues: function mapValues(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); - var setter = aCallable(newMap.set); - iterate(iterator, function (key, value) { - functionCall(setter, newMap, key, boundFunction(value, key, map)); - }, { AS_ENTRIES: true, IS_ITERATOR: true }); - return newMap; - } - }); + // restore cached content + if (!this.needCache) { + return html; + } - // `Map.prototype.merge` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, { - // eslint-disable-next-line no-unused-vars -- required for `.length` - merge: function merge(iterable /* ...iterables */) { - var map = anObject(this); - var setter = aCallable(map.set); - var argumentsLength = arguments.length; - var i = 0; - while (i < argumentsLength) { - iterate(arguments[i++], setter, { that: map, AS_ENTRIES: true }); + var regex = new RegExp(concat$5(_context8 = "".concat(this.cacheKey, "I((?:")).call(_context8, ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX, ")?\\w+)\\$"), 'g'); + var $html = html.replace(regex, function (match, cacheSign) { + return _this2.popCache(cacheSign.replace(/_L\d+$/, '')); + }); + this.resetCache(); + return $html; } - return map; - } - }); + /** + * + * @param {string} wholeMatch whole match + */ - var TypeError$i = global_1.TypeError; + }, { + key: "checkCache", + value: function checkCache(wholeMatch, sentenceMakeFunc) { + var _context9, _context10; - // `Map.prototype.reduce` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - reduce: function reduce(callbackfn /* , initialValue */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var noInitial = arguments.length < 2; - var accumulator = noInitial ? undefined : arguments[1]; - aCallable(callbackfn); - iterate(iterator, function (key, value) { - if (noInitial) { - noInitial = false; - accumulator = value; - } else { - accumulator = callbackfn(accumulator, value, key, map); - } - }, { AS_ENTRIES: true, IS_ITERATOR: true }); - if (noInitial) throw TypeError$i('Reduce of empty map with no initial value'); - return accumulator; - } - }); + var lineCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + this.sign = this.$engine.md5(wholeMatch); // miss cache - // `Set.prototype.some` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - some: function some(callbackfn /* , thisArg */) { - var map = anObject(this); - var iterator = getMapIterator(map); - var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); - return iterate(iterator, function (key, value, stop) { - if (boundFunction(value, key, map)) return stop(); - }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; - } - }); + if (!this.cache[this.sign]) { + return this.toHtml(wholeMatch, sentenceMakeFunc); + } // hit & mark cache - var TypeError$j = global_1.TypeError; - // `Set.prototype.update` method - // https://github.com/tc39/proposal-collection-methods - _export({ target: 'Map', proto: true, real: true, forced: true }, { - update: function update(key, callback /* , thunk */) { - var map = anObject(this); - var get = aCallable(map.get); - var has = aCallable(map.has); - var set = aCallable(map.set); - var length = arguments.length; - aCallable(callback); - var isPresentInMap = functionCall(has, map, key); - if (!isPresentInMap && length < 3) { - throw TypeError$j('Updating absent value'); + this.cache[this.sign].using = true; + return concat$5(_context9 = concat$5(_context10 = "".concat(this.cacheKey, "I")).call(_context10, this.sign, "_L")).call(_context9, lineCount, "$"); } - var value = isPresentInMap ? functionCall(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); - functionCall(set, map, key, callback(value, key, map)); - return map; - } - }); + }, { + key: "mounted", + value: function mounted() {// console.log('base mounted'); + } + }, { + key: "signWithCache", + value: function signWithCache(html) { + return false; + } + }]); - var TypeError$k = global_1.TypeError; + return ParagraphBase; + }(SyntaxBase); - // `Map.prototype.upsert` method - // https://github.com/thumbsupep/proposal-upsert - var mapUpsert = function upsert(key, updateFn /* , insertFn */) { - var map = anObject(this); - var get = aCallable(map.get); - var has = aCallable(map.has); - var set = aCallable(map.set); - var insertFn = arguments.length > 2 ? arguments[2] : undefined; - var value; - if (!isCallable(updateFn) && !isCallable(insertFn)) { - throw TypeError$k('At least one callback required'); - } - if (functionCall(has, map, key)) { - value = functionCall(get, map, key); - if (isCallable(updateFn)) { - value = updateFn(value); - functionCall(set, map, key, value); - } - } else if (isCallable(insertFn)) { - value = insertFn(); - functionCall(set, map, key, value); - } return value; - }; + _defineProperty(ParagraphBase, "HOOK_TYPE", HOOKS_TYPE_LIST.PAR); - // TODO: remove from `core-js@4` + _defineProperty(ParagraphBase, "IN_PARAGRAPH_CACHE_KEY_PREFIX", '!'); + _defineProperty(ParagraphBase, "IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX", '\\!'); + // FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it - // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`) - // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, forced: true }, { - upsert: mapUpsert - }); - // TODO: remove from `core-js@4` + var arrayBufferNonExtensible = fails(function () { + if (typeof ArrayBuffer == 'function') { + var buffer = new ArrayBuffer(8); + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe + if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 }); + } + }); + // eslint-disable-next-line es-x/no-object-isextensible -- safe + var $isExtensible = Object.isExtensible; + var FAILS_ON_PRIMITIVES$3 = fails(function () { $isExtensible(1); }); + // `Object.isExtensible` method + // https://tc39.es/ecma262/#sec-object.isextensible + var objectIsExtensible = (FAILS_ON_PRIMITIVES$3 || arrayBufferNonExtensible) ? function isExtensible(it) { + if (!isObject(it)) return false; + if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') return false; + return $isExtensible ? $isExtensible(it) : true; + } : $isExtensible; - // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`) - // https://github.com/thumbsupep/proposal-upsert - _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, { - updateOrInsert: mapUpsert + var freezing = !fails(function () { + // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing + return Object.isExtensible(Object.preventExtensions({})); }); - // TODO: remove from `core-js@4` + var internalMetadata = createCommonjsModule(function (module) { + var defineProperty = objectDefineProperty.f; - // TODO: remove from `core-js@4` - var map$7 = map$6; - var map$8 = map$7; - var map$9 = map$8; - var isNativeFunction = createCommonjsModule(function (module) { - function _isNativeFunction(fn) { - var _context; + var REQUIRED = false; + var METADATA = uid('meta'); + var id = 0; - return indexOf$7(_context = Function.toString.call(fn)).call(_context, "[native code]") !== -1; - } + var setMetadata = function (it) { + defineProperty(it, METADATA, { value: { + objectID: 'O' + id++, // object ID + weakData: {} // weak collections IDs + } }); + }; - module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + var fastKey = function (it, create) { + // return a primitive with prefix + if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if (!hasOwnProperty_1(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!objectIsExtensible(it)) return 'F'; + // not necessary to add metadata + if (!create) return 'E'; + // add missing metadata + setMetadata(it); + // return object ID + } return it[METADATA].objectID; + }; - unwrapExports(isNativeFunction); + var getWeakData = function (it, create) { + if (!hasOwnProperty_1(it, METADATA)) { + // can't set metadata to uncaught frozen object + if (!objectIsExtensible(it)) return true; + // not necessary to add metadata + if (!create) return false; + // add missing metadata + setMetadata(it); + // return the store of weak collections IDs + } return it[METADATA].weakData; + }; - var construct$5 = construct$3; + // add metadata on freeze-family methods calling + var onFreeze = function (it) { + if (freezing && REQUIRED && objectIsExtensible(it) && !hasOwnProperty_1(it, METADATA)) setMetadata(it); + return it; + }; - var construct$6 = construct$5; + var enable = function () { + meta.enable = function () { /* empty */ }; + REQUIRED = true; + var getOwnPropertyNames = objectGetOwnPropertyNames.f; + var splice = functionUncurryThis([].splice); + var test = {}; + test[METADATA] = 1; - var construct$7 = construct$6; + // prevent exposing of metadata key + if (getOwnPropertyNames(test).length) { + objectGetOwnPropertyNames.f = function (it) { + var result = getOwnPropertyNames(it); + for (var i = 0, length = result.length; i < length; i++) { + if (result[i] === METADATA) { + splice(result, i, 1); + break; + } + } return result; + }; - var construct$8 = construct$7; + _export({ target: 'Object', stat: true, forced: true }, { + getOwnPropertyNames: objectGetOwnPropertyNamesExternal.f + }); + } + }; - var bind$6 = bind$4; + var meta = module.exports = { + enable: enable, + fastKey: fastKey, + getWeakData: getWeakData, + onFreeze: onFreeze + }; - var bind$7 = bind$6; + hiddenKeys[METADATA] = true; + }); + var internalMetadata_1 = internalMetadata.enable; + var internalMetadata_2 = internalMetadata.fastKey; + var internalMetadata_3 = internalMetadata.getWeakData; + var internalMetadata_4 = internalMetadata.onFreeze; - var bind$8 = bind$7; + var TypeError$g = global_1.TypeError; - var bind$9 = bind$8; + var Result = function (stopped, result) { + this.stopped = stopped; + this.result = result; + }; - var isNativeReflectConstruct = createCommonjsModule(function (module) { - function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !construct$8) return false; - if (construct$8.sham) return false; - if (typeof Proxy === "function") return true; + var ResultPrototype = Result.prototype; - try { - Boolean.prototype.valueOf.call(construct$8(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } - } + var iterate = function (iterable, unboundFunction, options) { + var that = options && options.that; + var AS_ENTRIES = !!(options && options.AS_ENTRIES); + var IS_ITERATOR = !!(options && options.IS_ITERATOR); + var INTERRUPTED = !!(options && options.INTERRUPTED); + var fn = functionBindContext(unboundFunction, that); + var iterator, iterFn, index, length, result, next, step; - module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + var stop = function (condition) { + if (iterator) iteratorClose(iterator, 'normal', condition); + return new Result(true, condition); + }; - unwrapExports(isNativeReflectConstruct); + var callFn = function (value) { + if (AS_ENTRIES) { + anObject(value); + return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]); + } return INTERRUPTED ? fn(value, stop) : fn(value); + }; - var construct$9 = createCommonjsModule(function (module) { - function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = construct$8, module.exports.__esModule = true, module.exports["default"] = module.exports; + if (IS_ITERATOR) { + iterator = iterable; } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - - var Constructor = bind$9(Function).apply(Parent, a); - - var instance = new Constructor(); - if (Class) setPrototypeOf$6(instance, Class.prototype); - return instance; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; + iterFn = getIteratorMethod(iterable); + if (!iterFn) throw TypeError$g(tryToString(iterable) + ' is not iterable'); + // optimisation for array iterators + if (isArrayIteratorMethod(iterFn)) { + for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { + result = callFn(iterable[index]); + if (result && objectIsPrototypeOf(ResultPrototype, result)) return result; + } return new Result(false); + } + iterator = getIterator(iterable, iterFn); } - return _construct.apply(null, arguments); - } + next = iterator.next; + while (!(step = functionCall(next, iterator)).done) { + try { + result = callFn(step.value); + } catch (error) { + iteratorClose(iterator, 'throw', error); + } + if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result; + } return new Result(false); + }; - module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + var TypeError$h = global_1.TypeError; - var _construct = unwrapExports(construct$9); + var anInstance = function (it, Prototype) { + if (objectIsPrototypeOf(Prototype, it)) return it; + throw TypeError$h('Incorrect invocation'); + }; - var wrapNativeSuper = createCommonjsModule(function (module) { - function _wrapNativeSuper(Class) { - var _cache = typeof map$9 === "function" ? new map$9() : undefined; + var defineProperty$d = objectDefineProperty.f; + var forEach$4 = arrayIteration.forEach; - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); + var setInternalState$3 = internalState.set; + var internalStateGetterFor = internalState.getterFor; - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return construct$9(Class, arguments, getPrototypeOf$6(this).constructor); - } + var collection = function (CONSTRUCTOR_NAME, wrapper, common) { + var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; + var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1; + var ADDER = IS_MAP ? 'set' : 'add'; + var NativeConstructor = global_1[CONSTRUCTOR_NAME]; + var NativePrototype = NativeConstructor && NativeConstructor.prototype; + var exported = {}; + var Constructor; - Wrapper.prototype = create$5(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } + if (!descriptors || !isCallable(NativeConstructor) + || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); })) + ) { + // create collection constructor + Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); + internalMetadata.enable(); + } else { + Constructor = wrapper(function (target, iterable) { + setInternalState$3(anInstance(target, Prototype), { + type: CONSTRUCTOR_NAME, + collection: new NativeConstructor() + }); + if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP }); }); - return setPrototypeOf$6(Wrapper, Class); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _wrapNativeSuper(Class); - } - module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + var Prototype = Constructor.prototype; - var _wrapNativeSuper = unwrapExports(wrapNativeSuper); + var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); - var isArray$8 = isArray$3; + forEach$4(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) { + var IS_ADDER = KEY == 'add' || KEY == 'set'; + if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) { + createNonEnumerableProperty(Prototype, KEY, function (a, b) { + var collection = getInternalState(this).collection; + if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false; + var result = collection[KEY](a === 0 ? 0 : a, b); + return IS_ADDER ? this : result; + }); + } + }); - function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + IS_WEAK || defineProperty$d(Prototype, 'size', { + configurable: true, + get: function () { + return getInternalState(this).collection.size; + } + }); + } - function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true); - /** - * Copyright (C) 2021 THL A29 Limited, a Tencent company. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + exported[CONSTRUCTOR_NAME] = Constructor; + _export({ global: true, forced: true }, exported); - /** - * 三个地方的错误异常校验 - * 1. markdown 对象参数校验 - * 2. editText 用户输入校验,执行engine过程以防异常 - * 3. 自定义hook校验 对外开发者开发标准校验 - */ - var $expectTarget = function $expectTarget(target, Constructor) { - if (!isArray$8(target) && _typeof(target) !== Constructor.name.toLowerCase() || !isArray$8(target) && Constructor.name.toLowerCase() === 'array') { - throw new TypeError("parameter given must be ".concat(Constructor.name)); - } + if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); - return true; + return Constructor; }; - var $expectInherit = function $expectInherit(target, parent) { - if (!(target instanceof parent)) { - throw new Error('the hook does not correctly inherit'); - } - return true; + var defineBuiltIns = function (target, src, options) { + for (var key in src) { + if (options && options.unsafe && target[key]) target[key] = src[key]; + else defineBuiltIn(target, key, src[key], options); + } return target; }; - var $expectInstance = function $expectInstance(target) { - if (_typeof(target) !== 'object') { - throw new Error('the hook must be a instance, not a class'); - } - - return true; - }; // ref: https://github.com/mdlavin/nested-error-stacks - - var NestedError = /*#__PURE__*/function (_Error) { - _inherits(NestedError, _Error); - - var _super = _createSuper$1(NestedError); - function NestedError(message, nested) { - var _this; + var SPECIES$3 = wellKnownSymbol('species'); - _classCallCheck(this, NestedError); + var setSpecies = function (CONSTRUCTOR_NAME) { + var Constructor = getBuiltIn(CONSTRUCTOR_NAME); + var defineProperty = objectDefineProperty.f; - _this = _super.call(this, message); - _this.name = 'Error'; - _this.stack = _this.buildStackTrace(nested); - return _this; + if (descriptors && Constructor && !Constructor[SPECIES$3]) { + defineProperty(Constructor, SPECIES$3, { + configurable: true, + get: function () { return this; } + }); } + }; - _createClass(NestedError, [{ - key: "buildStackTrace", - value: function buildStackTrace(nested) { - var _context; + var defineProperty$e = objectDefineProperty.f; - var stack = nested && nested.stack ? nested.stack : ''; - var newStack = concat$5(_context = "".concat(this.stack, "\nCaused By: ")).call(_context, stack); - return newStack; - } - }]); - return NestedError; - }( /*#__PURE__*/_wrapNativeSuper(Error)); - /** - * @typedef {import('~types/cherry').CherryOptions} CherryOptions - * @typedef {import('~types/cherry').CherryEngineOptions} CherryEngineOptions - * @typedef {import('~types/cherry').CustomSyntaxRegConfig} CustomSyntaxRegConfig - * @typedef { (SyntaxBase | ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntax - * @typedef { (typeof SyntaxBase | typeof ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntaxClass - */ - var WARN_DUPLICATED = -1; - var WARN_NOT_A_VALID_HOOK = -2; - /** - * 处理报错信息,在dev模式下才会输出报错信息 - * @param {number} type - * @param {any} objClass - * @param {number} index - */ - function processWarning(type, objClass, index) { - if (type === WARN_DUPLICATED) { - var _context, _context2; - Logger.warn(concat$5(_context = concat$5(_context2 = "Duplicate hook name [".concat(objClass.HOOK_NAME, "] found, hook [")).call(_context2, objClass.toString(), "] ")).call(_context, isNaN(index) ? '' : "at index [".concat(index, "] "), "will not take effect.")); - } else if (type === WARN_NOT_A_VALID_HOOK) { - var _context3; + var fastKey = internalMetadata.fastKey; - Logger.warn(concat$5(_context3 = "Hook [".concat(objClass.toString(), "] ")).call(_context3, isNaN(index) ? '' : "at index [".concat(index, "] "), "is not a valid hook, and will not take effect.")); - } - } - /** - * 是否一个合法的 HookClass - * @param {any} HookClass - * @returns { HookClass is (typeof SyntaxBase | typeof ParagraphBase) } - */ + var setInternalState$4 = internalState.set; + var internalStateGetterFor$1 = internalState.getterFor; - function isHookValid(HookClass) { - return isProtoOfSyntaxBase(HookClass) || isProtoOfParagraphBase(HookClass); - } - /** - * 传入的类是否 SyntaxBase 的子类 - * @param {any} value - * @returns { value is typeof SyntaxBase } - */ + var collectionStrong = { + getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { + var Constructor = wrapper(function (that, iterable) { + anInstance(that, Prototype); + setInternalState$4(that, { + type: CONSTRUCTOR_NAME, + index: objectCreate(null), + first: undefined, + last: undefined, + size: 0 + }); + if (!descriptors) that.size = 0; + if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP }); + }); + var Prototype = Constructor.prototype; - function isProtoOfSyntaxBase(value) { - return Object.prototype.isPrototypeOf.call(SyntaxBase, value); - } - /** - * 传入的类是否 ParagraphBase 的子类 - * @param {any} value - * @returns { value is typeof ParagraphBase } - */ + var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME); + var define = function (that, key, value) { + var state = getInternalState(that); + var entry = getEntry(that, key); + var previous, index; + // change existing entry + if (entry) { + entry.value = value; + // create new entry + } else { + state.last = entry = { + index: index = fastKey(key, true), + key: key, + value: value, + previous: previous = state.last, + next: undefined, + removed: false + }; + if (!state.first) state.first = entry; + if (previous) previous.next = entry; + if (descriptors) state.size++; + else that.size++; + // add to index + if (index !== 'F') state.index[index] = entry; + } return that; + }; - function isProtoOfParagraphBase(value) { - return Object.prototype.isPrototypeOf.call(ParagraphBase, value); - } - /** - * 是否一个配置型的自定义语法 - * @param {any} value - * @returns { value is CustomSyntaxRegConfig } - */ + var getEntry = function (that, key) { + var state = getInternalState(that); + // fast case + var index = fastKey(key); + var entry; + if (index !== 'F') return state.index[index]; + // frozen object case + for (entry = state.first; entry; entry = entry.next) { + if (entry.key == key) return entry; + } + }; + defineBuiltIns(Prototype, { + // `{ Map, Set }.prototype.clear()` methods + // https://tc39.es/ecma262/#sec-map.prototype.clear + // https://tc39.es/ecma262/#sec-set.prototype.clear + clear: function clear() { + var that = this; + var state = getInternalState(that); + var data = state.index; + var entry = state.first; + while (entry) { + entry.removed = true; + if (entry.previous) entry.previous = entry.previous.next = undefined; + delete data[entry.index]; + entry = entry.next; + } + state.first = state.last = undefined; + if (descriptors) state.size = 0; + else that.size = 0; + }, + // `{ Map, Set }.prototype.delete(key)` methods + // https://tc39.es/ecma262/#sec-map.prototype.delete + // https://tc39.es/ecma262/#sec-set.prototype.delete + 'delete': function (key) { + var that = this; + var state = getInternalState(that); + var entry = getEntry(that, key); + if (entry) { + var next = entry.next; + var prev = entry.previous; + delete state.index[entry.index]; + entry.removed = true; + if (prev) prev.next = next; + if (next) next.previous = prev; + if (state.first == entry) state.first = next; + if (state.last == entry) state.last = prev; + if (descriptors) state.size--; + else that.size--; + } return !!entry; + }, + // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods + // https://tc39.es/ecma262/#sec-map.prototype.foreach + // https://tc39.es/ecma262/#sec-set.prototype.foreach + forEach: function forEach(callbackfn /* , that = undefined */) { + var state = getInternalState(this); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var entry; + while (entry = entry ? entry.next : state.first) { + boundFunction(entry.value, entry.key, this); + // revert to the last existing entry + while (entry && entry.removed) entry = entry.previous; + } + }, + // `{ Map, Set}.prototype.has(key)` methods + // https://tc39.es/ecma262/#sec-map.prototype.has + // https://tc39.es/ecma262/#sec-set.prototype.has + has: function has(key) { + return !!getEntry(this, key); + } + }); - function isCustomSyntaxConfig(value) { - var syntaxClass = - /** @type {any} */ + defineBuiltIns(Prototype, IS_MAP ? { + // `Map.prototype.get(key)` method + // https://tc39.es/ecma262/#sec-map.prototype.get + get: function get(key) { + var entry = getEntry(this, key); + return entry && entry.value; + }, + // `Map.prototype.set(key, value)` method + // https://tc39.es/ecma262/#sec-map.prototype.set + set: function set(key, value) { + return define(this, key === 0 ? 0 : key, value); + } + } : { + // `Set.prototype.add(value)` method + // https://tc39.es/ecma262/#sec-set.prototype.add + add: function add(value) { + return define(this, value = value === 0 ? 0 : value, value); + } + }); + if (descriptors) defineProperty$e(Prototype, 'size', { + get: function () { + return getInternalState(this).size; + } + }); + return Constructor; + }, + setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { + var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; + var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME); + var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME); + // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods + // https://tc39.es/ecma262/#sec-map.prototype.entries + // https://tc39.es/ecma262/#sec-map.prototype.keys + // https://tc39.es/ecma262/#sec-map.prototype.values + // https://tc39.es/ecma262/#sec-map.prototype-@@iterator + // https://tc39.es/ecma262/#sec-set.prototype.entries + // https://tc39.es/ecma262/#sec-set.prototype.keys + // https://tc39.es/ecma262/#sec-set.prototype.values + // https://tc39.es/ecma262/#sec-set.prototype-@@iterator + defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { + setInternalState$4(this, { + type: ITERATOR_NAME, + target: iterated, + state: getInternalCollectionState(iterated), + kind: kind, + last: undefined + }); + }, function () { + var state = getInternalIteratorState(this); + var kind = state.kind; + var entry = state.last; + // revert to the last existing entry + while (entry && entry.removed) entry = entry.previous; + // get next entry + if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) { + // or finish the iteration + state.target = undefined; + return { value: undefined, done: true }; + } + // return step by kind + if (kind == 'keys') return { value: entry.key, done: false }; + if (kind == 'values') return { value: entry.value, done: false }; + return { value: [entry.key, entry.value], done: false }; + }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); - /** @type {CustomSyntaxRegConfig} */ - value === null || value === void 0 ? void 0 : value.syntaxClass; - return isProtoOfSyntaxBase(syntaxClass) || isProtoOfParagraphBase(syntaxClass); - } - /** - * 是否一个已注册的自定义语法hook类 - * @param {any} value - * @returns { value is CustomSyntaxClass } - */ + // `{ Map, Set }.prototype[@@species]` accessors + // https://tc39.es/ecma262/#sec-get-map-@@species + // https://tc39.es/ecma262/#sec-get-set-@@species + setSpecies(CONSTRUCTOR_NAME); + } + }; + // `Map` constructor + // https://tc39.es/ecma262/#sec-map-objects + collection('Map', function (init) { + return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; + }, collectionStrong); - function isRegisteredCustomSyntaxClass(value) { - return isHookValid(value) && - /** @type {CustomSyntaxClass} */ - (value === null || value === void 0 ? void 0 : value.Cherry$$CUSTOM) === true; - } - /** - * 语法注册中心 - */ + var map$4 = path.Map; + var map$5 = map$4; - var HookCenter = /*#__PURE__*/function () { - /** - * - * @param {(typeof SyntaxBase)[]} hooksConfig - * @param {Partial} editorConfig - */ - function HookCenter(hooksConfig, editorConfig) { - _classCallCheck(this, HookCenter); + var map$6 = map$5; - /** - * @property - * @type {Record} hookList hook 名称 -> hook 类型的映射 - */ - this.hookList = - /** @type {any} */ - {}; - /** - * @property - * @type {Record} hookNameList hook 名称 -> hook 类型的映射 - */ + // https://tc39.github.io/proposal-setmap-offrom/ - this.hookNameList = {}; - $expectTarget(hooksConfig, Array); - this.registerInternalHooks(hooksConfig, editorConfig); - this.registerCustomHooks(editorConfig.engine.customSyntax, editorConfig); - } - /** - * 注册系统默认的语法hook - * @param {any[]} hooksConfig 在hookconfig.js里定义的配置 - * @param {Partial} editorConfig 编辑器配置 - */ - _createClass(HookCenter, [{ - key: "registerInternalHooks", - value: function registerInternalHooks(hooksConfig, editorConfig) { - var _this = this; - forEach$3(hooksConfig).call(hooksConfig, - /** - * - * @param {typeof SyntaxBase} HookClass - * @param {number} index - */ - function (HookClass, index) { - var result = _this.register(HookClass, editorConfig); - processWarning(result, HookClass, index); - }); - } - /** - * 注册第三方的语法hook - * @param {CherryEngineOptions['customSyntax']} customHooks 用户传入的配置 - * @param {Partial} editorConfig 编辑器配置 - */ - }, { - key: "registerCustomHooks", - value: function registerCustomHooks(customHooks, editorConfig) { - var _this2 = this; + var push$4 = [].push; - if (!customHooks) { - return; - } + var collectionFrom = function from(source /* , mapFn, thisArg */) { + var length = arguments.length; + var mapFn = length > 1 ? arguments[1] : undefined; + var mapping, array, n, boundFunction; + aConstructor(this); + mapping = mapFn !== undefined; + if (mapping) aCallable(mapFn); + if (source == undefined) return new this(); + array = []; + if (mapping) { + n = 0; + boundFunction = functionBindContext(mapFn, length > 2 ? arguments[2] : undefined); + iterate(source, function (nextItem) { + functionCall(push$4, array, boundFunction(nextItem, n++)); + }); + } else { + iterate(source, push$4, { that: array }); + } + return new this(array); + }; - var hookNames = keys$3(customHooks); + // `Map.from` method + // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from + _export({ target: 'Map', stat: true, forced: true }, { + from: collectionFrom + }); - forEach$3(hookNames).call(hookNames, function (hookName) { - /** @type {number} */ - var result; - /** @type {typeof SyntaxBase} */ + // https://tc39.github.io/proposal-setmap-offrom/ + var collectionOf = function of() { + return new this(arraySlice(arguments)); + }; - var HookClass; - var customHookConfig = {}; - var hookClassOrConfig = customHooks[hookName]; + // `Map.of` method + // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of + _export({ target: 'Map', stat: true, forced: true }, { + of: collectionOf + }); - if (isProtoOfSyntaxBase(hookClassOrConfig)) { - HookClass = hookClassOrConfig; - } else if (isCustomSyntaxConfig(hookClassOrConfig)) { - HookClass = hookClassOrConfig.syntaxClass; - customHookConfig.force = Boolean(hookClassOrConfig.force); + // https://github.com/tc39/collection-methods + var collectionDeleteAll = function deleteAll(/* ...elements */) { + var collection = anObject(this); + var remover = aCallable(collection['delete']); + var allDeleted = true; + var wasDeleted; + for (var k = 0, len = arguments.length; k < len; k++) { + wasDeleted = functionCall(remover, collection, arguments[k]); + allDeleted = allDeleted && wasDeleted; + } + return !!allDeleted; + }; - if (hookClassOrConfig.before) { - customHookConfig.before = hookClassOrConfig.before; - } else if (hookClassOrConfig.after) { - customHookConfig.after = hookClassOrConfig.after; - } - } else { - return; - } + // `Map.prototype.deleteAll` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + deleteAll: collectionDeleteAll + }); - if (isHookValid(HookClass)) { - // 自定义Hook标识 - defineProperty$5(HookClass, 'Cherry$$CUSTOM', { - enumerable: false, - configurable: false, - writable: false, - value: true - }); + // `Map.prototype.emplace` method + // https://github.com/thumbsupep/proposal-upsert + var mapEmplace = function emplace(key, handler) { + var map = anObject(this); + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); + var value = (functionCall(has, map, key) && 'update' in handler) + ? handler.update(functionCall(get, map, key), key, map) + : handler.insert(key, map); + functionCall(set, map, key, value); + return value; + }; - result = _this2.register(HookClass, editorConfig, customHookConfig); - } else { - result = WARN_NOT_A_VALID_HOOK; - } + // `Map.prototype.emplace` method + // https://github.com/thumbsupep/proposal-upsert + _export({ target: 'Map', proto: true, real: true, forced: true }, { + emplace: mapEmplace + }); - processWarning(result, HookClass, undefined); - }); - } - }, { - key: "getHookList", - value: function getHookList() { - return this.hookList; - } - }, { - key: "getHookNameList", - value: function getHookNameList() { - return this.hookNameList; - } - /** - * - * @param {((...args: any[]) => any) | typeof SyntaxBase} HookClass - * @param {Partial} editorConfig - * @param {Omit} [customHookConfig] - * @returns - */ + var getMapIterator = getIterator; - }, { - key: "register", - value: function register(HookClass, editorConfig, customHookConfig) { - // filter Configs Here - var externals = editorConfig.externals, - engine = editorConfig.engine; - var syntax = engine.syntax; - /** @type {SyntaxBase | CustomSyntax} */ + // `Map.prototype.every` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + every: function every(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return !iterate(iterator, function (key, value, stop) { + if (!boundFunction(value, key, map)) return stop(); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; + } + }); - var instance; - /** @type {string} */ + var SPECIES$4 = wellKnownSymbol('species'); - var hookName; // 首先校验Hook是否合法 + // `SpeciesConstructor` abstract operation + // https://tc39.es/ecma262/#sec-speciesconstructor + var speciesConstructor = function (O, defaultConstructor) { + var C = anObject(O).constructor; + var S; + return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aConstructor(S); + }; - if (!isHookValid(HookClass)) { - // 可能是一个function hook - if (typeof HookClass === 'function') { - var funcHook = HookClass; - instance = funcHook(editorConfig); + // `Map.prototype.filter` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + filter: function filter(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); + var setter = aCallable(newMap.set); + iterate(iterator, function (key, value) { + if (boundFunction(value, key, map)) functionCall(setter, newMap, key, value); + }, { AS_ENTRIES: true, IS_ITERATOR: true }); + return newMap; + } + }); - if (!instance || !isHookValid(instance.constructor)) { - return WARN_NOT_A_VALID_HOOK; - } + // `Map.prototype.find` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + find: function find(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return iterate(iterator, function (key, value, stop) { + if (boundFunction(value, key, map)) return stop(value); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; + } + }); - hookName = instance.getName(); - } else { - return WARN_NOT_A_VALID_HOOK; - } - } else { - hookName = HookClass.HOOK_NAME; // TODO: 需要考虑自定义 hook 配置的传入方式 + // `Map.prototype.findKey` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + findKey: function findKey(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return iterate(iterator, function (key, value, stop) { + if (boundFunction(value, key, map)) return stop(key); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; + } + }); - var config = (syntax === null || syntax === void 0 ? void 0 : syntax[hookName]) || {}; - instance = new HookClass({ - externals: externals, - config: config, - globalConfig: engine.global - }); - } // TODO: 待校验是否需要跳过禁用的自定义 hook - // Skip Disabled Internal Hooks + var push$5 = functionUncurryThis([].push); + // `Map.groupBy` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', stat: true, forced: true }, { + groupBy: function groupBy(iterable, keyDerivative) { + aCallable(keyDerivative); + var iterator = getIterator(iterable); + var newMap = new this(); + var has = aCallable(newMap.has); + var get = aCallable(newMap.get); + var set = aCallable(newMap.set); + iterate(iterator, function (element) { + var derivedKey = keyDerivative(element); + if (!functionCall(has, newMap, derivedKey)) functionCall(set, newMap, derivedKey, [element]); + else push$5(functionCall(get, newMap, derivedKey), element); + }, { IS_ITERATOR: true }); + return newMap; + } + }); - if (syntax[hookName] === false && !isRegisteredCustomSyntaxClass(HookClass)) { - return; - } // 下面处理的都是 CustomSyntax + // `SameValueZero` abstract operation + // https://tc39.es/ecma262/#sec-samevaluezero + var sameValueZero = function (x, y) { + // eslint-disable-next-line no-self-compare -- NaN check + return x === y || x != x && y != y; + }; + // `Map.prototype.includes` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + includes: function includes(searchElement) { + return iterate(getMapIterator(anObject(this)), function (key, value, stop) { + if (sameValueZero(value, searchElement)) return stop(); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; + } + }); - var hookType = instance.getType(); + // `Map.keyBy` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', stat: true, forced: true }, { + keyBy: function keyBy(iterable, keyDerivative) { + var newMap = new this(); + aCallable(keyDerivative); + var setter = aCallable(newMap.set); + iterate(iterable, function (element) { + functionCall(setter, newMap, keyDerivative(element), element); + }); + return newMap; + } + }); - if (this.hookNameList[hookName]) { - var _context4; + // `Map.prototype.keyOf` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + keyOf: function keyOf(searchElement) { + return iterate(getMapIterator(anObject(this)), function (key, value, stop) { + if (value === searchElement) return stop(key); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result; + } + }); - // 内置 hook 重名 - if (!isRegisteredCustomSyntaxClass(HookClass)) { - return WARN_DUPLICATED; - } // 自定义 hook 重名且没有开启覆盖的选项 + // `Map.prototype.mapKeys` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + mapKeys: function mapKeys(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); + var setter = aCallable(newMap.set); + iterate(iterator, function (key, value) { + functionCall(setter, newMap, boundFunction(value, key, map), value); + }, { AS_ENTRIES: true, IS_ITERATOR: true }); + return newMap; + } + }); + // `Map.prototype.mapValues` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + mapValues: function mapValues(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + var newMap = new (speciesConstructor(map, getBuiltIn('Map')))(); + var setter = aCallable(newMap.set); + iterate(iterator, function (key, value) { + functionCall(setter, newMap, key, boundFunction(value, key, map)); + }, { AS_ENTRIES: true, IS_ITERATOR: true }); + return newMap; + } + }); - if (!customHookConfig.force) { - return WARN_DUPLICATED; - } // 强制覆盖以前的Hook,所以需要移除 + // `Map.prototype.merge` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, { + // eslint-disable-next-line no-unused-vars -- required for `.length` + merge: function merge(iterable /* ...iterables */) { + var map = anObject(this); + var setter = aCallable(map.set); + var argumentsLength = arguments.length; + var i = 0; + while (i < argumentsLength) { + iterate(arguments[i++], setter, { that: map, AS_ENTRIES: true }); + } + return map; + } + }); + var TypeError$i = global_1.TypeError; - var duplicateHookType = this.hookNameList[hookName].type; - this.hookList[duplicateHookType] = filter$3(_context4 = this.hookList[duplicateHookType]).call(_context4, function (hook) { - return hook.getName() !== hookName; - }); + // `Map.prototype.reduce` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + reduce: function reduce(callbackfn /* , initialValue */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var noInitial = arguments.length < 2; + var accumulator = noInitial ? undefined : arguments[1]; + aCallable(callbackfn); + iterate(iterator, function (key, value) { + if (noInitial) { + noInitial = false; + accumulator = value; + } else { + accumulator = callbackfn(accumulator, value, key, map); } + }, { AS_ENTRIES: true, IS_ITERATOR: true }); + if (noInitial) throw TypeError$i('Reduce of empty map with no initial value'); + return accumulator; + } + }); - this.hookNameList[hookName] = { - type: hookType - }; - this.hookList[hookType] = this.hookList[hookType] || []; // 内置Hook直接push到结尾 + // `Set.prototype.some` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + some: function some(callbackfn /* , thisArg */) { + var map = anObject(this); + var iterator = getMapIterator(map); + var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined); + return iterate(iterator, function (key, value, stop) { + if (boundFunction(value, key, map)) return stop(); + }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped; + } + }); - if (!isRegisteredCustomSyntaxClass(HookClass)) { - this.hookList[hookType].push(instance); - return; - } // 插入自定义Hook + var TypeError$j = global_1.TypeError; + // `Set.prototype.update` method + // https://github.com/tc39/proposal-collection-methods + _export({ target: 'Map', proto: true, real: true, forced: true }, { + update: function update(key, callback /* , thunk */) { + var map = anObject(this); + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); + var length = arguments.length; + aCallable(callback); + var isPresentInMap = functionCall(has, map, key); + if (!isPresentInMap && length < 3) { + throw TypeError$j('Updating absent value'); + } + var value = isPresentInMap ? functionCall(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map); + functionCall(set, map, key, callback(value, key, map)); + return map; + } + }); - var insertIndex = -1; + var TypeError$k = global_1.TypeError; - if (customHookConfig.before) { - var _context5; + // `Map.prototype.upsert` method + // https://github.com/thumbsupep/proposal-upsert + var mapUpsert = function upsert(key, updateFn /* , insertFn */) { + var map = anObject(this); + var get = aCallable(map.get); + var has = aCallable(map.has); + var set = aCallable(map.set); + var insertFn = arguments.length > 2 ? arguments[2] : undefined; + var value; + if (!isCallable(updateFn) && !isCallable(insertFn)) { + throw TypeError$k('At least one callback required'); + } + if (functionCall(has, map, key)) { + value = functionCall(get, map, key); + if (isCallable(updateFn)) { + value = updateFn(value); + functionCall(set, map, key, value); + } + } else if (isCallable(insertFn)) { + value = insertFn(); + functionCall(set, map, key, value); + } return value; + }; - insertIndex = findIndex$3(_context5 = this.hookList[hookType]).call(_context5, function (hook) { - return hook.getName() === customHookConfig.before; - }); + // TODO: remove from `core-js@4` - if (insertIndex === -1) { - var _context6; - Logger.warn(concat$5(_context6 = "Cannot find hook named [".concat(customHookConfig.before, "],\n custom hook [")).call(_context6, hookName, "] will append to the end of the hooks.")); - } - } else if (customHookConfig.after) { - var _context7, _context8; - insertIndex = findIndex$3(_context7 = this.hookList[hookType]).call(_context7, function (hook) { - return hook.getName() === customHookConfig.after; - }); - insertIndex === -1 ? Logger.warn(concat$5(_context8 = "Cannot find hook named [".concat(customHookConfig.after, "],\n custom hook [")).call(_context8, hookName, "] will append to the end of the hooks.")) : insertIndex += 1; // 统一处理往前插入的逻辑,所以要插入某Hook之后,索引需要加一 - } // 无需插入或目标索引为数组结尾 + // `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`) + // https://github.com/thumbsupep/proposal-upsert + _export({ target: 'Map', proto: true, real: true, forced: true }, { + upsert: mapUpsert + }); + // TODO: remove from `core-js@4` - if (insertIndex < 0 || insertIndex >= this.hookList[hookType].length) { - this.hookList[hookType].push(instance); - } else { - var _context9; - splice$4(_context9 = this.hookList[hookType]).call(_context9, insertIndex, 0, instance); - } // console.log(this.hookList[hookType]); - } - }]); + // `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`) + // https://github.com/thumbsupep/proposal-upsert + _export({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, { + updateOrInsert: mapUpsert + }); - return HookCenter; - }(); + // TODO: remove from `core-js@4` - /** - * Copyright (C) 2021 THL A29 Limited, a Tencent company. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - function compileRegExp(obj, flags, allowExtendedFlags) { - var source = obj.begin + obj.content + obj.end; + // TODO: remove from `core-js@4` - if (allowExtendedFlags) { - // Extend \h for horizontal whitespace - source = source.replace(/\[\\h\]/g, HORIZONTAL_WHITESPACE).replace(/\\h/g, HORIZONTAL_WHITESPACE); - } - return new RegExp(source, flags || 'g'); - } - function isLookbehindSupported() { - try { - new RegExp('(?<=.)'); - return true; - } catch (ignore) {} + var map$7 = map$6; - return false; + var map$8 = map$7; + + var map$9 = map$8; + + var isNativeFunction = createCommonjsModule(function (module) { + function _isNativeFunction(fn) { + var _context; + + return indexOf$7(_context = Function.toString.call(fn)).call(_context, "[native code]") !== -1; } - var HORIZONTAL_WHITESPACE = "[ \\t\\u00a0]"; // 仅适用非多行模式的正则 - var ALLOW_WHITESPACE_MULTILINE = '(?:.*?)(?:(?:\\n.*?)*?)'; - var DO_NOT_STARTS_AND_END_WITH_SPACES_MULTILINE_ALLOW_EMPTY = '(?:(?:\\S|(?:\\S.*?\\S))(?:[ \\t]*\\n.*?)*?)'; - var NOT_ALL_WHITE_SPACES_INLINE = '(?:[^\\n]*?\\S[^\\n]*?)'; - // !, ", #, $, %, &, ', (, ), *, +, ,, -, ., / (U+0021–2F), - // :, ;, <, =, >, ?, @ (U+003A–0040), - // [, \, ], ^, _, ` (U+005B–0060), - // {, |, }, or ~ (U+007B–007E). + module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports; + }); - var PUNCTUATION = "[\\u0021-\\u002F\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e]"; // extra punctuations + unwrapExports(isNativeFunction); - var UNDERSCORE_EMPHASIS_BOUNDARY = '[' + "\\u0021-\\u002F\\u003a-\\u0040\\u005b\\u005d\\u005e\\u0060\\u007b-\\u007e" + // punctuations defined in commonmark - ' ' + '\\t\\n' + '!“”¥‘’(),。—:;《》?【】「」·~|' + // chinese punctuations - ']'; // https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail) + var construct$5 = construct$3; - var EMAIL_INLINE = new RegExp([/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+/.source, '@', /[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])?)*/.source].join('')); - var EMAIL = new RegExp("^".concat(EMAIL_INLINE.source, "$")); // https://gist.github.com/dperini/729294 - // [USERNAME[:PASSWORD]@](IP|HOST)[:PORT][/SOURCE_PATH?QUERY_PARAMS#HASH] + var construct$6 = construct$5; - var URL_INLINE_NO_SLASH = new RegExp('' + // 针对eslint的特殊处理 - '(?:\\S+(?::\\S*)?@)?' + '(?:' + // IP address exclusion - // IP address dotted notation octets - // excludes loopback network 0.0.0.0 - // excludes reserved space >= 224.0.0.0 - // excludes network & broadcast addresses - // (first & last IP address of each class) - '(?:1\\d\\d|2[01]\\d|22[0-3]|[1-9]\\d?)' + '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' + '(?:\\.(?:1\\d\\d|2[0-4]\\d|25[0-4]|[1-9]\\d?))' + '|' + // host & domain names, may end with dot - '(?![-_])(?:[-\\w\\xa1-\\xff]{0,63}[^-_]\\.)+' + // TLD identifier name, may end with dot - '(?:[a-zA-Z\\xa1-\\xff]{2,}\\.?)' + ')' + // port number (optional) - '(?::\\d{2,5})?' + // resource path (optional) - '(?:[/?#][^\\s<>\\x00-\\x1f"\\(\\)]*)?'); - var URL_INLINE = new RegExp( // eslint特殊处理 - // protocol identifier (optional) - // short syntax // still required - // '(?:(?:(?:https?|ftp):)?\\/\\/)' + - "(?:\\/\\/)".concat(URL_INLINE_NO_SLASH.source)); - var URL_NO_SLASH = new RegExp("^".concat(URL_INLINE_NO_SLASH.source, "$")); - var URL$1 = new RegExp("^".concat(URL_INLINE.source, "$")); - function getTableRule() { - var _context; + var construct$7 = construct$6; - var merge = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - // ^(\|[^\n]+\|\r?\n)((?:\|:?[-]+:?)+\|)(\n(?:\|[^\n]+\|\r?\n?)*)?$ - // (\\|?[^\\n|]+\\|?\\n)(?:\\|?[\\s]*:?[-]{2,}:?[\\s]* - // (?:\\|[\\s]*:?[-]{2,}:?[\\s]*)+\\|?)(\\n\\|?(\\|[^\\n|]+)*\\|?)? + var construct$8 = construct$7; - /** - * (\|[^\n]+\|\n) Headers - * ((\|[\s]*:?[-]{2,}:?[\s]*)+\|) Column Options - * ((?:\n\|[^\n]+\|)*) Rows - */ - var strict = { - begin: '(?:^|\\n)(\\n*)', - content: ['(\\h*\\|[^\\n]+\\|?\\h*)', // Header - '\\n', '(?:(?:\\h*\\|\\h*:?[-]{1,}:?\\h*)+\\|?\\h*)', // Column Options - '((\\n\\h*\\|[^\\n]+\\|?\\h*)*)' // Rows - ].join(''), - end: '(?=$|\\n)' - }; - strict.reg = compileRegExp(strict, 'g', true); - var loose = { - begin: '(?:^|\\n)(\\n*)', - content: ['(\\|?[^\\n|]+(\\|[^\\n|]+)+\\|?)', // Header - '\\n', '(?:\\|?\\h*:?[-]{1,}:?[\\h]*(?:\\|[\\h]*:?[-]{1,}:?\\h*)+\\|?)', // Column Options - '((\\n\\|?([^\\n|]+(\\|[^\\n|]*)+)\\|?)*)' // Rows - ].join(''), - end: '(?=$|\\n)' - }; - loose.reg = compileRegExp(loose, 'g', true); - - if (merge === false) { - return { - strict: strict, - loose: loose - }; - } - - var regStr = concat$5(_context = "(?:".concat(strict.begin + strict.content + strict.end, "|")).call(_context, loose.begin + loose.content + loose.end, ")"); - - return compileRegExp({ - begin: '', - content: regStr, - end: '' - }, 'g', true); - } - function getCodeBlockRule() { - var codeBlock = { - /** - * (?:^|\n)是区块的通用开头 - * (\n*)捕获区块前的所有换行 - * (?:[^\S\n]*)捕获```前置的空格字符 - * 只要有连续3个及以上`并且前后`的数量相等,则认为是代码快语法 - */ - begin: /(?:^|\n)(\n*(?:[^\S\n]*))(`{3,})([^`]*?)\n/, - content: /([\w\W]*?)/, - // '([\\w\\W]*?)', - end: /[^\S\n]*\2[ \t]*(?=$|\n+)/ // '\\s*```[ \\t]*(?=$|\\n+)', + var bind$6 = bind$4; - }; - codeBlock.reg = new RegExp(codeBlock.begin.source + codeBlock.content.source + codeBlock.end.source, 'g'); - return codeBlock; - } - /** - * 从selection里获取列表语法 - * @param {*} selection - * @param {('ol'|'ul'|'checklist')} type 列表类型 - * @returns {String} - */ + var bind$7 = bind$6; - function getListFromStr(selection, type) { - var $selection = selection ? selection : 'No.1\n No.1.1\nNo.2'; - $selection = $selection.replace(/^\n+/, '').replace(/\n+$/, ''); - var pre = '1.'; + var bind$8 = bind$7; - switch (type) { - case 'ol': - pre = '1.'; - break; + var bind$9 = bind$8; - case 'ul': - pre = '-'; - break; + var isNativeReflectConstruct = createCommonjsModule(function (module) { + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !construct$8) return false; + if (construct$8.sham) return false; + if (typeof Proxy === "function") return true; - case 'checklist': - pre = '- [x]'; - break; + try { + Boolean.prototype.valueOf.call(construct$8(Boolean, [], function () {})); + return true; + } catch (e) { + return false; } + } - $selection = $selection.replace(/^(\s*)([0-9a-zA-Z]+\.|- \[x\]|- \[ \]|-) /gm, '$1'); // 对有序列表进行序号自增处理 + module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports; + }); - if (pre === '1.') { - var listNum = {}; - $selection = $selection.replace(/^(\s*)(\S[\s\S]*?)$/gm, function (match, p1, p2) { - var _p1$match, _context2, _context3; + unwrapExports(isNativeReflectConstruct); - var space = ((_p1$match = p1.match(/[ \t]/g)) === null || _p1$match === void 0 ? void 0 : _p1$match.length) || 0; - listNum[space] = listNum[space] ? listNum[space] + 1 : 1; - return concat$5(_context2 = concat$5(_context3 = "".concat(p1)).call(_context3, listNum[space], ". ")).call(_context2, p2); - }); + var construct$9 = createCommonjsModule(function (module) { + function _construct(Parent, args, Class) { + if (isNativeReflectConstruct()) { + module.exports = _construct = construct$8, module.exports.__esModule = true, module.exports["default"] = module.exports; } else { - $selection = $selection.replace(/^(\s*)(\S[\s\S]*?)$/gm, "$1".concat(pre, " $2")); - } - - return $selection; - } - - var arrayWithoutHoles = createCommonjsModule(function (module) { - function _arrayWithoutHoles(arr) { - if (isArray$7(arr)) return arrayLikeToArray(arr); - } + module.exports = _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); - module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + var Constructor = bind$9(Function).apply(Parent, a); - unwrapExports(arrayWithoutHoles); + var instance = new Constructor(); + if (Class) setPrototypeOf$6(instance, Class.prototype); + return instance; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + } - var iterableToArray = createCommonjsModule(function (module) { - function _iterableToArray(iter) { - if (typeof symbol$5 !== "undefined" && getIteratorMethod$5(iter) != null || iter["@@iterator"] != null) return from_1$5(iter); + return _construct.apply(null, arguments); } - module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; }); - unwrapExports(iterableToArray); + var _construct = unwrapExports(construct$9); - var nonIterableSpread = createCommonjsModule(function (module) { - function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } + var wrapNativeSuper = createCommonjsModule(function (module) { + function _wrapNativeSuper(Class) { + var _cache = typeof map$9 === "function" ? new map$9() : undefined; - module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !isNativeFunction(Class)) return Class; - unwrapExports(nonIterableSpread); + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } - var toConsumableArray = createCommonjsModule(function (module) { - function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); - } + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); - module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - }); + _cache.set(Class, Wrapper); + } - var _toConsumableArray = unwrapExports(toConsumableArray); + function Wrapper() { + return construct$9(Class, arguments, getPrototypeOf$6(this).constructor); + } - var toArray = createCommonjsModule(function (module) { - function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); + Wrapper.prototype = create$5(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return setPrototypeOf$6(Wrapper, Class); + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + return _wrapNativeSuper(Class); } - module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; }); - var _toArray = unwrapExports(toArray); + var _wrapNativeSuper = unwrapExports(wrapNativeSuper); - function ownKeys$1(object, enumerableOnly) { var keys = keys$3(object); if (getOwnPropertySymbols$2) { var symbols = getOwnPropertySymbols$2(object); enumerableOnly && (symbols = filter$3(symbols).call(symbols, function (sym) { return getOwnPropertyDescriptor$3(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } + function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? forEach$3(_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : getOwnPropertyDescriptors$2 ? defineProperties$2(target, getOwnPropertyDescriptors$2(source)) : forEach$3(_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { defineProperty$5(target, key, getOwnPropertyDescriptor$3(source, key)); }); } return target; } + function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** * Copyright (C) 2021 THL A29 Limited, a Tencent company. @@ -24745,6866 +24796,7023 @@ */ /** - * - * @param {string} str - * @param {{replacedText:string;begin:number;length:number;}[]} buffer + * 三个地方的错误异常校验 + * 1. markdown 对象参数校验 + * 2. editText 用户输入校验,执行engine过程以防异常 + * 3. 自定义hook校验 对外开发者开发标准校验 */ - function replaceStringByBuffer(str, buffer) { - if (!buffer.length) { - return str; + var $expectTarget = function $expectTarget(target, Constructor) { + if (!isArray$8(target) && _typeof(target) !== Constructor.name.toLowerCase() || !isArray$8(target) && Constructor.name.toLowerCase() === 'array') { + throw new TypeError("parameter given must be ".concat(Constructor.name)); } - var slicedString = []; - var offset = 0; - - forEach$3(buffer).call(buffer, function (buf, index) { - slicedString.push(slice$7(str).call(str, offset, buf.begin)); - slicedString.push(buf.replacedText); - offset = buf.begin + buf.length; + return true; + }; + var $expectInherit = function $expectInherit(target, parent) { + if (!(target instanceof parent)) { + throw new Error('the hook does not correctly inherit'); + } - if (index === buffer.length - 1) { - slicedString.push(slice$7(str).call(str, offset)); - } - }); // console.log(slicedString, slicedString.join('')); + return true; + }; + var $expectInstance = function $expectInstance(target) { + if (_typeof(target) !== 'object') { + throw new Error('the hook must be a instance, not a class'); + } + return true; + }; // ref: https://github.com/mdlavin/nested-error-stacks - return slicedString.join(''); - } - /** - * @param {string} str 原始字符串 - * @param {RegExp} regex 正则 - * @param {(...args: any[])=>string} replacer 字符串替换函数 - * @param {boolean} [continuousMatch=false] 是否连续匹配,主要用于需要后向断言的连续语法匹配 - * @param {number} [rollbackLength=1] 连续匹配时,每次指针回退的长度,默认为 1 - */ + var NestedError = /*#__PURE__*/function (_Error) { + _inherits(NestedError, _Error); + var _super = _createSuper$1(NestedError); - function replaceLookbehind(str, regex, replacer) { - var continuousMatch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - var rollbackLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + function NestedError(message, nested) { + var _this; - if (!regex) { - return str; - } // 从头开始匹配 + _classCallCheck(this, NestedError); + _this = _super.call(this, message); + _this.name = 'Error'; + _this.stack = _this.buildStackTrace(nested); + return _this; + } - regex.lastIndex = 0; - var args; - var lastIndex = 0; - var replaceBuffer = []; + _createClass(NestedError, [{ + key: "buildStackTrace", + value: function buildStackTrace(nested) { + var _context; - while ((args = regex.exec(str)) !== null) { - var replaceInfo = { - begin: args.index, - length: args[0].length - }; + var stack = nested && nested.stack ? nested.stack : ''; - if (continuousMatch && args.index === lastIndex - rollbackLength) { - var _context; + var newStack = concat$5(_context = "".concat(this.stack, "\nCaused By: ")).call(_context, stack); - var _args = args, - _args2 = _toArray(_args), - match = _args2[0], - restArgs = slice$7(_args2).call(_args2, 2); // 丢弃 leadingChar,需要调整begin和length + return newStack; + } + }]); + return NestedError; + }( /*#__PURE__*/_wrapNativeSuper(Error)); - replaceBuffer.push({ - begin: replaceInfo.begin + rollbackLength, - length: replaceInfo.length - rollbackLength, - replacedText: replacer.apply(void 0, concat$5(_context = [slice$7(match).call(match, rollbackLength), '']).call(_context, _toConsumableArray(restArgs))) - }); - } else { - replaceBuffer.push(_objectSpread(_objectSpread({}, replaceInfo), {}, { - replacedText: replacer.apply(void 0, _toConsumableArray(args)) - })); - } // console.log(args); + /** + * @typedef {import('~types/cherry').CherryOptions} CherryOptions + * @typedef {import('~types/cherry').CherryEngineOptions} CherryEngineOptions + * @typedef {import('~types/cherry').CustomSyntaxRegConfig} CustomSyntaxRegConfig + * @typedef { (SyntaxBase | ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntax + * @typedef { (typeof SyntaxBase | typeof ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntaxClass + */ + var WARN_DUPLICATED = -1; + var WARN_NOT_A_VALID_HOOK = -2; + /** + * 处理报错信息,在dev模式下才会输出报错信息 + * @param {number} type + * @param {any} objClass + * @param {number} index + */ - lastIndex = regex.lastIndex; - regex.lastIndex -= rollbackLength; - } // 正则复位,避免影响其他逻辑 + function processWarning(type, objClass, index) { + if (type === WARN_DUPLICATED) { + var _context, _context2; + Logger.warn(concat$5(_context = concat$5(_context2 = "Duplicate hook name [".concat(objClass.HOOK_NAME, "] found, hook [")).call(_context2, objClass.toString(), "] ")).call(_context, isNaN(index) ? '' : "at index [".concat(index, "] "), "will not take effect.")); + } else if (type === WARN_NOT_A_VALID_HOOK) { + var _context3; - regex.lastIndex = 0; - return replaceStringByBuffer(str, replaceBuffer); + Logger.warn(concat$5(_context3 = "Hook [".concat(objClass.toString(), "] ")).call(_context3, isNaN(index) ? '' : "at index [".concat(index, "] "), "is not a valid hook, and will not take effect.")); + } } + /** + * 是否一个合法的 HookClass + * @param {any} HookClass + * @returns { HookClass is (typeof SyntaxBase | typeof ParagraphBase) } + */ - function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + function isHookValid(HookClass) { + return isProtoOfSyntaxBase(HookClass) || isProtoOfParagraphBase(HookClass); + } + /** + * 传入的类是否 SyntaxBase 的子类 + * @param {any} value + * @returns { value is typeof SyntaxBase } + */ - var Color = /*#__PURE__*/function (_SyntaxBase) { - _inherits(Color, _SyntaxBase); - var _super = _createSuper$2(Color); + function isProtoOfSyntaxBase(value) { + return Object.prototype.isPrototypeOf.call(SyntaxBase, value); + } + /** + * 传入的类是否 ParagraphBase 的子类 + * @param {any} value + * @returns { value is typeof ParagraphBase } + */ - function Color() { - _classCallCheck(this, Color); - return _super.apply(this, arguments); - } + function isProtoOfParagraphBase(value) { + return Object.prototype.isPrototypeOf.call(ParagraphBase, value); + } + /** + * 是否一个配置型的自定义语法 + * @param {any} value + * @returns { value is CustomSyntaxRegConfig } + */ - _createClass(Color, [{ - key: "toHtml", - value: // constructor() { - // super(); - // } - function toHtml(whole, leadingChar, m1, m2) { - var _context, _context2; - return concat$5(_context = concat$5(_context2 = "".concat(leadingChar, "")).call(_context, m2, ""); - } - }, { - key: "makeHtml", - value: function makeHtml(str) { - if (isLookbehindSupported()) { - return str.replace(this.RULE.reg, this.toHtml); - } + function isCustomSyntaxConfig(value) { + var syntaxClass = + /** @type {any} */ - return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1); - } - }, { - key: "rule", - value: function rule() { - var ret = { - begin: isLookbehindSupported() ? '((?} editorConfig + */ + function HookCenter(hooksConfig, editorConfig) { + _classCallCheck(this, HookCenter); - var BackgroundColor = /*#__PURE__*/function (_SyntaxBase) { - _inherits(BackgroundColor, _SyntaxBase); + /** + * @property + * @type {Record} hookList hook 名称 -> hook 类型的映射 + */ + this.hookList = + /** @type {any} */ + {}; + /** + * @property + * @type {Record} hookNameList hook 名称 -> hook 类型的映射 + */ - var _super = _createSuper$3(BackgroundColor); + this.hookNameList = {}; + $expectTarget(hooksConfig, Array); + this.registerInternalHooks(hooksConfig, editorConfig); + this.registerCustomHooks(editorConfig.engine.customSyntax, editorConfig); + } + /** + * 注册系统默认的语法hook + * @param {any[]} hooksConfig 在hookconfig.js里定义的配置 + * @param {Partial} editorConfig 编辑器配置 + */ - function BackgroundColor() { - _classCallCheck(this, BackgroundColor); - return _super.apply(this, arguments); - } + _createClass(HookCenter, [{ + key: "registerInternalHooks", + value: function registerInternalHooks(hooksConfig, editorConfig) { + var _this = this; - _createClass(BackgroundColor, [{ - key: "toHtml", - value: // constructor() { - // super(); - // } - function toHtml(whole, leadingChar, m1, m2) { - var _context, _context2; + forEach$3(hooksConfig).call(hooksConfig, + /** + * + * @param {typeof SyntaxBase} HookClass + * @param {number} index + */ + function (HookClass, index) { + var result = _this.register(HookClass, editorConfig); - return concat$5(_context = concat$5(_context2 = "".concat(leadingChar, "")).call(_context, m2, ""); + processWarning(result, HookClass, index); + }); } - }, { - key: "makeHtml", - value: function makeHtml(str) { - if (isLookbehindSupported()) { - return str.replace(this.RULE.reg, this.toHtml); - } + /** + * 注册第三方的语法hook + * @param {CherryEngineOptions['customSyntax']} customHooks 用户传入的配置 + * @param {Partial} editorConfig 编辑器配置 + */ - return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1); - } }, { - key: "rule", - value: function rule() { - var ret = { - begin: isLookbehindSupported() ? '((?")).call(_context, m3, ""); + processWarning(result, HookClass, undefined); + }); } }, { - key: "makeHtml", - value: function makeHtml(str) { - if (!this.test(str)) { - return str; - } - - if (isLookbehindSupported()) { - return str.replace(this.RULE.reg, this.toHtml); - } - - return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1); + key: "getHookList", + value: function getHookList() { + return this.hookList; } }, { - key: "rule", - value: function rule() { - var ret = { - begin: isLookbehindSupported() ? '((? any) | typeof SyntaxBase} HookClass + * @param {Partial} editorConfig + * @param {Omit} [customHookConfig] + * @returns + */ - return Size; - }(SyntaxBase); + }, { + key: "register", + value: function register(HookClass, editorConfig, customHookConfig) { + // filter Configs Here + var externals = editorConfig.externals, + engine = editorConfig.engine; + var syntax = engine.syntax; + /** @type {SyntaxBase | CustomSyntax} */ - _defineProperty(Size, "HOOK_NAME", 'fontSize'); + var instance; + /** @type {string} */ - function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + var hookName; // 首先校验Hook是否合法 - function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } - /** - * 删除线语法 - */ + if (!isHookValid(HookClass)) { + // 可能是一个function hook + if (typeof HookClass === 'function') { + var funcHook = HookClass; + instance = funcHook(editorConfig); - var Strikethrough = /*#__PURE__*/function (_SyntaxBase) { - _inherits(Strikethrough, _SyntaxBase); + if (!instance || !isHookValid(instance.constructor)) { + return WARN_NOT_A_VALID_HOOK; + } - var _super = _createSuper$5(Strikethrough); + hookName = instance.getName(); + } else { + return WARN_NOT_A_VALID_HOOK; + } + } else { + hookName = HookClass.HOOK_NAME; // TODO: 需要考虑自定义 hook 配置的传入方式 - function Strikethrough() { - var _this; + var config = (syntax === null || syntax === void 0 ? void 0 : syntax[hookName]) || {}; + instance = new HookClass({ + externals: externals, + config: config, + globalConfig: engine.global + }); + } // TODO: 待校验是否需要跳过禁用的自定义 hook + // Skip Disabled Internal Hooks - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - config: undefined - }, - config = _ref.config; - _classCallCheck(this, Strikethrough); + if (syntax[hookName] === false && !isRegisteredCustomSyntaxClass(HookClass)) { + return; + } // 下面处理的都是 CustomSyntax - _this = _super.call(this, { - config: config - }); - if (!config) { - return _possibleConstructorReturn(_this); - } + var hookType = instance.getType(); - _this.needWhitespace = !!config.needWhitespace; - return _this; - } - /** - * 主要逻辑 - * @param {string} str markdown源码 - * @returns {string} html内容 - */ + if (this.hookNameList[hookName]) { + var _context4; + // 内置 hook 重名 + if (!isRegisteredCustomSyntaxClass(HookClass)) { + return WARN_DUPLICATED; + } // 自定义 hook 重名且没有开启覆盖的选项 - _createClass(Strikethrough, [{ - key: "makeHtml", - value: function makeHtml(str) { - if (!this.test(str)) { - return str; - } - return str.replace(this.RULE.reg, '$1$2'); - } - }, { - key: "rule", - value: function rule() { - var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - config: undefined - }, - config = _ref2.config; + if (!customHookConfig.force) { + return WARN_DUPLICATED; + } // 强制覆盖以前的Hook,所以需要移除 - /** @type {Partial} */ - var ret = {}; - if (!!config.needWhitespace) { - ret = { - begin: '(^|[\\s])\\~T\\~T', - end: '\\~T\\~T(?=\\s|$)', - content: '([\\w\\W]+?)' - }; - } else { - ret = { - begin: '(^|[^\\\\])\\~T\\~T', - end: '\\~T\\~T', - content: '([\\w\\W]+?)' - }; + var duplicateHookType = this.hookNameList[hookName].type; + this.hookList[duplicateHookType] = filter$3(_context4 = this.hookList[duplicateHookType]).call(_context4, function (hook) { + return hook.getName() !== hookName; + }); } - ret.reg = new RegExp(ret.begin + ret.content + ret.end, 'g'); - return ret; - } - }]); + this.hookNameList[hookName] = { + type: hookType + }; + this.hookList[hookType] = this.hookList[hookType] || []; // 内置Hook直接push到结尾 - return Strikethrough; - }(SyntaxBase); + if (!isRegisteredCustomSyntaxClass(HookClass)) { + this.hookList[hookType].push(instance); + return; + } // 插入自定义Hook - _defineProperty(Strikethrough, "HOOK_NAME", 'strikethrough'); - function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = construct$4(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + var insertIndex = -1; - function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !construct$4) return false; if (construct$4.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(construct$4(Boolean, [], function () {})); return true; } catch (e) { return false; } } + if (customHookConfig.before) { + var _context5; - var Sup = /*#__PURE__*/function (_SyntaxBase) { - _inherits(Sup, _SyntaxBase); + insertIndex = findIndex$3(_context5 = this.hookList[hookType]).call(_context5, function (hook) { + return hook.getName() === customHookConfig.before; + }); - var _super = _createSuper$6(Sup); + if (insertIndex === -1) { + var _context6; - function Sup() { - _classCallCheck(this, Sup); + Logger.warn(concat$5(_context6 = "Cannot find hook named [".concat(customHookConfig.before, "],\n custom hook [")).call(_context6, hookName, "] will append to the end of the hooks.")); + } + } else if (customHookConfig.after) { + var _context7, _context8; - return _super.apply(this, arguments); - } + insertIndex = findIndex$3(_context7 = this.hookList[hookType]).call(_context7, function (hook) { + return hook.getName() === customHookConfig.after; + }); + insertIndex === -1 ? Logger.warn(concat$5(_context8 = "Cannot find hook named [".concat(customHookConfig.after, "],\n custom hook [")).call(_context8, hookName, "] will append to the end of the hooks.")) : insertIndex += 1; // 统一处理往前插入的逻辑,所以要插入某Hook之后,索引需要加一 + } // 无需插入或目标索引为数组结尾 - _createClass(Sup, [{ - key: "toHtml", - value: // constructor() { - // super(); - // } - function toHtml(whole, leadingChar, m1) { - var _context; - return concat$5(_context = "".concat(leadingChar, "")).call(_context, m1, ""); - } - }, { - key: "makeHtml", - value: function makeHtml(str) { - if (isLookbehindSupported()) { - return str.replace(this.RULE.reg, this.toHtml); - } + if (insertIndex < 0 || insertIndex >= this.hookList[hookType].length) { + this.hookList[hookType].push(instance); + } else { + var _context9; + + splice$4(_context9 = this.hookList[hookType]).call(_context9, insertIndex, 0, instance); + } // console.log(this.hookList[hookType]); - return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1); - } - }, { - key: "rule", - value: function rule() { - var ret = { - begin: isLookbehindSupported() ? '((?, ?, @ (U+003A–0040), + // [, \, ], ^, _, ` (U+005B–0060), + // {, |, }, or ~ (U+007B–007E). - function Sub() { - _classCallCheck(this, Sub); + var PUNCTUATION = "[\\u0021-\\u002F\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e]"; // extra punctuations - return _super.apply(this, arguments); - } + var UNDERSCORE_EMPHASIS_BOUNDARY = '[' + "\\u0021-\\u002F\\u003a-\\u0040\\u005b\\u005d\\u005e\\u0060\\u007b-\\u007e" + // punctuations defined in commonmark + ' ' + '\\t\\n' + '!“”¥‘’(),。—:;《》?【】「」·~|' + // chinese punctuations + ']'; // https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail) - _createClass(Sub, [{ - key: "toHtml", - value: // constructor() { - // super(); - // } - function toHtml(whole, leadingChar, m1) { - var _context; + var EMAIL_INLINE = new RegExp([/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+/.source, '@', /[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])?)*/.source].join('')); + var EMAIL = new RegExp("^".concat(EMAIL_INLINE.source, "$")); // https://gist.github.com/dperini/729294 + // [USERNAME[:PASSWORD]@](IP|HOST)[:PORT][/SOURCE_PATH?QUERY_PARAMS#HASH] - return concat$5(_context = "".concat(leadingChar, "")).call(_context, m1, ""); - } - }, { - key: "makeHtml", - value: function makeHtml(str) { - if (isLookbehindSupported()) { - return str.replace(this.RULE.reg, this.toHtml); - } + var URL_INLINE_NO_SLASH = new RegExp('' + // 针对eslint的特殊处理 + '(?:\\S+(?::\\S*)?@)?' + '(?:' + // IP address exclusion + // IP address dotted notation octets + // excludes loopback network 0.0.0.0 + // excludes reserved space >= 224.0.0.0 + // excludes network & broadcast addresses + // (first & last IP address of each class) + '(?:1\\d\\d|2[01]\\d|22[0-3]|[1-9]\\d?)' + '(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}' + '(?:\\.(?:1\\d\\d|2[0-4]\\d|25[0-4]|[1-9]\\d?))' + '|' + // host & domain names, may end with dot + '(?![-_])(?:[-\\w\\xa1-\\xff]{0,63}[^-_]\\.)+' + // TLD identifier name, may end with dot + '(?:[a-zA-Z\\xa1-\\xff]{2,}\\.?)' + ')' + // port number (optional) + '(?::\\d{2,5})?' + // resource path (optional) + '(?:[/?#][^\\s<>\\x00-\\x1f"\\(\\)]*)?'); + var URL_INLINE = new RegExp( // eslint特殊处理 + // protocol identifier (optional) + // short syntax // still required + // '(?:(?:(?:https?|ftp):)?\\/\\/)' + + "(?:\\/\\/)".concat(URL_INLINE_NO_SLASH.source)); + var URL_NO_SLASH = new RegExp("^".concat(URL_INLINE_NO_SLASH.source, "$")); + var URL$1 = new RegExp("^".concat(URL_INLINE.source, "$")); + function getTableRule() { + var _context; - return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1); - } - }, { - key: "rule", - value: function rule() { - var ret = { - begin: isLookbehindSupported() ? '((? 0 && arguments[0] !== undefined ? arguments[0] : false; + // ^(\|[^\n]+\|\r?\n)((?:\|:?[-]+:?)+\|)(\n(?:\|[^\n]+\|\r?\n?)*)?$ + // (\\|?[^\\n|]+\\|?\\n)(?:\\|?[\\s]*:?[-]{2,}:?[\\s]* + // (?:\\|[\\s]*:?[-]{2,}:?[\\s]*)+\\|?)(\\n\\|?(\\|[^\\n|]+)*\\|?)? - return Sub; - }(SyntaxBase); + /** + * (\|[^\n]+\|\n) Headers + * ((\|[\s]*:?[-]{2,}:?[\s]*)+\|) Column Options + * ((?:\n\|[^\n]+\|)*) Rows + */ + var strict = { + begin: '(?:^|\\n)(\\n*)', + content: ['(\\h*\\|[^\\n]+\\|?\\h*)', // Header + '\\n', '(?:(?:\\h*\\|\\h*:?[-]{1,}:?\\h*)+\\|?\\h*)', // Column Options + '((\\n\\h*\\|[^\\n]+\\|?\\h*)*)' // Rows + ].join(''), + end: '(?=$|\\n)' + }; + strict.reg = compileRegExp(strict, 'g', true); + var loose = { + begin: '(?:^|\\n)(\\n*)', + content: ['(\\|?[^\\n|]+(\\|[^\\n|]+)+\\|?)', // Header + '\\n', '(?:\\|?\\h*:?[-]{1,}:?[\\h]*(?:\\|[\\h]*:?[-]{1,}:?\\h*)+\\|?)', // Column Options + '((\\n\\|?([^\\n|]+(\\|[^\\n|]*)+)\\|?)*)' // Rows + ].join(''), + end: '(?=$|\\n)' + }; + loose.reg = compileRegExp(loose, 'g', true); - _defineProperty(Sub, "HOOK_NAME", 'sub'); + if (merge === false) { + return { + strict: strict, + loose: loose + }; + } - var prismCore = createCommonjsModule(function (module) { - /// + var regStr = concat$5(_context = "(?:".concat(strict.begin + strict.content + strict.end, "|")).call(_context, loose.begin + loose.content + loose.end, ")"); - var _self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); + return compileRegExp({ + begin: '', + content: regStr, + end: '' + }, 'g', true); + } + function getCodeBlockRule() { + var codeBlock = { + /** + * (?:^|\n)是区块的通用开头 + * (\n*)捕获区块前的所有换行 + * (?:[^\S\n]*)捕获```前置的空格字符 + * 只要有连续3个及以上`并且前后`的数量相等,则认为是代码快语法 + */ + begin: /(?:^|\n)(\n*(?:[^\S\n]*))(`{3,})([^`]*?)\n/, + content: /([\w\W]*?)/, + // '([\\w\\W]*?)', + end: /[^\S\n]*\2[ \t]*(?=$|\n+)/ // '\\s*```[ \\t]*(?=$|\\n+)', + }; + codeBlock.reg = new RegExp(codeBlock.begin.source + codeBlock.content.source + codeBlock.end.source, 'g'); + return codeBlock; + } /** - * Prism: Lightweight, robust, elegant syntax highlighting - * - * @license MIT - * @author Lea Verou - * @namespace - * @public + * 从selection里获取列表语法 + * @param {*} selection + * @param {('ol'|'ul'|'checklist')} type 列表类型 + * @returns {String} */ - var Prism = (function (_self) { - // Private helper vars - var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i; - var uniqueId = 0; + function getListFromStr(selection, type) { + var $selection = selection ? selection : 'No.1\n No.1.1\nNo.2'; + $selection = $selection.replace(/^\n+/, '').replace(/\n+$/, ''); + var pre = '1.'; - // The grammar object for plaintext - var plainTextGrammar = {}; + switch (type) { + case 'ol': + pre = '1.'; + break; + case 'ul': + pre = '-'; + break; - var _ = { - /** - * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the - * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load - * additional languages or plugins yourself. - * - * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. - * - * You obviously have to change this value before the automatic highlighting started. To do this, you can add an - * empty Prism object into the global scope before loading the Prism script like this: - * - * ```js - * window.Prism = window.Prism || {}; - * Prism.manual = true; - * // add a new `.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n }\n stateCDATASequence(c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n }\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n fastForwardTo(c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n }\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n stateInCommentLike(c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n }\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n isTagStartChar(c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n }\n startSpecial(sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n }\n stateBeforeTagName(c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n const lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n }\n stateInTagName(c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateBeforeClosingTagName(c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n }\n stateInClosingTagName(c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n }\n stateAfterClosingTagName(c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeAttributeName(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateInSelfClosingTag(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateInAttributeName(c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n }\n stateAfterAttributeName(c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateBeforeAttributeValue(c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n }\n handleInAttributeValue(c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateInAttributeValueDoubleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n }\n stateInAttributeValueSingleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n }\n stateInAttributeValueNoQuotes(c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateBeforeDeclaration(c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n }\n stateInDeclaration(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateInProcessingInstruction(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeComment(c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n }\n stateInSpecialComment(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeSpecialS(c) {\n const lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n }\n stateBeforeEntity(c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Num) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n }\n stateInNamedEntity(c) {\n this.entityExcess += 1;\n this.trieIndex = determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n const masked = this.trieCurrent & BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n const valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n const entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n }\n emitNamedEntity() {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n const valueLength = (this.entityTrie[this.entityResult] & BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1:\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~BinTrieFlags.VALUE_LENGTH);\n break;\n case 2:\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n }\n stateBeforeNumericEntity(c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n }\n emitNumericEntity(strict) {\n const entityStart = this.index - this.entityExcess - 1;\n const numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint(replaceCodePoint(this.entityResult));\n }\n this.state = this.baseState;\n }\n stateInNumericEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n stateInHexEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n allowLegacyEntity() {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n }\n /**\n * Remove data that has already been consumed from the buffer.\n */\n cleanup() {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n }\n shouldContinue() {\n return this.index < this.buffer.length + this.offset && this.running;\n }\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n if (this.state === State.Text) {\n this.stateText(c);\n }\n else if (this.state === State.SpecialStartSequence) {\n this.stateSpecialStartSequence(c);\n }\n else if (this.state === State.InSpecialTag) {\n this.stateInSpecialTag(c);\n }\n else if (this.state === State.CDATASequence) {\n this.stateCDATASequence(c);\n }\n else if (this.state === State.InAttributeValueDq) {\n this.stateInAttributeValueDoubleQuotes(c);\n }\n else if (this.state === State.InAttributeName) {\n this.stateInAttributeName(c);\n }\n else if (this.state === State.InCommentLike) {\n this.stateInCommentLike(c);\n }\n else if (this.state === State.InSpecialComment) {\n this.stateInSpecialComment(c);\n }\n else if (this.state === State.BeforeAttributeName) {\n this.stateBeforeAttributeName(c);\n }\n else if (this.state === State.InTagName) {\n this.stateInTagName(c);\n }\n else if (this.state === State.InClosingTagName) {\n this.stateInClosingTagName(c);\n }\n else if (this.state === State.BeforeTagName) {\n this.stateBeforeTagName(c);\n }\n else if (this.state === State.AfterAttributeName) {\n this.stateAfterAttributeName(c);\n }\n else if (this.state === State.InAttributeValueSq) {\n this.stateInAttributeValueSingleQuotes(c);\n }\n else if (this.state === State.BeforeAttributeValue) {\n this.stateBeforeAttributeValue(c);\n }\n else if (this.state === State.BeforeClosingTagName) {\n this.stateBeforeClosingTagName(c);\n }\n else if (this.state === State.AfterClosingTagName) {\n this.stateAfterClosingTagName(c);\n }\n else if (this.state === State.BeforeSpecialS) {\n this.stateBeforeSpecialS(c);\n }\n else if (this.state === State.InAttributeValueNq) {\n this.stateInAttributeValueNoQuotes(c);\n }\n else if (this.state === State.InSelfClosingTag) {\n this.stateInSelfClosingTag(c);\n }\n else if (this.state === State.InDeclaration) {\n this.stateInDeclaration(c);\n }\n else if (this.state === State.BeforeDeclaration) {\n this.stateBeforeDeclaration(c);\n }\n else if (this.state === State.BeforeComment) {\n this.stateBeforeComment(c);\n }\n else if (this.state === State.InProcessingInstruction) {\n this.stateInProcessingInstruction(c);\n }\n else if (this.state === State.InNamedEntity) {\n this.stateInNamedEntity(c);\n }\n else if (this.state === State.BeforeEntity) {\n this.stateBeforeEntity(c);\n }\n else if (this.state === State.InHexEntity) {\n this.stateInHexEntity(c);\n }\n else if (this.state === State.InNumericEntity) {\n this.stateInNumericEntity(c);\n }\n else {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n this.index++;\n }\n this.cleanup();\n }\n finish() {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n }\n /** Handle any trailing data. */\n handleTrailingData() {\n const endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n }\n emitPartial(start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n }\n emitCodePoint(cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n }\n}\n//# sourceMappingURL=Tokenizer.js.map","import Tokenizer, { QuoteType } from \"./Tokenizer.js\";\nimport { fromCodePoint } from \"entities/lib/decode.js\";\nconst formTags = new Set([\n \"input\",\n \"option\",\n \"optgroup\",\n \"select\",\n \"button\",\n \"datalist\",\n \"textarea\",\n]);\nconst pTag = new Set([\"p\"]);\nconst tableSectionTags = new Set([\"thead\", \"tbody\"]);\nconst ddtTags = new Set([\"dd\", \"dt\"]);\nconst rtpTags = new Set([\"rt\", \"rp\"]);\nconst openImpliesClose = new Map([\n [\"tr\", new Set([\"tr\", \"th\", \"td\"])],\n [\"th\", new Set([\"th\"])],\n [\"td\", new Set([\"thead\", \"th\", \"td\"])],\n [\"body\", new Set([\"head\", \"link\", \"script\"])],\n [\"li\", new Set([\"li\"])],\n [\"p\", pTag],\n [\"h1\", pTag],\n [\"h2\", pTag],\n [\"h3\", pTag],\n [\"h4\", pTag],\n [\"h5\", pTag],\n [\"h6\", pTag],\n [\"select\", formTags],\n [\"input\", formTags],\n [\"output\", formTags],\n [\"button\", formTags],\n [\"datalist\", formTags],\n [\"textarea\", formTags],\n [\"option\", new Set([\"option\"])],\n [\"optgroup\", new Set([\"optgroup\", \"option\"])],\n [\"dd\", ddtTags],\n [\"dt\", ddtTags],\n [\"address\", pTag],\n [\"article\", pTag],\n [\"aside\", pTag],\n [\"blockquote\", pTag],\n [\"details\", pTag],\n [\"div\", pTag],\n [\"dl\", pTag],\n [\"fieldset\", pTag],\n [\"figcaption\", pTag],\n [\"figure\", pTag],\n [\"footer\", pTag],\n [\"form\", pTag],\n [\"header\", pTag],\n [\"hr\", pTag],\n [\"main\", pTag],\n [\"nav\", pTag],\n [\"ol\", pTag],\n [\"pre\", pTag],\n [\"section\", pTag],\n [\"table\", pTag],\n [\"ul\", pTag],\n [\"rt\", rtpTags],\n [\"rp\", rtpTags],\n [\"tbody\", tableSectionTags],\n [\"tfoot\", tableSectionTags],\n]);\nconst voidElements = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\nconst foreignContextElements = new Set([\"math\", \"svg\"]);\nconst htmlIntegrationElements = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignobject\",\n \"desc\",\n \"title\",\n]);\nconst reNameEnd = /\\s|\\//;\nexport class Parser {\n constructor(cbs, options = {}) {\n var _a, _b, _c, _d, _e;\n this.options = options;\n /** The start index of the last event. */\n this.startIndex = 0;\n /** The end index of the last event. */\n this.endIndex = 0;\n /**\n * Store the start index of the current open tag,\n * so we can update the start index for attributes.\n */\n this.openTagStart = 0;\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribvalue = \"\";\n this.attribs = null;\n this.stack = [];\n this.foreignContext = [];\n this.buffers = [];\n this.bufferOffset = 0;\n /** The index of the last written buffer. Used when resuming after a `pause()`. */\n this.writeIndex = 0;\n /** Indicates whether the parser has finished running / `.end` has been called. */\n this.ended = false;\n this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};\n this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;\n this.lowerCaseAttributeNames =\n (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;\n this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer)(this.options, this);\n (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);\n }\n // Tokenizer event handlers\n /** @internal */\n ontext(start, endIndex) {\n var _a, _b;\n const data = this.getSlice(start, endIndex);\n this.endIndex = endIndex - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);\n this.startIndex = endIndex;\n }\n /** @internal */\n ontextentity(cp) {\n var _a, _b;\n /*\n * Entities can be emitted on the character, or directly after.\n * We use the section start here to get accurate indices.\n */\n const idx = this.tokenizer.getSectionStart();\n this.endIndex = idx - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, fromCodePoint(cp));\n this.startIndex = idx;\n }\n isVoidElement(name) {\n return !this.options.xmlMode && voidElements.has(name);\n }\n /** @internal */\n onopentagname(start, endIndex) {\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n this.emitOpenTag(name);\n }\n emitOpenTag(name) {\n var _a, _b, _c, _d;\n this.openTagStart = this.startIndex;\n this.tagname = name;\n const impliesClose = !this.options.xmlMode && openImpliesClose.get(name);\n if (impliesClose) {\n while (this.stack.length > 0 &&\n impliesClose.has(this.stack[this.stack.length - 1])) {\n const el = this.stack.pop();\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, el, true);\n }\n }\n if (!this.isVoidElement(name)) {\n this.stack.push(name);\n if (foreignContextElements.has(name)) {\n this.foreignContext.push(true);\n }\n else if (htmlIntegrationElements.has(name)) {\n this.foreignContext.push(false);\n }\n }\n (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);\n if (this.cbs.onopentag)\n this.attribs = {};\n }\n endOpenTag(isImplied) {\n var _a, _b;\n this.startIndex = this.openTagStart;\n if (this.attribs) {\n (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied);\n this.attribs = null;\n }\n if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {\n this.cbs.onclosetag(this.tagname, true);\n }\n this.tagname = \"\";\n }\n /** @internal */\n onopentagend(endIndex) {\n this.endIndex = endIndex;\n this.endOpenTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onclosetag(start, endIndex) {\n var _a, _b, _c, _d, _e, _f;\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n if (foreignContextElements.has(name) ||\n htmlIntegrationElements.has(name)) {\n this.foreignContext.pop();\n }\n if (!this.isVoidElement(name)) {\n const pos = this.stack.lastIndexOf(name);\n if (pos !== -1) {\n if (this.cbs.onclosetag) {\n let count = this.stack.length - pos;\n while (count--) {\n // We know the stack has sufficient elements.\n this.cbs.onclosetag(this.stack.pop(), count !== 0);\n }\n }\n else\n this.stack.length = pos;\n }\n else if (!this.options.xmlMode && name === \"p\") {\n // Implicit open before close\n this.emitOpenTag(\"p\");\n this.closeCurrentTag(true);\n }\n }\n else if (!this.options.xmlMode && name === \"br\") {\n // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.\n (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, \"br\");\n (_d = (_c = this.cbs).onopentag) === null || _d === void 0 ? void 0 : _d.call(_c, \"br\", {}, true);\n (_f = (_e = this.cbs).onclosetag) === null || _f === void 0 ? void 0 : _f.call(_e, \"br\", false);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onselfclosingtag(endIndex) {\n this.endIndex = endIndex;\n if (this.options.xmlMode ||\n this.options.recognizeSelfClosing ||\n this.foreignContext[this.foreignContext.length - 1]) {\n this.closeCurrentTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n else {\n // Ignore the fact that the tag is self-closing.\n this.onopentagend(endIndex);\n }\n }\n closeCurrentTag(isOpenImplied) {\n var _a, _b;\n const name = this.tagname;\n this.endOpenTag(isOpenImplied);\n // Self-closing tags will be on the top of the stack\n if (this.stack[this.stack.length - 1] === name) {\n // If the opening tag isn't implied, the closing tag has to be implied.\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied);\n this.stack.pop();\n }\n }\n /** @internal */\n onattribname(start, endIndex) {\n this.startIndex = start;\n const name = this.getSlice(start, endIndex);\n this.attribname = this.lowerCaseAttributeNames\n ? name.toLowerCase()\n : name;\n }\n /** @internal */\n onattribdata(start, endIndex) {\n this.attribvalue += this.getSlice(start, endIndex);\n }\n /** @internal */\n onattribentity(cp) {\n this.attribvalue += fromCodePoint(cp);\n }\n /** @internal */\n onattribend(quote, endIndex) {\n var _a, _b;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double\n ? '\"'\n : quote === QuoteType.Single\n ? \"'\"\n : quote === QuoteType.NoValue\n ? undefined\n : null);\n if (this.attribs &&\n !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {\n this.attribs[this.attribname] = this.attribvalue;\n }\n this.attribvalue = \"\";\n }\n getInstructionName(value) {\n const idx = value.search(reNameEnd);\n let name = idx < 0 ? value : value.substr(0, idx);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n return name;\n }\n /** @internal */\n ondeclaration(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onprocessinginstruction(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncomment(start, endIndex, offset) {\n var _a, _b, _c, _d;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset));\n (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncdata(start, endIndex, offset) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex - offset);\n if (this.options.xmlMode || this.options.recognizeCDATA) {\n (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);\n (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);\n }\n else {\n (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);\n (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onend() {\n var _a, _b;\n if (this.cbs.onclosetag) {\n // Set the end index for all remaining tags\n this.endIndex = this.startIndex;\n for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i], true))\n ;\n }\n (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n /**\n * Resets the parser to a blank state, ready to parse a new HTML document\n */\n reset() {\n var _a, _b, _c, _d;\n (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.tokenizer.reset();\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribs = null;\n this.stack.length = 0;\n this.startIndex = 0;\n this.endIndex = 0;\n (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n this.buffers.length = 0;\n this.bufferOffset = 0;\n this.writeIndex = 0;\n this.ended = false;\n }\n /**\n * Resets the parser, then parses a complete document and\n * pushes it to the handler.\n *\n * @param data Document to parse.\n */\n parseComplete(data) {\n this.reset();\n this.end(data);\n }\n getSlice(start, end) {\n while (start - this.bufferOffset >= this.buffers[0].length) {\n this.shiftBuffer();\n }\n let str = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);\n while (end - this.bufferOffset > this.buffers[0].length) {\n this.shiftBuffer();\n str += this.buffers[0].slice(0, end - this.bufferOffset);\n }\n return str;\n }\n shiftBuffer() {\n this.bufferOffset += this.buffers[0].length;\n this.writeIndex--;\n this.buffers.shift();\n }\n /**\n * Parses a chunk of data and calls the corresponding callbacks.\n *\n * @param chunk Chunk to parse.\n */\n write(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(\".write() after done!\"));\n return;\n }\n this.buffers.push(chunk);\n if (this.tokenizer.running) {\n this.tokenizer.write(chunk);\n this.writeIndex++;\n }\n }\n /**\n * Parses the end of the buffer and clears the stack, calls onend.\n *\n * @param chunk Optional final chunk to parse.\n */\n end(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, Error(\".end() after done!\"));\n return;\n }\n if (chunk)\n this.write(chunk);\n this.ended = true;\n this.tokenizer.end();\n }\n /**\n * Pauses parsing. The parser won't emit events until `resume` is called.\n */\n pause() {\n this.tokenizer.pause();\n }\n /**\n * Resumes parsing after `pause` was called.\n */\n resume() {\n this.tokenizer.resume();\n while (this.tokenizer.running &&\n this.writeIndex < this.buffers.length) {\n this.tokenizer.write(this.buffers[this.writeIndex++]);\n }\n if (this.ended)\n this.tokenizer.end();\n }\n /**\n * Alias of `write`, for backwards compatibility.\n *\n * @param chunk Chunk to parse.\n * @deprecated\n */\n parseChunk(chunk) {\n this.write(chunk);\n }\n /**\n * Alias of `end`, for backwards compatibility.\n *\n * @param chunk Optional final chunk to parse.\n * @deprecated\n */\n done(chunk) {\n this.end(chunk);\n }\n}\n//# sourceMappingURL=Parser.js.map","import { Parser } from \"./Parser.js\";\nexport { Parser };\nimport { DomHandler, } from \"domhandler\";\nexport { DomHandler };\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nexport function parseDocument(data, options) {\n const handler = new DomHandler(undefined, options);\n new Parser(handler, options).end(data);\n return handler.root;\n}\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nexport function parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param cb A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nexport function createDomStream(cb, options, elementCb) {\n const handler = new DomHandler(cb, options, elementCb);\n return new Parser(handler, options);\n}\nexport { default as Tokenizer, } from \"./Tokenizer.js\";\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nimport * as ElementType from \"domelementtype\";\nexport { ElementType };\nimport { getFeed } from \"domutils\";\nexport { getFeed };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nexport function parseFeed(feed, options = { xmlMode: true }) {\n return getFeed(parseDOM(feed, options));\n}\nexport * as DomUtils from \"domutils\";\n// Old name for DomHandler\nexport { DomHandler as DefaultHandler };\n//# sourceMappingURL=index.js.map","/**\n * Types used in signatures of Cheerio methods.\n *\n * @category Cheerio\n */\nexport * from './types.js';\nimport { getLoad } from './load.js';\nimport { getParse } from './parse.js';\nimport { renderWithParse5, parseWithParse5 } from './parsers/parse5-adapter.js';\nimport renderWithHtmlparser2 from 'dom-serializer';\nimport { parseDocument as parseWithHtmlparser2 } from 'htmlparser2';\nconst parse = getParse((content, options, isDocument, context) => options.xmlMode || options._useHtmlParser2\n ? parseWithHtmlparser2(content, options)\n : parseWithParse5(content, options, isDocument, context));\n// Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616\n/**\n * Create a querying function, bound to a document created from the provided markup.\n *\n * Note that similar to web browser contexts, this operation may introduce\n * ``, ``, and `` elements; set `isDocument` to `false` to\n * switch to fragment mode and disable this.\n *\n * @param content - Markup to be loaded.\n * @param options - Options for the created instance.\n * @param isDocument - Allows parser to be switched to fragment mode.\n * @returns The loaded document.\n * @see {@link https://cheerio.js.org#loading} for additional usage information.\n */\nexport const load = getLoad(parse, (dom, options) => options.xmlMode || options._useHtmlParser2\n ? renderWithHtmlparser2(dom, options)\n : renderWithParse5(dom));\n/**\n * The default cheerio instance.\n *\n * @deprecated Use the function returned by `load` instead.\n */\nexport default load([]);\nexport { html, xml, text } from './static.js';\nimport * as staticMethods from './static.js';\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('

');\n *\n * $.contains($('div').get(0), $('p').get(0));\n * //=> true\n *\n * $.contains($('p').get(0), $('div').get(0));\n * //=> false\n * ```\n *\n * @returns {boolean}\n */\nexport const { contains } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n *\n * $.merge([1, 2], [3, 4]);\n * //=> [1, 2, 3, 4]\n * ```\n */\nexport const { merge } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name as it is defined on the\n * \"loaded\" Cheerio factory function.\n *\n * @deprecated See {@link static/parseHTML}.\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.parseHTML('markup');\n * ```\n */\nexport const { parseHTML } = staticMethods;\n/**\n * Users seeking to access the top-level element of a parsed document should\n * instead use the `root` static method of a \"loaded\" Cheerio function.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.root();\n * ```\n */\nexport const { root } = staticMethods;\n//# sourceMappingURL=index.js.map","exports = module.exports = debug;\n\nfunction debug(label) {\n return _debug.bind(null, label);\n}\n\nfunction _debug(label) {\n var args = [].slice.call(arguments, 1);\n args.unshift('[' + label + ']');\n process.stderr.write(args.join(' ') + '\\n');\n}","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `lex()` and print the results.\n\nvar debug = require('./debug')('lex');\n\nexports = module.exports = lex;\n\n/**\n * Convert a CSS string into an array of lexical tokens.\n *\n * @param {String} css CSS\n * @returns {Array} lexical tokens\n */\nfunction lex(css) {\n var start; // Debug timer start.\n\n var buffer = ''; // Character accumulator\n var ch; // Current character\n var column = 0; // Current source column number\n var cursor = -1; // Current source cursor position\n var depth = 0; // Current nesting depth\n var line = 1; // Current source line number\n var state = 'before-selector'; // Current state\n var stack = [state]; // State stack\n var token = {}; // Current token\n var tokens = []; // Token accumulator\n\n // Supported @-rules, in roughly descending order of usage probability.\n var atRules = [\n 'media',\n 'keyframes',\n { name: '-webkit-keyframes', type: 'keyframes', prefix: '-webkit-' },\n { name: '-moz-keyframes', type: 'keyframes', prefix: '-moz-' },\n { name: '-ms-keyframes', type: 'keyframes', prefix: '-ms-' },\n { name: '-o-keyframes', type: 'keyframes', prefix: '-o-' },\n 'font-face',\n { name: 'import', state: 'before-at-value' },\n { name: 'charset', state: 'before-at-value' },\n 'supports',\n 'viewport',\n { name: 'namespace', state: 'before-at-value' },\n 'document',\n { name: '-moz-document', type: 'document', prefix: '-moz-' },\n 'page'\n ];\n\n // -- Functions ------------------------------------------------------------\n\n /**\n * Advance the character cursor and return the next character.\n *\n * @returns {String} The next character.\n */\n function getCh() {\n skip();\n return css[cursor];\n }\n\n /**\n * Return the state at the given index in the stack.\n * The stack is LIFO so indexing is from the right.\n *\n * @param {Number} [index=0] Index to return.\n * @returns {String} state\n */\n function getState(index) {\n return index ? stack[stack.length - 1 - index] : state;\n }\n\n /**\n * Look ahead for a string beginning from the next position. The string\n * being looked for must start at the next position.\n *\n * @param {String} str The string to look for.\n * @returns {Boolean} Whether the string was found.\n */\n function isNextString(str) {\n var start = cursor + 1;\n return (str === css.slice(start, start + str.length));\n }\n\n /**\n * Find the start position of a substring beginning from the next\n * position. The string being looked for may begin anywhere.\n *\n * @param {String} str The substring to look for.\n * @returns {Number|false} The position, or `false` if not found.\n */\n function find(str) {\n var pos = css.slice(cursor).indexOf(str);\n\n return pos > 0 ? pos : false;\n }\n\n /**\n * Determine whether a character is next.\n *\n * @param {String} ch Character.\n * @returns {Boolean} Whether the character is next.\n */\n function isNextChar(ch) {\n return ch === peek(1);\n }\n\n /**\n * Return the character at the given cursor offset. The offset is relative\n * to the cursor, so negative values move backwards.\n *\n * @param {Number} [offset=1] Cursor offset.\n * @returns {String} Character.\n */\n function peek(offset) {\n return css[cursor + (offset || 1)];\n }\n\n /**\n * Remove the current state from the stack and set the new current state.\n *\n * @returns {String} The removed state.\n */\n function popState() {\n var removed = stack.pop();\n state = stack[stack.length - 1];\n\n return removed;\n }\n\n /**\n * Set the current state and add it to the stack.\n *\n * @param {String} newState The new state.\n * @returns {Number} The new stack length.\n */\n function pushState(newState) {\n state = newState;\n stack.push(state);\n\n return stack.length;\n }\n\n /**\n * Replace the current state with a new state.\n *\n * @param {String} newState The new state.\n * @returns {String} The replaced state.\n */\n function replaceState(newState) {\n var previousState = state;\n stack[stack.length - 1] = state = newState;\n\n return previousState;\n }\n\n /**\n * Move the character cursor. Positive numbers move the cursor forward.\n * Negative numbers are not supported!\n *\n * @param {Number} [n=1] Number of characters to skip.\n */\n function skip(n) {\n if ((n || 1) == 1) {\n if (css[cursor] == '\\n') {\n line++;\n column = 1;\n } else {\n column++;\n }\n cursor++;\n } else {\n var skipStr = css.slice(cursor, cursor + n).split('\\n');\n if (skipStr.length > 1) {\n line += skipStr.length - 1;\n column = 1;\n }\n column += skipStr[skipStr.length - 1].length;\n cursor = cursor + n;\n }\n }\n\n /**\n * Add the current token to the pile and reset the buffer.\n */\n function addToken() {\n token.end = {\n line: line,\n col: column\n };\n\n DEBUG && debug('addToken:', JSON.stringify(token, null, 2));\n\n tokens.push(token);\n\n buffer = '';\n token = {};\n }\n\n /**\n * Set the current token.\n *\n * @param {String} type Token type.\n */\n function initializeToken(type) {\n token = {\n type: type,\n start: {\n line: line,\n col : column\n }\n };\n }\n\n // -- Main Loop ------------------------------------------------------------\n\n /*\n The main loop is a state machine that reads in one character at a time,\n and determines what to do based on the current state and character.\n This is implemented as a series of nested `switch` statements and the\n case orders have been mildly optimized based on rough probabilities\n calculated by processing a small sample of real-world CSS.\n\n Further optimization (such as a dispatch table) shouldn't be necessary\n since the total number of cases is very low.\n */\n\n TIMER && (start = Date.now());\n\n while (ch = getCh()) {\n DEBUG && debug(ch, getState());\n\n // column += 1;\n\n switch (ch) {\n // Space\n case ' ':\n switch (getState()) {\n case 'selector':\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'at-value':\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n }\n break;\n\n // Newline or tab\n case '\\n':\n case '\\t':\n case '\\r':\n case '\\f':\n switch (getState()) {\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'comment':\n case 'single-string':\n case 'double-string':\n case 'selector':\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule if a semi-colon was omitted.\n if ('\\n' === ch) {\n token.value = buffer.trim();\n addToken();\n popState();\n }\n break;\n }\n\n // if ('\\n' === ch) {\n // column = 0;\n // line += 1;\n // }\n break;\n\n case ':':\n switch (getState()) {\n case 'name':\n token.name = buffer.trim();\n buffer = '';\n\n replaceState('before-value');\n break;\n\n case 'before-selector':\n buffer += ch;\n\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case ';':\n switch (getState()) {\n case 'name':\n case 'before-value':\n case 'value':\n // Tokenize a declaration\n // if value is empty skip the declaration\n if (buffer.trim().length > 0) {\n token.value = buffer.trim(),\n addToken();\n }\n replaceState('before-name');\n break;\n\n case 'value-paren':\n // Insignificant semi-colon\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule\n token.value = buffer.trim();\n addToken();\n popState();\n break;\n\n case 'before-name':\n // Extraneous semi-colon\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case '{':\n switch (getState()) {\n case 'selector':\n // If the sequence is `\\{` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n // Tokenize a selector\n token.text = buffer.trim();\n addToken();\n replaceState('before-name');\n depth = depth + 1;\n break;\n\n case 'at-group':\n // Tokenize an @-group\n token.name = buffer.trim();\n\n // XXX: @-rules are starting to get hairy\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n case 'page' :\n pushState('before-name');\n break;\n\n default:\n pushState('before-selector');\n }\n\n addToken();\n depth = depth + 1;\n break;\n\n case 'name':\n case 'at-rule':\n // Tokenize a declaration or an @-rule\n token.name = buffer.trim();\n addToken();\n pushState('before-name');\n depth = depth + 1;\n break;\n\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore braces in comments and strings\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n }\n\n break;\n\n case '}':\n switch (getState()) {\n case 'before-name':\n case 'name':\n case 'before-value':\n case 'value':\n // If the buffer contains anything, it is a value\n if (buffer) {\n token.value = buffer.trim();\n }\n\n // If the current token has a name and a value it should be tokenized.\n if (token.name && token.value) {\n addToken();\n }\n\n // Leave the block\n initializeToken('end');\n addToken();\n popState();\n\n // We might need to leave again.\n // XXX: What about 3 levels deep?\n if ('at-group' === getState()) {\n initializeToken('at-group-end');\n addToken();\n popState();\n }\n \n if (depth > 0) {\n depth = depth - 1;\n }\n\n break;\n\n case 'at-group':\n case 'before-selector':\n case 'selector':\n // If the sequence is `\\}` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n if (depth > 0) {\n // Leave block if in an at-group\n if ('at-group' === getState(1)) {\n initializeToken('at-group-end');\n addToken();\n }\n }\n\n if (depth > 1) {\n popState();\n }\n\n if (depth > 0) {\n depth = depth - 1;\n }\n break;\n\n case 'double-string':\n case 'single-string':\n case 'comment':\n // Ignore braces in comments and strings.\n buffer += ch;\n break;\n }\n\n break;\n\n // Strings\n case '\"':\n case \"'\":\n switch (getState()) {\n case 'double-string':\n if ('\"' === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'single-string':\n if (\"'\" === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'before-value':\n replaceState('value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'comment':\n // Ignore strings within comments.\n break;\n\n default:\n if ('\\\\' !== peek(-1)) {\n pushState('\"' === ch ? 'double-string' : 'single-string');\n }\n }\n\n buffer += ch;\n break;\n\n // Comments\n case '/':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore\n buffer += ch;\n break;\n\n case 'before-value':\n case 'selector':\n case 'name':\n case 'value':\n if (isNextChar('*')) {\n // Ignore comments in selectors, properties and values. They are\n // difficult to represent in the AST.\n var pos = find('*/');\n\n if (pos) {\n skip(pos + 1);\n }\n } else {\n if (getState() == 'before-value') replaceState('value');\n buffer += ch;\n }\n break;\n\n default:\n if (isNextChar('*')) {\n // Create a comment token\n initializeToken('comment');\n pushState('comment');\n skip();\n }\n else {\n buffer += ch;\n }\n break;\n }\n break;\n\n // Comment end or universal selector\n case '*':\n switch (getState()) {\n case 'comment':\n if (isNextChar('/')) {\n // Tokenize a comment\n token.text = buffer; // Don't trim()!\n skip();\n addToken();\n popState();\n }\n else {\n buffer += ch;\n }\n break;\n\n case 'before-selector':\n buffer += ch;\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n }\n break;\n\n // @-rules\n case '@':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n // Iterate over the supported @-rules and attempt to tokenize one.\n var tokenized = false;\n var name;\n var rule;\n\n for (var j = 0, len = atRules.length; !tokenized && j < len; ++j) {\n rule = atRules[j];\n name = rule.name || rule;\n\n if (!isNextString(name)) { continue; }\n\n tokenized = true;\n\n initializeToken(name);\n pushState(rule.state || 'at-group');\n skip(name.length);\n\n if (rule.prefix) {\n token.prefix = rule.prefix;\n }\n\n if (rule.type) {\n token.type = rule.type;\n }\n }\n\n if (!tokenized) {\n // Keep on truckin' America!\n buffer += ch;\n }\n break;\n }\n break;\n\n // Parentheses are tracked to disambiguate semi-colons, such as within a\n // data URI.\n case '(':\n switch (getState()) {\n case 'value':\n pushState('value-paren');\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n case ')':\n switch (getState()) {\n case 'value-paren':\n popState();\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n default:\n switch (getState()) {\n case 'before-selector':\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-name':\n initializeToken('property');\n replaceState('name');\n break;\n\n case 'before-value':\n replaceState('value');\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n break;\n }\n\n buffer += ch;\n break;\n }\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return tokens;\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `parse()` and print the results.\n\nvar debug = require('./debug')('parse');\nvar lex = require('./lexer');\n\nexports = module.exports = parse;\n\nvar _comments; // Whether comments are allowed.\nvar _depth; // Current block nesting depth.\nvar _position; // Whether to include line/column position.\nvar _tokens; // Array of lexical tokens.\n\n/**\n * Convert a CSS string or array of lexical tokens into a `stringify`-able AST.\n *\n * @param {String} css CSS string or array of lexical token\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comment nodes in the AST\n * @returns {Object} `stringify`-able AST\n */\nfunction parse(css, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _comments = !!options.comments;\n _position = !!options.position;\n\n _depth = 0;\n\n // Operate on a copy of the given tokens, or the lex()'d CSS string.\n _tokens = Array.isArray(css) ? css.slice() : lex(css);\n\n var rule;\n var rules = [];\n var token;\n\n TIMER && (start = Date.now());\n\n while ((token = next())) {\n rule = parseToken(token);\n rule && rules.push(rule);\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return {\n type: \"stylesheet\",\n stylesheet: {\n rules: rules\n }\n };\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Build an AST node from a lexical token.\n *\n * @param {Object} token lexical token\n * @param {Object} [override] object hash of properties that override those\n * already in the token, or that will be added to the token.\n * @returns {Object} AST node\n */\nfunction astNode(token, override) {\n override || (override = {});\n\n var key;\n var keys = ['type', 'name', 'value'];\n var node = {};\n\n // Avoiding [].forEach for performance reasons.\n for (var i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (token[key]) {\n node[key] = override[key] || token[key];\n }\n }\n\n keys = Object.keys(override);\n\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (!node[key]) {\n node[key] = override[key];\n }\n }\n\n if (_position) {\n node.position = {\n start: token.start,\n end: token.end\n };\n }\n\n DEBUG && debug('astNode:', JSON.stringify(node, null, 2));\n\n return node;\n}\n\n/**\n * Remove a lexical token from the stack and return the removed token.\n *\n * @returns {Object} lexical token\n */\nfunction next() {\n var token = _tokens.shift();\n DEBUG && debug('next:', JSON.stringify(token, null, 2));\n return token;\n}\n\n// -- Parse* Functions ---------------------------------------------------------\n\n/**\n * Convert an @-group lexical token to an AST node.\n *\n * @param {Object} token @-group lexical token\n * @returns {Object} @-group AST node\n */\nfunction parseAtGroup(token) {\n _depth = _depth + 1;\n\n // As the @-group token is assembled, relevant token values are captured here\n // temporarily. They will later be used as `tokenize()` overrides.\n var overrides = {};\n\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n overrides.declarations = parseDeclarations();\n break;\n\n case 'page':\n overrides.prefix = token.prefix;\n overrides.declarations = parseDeclarations();\n break;\n\n default:\n overrides.prefix = token.prefix;\n overrides.rules = parseRules();\n }\n\n return astNode(token, overrides);\n}\n\n/**\n * Convert an @import lexical token to an AST node.\n *\n * @param {Object} token @import lexical token\n * @returns {Object} @import AST node\n */\nfunction parseAtImport(token) {\n return astNode(token);\n}\n\n/**\n * Convert an @charset token to an AST node.\n *\n * @param {Object} token @charset lexical token\n * @returns {Object} @charset node\n */\nfunction parseCharset(token) {\n return astNode(token);\n}\n\n/**\n * Convert a comment token to an AST Node.\n *\n * @param {Object} token comment lexical token\n * @returns {Object} comment node\n */\nfunction parseComment(token) {\n return astNode(token, {text: token.text});\n}\n\nfunction parseNamespace(token) {\n return astNode(token);\n}\n\n/**\n * Convert a property lexical token to a property AST node.\n *\n * @returns {Object} property node\n */\nfunction parseProperty(token) {\n return astNode(token);\n}\n\n/**\n * Convert a selector lexical token to a selector AST node.\n *\n * @param {Object} token selector lexical token\n * @returns {Object} selector node\n */\nfunction parseSelector(token) {\n function trim(str) {\n return str.trim();\n }\n\n return astNode(token, {\n type: 'rule',\n selectors: token.text.split(',').map(trim),\n declarations: parseDeclarations(token)\n });\n}\n\n/**\n * Convert a lexical token to an AST node.\n *\n * @returns {Object|undefined} AST node\n */\nfunction parseToken(token) {\n switch (token.type) {\n // Cases are listed in roughly descending order of probability.\n case 'property': return parseProperty(token);\n\n case 'selector': return parseSelector(token);\n\n case 'at-group-end': _depth = _depth - 1; return;\n\n case 'media' :\n case 'keyframes' :return parseAtGroup(token);\n\n case 'comment': if (_comments) { return parseComment(token); } break;\n\n case 'charset': return parseCharset(token);\n case 'import': return parseAtImport(token);\n\n case 'namespace': return parseNamespace(token);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return parseAtGroup(token);\n }\n\n DEBUG && debug('parseToken: unexpected token:', JSON.stringify(token));\n}\n\n// -- Parse Helper Functions ---------------------------------------------------\n\n/**\n * Iteratively parses lexical tokens from the stack into AST nodes until a\n * conditional function returns `false`, at which point iteration terminates\n * and any AST nodes collected are returned.\n *\n * @param {Function} conditionFn\n * @param {Object} token the lexical token being parsed\n * @returns {Boolean} `true` if the token should be parsed, `false` otherwise\n * @return {Array} AST nodes\n */\nfunction parseTokensWhile(conditionFn) {\n var node;\n var nodes = [];\n var token;\n\n while ((token = next()) && (conditionFn && conditionFn(token))) {\n node = parseToken(token);\n node && nodes.push(node);\n }\n\n // Place an unused non-`end` lexical token back onto the stack.\n if (token && token.type !== 'end') {\n _tokens.unshift(token);\n }\n\n return nodes;\n}\n\n/**\n * Convert a series of tokens into a sequence of declaration AST nodes.\n *\n * @returns {Array} declaration nodes\n */\nfunction parseDeclarations() {\n return parseTokensWhile(function (token) {\n return (token.type === 'property' || token.type === 'comment');\n });\n}\n\n/**\n * Convert a series of tokens into a sequence of rule nodes.\n *\n * @returns {Array} rule nodes\n */\nfunction parseRules() {\n return parseTokensWhile(function () { return _depth; });\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `stringify()` and print the results.\n\nvar debug = require('./debug')('stringify');\n\nvar _comments; // Whether comments are allowed in the stringified CSS.\nvar _compress; // Whether the stringified CSS should be compressed.\nvar _indentation; // Indentation option value.\nvar _level; // Current indentation level.\nvar _n; // Compression-aware newline character.\nvar _s; // Compression-aware space character.\n\nexports = module.exports = stringify;\n\n/**\n * Convert a `stringify`-able AST into a CSS string.\n *\n * @param {Object} `stringify`-able AST\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comments in the CSS\n * @param {Boolean} [options.compress=false] compress whitespace\n * @param {String} [options.indentation=''] indentation sequence\n * @returns {String} CSS\n */\nfunction stringify(ast, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _indentation = options.indentation || '';\n _compress = !!options.compress;\n _comments = !!options.comments;\n _level = 1;\n\n if (_compress) {\n _n = _s = '';\n } else {\n _n = '\\n';\n _s = ' ';\n }\n\n TIMER && (start = Date.now());\n\n var css = reduce(ast.stylesheet.rules, stringifyNode).join('\\n').trim();\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return css;\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Modify the indentation level, or return a compression-aware sequence of\n * spaces equal to the current indentation level.\n *\n * @param {Number} [level=undefined] indentation level modifier\n * @returns {String} sequence of spaces\n */\nfunction indent(level) {\n if (level) {\n _level += level;\n return;\n }\n\n if (_compress) { return ''; }\n\n return Array(_level).join(_indentation || '');\n}\n\n// -- Stringify Functions ------------------------------------------------------\n\n/**\n * Stringify an @-rule AST node.\n *\n * Use `stringifyAtGroup()` when dealing with @-groups that may contain blocks\n * such as @media.\n *\n * @param {String} type @-rule type. E.g., import, charset\n * @returns {String} Stringified @-rule\n */\nfunction stringifyAtRule(node) {\n return '@' + node.type + ' ' + node.value + ';' + _n;\n}\n\n/**\n * Stringify an @-group AST node.\n *\n * Use `stringifyAtRule()` when dealing with @-rules that may not contain blocks\n * such as @import.\n *\n * @param {Object} node @-group AST node\n * @returns {String}\n */\nfunction stringifyAtGroup(node) {\n var label = '';\n var prefix = node.prefix || '';\n\n if (node.name) {\n label = ' ' + node.name;\n }\n\n // FIXME: @-rule conditional logic is leaking everywhere.\n var chomp = node.type !== 'page';\n\n return '@' + prefix + node.type + label + _s + stringifyBlock(node, chomp) + _n;\n}\n\n/**\n * Stringify a comment AST node.\n *\n * @param {Object} node comment AST node\n * @returns {String}\n */\nfunction stringifyComment(node) {\n if (!_comments) { return ''; }\n\n return '/*' + (node.text || '') + '*/' + _n;\n}\n\n/**\n * Stringify a rule AST node.\n *\n * @param {Object} node rule AST node\n * @returns {String}\n */\nfunction stringifyRule(node) {\n var label;\n\n if (node.selectors) {\n label = node.selectors.join(',' + _n);\n } else {\n label = '@' + node.type;\n label += node.name ? ' ' + node.name : '';\n }\n\n return indent() + label + _s + stringifyBlock(node) + _n;\n}\n\n\n// -- Stringify Helper Functions -----------------------------------------------\n\n/**\n * Reduce an array by applying a function to each item and retaining the truthy\n * results.\n *\n * When `item.type` is `'comment'` `stringifyComment` will be applied instead.\n *\n * @param {Array} items array to reduce\n * @param {Function} fn function to call for each item in the array\n * @returns {Mixed} Truthy values will be retained, falsy values omitted\n * @returns {Array} retained results\n */\nfunction reduce(items, fn) {\n return items.reduce(function (results, item) {\n var result = (item.type === 'comment') ? stringifyComment(item) : fn(item);\n result && results.push(result);\n return results;\n }, []);\n}\n\n/**\n * Stringify an AST node with the assumption that it represents a block of\n * declarations or other @-group contents.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\n// FIXME: chomp should not be a magic boolean parameter\nfunction stringifyBlock(node, chomp) {\n var children = node.declarations;\n var fn = stringifyDeclaration;\n\n if (node.rules) {\n children = node.rules;\n fn = stringifyRule;\n }\n\n children = stringifyChildren(children, fn);\n children && (children = _n + children + (chomp ? '' : _n));\n\n return '{' + children + indent() + '}';\n}\n\n/**\n * Stringify an array of child AST nodes by calling the given stringify function\n * once for each child, and concatenating the results.\n *\n * @param {Array} children `node.rules` or `node.declarations`\n * @param {Function} fn stringify function\n * @returns {String}\n */\nfunction stringifyChildren(children, fn) {\n if (!children) { return ''; }\n\n indent(1);\n var results = reduce(children, fn);\n indent(-1);\n\n if (!results.length) { return ''; }\n\n return results.join(_n);\n}\n\n/**\n * Stringify a declaration AST node.\n *\n * @param {Object} node declaration AST node\n * @returns {String}\n */\nfunction stringifyDeclaration(node) {\n if (node.type === 'property') {\n return stringifyProperty(node);\n }\n\n DEBUG && debug('stringifyDeclaration: unexpected node:', JSON.stringify(node));\n}\n\n/**\n * Stringify an AST node.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\nfunction stringifyNode(node) {\n switch (node.type) {\n // Cases are listed in roughly descending order of probability.\n case 'rule': return stringifyRule(node);\n\n case 'media' :\n case 'keyframes': return stringifyAtGroup(node);\n\n case 'comment': return stringifyComment(node);\n\n case 'import' :\n case 'charset' :\n case 'namespace': return stringifyAtRule(node);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return stringifyAtGroup(node);\n }\n\n DEBUG && debug('stringifyNode: unexpected node: ' + JSON.stringify(node));\n}\n\n/**\n * Stringify an AST property node.\n *\n * @param {Object} node AST property node\n * @returns {String}\n */\nfunction stringifyProperty(node) {\n var name = node.name ? node.name + ':' + _s : '';\n\n return indent() + name + node.value + ';';\n}\n","module.exports = {\n lex : require('./lib/lexer'),\n parse: require('./lib/parser'),\n stringify: require('./lib/stringify')\n};\n","/*\r\nSlick Parser\r\n - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com)\r\n*/\"use strict\"\r\n\r\n// Notable changes from Slick.Parser 1.0.x\r\n\r\n// The parser now uses 2 classes: Expressions and Expression\r\n// `new Expressions` produces an array-like object containing a list of Expression objects\r\n// - Expressions::toString() produces a cleaned up expressions string\r\n// `new Expression` produces an array-like object\r\n// - Expression::toString() produces a cleaned up expression string\r\n// The only exposed method is parse, which produces a (cached) `new Expressions` instance\r\n// parsed.raw is no longer present, use .toString()\r\n// parsed.expression is now useless, just use the indices\r\n// parsed.reverse() has been removed for now, due to its apparent uselessness\r\n// Other changes in the Expressions object:\r\n// - classNames are now unique, and save both escaped and unescaped values\r\n// - attributes now save both escaped and unescaped values\r\n// - pseudos now save both escaped and unescaped values\r\n\r\nvar escapeRe = /([-.*+?^${}()|[\\]\\/\\\\])/g,\r\n unescapeRe = /\\\\/g\r\n\r\nvar escape = function(string){\r\n // XRegExp v2.0.0-beta-3\r\n // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js\r\n return (string + \"\").replace(escapeRe, '\\\\$1')\r\n}\r\n\r\nvar unescape = function(string){\r\n return (string + \"\").replace(unescapeRe, '')\r\n}\r\n\r\nvar slickRe = RegExp(\r\n/*\r\n#!/usr/bin/env ruby\r\nputs \"\\t\\t\" + DATA.read.gsub(/\\(\\?x\\)|\\s+#.*$|\\s+|\\\\$|\\\\n/,'')\r\n__END__\r\n \"(?x)^(?:\\\r\n \\\\s* ( , ) \\\\s* # Separator \\n\\\r\n | \\\\s* ( + ) \\\\s* # Combinator \\n\\\r\n | ( \\\\s+ ) # CombinatorChildren \\n\\\r\n | ( + | \\\\* ) # Tag \\n\\\r\n | \\\\# ( + ) # ID \\n\\\r\n | \\\\. ( + ) # ClassName \\n\\\r\n | # Attribute \\n\\\r\n \\\\[ \\\r\n \\\\s* (+) (?: \\\r\n \\\\s* ([*^$!~|]?=) (?: \\\r\n \\\\s* (?:\\\r\n ([\\\"']?)(.*?)\\\\9 \\\r\n )\\\r\n ) \\\r\n )? \\\\s* \\\r\n \\\\](?!\\\\]) \\n\\\r\n | :+ ( + )(?:\\\r\n \\\\( (?:\\\r\n (?:([\\\"'])([^\\\\12]*)\\\\12)|((?:\\\\([^)]+\\\\)|[^()]*)+)\\\r\n ) \\\\)\\\r\n )?\\\r\n )\"\r\n*/\r\n\"^(?:\\\\s*(,)\\\\s*|\\\\s*(+)\\\\s*|(\\\\s+)|(+|\\\\*)|\\\\#(+)|\\\\.(+)|\\\\[\\\\s*(+)(?:\\\\s*([*^$!~|]?=)(?:\\\\s*(?:([\\\"']?)(.*?)\\\\9)))?\\\\s*\\\\](?!\\\\])|(:+)(+)(?:\\\\((?:(?:([\\\"'])([^\\\\13]*)\\\\13)|((?:\\\\([^)]+\\\\)|[^()]*)+))\\\\))?)\"\r\n .replace(//, '[' + escape(\">+~`!@$%^&={}\\\\;/g, '(?:[\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n .replace(//g, '(?:[:\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n)\r\n\r\n// Part\r\n\r\nvar Part = function Part(combinator){\r\n this.combinator = combinator || \" \"\r\n this.tag = \"*\"\r\n}\r\n\r\nPart.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\", k, part\r\n\r\n xpr += this.tag || \"*\"\r\n if (this.id) xpr += \"#\" + this.id\r\n if (this.classes) xpr += \".\" + this.classList.join(\".\")\r\n if (this.attributes) for (k = 0; part = this.attributes[k++];){\r\n xpr += \"[\" + part.name + (part.operator ? part.operator + '\"' + part.value + '\"' : '') + \"]\"\r\n }\r\n if (this.pseudos) for (k = 0; part = this.pseudos[k++];){\r\n xpr += \":\" + part.name\r\n if (part.value) xpr += \"(\" + part.value + \")\"\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\n// Expression\r\n\r\nvar Expression = function Expression(){\r\n this.length = 0\r\n}\r\n\r\nExpression.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\"\r\n\r\n for (var j = 0, bit; bit = this[j++];){\r\n if (j !== 1) xpr += \" \"\r\n if (bit.combinator !== \" \") xpr += bit.combinator + \" \"\r\n xpr += bit\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar replacer = function(\r\n rawMatch,\r\n\r\n separator,\r\n combinator,\r\n combinatorChildren,\r\n\r\n tagName,\r\n id,\r\n className,\r\n\r\n attributeKey,\r\n attributeOperator,\r\n attributeQuote,\r\n attributeValue,\r\n\r\n pseudoMarker,\r\n pseudoClass,\r\n pseudoQuote,\r\n pseudoClassQuotedValue,\r\n pseudoClassValue\r\n){\r\n\r\n var expression, current\r\n\r\n if (separator || !this.length){\r\n expression = this[this.length++] = new Expression\r\n if (separator) return ''\r\n }\r\n\r\n if (!expression) expression = this[this.length - 1]\r\n\r\n if (combinator || combinatorChildren || !expression.length){\r\n current = expression[expression.length++] = new Part(combinator)\r\n }\r\n\r\n if (!current) current = expression[expression.length - 1]\r\n\r\n if (tagName){\r\n\r\n current.tag = unescape(tagName)\r\n\r\n } else if (id){\r\n\r\n current.id = unescape(id)\r\n\r\n } else if (className){\r\n\r\n var unescaped = unescape(className)\r\n\r\n var classes = current.classes || (current.classes = {})\r\n if (!classes[unescaped]){\r\n classes[unescaped] = escape(className)\r\n var classList = current.classList || (current.classList = [])\r\n classList.push(unescaped)\r\n classList.sort()\r\n }\r\n\r\n } else if (pseudoClass){\r\n\r\n pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue\r\n\r\n ;(current.pseudos || (current.pseudos = [])).push({\r\n type : pseudoMarker.length == 1 ? 'class' : 'element',\r\n name : unescape(pseudoClass),\r\n escapedName : escape(pseudoClass),\r\n value : pseudoClassValue ? unescape(pseudoClassValue) : null,\r\n escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null\r\n })\r\n\r\n } else if (attributeKey){\r\n\r\n attributeValue = attributeValue ? escape(attributeValue) : null\r\n\r\n ;(current.attributes || (current.attributes = [])).push({\r\n operator : attributeOperator,\r\n name : unescape(attributeKey),\r\n escapedName : escape(attributeKey),\r\n value : attributeValue ? unescape(attributeValue) : null,\r\n escapedValue : attributeValue ? escape(attributeValue) : null\r\n })\r\n\r\n }\r\n\r\n return ''\r\n\r\n}\r\n\r\n// Expressions\r\n\r\nvar Expressions = function Expressions(expression){\r\n this.length = 0\r\n\r\n var self = this\r\n\r\n var original = expression, replaced\r\n\r\n while (expression){\r\n replaced = expression.replace(slickRe, function(){\r\n return replacer.apply(self, arguments)\r\n })\r\n if (replaced === expression) throw new Error(original + ' is an invalid expression')\r\n expression = replaced\r\n }\r\n}\r\n\r\nExpressions.prototype.toString = function(){\r\n if (!this.raw){\r\n var expressions = []\r\n for (var i = 0, expression; expression = this[i++];) expressions.push(expression)\r\n this.raw = expressions.join(\", \")\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar cache = {}\r\n\r\nvar parse = function(expression){\r\n if (expression == null) return null\r\n expression = ('' + expression).replace(/^\\s+|\\s+$/g, '')\r\n return cache[expression] || (cache[expression] = new Expressions(expression))\r\n}\r\n\r\nmodule.exports = parse\r\n","'use strict';\n\nvar parser = require('slick/parser');\n\nmodule.exports = exports = Selector;\n\n/**\n * CSS selector constructor.\n *\n * @param {String} selector text\n * @param {Array} optionally, precalculated specificity\n * @api public\n */\n\nfunction Selector(text, styleAttribute) {\n this.text = text;\n this.spec = undefined;\n this.styleAttribute = styleAttribute || false;\n}\n\n/**\n * Get parsed selector.\n *\n * @api public\n */\n\nSelector.prototype.parsed = function() {\n if (!this.tokens) { this.tokens = parse(this.text); }\n return this.tokens;\n};\n\n/**\n * Lazy specificity getter\n *\n * @api public\n */\n\nSelector.prototype.specificity = function() {\n var styleAttribute = this.styleAttribute;\n if (!this.spec) { this.spec = specificity(this.text, this.parsed()); }\n return this.spec;\n\n function specificity(text, parsed) {\n var expressions = parsed || parse(text);\n var spec = [styleAttribute ? 1 : 0, 0, 0, 0];\n var nots = [];\n\n for (var i = 0; i < expressions.length; i++) {\n var expression = expressions[i];\n var pseudos = expression.pseudos;\n\n // id awards a point in the second column\n if (expression.id) { spec[1]++; }\n\n // classes and attributes award a point each in the third column\n if (expression.attributes) { spec[2] += expression.attributes.length; }\n if (expression.classList) { spec[2] += expression.classList.length; }\n\n // tag awards a point in the fourth column\n if (expression.tag && expression.tag !== '*') { spec[3]++; }\n\n // pseudos award a point each in the fourth column\n if (pseudos) {\n spec[3] += pseudos.length;\n\n for (var p = 0; p < pseudos.length; p++) {\n if (pseudos[p].name === 'not') {\n nots.push(pseudos[p].value);\n spec[3]--;\n }\n }\n }\n }\n\n for (var ii = nots.length; ii--;) {\n var not = specificity(nots[ii]);\n for (var jj = 4; jj--;) { spec[jj] += not[jj]; }\n }\n\n return spec;\n }\n};\n\n/**\n * Parses a selector and returns the tokens.\n *\n * @param {String} selector\n * @api private.\n */\n\nfunction parse(text) {\n try {\n return parser(text)[0];\n } catch (e) {\n return [];\n }\n}\n","'use strict';\n\nmodule.exports = exports = Property;\n\n/**\n * Module dependencies.\n */\n\nvar utils = require('./utils');\n\n/**\n * CSS property constructor.\n *\n * @param {String} property\n * @param {String} value\n * @param {Selector} selector the property originates from\n * @param {Integer} priority 0 for normal properties, 2 for !important properties.\n * @param {Array} additional array of integers representing more detailed priorities (sorting)\n * @api public\n */\n\nfunction Property(prop, value, selector, priority, additionalPriority) {\n this.prop = prop;\n this.value = value;\n this.selector = selector;\n this.priority = priority || 0;\n this.additionalPriority = additionalPriority || [];\n}\n\n/**\n * Compares with another Property based on Selector#specificity.\n *\n * @api public\n */\n\nProperty.prototype.compareFunc = function(property) {\n var a = [];\n a.push.apply(a, this.selector.specificity());\n a.push.apply(a, this.additionalPriority);\n a[0] += this.priority;\n var b = [];\n b.push.apply(b, property.selector.specificity());\n b.push.apply(b, property.additionalPriority);\n b[0] += property.priority;\n return utils.compareFunc(a, b);\n};\n\nProperty.prototype.compare = function(property) {\n var winner = this.compareFunc(property);\n if (winner === 1) {\n return this;\n }\n return property;\n};\n\n\n/**\n * Returns CSS property\n *\n * @api public\n */\n\nProperty.prototype.toString = function() {\n return this.prop + ': ' + this.value.replace(/['\"]+/g, '') + ';';\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\n\nvar mensch = require('mensch');\nvar Selector = require('./selector');\nvar Property = require('./property');\n\nexports.Selector = Selector;\nexports.Property = Property;\n\n/**\n * Returns an array of the selectors.\n *\n * @license Sizzle CSS Selector Engine - MIT\n * @param {String} selectorText from mensch\n * @api public\n */\n\nexports.extract = function extract(selectorText) {\n var attr = 0;\n var sels = [];\n var sel = '';\n\n for (var i = 0, l = selectorText.length; i < l; i++) {\n var c = selectorText.charAt(i);\n\n if (attr) {\n if (']' === c || ')' === c) { attr--; }\n sel += c;\n } else {\n if (',' === c) {\n sels.push(sel);\n sel = '';\n } else {\n if ('[' === c || '(' === c) { attr++; }\n if (sel.length || (c !== ',' && c !== '\\n' && c !== ' ')) { sel += c; }\n }\n }\n }\n\n if (sel.length) {\n sels.push(sel);\n }\n\n return sels;\n};\n\n/**\n * Returns a parse tree for a CSS source.\n * If it encounters multiple selectors separated by a comma, it splits the\n * tree.\n *\n * @param {String} css source\n * @api public\n */\n\nexports.parseCSS = function(css) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var ret = [];\n\n for (var i = 0, l = rules.length; i < l; i++) {\n if (rules[i].type == 'rule') {\n var rule = rules[i];\n var selectors = rule.selectors;\n\n for (var ii = 0, ll = selectors.length; ii < ll; ii++) {\n ret.push([selectors[ii], rule.declarations]);\n }\n }\n }\n\n return ret;\n};\n\n/**\n * Returns preserved text for a CSS source.\n *\n * @param {String} css source\n * @param {Object} options\n * @api public\n */\n\nexports.getPreservedText = function(css, options, ignoredPseudos) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var preserved = [];\n var lastStart = null;\n\n for (var i = rules.length - 1; i >= 0; i--) {\n if ((options.fontFaces && rules[i].type === 'font-face') ||\n (options.mediaQueries && rules[i].type === 'media') ||\n (options.keyFrames && rules[i].type === 'keyframes') ||\n (options.pseudos && rules[i].selectors && this.matchesPseudo(rules[i].selectors[0], ignoredPseudos))) {\n preserved.unshift(\n mensch.stringify(\n { stylesheet: { rules: [ rules[i] ] }},\n { comments: false, indentation: ' ' }\n )\n );\n }\n lastStart = rules[i].position.start;\n }\n\n if (preserved.length === 0) {\n return false;\n }\n return '\\n' + preserved.join('\\n') + '\\n';\n};\n\nexports.normalizeLineEndings = function(text) {\n return text.replace(/\\r\\n/g, '\\n').replace(/\\n/g, '\\r\\n');\n};\n\nexports.matchesPseudo = function(needle, haystack) {\n return haystack.find(function (element) {\n return needle.indexOf(element) > -1;\n })\n}\n\n/**\n * Compares two specificity vectors, returning the winning one.\n *\n * @param {Array} vector a\n * @param {Array} vector b\n * @return {Array}\n * @api public\n */\n\nexports.compareFunc = function(a, b) {\n var min = Math.min(a.length, b.length);\n for (var i = 0; i < min; i++) {\n if (a[i] === b[i]) { continue; }\n if (a[i] > b[i]) { return 1; }\n return -1;\n }\n\n return a.length - b.length;\n};\n\nexports.compare = function(a, b) {\n return exports.compareFunc(a, b) == 1 ? a : b;\n};\n\nexports.getDefaultOptions = function(options) {\n var result = Object.assign({\n extraCss: '',\n insertPreservedExtraCss: true,\n applyStyleTags: true,\n removeStyleTags: true,\n preserveMediaQueries: true,\n preserveFontFaces: true,\n preserveKeyFrames: true,\n preservePseudos: true,\n applyWidthAttributes: true,\n applyHeightAttributes: true,\n applyAttributesTableElements: true,\n url: ''\n }, options);\n\n result.webResources = result.webResources || {};\n\n return result;\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\nvar cheerio = require('cheerio');\nvar utils = require('./utils');\n\nvar cheerioLoad = function(html, options, encodeEntities) {\n options = Object.assign({decodeEntities: false, _useHtmlParser2:true}, options);\n html = encodeEntities(html);\n return cheerio.load(html, options);\n};\n\nvar createEntityConverters = function () {\n var codeBlockLookup = [];\n\n var encodeCodeBlocks = function(html) {\n var blocks = module.exports.codeBlocks;\n Object.keys(blocks).forEach(function(key) {\n var re = new RegExp(blocks[key].start + '([\\\\S\\\\s]*?)' + blocks[key].end, 'g');\n html = html.replace(re, function(match, subMatch) {\n codeBlockLookup.push(match);\n return 'JUICE_CODE_BLOCK_' + (codeBlockLookup.length - 1) + '_';\n });\n });\n return html;\n };\n\n var decodeCodeBlocks = function(html) {\n for(var index = 0; index < codeBlockLookup.length; index++) {\n var re = new RegExp('JUICE_CODE_BLOCK_' + index + '_(=\"\")?', 'gi');\n html = html.replace(re, function() {\n return codeBlockLookup[index];\n });\n }\n return html;\n };\n\n return {\n encodeEntities: encodeCodeBlocks,\n decodeEntities: decodeCodeBlocks,\n };\n};\n\n/**\n * Parses the input, calls the callback on the parsed DOM, and generates the output\n *\n * @param {String} html input html to be processed\n * @param {Object} options for the parser\n * @param {Function} callback to be invoked on the DOM\n * @param {Array} callbackExtraArguments to be passed to the callback\n * @return {String} resulting html\n */\nmodule.exports = function(html, options, callback, callbackExtraArguments) {\n var entityConverters = createEntityConverters();\n\n var $ = cheerioLoad(html, options, entityConverters.encodeEntities);\n var args = [ $ ];\n args.push.apply(args, callbackExtraArguments);\n var doc = callback.apply(undefined, args) || $;\n\n if (options && options.xmlMode) {\n return entityConverters.decodeEntities(doc.xml());\n }\n return entityConverters.decodeEntities(doc.html());\n};\n\nmodule.exports.codeBlocks = {\n EJS: { start: '<%', end: '%>' },\n HBS: { start: '{{', end: '}}' }\n};\n","'use strict';\n\n/**\n * Converts a decimal number to roman numeral.\n * https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.romanize = function(num) {\n if (isNaN(num))\n return NaN;\n var digits = String(+num).split(\"\"),\n key = [\"\",\"C\",\"CC\",\"CCC\",\"CD\",\"D\",\"DC\",\"DCC\",\"DCCC\",\"CM\",\n \"\",\"X\",\"XX\",\"XXX\",\"XL\",\"L\",\"LX\",\"LXX\",\"LXXX\",\"XC\",\n \"\",\"I\",\"II\",\"III\",\"IV\",\"V\",\"VI\",\"VII\",\"VIII\",\"IX\"],\n roman = \"\",\n i = 3;\n while (i--)\n roman = (key[+digits.pop() + (i * 10)] || \"\") + roman;\n return Array(+digits.join(\"\") + 1).join(\"M\") + roman;\n}\n\n/**\n * Converts a decimal number to alphanumeric numeral.\n * https://stackoverflow.com/questions/45787459/convert-number-to-alphabet-string-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.alphanumeric = function(num) {\n var s = '', t;\n\n while (num > 0) {\n t = (num - 1) % 26;\n s = String.fromCharCode(65 + t) + s;\n num = (num - t)/26 | 0;\n }\n return s || undefined;\n}","'use strict';\n\nvar utils = require('./utils');\nvar numbers = require('./numbers');\n\nmodule.exports = function makeJuiceClient(juiceClient) {\n\njuiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link'];\njuiceClient.widthElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.heightElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.tableElements = ['TABLE', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT'];\njuiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ];\njuiceClient.styleToAttribute = {\n 'background-color': 'bgcolor',\n 'background-image': 'background',\n 'text-align': 'align',\n 'vertical-align': 'valign'\n};\njuiceClient.excludedProperties = [];\n\njuiceClient.juiceDocument = juiceDocument;\njuiceClient.inlineDocument = inlineDocument;\n\nfunction inlineDocument($, css, options) {\n\n options = options || {};\n var rules = utils.parseCSS(css);\n var editedElements = [];\n var styleAttributeName = 'style';\n var counters = {};\n\n if (options.styleAttributeName) {\n styleAttributeName = options.styleAttributeName;\n }\n\n rules.forEach(handleRule);\n editedElements.forEach(setStyleAttrs);\n\n if (options.inlinePseudoElements) {\n editedElements.forEach(inlinePseudoElements);\n }\n\n if (options.applyWidthAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'width');\n });\n }\n\n if (options.applyHeightAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'height');\n });\n }\n\n if (options.applyAttributesTableElements) {\n editedElements.forEach(setAttributesOnTableElements);\n }\n\n if (options.insertPreservedExtraCss && options.extraCss) {\n var preservedText = utils.getPreservedText(options.extraCss, {\n mediaQueries: options.preserveMediaQueries,\n fontFaces: options.preserveFontFaces,\n keyFrames: options.preserveKeyFrames\n });\n if (preservedText) {\n var $appendTo = null;\n if (options.insertPreservedExtraCss !== true) {\n $appendTo = $(options.insertPreservedExtraCss);\n } else {\n $appendTo = $('head');\n if (!$appendTo.length) { $appendTo = $('body'); }\n if (!$appendTo.length) { $appendTo = $.root(); }\n }\n\n $appendTo.first().append('');\n }\n }\n\n function handleRule(rule) {\n var sel = rule[0];\n var style = rule[1];\n var selector = new utils.Selector(sel);\n var parsedSelector = selector.parsed();\n\n if (!parsedSelector) {\n return;\n }\n\n var pseudoElementType = getPseudoElementType(parsedSelector);\n\n // skip rule if the selector has any pseudos which are ignored\n for (var i = 0; i < parsedSelector.length; ++i) {\n var subSel = parsedSelector[i];\n if (subSel.pseudos) {\n for (var j = 0; j < subSel.pseudos.length; ++j) {\n var subSelPseudo = subSel.pseudos[j];\n if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) {\n return;\n }\n }\n }\n }\n\n if (pseudoElementType) {\n var last = parsedSelector[parsedSelector.length - 1];\n var pseudos = last.pseudos;\n last.pseudos = filterElementPseudos(last.pseudos);\n sel = parsedSelector.toString();\n last.pseudos = pseudos;\n }\n\n var els;\n try {\n els = $(sel);\n } catch (err) {\n // skip invalid selector\n return;\n }\n\n els.each(function() {\n var el = this;\n\n if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) {\n return;\n }\n\n if (pseudoElementType) {\n var pseudoElPropName = 'pseudo' + pseudoElementType;\n var pseudoEl = el[pseudoElPropName];\n if (!pseudoEl) {\n pseudoEl = el[pseudoElPropName] = $('').get(0);\n pseudoEl.pseudoElementType = pseudoElementType;\n pseudoEl.pseudoElementParent = el;\n pseudoEl.counterProps = el.counterProps;\n el[pseudoElPropName] = pseudoEl;\n }\n el = pseudoEl;\n }\n\n if (!el.styleProps) {\n el.styleProps = {};\n\n // if the element has inline styles, fake selector with topmost specificity\n if ($(el).attr(styleAttributeName)) {\n var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } ';\n addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('`;\n }\n\n computeStyle() {\n // 计算需要append进富文本的style\n const mathStyle = this.getStyleFromSheets('mjx-container');\n const cherryStyle = this.getStyleFromSheets('cherry');\n const echartStyle =\n '';\n return {\n mathStyle,\n echartStyle,\n cherryStyle,\n };\n }\n\n /**\n * 由于复制操作会随着预览区域的内容增加而耗时变长,所以需要增加“正在复制”的状态回显\n * 同时该状态也用于限频\n */\n toggleLoading() {\n // 切换loading状态\n if (this.isLoading) {\n const loadingButton = document.querySelector('.icon-loading');\n loadingButton.outerHTML = '';\n } else {\n const copyButton = document.querySelector('.ch-icon-copy');\n copyButton.outerHTML = '
';\n }\n this.isLoading = !this.isLoading;\n }\n\n /**\n * 响应点击事件\n * 该按钮不会引发编辑区域的内容改动,所以不用处理用户在编辑区域的选中内容\n * @param {Event} e 点击事件\n */\n onClick(e) {\n this.toggleLoading();\n const inlineCodeTheme = document.querySelector('.cherry').getAttribute('data-inline-code-theme');\n const codeBlockTheme = document.querySelector('.cherry').getAttribute('data-code-block-theme');\n const { mathStyle, echartStyle, cherryStyle } = this.computeStyle();\n const html = this.previewer.isPreviewerHidden()\n ? this.previewer.options.previewerCache.html\n : this.previewer.getValue();\n // 将css样式以行内样式的形式插入到html内容里\n this.adaptWechat(html).then((html) => {\n copyToClip(\n juice(\n `
\n
${html}
\n
${mathStyle + echartStyle + cherryStyle}`,\n ),\n );\n this.toggleLoading();\n });\n }\n}\n\n/**\n * 将图片转成base64,防止出现由于图片防盗链功能导致图裂的情况\n * @param {string} url 图片的地址\n * @param {Function} [callback] 回调函数,本函数不处理该参数\n * @param {string} [outputFormat]\n * @returns {Promise} img node\n */\nfunction convertImgToBase64(url, callback, outputFormat) {\n return new Promise((resolve) => {\n let canvas = /** @type {HTMLCanvasElement}*/ (document.createElement('CANVAS'));\n const ctx = canvas.getContext('2d');\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.onload = function () {\n canvas.height = img.height;\n canvas.width = img.width;\n ctx.drawImage(img, 0, 0);\n const dataURL = canvas.toDataURL(outputFormat || 'image/png');\n resolve(dataURL);\n canvas = null;\n };\n img.src = url;\n });\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 工具栏各个实例的注册中心\n */\nimport Bold from './hooks/Bold';\nimport Italic from './hooks/Italic';\nimport Split from './hooks/Split';\nimport Strikethrough from './hooks/Strikethrough';\nimport Sub from './hooks/Sub';\nimport Sup from './hooks/Sup';\nimport Color from './hooks/Color';\nimport Header from './hooks/Header';\nimport Insert from './hooks/Insert';\nimport List from './hooks/List';\nimport Ol from './hooks/Ol';\nimport Ul from './hooks/Ul';\nimport CheckList from './hooks/CheckList';\nimport Graph from './hooks/Graph';\nimport Size from './hooks/Size';\nimport H1 from './hooks/H1';\nimport H2 from './hooks/H2';\nimport H3 from './hooks/H3';\nimport Quote from './hooks/Quote';\nimport QuickTable from './hooks/QuickTable';\nimport TogglePreview from './hooks/TogglePreview';\nimport FullScreen from './hooks/FullScreen';\nimport Undo from './hooks/Undo';\nimport Redo from './hooks/Redo';\nimport Code from './hooks/Code';\nimport CodeTheme from './hooks/CodeTheme';\nimport Export from './hooks/Export';\nimport Settings from './hooks/Settings';\nimport Underline from './hooks/Underline';\nimport SwitchModel from './hooks/SwitchModel';\nimport Image from './hooks/Image';\nimport Audio from './hooks/Audio';\nimport Video from './hooks/Video';\nimport Br from './hooks/Br';\nimport Hr from './hooks/Hr';\nimport Formula from './hooks/Formula';\nimport Link from './hooks/Link';\nimport Table from './hooks/Table';\nimport Toc from './hooks/Toc';\nimport LineTable from './hooks/LineTable';\nimport BarTable from './hooks/BarTable';\nimport Pdf from './hooks/Pdf';\nimport Word from './hooks/Word';\nimport Ruby from './hooks/Ruby';\nimport Theme from './hooks/Theme';\n// Sidebar\nimport MobilePreview from './hooks/MobilePreview';\nimport Copy from './hooks/Copy';\n\n// 定义默认支持的工具栏\n// 目前不支持按需动态加载\n// 如果对CherryMarkdown构建后的文件大小有比较严格的要求,可以根据实际情况删减hook\nconst HookList = {\n bold: Bold,\n italic: Italic,\n '|': Split,\n strikethrough: Strikethrough,\n sub: Sub,\n sup: Sup,\n header: Header,\n insert: Insert,\n list: List,\n ol: Ol,\n ul: Ul,\n checklist: CheckList,\n graph: Graph,\n size: Size,\n h1: H1,\n h2: H2,\n h3: H3,\n color: Color,\n quote: Quote,\n quickTable: QuickTable,\n togglePreview: TogglePreview,\n code: Code,\n codeTheme: CodeTheme,\n export: Export,\n settings: Settings,\n fullScreen: FullScreen,\n mobilePreview: MobilePreview,\n copy: Copy,\n undo: Undo,\n redo: Redo,\n underline: Underline,\n switchModel: SwitchModel,\n image: Image,\n audio: Audio,\n video: Video,\n br: Br,\n hr: Hr,\n formula: Formula,\n link: Link,\n table: Table,\n toc: Toc,\n lineTable: LineTable,\n barTable: BarTable,\n pdf: Pdf,\n word: Word,\n ruby: Ruby,\n theme: Theme,\n};\n\nexport default class HookCenter {\n constructor(toolbar) {\n this.toolbar = toolbar;\n /**\n * @type {{[key: string]: import('@/toolbars/MenuBase').default}} 保存所有菜单实例\n */\n this.hooks = {};\n /**\n * @type {string[]} 所有注册的菜单名称\n */\n this.allMenusName = [];\n /**\n * @type {string[]} 一级菜单的名称\n */\n this.level1MenusName = [];\n /**\n * @type {{ [parentName: string]: string[]}} 二级菜单的名称, e.g. {一级菜单名称: [二级菜单名称1, 二级菜单名称2]}\n */\n this.level2MenusName = {};\n this.init();\n }\n\n $newMenu(name) {\n if (this.hooks[name]) {\n return;\n }\n const { $cherry, customMenu } = this.toolbar.options;\n if (HookList[name]) {\n this.allMenusName.push(name);\n this.hooks[name] = new HookList[name]($cherry);\n } else if (customMenu !== undefined && customMenu !== null && customMenu[name]) {\n this.allMenusName.push(name);\n // 如果是自定义菜单,传参兼容旧版\n this.hooks[name] = new customMenu[name]($cherry);\n }\n }\n\n /**\n * 根据配置动态渲染、绑定工具栏\n * @returns\n */\n init() {\n const { buttonConfig } = this.toolbar.options;\n buttonConfig.forEach((item) => {\n if (typeof item === 'string') {\n this.level1MenusName.push(item);\n this.$newMenu(item);\n } else if (typeof item === 'object') {\n const keys = Object.keys(item);\n if (keys.length === 1) {\n // 只接受形如{ name: [ subMenu ] }的参数\n const [name] = keys;\n this.level1MenusName.push(name);\n this.$newMenu(name);\n this.level2MenusName[name] = item[name];\n item[name].forEach((subItem) => {\n this.$newMenu(subItem);\n });\n }\n }\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { mac } from 'codemirror/src/util/browser';\nimport HookCenter from './HookCenter';\nimport Event from '@/Event';\nimport { createElement } from '@/utils/dom';\nimport Logger from '@/Logger';\n\nexport default class Toolbar {\n /**\n * @type {Record} 外部获取 toolbarHandler\n */\n toolbarHandlers = {};\n\n constructor(options) {\n // 存储所有菜单的实例\n this.menus = {};\n // 存储所有快捷键的影射 {快捷键: 菜单名称}\n this.shortcutKeyMap = {};\n // 存储所有二级菜单面板\n this.subMenus = {};\n // 默认的菜单配置\n this.options = {\n dom: document.createElement('div'),\n buttonConfig: ['bold'],\n customMenu: [],\n };\n\n Object.assign(this.options, options);\n this.$cherry = this.options.$cherry;\n this.instanceId = this.$cherry.instanceId;\n this.menus = new HookCenter(this);\n this.drawMenus();\n this.init();\n }\n\n init() {\n this.collectShortcutKey();\n this.collectToolbarHandler();\n Event.on(this.instanceId, Event.Events.cleanAllSubMenus, () => this.hidAlleSubMenu());\n }\n\n previewOnly() {\n this.options.dom.classList.add('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarHide);\n }\n\n showToolbar() {\n this.options.dom.classList.remove('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarShow);\n }\n\n isHasLevel2Menu(name) {\n // FIXME: return boolean\n return this.menus.level2MenusName[name];\n }\n\n isHasConfigMenu(name) {\n // FIXME: return boolean\n return this.menus.hooks[name].subMenuConfig || [];\n }\n\n /**\n * 判断是否有子菜单,目前有两种子菜单配置方式:1、通过`subMenuConfig`属性 2、通过`buttonConfig`配置属性\n * @param {string} name\n * @returns {boolean} 是否有子菜单\n */\n isHasSubMenu(name) {\n return Boolean(this.isHasLevel2Menu(name) || this.isHasConfigMenu(name).length > 0);\n }\n\n /**\n * 根据配置画出来一级工具栏\n */\n drawMenus() {\n const frag = document.createDocumentFragment();\n this.menus.level1MenusName.forEach((name) => {\n const btn = this.menus.hooks[name].createBtn();\n btn.addEventListener(\n 'click',\n (event) => {\n this.onClick(event, name);\n },\n false,\n );\n if (this.isHasSubMenu(name)) {\n btn.classList.add('cherry-toolbar-dropdown');\n }\n frag.appendChild(btn);\n });\n this.options.dom.appendChild(frag);\n }\n\n drawSubMenus(name) {\n const menu = this.menus.hooks[name];\n const pos = menu.getMenuPosition();\n this.subMenus[name] = createElement('div', 'cherry-dropdown', { name });\n this.subMenus[name].style.left = `${pos.left + pos.width / 2}px`;\n this.subMenus[name].style.top = `${pos.top + pos.height}px`;\n this.subMenus[name].style.position = menu.positionModel;\n // 如果有配置的二级菜单\n const level2MenusName = this.isHasLevel2Menu(name);\n if (level2MenusName) {\n level2MenusName.forEach((level2Name) => {\n const subMenu = this.menus.hooks[level2Name];\n if (subMenu !== undefined && typeof subMenu.createBtn === 'function') {\n const btn = subMenu.createBtn(true);\n // 二级菜单的dom认定为一级菜单的\n subMenu.dom = subMenu.dom ? subMenu.dom : this.menus.hooks[name].dom;\n btn.addEventListener('click', (event) => this.onClick(event, level2Name, true), false);\n this.subMenus[name].appendChild(btn);\n }\n });\n }\n // 兼容旧版本配置的二级菜单\n const subMenuConfig = this.isHasConfigMenu(name);\n if (subMenuConfig.length > 0) {\n subMenuConfig.forEach((config) => {\n const btn = this.menus.hooks[name].createSubBtnByConfig(config);\n btn.addEventListener('click', () => this.hidAlleSubMenu(), false);\n this.subMenus[name].appendChild(btn);\n });\n }\n this.$cherry.wrapperDom.appendChild(this.subMenus[name]);\n }\n\n onClick(event, name, focusEvent = false) {\n const menu = this.menus.hooks[name];\n if (!menu) {\n return;\n }\n if (this.isHasSubMenu(name) && !focusEvent) {\n this.toggleSubMenu(name);\n } else {\n this.hidAlleSubMenu();\n menu.fire(event, name);\n }\n }\n\n toggleSubMenu(name) {\n this.hidAlleSubMenu(); // 切换前先隐藏所有的二级菜单,就不会出现首次点击的时候多个二级菜单的问题 add by ufec\n if (this.subMenus[name]) {\n const test = this.subMenus[name].style.display;\n this.subMenus[name].style.display = test === 'none' ? 'block' : 'none';\n } else {\n this.drawSubMenus(name);\n }\n }\n\n /**\n * 隐藏所有的二级菜单\n */\n hidAlleSubMenu() {\n this.$cherry.wrapperDom.querySelectorAll('.cherry-dropdown').forEach((dom) => {\n dom.style.display = 'none';\n });\n }\n\n /**\n * 收集快捷键\n */\n collectShortcutKey() {\n this.menus.allMenusName.forEach((name) => {\n this.menus.hooks[name].shortcutKeys?.forEach((key) => {\n this.shortcutKeyMap[key] = name;\n });\n });\n }\n\n collectToolbarHandler() {\n this.toolbarHandlers = this.menus.allMenusName.reduce((handlerMap, name) => {\n const menuHook = this.menus.hooks[name];\n if (!menuHook) {\n return handlerMap;\n }\n handlerMap[name] = (shortcut, _callback) => {\n if (typeof _callback === 'function') {\n Logger.warn(\n 'MenuBase#onClick param callback is no longer supported. Please register the callback via MenuBase#registerAfterClickCb instead.',\n );\n }\n menuHook.fire.call(menuHook, undefined, shortcut);\n };\n return handlerMap;\n }, {});\n }\n\n /**\n * 监测是否有对应的快捷键\n * @param {KeyboardEvent} evt keydown 事件\n * @returns {boolean} 是否有对应的快捷键\n */\n matchShortcutKey(evt) {\n return !!this.shortcutKeyMap[this.getCurrentKey(evt)];\n }\n\n /**\n * 触发对应快捷键的事件\n * @param {KeyboardEvent} evt\n */\n fireShortcutKey(evt) {\n const currentKey = this.getCurrentKey(evt);\n this.menus.hooks[this.shortcutKeyMap[currentKey]]?.fire(evt, currentKey);\n }\n\n /**\n * 格式化当前按键,mac下的command按键转换为ctrl\n * @param {KeyboardEvent} event\n * @returns\n */\n getCurrentKey(event) {\n let key = '';\n if (event.ctrlKey) {\n key += 'Ctrl-';\n }\n\n if (event.altKey) {\n key += 'Alt-';\n }\n\n if (event.metaKey && mac) {\n key += 'Ctrl-';\n }\n\n // 如果存在shift键\n if (event.shiftKey) {\n key += `Shift-`;\n }\n\n // 如果还有第三个键 且不是 shift键\n if (event.key && event.key.toLowerCase() !== 'shift') {\n key += event.key.toLowerCase();\n }\n\n return key;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 在编辑区域选中文本时浮现的bubble工具栏\n */\nexport default class Bubble extends Toolbar {\n /**\n * @type {'flex' | 'block'}\n */\n static displayType = 'flex';\n // constructor(options) {\n // super(options);\n // }\n\n set visible(visible) {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n if (visible) {\n bubbleStyle.display === 'none' && (this.bubbleDom.style.display = Bubble.displayType);\n // bubbleStyle.visibility !== 'visible' && (this.bubbleBottom.style.visibility = 'visible');\n } else {\n bubbleStyle.display !== 'none' && (this.bubbleDom.style.display = 'none');\n // bubbleStyle.visibility !== 'hidden' && (this.bubbleBottom.style.visibility = 'hidden');\n }\n }\n\n get visible() {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n return bubbleStyle.display !== 'none' && bubbleStyle.visibility !== 'hidden';\n }\n\n init() {\n this.options.editor = this.$cherry.editor;\n this.addSelectionChangeListener();\n this.bubbleDom = this.options.dom;\n this.editorDom = this.options.editor.getEditorDom();\n this.initBubbleDom();\n this.editorDom.querySelector('.CodeMirror').appendChild(this.bubbleDom);\n }\n\n /**\n * 计算编辑区域的偏移量\n * @returns {number} 编辑区域的滚动区域\n */\n getScrollTop() {\n return this.options.editor.editor.getScrollInfo().top;\n }\n\n /**\n * 当编辑区域滚动的时候自动隐藏bubble工具栏和子工具栏\n */\n updatePositionWhenScroll() {\n if (this.bubbleDom.style.display === Bubble.displayType) {\n this.bubbleDom.style.marginTop = `${parseFloat(this.bubbleDom.dataset.scrollTop) - this.getScrollTop()}px`;\n }\n }\n\n /**\n * 根据高度计算bubble工具栏出现的位置的高度\n * 根据宽度计算bubble工具栏出现的位置的left值,以及bubble工具栏三角箭头的left值\n * @param {number} top 高度\n * @param {number} width 选中文本内容的宽度\n */\n showBubble(top, width) {\n if (!this.visible) {\n this.visible = true;\n this.bubbleDom.style.marginTop = '0';\n this.bubbleDom.dataset.scrollTop = String(this.getScrollTop());\n }\n const positionLimit = this.editorDom.querySelector('.CodeMirror-lines').firstChild.getBoundingClientRect();\n const editorPosition = this.editorDom.getBoundingClientRect();\n const minLeft = positionLimit.left - editorPosition.left;\n const maxLeft = positionLimit.width + minLeft;\n const minTop = this.bubbleDom.offsetHeight * 2;\n let $top = top;\n if ($top < minTop) {\n // 如果高度小于编辑器的顶部,则让bubble工具栏出现在选中文本的下放\n $top += this.bubbleDom.offsetHeight - this.bubbleTop.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'block';\n this.bubbleBottom.style.display = 'none';\n } else {\n // 反之出现在选中文本内容的上方\n $top -= this.bubbleDom.offsetHeight + 2 * this.bubbleBottom.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'none';\n this.bubbleBottom.style.display = 'block';\n }\n this.bubbleDom.style.top = `${$top}px`;\n let left = width - this.bubbleDom.offsetWidth / 2;\n if (left < minLeft) {\n // 如果位置超过了编辑器的最左边,则控制bubble工具栏不超出编辑器最左边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = minLeft;\n this.$setBubbleCursorPosition(`${width - minLeft}px`);\n } else if (left + this.bubbleDom.offsetWidth > maxLeft) {\n // 如果位置超过了编辑器的最右边,则控制bubble工具栏不超出编辑器最右边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = maxLeft - this.bubbleDom.offsetWidth;\n this.$setBubbleCursorPosition(`${width - left}px`);\n } else {\n // 让bubble工具栏的箭头处于工具栏的中间位置\n this.$setBubbleCursorPosition('50%');\n }\n // 安全边距 20px\n this.bubbleDom.style.left = `${Math.max(20, left)}px`;\n }\n\n hideBubble() {\n this.visible = false;\n }\n\n /**\n * 控制bubble工具栏的箭头的位置\n * @param {string} left 左偏移量\n */\n $setBubbleCursorPosition(left = '50%') {\n if (left === '50%') {\n this.bubbleTop.style.left = '50%';\n this.bubbleBottom.style.left = '50%';\n } else {\n const $left = parseFloat(left) < 10 ? '10px' : left;\n this.bubbleTop.style.left = $left;\n this.bubbleBottom.style.left = $left;\n }\n }\n\n initBubbleDom() {\n const top = document.createElement('div');\n top.className = 'cherry-bubble-top';\n const bottom = document.createElement('div');\n bottom.className = 'cherry-bubble-bottom';\n this.bubbleTop = top;\n this.bubbleBottom = bottom;\n this.bubbleDom.appendChild(top);\n this.bubbleDom.appendChild(bottom);\n // 默认不可见\n this.visible = false;\n }\n\n getBubbleDom() {\n return this.bubbleDom;\n }\n\n addSelectionChangeListener() {\n this.options.editor.addListener('change', (codemirror) => {\n // 当编辑区内容变更时自动隐藏bubble工具栏\n this.hideBubble();\n });\n this.options.editor.addListener('refresh', (codemirror) => {\n // 当编辑区内容刷新时自动隐藏bubble工具栏\n this.hideBubble();\n });\n this.options.editor.addListener('scroll', (codemirror) => {\n // 当编辑区滚动时,需要实时同步bubble工具栏的位置\n this.updatePositionWhenScroll();\n });\n this.options.editor.addListener('beforeSelectionChange', (codemirror, info) => {\n // 当编辑区选中内容改变时,需要展示/隐藏bubble工具栏,并计算工具栏位置\n if (info.origin !== '*mouse' && (info.origin !== null || typeof info.origin === 'undefined')) {\n return true;\n }\n if (!info.ranges[0]) {\n return true;\n }\n const anchor = info.ranges[0].anchor.line * 1000000 + info.ranges[0].anchor.ch;\n const head = info.ranges[0].head.line * 1000000 + info.ranges[0].head.ch;\n let direction = 'asc';\n if (anchor > head) {\n direction = 'desc';\n }\n setTimeout(() => {\n const selections = codemirror.getSelections();\n if (selections.join('').length <= 0) {\n this.hideBubble();\n return;\n }\n const selectedObjs = codemirror.getWrapperElement().getElementsByClassName('CodeMirror-selected');\n const editorPosition = this.editorDom.getBoundingClientRect();\n let width = 0;\n let top = 0;\n if (typeof selectedObjs !== 'object' || selectedObjs.length <= 0) {\n this.hideBubble();\n return;\n }\n for (let key = 0; key < selectedObjs.length; key++) {\n const one = selectedObjs[key];\n const position = one.getBoundingClientRect();\n const targetTop = position.top - editorPosition.top;\n if (direction === 'asc') {\n if (targetTop >= top) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n } else {\n if (targetTop <= top || top <= 0) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n }\n }\n this.showBubble(top, width);\n }, 10);\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 当光标处于编辑器新行起始位置时出现的浮动工具栏\n */\nexport default class FloatMenu extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n\n init() {\n this.editor = this.$cherry.editor;\n this.editorDom = this.editor.getEditorDom();\n this.editorDom.querySelector('.CodeMirror-scroll').appendChild(this.options.dom);\n this.initAction();\n }\n\n initAction() {\n const self = this;\n this.editor.addListener('cursorActivity', (codemirror, evt) => {\n // 当编辑区光标位置改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('update', (codemirror, evt) => {\n // 当编辑区内容改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('refresh', (codemirror, evt) => {\n // 当编辑器刷新时触发\n setTimeout(() => {\n self.cursorActivity(evt, codemirror);\n }, 0);\n });\n }\n\n update(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n }\n\n /**\n * 当光标激活时触发,当光标处于行起始位置时展示float工具栏;反之隐藏\n * @param {Event} evt\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n cursorActivity(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n const codeMirrorLines = document.querySelector('.cherry-editor .CodeMirror-lines');\n if (!codeMirrorLines) {\n return false;\n }\n const computedLinesStyle = getComputedStyle(codeMirrorLines);\n const codeWrapPaddingLeft = parseFloat(computedLinesStyle.paddingLeft);\n const codeWrapPaddingTop = parseFloat(computedLinesStyle.paddingTop);\n // const cursorHandle = codeMirror.getLineHandle(pos.line);\n // const verticalMiddle = cursorHandle.height * 1 / 2;\n\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n this.options.dom.style.left = `${codeWrapPaddingLeft}px`;\n this.options.dom.style.top = `${this.getLineHeight(pos.line, codeMirror) + codeWrapPaddingTop}px`;\n }\n\n /**\n * 判断是否需要隐藏Float工具栏\n * 有选中内容,或者光标所在行有内容时隐藏float 工具栏\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns {boolean} 是否需要隐藏float工具栏,true:需要隐藏\n */\n isHidden(line, codeMirror) {\n const selections = codeMirror.getSelections();\n if (selections.length > 1) {\n return true;\n }\n const selection = codeMirror.getSelection();\n if (selection.length > 0) {\n return true;\n }\n if (codeMirror.getLine(line)) {\n return true;\n }\n return false;\n }\n\n /**\n * 获取对应行的行高度,用来让float 工具栏在该行保持垂直居中\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n getLineHeight(line, codeMirror) {\n let height = 0;\n codeMirror.getDoc().eachLine(0, line, (line) => {\n height += line.height;\n });\n\n return height;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 预览区域右侧悬浮的工具栏\n * 推荐放置跟编辑区域完全无关的工具栏\n * 比如复制预览区域内容、修改预览区域主题等\n */\nexport default class Sidebar extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n}\n","/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos, _fix_unicode) {\n // Check for equality\n if (text1 === text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n if (cursor_pos != null) {\n var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);\n if (editdiff) {\n return editdiff;\n }\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs, _fix_unicode);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i !== -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [\n [DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]\n ];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length === 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 !== 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (\n x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) === text2.charAt(y1)\n ) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (\n x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)\n ) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)\n ) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)\n ) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n var prefixLength = diff_commonPrefix(\n longtext.substring(i), shorttext.substring(j));\n var suffixLength = diff_commonSuffix(\n longtext.substring(0, i), shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(\n j - suffixLength, j) + shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [\n best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common\n ];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff\n */\nfunction diff_cleanupMerge(diffs, fix_unicode) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n diffs.splice(pointer, 1);\n continue;\n }\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n var previous_equality = pointer - count_insert - count_delete - 1;\n if (fix_unicode) {\n // prevent splitting of unicode surrogate pairs. when fix_unicode is true,\n // we assume that the old and new text in the diff are complete and correct\n // unicode-encoded JS strings, but the tuple boundaries may fall between\n // surrogate pairs. we fix this by shaving off stray surrogates from the end\n // of the previous equality and the beginning of this equality. this may create\n // empty equalities or a common prefix or suffix. for example, if AB and AC are\n // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and\n // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this\n // particular case, both equalities go away, we absorb any previous inequalities,\n // and we keep scanning for the next equality before rewriting the tuples.\n if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {\n var stray = diffs[previous_equality][1].slice(-1);\n diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);\n text_delete = stray + text_delete;\n text_insert = stray + text_insert;\n if (!diffs[previous_equality][1]) {\n // emptied out previous equality, so delete it and include previous delete/insert\n diffs.splice(previous_equality, 1);\n pointer--;\n var k = previous_equality - 1;\n if (diffs[k] && diffs[k][0] === DIFF_INSERT) {\n count_insert++;\n text_insert = diffs[k][1] + text_insert;\n k--;\n }\n if (diffs[k] && diffs[k][0] === DIFF_DELETE) {\n count_delete++;\n text_delete = diffs[k][1] + text_delete;\n k--;\n }\n previous_equality = k;\n }\n }\n if (starts_with_pair_end(diffs[pointer][1])) {\n var stray = diffs[pointer][1].charAt(0);\n diffs[pointer][1] = diffs[pointer][1].slice(1);\n text_delete += stray;\n text_insert += stray;\n }\n }\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n // for empty equality not at end, wait for next equality\n diffs.splice(pointer, 1);\n break;\n }\n if (text_delete.length > 0 || text_insert.length > 0) {\n // note that diff_commonPrefix and diff_commonSuffix are unicode-aware\n if (text_delete.length > 0 && text_insert.length > 0) {\n // Factor out any common prefixes.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if (previous_equality >= 0) {\n diffs[previous_equality][1] += text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixes.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] =\n text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length - commonlength);\n text_delete = text_delete.substring(0, text_delete.length - commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n var n = count_insert + count_delete;\n if (text_delete.length === 0 && text_insert.length === 0) {\n diffs.splice(pointer - n, n);\n pointer = pointer - n;\n } else if (text_delete.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 1;\n } else if (text_insert.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);\n pointer = pointer - n + 1;\n } else {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 2;\n }\n }\n if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] === DIFF_EQUAL &&\n diffs[pointer + 1][0] === DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs, fix_unicode);\n }\n};\n\nfunction is_surrogate_pair_start(charCode) {\n return charCode >= 0xD800 && charCode <= 0xDBFF;\n}\n\nfunction is_surrogate_pair_end(charCode) {\n return charCode >= 0xDC00 && charCode <= 0xDFFF;\n}\n\nfunction starts_with_pair_end(str) {\n return is_surrogate_pair_end(str.charCodeAt(0));\n}\n\nfunction ends_with_pair_start(str) {\n return is_surrogate_pair_start(str.charCodeAt(str.length - 1));\n}\n\nfunction remove_empty_tuples(tuples) {\n var ret = [];\n for (var i = 0; i < tuples.length; i++) {\n if (tuples[i][1].length > 0) {\n ret.push(tuples[i]);\n }\n }\n return ret;\n}\n\nfunction make_edit_splice(before, oldMiddle, newMiddle, after) {\n if (ends_with_pair_start(before) || starts_with_pair_end(after)) {\n return null;\n }\n return remove_empty_tuples([\n [DIFF_EQUAL, before],\n [DIFF_DELETE, oldMiddle],\n [DIFF_INSERT, newMiddle],\n [DIFF_EQUAL, after]\n ]);\n}\n\nfunction find_cursor_edit_diff(oldText, newText, cursor_pos) {\n // note: this runs after equality check has ruled out exact equality\n var oldRange = typeof cursor_pos === 'number' ?\n { index: cursor_pos, length: 0 } : cursor_pos.oldRange;\n var newRange = typeof cursor_pos === 'number' ?\n null : cursor_pos.newRange;\n // take into account the old and new selection to generate the best diff\n // possible for a text edit. for example, a text change from \"xxx\" to \"xx\"\n // could be a delete or forwards-delete of any one of the x's, or the\n // result of selecting two of the x's and typing \"x\".\n var oldLength = oldText.length;\n var newLength = newText.length;\n if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {\n // see if we have an insert or delete before or after cursor\n var oldCursor = oldRange.index;\n var oldBefore = oldText.slice(0, oldCursor);\n var oldAfter = oldText.slice(oldCursor);\n var maybeNewCursor = newRange ? newRange.index : null;\n editBefore: {\n // is this an insert or delete right before oldCursor?\n var newCursor = oldCursor + newLength - oldLength;\n if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {\n break editBefore;\n }\n if (newCursor < 0 || newCursor > newLength) {\n break editBefore;\n }\n var newBefore = newText.slice(0, newCursor);\n var newAfter = newText.slice(newCursor);\n if (newAfter !== oldAfter) {\n break editBefore;\n }\n var prefixLength = Math.min(oldCursor, newCursor);\n var oldPrefix = oldBefore.slice(0, prefixLength);\n var newPrefix = newBefore.slice(0, prefixLength);\n if (oldPrefix !== newPrefix) {\n break editBefore;\n }\n var oldMiddle = oldBefore.slice(prefixLength);\n var newMiddle = newBefore.slice(prefixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);\n }\n editAfter: {\n // is this an insert or delete right after oldCursor?\n if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {\n break editAfter;\n }\n var cursor = oldCursor;\n var newBefore = newText.slice(0, cursor);\n var newAfter = newText.slice(cursor);\n if (newBefore !== oldBefore) {\n break editAfter;\n }\n var suffixLength = Math.min(oldLength - cursor, newLength - cursor);\n var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);\n var newSuffix = newAfter.slice(newAfter.length - suffixLength);\n if (oldSuffix !== newSuffix) {\n break editAfter;\n }\n var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);\n var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);\n return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);\n }\n }\n if (oldRange.length > 0 && newRange && newRange.length === 0) {\n replaceRange: {\n // see if diff could be a splice of the old selection range\n var oldPrefix = oldText.slice(0, oldRange.index);\n var oldSuffix = oldText.slice(oldRange.index + oldRange.length);\n var prefixLength = oldPrefix.length;\n var suffixLength = oldSuffix.length;\n if (newLength < prefixLength + suffixLength) {\n break replaceRange;\n }\n var newPrefix = newText.slice(0, prefixLength);\n var newSuffix = newText.slice(newLength - suffixLength);\n if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {\n break replaceRange;\n }\n var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);\n var newMiddle = newText.slice(prefixLength, newLength - suffixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);\n }\n }\n\n return null;\n}\n\nfunction diff(text1, text2, cursor_pos) {\n // only pass fix_unicode=true at the top level, not when diff_main is\n // recursively invoked\n return diff_main(text1, text2, cursor_pos, true);\n}\n\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport diff from 'fast-diff';\n/**\n * 更新内容时保持光标不变\n * @param {Number} pos 光标相对文档开头的偏移量\n * @param {String} oldContent 变更前的内容\n * @param {String} newContent 变更后的内容\n * @returns {Number} newPos 新的光标偏移量\n */\nexport default function getPosBydiffs(pos, oldContent, newContent) {\n const diffs = diff(oldContent, newContent);\n let newPos = pos;\n let tmpPos = pos;\n for (let i = 0; i < diffs.length; i++) {\n const val = diffs[i];\n if (tmpPos <= 0) {\n return newPos;\n }\n const opType = val[0];\n const opLength = val[1].length;\n switch (opType) {\n // 没有改变的内容\n case diff.EQUAL:\n if (tmpPos <= opLength) {\n return newPos;\n }\n tmpPos -= opLength;\n break;\n // 删除的内容\n case diff.DELETE:\n if (tmpPos <= opLength) {\n return newPos - opLength + tmpPos;\n }\n tmpPos -= opLength;\n newPos -= opLength;\n break;\n // 新增的内容\n case diff.INSERT:\n newPos += opLength;\n break;\n }\n }\n return newPos;\n}\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys'),\n keysIn = require('./keysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst callbacks = {\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: (url, srcType) => url,\n fileUpload(file, callback) {\n if (/video/i.test(file.type)) {\n callback('images/demo-dog.png', {\n name: `${file.name.replace(/\\.[^.]+$/, '')}`,\n poster: 'images/demo-dog.png?poster=true',\n isBorder: true,\n isShadow: true,\n isRadius: true,\n });\n } else {\n callback('images/demo-dog.png', { name: `${file.name.replace(/\\.[^.]+$/, '')}`, isShadow: true });\n }\n },\n afterChange: (text, html) => {},\n afterInit: (text, html) => {},\n beforeImageMounted: (srcProp, src) => ({ srcProp, src }),\n onClickPreview: (event) => {},\n onCopyCode: (event, code) => {\n // 阻止默认的粘贴事件\n // return false;\n // 对复制内容进行额外处理\n return code;\n },\n // 获取中文的拼音\n changeString2Pinyin: (string) => {\n /**\n * 推荐使用这个组件:https://github.com/liu11hao11/pinyin_js\n *\n * 可以在 ../scripts/pinyin/pinyin_dist.js 里直接引用\n */\n return string;\n },\n};\n\n/** @type {Partial} */\nconst defaultConfig = {\n // 第三方包\n externals: {\n // externals\n },\n // 解析引擎配置\n engine: {\n // 全局配置\n global: {\n // 是否启用经典换行逻辑\n // true:一个换行会被忽略,两个以上连续换行会分割成段落,\n // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落\n classicBr: false,\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: callbacks.urlProcessor,\n /**\n * 额外允许渲染的html标签\n * 标签以英文竖线分隔,如:htmlWhiteList: 'iframe|script|style'\n * 默认为空,默认允许渲染的html见src/utils/sanitize.js whiteList 属性\n * 需要注意:\n * - 启用iframe、script等标签后,会产生xss注入,请根据实际场景判断是否需要启用\n * - 一般编辑权限可控的场景(如api文档系统)可以允许iframe、script等标签\n */\n htmlWhiteList: '',\n },\n // 内置语法配置\n syntax: {\n // 语法开关\n // 'hookName': false,\n // 语法配置\n // 'hookName': {\n //\n // }\n list: {\n listNested: false, // 同级列表类型转换后变为子级\n indentSpace: 2, // 默认2个空格缩进\n },\n table: {\n enableChart: false,\n // chartRenderEngine: EChartsTableEngine,\n // externals: ['echarts'],\n },\n inlineCode: {\n theme: 'red',\n },\n codeBlock: {\n theme: 'dark', // 默认为深色主题\n wrap: true, // 超出长度是否换行,false则显示滚动条\n lineNumber: true, // 默认显示行号\n copyCode: true, // 是否显示“复制”按钮\n customRenderer: {\n // 自定义语法渲染器\n },\n /**\n * indentedCodeBlock是缩进代码块是否启用的开关\n *\n * 在6.X之前的版本中默认不支持该语法。\n * 因为cherry的开发团队认为该语法太丑了(容易误触)\n * 开发团队希望用```代码块语法来彻底取代该语法\n * 但在后续的沟通中,开发团队发现在某些场景下该语法有更好的显示效果\n * 因此开发团队在6.X版本中才引入了该语法\n * 已经引用6.x以下版本的业务如果想做到用户无感知升级,可以去掉该语法:\n * indentedCodeBlock:false\n */\n indentedCodeBlock: true,\n },\n emoji: {\n useUnicode: true, // 是否使用unicode进行渲染\n },\n fontEmphasis: {\n /**\n * 是否允许首尾空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * __ hello __ ====> hello \n * __hello__ ====> hello\n * false:\n * __ hello __ ====> _ hello _\n * __hello__ ====> hello\n */\n allowWhitespace: false,\n },\n strikethrough: {\n /**\n * 是否必须有前后空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * hello wor~~l~~d ====> hello wor~~l~~d\n * hello wor ~~l~~ d ====> hello wor l d\n * false:\n * hello wor~~l~~d ====> hello world\n * hello wor ~~l~~ d ====> hello wor l d\n */\n needWhitespace: false,\n },\n mathBlock: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n plugins: true, // 默认加载插件\n },\n inlineMath: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n },\n toc: {\n /** 默认只渲染一个目录 */\n allowMultiToc: false,\n },\n header: {\n /**\n * 标题的样式:\n * - default 默认样式,标题前面有锚点\n * - autonumber 标题前面有自增序号锚点\n * - none 标题没有锚点\n */\n anchorStyle: 'default',\n },\n },\n },\n editor: {\n theme: 'default', // depend on codemirror theme name: https://codemirror.net/demo/theme.htm\n // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主\n height: '100%',\n // defaultModel 编辑器初始化后的默认模式,一共有三种模式:1、双栏编辑预览模式;2、纯编辑模式;3、预览模式\n // edit&preview: 双栏编辑预览模式\n // editOnly: 纯编辑模式(没有预览,可通过toolbar切换成双栏或预览模式)\n // previewOnly: 预览模式(没有编辑框,toolbar只显示“返回编辑”按钮,可通过toolbar切换成编辑模式)\n defaultModel: 'edit&preview',\n // 粘贴时是否自动将html转成markdown\n convertWhenPaste: true,\n codemirror: {\n // 是否自动focus 默认为true\n autofocus: true,\n },\n },\n toolbars: {\n theme: 'dark', // light or dark\n showToolbar: true, // false:不展示顶部工具栏; true:展示工具栏; toolbars.showToolbar=false 与 toolbars.toolbar=false 等效\n toolbar: [\n 'bold',\n 'italic',\n 'strikethrough',\n '|',\n 'color',\n 'header',\n 'ruby',\n '|',\n 'list',\n {\n insert: [\n 'image',\n 'audio',\n 'video',\n 'link',\n 'hr',\n 'br',\n 'code',\n 'formula',\n 'toc',\n 'table',\n 'line-table',\n 'bar-table',\n 'pdf',\n 'word',\n ],\n },\n 'graph',\n 'settings',\n ],\n sidebar: [],\n bubble: ['bold', 'italic', 'underline', 'strikethrough', 'sub', 'sup', 'quote', '|', 'size', 'color'], // array or false\n float: ['h1', 'h2', 'h3', '|', 'checklist', 'quote', 'quickTable', 'code'], // array or false\n },\n fileUpload: callbacks.fileUpload,\n /**\n * 上传文件的时候用来指定文件类型\n */\n fileTypeLimitMap: {\n video: 'video/*',\n audio: 'audio/*',\n image: 'image/*',\n word: '.doc,.docx',\n pdf: '.pdf',\n },\n callback: {\n afterChange: callbacks.afterChange,\n afterInit: callbacks.afterInit,\n beforeImageMounted: callbacks.beforeImageMounted,\n // 预览区域点击事件,previewer.enablePreviewerBubble = true 时生效\n onClickPreview: callbacks.onClickPreview,\n // 复制代码块代码时的回调\n onCopyCode: callbacks.onCopyCode,\n // 把中文变成拼音的回调,当然也可以把中文变成英文、英文变成中文\n changeString2Pinyin: callbacks.changeString2Pinyin,\n },\n previewer: {\n dom: false,\n className: 'cherry-markdown',\n // 是否启用预览区域编辑能力(目前支持编辑图片尺寸、编辑表格内容)\n enablePreviewerBubble: true,\n /**\n * 配置图片懒加载的逻辑\n * - 如果不希望图片懒加载,可配置成 lazyLoadImg = {noLoadImgNum: -1}\n * - 如果希望所有图片都无脑懒加载,可配置成 lazyLoadImg = {noLoadImgNum: 0, autoLoadImgNum: -1}\n * - 如果一共有15张图片,希望:\n * 1、前5张图片(1~5)直接加载;\n * 2、后5张图片(6~10)不论在不在视区内,都无脑懒加载;\n * 3、其他图片(11~15)在视区内时,进行懒加载;\n * 则配置应该为:lazyLoadImg = {noLoadImgNum: 5, autoLoadImgNum: 5}\n */\n lazyLoadImg: {\n // 加载图片时如果需要展示loading图,则配置loading图的地址\n loadingImgPath: '',\n // 同一时间最多有几个图片请求,最大同时加载6张图片\n maxNumPerTime: 2,\n // 不进行懒加载处理的图片数量,如果为0,即所有图片都进行懒加载处理, 如果设置为-1,则所有图片都不进行懒加载处理\n noLoadImgNum: 5,\n // 首次自动加载几张图片(不论图片是否滚动到视野内),autoLoadImgNum = -1 表示会自动加载完所有图片\n autoLoadImgNum: 5,\n // 针对加载失败的图片 或 beforeLoadOneImgCallback 返回false 的图片,最多尝试加载几次,为了防止死循环,最多5次。以图片的src为纬度统计重试次数\n maxTryTimesPerSrc: 2,\n // 加载一张图片之前的回调函数,函数return false 会终止加载操作\n beforeLoadOneImgCallback: (img) => {\n return true;\n },\n // 加载一张图片失败之后的回调函数\n failLoadOneImgCallback: (img) => {},\n // 加载一张图片之后的回调函数,如果图片加载失败,则不会回调该函数\n afterLoadOneImgCallback: (img) => {},\n // 加载完所有图片后调用的回调函数\n afterLoadAllImgCallback: () => {},\n },\n },\n /**\n * 配置主题,第三方可以自行扩展主题\n */\n theme: [\n { className: 'default', label: '默认' },\n { className: 'dark', label: '暗黑' },\n { className: 'light', label: '明亮' },\n { className: 'green', label: '清新' },\n { className: 'red', label: '热情' },\n ],\n // 预览页面不需要绑定事件\n isPreviewOnly: false,\n // 预览区域跟随编辑器光标自动滚动\n autoScrollByCursor: true,\n // 外层容器不存在时,是否强制输出到body上\n forceAppend: true,\n // The locale Cherry is going to use. Locales live in /src/locales/\n locale: 'zh_CN',\n};\n\nexport default cloneDeep(defaultConfig);\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport default {\n bold: '加粗', // 加粗\n code: '代码', // 代码\n graph: '画图', // 画图\n h1: '一级标题', // 一级标题\n h2: '二级标题', // 二级标题\n h3: '三级标题', // 三级标题\n h4: '四级标题', // 四级标题\n h5: '五级标题', // 五级标题\n header: '标题', // 标题\n insert: '插入', // 插入\n italic: '斜体', // 斜体\n list: '列表', // 列表\n quickTable: '表格', // 表格\n quote: '引用', // 引用\n size: '大小', // 大小\n color: '文字颜色&背景', // 文字颜色&背景\n strikethrough: '删除线', // 删除线\n sub: '下标', // 下标\n sup: '上标', // 上标\n togglePreview: '预览', // 预览\n fullScreen: '全屏', // 全屏\n image: '图片', // 图片\n audio: '音频', // 音频\n video: '视频', // 视频\n link: '超链接', // 超链接\n hr: '分隔线', // 分隔线\n br: '换行', // 换行\n toc: '目录', // 目录\n pdf: 'pdf', // pdf\n word: 'word', // word\n table: '表格', // 表格\n 'line-table': '折线表格', // 折线表格\n 'bar-table': '柱状表格', // 柱状表格\n formula: '公式', // 公式\n insertFormula: '公式', // 公式\n insertFlow: '流程图', // 流程图\n insertSeq: '时序图', // 时序图\n insertState: '状态图', // 状态图\n insertClass: '类图', // 类图\n insertPie: '饼图', // 饼图\n insertGantt: '甘特图', // 甘特图\n checklist: '清单', // 清单\n ol: '有序列表', // 有序列表\n ul: '无序列表', // 无序列表\n undo: '撤销', // 撤销\n redo: '恢复', // 恢复\n previewClose: '关闭预览', // 关闭预览\n codeTheme: '代码主题', // 代码主题\n switchModel: '模式切换', // 模式切换\n switchPreview: '预览', // 预览\n switchEdit: '返回编辑', // 返回编辑\n classicBr: '经典换行', // 经典换行\n normalBr: '常规换行', // 常规换行\n settings: '设置', // 设置\n mobilePreview: '移动端预览', // 移动端预览\n copy: '复制内容', // 复制内容\n export: '导出', // 导出PDF、长图\n underline: '下划线', // 下划线\n pinyin: '拼音', // 拼音\n pastePlain: '粘贴为纯文本格式', // 粘贴为纯文本格式\n pasteMarkdown: '粘贴为markdown格式', // 粘贴为markdown格式\n hide: '隐藏(ctrl+0)', // 隐藏(ctrl+0)\n exportToPdf: '导出PDF', // 导出PDF\n exportScreenshot: '导出长图', // 导出长图\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport default {\n bold: 'Bold',\n code: 'Code',\n graph: 'Graph',\n h1: 'Heading 1',\n h2: 'Heading 2',\n h3: 'Heading 3',\n h4: 'Heading 4',\n h5: 'Heading 5',\n header: 'Header',\n insert: 'Insert',\n italic: 'Italic',\n list: 'List',\n quickTable: 'Quick Table',\n quote: 'Quote',\n size: 'Size',\n color: 'Color',\n strikethrough: 'Strikethrough',\n sub: 'Sub',\n sup: 'Sup',\n togglePreview: 'Toggle Preview',\n fullScreen: 'Full Screen',\n image: 'Image',\n audio: 'Audio',\n video: 'Video',\n link: 'Link',\n hr: 'Horizontal Rule',\n br: 'New Line',\n toc: 'Table Of Content',\n pdf: 'PDF',\n word: 'Word',\n table: 'Table',\n 'line-table': 'Line Table',\n 'bar-table': 'Bar Table',\n formula: 'Formula',\n insertFormula: 'Insert Formula',\n insertFlow: 'Insert Flow',\n insertSeq: 'Insert Seq',\n insertState: 'Insert State',\n insertClass: 'Insert Class',\n insertPie: 'Insert Pie',\n insertGantt: 'Insert Gantt',\n checklist: 'Checklist',\n ol: 'Ordered List',\n ul: 'Unordered List',\n undo: 'Undo',\n redo: 'Redo',\n previewClose: 'Preview Close',\n codeTheme: 'Code Theme',\n switchModel: 'Switch Model',\n switchPreview: 'Switch Preview',\n switchEdit: 'Switch Edit',\n classicBr: 'Classic New Line',\n normalBr: 'Normal New Line',\n settings: 'Settings',\n mobilePreview: 'Mobile Preview',\n copy: 'Copy',\n export: 'Export',\n underline: 'Underline',\n pinyin: 'Pinyin',\n pastePlain: 'Paste as Plain Text',\n pasteMarkdown: 'Paste as Markdown',\n hide: 'Hide (ctrl+0)',\n exportToPdf: 'Export to PDF',\n exportScreenshot: 'Screenshot',\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport zhCn from './zh_CN';\nimport enUs from './en_US';\n\nexport default {\n zh_CN: zhCn,\n en_US: enUs,\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase, { HOOKS_TYPE_LIST } from './core/SyntaxBase';\nimport ParagraphBase from './core/ParagraphBase';\nimport MenuBase from './toolbars/MenuBase';\n\nfunction filterOptions(options, whiteList, propTypes) {\n const filteredOptions = {};\n Object.keys(options).forEach((key) => {\n if (whiteList.indexOf(key) === -1) {\n return;\n }\n if (typeof propTypes === 'object') {\n if (typeof propTypes[key] === 'string') {\n if (typeof options[key] === propTypes[key]) {\n filteredOptions[key] = options[key];\n }\n } else {\n if (options[key] instanceof propTypes[key]) {\n filteredOptions[key] = options[key];\n }\n }\n } else if (typeof propTypes === 'string') {\n if (typeof options[key] === propTypes) {\n filteredOptions[key] = options[key];\n }\n }\n });\n return filteredOptions;\n}\n\nexport function createSyntaxHook(name, type, options) {\n const BaseClass = type === HOOKS_TYPE_LIST.PAR ? ParagraphBase : SyntaxBase;\n const optionsWhiteList = ['beforeMakeHtml', 'makeHtml', 'afterMakeHtml', 'rule', 'test'];\n const filteredOptions = filterOptions(options, optionsWhiteList, 'function');\n const paragraphConfig = { needCache: options.needCache, defaultCache: options.defaultCache };\n return class CustomSyntax extends BaseClass {\n static HOOK_NAME = name;\n\n constructor(editorConfig = {}) {\n if (type === HOOKS_TYPE_LIST.PAR) {\n super({ needCache: !!paragraphConfig.needCache, defaultCache: paragraphConfig.defaultCache });\n } else {\n super();\n }\n\n this.config = editorConfig.config;\n }\n\n beforeMakeHtml(...args) {\n if (filteredOptions.beforeMakeHtml) {\n return filteredOptions.beforeMakeHtml.apply(this, args);\n }\n return super.beforeMakeHtml(...args);\n }\n\n makeHtml(...args) {\n if (filteredOptions.makeHtml) {\n return filteredOptions.makeHtml.apply(this, args);\n }\n return super.makeHtml(...args);\n }\n\n afterMakeHtml(...args) {\n if (filteredOptions.afterMakeHtml) {\n return filteredOptions.afterMakeHtml.apply(this, args);\n }\n return super.afterMakeHtml(...args);\n }\n\n test(...args) {\n if (filteredOptions.test) {\n return filteredOptions.test.apply(this, args);\n }\n return super.test(...args);\n }\n\n rule(...args) {\n if (filteredOptions.rule) {\n return filteredOptions.rule.apply(this, args);\n }\n return super.rule(...args);\n }\n };\n}\n\nexport function createMenuHook(name, options) {\n const optionsWhiteList = ['subMenuConfig', 'onClick', 'shortcutKeys', 'iconName'];\n const propTypes = {\n subMenuConfig: Array,\n onClick: 'function',\n shortcutKeys: Array,\n iconName: 'string',\n };\n const filteredOptions = filterOptions(options, optionsWhiteList, propTypes);\n return class CustomMenu extends MenuBase {\n constructor(editorInstance) {\n super(editorInstance);\n if (!filteredOptions.iconName) {\n this.noIcon = true;\n }\n this.setName(name, filteredOptions.iconName);\n this.subMenuConfig = filteredOptions.subMenuConfig || [];\n }\n\n onClick(...args) {\n if (filteredOptions.onClick) {\n return filteredOptions.onClick.apply(this, args);\n }\n return super.onClick(...args);\n }\n\n get shortcutKeys() {\n if (filteredOptions.shortcutKeys) {\n return filteredOptions.shortcutKeys;\n }\n return [];\n }\n };\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 本文件主要维护导出Cherry时需要附加在Cherry对象上的静态属性集合\n * 所有的具名导出都会挂载在Cherry或CherryEngine上\n */\nimport { HOOKS_TYPE_LIST } from './core/SyntaxBase';\nimport { createSyntaxHook, createMenuHook } from './Factory';\nimport { isBrowser } from './utils/env';\n\nconst constants = { HOOKS_TYPE_LIST };\n\nconst plugins = {};\nconst nodeIgnorePlugin = [];\n\nif (!isBrowser()) {\n nodeIgnorePlugin.forEach((key) => {\n delete plugins[key];\n });\n}\n\nconst VERSION = `${process.env.BUILD_VERSION}`;\n\nexport class CherryStatic {\n static createSyntaxHook = createSyntaxHook;\n static createMenuHook = createMenuHook;\n static constants = constants;\n static VERSION = VERSION;\n /**\n * @this {typeof import('./Cherry').default | typeof CherryStatic}\n * @param {{ install: (defaultConfig: any, ...args: any[]) => void }} PluginClass 插件Class\n * @param {...any} args 初始化插件的参数\n * @returns\n */\n static usePlugin(PluginClass, ...args) {\n if (this === CherryStatic) {\n throw new Error('`usePlugin` is not allowed to called through CherryStatic class.');\n }\n // @ts-ignore\n if (this.initialized) {\n throw new Error('The function `usePlugin` should be called before Cherry is instantiated.');\n }\n // @ts-ignore\n if (PluginClass.$cherry$mounted === true) {\n return;\n }\n // @ts-ignore\n PluginClass.install.apply(PluginClass, [this.config.defaults, ...args]);\n // @ts-ignore\n PluginClass.$cherry$mounted = true;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\nimport Editor from './Editor';\nimport Engine from './Engine';\nimport Previewer from './Previewer';\nimport Bubble from './toolbars/Bubble';\nimport FloatMenu from './toolbars/FloatMenu';\nimport Toolbar from './toolbars/Toolbar';\nimport { createElement } from './utils/dom';\nimport Sidebar from './toolbars/Sidebar';\nimport { customizer, getThemeFromLocal } from './utils/config';\nimport NestedError, { $expectTarget } from './utils/error';\nimport getPosBydiffs from './utils/recount-pos';\nimport defaultConfig from './Cherry.config';\nimport './sass/cherry.scss';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Event from './Event';\nimport locales from '@/locales/index';\n\nimport { urlProcessorProxy } from './UrlCache';\nimport { CherryStatic } from './CherryStatic';\n\n/** @typedef {import('~types/cherry').CherryOptions} CherryOptions */\nexport default class Cherry extends CherryStatic {\n /**\n * @protected\n */\n static initialized = false;\n /**\n * @readonly\n */\n static config = {\n /** @type {Partial} */\n defaults: defaultConfig,\n };\n\n /**\n * @param {Partial} options\n */\n constructor(options) {\n super();\n Cherry.initialized = true;\n const defaultConfigCopy = cloneDeep(Cherry.config.defaults);\n this.defaultToolbar = defaultConfigCopy.toolbars.toolbar;\n $expectTarget(options, Object);\n /**\n * @property\n * @type {Partial}\n */\n this.options = mergeWith({}, defaultConfigCopy, options, customizer);\n\n // loading the locale\n this.locale = locales[this.options.locale];\n\n if (typeof this.options.engine.global.urlProcessor === 'function') {\n this.options.engine.global.urlProcessor = urlProcessorProxy(this.options.engine.global.urlProcessor);\n }\n\n this.status = {\n toolbar: 'show',\n previewer: 'show',\n editor: 'show',\n };\n\n if (this.options.isPreviewOnly || this.options.editor.defaultModel === 'previewOnly') {\n this.options.toolbars.showToolbar = false;\n this.options.editor.defaultModel = 'previewOnly';\n this.status.editor = 'hide';\n this.status.toolbar = 'hide';\n }\n\n /**\n * @property\n * @type {string} 实例ID\n */\n this.instanceId = `cherry-${new Date().getTime()}${Math.random()}`;\n this.options.instanceId = this.instanceId;\n\n /**\n * @private\n * @type {Engine}\n */\n this.engine = new Engine(this.options, this);\n this.init();\n }\n\n /**\n * 初始化工具栏、编辑区、预览区等\n * @private\n */\n init() {\n let mountEl = this.options.id ? document.getElementById(this.options.id) : this.options.el;\n\n if (!mountEl) {\n if (!this.options.forceAppend) {\n return false;\n }\n mountEl = document.createElement('div');\n mountEl.id = this.options.id || 'cherry-markdown';\n document.body.appendChild(mountEl);\n }\n\n if (!mountEl.style.height) {\n mountEl.style.height = this.options.editor.height;\n }\n this.cherryDom = mountEl;\n\n // 蒙层dom,用来拖拽编辑区&预览区宽度时展示蒙层\n const wrapperDom = this.createWrapper();\n // 创建编辑区\n const editor = this.createEditor();\n // 创建预览区\n const previewer = this.createPreviewer();\n\n if (this.options.toolbars.showToolbar === false || this.options.toolbars.toolbar === false) {\n // 即便配置了不展示工具栏,也要让工具栏加载对应的语法hook\n wrapperDom.classList.add('cherry--no-toolbar');\n this.options.toolbars.toolbar = this.defaultToolbar;\n }\n $expectTarget(this.options.toolbars.toolbar, Array);\n // 创建顶部工具栏\n this.toolbar = this.createToolbar();\n // 创建预览区域的侧边工具栏\n this.sidebar = this.createSidebar();\n\n const wrapperFragment = document.createDocumentFragment();\n wrapperFragment.appendChild(this.toolbar.options.dom);\n wrapperFragment.appendChild(editor.options.editorDom);\n wrapperFragment.appendChild(this.sidebar.options.dom);\n if (!this.options.previewer.dom) {\n wrapperFragment.appendChild(previewer.options.previewerDom);\n }\n wrapperFragment.appendChild(previewer.options.virtualDragLineDom);\n wrapperFragment.appendChild(previewer.options.editorMaskDom);\n wrapperFragment.appendChild(previewer.options.previewerMaskDom);\n\n wrapperDom.appendChild(wrapperFragment);\n mountEl.appendChild(wrapperDom);\n\n editor.init(previewer);\n // 创建bubble工具栏,所谓bubble工具栏,是指在编辑区选中文本时悬浮出现的工具栏\n this.createBubble();\n // 创建float工具栏,所谓float工具栏,是指当编辑区光标处于新行时,在行内联想出的工具栏\n this.createFloatMenu();\n previewer.init(editor);\n\n previewer.registerAfterUpdate(this.engine.mounted.bind(this.engine));\n\n // default value init\n this.initText(editor.editor);\n\n // 切换模式,有纯预览模式、纯编辑模式、双栏编辑模式\n this.switchModel(this.options.editor.defaultModel);\n\n Event.on(this.instanceId, Event.Events.toolbarHide, () => {\n this.status.toolbar = 'hide';\n });\n Event.on(this.instanceId, Event.Events.toolbarShow, () => {\n this.status.toolbar = 'show';\n });\n Event.on(this.instanceId, Event.Events.previewerClose, () => {\n this.status.previewer = 'hide';\n });\n Event.on(this.instanceId, Event.Events.previewerOpen, () => {\n this.status.previewer = 'show';\n });\n Event.on(this.instanceId, Event.Events.editorClose, () => {\n this.status.editor = 'hide';\n });\n Event.on(this.instanceId, Event.Events.editorOpen, () => {\n this.status.editor = 'show';\n });\n }\n\n /**\n * 切换编辑模式\n * @param {'edit&preview'|'editOnly'|'previewOnly'} model 模式类型\n * 一般纯预览模式和纯编辑模式适合在屏幕较小的终端使用,比如手机移动端\n *\n * @returns\n */\n switchModel(model = 'edit&preview') {\n switch (model) {\n case 'edit&preview':\n if (this.previewer) {\n this.previewer.editOnly(true);\n this.previewer.recoverPreviewer();\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'editOnly':\n if (!this.previewer.isPreviewerHidden()) {\n this.previewer.editOnly(true);\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'previewOnly':\n this.previewer.previewOnly();\n this.toolbar && this.toolbar.previewOnly();\n break;\n }\n }\n\n /**\n * 获取实例id\n * @returns {string}\n * @public\n */\n getInstanceId() {\n return this.instanceId;\n }\n\n /**\n * 获取编辑器状态\n * @returns {Object}\n */\n getStatus() {\n return this.status;\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getValue() {\n return this.editor.editor.getValue();\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getMarkdown() {\n return this.getValue();\n }\n\n /**\n * 获取CodeMirror实例\n * @returns CodeMirror实例\n */\n getCodeMirror() {\n return this.editor.editor;\n }\n\n /**\n * 获取预览区内的html内容\n * @param {boolean} wrapTheme 是否在外层包裹主题class\n * @returns html内容\n */\n getHtml(wrapTheme = true) {\n return this.previewer.getValue(wrapTheme);\n }\n\n getPreviewer() {\n return this.previewer;\n }\n\n /**\n * 获取目录,目录由head1~6组成\n * @returns 标题head数组\n */\n getToc() {\n const str = this.getHtml();\n /** @type {({level: number;id: string;text: string})[]} */\n const headerList = [];\n const headerRegex = /(.+?)<\\/h[0-6]>/g;\n str.replace(headerRegex, (match, level, id, text) => {\n headerList.push({ level: +level, id, text });\n return match;\n });\n return headerList;\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setValue(content, keepCursor = false) {\n if (keepCursor === false) {\n return this.editor.editor.setValue(content);\n }\n const codemirror = this.editor.editor;\n const old = this.getValue();\n const pos = codemirror.getDoc().indexFromPos(codemirror.getCursor());\n const newPos = getPosBydiffs(pos, old, content);\n const ret = codemirror.setValue(content);\n const cursor = codemirror.getDoc().posFromIndex(newPos);\n codemirror.setCursor(cursor);\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insert(content, isSelect = false, anchor = false, focus = true) {\n if (anchor) {\n this.editor.editor.setSelection({ line: anchor[0], ch: anchor[1] }, { line: anchor[0], ch: anchor[1] });\n }\n const ret = this.editor.editor.replaceSelection(content, isSelect ? 'around' : 'end');\n focus && this.editor.editor.focus();\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insertValue(content, isSelect = false, anchor = false, focus = true) {\n return this.insert(content, isSelect, anchor, focus);\n }\n\n /**\n * 强制重新渲染预览区域\n */\n refreshPreviewer() {\n try {\n const markdownText = this.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.refresh(html);\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setMarkdown(content, keepCursor = false) {\n return this.setValue(content, keepCursor);\n }\n\n /**\n * @private\n * @returns\n */\n createWrapper() {\n const toolbarTheme = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n // TODO: 完善类型\n const inlineCodeTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.inlineCode).theme;\n let codeBlockTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.codeBlock).theme;\n if (codeBlockTheme === 'dark') codeBlockTheme = 'tomorrow-night';\n else if (codeBlockTheme === 'light') codeBlockTheme = 'solarized-light';\n const wrapperDom = createElement('div', ['cherry', 'clearfix', getThemeFromLocal(true)].join(' '), {\n 'data-toolbarTheme': toolbarTheme,\n 'data-inlineCodeTheme': inlineCodeTheme,\n 'data-codeBlockTheme': codeBlockTheme,\n });\n this.wrapperDom = wrapperDom;\n return wrapperDom;\n }\n\n /**\n * @private\n * @returns\n */\n createToolbar() {\n const dom = createElement('div', 'cherry-toolbar');\n this.toolbar = new Toolbar({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.toolbar,\n customMenu: this.options.toolbars.customMenu,\n });\n return this.toolbar;\n }\n\n /**\n * @private\n * @returns\n */\n createSidebar() {\n const externalClass = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n const dom = createElement('div', `cherry-sidebar ${externalClass}`);\n this.sidebar = new Sidebar({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.sidebar,\n customMenu: this.options.toolbars.customMenu,\n });\n return this.sidebar;\n }\n\n /**\n * @private\n * @returns\n */\n createFloatMenu() {\n const dom = createElement('div', 'cherry-floatmenu');\n if (this.options.toolbars.float) {\n $expectTarget(this.options.toolbars.float, Array);\n this.floatMenu = new FloatMenu({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.float,\n });\n }\n }\n\n /**\n * @private\n * @returns\n */\n createBubble() {\n const dom = createElement('div', 'cherry-bubble');\n if (this.options.toolbars.bubble) {\n $expectTarget(this.options.toolbars.bubble, Array);\n this.bubble = new Bubble({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.bubble,\n engine: this.engine,\n });\n }\n }\n\n /**\n * @private\n * @returns {import('@/Editor').default}\n */\n createEditor() {\n const textArea = createElement('textarea', '', { id: 'code', name: 'code' });\n textArea.textContent = this.options.value;\n const editor = createElement('div', 'cherry-editor');\n editor.appendChild(textArea);\n\n this.editor = new Editor({\n $cherry: this,\n editorDom: editor,\n wrapperDom: this.wrapperDom,\n value: this.options.value,\n onKeydown: this.fireShortcutKey.bind(this),\n onChange: this.editText.bind(this),\n toolbars: this.options.toolbars,\n fileUpload: this.options.fileUpload,\n autoScrollByCursor: this.options.autoScrollByCursor,\n ...this.options.editor,\n });\n return this.editor;\n }\n\n /**\n * @private\n * @returns {import('@/Previewer').default}\n */\n createPreviewer() {\n /** @type {HTMLDivElement} */\n let previewer;\n const anchorStyle =\n (this.options.engine.syntax.header && this.options.engine.syntax.header.anchorStyle) || 'default';\n const autonumberClass = anchorStyle === 'autonumber' ? ' head-num' : '';\n const { className, dom, enablePreviewerBubble } = this.options.previewer;\n const previewerClassName = ['cherry-previewer', className || '', autonumberClass, getThemeFromLocal(true)].join(\n ' ',\n );\n if (dom) {\n previewer = dom;\n previewer.className += ` ${previewerClassName}`;\n } else {\n previewer = createElement('div', previewerClassName);\n }\n const virtualDragLine = createElement('div', 'cherry-drag');\n const editorMask = createElement('div', 'cherry-editor-mask');\n const previewerMask = createElement('div', 'cherry-previewer-mask');\n\n this.previewer = new Previewer({\n $cherry: this,\n virtualDragLineDom: virtualDragLine,\n editorMaskDom: editorMask,\n previewerMaskDom: previewerMask,\n previewerDom: previewer,\n value: this.options.value,\n isPreviewOnly: this.options.isPreviewOnly,\n enablePreviewerBubble,\n lazyLoadImg: this.options.previewer.lazyLoadImg,\n });\n\n return this.previewer;\n }\n\n /**\n * @private\n * @param {import('codemirror').Editor} codemirror\n */\n initText(codemirror) {\n try {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterInit) {\n this.options.callback.afterInit(markdownText, html);\n }\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {Event} _evt\n * @param {import('codemirror').Editor} codemirror\n */\n editText(_evt, codemirror) {\n try {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.timer = setTimeout(() => {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterChange) {\n this.options.callback.afterChange(markdownText, html);\n }\n // 强制每次编辑(包括undo、redo)编辑器都会自动滚动到光标位置\n codemirror.scrollIntoView(null);\n }, 50);\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {any} cb\n */\n onChange(cb) {\n this.editor.editor.on('change', (codeMirror) => {\n cb({\n markdown: codeMirror.getValue(), // 后续可以按需增加html或其他状态\n });\n });\n }\n\n /**\n * @private\n * @param {*} evt\n */\n fireShortcutKey(evt) {\n if (this.toolbar.matchShortcutKey(evt)) {\n // 快捷键\n evt.preventDefault();\n this.toolbar.fireShortcutKey(evt);\n }\n }\n\n /**\n * 导出预览区域内容\n * @public\n * @param {String} type 'pdf':导出成pdf文件; 'img':导出成图片\n */\n export(type = 'pdf') {\n this.previewer.export(type);\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Cherry from './Cherry';\n\nimport SyntaxHookBase from './core/SyntaxBase';\nimport MenuHookBase from './toolbars/MenuBase';\n\n// in browser\nif (window) {\n // @ts-ignore\n window.Cherry = Cherry;\n}\n\nexport { SyntaxHookBase, MenuHookBase };\n\nexport default Cherry;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\n\nconst DEFAULT_OPTIONS = {\n // TODO: themes\n theme: 'default',\n altFontFamily: 'sans-serif',\n fontFamily: 'sans-serif',\n themeCSS: '.label foreignObject { font-size: 90%; overflow: visible; } .label { font-family: sans-serif; }',\n flowchart: {\n useMaxWidth: false,\n },\n sequence: {\n useMaxWidth: false,\n },\n startOnLoad: false,\n logLevel: 5,\n // fontFamily: 'Arial, monospace'\n};\n\nexport default class MermaidCodeEngine {\n static TYPE = 'figure';\n\n static install(cherryOptions, ...args) {\n mergeWith(cherryOptions, {\n engine: {\n syntax: {\n codeBlock: {\n customRenderer: {\n mermaid: new MermaidCodeEngine(...args),\n },\n },\n },\n },\n });\n }\n\n mermaidAPIRefs = null;\n options = DEFAULT_OPTIONS;\n dom = null;\n mermaidCanvas = null;\n\n constructor(mermaidOptions = {}) {\n const { mermaid, mermaidAPI } = mermaidOptions;\n if (\n !mermaidAPI &&\n !window.mermaidAPI &&\n (!mermaid || !mermaid.mermaidAPI) &&\n (!window.mermaid || !window.mermaid.mermaidAPI)\n ) {\n throw new Error('code-block-mermaid-plugin[init]: Package mermaid or mermaidAPI not found.');\n }\n this.options = { ...DEFAULT_OPTIONS, ...(mermaidOptions || {}) };\n this.mermaidAPIRefs = mermaidAPI || window.mermaidAPI || mermaid.mermaidAPI || window.mermaid.mermaidAPI;\n delete this.options.mermaid;\n delete this.options.mermaidAPI;\n this.mermaidAPIRefs.initialize(this.options);\n }\n\n mountMermaidCanvas($engine) {\n if (this.mermaidCanvas && document.body.contains(this.mermaidCanvas)) {\n return;\n }\n this.mermaidCanvas = document.createElement('div');\n this.mermaidCanvas.style = 'width:1024px;opacity:0;position:fixed;top:100%;';\n const container = $engine.$cherry.wrapperDom || document.body;\n container.appendChild(this.mermaidCanvas);\n }\n\n /**\n * 转换svg为img,如果出错则直出svg\n * @param {string} svgCode\n * @param {string} graphId\n * @returns {string}\n */\n convertMermaidSvgToImg(svgCode, graphId) {\n const domParser = new DOMParser();\n let svgHtml;\n const injectSvgFallback = (svg) =>\n svg.replace('`;\n } else {\n svgHtml = injectSvgFallback(svgCode);\n }\n } catch (e) {\n svgHtml = injectSvgFallback(svgCode);\n }\n return svgHtml;\n }\n\n render(src, sign, $engine) {\n let $sign = sign;\n if (!$sign) {\n $sign = Math.round(Math.random() * 100000000);\n }\n this.mountMermaidCanvas($engine);\n let html;\n // 多实例的情况下相同的内容ID相同会导致mermaid渲染异常\n // 需要通过添加时间戳使得多次渲染相同内容的图像ID唯一\n // 图像渲染节流在CodeBlock Hook内部控制\n const graphId = `mermaid-${$sign}-${new Date().getTime()}`;\n try {\n this.mermaidAPIRefs.render(\n graphId,\n src,\n (svgCode) => {\n const fixedSvg = svgCode\n .replace(/\\s*markerUnits=\"0\"/g, '')\n .replace(/\\s*x=\"NaN\"/g, '')\n .replace(/
/g, '
');\n html = this.convertMermaidSvgToImg(fixedSvg, graphId);\n },\n this.mermaidCanvas,\n );\n } catch (e) {\n return false;\n }\n return html;\n }\n}\n","// @ts-nocheck\n/*\n * $Id: rawdeflate.js,v 0.3 2009/03/01 19:05:05 dankogai Exp dankogai $\n *\n * Original:\n * http://www.onicos.com/staff/iz/amuse/javascript/expert/deflate.txt\n */\n\n// if run as a web worker, respond to messages by deflating them\nconst deflate = (function () {\n /* Copyright (C) 1999 Masanao Izumo \n * Version: 1.0.1\n * LastModified: Dec 25 1999\n */\n\n /* Interface:\n * data = deflate(src);\n */\n\n /* constant parameters */\n const zip_WSIZE = 32768; // Sliding Window size\n const zip_STORED_BLOCK = 0;\n const zip_STATIC_TREES = 1;\n const zip_DYN_TREES = 2;\n\n /* for deflate */\n const zip_DEFAULT_LEVEL = 6;\n const zip_FULL_SEARCH = true;\n const zip_INBUFSIZ = 32768; // Input buffer size\n const zip_INBUF_EXTRA = 64; // Extra buffer\n const zip_OUTBUFSIZ = 1024 * 8;\n const zip_window_size = 2 * zip_WSIZE;\n const zip_MIN_MATCH = 3;\n const zip_MAX_MATCH = 258;\n const zip_BITS = 16;\n // for SMALL_MEM\n const zip_LIT_BUFSIZE = 0x2000;\n const zip_HASH_BITS = 13;\n // for MEDIUM_MEM\n // var zip_LIT_BUFSIZE = 0x4000;\n // var zip_HASH_BITS = 14;\n // for BIG_MEM\n // var zip_LIT_BUFSIZE = 0x8000;\n // var zip_HASH_BITS = 15;\n // if(zip_LIT_BUFSIZE > zip_INBUFSIZ)\n // alert(\"error: zip_INBUFSIZ is too small\");\n // if((zip_WSIZE<<1) > (1< zip_BITS-1)\n // alert(\"error: zip_HASH_BITS is too large\");\n // if(zip_HASH_BITS < 8 || zip_MAX_MATCH != 258)\n // alert(\"error: Code too clever\");\n const zip_DIST_BUFSIZE = zip_LIT_BUFSIZE;\n const zip_HASH_SIZE = 1 << zip_HASH_BITS;\n const zip_HASH_MASK = zip_HASH_SIZE - 1;\n const zip_WMASK = zip_WSIZE - 1;\n const zip_NIL = 0; // Tail of hash chains\n const zip_TOO_FAR = 4096;\n const zip_MIN_LOOKAHEAD = zip_MAX_MATCH + zip_MIN_MATCH + 1;\n const zip_MAX_DIST = zip_WSIZE - zip_MIN_LOOKAHEAD;\n const zip_SMALLEST = 1;\n const zip_MAX_BITS = 15;\n const zip_MAX_BL_BITS = 7;\n const zip_LENGTH_CODES = 29;\n const zip_LITERALS = 256;\n const zip_END_BLOCK = 256;\n const zip_L_CODES = zip_LITERALS + 1 + zip_LENGTH_CODES;\n const zip_D_CODES = 30;\n const zip_BL_CODES = 19;\n const zip_REP_3_6 = 16;\n const zip_REPZ_3_10 = 17;\n const zip_REPZ_11_138 = 18;\n const zip_HEAP_SIZE = 2 * zip_L_CODES + 1;\n const zip_H_SHIFT = parseInt((zip_HASH_BITS + zip_MIN_MATCH - 1) / zip_MIN_MATCH);\n\n /* variables */\n let zip_free_queue;\n let zip_qhead;\n let zip_qtail;\n let zip_initflag;\n let zip_outbuf = null;\n let zip_outcnt;\n let zip_outoff;\n let zip_complete;\n let zip_window;\n let zip_d_buf;\n let zip_l_buf;\n let zip_prev;\n let zip_bi_buf;\n let zip_bi_valid;\n let zip_block_start;\n let zip_ins_h;\n let zip_hash_head;\n let zip_prev_match;\n let zip_match_available;\n let zip_match_length;\n let zip_prev_length;\n let zip_strstart;\n let zip_match_start;\n let zip_eofile;\n let zip_lookahead;\n let zip_max_chain_length;\n let zip_max_lazy_match;\n let zip_compr_level;\n let zip_good_match;\n let zip_nice_match;\n let zip_dyn_ltree;\n let zip_dyn_dtree;\n let zip_static_ltree;\n let zip_static_dtree;\n let zip_bl_tree;\n let zip_l_desc;\n let zip_d_desc;\n let zip_bl_desc;\n let zip_bl_count;\n let zip_heap;\n let zip_heap_len;\n let zip_heap_max;\n let zip_depth;\n let zip_length_code;\n let zip_dist_code;\n let zip_base_length;\n let zip_base_dist;\n let zip_flag_buf;\n let zip_last_lit;\n let zip_last_dist;\n let zip_last_flags;\n let zip_flags;\n let zip_flag_bit;\n let zip_opt_len;\n let zip_static_len;\n let zip_deflate_data;\n let zip_deflate_pos;\n\n /* objects (deflate) */\n\n function zip_DeflateCT() {\n this.fc = 0; // frequency count or bit string\n this.dl = 0; // father node in Huffman tree or length of bit string\n }\n\n function zip_DeflateTreeDesc() {\n this.dyn_tree = null; // the dynamic tree\n this.static_tree = null; // corresponding static tree or NULL\n this.extra_bits = null; // extra bits for each code or NULL\n this.extra_base = 0; // base index for extra_bits\n this.elems = 0; // max number of elements in the tree\n this.max_length = 0; // max bit length for the codes\n this.max_code = 0; // largest code with non zero frequency\n }\n\n /* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\n function zip_DeflateConfiguration(a, b, c, d) {\n this.good_length = a; // reduce lazy search above this match length\n this.max_lazy = b; // do not perform lazy search above this match length\n this.nice_length = c; // quit search above this match length\n this.max_chain = d;\n }\n\n function zip_DeflateBuffer() {\n this.next = null;\n this.len = 0;\n this.ptr = new Array(zip_OUTBUFSIZ);\n this.off = 0;\n }\n\n /* constant tables */\n const zip_extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];\n const zip_extra_dbits = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 4,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 10,\n 11,\n 11,\n 12,\n 12,\n 13,\n 13,\n ];\n const zip_extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];\n const zip_bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n const zip_configuration_table = [\n new zip_DeflateConfiguration(0, 0, 0, 0),\n new zip_DeflateConfiguration(4, 4, 8, 4),\n new zip_DeflateConfiguration(4, 5, 16, 8),\n new zip_DeflateConfiguration(4, 6, 32, 32),\n new zip_DeflateConfiguration(4, 4, 16, 16),\n new zip_DeflateConfiguration(8, 16, 32, 32),\n new zip_DeflateConfiguration(8, 16, 128, 128),\n new zip_DeflateConfiguration(8, 32, 128, 256),\n new zip_DeflateConfiguration(32, 128, 258, 1024),\n new zip_DeflateConfiguration(32, 258, 258, 4096),\n ];\n\n /* routines (deflate) */\n\n function zip_deflate_start(level) {\n let i;\n\n if (!level) level = zip_DEFAULT_LEVEL;\n else if (level < 1) level = 1;\n else if (level > 9) level = 9;\n\n zip_compr_level = level;\n zip_initflag = false;\n zip_eofile = false;\n if (zip_outbuf != null) return;\n\n zip_free_queue = zip_qhead = zip_qtail = null;\n zip_outbuf = new Array(zip_OUTBUFSIZ);\n zip_window = new Array(zip_window_size);\n zip_d_buf = new Array(zip_DIST_BUFSIZE);\n zip_l_buf = new Array(zip_INBUFSIZ + zip_INBUF_EXTRA);\n zip_prev = new Array(1 << zip_BITS);\n zip_dyn_ltree = new Array(zip_HEAP_SIZE);\n for (i = 0; i < zip_HEAP_SIZE; i++) zip_dyn_ltree[i] = new zip_DeflateCT();\n zip_dyn_dtree = new Array(2 * zip_D_CODES + 1);\n for (i = 0; i < 2 * zip_D_CODES + 1; i++) zip_dyn_dtree[i] = new zip_DeflateCT();\n zip_static_ltree = new Array(zip_L_CODES + 2);\n for (i = 0; i < zip_L_CODES + 2; i++) zip_static_ltree[i] = new zip_DeflateCT();\n zip_static_dtree = new Array(zip_D_CODES);\n for (i = 0; i < zip_D_CODES; i++) zip_static_dtree[i] = new zip_DeflateCT();\n zip_bl_tree = new Array(2 * zip_BL_CODES + 1);\n for (i = 0; i < 2 * zip_BL_CODES + 1; i++) zip_bl_tree[i] = new zip_DeflateCT();\n zip_l_desc = new zip_DeflateTreeDesc();\n zip_d_desc = new zip_DeflateTreeDesc();\n zip_bl_desc = new zip_DeflateTreeDesc();\n zip_bl_count = new Array(zip_MAX_BITS + 1);\n zip_heap = new Array(2 * zip_L_CODES + 1);\n zip_depth = new Array(2 * zip_L_CODES + 1);\n zip_length_code = new Array(zip_MAX_MATCH - zip_MIN_MATCH + 1);\n zip_dist_code = new Array(512);\n zip_base_length = new Array(zip_LENGTH_CODES);\n zip_base_dist = new Array(zip_D_CODES);\n zip_flag_buf = new Array(parseInt(zip_LIT_BUFSIZE / 8));\n }\n\n function zip_deflate_end() {\n zip_free_queue = zip_qhead = zip_qtail = null;\n zip_outbuf = null;\n zip_window = null;\n zip_d_buf = null;\n zip_l_buf = null;\n zip_prev = null;\n zip_dyn_ltree = null;\n zip_dyn_dtree = null;\n zip_static_ltree = null;\n zip_static_dtree = null;\n zip_bl_tree = null;\n zip_l_desc = null;\n zip_d_desc = null;\n zip_bl_desc = null;\n zip_bl_count = null;\n zip_heap = null;\n zip_depth = null;\n zip_length_code = null;\n zip_dist_code = null;\n zip_base_length = null;\n zip_base_dist = null;\n zip_flag_buf = null;\n }\n\n function zip_reuse_queue(p) {\n p.next = zip_free_queue;\n zip_free_queue = p;\n }\n\n function zip_new_queue() {\n let p;\n\n if (zip_free_queue != null) {\n p = zip_free_queue;\n zip_free_queue = zip_free_queue.next;\n } else p = new zip_DeflateBuffer();\n p.next = null;\n p.len = p.off = 0;\n\n return p;\n }\n\n function zip_head1(i) {\n return zip_prev[zip_WSIZE + i];\n }\n\n function zip_head2(i, val) {\n return (zip_prev[zip_WSIZE + i] = val);\n }\n\n /* put_byte is used for the compressed output, put_ubyte for the\n * uncompressed output. However unlzw() uses window for its\n * suffix table instead of its output buffer, so it does not use put_ubyte\n * (to be cleaned up).\n */\n function zip_put_byte(c) {\n zip_outbuf[zip_outoff + zip_outcnt++] = c;\n if (zip_outoff + zip_outcnt == zip_OUTBUFSIZ) zip_qoutbuf();\n }\n\n /* Output a 16 bit value, lsb first */\n function zip_put_short(w) {\n w &= 0xffff;\n if (zip_outoff + zip_outcnt < zip_OUTBUFSIZ - 2) {\n zip_outbuf[zip_outoff + zip_outcnt++] = w & 0xff;\n zip_outbuf[zip_outoff + zip_outcnt++] = w >>> 8;\n } else {\n zip_put_byte(w & 0xff);\n zip_put_byte(w >>> 8);\n }\n }\n\n /* ==========================================================================\n * Insert string s in the dictionary and set match_head to the previous head\n * of the hash chain (the most recent string with same hash key). Return\n * the previous length of the hash chain.\n * IN assertion: all calls to to INSERT_STRING are made with consecutive\n * input characters and the first MIN_MATCH bytes of s are valid\n * (except for the last MIN_MATCH-1 bytes of the input file).\n */\n function zip_INSERT_STRING() {\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + zip_MIN_MATCH - 1] & 0xff)) & zip_HASH_MASK;\n zip_hash_head = zip_head1(zip_ins_h);\n zip_prev[zip_strstart & zip_WMASK] = zip_hash_head;\n zip_head2(zip_ins_h, zip_strstart);\n }\n\n /* Send a code of the given tree. c and tree must not have side effects */\n function zip_SEND_CODE(c, tree) {\n zip_send_bits(tree[c].fc, tree[c].dl);\n }\n\n /* Mapping from a distance to a distance code. dist is the distance - 1 and\n * must not have side effects. dist_code[256] and dist_code[257] are never\n * used.\n */\n function zip_D_CODE(dist) {\n return (dist < 256 ? zip_dist_code[dist] : zip_dist_code[256 + (dist >> 7)]) & 0xff;\n }\n\n /* ==========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\n function zip_SMALLER(tree, n, m) {\n return tree[n].fc < tree[m].fc || (tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]);\n }\n\n /* ==========================================================================\n * read string data\n */\n function zip_read_buff(buff, offset, n) {\n let i;\n for (i = 0; i < n && zip_deflate_pos < zip_deflate_data.length; i++)\n buff[offset + i] = zip_deflate_data.charCodeAt(zip_deflate_pos++) & 0xff;\n return i;\n }\n\n /* ==========================================================================\n * Initialize the \"longest match\" routines for a new file\n */\n function zip_lm_init() {\n let j;\n\n /* Initialize the hash table. */\n for (j = 0; j < zip_HASH_SIZE; j++)\n //\tzip_head2(j, zip_NIL);\n zip_prev[zip_WSIZE + j] = 0;\n /* prev will be initialized on the fly */\n\n /* Set the default configuration parameters:\n */\n zip_max_lazy_match = zip_configuration_table[zip_compr_level].max_lazy;\n zip_good_match = zip_configuration_table[zip_compr_level].good_length;\n if (!zip_FULL_SEARCH) zip_nice_match = zip_configuration_table[zip_compr_level].nice_length;\n zip_max_chain_length = zip_configuration_table[zip_compr_level].max_chain;\n\n zip_strstart = 0;\n zip_block_start = 0;\n\n zip_lookahead = zip_read_buff(zip_window, 0, 2 * zip_WSIZE);\n if (zip_lookahead <= 0) {\n zip_eofile = true;\n zip_lookahead = 0;\n return;\n }\n zip_eofile = false;\n /* Make sure that we always have enough lookahead. This is important\n * if input comes from a device such as a tty.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n\n /* If lookahead < MIN_MATCH, ins_h is garbage, but this is\n * not important since only literal bytes will be emitted.\n */\n zip_ins_h = 0;\n for (j = 0; j < zip_MIN_MATCH - 1; j++) {\n // UPDATE_HASH(ins_h, window[j]);\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[j] & 0xff)) & zip_HASH_MASK;\n }\n }\n\n /* ==========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n */\n function zip_longest_match(cur_match) {\n let chain_length = zip_max_chain_length; // max hash chain length\n let scanp = zip_strstart; // current string\n let matchp; // matched string\n let len; // length of current match\n let best_len = zip_prev_length; // best match length so far\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n const limit = zip_strstart > zip_MAX_DIST ? zip_strstart - zip_MAX_DIST : zip_NIL;\n\n const strendp = zip_strstart + zip_MAX_MATCH;\n let scan_end1 = zip_window[scanp + best_len - 1];\n let scan_end = zip_window[scanp + best_len];\n\n /* Do not waste too much time if we already have a good match: */\n if (zip_prev_length >= zip_good_match) chain_length >>= 2;\n\n // Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, \"insufficient lookahead\");\n\n do {\n // Assert(cur_match < encoder->strstart, \"no future\");\n matchp = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2:\n */\n if (\n zip_window[matchp + best_len] != scan_end ||\n zip_window[matchp + best_len - 1] != scan_end1 ||\n zip_window[matchp] != zip_window[scanp] ||\n zip_window[++matchp] != zip_window[scanp + 1]\n ) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scanp += 2;\n matchp++;\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {} while (\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n scanp < strendp\n );\n\n len = zip_MAX_MATCH - (strendp - scanp);\n scanp = strendp - zip_MAX_MATCH;\n\n if (len > best_len) {\n zip_match_start = cur_match;\n best_len = len;\n if (zip_FULL_SEARCH) {\n if (len >= zip_MAX_MATCH) break;\n } else {\n if (len >= zip_nice_match) break;\n }\n\n scan_end1 = zip_window[scanp + best_len - 1];\n scan_end = zip_window[scanp + best_len];\n }\n } while ((cur_match = zip_prev[cur_match & zip_WMASK]) > limit && --chain_length != 0);\n\n return best_len;\n }\n\n /* ==========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead, and sets eofile if end of input file.\n * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0\n * OUT assertions: at least one byte has been read, or eofile is set;\n * file reads are performed for at least two bytes (required for the\n * translate_eol option).\n */\n function zip_fill_window() {\n let n;\n let m;\n\n // Amount of free space at the end of the window.\n let more = zip_window_size - zip_lookahead - zip_strstart;\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (more == -1) {\n /* Very unlikely, but possible on 16 bit machine if strstart == 0\n * and lookahead == 1 (input done one byte at time)\n */\n more--;\n } else if (zip_strstart >= zip_WSIZE + zip_MAX_DIST) {\n /* By the IN assertion, the window is not empty so we can't confuse\n * more == 0 with more == 64K on a 16 bit machine.\n */\n //\tAssert(window_size == (ulg)2*WSIZE, \"no sliding with BIG_MEM\");\n\n //\tSystem.arraycopy(window, WSIZE, window, 0, WSIZE);\n for (n = 0; n < zip_WSIZE; n++) zip_window[n] = zip_window[n + zip_WSIZE];\n\n zip_match_start -= zip_WSIZE;\n zip_strstart -= zip_WSIZE; /* we now have strstart >= MAX_DIST: */\n zip_block_start -= zip_WSIZE;\n\n for (n = 0; n < zip_HASH_SIZE; n++) {\n m = zip_head1(n);\n zip_head2(n, m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL);\n }\n for (n = 0; n < zip_WSIZE; n++) {\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n m = zip_prev[n];\n zip_prev[n] = m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL;\n }\n more += zip_WSIZE;\n }\n // At this point, more >= 2\n if (!zip_eofile) {\n n = zip_read_buff(zip_window, zip_strstart + zip_lookahead, more);\n if (n <= 0) zip_eofile = true;\n else zip_lookahead += n;\n }\n }\n\n /* ==========================================================================\n * Processes a new input file and return its compressed length. This\n * function does not perform lazy evaluationof matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\n function zip_deflate_fast() {\n while (zip_lookahead != 0 && zip_qhead == null) {\n var flush; // set if current block must be flushed\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n zip_INSERT_STRING();\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (zip_hash_head != zip_NIL && zip_strstart - zip_hash_head <= zip_MAX_DIST) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n zip_match_length = zip_longest_match(zip_hash_head);\n /* longest_match() sets match_start */\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\n }\n if (zip_match_length >= zip_MIN_MATCH) {\n //\t check_match(strstart, match_start, match_length);\n\n flush = zip_ct_tally(zip_strstart - zip_match_start, zip_match_length - zip_MIN_MATCH);\n zip_lookahead -= zip_match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (zip_match_length <= zip_max_lazy_match) {\n zip_match_length--; // string at strstart already in hash table\n do {\n zip_strstart++;\n zip_INSERT_STRING();\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\n * these bytes are garbage, but it does not matter since\n * the next lookahead bytes will be emitted as literals.\n */\n } while (--zip_match_length != 0);\n zip_strstart++;\n } else {\n zip_strstart += zip_match_length;\n zip_match_length = 0;\n zip_ins_h = zip_window[zip_strstart] & 0xff;\n //\t\tUPDATE_HASH(ins_h, window[strstart + 1]);\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + 1] & 0xff)) & zip_HASH_MASK;\n\n // #if MIN_MATCH != 3\n //\t\tCall UPDATE_HASH() MIN_MATCH-3 more times\n // #endif\n }\n } else {\n /* No match, output a literal byte */\n flush = zip_ct_tally(0, zip_window[zip_strstart] & 0xff);\n zip_lookahead--;\n zip_strstart++;\n }\n if (flush) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n }\n }\n\n function zip_deflate_better() {\n /* Process the input block. */\n while (zip_lookahead != 0 && zip_qhead == null) {\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n zip_INSERT_STRING();\n\n /* Find the longest match, discarding those <= prev_length.\n */\n zip_prev_length = zip_match_length;\n zip_prev_match = zip_match_start;\n zip_match_length = zip_MIN_MATCH - 1;\n\n if (\n zip_hash_head != zip_NIL &&\n zip_prev_length < zip_max_lazy_match &&\n zip_strstart - zip_hash_head <= zip_MAX_DIST\n ) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n zip_match_length = zip_longest_match(zip_hash_head);\n /* longest_match() sets match_start */\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\n\n /* Ignore a length 3 match if it is too distant: */\n if (zip_match_length == zip_MIN_MATCH && zip_strstart - zip_match_start > zip_TOO_FAR) {\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n zip_match_length--;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (zip_prev_length >= zip_MIN_MATCH && zip_match_length <= zip_prev_length) {\n var flush; // set if current block must be flushed\n\n //\t check_match(strstart - 1, prev_match, prev_length);\n flush = zip_ct_tally(zip_strstart - 1 - zip_prev_match, zip_prev_length - zip_MIN_MATCH);\n\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted.\n */\n zip_lookahead -= zip_prev_length - 1;\n zip_prev_length -= 2;\n do {\n zip_strstart++;\n zip_INSERT_STRING();\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\n * these bytes are garbage, but it does not matter since the\n * next lookahead bytes will always be emitted as literals.\n */\n } while (--zip_prev_length != 0);\n zip_match_available = 0;\n zip_match_length = zip_MIN_MATCH - 1;\n zip_strstart++;\n if (flush) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n } else if (zip_match_available != 0) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n if (zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff)) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n zip_strstart++;\n zip_lookahead--;\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n zip_match_available = 1;\n zip_strstart++;\n zip_lookahead--;\n }\n\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n }\n }\n\n function zip_init_deflate() {\n if (zip_eofile) return;\n zip_bi_buf = 0;\n zip_bi_valid = 0;\n zip_ct_init();\n zip_lm_init();\n\n zip_qhead = null;\n zip_outcnt = 0;\n zip_outoff = 0;\n\n if (zip_compr_level <= 3) {\n zip_prev_length = zip_MIN_MATCH - 1;\n zip_match_length = 0;\n } else {\n zip_match_length = zip_MIN_MATCH - 1;\n zip_match_available = 0;\n }\n\n zip_complete = false;\n }\n\n /* ==========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\n function zip_deflate_internal(buff, off, buff_size) {\n let n;\n\n if (!zip_initflag) {\n zip_init_deflate();\n zip_initflag = true;\n if (zip_lookahead == 0) {\n // empty\n zip_complete = true;\n return 0;\n }\n }\n\n if ((n = zip_qcopy(buff, off, buff_size)) == buff_size) return buff_size;\n\n if (zip_complete) return n;\n\n if (zip_compr_level <= 3)\n // optimized for speed\n zip_deflate_fast();\n else zip_deflate_better();\n if (zip_lookahead == 0) {\n if (zip_match_available != 0) zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff);\n zip_flush_block(1);\n zip_complete = true;\n }\n return n + zip_qcopy(buff, n + off, buff_size - n);\n }\n\n function zip_qcopy(buff, off, buff_size) {\n let n;\n let i;\n let j;\n\n n = 0;\n while (zip_qhead != null && n < buff_size) {\n i = buff_size - n;\n if (i > zip_qhead.len) i = zip_qhead.len;\n // System.arraycopy(qhead.ptr, qhead.off, buff, off + n, i);\n for (j = 0; j < i; j++) buff[off + n + j] = zip_qhead.ptr[zip_qhead.off + j];\n\n zip_qhead.off += i;\n zip_qhead.len -= i;\n n += i;\n if (zip_qhead.len == 0) {\n var p;\n p = zip_qhead;\n zip_qhead = zip_qhead.next;\n zip_reuse_queue(p);\n }\n }\n\n if (n == buff_size) return n;\n\n if (zip_outoff < zip_outcnt) {\n i = buff_size - n;\n if (i > zip_outcnt - zip_outoff) i = zip_outcnt - zip_outoff;\n // System.arraycopy(outbuf, outoff, buff, off + n, i);\n for (j = 0; j < i; j++) buff[off + n + j] = zip_outbuf[zip_outoff + j];\n zip_outoff += i;\n n += i;\n if (zip_outcnt == zip_outoff) zip_outcnt = zip_outoff = 0;\n }\n return n;\n }\n\n /* ==========================================================================\n * Allocate the match buffer, initialize the various tables and save the\n * location of the internal file attribute (ascii/binary) and method\n * (DEFLATE/STORE).\n */\n function zip_ct_init() {\n let n; // iterates over tree elements\n let bits; // bit counter\n let length; // length value\n let code; // code value\n let dist; // distance index\n\n if (zip_static_dtree[0].dl != 0) return; // ct_init already called\n\n zip_l_desc.dyn_tree = zip_dyn_ltree;\n zip_l_desc.static_tree = zip_static_ltree;\n zip_l_desc.extra_bits = zip_extra_lbits;\n zip_l_desc.extra_base = zip_LITERALS + 1;\n zip_l_desc.elems = zip_L_CODES;\n zip_l_desc.max_length = zip_MAX_BITS;\n zip_l_desc.max_code = 0;\n\n zip_d_desc.dyn_tree = zip_dyn_dtree;\n zip_d_desc.static_tree = zip_static_dtree;\n zip_d_desc.extra_bits = zip_extra_dbits;\n zip_d_desc.extra_base = 0;\n zip_d_desc.elems = zip_D_CODES;\n zip_d_desc.max_length = zip_MAX_BITS;\n zip_d_desc.max_code = 0;\n\n zip_bl_desc.dyn_tree = zip_bl_tree;\n zip_bl_desc.static_tree = null;\n zip_bl_desc.extra_bits = zip_extra_blbits;\n zip_bl_desc.extra_base = 0;\n zip_bl_desc.elems = zip_BL_CODES;\n zip_bl_desc.max_length = zip_MAX_BL_BITS;\n zip_bl_desc.max_code = 0;\n\n // Initialize the mapping length (0..255) -> length code (0..28)\n length = 0;\n for (code = 0; code < zip_LENGTH_CODES - 1; code++) {\n zip_base_length[code] = length;\n for (n = 0; n < 1 << zip_extra_lbits[code]; n++) zip_length_code[length++] = code;\n }\n // Assert (length == 256, \"ct_init: length != 256\");\n\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n zip_length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n zip_base_dist[code] = dist;\n for (n = 0; n < 1 << zip_extra_dbits[code]; n++) {\n zip_dist_code[dist++] = code;\n }\n }\n // Assert (dist == 256, \"ct_init: dist != 256\");\n dist >>= 7; // from now on, all distances are divided by 128\n for (; code < zip_D_CODES; code++) {\n zip_base_dist[code] = dist << 7;\n for (n = 0; n < 1 << (zip_extra_dbits[code] - 7); n++) zip_dist_code[256 + dist++] = code;\n }\n // Assert (dist == 256, \"ct_init: 256+dist != 512\");\n\n // Construct the codes of the static literal tree\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\n n = 0;\n while (n <= 143) {\n zip_static_ltree[n++].dl = 8;\n zip_bl_count[8]++;\n }\n while (n <= 255) {\n zip_static_ltree[n++].dl = 9;\n zip_bl_count[9]++;\n }\n while (n <= 279) {\n zip_static_ltree[n++].dl = 7;\n zip_bl_count[7]++;\n }\n while (n <= 287) {\n zip_static_ltree[n++].dl = 8;\n zip_bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n zip_gen_codes(zip_static_ltree, zip_L_CODES + 1);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < zip_D_CODES; n++) {\n zip_static_dtree[n].dl = 5;\n zip_static_dtree[n].fc = zip_bi_reverse(n, 5);\n }\n\n // Initialize the first block of the first file:\n zip_init_block();\n }\n\n /* ==========================================================================\n * Initialize a new block.\n */\n function zip_init_block() {\n let n; // iterates over tree elements\n\n // Initialize the trees.\n for (n = 0; n < zip_L_CODES; n++) zip_dyn_ltree[n].fc = 0;\n for (n = 0; n < zip_D_CODES; n++) zip_dyn_dtree[n].fc = 0;\n for (n = 0; n < zip_BL_CODES; n++) zip_bl_tree[n].fc = 0;\n\n zip_dyn_ltree[zip_END_BLOCK].fc = 1;\n zip_opt_len = zip_static_len = 0;\n zip_last_lit = zip_last_dist = zip_last_flags = 0;\n zip_flags = 0;\n zip_flag_bit = 1;\n }\n\n /* ==========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\n function zip_pqdownheap(\n tree, // the tree to restore\n k,\n ) {\n // node to move down\n const v = zip_heap[k];\n let j = k << 1; // left son of k\n\n while (j <= zip_heap_len) {\n // Set j to the smallest of the two sons:\n if (j < zip_heap_len && zip_SMALLER(tree, zip_heap[j + 1], zip_heap[j])) j++;\n\n // Exit if v is smaller than both sons\n if (zip_SMALLER(tree, v, zip_heap[j])) break;\n\n // Exchange v with the smallest son\n zip_heap[k] = zip_heap[j];\n k = j;\n\n // And continue down the tree, setting j to the left son of k\n j <<= 1;\n }\n zip_heap[k] = v;\n }\n\n /* ==========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\n function zip_gen_bitlen(desc) {\n // the tree descriptor\n const tree = desc.dyn_tree;\n const extra = desc.extra_bits;\n const base = desc.extra_base;\n const { max_code } = desc;\n const { max_length } = desc;\n const stree = desc.static_tree;\n let h; // heap index\n let n;\n let m; // iterate over the tree elements\n let bits; // bit length\n let xbits; // extra bits\n let f; // frequency\n let overflow = 0; // number of elements with bit length too large\n\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[zip_heap[zip_heap_max]].dl = 0; // root of the heap\n\n for (h = zip_heap_max + 1; h < zip_HEAP_SIZE; h++) {\n n = zip_heap[h];\n bits = tree[tree[n].dl].dl + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n].dl = bits;\n // We overwrite tree[n].dl which is no longer needed\n\n if (n > max_code) continue; // not a leaf node\n\n zip_bl_count[bits]++;\n xbits = 0;\n if (n >= base) xbits = extra[n - base];\n f = tree[n].fc;\n zip_opt_len += f * (bits + xbits);\n if (stree != null) zip_static_len += f * (stree[n].dl + xbits);\n }\n if (overflow == 0) return;\n\n // This happens for example on obj2 and pic of the Calgary corpus\n\n // Find the first bit length which could increase:\n do {\n bits = max_length - 1;\n while (zip_bl_count[bits] == 0) bits--;\n zip_bl_count[bits]--; // move one leaf down the tree\n zip_bl_count[bits + 1] += 2; // move one overflow item as its brother\n zip_bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits != 0; bits--) {\n n = zip_bl_count[bits];\n while (n != 0) {\n m = zip_heap[--h];\n if (m > max_code) continue;\n if (tree[m].dl != bits) {\n zip_opt_len += (bits - tree[m].dl) * tree[m].fc;\n tree[m].fc = bits;\n }\n n--;\n }\n }\n }\n\n /* ==========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\n function zip_gen_codes(\n tree, // the tree to decorate\n max_code,\n ) {\n // largest code with non zero frequency\n const next_code = new Array(zip_MAX_BITS + 1); // next code value for each bit length\n let code = 0; // running code value\n let bits; // bit index\n let n; // code index\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= zip_MAX_BITS; bits++) {\n code = (code + zip_bl_count[bits - 1]) << 1;\n next_code[bits] = code;\n }\n\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n // Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<> 1; n >= 1; n--) zip_pqdownheap(tree, n);\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n do {\n n = zip_heap[zip_SMALLEST];\n zip_heap[zip_SMALLEST] = zip_heap[zip_heap_len--];\n zip_pqdownheap(tree, zip_SMALLEST);\n\n m = zip_heap[zip_SMALLEST]; // m = node of next least frequency\n\n // keep the nodes sorted by frequency\n zip_heap[--zip_heap_max] = n;\n zip_heap[--zip_heap_max] = m;\n\n // Create a new node father of n and m\n tree[node].fc = tree[n].fc + tree[m].fc;\n //\tdepth[node] = (char)(MAX(depth[n], depth[m]) + 1);\n if (zip_depth[n] > zip_depth[m] + 1) zip_depth[node] = zip_depth[n];\n else zip_depth[node] = zip_depth[m] + 1;\n tree[n].dl = tree[m].dl = node;\n\n // and insert the new node in the heap\n zip_heap[zip_SMALLEST] = node++;\n zip_pqdownheap(tree, zip_SMALLEST);\n } while (zip_heap_len >= 2);\n\n zip_heap[--zip_heap_max] = zip_heap[zip_SMALLEST];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n zip_gen_bitlen(desc);\n\n // The field len is now set, we can generate the bit codes\n zip_gen_codes(tree, max_code);\n }\n\n /* ==========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree. Updates opt_len to take into account the repeat\n * counts. (The contribution of the bit length codes will be added later\n * during the construction of bl_tree.)\n */\n function zip_scan_tree(\n tree, // the tree to be scanned\n max_code,\n ) {\n // and its largest code of non zero frequency\n let n; // iterates over all tree elements\n let prevlen = -1; // last emitted length\n let curlen; // length of current code\n let nextlen = tree[0].dl; // length of next code\n let count = 0; // repeat count of the current code\n let max_count = 7; // max repeat count\n let min_count = 4; // min repeat count\n\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[max_code + 1].dl = 0xffff; // guard\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[n + 1].dl;\n if (++count < max_count && curlen == nextlen) continue;\n else if (count < min_count) zip_bl_tree[curlen].fc += count;\n else if (curlen != 0) {\n if (curlen != prevlen) zip_bl_tree[curlen].fc++;\n zip_bl_tree[zip_REP_3_6].fc++;\n } else if (count <= 10) zip_bl_tree[zip_REPZ_3_10].fc++;\n else zip_bl_tree[zip_REPZ_11_138].fc++;\n count = 0;\n prevlen = curlen;\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen == nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n }\n\n /* ==========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\n function zip_send_tree(\n tree, // the tree to be scanned\n max_code,\n ) {\n // and its largest code of non zero frequency\n let n; // iterates over all tree elements\n let prevlen = -1; // last emitted length\n let curlen; // length of current code\n let nextlen = tree[0].dl; // length of next code\n let count = 0; // repeat count of the current code\n let max_count = 7; // max repeat count\n let min_count = 4; /* guard already set */ // min repeat count\n\n /* tree[max_code+1].dl = -1; */ if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[n + 1].dl;\n if (++count < max_count && curlen == nextlen) {\n continue;\n } else if (count < min_count) {\n do {\n zip_SEND_CODE(curlen, zip_bl_tree);\n } while (--count != 0);\n } else if (curlen != 0) {\n if (curlen != prevlen) {\n zip_SEND_CODE(curlen, zip_bl_tree);\n count--;\n }\n // Assert(count >= 3 && count <= 6, \" 3_6?\");\n zip_SEND_CODE(zip_REP_3_6, zip_bl_tree);\n zip_send_bits(count - 3, 2);\n } else if (count <= 10) {\n zip_SEND_CODE(zip_REPZ_3_10, zip_bl_tree);\n zip_send_bits(count - 3, 3);\n } else {\n zip_SEND_CODE(zip_REPZ_11_138, zip_bl_tree);\n zip_send_bits(count - 11, 7);\n }\n count = 0;\n prevlen = curlen;\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen == nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n }\n\n /* ==========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\n function zip_build_bl_tree() {\n let max_blindex; // index of last bit length code of non zero freq\n\n // Determine the bit length frequencies for literal and distance trees\n zip_scan_tree(zip_dyn_ltree, zip_l_desc.max_code);\n zip_scan_tree(zip_dyn_dtree, zip_d_desc.max_code);\n\n // Build the bit length tree:\n zip_build_tree(zip_bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = zip_BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (zip_bl_tree[zip_bl_order[max_blindex]].dl != 0) break;\n }\n /* Update opt_len to include the bit length tree and counts */\n zip_opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n // Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n\n return max_blindex;\n }\n\n /* ==========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\n function zip_send_all_trees(lcodes, dcodes, blcodes) {\n // number of codes for each tree\n let rank; // index in bl_order\n\n // Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n // Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n //\t \"too many codes\");\n // Tracev((stderr, \"\\nbl counts: \"));\n zip_send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\n zip_send_bits(dcodes - 1, 5);\n zip_send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\n for (rank = 0; rank < blcodes; rank++) {\n // Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n zip_send_bits(zip_bl_tree[zip_bl_order[rank]].dl, 3);\n }\n\n // send the literal tree\n zip_send_tree(zip_dyn_ltree, lcodes - 1);\n\n // send the distance tree\n zip_send_tree(zip_dyn_dtree, dcodes - 1);\n }\n\n /* ==========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\n function zip_flush_block(eof) {\n // true if this is the last block for a file\n let opt_lenb;\n let static_lenb; // opt_len and static_len in bytes\n let max_blindex; // index of last bit length code of non zero freq\n let stored_len; // length of input block\n\n stored_len = zip_strstart - zip_block_start;\n zip_flag_buf[zip_last_flags] = zip_flags; // Save the flags for the last 8 items\n\n // Construct the literal and distance trees\n zip_build_tree(zip_l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n\n zip_build_tree(zip_d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = zip_build_bl_tree();\n\n // Determine the best encoding. Compute first the block length in bytes\n opt_lenb = (zip_opt_len + 3 + 7) >> 3;\n static_lenb = (zip_static_len + 3 + 7) >> 3;\n\n // Trace((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u \",\n //\t opt_lenb, encoder->opt_len,\n //\t static_lenb, encoder->static_len, stored_len,\n //\t encoder->last_lit, encoder->last_dist));\n\n if (static_lenb <= opt_lenb) opt_lenb = static_lenb;\n if (\n stored_len + 4 <= opt_lenb && // 4: two words for the lengths\n zip_block_start >= 0\n ) {\n let i;\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n zip_send_bits((zip_STORED_BLOCK << 1) + eof, 3); /* send block type */\n zip_bi_windup(); /* align on byte boundary */\n zip_put_short(stored_len);\n zip_put_short(~stored_len);\n\n // copy block\n /*\n p = &window[block_start];\n for(i = 0; i < stored_len; i++)\n\tput_byte(p[i]);\n*/\n for (i = 0; i < stored_len; i++) zip_put_byte(zip_window[zip_block_start + i]);\n } else if (static_lenb == opt_lenb) {\n zip_send_bits((zip_STATIC_TREES << 1) + eof, 3);\n zip_compress_block(zip_static_ltree, zip_static_dtree);\n } else {\n zip_send_bits((zip_DYN_TREES << 1) + eof, 3);\n zip_send_all_trees(zip_l_desc.max_code + 1, zip_d_desc.max_code + 1, max_blindex + 1);\n zip_compress_block(zip_dyn_ltree, zip_dyn_dtree);\n }\n\n zip_init_block();\n\n if (eof != 0) zip_bi_windup();\n }\n\n /* ==========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\n function zip_ct_tally(\n dist, // distance of matched string\n lc,\n ) {\n // match length-MIN_MATCH or unmatched char (if dist==0)\n zip_l_buf[zip_last_lit++] = lc;\n if (dist == 0) {\n // lc is the unmatched char\n zip_dyn_ltree[lc].fc++;\n } else {\n // Here, lc is the match length - MIN_MATCH\n dist--; // dist = match distance - 1\n // Assert((ush)dist < (ush)MAX_DIST &&\n //\t (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n //\t (ush)D_CODE(dist) < (ush)D_CODES, \"ct_tally: bad match\");\n\n zip_dyn_ltree[zip_length_code[lc] + zip_LITERALS + 1].fc++;\n zip_dyn_dtree[zip_D_CODE(dist)].fc++;\n\n zip_d_buf[zip_last_dist++] = dist;\n zip_flags |= zip_flag_bit;\n }\n zip_flag_bit <<= 1;\n\n // Output the flags if they fill a byte\n if ((zip_last_lit & 7) == 0) {\n zip_flag_buf[zip_last_flags++] = zip_flags;\n zip_flags = 0;\n zip_flag_bit = 1;\n }\n // Try to guess if it is profitable to stop the current block here\n if (zip_compr_level > 2 && (zip_last_lit & 0xfff) == 0) {\n // Compute an upper bound for the compressed length\n let out_length = zip_last_lit * 8;\n const in_length = zip_strstart - zip_block_start;\n let dcode;\n\n for (dcode = 0; dcode < zip_D_CODES; dcode++) {\n out_length += zip_dyn_dtree[dcode].fc * (5 + zip_extra_dbits[dcode]);\n }\n out_length >>= 3;\n // Trace((stderr,\"\\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) \",\n //\t encoder->last_lit, encoder->last_dist, in_length, out_length,\n //\t 100L - out_length*100L/in_length));\n if (zip_last_dist < parseInt(zip_last_lit / 2) && out_length < parseInt(in_length / 2)) return true;\n }\n return zip_last_lit == zip_LIT_BUFSIZE - 1 || zip_last_dist == zip_DIST_BUFSIZE;\n /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n }\n\n /* ==========================================================================\n * Send the block data compressed using the given Huffman trees\n */\n function zip_compress_block(\n ltree, // literal tree\n dtree,\n ) {\n // distance tree\n let dist; // distance of matched string\n let lc; // match length or unmatched char (if dist == 0)\n let lx = 0; // running index in l_buf\n let dx = 0; // running index in d_buf\n let fx = 0; // running index in flag_buf\n let flag = 0; // current flags\n let code; // the code to send\n let extra; // number of extra bits to send\n\n if (zip_last_lit != 0)\n do {\n if ((lx & 7) == 0) flag = zip_flag_buf[fx++];\n lc = zip_l_buf[lx++] & 0xff;\n if ((flag & 1) == 0) {\n zip_SEND_CODE(lc, ltree); /* send a literal byte */\n //\tTracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n // Here, lc is the match length - MIN_MATCH\n code = zip_length_code[lc];\n zip_SEND_CODE(code + zip_LITERALS + 1, ltree); // send the length code\n extra = zip_extra_lbits[code];\n if (extra != 0) {\n lc -= zip_base_length[code];\n zip_send_bits(lc, extra); // send the extra length bits\n }\n dist = zip_d_buf[dx++];\n // Here, dist is the match distance - 1\n code = zip_D_CODE(dist);\n //\tAssert (code < D_CODES, \"bad d_code\");\n\n zip_SEND_CODE(code, dtree); // send the distance code\n extra = zip_extra_dbits[code];\n if (extra != 0) {\n dist -= zip_base_dist[code];\n zip_send_bits(dist, extra); // send the extra distance bits\n }\n } // literal or match pair ?\n flag >>= 1;\n } while (lx < zip_last_lit);\n\n zip_SEND_CODE(zip_END_BLOCK, ltree);\n }\n\n /* ==========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\n const zip_Buf_size = 16; // bit size of bi_buf\n function zip_send_bits(\n value, // value to send\n length,\n ) {\n // number of bits\n /* If not enough room in bi_buf, use (valid) bits from bi_buf and\n * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))\n * unused bits in value.\n */\n if (zip_bi_valid > zip_Buf_size - length) {\n zip_bi_buf |= value << zip_bi_valid;\n zip_put_short(zip_bi_buf);\n zip_bi_buf = value >> (zip_Buf_size - zip_bi_valid);\n zip_bi_valid += length - zip_Buf_size;\n } else {\n zip_bi_buf |= value << zip_bi_valid;\n zip_bi_valid += length;\n }\n }\n\n /* ==========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\n function zip_bi_reverse(\n code, // the value to invert\n len,\n ) {\n // its bit length\n let res = 0;\n do {\n res |= code & 1;\n code >>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >> 1;\n }\n\n /* ==========================================================================\n * Write out any remaining bits in an incomplete byte.\n */\n function zip_bi_windup() {\n if (zip_bi_valid > 8) {\n zip_put_short(zip_bi_buf);\n } else if (zip_bi_valid > 0) {\n zip_put_byte(zip_bi_buf);\n }\n zip_bi_buf = 0;\n zip_bi_valid = 0;\n }\n\n function zip_qoutbuf() {\n if (zip_outcnt != 0) {\n let q;\n let i;\n q = zip_new_queue();\n if (zip_qhead == null) zip_qhead = zip_qtail = q;\n else zip_qtail = zip_qtail.next = q;\n q.len = zip_outcnt - zip_outoff;\n // System.arraycopy(zip_outbuf, zip_outoff, q.ptr, 0, q.len);\n for (i = 0; i < q.len; i++) q.ptr[i] = zip_outbuf[zip_outoff + i];\n zip_outcnt = zip_outoff = 0;\n }\n }\n\n return function deflate(str, level) {\n let i;\n let j;\n\n zip_deflate_data = str;\n zip_deflate_pos = 0;\n if (typeof level === 'undefined') level = zip_DEFAULT_LEVEL;\n zip_deflate_start(level);\n\n const buff = new Array(1024);\n const aout = [];\n while ((i = zip_deflate_internal(buff, 0, buff.length)) > 0) {\n const cbuf = new Array(i);\n for (j = 0; j < i; j++) {\n cbuf[j] = String.fromCharCode(buff[j]);\n }\n aout[aout.length] = cbuf.join('');\n }\n zip_deflate_data = null; // G.C.\n return aout.join('');\n };\n})();\n\nexport default deflate;\n","// @ts-nocheck\n/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\nimport deflate from '@/libs/rawdeflate';\n\nfunction encode64(data) {\n let r = '';\n for (let i = 0; i < data.length; i += 3) {\n if (i + 2 === data.length) {\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);\n } else if (i + 1 === data.length) {\n r += append3bytes(data.charCodeAt(i), 0, 0);\n } else {\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2));\n }\n }\n return r;\n}\n\nfunction append3bytes(b1, b2, b3) {\n const c1 = b1 >> 2;\n const c2 = ((b1 & 0x3) << 4) | (b2 >> 4);\n const c3 = ((b2 & 0xf) << 2) | (b3 >> 6);\n const c4 = b3 & 0x3f;\n let r = '';\n r += encode6bit(c1 & 0x3f);\n r += encode6bit(c2 & 0x3f);\n r += encode6bit(c3 & 0x3f);\n r += encode6bit(c4 & 0x3f);\n return r;\n}\n\nfunction encode6bit(b1) {\n let b = b1;\n if (b < 10) {\n return String.fromCharCode(48 + b);\n }\n b -= 10;\n if (b < 26) {\n return String.fromCharCode(65 + b);\n }\n b -= 26;\n if (b < 26) {\n return String.fromCharCode(97 + b);\n }\n b -= 26;\n if (b === 0) {\n return '-';\n }\n if (b === 1) {\n return '_';\n }\n return '?';\n}\n\nfunction compress(s1, url) {\n const s = unescape(encodeURIComponent(s1));\n return `${url}/svg/${encode64(deflate(s, 9))}`;\n}\n\nexport default class PlantUMLCodeEngine {\n static install(cherryOptions, args) {\n mergeWith(cherryOptions, {\n engine: {\n syntax: {\n codeBlock: {\n customRenderer: {\n plantuml: new PlantUMLCodeEngine({\n ...args,\n ...(cherryOptions.engine.syntax.plantuml ?? {}),\n }),\n },\n },\n },\n },\n });\n }\n\n constructor(plantUMLOptions = {}) {\n const defaultUrl = 'http://www.plantuml.com/plantuml';\n this.baseUrl = plantUMLOptions.baseUrl ?? defaultUrl;\n }\n\n render(src, sign) {\n let $sign = sign;\n if (!$sign) {\n $sign = Math.round(Math.random() * 100000000);\n }\n const graphId = `plantuml-${$sign}-${new Date().getTime()}`;\n return ``;\n }\n}\n","/*! For license information please see mermaid.esm.min.mjs.LICENSE.txt */\nvar t={2536:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,6],n=[1,7],r=[1,8],i=[1,9],a=[1,16],o=[1,11],s=[1,12],l=[1,13],u=[1,14],h=[1,15],f=[1,27],d=[1,33],p=[1,34],g=[1,35],y=[1,36],m=[1,37],b=[1,72],v=[1,73],_=[1,74],x=[1,75],k=[1,76],w=[1,77],T=[1,78],E=[1,38],C=[1,39],S=[1,40],A=[1,41],M=[1,42],N=[1,43],O=[1,44],D=[1,45],B=[1,46],L=[1,47],I=[1,48],F=[1,49],R=[1,50],P=[1,51],j=[1,52],z=[1,53],Y=[1,54],U=[1,55],$=[1,56],W=[1,57],q=[1,59],H=[1,60],V=[1,61],G=[1,62],X=[1,63],Z=[1,64],Q=[1,65],K=[1,66],J=[1,67],tt=[1,68],et=[1,69],nt=[24,52],rt=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],it=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],at=[1,94],ot=[1,95],st=[1,96],ct=[1,97],lt=[15,24,52],ut=[7,8,9,10,18,22,25,26,27,28],ht=[15,24,43,52],ft=[15,24,43,52,86,87,89,90],dt=[15,43],pt=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],gt={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,\":\":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,C4_CONTEXT:22,statements:23,EOF:24,C4_CONTAINER:25,C4_COMPONENT:26,C4_DYNAMIC:27,C4_DEPLOYMENT:28,otherStatements:29,diagramStatements:30,otherStatement:31,title:32,accDescription:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,boundaryStatement:39,boundaryStartStatement:40,boundaryStopStatement:41,boundaryStart:42,LBRACE:43,ENTERPRISE_BOUNDARY:44,attributes:45,SYSTEM_BOUNDARY:46,BOUNDARY:47,CONTAINER_BOUNDARY:48,NODE:49,NODE_L:50,NODE_R:51,RBRACE:52,diagramStatement:53,PERSON:54,PERSON_EXT:55,SYSTEM:56,SYSTEM_DB:57,SYSTEM_QUEUE:58,SYSTEM_EXT:59,SYSTEM_EXT_DB:60,SYSTEM_EXT_QUEUE:61,CONTAINER:62,CONTAINER_DB:63,CONTAINER_QUEUE:64,CONTAINER_EXT:65,CONTAINER_EXT_DB:66,CONTAINER_EXT_QUEUE:67,COMPONENT:68,COMPONENT_DB:69,COMPONENT_QUEUE:70,COMPONENT_EXT:71,COMPONENT_EXT_DB:72,COMPONENT_EXT_QUEUE:73,REL:74,BIREL:75,REL_U:76,REL_D:77,REL_L:78,REL_R:79,REL_B:80,REL_INDEX:81,UPDATE_EL_STYLE:82,UPDATE_REL_STYLE:83,UPDATE_LAYOUT_CONFIG:84,attribute:85,STR:86,STR_KEY:87,STR_VALUE:88,ATTRIBUTE:89,ATTRIBUTE_EMPTY:90,$accept:0,$end:1},terminals_:{2:\"error\",7:\"direction_tb\",8:\"direction_bt\",9:\"direction_rl\",10:\"direction_lr\",15:\"NEWLINE\",16:\":\",18:\"open_directive\",19:\"type_directive\",20:\"arg_directive\",21:\"close_directive\",22:\"C4_CONTEXT\",24:\"EOF\",25:\"C4_CONTAINER\",26:\"C4_COMPONENT\",27:\"C4_DYNAMIC\",28:\"C4_DEPLOYMENT\",32:\"title\",33:\"accDescription\",34:\"acc_title\",35:\"acc_title_value\",36:\"acc_descr\",37:\"acc_descr_value\",38:\"acc_descr_multiline_value\",43:\"LBRACE\",44:\"ENTERPRISE_BOUNDARY\",46:\"SYSTEM_BOUNDARY\",47:\"BOUNDARY\",48:\"CONTAINER_BOUNDARY\",49:\"NODE\",50:\"NODE_L\",51:\"NODE_R\",52:\"RBRACE\",54:\"PERSON\",55:\"PERSON_EXT\",56:\"SYSTEM\",57:\"SYSTEM_DB\",58:\"SYSTEM_QUEUE\",59:\"SYSTEM_EXT\",60:\"SYSTEM_EXT_DB\",61:\"SYSTEM_EXT_QUEUE\",62:\"CONTAINER\",63:\"CONTAINER_DB\",64:\"CONTAINER_QUEUE\",65:\"CONTAINER_EXT\",66:\"CONTAINER_EXT_DB\",67:\"CONTAINER_EXT_QUEUE\",68:\"COMPONENT\",69:\"COMPONENT_DB\",70:\"COMPONENT_QUEUE\",71:\"COMPONENT_EXT\",72:\"COMPONENT_EXT_DB\",73:\"COMPONENT_EXT_QUEUE\",74:\"REL\",75:\"BIREL\",76:\"REL_U\",77:\"REL_D\",78:\"REL_L\",79:\"REL_R\",80:\"REL_B\",81:\"REL_INDEX\",82:\"UPDATE_EL_STYLE\",83:\"UPDATE_REL_STYLE\",84:\"UPDATE_LAYOUT_CONFIG\",86:\"STR\",87:\"STR_KEY\",88:\"STR_VALUE\",89:\"ATTRIBUTE\",90:\"ATTRIBUTE_EMPTY\"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setDirection(\"TB\");break;case 5:r.setDirection(\"BT\");break;case 6:r.setDirection(\"RL\");break;case 7:r.setDirection(\"LR\");break;case 11:console.log(\"open_directive: \",a[s]),r.parseDirective(\"%%{\",\"open_directive\");break;case 12:break;case 13:a[s]=a[s].trim().replace(/'/g,'\"'),console.log(\"arg_directive: \",a[s]),r.parseDirective(a[s],\"arg_directive\");break;case 14:console.log(\"close_directive: \",a[s]),r.parseDirective(\"}%%\",\"close_directive\",\"c4Context\");break;case 15:case 16:case 17:case 18:case 19:r.setC4Type(a[s-3]);break;case 26:r.setTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 27:r.setAccDescription(a[s].substring(15)),this.$=a[s].substring(15);break;case 28:this.$=a[s].trim(),r.setTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:case 36:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,\"ENTERPRISE\"),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 37:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 38:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,\"CONTAINER\"),r.addContainerBoundary(...a[s]),this.$=a[s];break;case 39:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"node\",...a[s]),this.$=a[s];break;case 40:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"nodeL\",...a[s]),this.$=a[s];break;case 41:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"nodeR\",...a[s]),this.$=a[s];break;case 42:r.popBoundaryParseStack();break;case 46:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"person\",...a[s]),this.$=a[s];break;case 47:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_person\",...a[s]),this.$=a[s];break;case 48:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system\",...a[s]),this.$=a[s];break;case 49:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system_db\",...a[s]),this.$=a[s];break;case 50:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system_queue\",...a[s]),this.$=a[s];break;case 51:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system\",...a[s]),this.$=a[s];break;case 52:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system_db\",...a[s]),this.$=a[s];break;case 53:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system_queue\",...a[s]),this.$=a[s];break;case 54:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container\",...a[s]),this.$=a[s];break;case 55:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container_db\",...a[s]),this.$=a[s];break;case 56:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container_queue\",...a[s]),this.$=a[s];break;case 57:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container\",...a[s]),this.$=a[s];break;case 58:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container_db\",...a[s]),this.$=a[s];break;case 59:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container_queue\",...a[s]),this.$=a[s];break;case 60:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component\",...a[s]),this.$=a[s];break;case 61:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component_db\",...a[s]),this.$=a[s];break;case 62:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component_queue\",...a[s]),this.$=a[s];break;case 63:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component\",...a[s]),this.$=a[s];break;case 64:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component_db\",...a[s]),this.$=a[s];break;case 65:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component_queue\",...a[s]),this.$=a[s];break;case 67:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel\",...a[s]),this.$=a[s];break;case 68:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"birel\",...a[s]),this.$=a[s];break;case 69:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_u\",...a[s]),this.$=a[s];break;case 70:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_d\",...a[s]),this.$=a[s];break;case 71:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_l\",...a[s]),this.$=a[s];break;case 72:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_r\",...a[s]),this.$=a[s];break;case 73:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_b\",...a[s]),this.$=a[s];break;case 74:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(0,1),r.addRel(\"rel\",...a[s]),this.$=a[s];break;case 75:console.log(a[s-1],JSON.stringify(a[s])),r.updateElStyle(\"update_el_style\",...a[s]),this.$=a[s];break;case 76:console.log(a[s-1],JSON.stringify(a[s])),r.updateRelStyle(\"update_rel_style\",...a[s]),this.$=a[s];break;case 77:console.log(a[s-1],JSON.stringify(a[s])),r.updateLayoutConfig(\"update_layout_config\",...a[s]),this.$=a[s];break;case 78:console.log(\"PUSH ATTRIBUTE: \",a[s]),this.$=[a[s]];break;case 79:console.log(\"PUSH ATTRIBUTE: \",a[s-1]),a[s].unshift(a[s-1]),this.$=a[s];break;case 80:case 82:this.$=a[s].trim();break;case 81:console.log(\"kv: \",a[s-1],a[s]);let t={};t[a[s-1].trim()]=a[s].trim(),this.$=t;break;case 83:this.$=\"\"}},table:[{3:1,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:f},t([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:79,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:80,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:81,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:82,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},t(nt,[2,20],{53:32,39:58,40:70,42:71,30:87,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(nt,[2,21]),t(rt,[2,23],{15:[1,88]}),t(nt,[2,43],{15:[1,89]}),t(it,[2,26]),t(it,[2,27]),{35:[1,90]},{37:[1,91]},t(it,[2,30]),{45:92,85:93,86:at,87:ot,89:st,90:ct},{45:98,85:93,86:at,87:ot,89:st,90:ct},{45:99,85:93,86:at,87:ot,89:st,90:ct},{45:100,85:93,86:at,87:ot,89:st,90:ct},{45:101,85:93,86:at,87:ot,89:st,90:ct},{45:102,85:93,86:at,87:ot,89:st,90:ct},{45:103,85:93,86:at,87:ot,89:st,90:ct},{45:104,85:93,86:at,87:ot,89:st,90:ct},{45:105,85:93,86:at,87:ot,89:st,90:ct},{45:106,85:93,86:at,87:ot,89:st,90:ct},{45:107,85:93,86:at,87:ot,89:st,90:ct},{45:108,85:93,86:at,87:ot,89:st,90:ct},{45:109,85:93,86:at,87:ot,89:st,90:ct},{45:110,85:93,86:at,87:ot,89:st,90:ct},{45:111,85:93,86:at,87:ot,89:st,90:ct},{45:112,85:93,86:at,87:ot,89:st,90:ct},{45:113,85:93,86:at,87:ot,89:st,90:ct},{45:114,85:93,86:at,87:ot,89:st,90:ct},{45:115,85:93,86:at,87:ot,89:st,90:ct},{45:116,85:93,86:at,87:ot,89:st,90:ct},t(lt,[2,66]),{45:117,85:93,86:at,87:ot,89:st,90:ct},{45:118,85:93,86:at,87:ot,89:st,90:ct},{45:119,85:93,86:at,87:ot,89:st,90:ct},{45:120,85:93,86:at,87:ot,89:st,90:ct},{45:121,85:93,86:at,87:ot,89:st,90:ct},{45:122,85:93,86:at,87:ot,89:st,90:ct},{45:123,85:93,86:at,87:ot,89:st,90:ct},{45:124,85:93,86:at,87:ot,89:st,90:ct},{45:125,85:93,86:at,87:ot,89:st,90:ct},{45:126,85:93,86:at,87:ot,89:st,90:ct},{45:127,85:93,86:at,87:ot,89:st,90:ct},{30:128,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,130],43:[1,129]},{45:131,85:93,86:at,87:ot,89:st,90:ct},{45:132,85:93,86:at,87:ot,89:st,90:ct},{45:133,85:93,86:at,87:ot,89:st,90:ct},{45:134,85:93,86:at,87:ot,89:st,90:ct},{45:135,85:93,86:at,87:ot,89:st,90:ct},{45:136,85:93,86:at,87:ot,89:st,90:ct},{45:137,85:93,86:at,87:ot,89:st,90:ct},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},t(ut,[2,9]),{14:142,21:f},{21:[2,13]},{1:[2,15]},t(nt,[2,22]),t(rt,[2,24],{31:31,29:143,32:d,33:p,34:g,36:y,38:m}),t(nt,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:d,33:p,34:g,36:y,38:m,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(it,[2,28]),t(it,[2,29]),t(lt,[2,46]),t(ht,[2,78],{85:93,45:145,86:at,87:ot,89:st,90:ct}),t(ft,[2,80]),{88:[1,146]},t(ft,[2,82]),t(ft,[2,83]),t(lt,[2,47]),t(lt,[2,48]),t(lt,[2,49]),t(lt,[2,50]),t(lt,[2,51]),t(lt,[2,52]),t(lt,[2,53]),t(lt,[2,54]),t(lt,[2,55]),t(lt,[2,56]),t(lt,[2,57]),t(lt,[2,58]),t(lt,[2,59]),t(lt,[2,60]),t(lt,[2,61]),t(lt,[2,62]),t(lt,[2,63]),t(lt,[2,64]),t(lt,[2,65]),t(lt,[2,67]),t(lt,[2,68]),t(lt,[2,69]),t(lt,[2,70]),t(lt,[2,71]),t(lt,[2,72]),t(lt,[2,73]),t(lt,[2,74]),t(lt,[2,75]),t(lt,[2,76]),t(lt,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},t(dt,[2,35]),t(dt,[2,36]),t(dt,[2,37]),t(dt,[2,38]),t(dt,[2,39]),t(dt,[2,40]),t(dt,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},t(rt,[2,25]),t(nt,[2,45]),t(ht,[2,79]),t(ft,[2,81]),t(lt,[2,31]),t(lt,[2,42]),t(pt,[2,32]),t(pt,[2,33],{15:[1,152]}),t(ut,[2,10]),t(pt,[2,34])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},yt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin(\"type_directive\"),19;case 6:return this.popState(),this.begin(\"arg_directive\"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:return 32;case 10:return 33;case 11:return this.begin(\"acc_title\"),34;case 12:return this.popState(),\"acc_title_value\";case 13:return this.begin(\"acc_descr\"),36;case 14:return this.popState(),\"acc_descr_value\";case 15:this.begin(\"acc_descr_multiline\");break;case 16:this.popState();break;case 17:return\"acc_descr_multiline_value\";case 18:case 21:break;case 19:c;break;case 20:return 15;case 22:return 22;case 23:return 25;case 24:return 26;case 25:return 27;case 26:return 28;case 27:return this.begin(\"person_ext\"),console.log(\"begin person_ext\"),55;case 28:return this.begin(\"person\"),console.log(\"begin person\"),54;case 29:return this.begin(\"system_ext_queue\"),console.log(\"begin system_ext_queue\"),61;case 30:return this.begin(\"system_ext_db\"),console.log(\"begin system_ext_db\"),60;case 31:return this.begin(\"system_ext\"),console.log(\"begin system_ext\"),59;case 32:return this.begin(\"system_queue\"),console.log(\"begin system_queue\"),58;case 33:return this.begin(\"system_db\"),console.log(\"begin system_db\"),57;case 34:return this.begin(\"system\"),console.log(\"begin system\"),56;case 35:return this.begin(\"boundary\"),console.log(\"begin boundary\"),47;case 36:return this.begin(\"enterprise_boundary\"),console.log(\"begin enterprise_boundary\"),44;case 37:return this.begin(\"system_boundary\"),console.log(\"begin system_boundary\"),46;case 38:return this.begin(\"container_ext_queue\"),console.log(\"begin container_ext_queue\"),67;case 39:return this.begin(\"container_ext_db\"),console.log(\"begin container_ext_db\"),66;case 40:return this.begin(\"container_ext\"),console.log(\"begin container_ext\"),65;case 41:return this.begin(\"container_queue\"),console.log(\"begin container_queue\"),64;case 42:return this.begin(\"container_db\"),console.log(\"begin container_db\"),63;case 43:return this.begin(\"container\"),console.log(\"begin container\"),62;case 44:return this.begin(\"container_boundary\"),console.log(\"begin container_boundary\"),48;case 45:return this.begin(\"component_ext_queue\"),console.log(\"begin component_ext_queue\"),73;case 46:return this.begin(\"component_ext_db\"),console.log(\"begin component_ext_db\"),72;case 47:return this.begin(\"component_ext\"),console.log(\"begin component_ext\"),71;case 48:return this.begin(\"component_queue\"),console.log(\"begin component_queue\"),70;case 49:return this.begin(\"component_db\"),console.log(\"begin component_db\"),69;case 50:return this.begin(\"component\"),console.log(\"begin component\"),68;case 51:case 52:return this.begin(\"node\"),console.log(\"begin node\"),49;case 53:return this.begin(\"node_l\"),console.log(\"begin node_l\"),50;case 54:return this.begin(\"node_r\"),console.log(\"begin node_r\"),51;case 55:return this.begin(\"rel\"),console.log(\"begin rel\"),74;case 56:return this.begin(\"birel\"),console.log(\"begin birel\"),75;case 57:case 58:return this.begin(\"rel_u\"),console.log(\"begin rel_u\"),76;case 59:case 60:return this.begin(\"rel_d\"),console.log(\"begin rel_d\"),77;case 61:case 62:return this.begin(\"rel_l\"),console.log(\"begin rel_l\"),78;case 63:case 64:return this.begin(\"rel_r\"),console.log(\"begin rel_r\"),79;case 65:return this.begin(\"rel_b\"),console.log(\"begin rel_b\"),80;case 66:return this.begin(\"rel_index\"),console.log(\"begin rel_index\"),81;case 67:return this.begin(\"update_el_style\"),console.log(\"begin update_el_style\"),82;case 68:return this.begin(\"update_rel_style\"),console.log(\"begin update_rel_style\"),83;case 69:return this.begin(\"update_layout_config\"),console.log(\"begin update_layout_config\"),84;case 70:return\"EOF_IN_STRUCT\";case 71:return console.log(\"begin attribute with ATTRIBUTE_EMPTY\"),this.begin(\"attribute\"),\"ATTRIBUTE_EMPTY\";case 72:console.log(\"begin attribute\"),this.begin(\"attribute\");break;case 73:console.log(\"STOP attribute\"),this.popState(),console.log(\"STOP diagram\"),this.popState();break;case 74:return console.log(\",,\"),90;case 75:console.log(\",\");break;case 76:return console.log(\"ATTRIBUTE_EMPTY\"),90;case 77:console.log(\"begin string\"),this.begin(\"string\");break;case 78:console.log(\"STOP string\"),this.popState();break;case 79:return console.log(\"STR\"),\"STR\";case 80:console.log(\"begin string_kv\"),this.begin(\"string_kv\");break;case 81:return console.log(\"STR_KEY\"),this.begin(\"string_kv_key\"),\"STR_KEY\";case 82:console.log(\"begin string_kv_value\"),this.popState(),this.begin(\"string_kv_value\");break;case 83:return console.log(\"STR_VALUE\"),\"STR_VALUE\";case 84:console.log(\"STOP string_kv_value\"),this.popState(),this.popState();break;case 85:return console.log(\"not STR\"),\"STR\";case 86:return console.log(\"begin boundary block\"),\"LBRACE\";case 87:return console.log(\"STOP boundary block\"),\"RBRACE\";case 88:return\"SPACE\";case 89:return\"EOL\";case 90:return 24}},rules:[/^(?:%%\\{)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:title\\s[^#\\n;]+)/,/^(?:accDescription\\s[^#\\n;]+)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:C4Context\\b)/,/^(?:C4Container\\b)/,/^(?:C4Component\\b)/,/^(?:C4Dynamic\\b)/,/^(?:C4Deployment\\b)/,/^(?:Person_Ext\\b)/,/^(?:Person\\b)/,/^(?:SystemQueue_Ext\\b)/,/^(?:SystemDb_Ext\\b)/,/^(?:System_Ext\\b)/,/^(?:SystemQueue\\b)/,/^(?:SystemDb\\b)/,/^(?:System\\b)/,/^(?:Boundary\\b)/,/^(?:Enterprise_Boundary\\b)/,/^(?:System_Boundary\\b)/,/^(?:ContainerQueue_Ext\\b)/,/^(?:ContainerDb_Ext\\b)/,/^(?:Container_Ext\\b)/,/^(?:ContainerQueue\\b)/,/^(?:ContainerDb\\b)/,/^(?:Container\\b)/,/^(?:Container_Boundary\\b)/,/^(?:ComponentQueue_Ext\\b)/,/^(?:ComponentDb_Ext\\b)/,/^(?:Component_Ext\\b)/,/^(?:ComponentQueue\\b)/,/^(?:ComponentDb\\b)/,/^(?:Component\\b)/,/^(?:Deployment_Node\\b)/,/^(?:Node\\b)/,/^(?:Node_L\\b)/,/^(?:Node_R\\b)/,/^(?:Rel\\b)/,/^(?:BiRel\\b)/,/^(?:Rel_Up\\b)/,/^(?:Rel_U\\b)/,/^(?:Rel_Down\\b)/,/^(?:Rel_D\\b)/,/^(?:Rel_Left\\b)/,/^(?:Rel_L\\b)/,/^(?:Rel_Right\\b)/,/^(?:Rel_R\\b)/,/^(?:Rel_Back\\b)/,/^(?:RelIndex\\b)/,/^(?:UpdateElementStyle\\b)/,/^(?:UpdateRelStyle\\b)/,/^(?:UpdateLayoutConfig\\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*[\"][\"])/,/^(?:[ ]*[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[ ]*[\\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*[\"])/,/^(?:[^\"]+)/,/^(?:[\"])/,/^(?:[^,]+)/,/^(?:\\{)/,/^(?:\\})/,/^(?:[\\s]+)/,/^(?:[\\n\\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},string_kv_value:{rules:[83,84],inclusive:!1},string_kv_key:{rules:[82],inclusive:!1},string_kv:{rules:[81],inclusive:!1},string:{rules:[78,79],inclusive:!1},attribute:{rules:[73,74,75,76,77,80,85],inclusive:!1},update_layout_config:{rules:[70,71,72,73],inclusive:!1},update_rel_style:{rules:[70,71,72,73],inclusive:!1},update_el_style:{rules:[70,71,72,73],inclusive:!1},rel_b:{rules:[70,71,72,73],inclusive:!1},rel_r:{rules:[70,71,72,73],inclusive:!1},rel_l:{rules:[70,71,72,73],inclusive:!1},rel_d:{rules:[70,71,72,73],inclusive:!1},rel_u:{rules:[70,71,72,73],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[70,71,72,73],inclusive:!1},node_r:{rules:[70,71,72,73],inclusive:!1},node_l:{rules:[70,71,72,73],inclusive:!1},node:{rules:[70,71,72,73],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[70,71,72,73],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[70,71,72,73],inclusive:!1},component_ext:{rules:[70,71,72,73],inclusive:!1},component_queue:{rules:[70,71,72,73],inclusive:!1},component_db:{rules:[70,71,72,73],inclusive:!1},component:{rules:[70,71,72,73],inclusive:!1},container_boundary:{rules:[70,71,72,73],inclusive:!1},container_ext_queue:{rules:[],inclusive:!1},container_ext_db:{rules:[70,71,72,73],inclusive:!1},container_ext:{rules:[70,71,72,73],inclusive:!1},container_queue:{rules:[70,71,72,73],inclusive:!1},container_db:{rules:[70,71,72,73],inclusive:!1},container:{rules:[70,71,72,73],inclusive:!1},birel:{rules:[70,71,72,73],inclusive:!1},system_boundary:{rules:[70,71,72,73],inclusive:!1},enterprise_boundary:{rules:[70,71,72,73],inclusive:!1},boundary:{rules:[70,71,72,73],inclusive:!1},system_ext_queue:{rules:[70,71,72,73],inclusive:!1},system_ext_db:{rules:[70,71,72,73],inclusive:!1},system_ext:{rules:[70,71,72,73],inclusive:!1},system_queue:{rules:[70,71,72,73],inclusive:!1},system_db:{rules:[70,71,72,73],inclusive:!1},system:{rules:[70,71,72,73],inclusive:!1},person_ext:{rules:[70,71,72,73],inclusive:!1},person:{rules:[70,71,72,73],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],inclusive:!0}}};function mt(){this.yy={}}return gt.lexer=yt,mt.prototype=gt,gt.Parser=mt,new mt}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(555).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},1362:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,7],r=[1,8],i=[1,9],a=[1,10],o=[1,13],s=[1,12],c=[1,16,25],l=[1,20],u=[1,31],h=[1,32],f=[1,33],d=[1,35],p=[1,38],g=[1,36],y=[1,37],m=[1,39],b=[1,40],v=[1,41],_=[1,42],x=[1,45],k=[1,46],w=[1,47],T=[1,48],E=[16,25],C=[1,62],S=[1,63],A=[1,64],M=[1,65],N=[1,66],O=[1,67],D=[1,68],B=[16,25,32,44,45,53,56,57,58,59,60,61,62,67,69],L=[16,25,30,32,44,45,49,53,56,57,58,59,60,61,62,67,69,84,85,86,87],I=[5,8,9,10,11,16,19,23,25],F=[53,84,85,86,87],R=[53,61,62,84,85,86,87],P=[53,56,57,58,59,60,84,85,86,87],j=[16,25,32],z=[1,100],Y={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statments:5,direction:6,directive:7,direction_tb:8,direction_bt:9,direction_rl:10,direction_lr:11,graphConfig:12,openDirective:13,typeDirective:14,closeDirective:15,NEWLINE:16,\":\":17,argDirective:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,CLASS_DIAGRAM:23,statements:24,EOF:25,statement:26,className:27,alphaNumToken:28,classLiteralName:29,GENERICTYPE:30,relationStatement:31,LABEL:32,classStatement:33,methodStatement:34,annotationStatement:35,clickStatement:36,cssClassStatement:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,CLASS:43,STYLE_SEPARATOR:44,STRUCT_START:45,members:46,STRUCT_STOP:47,ANNOTATION_START:48,ANNOTATION_END:49,MEMBER:50,SEPARATOR:51,relation:52,STR:53,relationType:54,lineType:55,AGGREGATION:56,EXTENSION:57,COMPOSITION:58,DEPENDENCY:59,LOLLIPOP:60,LINE:61,DOTTED_LINE:62,CALLBACK:63,LINK:64,LINK_TARGET:65,CLICK:66,CALLBACK_NAME:67,CALLBACK_ARGS:68,HREF:69,CSSCLASS:70,commentToken:71,textToken:72,graphCodeTokens:73,textNoTagsToken:74,TAGSTART:75,TAGEND:76,\"==\":77,\"--\":78,PCT:79,DEFAULT:80,SPACE:81,MINUS:82,keywords:83,UNICODE_TEXT:84,NUM:85,ALPHA:86,BQUOTE_STR:87,$accept:0,$end:1},terminals_:{2:\"error\",5:\"statments\",8:\"direction_tb\",9:\"direction_bt\",10:\"direction_rl\",11:\"direction_lr\",16:\"NEWLINE\",17:\":\",19:\"open_directive\",20:\"type_directive\",21:\"arg_directive\",22:\"close_directive\",23:\"CLASS_DIAGRAM\",25:\"EOF\",30:\"GENERICTYPE\",32:\"LABEL\",38:\"acc_title\",39:\"acc_title_value\",40:\"acc_descr\",41:\"acc_descr_value\",42:\"acc_descr_multiline_value\",43:\"CLASS\",44:\"STYLE_SEPARATOR\",45:\"STRUCT_START\",47:\"STRUCT_STOP\",48:\"ANNOTATION_START\",49:\"ANNOTATION_END\",50:\"MEMBER\",51:\"SEPARATOR\",53:\"STR\",56:\"AGGREGATION\",57:\"EXTENSION\",58:\"COMPOSITION\",59:\"DEPENDENCY\",60:\"LOLLIPOP\",61:\"LINE\",62:\"DOTTED_LINE\",63:\"CALLBACK\",64:\"LINK\",65:\"LINK_TARGET\",66:\"CLICK\",67:\"CALLBACK_NAME\",68:\"CALLBACK_ARGS\",69:\"HREF\",70:\"CSSCLASS\",73:\"graphCodeTokens\",75:\"TAGSTART\",76:\"TAGEND\",77:\"==\",78:\"--\",79:\"PCT\",80:\"DEFAULT\",81:\"SPACE\",82:\"MINUS\",83:\"keywords\",84:\"UNICODE_TEXT\",85:\"NUM\",86:\"ALPHA\",87:\"BQUOTE_STR\"},productions_:[0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[46,1],[46,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[52,3],[52,2],[52,2],[52,1],[54,1],[54,1],[54,1],[54,1],[54,1],[55,1],[55,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[71,1],[71,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[74,1],[74,1],[74,1],[74,1],[28,1],[28,1],[28,1],[29,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setDirection(\"TB\");break;case 6:r.setDirection(\"BT\");break;case 7:r.setDirection(\"RL\");break;case 8:r.setDirection(\"LR\");break;case 12:r.parseDirective(\"%%{\",\"open_directive\");break;case 13:r.parseDirective(a[s],\"type_directive\");break;case 14:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 15:r.parseDirective(\"}%%\",\"close_directive\",\"class\");break;case 20:case 21:this.$=a[s];break;case 22:this.$=a[s-1]+a[s];break;case 23:case 24:this.$=a[s-1]+\"~\"+a[s];break;case 25:r.addRelation(a[s]);break;case 26:a[s-1].title=r.cleanupLabel(a[s]),r.addRelation(a[s-1]);break;case 34:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 35:case 36:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 37:r.addClass(a[s]);break;case 38:r.addClass(a[s-2]),r.setCssClass(a[s-2],a[s]);break;case 39:r.addClass(a[s-3]),r.addMembers(a[s-3],a[s-1]);break;case 40:r.addClass(a[s-5]),r.setCssClass(a[s-5],a[s-3]),r.addMembers(a[s-5],a[s-1]);break;case 41:r.addAnnotation(a[s],a[s-2]);break;case 42:this.$=[a[s]];break;case 43:a[s].push(a[s-1]),this.$=a[s];break;case 44:case 46:case 47:break;case 45:r.addMember(a[s-1],r.cleanupLabel(a[s]));break;case 48:this.$={id1:a[s-2],id2:a[s],relation:a[s-1],relationTitle1:\"none\",relationTitle2:\"none\"};break;case 49:this.$={id1:a[s-3],id2:a[s],relation:a[s-1],relationTitle1:a[s-2],relationTitle2:\"none\"};break;case 50:this.$={id1:a[s-3],id2:a[s],relation:a[s-2],relationTitle1:\"none\",relationTitle2:a[s-1]};break;case 51:this.$={id1:a[s-4],id2:a[s],relation:a[s-2],relationTitle1:a[s-3],relationTitle2:a[s-1]};break;case 52:this.$={type1:a[s-2],type2:a[s],lineType:a[s-1]};break;case 53:this.$={type1:\"none\",type2:a[s],lineType:a[s-1]};break;case 54:this.$={type1:a[s-1],type2:\"none\",lineType:a[s]};break;case 55:this.$={type1:\"none\",type2:\"none\",lineType:a[s]};break;case 56:this.$=r.relationType.AGGREGATION;break;case 57:this.$=r.relationType.EXTENSION;break;case 58:this.$=r.relationType.COMPOSITION;break;case 59:this.$=r.relationType.DEPENDENCY;break;case 60:this.$=r.relationType.LOLLIPOP;break;case 61:this.$=r.lineType.LINE;break;case 62:this.$=r.lineType.DOTTED_LINE;break;case 63:case 69:this.$=a[s-2],r.setClickEvent(a[s-1],a[s]);break;case 64:case 70:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 65:case 73:this.$=a[s-2],r.setLink(a[s-1],a[s]);break;case 66:case 74:this.$=a[s-3],r.setLink(a[s-2],a[s-1],a[s]);break;case 67:case 75:this.$=a[s-3],r.setLink(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 68:case 76:this.$=a[s-4],r.setLink(a[s-3],a[s-2],a[s]),r.setTooltip(a[s-3],a[s-1]);break;case 71:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 72:this.$=a[s-4],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setTooltip(a[s-3],a[s]);break;case 77:r.setCssClass(a[s-1],a[s])}},table:[{3:1,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[2,9]},t(c,[2,5]),t(c,[2,6]),t(c,[2,7]),t(c,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:l},t([17,22],[2,13]),{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:21,26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},{16:[1,49]},{18:50,21:[1,51]},{16:[2,15]},{25:[1,52]},{16:[1,53],25:[2,17]},t(E,[2,25],{32:[1,54]}),t(E,[2,27]),t(E,[2,28]),t(E,[2,29]),t(E,[2,30]),t(E,[2,31]),t(E,[2,32]),t(E,[2,33]),{39:[1,55]},{41:[1,56]},t(E,[2,36]),t(E,[2,44],{52:57,54:60,55:61,32:[1,59],53:[1,58],56:C,57:S,58:A,59:M,60:N,61:O,62:D}),{27:69,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,46]),t(E,[2,47]),{28:70,84:x,85:k,86:w},{27:71,28:43,29:44,84:x,85:k,86:w,87:T},{27:72,28:43,29:44,84:x,85:k,86:w,87:T},{27:73,28:43,29:44,84:x,85:k,86:w,87:T},{53:[1,74]},t(B,[2,20],{28:43,29:44,27:75,30:[1,76],84:x,85:k,86:w,87:T}),t(B,[2,21],{30:[1,77]}),t(L,[2,91]),t(L,[2,92]),t(L,[2,93]),t([16,25,30,32,44,45,53,56,57,58,59,60,61,62,67,69],[2,94]),t(I,[2,10]),{15:78,22:l},{22:[2,14]},{1:[2,16]},{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:79,25:[2,18],26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},t(E,[2,26]),t(E,[2,34]),t(E,[2,35]),{27:80,28:43,29:44,53:[1,81],84:x,85:k,86:w,87:T},{52:82,54:60,55:61,56:C,57:S,58:A,59:M,60:N,61:O,62:D},t(E,[2,45]),{55:83,61:O,62:D},t(F,[2,55],{54:84,56:C,57:S,58:A,59:M,60:N}),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,59]),t(R,[2,60]),t(P,[2,61]),t(P,[2,62]),t(E,[2,37],{44:[1,85],45:[1,86]}),{49:[1,87]},{53:[1,88]},{53:[1,89]},{67:[1,90],69:[1,91]},{28:92,84:x,85:k,86:w},t(B,[2,22]),t(B,[2,23]),t(B,[2,24]),{16:[1,93]},{25:[2,19]},t(j,[2,48]),{27:94,28:43,29:44,84:x,85:k,86:w,87:T},{27:95,28:43,29:44,53:[1,96],84:x,85:k,86:w,87:T},t(F,[2,54],{54:97,56:C,57:S,58:A,59:M,60:N}),t(F,[2,53]),{28:98,84:x,85:k,86:w},{46:99,50:z},{27:101,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,63],{53:[1,102]}),t(E,[2,65],{53:[1,104],65:[1,103]}),t(E,[2,69],{53:[1,105],68:[1,106]}),t(E,[2,73],{53:[1,108],65:[1,107]}),t(E,[2,77]),t(I,[2,11]),t(j,[2,50]),t(j,[2,49]),{27:109,28:43,29:44,84:x,85:k,86:w,87:T},t(F,[2,52]),t(E,[2,38],{45:[1,110]}),{47:[1,111]},{46:112,47:[2,42],50:z},t(E,[2,41]),t(E,[2,64]),t(E,[2,66]),t(E,[2,67],{65:[1,113]}),t(E,[2,70]),t(E,[2,71],{53:[1,114]}),t(E,[2,74]),t(E,[2,75],{65:[1,115]}),t(j,[2,51]),{46:116,50:z},t(E,[2,39]),{47:[2,43]},t(E,[2,68]),t(E,[2,72]),t(E,[2,76]),{47:[1,117]},t(E,[2,40])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],51:[2,14],52:[2,16],79:[2,19],112:[2,43]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},U={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),19;case 1:return 8;case 2:return 9;case 3:return 10;case 4:return 11;case 5:return this.begin(\"type_directive\"),20;case 6:return this.popState(),this.begin(\"arg_directive\"),17;case 7:return this.popState(),this.popState(),22;case 8:return 21;case 9:case 10:case 19:case 27:break;case 11:return this.begin(\"acc_title\"),38;case 12:return this.popState(),\"acc_title_value\";case 13:return this.begin(\"acc_descr\"),40;case 14:return this.popState(),\"acc_descr_value\";case 15:this.begin(\"acc_descr_multiline\");break;case 16:case 37:case 40:case 43:case 46:case 49:case 52:this.popState();break;case 17:return\"acc_descr_multiline_value\";case 18:return 16;case 20:case 21:return 23;case 22:return this.begin(\"struct\"),45;case 23:return\"EDGE_STATE\";case 24:return\"EOF_IN_STRUCT\";case 25:return\"OPEN_IN_STRUCT\";case 26:return this.popState(),47;case 28:return\"MEMBER\";case 29:return 43;case 30:return 70;case 31:return 63;case 32:return 64;case 33:return 66;case 34:return 48;case 35:return 49;case 36:this.begin(\"generic\");break;case 38:return\"GENERICTYPE\";case 39:this.begin(\"string\");break;case 41:return\"STR\";case 42:this.begin(\"bqstring\");break;case 44:return\"BQUOTE_STR\";case 45:this.begin(\"href\");break;case 47:return 69;case 48:this.begin(\"callback_name\");break;case 50:this.popState(),this.begin(\"callback_args\");break;case 51:return 67;case 53:return 68;case 54:case 55:case 56:case 57:return 65;case 58:case 59:return 57;case 60:case 61:return 59;case 62:return 58;case 63:return 56;case 64:return 60;case 65:return 61;case 66:return 62;case 67:return 32;case 68:return 44;case 69:return 82;case 70:return\"DOT\";case 71:return\"PLUS\";case 72:return 79;case 73:case 74:return\"EQUALS\";case 75:return 86;case 76:return\"PUNCTUATION\";case 77:return 85;case 78:return 84;case 79:return 81;case 80:return 25}},rules:[/^(?:%%\\{)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:classDiagram-v2\\b)/,/^(?:classDiagram\\b)/,/^(?:[{])/,/^(?:\\[\\*\\])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\\n])/,/^(?:[^{}\\n]*)/,/^(?:class\\b)/,/^(?:cssClass\\b)/,/^(?:callback\\b)/,/^(?:link\\b)/,/^(?:click\\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:\\s*<\\|)/,/^(?:\\s*\\|>)/,/^(?:\\s*>)/,/^(?:\\s*<)/,/^(?:\\s*\\*)/,/^(?:\\s*o\\b)/,/^(?:\\s*\\(\\))/,/^(?:--)/,/^(?:\\.\\.)/,/^(?::{1}[^:\\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\\.)/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\\w+)/,/^(?:[!\"#$%&'*+,-.`?\\\\/])/,/^(?:[0-9]+)/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\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]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\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\\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-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\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\\u0D60\\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-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\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\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\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\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\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])/,/^(?:\\s)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[52,53],inclusive:!1},callback_name:{rules:[49,50,51],inclusive:!1},href:{rules:[46,47],inclusive:!1},struct:{rules:[23,24,25,26,27,28],inclusive:!1},generic:{rules:[37,38],inclusive:!1},bqstring:{rules:[43,44],inclusive:!1},string:{rules:[40,41],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,29,30,31,32,33,34,35,36,39,42,45,48,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80],inclusive:!0}}};function $(){this.yy={}}return Y.lexer=U,$.prototype=Y,Y.Parser=$,new $}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8218).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},5890:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,23,25,27,29,30,49],i=[1,17],a=[1,18],o=[1,19],s=[1,20],c=[1,21],l=[1,24],u=[1,29],h=[1,30],f=[1,31],d=[1,32],p=[6,9,11,15,20,23,25,27,29,30,42,43,44,45,49],g=[1,45],y=[30,46,47],m=[4,6,9,11,23,25,27,29,30,49],b=[42,43,44,45],v=[22,37],_=[1,64],x={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,title:23,title_value:24,acc_title:25,acc_title_value:26,acc_descr:27,acc_descr_value:28,acc_descr_multiline_value:29,ALPHANUM:30,\".\":31,attribute:32,attributeType:33,attributeName:34,attributeKeyType:35,attributeComment:36,ATTRIBUTE_WORD:37,ATTRIBUTE_KEY:38,COMMENT:39,cardinality:40,relType:41,ZERO_OR_ONE:42,ZERO_OR_MORE:43,ONE_OR_MORE:44,ONLY_ONE:45,NON_IDENTIFYING:46,IDENTIFYING:47,WORD:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,$accept:0,$end:1},terminals_:{2:\"error\",4:\"ER_DIAGRAM\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",20:\"BLOCK_START\",22:\"BLOCK_STOP\",23:\"title\",24:\"title_value\",25:\"acc_title\",26:\"acc_title_value\",27:\"acc_descr\",28:\"acc_descr_value\",29:\"acc_descr_multiline_value\",30:\"ALPHANUM\",31:\".\",37:\"ATTRIBUTE_WORD\",38:\"ATTRIBUTE_KEY\",39:\"COMMENT\",42:\"ZERO_OR_ONE\",43:\"ZERO_OR_MORE\",44:\"ONE_OR_MORE\",45:\"ONLY_ONE\",46:\"NON_IDENTIFYING\",47:\"IDENTIFYING\",48:\"WORD\",49:\"open_directive\",50:\"type_directive\",51:\"arg_directive\",52:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,3],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[36,1],[18,3],[40,1],[40,1],[40,1],[40,1],[41,1],[41,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:case 20:case 28:case 29:case 30:case 40:this.$=a[s];break;case 12:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 13:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s]);break;case 16:case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 21:this.$=a[s-2]+a[s-1]+a[s];break;case 22:this.$=[a[s]];break;case 23:a[s].push(a[s-1]),this.$=a[s];break;case 24:this.$={attributeType:a[s-1],attributeName:a[s]};break;case 25:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeKeyType:a[s]};break;case 26:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeComment:a[s]};break;case 27:this.$={attributeType:a[s-3],attributeName:a[s-2],attributeKeyType:a[s-1],attributeComment:a[s]};break;case 31:case 39:this.$=a[s].replace(/\"/g,\"\");break;case 32:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 33:this.$=r.Cardinality.ZERO_OR_ONE;break;case 34:this.$=r.Cardinality.ZERO_OR_MORE;break;case 35:this.$=r.Cardinality.ONE_OR_MORE;break;case 36:this.$=r.Cardinality.ONLY_ONE;break;case 37:this.$=r.Identification.NON_IDENTIFYING;break;case 38:this.$=r.Identification.IDENTIFYING;break;case 41:r.parseDirective(\"%%{\",\"open_directive\");break;case 42:r.parseDirective(a[s],\"type_directive\");break;case 43:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 44:r.parseDirective(\"}%%\",\"close_directive\",\"er\")}},table:[{3:1,4:e,7:3,12:4,49:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,49:n},{13:8,50:[1,9]},{50:[2,41]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},{1:[2,2]},{14:22,15:[1,23],52:l},t([15,52],[2,42]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:15,10:25,12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),t(r,[2,15],{18:26,40:28,20:[1,27],42:u,43:h,44:f,45:d}),{24:[1,33]},{26:[1,34]},{28:[1,35]},t(r,[2,19]),t(p,[2,20],{31:[1,36]}),{11:[1,37]},{16:38,51:[1,39]},{11:[2,44]},t(r,[2,5]),{17:40,30:c},{21:41,22:[1,42],32:43,33:44,37:g},{41:46,46:[1,47],47:[1,48]},t(y,[2,33]),t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(r,[2,16]),t(r,[2,17]),t(r,[2,18]),{17:49,30:c},t(m,[2,9]),{14:50,52:l},{52:[2,43]},{15:[1,51]},{22:[1,52]},t(r,[2,14]),{21:53,22:[2,22],32:43,33:44,37:g},{34:54,37:[1,55]},{37:[2,28]},{40:56,42:u,43:h,44:f,45:d},t(b,[2,37]),t(b,[2,38]),t(p,[2,21]),{11:[1,57]},{19:58,30:[1,60],48:[1,59]},t(r,[2,13]),{22:[2,23]},t(v,[2,24],{35:61,36:62,38:[1,63],39:_}),t([22,37,38,39],[2,29]),{30:[2,32]},t(m,[2,10]),t(r,[2,12]),t(r,[2,39]),t(r,[2,40]),t(v,[2,25],{36:65,39:_}),t(v,[2,26]),t([22,37,39],[2,30]),t(v,[2,31]),t(v,[2,27])],defaultActions:{5:[2,41],7:[2,2],24:[2,44],39:[2,43],45:[2,28],53:[2,23],56:[2,32]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},k={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"acc_title\"),25;case 1:return this.popState(),\"acc_title_value\";case 2:return this.begin(\"acc_descr\"),27;case 3:return this.popState(),\"acc_descr_value\";case 4:this.begin(\"acc_descr_multiline\");break;case 5:this.popState();break;case 6:return\"acc_descr_multiline_value\";case 7:return this.begin(\"open_directive\"),49;case 8:return this.begin(\"type_directive\"),50;case 9:return this.popState(),this.begin(\"arg_directive\"),15;case 10:return this.popState(),this.popState(),52;case 11:return 51;case 12:case 13:case 15:case 20:case 25:break;case 14:return 11;case 16:return 9;case 17:return 48;case 18:return 4;case 19:return this.begin(\"block\"),20;case 21:return 38;case 22:case 23:return 37;case 24:return 39;case 26:return this.popState(),22;case 27:case 40:return e.yytext[0];case 28:case 32:return 42;case 29:case 33:return 43;case 30:case 34:return 44;case 31:return 45;case 35:case 37:case 38:return 46;case 36:return 47;case 39:return 30;case 41:return 6}},rules:[/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:[\\s]+)/i,/^(?:\"[^\"]*\")/i,/^(?:erDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\s+)/i,/^(?:\\b((?:PK)|(?:FK))\\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[A-Za-z][A-Za-z0-9\\-_\\[\\]]*)/i,/^(?:\"[^\"]*\")/i,/^(?:[\\n]+)/i,/^(?:\\})/i,/^(?:.)/i,/^(?:\\|o\\b)/i,/^(?:\\}o\\b)/i,/^(?:\\}\\|)/i,/^(?:\\|\\|)/i,/^(?:o\\|)/i,/^(?:o\\{)/i,/^(?:\\|\\{)/i,/^(?:\\.\\.)/i,/^(?:--)/i,/^(?:\\.-)/i,/^(?:-\\.)/i,/^(?:[A-Za-z][A-Za-z0-9\\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},open_directive:{rules:[8],inclusive:!1},type_directive:{rules:[9,10],inclusive:!1},arg_directive:{rules:[10,11],inclusive:!1},block:{rules:[20,21,22,23,24,25,26,27],inclusive:!1},INITIAL:{rules:[0,2,4,7,12,13,14,15,16,17,18,19,28,29,30,31,32,33,34,35,36,37,38,39,40,41],inclusive:!0}}};function w(){this.yy={}}return x.lexer=k,w.prototype=x,x.Parser=w,new w}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8009).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3602:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,9],n=[1,7],r=[1,6],i=[1,8],a=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],o=[2,10],s=[1,20],c=[1,21],l=[1,22],u=[1,23],h=[1,30],f=[1,32],d=[1,33],p=[1,34],g=[1,62],y=[1,48],m=[1,52],b=[1,36],v=[1,37],_=[1,38],x=[1,39],k=[1,40],w=[1,56],T=[1,63],E=[1,51],C=[1,53],S=[1,55],A=[1,59],M=[1,60],N=[1,41],O=[1,42],D=[1,43],B=[1,44],L=[1,61],I=[1,50],F=[1,54],R=[1,57],P=[1,58],j=[1,49],z=[1,66],Y=[1,71],U=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$=[1,75],W=[1,74],q=[1,76],H=[20,21,23,81,82],V=[1,99],G=[1,104],X=[1,107],Z=[1,108],Q=[1,101],K=[1,106],J=[1,109],tt=[1,102],et=[1,114],nt=[1,113],rt=[1,103],it=[1,105],at=[1,110],ot=[1,111],st=[1,112],ct=[1,115],lt=[20,21,22,23,81,82],ut=[20,21,22,23,53,81,82],ht=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],ft=[20,21,23],dt=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],pt=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],gt=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],yt=[1,149],mt=[1,157],bt=[1,158],vt=[1,159],_t=[1,160],xt=[1,144],kt=[1,145],wt=[1,141],Tt=[1,152],Et=[1,153],Ct=[1,154],St=[1,155],At=[1,156],Mt=[1,161],Nt=[1,162],Ot=[1,147],Dt=[1,150],Bt=[1,146],Lt=[1,143],It=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],Ft=[1,165],Rt=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],Pt=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],jt=[12,21,22,24],zt=[22,106],Yt=[1,250],Ut=[1,245],$t=[1,246],Wt=[1,254],qt=[1,251],Ht=[1,248],Vt=[1,247],Gt=[1,249],Xt=[1,252],Zt=[1,253],Qt=[1,255],Kt=[1,273],Jt=[20,21,23,106],te=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113],ee={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,\":\":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,acc_title:44,acc_title_value:45,acc_descr:46,acc_descr_value:47,acc_descr_multiline_value:48,link:49,node:50,vertex:51,AMP:52,STYLE_SEPARATOR:53,idString:54,DOUBLECIRCLESTART:55,DOUBLECIRCLEEND:56,PS:57,PE:58,\"(-\":59,\"-)\":60,STADIUMSTART:61,STADIUMEND:62,SUBROUTINESTART:63,SUBROUTINEEND:64,VERTEX_WITH_PROPS_START:65,ALPHA:66,COLON:67,PIPE:68,CYLINDERSTART:69,CYLINDEREND:70,DIAMOND_START:71,DIAMOND_STOP:72,TAGEND:73,TRAPSTART:74,TRAPEND:75,INVTRAPSTART:76,INVTRAPEND:77,linkStatement:78,arrowText:79,TESTSTR:80,START_LINK:81,LINK:82,textToken:83,STR:84,keywords:85,STYLE:86,LINKSTYLE:87,CLASSDEF:88,CLASS:89,CLICK:90,DOWN:91,UP:92,textNoTags:93,textNoTagsToken:94,DEFAULT:95,stylesOpt:96,alphaNum:97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,HEX:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,MINUS:109,UNIT:110,BRKT:111,DOT:112,PCT:113,TAGSTART:114,alphaNumToken:115,idStringToken:116,alphaNumStatement:117,direction_tb:118,direction_bt:119,direction_rl:120,direction_lr:121,PUNCTUATION:122,UNICODE_TEXT:123,PLUS:124,EQUALS:125,MULT:126,UNDERSCORE:127,graphCodeTokens:128,ARROW_CROSS:129,ARROW_POINT:130,ARROW_CIRCLE:131,ARROW_OPEN:132,QUOTE:133,$accept:0,$end:1},terminals_:{2:\"error\",10:\":\",12:\"open_directive\",13:\"type_directive\",14:\"arg_directive\",15:\"close_directive\",20:\"SEMI\",21:\"NEWLINE\",22:\"SPACE\",23:\"EOF\",24:\"GRAPH\",25:\"NODIR\",26:\"DIR\",38:\"subgraph\",40:\"SQS\",41:\"SQE\",42:\"end\",44:\"acc_title\",45:\"acc_title_value\",46:\"acc_descr\",47:\"acc_descr_value\",48:\"acc_descr_multiline_value\",52:\"AMP\",53:\"STYLE_SEPARATOR\",55:\"DOUBLECIRCLESTART\",56:\"DOUBLECIRCLEEND\",57:\"PS\",58:\"PE\",59:\"(-\",60:\"-)\",61:\"STADIUMSTART\",62:\"STADIUMEND\",63:\"SUBROUTINESTART\",64:\"SUBROUTINEEND\",65:\"VERTEX_WITH_PROPS_START\",66:\"ALPHA\",67:\"COLON\",68:\"PIPE\",69:\"CYLINDERSTART\",70:\"CYLINDEREND\",71:\"DIAMOND_START\",72:\"DIAMOND_STOP\",73:\"TAGEND\",74:\"TRAPSTART\",75:\"TRAPEND\",76:\"INVTRAPSTART\",77:\"INVTRAPEND\",80:\"TESTSTR\",81:\"START_LINK\",82:\"LINK\",84:\"STR\",86:\"STYLE\",87:\"LINKSTYLE\",88:\"CLASSDEF\",89:\"CLASS\",90:\"CLICK\",91:\"DOWN\",92:\"UP\",95:\"DEFAULT\",98:\"CALLBACKNAME\",99:\"CALLBACKARGS\",100:\"HREF\",101:\"LINK_TARGET\",102:\"HEX\",104:\"INTERPOLATE\",105:\"NUM\",106:\"COMMA\",109:\"MINUS\",110:\"UNIT\",111:\"BRKT\",112:\"DOT\",113:\"PCT\",114:\"TAGSTART\",118:\"direction_tb\",119:\"direction_bt\",120:\"direction_rl\",121:\"direction_lr\",122:\"PUNCTUATION\",123:\"UNICODE_TEXT\",124:\"PLUS\",125:\"EQUALS\",126:\"MULT\",127:\"UNDERSCORE\",129:\"ARROW_CROSS\",130:\"ARROW_POINT\",131:\"ARROW_CIRCLE\",132:\"ARROW_OPEN\",133:\"QUOTE\"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.parseDirective(\"%%{\",\"open_directive\");break;case 6:r.parseDirective(a[s],\"type_directive\");break;case 7:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 8:r.parseDirective(\"}%%\",\"close_directive\",\"flowchart\");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:a[s]!==[]&&a[s-1].push(a[s]),this.$=a[s-1];break;case 12:case 82:case 84:case 96:case 152:case 154:case 155:case 78:case 150:this.$=a[s];break;case 19:r.setDirection(\"TB\"),this.$=\"TB\";break;case 20:r.setDirection(a[s-1]),this.$=a[s-1];break;case 35:this.$=a[s-1].nodes;break;case 41:this.$=r.addSubGraph(a[s-6],a[s-1],a[s-4]);break;case 42:this.$=r.addSubGraph(a[s-3],a[s-1],a[s-3]);break;case 43:this.$=r.addSubGraph(void 0,a[s-1],void 0);break;case 45:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 46:case 47:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 51:r.addLink(a[s-2].stmt,a[s],a[s-1]),this.$={stmt:a[s],nodes:a[s].concat(a[s-2].nodes)};break;case 52:r.addLink(a[s-3].stmt,a[s-1],a[s-2]),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 53:this.$={stmt:a[s-1],nodes:a[s-1]};break;case 54:this.$={stmt:a[s],nodes:a[s]};break;case 55:case 123:case 125:this.$=[a[s]];break;case 56:this.$=a[s-4].concat(a[s]);break;case 57:this.$=[a[s-2]],r.setClass(a[s-2],a[s]);break;case 58:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"square\");break;case 59:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"doublecircle\");break;case 60:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"circle\");break;case 61:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"ellipse\");break;case 62:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"stadium\");break;case 63:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"subroutine\");break;case 64:this.$=a[s-7],r.addVertex(a[s-7],a[s-1],\"rect\",void 0,void 0,void 0,Object.fromEntries([[a[s-5],a[s-3]]]));break;case 65:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"cylinder\");break;case 66:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"round\");break;case 67:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"diamond\");break;case 68:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"hexagon\");break;case 69:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"odd\");break;case 70:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"trapezoid\");break;case 71:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"inv_trapezoid\");break;case 72:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_right\");break;case 73:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_left\");break;case 74:this.$=a[s],r.addVertex(a[s]);break;case 75:a[s-1].text=a[s],this.$=a[s-1];break;case 76:case 77:a[s-2].text=a[s-1],this.$=a[s-2];break;case 79:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,text:a[s-1]};break;case 80:c=r.destructLink(a[s]),this.$={type:c.type,stroke:c.stroke,length:c.length};break;case 81:this.$=a[s-1];break;case 83:case 97:case 153:case 151:this.$=a[s-1]+\"\"+a[s];break;case 98:case 99:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 100:this.$=a[s-4],r.setClass(a[s-2],a[s]);break;case 101:case 109:this.$=a[s-1],r.setClickEvent(a[s-1],a[s]);break;case 102:case 110:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 103:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 104:this.$=a[s-4],r.setClickEvent(a[s-4],a[s-3],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 105:case 111:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 106:case 112:this.$=a[s-3],r.setLink(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 107:case 113:this.$=a[s-3],r.setLink(a[s-3],a[s-2],a[s]);break;case 108:case 114:this.$=a[s-5],r.setLink(a[s-5],a[s-4],a[s]),r.setTooltip(a[s-5],a[s-2]);break;case 115:this.$=a[s-4],r.addVertex(a[s-2],void 0,void 0,a[s]);break;case 116:case 118:this.$=a[s-4],r.updateLink(a[s-2],a[s]);break;case 117:this.$=a[s-4],r.updateLink([a[s-2]],a[s]);break;case 119:this.$=a[s-8],r.updateLinkInterpolate([a[s-6]],a[s-2]),r.updateLink([a[s-6]],a[s]);break;case 120:this.$=a[s-8],r.updateLinkInterpolate(a[s-6],a[s-2]),r.updateLink(a[s-6],a[s]);break;case 121:this.$=a[s-6],r.updateLinkInterpolate([a[s-4]],a[s]);break;case 122:this.$=a[s-6],r.updateLinkInterpolate(a[s-4],a[s]);break;case 124:case 126:a[s-2].push(a[s]),this.$=a[s-2];break;case 128:this.$=a[s-1]+a[s];break;case 156:this.$=\"v\";break;case 157:this.$=\"-\";break;case 158:this.$={stmt:\"dir\",value:\"TB\"};break;case 159:this.$={stmt:\"dir\",value:\"BT\"};break;case 160:this.$={stmt:\"dir\",value:\"RL\"};break;case 161:this.$={stmt:\"dir\",value:\"LR\"}}},table:[{3:1,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},t(a,o,{17:11}),{7:12,13:[1,13]},{16:14,21:n,22:r,24:i},{16:15,21:n,22:r,24:i},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{8:64,10:[1,65],15:z},t([10,15],[2,6]),t(a,[2,17]),t(a,[2,18]),t(a,[2,19]),{20:[1,68],21:[1,69],22:Y,27:67,30:70},t(U,[2,11]),t(U,[2,12]),t(U,[2,13]),t(U,[2,14]),t(U,[2,15]),t(U,[2,16]),{9:72,20:$,21:W,23:q,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:$,21:W,23:q},{9:81,20:$,21:W,23:q},{9:82,20:$,21:W,23:q},{9:83,20:$,21:W,23:q},{9:84,20:$,21:W,23:q},{9:86,20:$,21:W,22:[1,85],23:q},t(U,[2,44]),{45:[1,87]},{47:[1,88]},t(U,[2,47]),t(H,[2,54],{30:89,22:Y}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:V,52:G,66:X,67:Z,84:[1,97],91:Q,97:96,98:[1,94],100:[1,95],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(U,[2,158]),t(U,[2,159]),t(U,[2,160]),t(U,[2,161]),t(lt,[2,55],{53:[1,116]}),t(ut,[2,74],{116:129,40:[1,117],52:g,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:y,67:m,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),t(ht,[2,150]),t(ht,[2,175]),t(ht,[2,176]),t(ht,[2,177]),t(ht,[2,178]),t(ht,[2,179]),t(ht,[2,180]),t(ht,[2,181]),t(ht,[2,182]),t(ht,[2,183]),t(ht,[2,184]),t(ht,[2,185]),t(ht,[2,186]),t(ht,[2,187]),t(ht,[2,188]),t(ht,[2,189]),t(ht,[2,190]),{9:130,20:$,21:W,23:q},{11:131,14:[1,132]},t(ft,[2,8]),t(a,[2,20]),t(a,[2,26]),t(a,[2,27]),{21:[1,133]},t(dt,[2,34],{30:134,22:Y}),t(U,[2,35]),{50:135,51:45,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},t(pt,[2,48]),t(pt,[2,49]),t(pt,[2,50]),t(gt,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:yt,24:mt,26:bt,38:vt,39:139,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),t(U,[2,36]),t(U,[2,37]),t(U,[2,38]),t(U,[2,39]),t(U,[2,40]),{22:yt,24:mt,26:bt,38:vt,39:163,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:164}),t(U,[2,45]),t(U,[2,46]),t(H,[2,53],{52:Ft}),{26:V,52:G,66:X,67:Z,91:Q,97:166,102:[1,167],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{95:[1,168],103:169,105:[1,170]},{26:V,52:G,66:X,67:Z,91:Q,95:[1,171],97:172,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:173,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,101],{22:[1,174],99:[1,175]}),t(ft,[2,105],{22:[1,176]}),t(ft,[2,109],{115:100,117:178,22:[1,177],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,111],{22:[1,179]}),t(Rt,[2,152]),t(Rt,[2,154]),t(Rt,[2,155]),t(Rt,[2,156]),t(Rt,[2,157]),t(Pt,[2,162]),t(Pt,[2,163]),t(Pt,[2,164]),t(Pt,[2,165]),t(Pt,[2,166]),t(Pt,[2,167]),t(Pt,[2,168]),t(Pt,[2,169]),t(Pt,[2,170]),t(Pt,[2,171]),t(Pt,[2,172]),t(Pt,[2,173]),t(Pt,[2,174]),{52:g,54:180,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:yt,24:mt,26:bt,38:vt,39:181,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:182,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:184,42:_t,52:G,57:[1,183],66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:185,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:186,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:187,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{66:[1,188]},{22:yt,24:mt,26:bt,38:vt,39:189,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:190,42:_t,52:G,66:X,67:Z,71:[1,191],73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:192,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:193,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:194,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ht,[2,151]),t(jt,[2,3]),{8:195,15:z},{15:[2,7]},t(a,[2,28]),t(dt,[2,33]),t(H,[2,51],{30:196,22:Y}),t(gt,[2,75],{22:[1,197]}),{22:[1,198]},{22:yt,24:mt,26:bt,38:vt,39:199,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,81:kt,82:[1,200],83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(Pt,[2,82]),t(Pt,[2,84]),t(Pt,[2,140]),t(Pt,[2,141]),t(Pt,[2,142]),t(Pt,[2,143]),t(Pt,[2,144]),t(Pt,[2,145]),t(Pt,[2,146]),t(Pt,[2,147]),t(Pt,[2,148]),t(Pt,[2,149]),t(Pt,[2,85]),t(Pt,[2,86]),t(Pt,[2,87]),t(Pt,[2,88]),t(Pt,[2,89]),t(Pt,[2,90]),t(Pt,[2,91]),t(Pt,[2,92]),t(Pt,[2,93]),t(Pt,[2,94]),t(Pt,[2,95]),{9:203,20:$,21:W,22:yt,23:q,24:mt,26:bt,38:vt,40:[1,202],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,204],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Y,30:205},{22:[1,206],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},t(zt,[2,123]),{22:[1,211]},{22:[1,212],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,213],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{84:[1,214]},t(ft,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},t(Rt,[2,153]),{84:[1,219],101:[1,220]},t(lt,[2,57],{116:129,52:g,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),{22:yt,24:mt,26:bt,38:vt,41:[1,221],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,56:[1,222],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:223,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,224],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,60:[1,225],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,62:[1,226],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,64:[1,227],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{67:[1,228]},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,70:[1,229],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,230],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:231,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,41:[1,232],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,233],77:[1,234],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,236],77:[1,235],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{9:237,20:$,21:W,23:q},t(H,[2,52],{52:Ft}),t(gt,[2,77]),t(gt,[2,76]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,68:[1,238],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(gt,[2,79]),t(Pt,[2,83]),{22:yt,24:mt,26:bt,38:vt,39:239,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:240}),t(U,[2,43]),{51:241,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:242,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:256,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:257,102:qt,104:[1,258],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:259,102:qt,104:[1,260],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{105:[1,261]},{22:Yt,66:Ut,67:$t,86:Wt,96:262,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:263,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{26:V,52:G,66:X,67:Z,91:Q,97:264,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,102]),{84:[1,265]},t(ft,[2,106],{22:[1,266]}),t(ft,[2,107]),t(ft,[2,110]),t(ft,[2,112],{22:[1,267]}),t(ft,[2,113]),t(ut,[2,58]),t(ut,[2,59]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,268],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,66]),t(ut,[2,61]),t(ut,[2,62]),t(ut,[2,63]),{66:[1,269]},t(ut,[2,65]),t(ut,[2,67]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,270],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,69]),t(ut,[2,70]),t(ut,[2,72]),t(ut,[2,71]),t(ut,[2,73]),t(jt,[2,4]),t([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:yt,24:mt,26:bt,38:vt,41:[1,271],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,272],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},t(lt,[2,56]),t(ft,[2,115],{106:Kt}),t(Jt,[2,125],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(te,[2,127]),t(te,[2,129]),t(te,[2,130]),t(te,[2,131]),t(te,[2,132]),t(te,[2,133]),t(te,[2,134]),t(te,[2,135]),t(te,[2,136]),t(te,[2,137]),t(te,[2,138]),t(te,[2,139]),t(ft,[2,116],{106:Kt}),t(ft,[2,117],{106:Kt}),{22:[1,275]},t(ft,[2,118],{106:Kt}),{22:[1,276]},t(zt,[2,124]),t(ft,[2,98],{106:Kt}),t(ft,[2,99],{106:Kt}),t(ft,[2,100],{115:100,117:178,26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:$,21:W,23:q},t(U,[2,42]),{22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,107:283,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(te,[2,128]),{26:V,52:G,66:X,67:Z,91:Q,97:284,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:285,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,108]),t(ft,[2,114]),t(ut,[2,60]),{22:yt,24:mt,26:bt,38:vt,39:286,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,68]),t(It,o,{17:287}),t(Jt,[2,126],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(ft,[2,121],{115:100,117:178,22:[1,288],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,122],{115:100,117:178,22:[1,289],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),{22:yt,24:mt,26:bt,38:vt,41:[1,290],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,291],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:292,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:293,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(ut,[2,64]),t(U,[2,41]),t(ft,[2,119],{106:Kt}),t(ft,[2,120],{106:Kt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],132:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},ne={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),12;case 1:return this.begin(\"type_directive\"),13;case 2:return this.popState(),this.begin(\"arg_directive\"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:return this.begin(\"acc_title\"),44;case 8:return this.popState(),\"acc_title_value\";case 9:return this.begin(\"acc_descr\"),46;case 10:return this.popState(),\"acc_descr_value\";case 11:this.begin(\"acc_descr_multiline\");break;case 12:case 15:case 24:case 27:case 30:case 33:this.popState();break;case 13:return\"acc_descr_multiline_value\";case 14:this.begin(\"string\");break;case 16:return\"STR\";case 17:return 86;case 18:return 95;case 19:return 87;case 20:return 104;case 21:return 88;case 22:return 89;case 23:this.begin(\"href\");break;case 25:return 100;case 26:this.begin(\"callbackname\");break;case 28:this.popState(),this.begin(\"callbackargs\");break;case 29:return 98;case 31:return 99;case 32:this.begin(\"click\");break;case 34:return 90;case 35:case 36:return t.lex.firstGraph()&&this.begin(\"dir\"),24;case 37:return 38;case 38:return 42;case 39:case 40:case 41:case 42:return 101;case 43:return this.popState(),25;case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:return this.popState(),26;case 54:return 118;case 55:return 119;case 56:return 120;case 57:return 121;case 58:return 105;case 59:return 111;case 60:return 53;case 61:return 67;case 62:return 52;case 63:return 20;case 64:return 106;case 65:return 126;case 66:case 67:case 68:return 82;case 69:case 70:case 71:return 81;case 72:return 59;case 73:return 60;case 74:return 61;case 75:return 62;case 76:return 63;case 77:return 64;case 78:return 65;case 79:return 69;case 80:return 70;case 81:return 55;case 82:return 56;case 83:return 109;case 84:return 112;case 85:return 127;case 86:return 124;case 87:return 113;case 88:case 89:return 125;case 90:return 114;case 91:return 73;case 92:return 92;case 93:return\"SEP\";case 94:return 91;case 95:return 66;case 96:return 75;case 97:return 74;case 98:return 77;case 99:return 76;case 100:return 122;case 101:return 123;case 102:return 68;case 103:return 57;case 104:return 58;case 105:return 40;case 106:return 41;case 107:return 71;case 108:return 72;case 109:return 133;case 110:return 21;case 111:return 22;case 112:return 23}},rules:[/^(?:%%\\{)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)[^\\n]*)/,/^(?:[^\\}]%%[^\\n]*)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:style\\b)/,/^(?:default\\b)/,/^(?:linkStyle\\b)/,/^(?:interpolate\\b)/,/^(?:classDef\\b)/,/^(?:class\\b)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:click[\\s]+)/,/^(?:[\\s\\n])/,/^(?:[^\\s\\n]*)/,/^(?:graph\\b)/,/^(?:flowchart\\b)/,/^(?:subgraph\\b)/,/^(?:end\\b\\s*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:(\\r?\\n)*\\s*\\n)/,/^(?:\\s*LR\\b)/,/^(?:\\s*RL\\b)/,/^(?:\\s*TB\\b)/,/^(?:\\s*BT\\b)/,/^(?:\\s*TD\\b)/,/^(?:\\s*BR\\b)/,/^(?:\\s*<)/,/^(?:\\s*>)/,/^(?:\\s*\\^)/,/^(?:\\s*v\\b)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\\*)/,/^(?:\\s*[xo<]?--+[-xo>]\\s*)/,/^(?:\\s*[xo<]?==+[=xo>]\\s*)/,/^(?:\\s*[xo<]?-?\\.+-[xo>]?\\s*)/,/^(?:\\s*[xo<]?--\\s*)/,/^(?:\\s*[xo<]?==\\s*)/,/^(?:\\s*[xo<]?-\\.\\s*)/,/^(?:\\(-)/,/^(?:-\\))/,/^(?:\\(\\[)/,/^(?:\\]\\))/,/^(?:\\[\\[)/,/^(?:\\]\\])/,/^(?:\\[\\|)/,/^(?:\\[\\()/,/^(?:\\)\\])/,/^(?:\\(\\(\\()/,/^(?:\\)\\)\\))/,/^(?:-)/,/^(?:\\.)/,/^(?:[\\_])/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\\^)/,/^(?:\\\\\\|)/,/^(?:v\\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\\\\])/,/^(?:\\[\\/)/,/^(?:\\/\\])/,/^(?:\\[\\\\)/,/^(?:[!\"#$%&'*+,-.`?\\\\_/])/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\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]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\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\\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-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\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\\u0D60\\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-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\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\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\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\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\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])/,/^(?:\\|)/,/^(?:\\()/,/^(?:\\))/,/^(?:\\[)/,/^(?:\\])/,/^(?:\\{)/,/^(?:\\})/,/^(?:\")/,/^(?:(\\r?\\n)+)/,/^(?:\\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[30,31],inclusive:!1},callbackname:{rules:[27,28,29],inclusive:!1},href:{rules:[24,25],inclusive:!1},click:{rules:[33,34],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[43,44,45,46,47,48,49,50,51,52,53],inclusive:!1},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},string:{rules:[15,16],inclusive:!1},INITIAL:{rules:[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],inclusive:!0}}};function re(){this.yy={}}return ee.lexer=ne,re.prototype=ee,ee.Parser=re,new re}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(5354).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9959:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,23],d=[1,24],p=[1,25],g=[1,26],y=[1,28],m=[1,30],b=[1,33],v=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],_={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,excludes:16,includes:17,todayMarker:18,title:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,clickStatement:26,taskTxt:27,taskData:28,openDirective:29,typeDirective:30,closeDirective:31,\":\":32,argDirective:33,click:34,callbackname:35,callbackargs:36,href:37,clickStatementDebug:38,open_directive:39,type_directive:40,arg_directive:41,close_directive:42,$accept:0,$end:1},terminals_:{2:\"error\",5:\"gantt\",7:\"EOF\",9:\"SPACE\",11:\"NL\",12:\"dateFormat\",13:\"inclusiveEndDates\",14:\"topAxis\",15:\"axisFormat\",16:\"excludes\",17:\"includes\",18:\"todayMarker\",19:\"title\",20:\"acc_title\",21:\"acc_title_value\",22:\"acc_descr\",23:\"acc_descr_value\",24:\"acc_descr_multiline_value\",25:\"section\",27:\"taskTxt\",28:\"taskData\",32:\":\",34:\"click\",35:\"callbackname\",36:\"callbackargs\",37:\"href\",39:\"open_directive\",40:\"type_directive\",41:\"arg_directive\",42:\"close_directive\"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[26,2],[26,3],[26,3],[26,4],[26,3],[26,4],[26,2],[38,2],[38,3],[38,3],[38,4],[38,3],[38,4],[38,2],[29,1],[30,1],[33,1],[31,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 2:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 9:r.setDateFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[s].substr(18);break;case 11:r.TopAxis(),this.$=a[s].substr(8);break;case 12:r.setAxisFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 13:r.setExcludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 14:r.setIncludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 15:r.setTodayMarker(a[s].substr(12)),this.$=a[s].substr(12);break;case 16:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 26:this.$=a[s-1],r.setClickEvent(a[s-1],a[s],null);break;case 27:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 28:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],null),r.setLink(a[s-2],a[s]);break;case 29:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setLink(a[s-3],a[s]);break;case 30:this.$=a[s-2],r.setClickEvent(a[s-2],a[s],null),r.setLink(a[s-2],a[s-1]);break;case 31:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-1],a[s]),r.setLink(a[s-3],a[s-2]);break;case 32:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 33:case 39:this.$=a[s-1]+\" \"+a[s];break;case 34:case 35:case 37:this.$=a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 36:case 38:this.$=a[s-3]+\" \"+a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 40:r.parseDirective(\"%%{\",\"open_directive\");break;case 41:r.parseDirective(a[s],\"type_directive\");break;case 42:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 43:r.parseDirective(\"}%%\",\"close_directive\",\"gantt\")}},table:[{3:1,4:2,5:e,29:4,39:n},{1:[3]},{3:6,4:2,5:e,29:4,39:n},t(r,[2,3],{6:7}),{30:8,40:[1,9]},{40:[2,40]},{1:[2,1]},{4:29,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},{31:31,32:[1,32],42:b},t([32,42],[2,41]),t(r,[2,8],{1:[2,2]}),t(r,[2,4]),{4:29,10:34,12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,9]),t(r,[2,10]),t(r,[2,11]),t(r,[2,12]),t(r,[2,13]),t(r,[2,14]),t(r,[2,15]),t(r,[2,16]),{21:[1,35]},{23:[1,36]},t(r,[2,19]),t(r,[2,20]),t(r,[2,21]),{28:[1,37]},t(r,[2,23]),{35:[1,38],37:[1,39]},{11:[1,40]},{33:41,41:[1,42]},{11:[2,43]},t(r,[2,5]),t(r,[2,17]),t(r,[2,18]),t(r,[2,22]),t(r,[2,26],{36:[1,43],37:[1,44]}),t(r,[2,32],{35:[1,45]}),t(v,[2,24]),{31:46,42:b},{42:[2,42]},t(r,[2,27],{37:[1,47]}),t(r,[2,28]),t(r,[2,30],{36:[1,48]}),{11:[1,49]},t(r,[2,29]),t(r,[2,31]),t(v,[2,25])],defaultActions:{5:[2,40],6:[2,1],33:[2,43],42:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},x={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),39;case 1:return this.begin(\"type_directive\"),40;case 2:return this.popState(),this.begin(\"arg_directive\"),32;case 3:return this.popState(),this.popState(),42;case 4:return 41;case 5:return this.begin(\"acc_title\"),20;case 6:return this.popState(),\"acc_title_value\";case 7:return this.begin(\"acc_descr\"),22;case 8:return this.popState(),\"acc_descr_value\";case 9:this.begin(\"acc_descr_multiline\");break;case 10:case 20:case 23:case 26:case 29:this.popState();break;case 11:return\"acc_descr_multiline_value\";case 12:case 13:case 14:case 16:case 17:case 18:break;case 15:return 11;case 19:this.begin(\"href\");break;case 21:return 37;case 22:this.begin(\"callbackname\");break;case 24:this.popState(),this.begin(\"callbackargs\");break;case 25:return 35;case 27:return 36;case 28:this.begin(\"click\");break;case 30:return 34;case 31:return 5;case 32:return 12;case 33:return 13;case 34:return 14;case 35:return 15;case 36:return 17;case 37:return 16;case 38:return 18;case 39:return\"date\";case 40:return 19;case 41:return\"accDescription\";case 42:return 25;case 43:return 27;case 44:return 28;case 45:return 32;case 46:return 7;case 47:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:%%(?!\\{)*[^\\n]*)/i,/^(?:[^\\}]%%*[^\\n]*)/i,/^(?:%%*[^\\n]*[\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:href[\\s]+[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:call[\\s]+)/i,/^(?:\\([\\s]*\\))/i,/^(?:\\()/i,/^(?:[^(]*)/i,/^(?:\\))/i,/^(?:[^)]*)/i,/^(?:click[\\s]+)/i,/^(?:[\\s\\n])/i,/^(?:[^\\s\\n]*)/i,/^(?:gantt\\b)/i,/^(?:dateFormat\\s[^#\\n;]+)/i,/^(?:inclusiveEndDates\\b)/i,/^(?:topAxis\\b)/i,/^(?:axisFormat\\s[^#\\n;]+)/i,/^(?:includes\\s[^#\\n;]+)/i,/^(?:excludes\\s[^#\\n;]+)/i,/^(?:todayMarker\\s[^\\n;]+)/i,/^(?:\\d\\d\\d\\d-\\d\\d-\\d\\d\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accDescription\\s[^#\\n;]+)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[26,27],inclusive:!1},callbackname:{rules:[23,24,25],inclusive:!1},href:{rules:[20,21],inclusive:!1},click:{rules:[29,30],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],inclusive:!0}}};function k(){this.yy={}}return _.lexer=x,k.prototype=_,_.Parser=k,new k}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(6878).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},2553:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,7],r=[1,5],i=[1,9],a=[1,6],o=[2,6],s=[1,16],c=[6,8,14,20,22,24,25,27,29,32,35,39,49,53],l=[8,14,20,22,24,25,27,29,32,35,39],u=[8,13,14,20,22,24,25,27,29,32,35,39],h=[1,26],f=[6,8,14,49,53],d=[8,14,53],p=[1,64],g=[1,65],y=[1,66],m=[8,14,33,38,41,53],b={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,GG:6,document:7,EOF:8,\":\":9,DIR:10,options:11,body:12,OPT:13,NL:14,line:15,statement:16,commitStatement:17,mergeStatement:18,cherryPickStatement:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,branchStatement:26,CHECKOUT:27,ID:28,BRANCH:29,ORDER:30,NUM:31,CHERRY_PICK:32,COMMIT_ID:33,STR:34,MERGE:35,COMMIT_TYPE:36,commitType:37,COMMIT_TAG:38,COMMIT:39,commit_arg:40,COMMIT_MSG:41,NORMAL:42,REVERSE:43,HIGHLIGHT:44,openDirective:45,typeDirective:46,closeDirective:47,argDirective:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,\";\":53,$accept:0,$end:1},terminals_:{2:\"error\",6:\"GG\",8:\"EOF\",9:\":\",10:\"DIR\",13:\"OPT\",14:\"NL\",20:\"acc_title\",21:\"acc_title_value\",22:\"acc_descr\",23:\"acc_descr_value\",24:\"acc_descr_multiline_value\",25:\"section\",27:\"CHECKOUT\",28:\"ID\",29:\"BRANCH\",30:\"ORDER\",31:\"NUM\",32:\"CHERRY_PICK\",33:\"COMMIT_ID\",34:\"STR\",35:\"MERGE\",36:\"COMMIT_TYPE\",38:\"COMMIT_TAG\",39:\"COMMIT\",41:\"COMMIT_MSG\",42:\"NORMAL\",43:\"REVERSE\",44:\"HIGHLIGHT\",49:\"open_directive\",50:\"type_directive\",51:\"arg_directive\",52:\"close_directive\",53:\";\"},productions_:[0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[18,2],[18,4],[18,4],[18,4],[18,6],[18,6],[18,6],[18,6],[18,6],[18,6],[18,8],[18,8],[18,8],[18,8],[18,8],[18,8],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[40,0],[40,1],[37,1],[37,1],[37,1],[5,3],[5,5],[45,1],[46,1],[48,1],[47,1],[4,1],[4,1],[4,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return a[s];case 4:return a[s-1];case 5:return r.setDirection(a[s-3]),a[s-1];case 7:r.setOptions(a[s-1]),this.$=a[s];break;case 8:a[s-1]+=a[s],this.$=a[s-1];break;case 10:this.$=[];break;case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 12:this.$=a[s-1];break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.checkout(a[s]);break;case 23:r.branch(a[s]);break;case 24:r.branch(a[s-2],a[s]);break;case 25:r.cherryPick(a[s]);break;case 26:r.merge(a[s],\"\",\"\",\"\");break;case 27:r.merge(a[s-2],a[s],\"\",\"\");break;case 28:r.merge(a[s-2],\"\",a[s],\"\");break;case 29:r.merge(a[s-2],\"\",\"\",a[s]);break;case 30:r.merge(a[s-4],a[s],\"\",a[s-2]);break;case 31:r.merge(a[s-4],\"\",a[s],a[s-2]);break;case 32:r.merge(a[s-4],\"\",a[s-2],a[s]);break;case 33:r.merge(a[s-4],a[s-2],a[s],\"\");break;case 34:r.merge(a[s-4],a[s-2],\"\",a[s]);break;case 35:r.merge(a[s-4],a[s],a[s-2],\"\");break;case 36:r.merge(a[s-6],a[s-4],a[s-2],a[s]);break;case 37:r.merge(a[s-6],a[s],a[s-4],a[s-2]);break;case 38:r.merge(a[s-6],a[s-4],a[s],a[s-2]);break;case 39:r.merge(a[s-6],a[s-2],a[s-4],a[s]);break;case 40:r.merge(a[s-6],a[s],a[s-2],a[s-4]);break;case 41:r.merge(a[s-6],a[s-2],a[s],a[s-4]);break;case 42:r.commit(a[s]);break;case 43:r.commit(\"\",\"\",r.commitType.NORMAL,a[s]);break;case 44:r.commit(\"\",\"\",a[s],\"\");break;case 45:r.commit(\"\",\"\",a[s],a[s-2]);break;case 46:r.commit(\"\",\"\",a[s-2],a[s]);break;case 47:r.commit(\"\",a[s],r.commitType.NORMAL,\"\");break;case 48:r.commit(\"\",a[s-2],r.commitType.NORMAL,a[s]);break;case 49:r.commit(\"\",a[s],r.commitType.NORMAL,a[s-2]);break;case 50:r.commit(\"\",a[s-2],a[s],\"\");break;case 51:r.commit(\"\",a[s],a[s-2],\"\");break;case 52:r.commit(\"\",a[s-4],a[s-2],a[s]);break;case 53:r.commit(\"\",a[s-4],a[s],a[s-2]);break;case 54:r.commit(\"\",a[s-2],a[s-4],a[s]);break;case 55:r.commit(\"\",a[s],a[s-4],a[s-2]);break;case 56:r.commit(\"\",a[s],a[s-2],a[s-4]);break;case 57:r.commit(\"\",a[s-2],a[s],a[s-4]);break;case 58:r.commit(a[s],\"\",r.commitType.NORMAL,\"\");break;case 59:r.commit(a[s],\"\",r.commitType.NORMAL,a[s-2]);break;case 60:r.commit(a[s-2],\"\",r.commitType.NORMAL,a[s]);break;case 61:r.commit(a[s-2],\"\",a[s],\"\");break;case 62:r.commit(a[s],\"\",a[s-2],\"\");break;case 63:r.commit(a[s],a[s-2],r.commitType.NORMAL,\"\");break;case 64:r.commit(a[s-2],a[s],r.commitType.NORMAL,\"\");break;case 65:r.commit(a[s-4],\"\",a[s-2],a[s]);break;case 66:r.commit(a[s-4],\"\",a[s],a[s-2]);break;case 67:r.commit(a[s-2],\"\",a[s-4],a[s]);break;case 68:r.commit(a[s],\"\",a[s-4],a[s-2]);break;case 69:r.commit(a[s],\"\",a[s-2],a[s-4]);break;case 70:r.commit(a[s-2],\"\",a[s],a[s-4]);break;case 71:r.commit(a[s-4],a[s],a[s-2],\"\");break;case 72:r.commit(a[s-4],a[s-2],a[s],\"\");break;case 73:r.commit(a[s-2],a[s],a[s-4],\"\");break;case 74:r.commit(a[s],a[s-2],a[s-4],\"\");break;case 75:r.commit(a[s],a[s-4],a[s-2],\"\");break;case 76:r.commit(a[s-2],a[s-4],a[s],\"\");break;case 77:r.commit(a[s-4],a[s],r.commitType.NORMAL,a[s-2]);break;case 78:r.commit(a[s-4],a[s-2],r.commitType.NORMAL,a[s]);break;case 79:r.commit(a[s-2],a[s],r.commitType.NORMAL,a[s-4]);break;case 80:r.commit(a[s],a[s-2],r.commitType.NORMAL,a[s-4]);break;case 81:r.commit(a[s],a[s-4],r.commitType.NORMAL,a[s-2]);break;case 82:r.commit(a[s-2],a[s-4],r.commitType.NORMAL,a[s]);break;case 83:r.commit(a[s-6],a[s-4],a[s-2],a[s]);break;case 84:r.commit(a[s-6],a[s-4],a[s],a[s-2]);break;case 85:r.commit(a[s-6],a[s-2],a[s-4],a[s]);break;case 86:r.commit(a[s-6],a[s],a[s-4],a[s-2]);break;case 87:r.commit(a[s-6],a[s-2],a[s],a[s-4]);break;case 88:r.commit(a[s-6],a[s],a[s-2],a[s-4]);break;case 89:r.commit(a[s-4],a[s-6],a[s-2],a[s]);break;case 90:r.commit(a[s-4],a[s-6],a[s],a[s-2]);break;case 91:r.commit(a[s-2],a[s-6],a[s-4],a[s]);break;case 92:r.commit(a[s],a[s-6],a[s-4],a[s-2]);break;case 93:r.commit(a[s-2],a[s-6],a[s],a[s-4]);break;case 94:r.commit(a[s],a[s-6],a[s-2],a[s-4]);break;case 95:r.commit(a[s],a[s-4],a[s-2],a[s-6]);break;case 96:r.commit(a[s-2],a[s-4],a[s],a[s-6]);break;case 97:r.commit(a[s],a[s-2],a[s-4],a[s-6]);break;case 98:r.commit(a[s-2],a[s],a[s-4],a[s-6]);break;case 99:r.commit(a[s-4],a[s-2],a[s],a[s-6]);break;case 100:r.commit(a[s-4],a[s],a[s-2],a[s-6]);break;case 101:r.commit(a[s-2],a[s-4],a[s-6],a[s]);break;case 102:r.commit(a[s],a[s-4],a[s-6],a[s-2]);break;case 103:r.commit(a[s-2],a[s],a[s-6],a[s-4]);break;case 104:r.commit(a[s],a[s-2],a[s-6],a[s-4]);break;case 105:r.commit(a[s-4],a[s-2],a[s-6],a[s]);break;case 106:r.commit(a[s-4],a[s],a[s-6],a[s-2]);break;case 107:this.$=\"\";break;case 108:this.$=a[s];break;case 109:this.$=r.commitType.NORMAL;break;case 110:this.$=r.commitType.REVERSE;break;case 111:this.$=r.commitType.HIGHLIGHT;break;case 114:r.parseDirective(\"%%{\",\"open_directive\");break;case 115:r.parseDirective(a[s],\"type_directive\");break;case 116:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 117:r.parseDirective(\"}%%\",\"close_directive\",\"gitGraph\")}},table:[{3:1,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{1:[3]},{3:10,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{3:11,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{7:12,8:o,9:[1,13],10:[1,14],11:15,14:s},t(c,[2,118]),t(c,[2,119]),t(c,[2,120]),{46:17,50:[1,18]},{50:[2,114]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:o,11:15,14:s},{9:[1,21]},t(l,[2,10],{12:22,13:[1,23]}),t(u,[2,9]),{9:[1,25],47:24,52:h},t([9,52],[2,115]),{1:[2,3]},{8:[1,27]},{7:28,8:o,11:15,14:s},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],35:[1,42],39:[1,41]},t(u,[2,8]),t(f,[2,112]),{48:45,51:[1,46]},t(f,[2,117]),{1:[2,4]},{8:[1,47]},t(l,[2,11]),{4:48,8:n,14:r,53:a},t(l,[2,13]),t(d,[2,14]),t(d,[2,15]),t(d,[2,16]),{21:[1,49]},{23:[1,50]},t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),{28:[1,51]},t(d,[2,107],{40:52,33:[1,55],34:[1,57],36:[1,54],38:[1,53],41:[1,56]}),{28:[1,58]},{33:[1,59]},{28:[1,60]},{47:61,52:h},{52:[2,116]},{1:[2,5]},t(l,[2,12]),t(d,[2,17]),t(d,[2,18]),t(d,[2,22]),t(d,[2,42]),{34:[1,62]},{37:63,42:p,43:g,44:y},{34:[1,67]},{34:[1,68]},t(d,[2,108]),t(d,[2,26],{33:[1,69],36:[1,70],38:[1,71]}),{34:[1,72]},t(d,[2,23],{30:[1,73]}),t(f,[2,113]),t(d,[2,43],{33:[1,75],36:[1,74],41:[1,76]}),t(d,[2,44],{33:[1,78],38:[1,77],41:[1,79]}),t(m,[2,109]),t(m,[2,110]),t(m,[2,111]),t(d,[2,47],{36:[1,81],38:[1,80],41:[1,82]}),t(d,[2,58],{33:[1,85],36:[1,84],38:[1,83]}),{34:[1,86]},{37:87,42:p,43:g,44:y},{34:[1,88]},t(d,[2,25]),{31:[1,89]},{37:90,42:p,43:g,44:y},{34:[1,91]},{34:[1,92]},{34:[1,93]},{34:[1,94]},{34:[1,95]},{34:[1,96]},{37:97,42:p,43:g,44:y},{34:[1,98]},{34:[1,99]},{37:100,42:p,43:g,44:y},{34:[1,101]},t(d,[2,27],{36:[1,102],38:[1,103]}),t(d,[2,28],{33:[1,105],38:[1,104]}),t(d,[2,29],{33:[1,106],36:[1,107]}),t(d,[2,24]),t(d,[2,45],{33:[1,108],41:[1,109]}),t(d,[2,49],{36:[1,110],41:[1,111]}),t(d,[2,59],{33:[1,113],36:[1,112]}),t(d,[2,46],{33:[1,114],41:[1,115]}),t(d,[2,51],{38:[1,116],41:[1,117]}),t(d,[2,62],{33:[1,119],38:[1,118]}),t(d,[2,48],{36:[1,120],41:[1,121]}),t(d,[2,50],{38:[1,122],41:[1,123]}),t(d,[2,63],{36:[1,124],38:[1,125]}),t(d,[2,60],{33:[1,127],36:[1,126]}),t(d,[2,61],{33:[1,129],38:[1,128]}),t(d,[2,64],{36:[1,130],38:[1,131]}),{37:132,42:p,43:g,44:y},{34:[1,133]},{34:[1,134]},{34:[1,135]},{34:[1,136]},{37:137,42:p,43:g,44:y},{34:[1,138]},{34:[1,139]},{37:140,42:p,43:g,44:y},{34:[1,141]},{37:142,42:p,43:g,44:y},{34:[1,143]},{34:[1,144]},{34:[1,145]},{34:[1,146]},{34:[1,147]},{34:[1,148]},{34:[1,149]},{37:150,42:p,43:g,44:y},{34:[1,151]},{34:[1,152]},{34:[1,153]},{37:154,42:p,43:g,44:y},{34:[1,155]},{37:156,42:p,43:g,44:y},{34:[1,157]},{34:[1,158]},{34:[1,159]},{37:160,42:p,43:g,44:y},{34:[1,161]},t(d,[2,33],{38:[1,162]}),t(d,[2,34],{36:[1,163]}),t(d,[2,32],{33:[1,164]}),t(d,[2,35],{38:[1,165]}),t(d,[2,30],{36:[1,166]}),t(d,[2,31],{33:[1,167]}),t(d,[2,56],{41:[1,168]}),t(d,[2,69],{33:[1,169]}),t(d,[2,57],{41:[1,170]}),t(d,[2,80],{36:[1,171]}),t(d,[2,70],{33:[1,172]}),t(d,[2,79],{36:[1,173]}),t(d,[2,55],{41:[1,174]}),t(d,[2,68],{33:[1,175]}),t(d,[2,54],{41:[1,176]}),t(d,[2,74],{38:[1,177]}),t(d,[2,67],{33:[1,178]}),t(d,[2,73],{38:[1,179]}),t(d,[2,53],{41:[1,180]}),t(d,[2,81],{36:[1,181]}),t(d,[2,52],{41:[1,182]}),t(d,[2,75],{38:[1,183]}),t(d,[2,76],{38:[1,184]}),t(d,[2,82],{36:[1,185]}),t(d,[2,66],{33:[1,186]}),t(d,[2,77],{36:[1,187]}),t(d,[2,65],{33:[1,188]}),t(d,[2,71],{38:[1,189]}),t(d,[2,72],{38:[1,190]}),t(d,[2,78],{36:[1,191]}),{34:[1,192]},{37:193,42:p,43:g,44:y},{34:[1,194]},{34:[1,195]},{37:196,42:p,43:g,44:y},{34:[1,197]},{34:[1,198]},{34:[1,199]},{34:[1,200]},{37:201,42:p,43:g,44:y},{34:[1,202]},{37:203,42:p,43:g,44:y},{34:[1,204]},{34:[1,205]},{34:[1,206]},{34:[1,207]},{34:[1,208]},{34:[1,209]},{34:[1,210]},{37:211,42:p,43:g,44:y},{34:[1,212]},{34:[1,213]},{34:[1,214]},{37:215,42:p,43:g,44:y},{34:[1,216]},{37:217,42:p,43:g,44:y},{34:[1,218]},{34:[1,219]},{34:[1,220]},{37:221,42:p,43:g,44:y},t(d,[2,36]),t(d,[2,38]),t(d,[2,37]),t(d,[2,39]),t(d,[2,41]),t(d,[2,40]),t(d,[2,97]),t(d,[2,98]),t(d,[2,95]),t(d,[2,96]),t(d,[2,100]),t(d,[2,99]),t(d,[2,104]),t(d,[2,103]),t(d,[2,102]),t(d,[2,101]),t(d,[2,106]),t(d,[2,105]),t(d,[2,94]),t(d,[2,93]),t(d,[2,92]),t(d,[2,91]),t(d,[2,89]),t(d,[2,90]),t(d,[2,88]),t(d,[2,87]),t(d,[2,86]),t(d,[2,85]),t(d,[2,83]),t(d,[2,84])],defaultActions:{9:[2,114],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,116],47:[2,5]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},v={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),49;case 1:return this.begin(\"type_directive\"),50;case 2:return this.popState(),this.begin(\"arg_directive\"),9;case 3:return this.popState(),this.popState(),52;case 4:return 51;case 5:return this.begin(\"acc_title\"),20;case 6:return this.popState(),\"acc_title_value\";case 7:return this.begin(\"acc_descr\"),22;case 8:return this.popState(),\"acc_descr_value\";case 9:this.begin(\"acc_descr_multiline\");break;case 10:case 35:case 38:this.popState();break;case 11:return\"acc_descr_multiline_value\";case 12:return 14;case 13:case 14:case 15:break;case 16:return 6;case 17:return 39;case 18:return 33;case 19:return 36;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 38;case 25:return 29;case 26:return 30;case 27:return 35;case 28:return 32;case 29:return 27;case 30:case 31:return 10;case 32:return 9;case 33:return\"CARET\";case 34:this.begin(\"options\");break;case 36:return 13;case 37:this.begin(\"string\");break;case 39:return 34;case 40:return 31;case 41:return 28;case 42:return 8}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:gitGraph\\b)/i,/^(?:commit\\b)/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\\b)/i,/^(?:REVERSE\\b)/i,/^(?:HIGHLIGHT\\b)/i,/^(?:tag:)/i,/^(?:branch\\b)/i,/^(?:order:)/i,/^(?:merge\\b)/i,/^(?:cherry-pick\\b)/i,/^(?:checkout\\b)/i,/^(?:LR\\b)/i,/^(?:BT\\b)/i,/^(?::)/i,/^(?:\\^)/i,/^(?:options\\r?\\n)/i,/^(?:[ \\r\\n\\t]+end\\b)/i,/^(?:[\\s\\S]+(?=[ \\r\\n\\t]+end))/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[0-9]+)/i,/^(?:[a-zA-Z][-_\\./a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},options:{rules:[35,36],inclusive:!1},string:{rules:[38,39],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,37,40,41,42],inclusive:!0}}};function _(){this.yy={}}return b.lexer=v,_.prototype=b,b.Parser=_,new _}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8183).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6765:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[6,9,10],n={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:\"error\",4:\"info\",6:\"EOF\",9:\"NL\",10:\"showInfo\"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,o){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0)}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},t(e,[2,3]),t(e,[2,4]),t(e,[2,5]),t(e,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},r={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return\"space\";case 3:return 10;case 4:return 6;case 5:return\"TXT\"}},rules:[/^(?:info\\b)/i,/^(?:[\\s\\n\\r]+)/i,/^(?:[\\s]+)/i,/^(?:showInfo\\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}};function i(){this.yy={}}return n.lexer=r,i.prototype=n,n.Parser=i,new i}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1428).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},7062:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,5],r=[1,6],i=[1,7],a=[1,9],o=[1,11,13,15,17,19,20,26,27,28,29],s=[2,5],c=[1,6,11,13,15,17,19,20,26,27,28,29],l=[26,27,28],u=[2,8],h=[1,18],f=[1,19],d=[1,20],p=[1,21],g=[1,22],y=[1,23],m=[1,28],b=[6,26,27,28,29],v={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,openDirective:21,typeDirective:22,closeDirective:23,\":\":24,argDirective:25,NEWLINE:26,\";\":27,EOF:28,open_directive:29,type_directive:30,arg_directive:31,close_directive:32,$accept:0,$end:1},terminals_:{2:\"error\",6:\"PIE\",8:\"showData\",11:\"txt\",12:\"value\",13:\"title\",14:\"title_value\",15:\"acc_title\",16:\"acc_title_value\",17:\"acc_descr\",18:\"acc_descr_value\",19:\"acc_descr_multiline_value\",20:\"section\",24:\":\",26:\"NEWLINE\",27:\";\",28:\"EOF\",29:\"open_directive\",30:\"type_directive\",31:\"arg_directive\",32:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[s-1];break;case 9:r.addSection(a[s-1],r.cleanupValue(a[s]));break;case 10:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 11:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 12:case 13:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 14:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 21:r.parseDirective(\"%%{\",\"open_directive\");break;case 22:r.parseDirective(a[s],\"type_directive\");break;case 23:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 24:r.parseDirective(\"}%%\",\"close_directive\",\"pie\")}},table:[{3:1,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{1:[3]},{3:10,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{3:11,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},t(o,s,{7:12,8:[1,13]}),t(c,[2,18]),t(c,[2,19]),t(c,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},t(l,u,{21:8,9:16,10:17,5:24,1:[2,3],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(o,s,{7:25}),{23:26,24:[1,27],32:m},t([24,32],[2,22]),t(o,[2,6]),{4:29,26:n,27:r,28:i},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},t(l,[2,13]),t(l,[2,14]),t(l,[2,15]),t(l,u,{21:8,9:16,10:17,5:24,1:[2,4],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(b,[2,16]),{25:34,31:[1,35]},t(b,[2,24]),t(o,[2,7]),t(l,[2,9]),t(l,[2,10]),t(l,[2,11]),t(l,[2,12]),{23:36,32:m},{32:[2,23]},t(b,[2,17])],defaultActions:{9:[2,21],10:[2,1],11:[2,2],35:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},_={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),29;case 1:return this.begin(\"type_directive\"),30;case 2:return this.popState(),this.begin(\"arg_directive\"),24;case 3:return this.popState(),this.popState(),32;case 4:return 31;case 5:case 6:case 8:case 9:break;case 7:return 26;case 10:return this.begin(\"title\"),13;case 11:return this.popState(),\"title_value\";case 12:return this.begin(\"acc_title\"),15;case 13:return this.popState(),\"acc_title_value\";case 14:return this.begin(\"acc_descr\"),17;case 15:return this.popState(),\"acc_descr_value\";case 16:this.begin(\"acc_descr_multiline\");break;case 17:case 20:this.popState();break;case 18:return\"acc_descr_multiline_value\";case 19:this.begin(\"string\");break;case 21:return\"txt\";case 22:return 6;case 23:return 8;case 24:return\"value\";case 25:return 28}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n\\r]+)/i,/^(?:%%[^\\n]*)/i,/^(?:[\\s]+)/i,/^(?:title\\b)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:pie\\b)/i,/^(?:showData\\b)/i,/^(?::[\\s]*[\\d]+(?:\\.[\\d]+)?)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[20,21],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],inclusive:!0}}};function x(){this.yy={}}return v.lexer=_,x.prototype=v,v.Parser=x,new x}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(4551).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3176:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[1,6],i=[1,7],a=[1,8],o=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],s=[1,22],c=[2,13],l=[1,26],u=[1,27],h=[1,28],f=[1,29],d=[1,30],p=[1,31],g=[1,24],y=[1,32],m=[1,33],b=[1,36],v=[71,72],_=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],x=[1,56],k=[1,57],w=[1,58],T=[1,59],E=[1,60],C=[1,61],S=[1,62],A=[62,63],M=[1,74],N=[1,70],O=[1,71],D=[1,72],B=[1,73],L=[1,75],I=[1,79],F=[1,80],R=[1,77],P=[1,78],j=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72],z={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,\":\":12,argDirective:13,acc_title:14,acc_title_value:15,acc_descr:16,acc_descr_value:17,acc_descr_multiline_value:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,requirementDef:23,elementDef:24,relationshipDef:25,requirementType:26,requirementName:27,STRUCT_START:28,requirementBody:29,ID:30,COLONSEP:31,id:32,TEXT:33,text:34,RISK:35,riskLevel:36,VERIFYMTHD:37,verifyType:38,STRUCT_STOP:39,REQUIREMENT:40,FUNCTIONAL_REQUIREMENT:41,INTERFACE_REQUIREMENT:42,PERFORMANCE_REQUIREMENT:43,PHYSICAL_REQUIREMENT:44,DESIGN_CONSTRAINT:45,LOW_RISK:46,MED_RISK:47,HIGH_RISK:48,VERIFY_ANALYSIS:49,VERIFY_DEMONSTRATION:50,VERIFY_INSPECTION:51,VERIFY_TEST:52,ELEMENT:53,elementName:54,elementBody:55,TYPE:56,type:57,DOCREF:58,ref:59,END_ARROW_L:60,relationship:61,LINE:62,END_ARROW_R:63,CONTAINS:64,COPIES:65,DERIVES:66,SATISFIES:67,VERIFIES:68,REFINES:69,TRACES:70,unqString:71,qString:72,$accept:0,$end:1},terminals_:{2:\"error\",5:\"NEWLINE\",6:\"RD\",8:\"EOF\",12:\":\",14:\"acc_title\",15:\"acc_title_value\",16:\"acc_descr\",17:\"acc_descr_value\",18:\"acc_descr_multiline_value\",19:\"open_directive\",20:\"type_directive\",21:\"arg_directive\",22:\"close_directive\",28:\"STRUCT_START\",30:\"ID\",31:\"COLONSEP\",33:\"TEXT\",35:\"RISK\",37:\"VERIFYMTHD\",39:\"STRUCT_STOP\",40:\"REQUIREMENT\",41:\"FUNCTIONAL_REQUIREMENT\",42:\"INTERFACE_REQUIREMENT\",43:\"PERFORMANCE_REQUIREMENT\",44:\"PHYSICAL_REQUIREMENT\",45:\"DESIGN_CONSTRAINT\",46:\"LOW_RISK\",47:\"MED_RISK\",48:\"HIGH_RISK\",49:\"VERIFY_ANALYSIS\",50:\"VERIFY_DEMONSTRATION\",51:\"VERIFY_INSPECTION\",52:\"VERIFY_TEST\",53:\"ELEMENT\",56:\"TYPE\",58:\"DOCREF\",60:\"END_ARROW_L\",62:\"LINE\",63:\"END_ARROW_R\",64:\"CONTAINS\",65:\"COPIES\",66:\"DERIVES\",67:\"SATISFIES\",68:\"VERIFIES\",69:\"REFINES\",70:\"TRACES\",71:\"unqString\",72:\"qString\"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 6:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 7:case 8:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 9:r.parseDirective(\"%%{\",\"open_directive\");break;case 10:r.parseDirective(a[s],\"type_directive\");break;case 11:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 12:r.parseDirective(\"}%%\",\"close_directive\",\"pie\");break;case 13:this.$=[];break;case 19:r.addRequirement(a[s-3],a[s-4]);break;case 20:r.setNewReqId(a[s-2]);break;case 21:r.setNewReqText(a[s-2]);break;case 22:r.setNewReqRisk(a[s-2]);break;case 23:r.setNewReqVerifyMethod(a[s-2]);break;case 26:this.$=r.RequirementType.REQUIREMENT;break;case 27:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 29:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 30:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 32:this.$=r.RiskLevel.LOW_RISK;break;case 33:this.$=r.RiskLevel.MED_RISK;break;case 34:this.$=r.RiskLevel.HIGH_RISK;break;case 35:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 36:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 37:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 38:this.$=r.VerifyType.VERIFY_TEST;break;case 39:r.addElement(a[s-3]);break;case 40:r.setNewElementType(a[s-2]);break;case 41:r.setNewElementDocRef(a[s-2]);break;case 44:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 45:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 46:this.$=r.Relationships.CONTAINS;break;case 47:this.$=r.Relationships.COPIES;break;case 48:this.$=r.Relationships.DERIVES;break;case 49:this.$=r.Relationships.SATISFIES;break;case 50:this.$=r.Relationships.VERIFIES;break;case 51:this.$=r.Relationships.REFINES;break;case 52:this.$=r.Relationships.TRACES}},table:[{3:1,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[3]},{3:10,4:2,5:[1,9],6:e,9:4,14:n,16:r,18:i,19:a},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},t(o,[2,8]),{20:[2,9]},{3:16,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[2,2]},{4:21,5:s,7:17,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{11:34,12:[1,35],22:b},t([12,22],[2,10]),t(o,[2,6]),t(o,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:s,7:38,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:39,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:40,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:41,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:42,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},t(v,[2,26]),t(v,[2,27]),t(v,[2,28]),t(v,[2,29]),t(v,[2,30]),t(v,[2,31]),t(_,[2,55]),t(_,[2,56]),t(o,[2,4]),{13:51,21:[1,52]},t(o,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{61:63,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{11:64,22:b},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},t(A,[2,46]),t(A,[2,47]),t(A,[2,48]),t(A,[2,49]),t(A,[2,50]),t(A,[2,51]),t(A,[2,52]),{63:[1,68]},t(o,[2,5]),{5:M,29:69,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:76,56:R,58:P},{32:81,71:y,72:m},{32:82,71:y,72:m},t(j,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:M,29:87,30:N,33:O,35:D,37:B,39:L},t(j,[2,25]),t(j,[2,39]),{31:[1,88]},{31:[1,89]},{5:I,39:F,55:90,56:R,58:P},t(j,[2,43]),t(j,[2,44]),t(j,[2,45]),{32:91,71:y,72:m},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},t(j,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},t(j,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:M,29:116,30:N,33:O,35:D,37:B,39:L},{5:M,29:117,30:N,33:O,35:D,37:B,39:L},{5:M,29:118,30:N,33:O,35:D,37:B,39:L},{5:M,29:119,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:120,56:R,58:P},{5:I,39:F,55:121,56:R,58:P},t(j,[2,20]),t(j,[2,21]),t(j,[2,22]),t(j,[2,23]),t(j,[2,40]),t(j,[2,41])],defaultActions:{8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),19;case 1:return this.begin(\"type_directive\"),20;case 2:return this.popState(),this.begin(\"arg_directive\"),12;case 3:return this.popState(),this.popState(),22;case 4:return 21;case 5:return\"title\";case 6:return this.begin(\"acc_title\"),14;case 7:return this.popState(),\"acc_title_value\";case 8:return this.begin(\"acc_descr\"),16;case 9:return this.popState(),\"acc_descr_value\";case 10:this.begin(\"acc_descr_multiline\");break;case 11:case 53:this.popState();break;case 12:return\"acc_descr_multiline_value\";case 13:return 5;case 14:case 15:case 16:break;case 17:return 8;case 18:return 6;case 19:return 28;case 20:return 39;case 21:return 31;case 22:return 30;case 23:return 33;case 24:return 35;case 25:return 37;case 26:return 40;case 27:return 41;case 28:return 42;case 29:return 43;case 30:return 44;case 31:return 45;case 32:return 46;case 33:return 47;case 34:return 48;case 35:return 49;case 36:return 50;case 37:return 51;case 38:return 52;case 39:return 53;case 40:return 64;case 41:return 65;case 42:return 66;case 43:return 67;case 44:return 68;case 45:return 69;case 46:return 70;case 47:return 56;case 48:return 58;case 49:return 60;case 50:return 63;case 51:return 62;case 52:this.begin(\"string\");break;case 54:return\"qString\";case 55:return e.yytext=e.yytext.trim(),71}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?::)/i,/^(?:id\\b)/i,/^(?:text\\b)/i,/^(?:risk\\b)/i,/^(?:verifyMethod\\b)/i,/^(?:requirement\\b)/i,/^(?:functionalRequirement\\b)/i,/^(?:interfaceRequirement\\b)/i,/^(?:performanceRequirement\\b)/i,/^(?:physicalRequirement\\b)/i,/^(?:designConstraint\\b)/i,/^(?:low\\b)/i,/^(?:medium\\b)/i,/^(?:high\\b)/i,/^(?:analysis\\b)/i,/^(?:demonstration\\b)/i,/^(?:inspection\\b)/i,/^(?:test\\b)/i,/^(?:element\\b)/i,/^(?:contains\\b)/i,/^(?:copies\\b)/i,/^(?:derives\\b)/i,/^(?:satisfies\\b)/i,/^(?:verifies\\b)/i,/^(?:refines\\b)/i,/^(?:traces\\b)/i,/^(?:type\\b)/i,/^(?:docref\\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[\\w][^\\r\\n\\{\\<\\>\\-\\=]*)/i],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[53,54],inclusive:!1},INITIAL:{rules:[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],inclusive:!0}}};function U(){this.yy={}}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8800).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6876:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,18],l=[1,19],u=[1,21],h=[1,22],f=[1,23],d=[1,29],p=[1,30],g=[1,31],y=[1,32],m=[1,33],b=[1,34],v=[1,35],_=[1,36],x=[1,37],k=[1,38],w=[1,39],T=[1,40],E=[1,43],C=[1,44],S=[1,45],A=[1,46],M=[1,47],N=[1,48],O=[1,51],D=[1,4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],B=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,53,58,59,60,61,69,79],L=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,52,53,58,59,60,61,69,79],I=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,51,53,58,59,60,61,69,79],F=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,53,58,59,60,61,69,79],R=[67,68,69],P=[1,121],j=[1,4,5,7,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],z={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,openDirective:11,typeDirective:12,closeDirective:13,\":\":14,argDirective:15,participant:16,actor:17,AS:18,restOfLine:19,participant_actor:20,signal:21,autonumber:22,NUM:23,off:24,activate:25,deactivate:26,note_statement:27,links_statement:28,link_statement:29,properties_statement:30,details_statement:31,title:32,legacy_title:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,loop:39,end:40,rect:41,opt:42,alt:43,else_sections:44,par:45,par_sections:46,critical:47,option_sections:48,break:49,option:50,and:51,else:52,note:53,placement:54,text2:55,over:56,actor_pair:57,links:58,link:59,properties:60,details:61,spaceList:62,\",\":63,left_of:64,right_of:65,signaltype:66,\"+\":67,\"-\":68,ACTOR:69,SOLID_OPEN_ARROW:70,DOTTED_OPEN_ARROW:71,SOLID_ARROW:72,DOTTED_ARROW:73,SOLID_CROSS:74,DOTTED_CROSS:75,SOLID_POINT:76,DOTTED_POINT:77,TXT:78,open_directive:79,type_directive:80,arg_directive:81,close_directive:82,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NEWLINE\",7:\"SD\",14:\":\",16:\"participant\",18:\"AS\",19:\"restOfLine\",20:\"participant_actor\",22:\"autonumber\",23:\"NUM\",24:\"off\",25:\"activate\",26:\"deactivate\",32:\"title\",33:\"legacy_title\",34:\"acc_title\",35:\"acc_title_value\",36:\"acc_descr\",37:\"acc_descr_value\",38:\"acc_descr_multiline_value\",39:\"loop\",40:\"end\",41:\"rect\",42:\"opt\",43:\"alt\",45:\"par\",47:\"critical\",49:\"break\",50:\"option\",51:\"and\",52:\"else\",53:\"note\",56:\"over\",58:\"links\",59:\"link\",60:\"properties\",61:\"details\",63:\",\",64:\"left_of\",65:\"right_of\",67:\"+\",68:\"-\",69:\"ACTOR\",70:\"SOLID_OPEN_ARROW\",71:\"DOTTED_OPEN_ARROW\",72:\"SOLID_ARROW\",73:\"DOTTED_ARROW\",74:\"SOLID_CROSS\",75:\"DOTTED_CROSS\",76:\"SOLID_POINT\",77:\"DOTTED_POINT\",78:\"TXT\",79:\"open_directive\",80:\"type_directive\",81:\"arg_directive\",82:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[48,1],[48,4],[46,1],[46,4],[44,1],[44,4],[27,4],[27,4],[28,3],[29,3],[30,3],[31,3],[62,2],[62,1],[57,3],[57,1],[54,1],[54,1],[21,5],[21,5],[21,4],[17,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[55,1],[11,1],[12,1],[15,1],[13,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.apply(a[s]),a[s];case 5:case 9:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:case 56:this.$=a[s];break;case 12:a[s-3].type=\"addParticipant\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 13:a[s-1].type=\"addParticipant\",this.$=a[s-1];break;case 14:a[s-3].type=\"addActor\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 15:a[s-1].type=\"addActor\",this.$=a[s-1];break;case 17:this.$={type:\"sequenceIndex\",sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 18:this.$={type:\"sequenceIndex\",sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 19:this.$={type:\"sequenceIndex\",sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:\"sequenceIndex\",sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]};break;case 22:this.$={type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1]};break;case 28:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 29:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 30:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:a[s-1].unshift({type:\"loopStart\",loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:\"loopEnd\",loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 34:a[s-1].unshift({type:\"rectStart\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:\"rectEnd\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 35:a[s-1].unshift({type:\"optStart\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:\"optEnd\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:\"altStart\",altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:\"altEnd\",signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:\"parStart\",parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:\"parEnd\",signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:\"criticalStart\",criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:\"criticalEnd\",signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:\"breakStart\",breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:\"breakEnd\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 42:this.$=a[s-3].concat([{type:\"option\",optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 44:this.$=a[s-3].concat([{type:\"and\",parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 46:this.$=a[s-3].concat([{type:\"else\",altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 47:this.$=[a[s-1],{type:\"addNote\",placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 48:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:\"addNote\",placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 49:this.$=[a[s-1],{type:\"addLinks\",actor:a[s-1].actor,text:a[s]}];break;case 50:this.$=[a[s-1],{type:\"addALink\",actor:a[s-1].actor,text:a[s]}];break;case 51:this.$=[a[s-1],{type:\"addProperties\",actor:a[s-1].actor,text:a[s]}];break;case 52:this.$=[a[s-1],{type:\"addDetails\",actor:a[s-1].actor,text:a[s]}];break;case 55:this.$=[a[s-2],a[s]];break;case 57:this.$=r.PLACEMENT.LEFTOF;break;case 58:this.$=r.PLACEMENT.RIGHTOF;break;case 59:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]}];break;case 60:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4]}];break;case 61:this.$=[a[s-3],a[s-1],{type:\"addMessage\",from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 62:this.$={type:\"addParticipant\",actor:a[s]};break;case 63:this.$=r.LINETYPE.SOLID_OPEN;break;case 64:this.$=r.LINETYPE.DOTTED_OPEN;break;case 65:this.$=r.LINETYPE.SOLID;break;case 66:this.$=r.LINETYPE.DOTTED;break;case 67:this.$=r.LINETYPE.SOLID_CROSS;break;case 68:this.$=r.LINETYPE.DOTTED_CROSS;break;case 69:this.$=r.LINETYPE.SOLID_POINT;break;case 70:this.$=r.LINETYPE.DOTTED_POINT;break;case 71:this.$=r.parseMessage(a[s].trim().substring(1));break;case 72:r.parseDirective(\"%%{\",\"open_directive\");break;case 73:r.parseDirective(a[s],\"type_directive\");break;case 74:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 75:r.parseDirective(\"}%%\",\"close_directive\",\"sequence\")}},table:[{3:1,4:e,5:n,6:4,7:r,11:6,79:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,11:6,79:i},{3:9,4:e,5:n,6:4,7:r,11:6,79:i},{3:10,4:e,5:n,6:4,7:r,11:6,79:i},t([1,4,5,16,20,22,25,26,32,33,34,36,38,39,41,42,43,45,47,49,53,58,59,60,61,69,79],a,{8:11}),{12:12,80:[1,13]},{80:[2,72]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{13:49,14:[1,50],82:O},t([14,82],[2,73]),t(D,[2,6]),{6:41,10:52,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},t(D,[2,8]),t(D,[2,9]),{17:53,69:N},{17:54,69:N},{5:[1,55]},{5:[1,58],23:[1,56],24:[1,57]},{17:59,69:N},{17:60,69:N},{5:[1,61]},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},t(D,[2,28]),t(D,[2,29]),{35:[1,66]},{37:[1,67]},t(D,[2,32]),{19:[1,68]},{19:[1,69]},{19:[1,70]},{19:[1,71]},{19:[1,72]},{19:[1,73]},{19:[1,74]},t(D,[2,40]),{66:75,70:[1,76],71:[1,77],72:[1,78],73:[1,79],74:[1,80],75:[1,81],76:[1,82],77:[1,83]},{54:84,56:[1,85],64:[1,86],65:[1,87]},{17:88,69:N},{17:89,69:N},{17:90,69:N},{17:91,69:N},t([5,18,63,70,71,72,73,74,75,76,77,78],[2,62]),{5:[1,92]},{15:93,81:[1,94]},{5:[2,75]},t(D,[2,7]),{5:[1,96],18:[1,95]},{5:[1,98],18:[1,97]},t(D,[2,16]),{5:[1,100],23:[1,99]},{5:[1,101]},t(D,[2,20]),{5:[1,102]},{5:[1,103]},t(D,[2,23]),t(D,[2,24]),t(D,[2,25]),t(D,[2,26]),t(D,[2,27]),t(D,[2,30]),t(D,[2,31]),t(B,a,{8:104}),t(B,a,{8:105}),t(B,a,{8:106}),t(L,a,{44:107,8:108}),t(I,a,{46:109,8:110}),t(F,a,{48:111,8:112}),t(B,a,{8:113}),{17:116,67:[1,114],68:[1,115],69:N},t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{17:117,69:N},{17:119,57:118,69:N},{69:[2,57]},{69:[2,58]},{55:120,78:P},{55:122,78:P},{55:123,78:P},{55:124,78:P},t(j,[2,10]),{13:125,82:O},{82:[2,74]},{19:[1,126]},t(D,[2,13]),{19:[1,127]},t(D,[2,15]),{5:[1,128]},t(D,[2,18]),t(D,[2,19]),t(D,[2,21]),t(D,[2,22]),{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,129],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,130],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,131],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,132]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,45],41:v,42:_,43:x,45:k,47:w,49:T,52:[1,133],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,134]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,43],41:v,42:_,43:x,45:k,47:w,49:T,51:[1,135],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,136]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,41],41:v,42:_,43:x,45:k,47:w,49:T,50:[1,137],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,138],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{17:139,69:N},{17:140,69:N},{55:141,78:P},{55:142,78:P},{55:143,78:P},{63:[1,144],78:[2,56]},{5:[2,49]},{5:[2,71]},{5:[2,50]},{5:[2,51]},{5:[2,52]},{5:[1,145]},{5:[1,146]},{5:[1,147]},t(D,[2,17]),t(D,[2,33]),t(D,[2,34]),t(D,[2,35]),t(D,[2,36]),{19:[1,148]},t(D,[2,37]),{19:[1,149]},t(D,[2,38]),{19:[1,150]},t(D,[2,39]),{55:151,78:P},{55:152,78:P},{5:[2,61]},{5:[2,47]},{5:[2,48]},{17:153,69:N},t(j,[2,11]),t(D,[2,12]),t(D,[2,14]),t(L,a,{8:108,44:154}),t(I,a,{8:110,46:155}),t(F,a,{8:112,48:156}),{5:[2,59]},{5:[2,60]},{78:[2,55]},{40:[2,46]},{40:[2,44]},{40:[2,42]}],defaultActions:{7:[2,72],8:[2,1],9:[2,2],10:[2,3],51:[2,75],86:[2,57],87:[2,58],94:[2,74],120:[2,49],121:[2,71],122:[2,50],123:[2,51],124:[2,52],141:[2,61],142:[2,47],143:[2,48],151:[2,59],152:[2,60],153:[2,55],154:[2,46],155:[2,44],156:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),79;case 1:return this.begin(\"type_directive\"),80;case 2:return this.popState(),this.begin(\"arg_directive\"),14;case 3:return this.popState(),this.popState(),82;case 4:return 81;case 5:case 52:case 65:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return 23;case 12:return this.begin(\"ID\"),16;case 13:return this.begin(\"ID\"),20;case 14:return e.yytext=e.yytext.trim(),this.begin(\"ALIAS\"),69;case 15:return this.popState(),this.popState(),this.begin(\"LINE\"),18;case 16:return this.popState(),this.popState(),5;case 17:return this.begin(\"LINE\"),39;case 18:return this.begin(\"LINE\"),41;case 19:return this.begin(\"LINE\"),42;case 20:return this.begin(\"LINE\"),43;case 21:return this.begin(\"LINE\"),52;case 22:return this.begin(\"LINE\"),45;case 23:return this.begin(\"LINE\"),51;case 24:return this.begin(\"LINE\"),47;case 25:return this.begin(\"LINE\"),50;case 26:return this.begin(\"LINE\"),49;case 27:return this.popState(),19;case 28:return 40;case 29:return 64;case 30:return 65;case 31:return 58;case 32:return 59;case 33:return 60;case 34:return 61;case 35:return 56;case 36:return 53;case 37:return this.begin(\"ID\"),25;case 38:return this.begin(\"ID\"),26;case 39:return 32;case 40:return 33;case 41:return this.begin(\"acc_title\"),34;case 42:return this.popState(),\"acc_title_value\";case 43:return this.begin(\"acc_descr\"),36;case 44:return this.popState(),\"acc_descr_value\";case 45:this.begin(\"acc_descr_multiline\");break;case 46:this.popState();break;case 47:return\"acc_descr_multiline_value\";case 48:return 7;case 49:return 22;case 50:return 24;case 51:return 63;case 53:return e.yytext=e.yytext.trim(),69;case 54:return 72;case 55:return 73;case 56:return 70;case 57:return 71;case 58:return 74;case 59:return 75;case 60:return 76;case 61:return 77;case 62:return 78;case 63:return 67;case 64:return 68;case 66:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[0-9]+(?=[ \\n]+))/i,/^(?:participant\\b)/i,/^(?:actor\\b)/i,/^(?:[^\\->:\\n,;]+?(?=((?!\\n)\\s)+as(?!\\n)\\s|[#\\n;]|$))/i,/^(?:as\\b)/i,/^(?:(?:))/i,/^(?:loop\\b)/i,/^(?:rect\\b)/i,/^(?:opt\\b)/i,/^(?:alt\\b)/i,/^(?:else\\b)/i,/^(?:par\\b)/i,/^(?:and\\b)/i,/^(?:critical\\b)/i,/^(?:option\\b)/i,/^(?:break\\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\\n;]*)/i,/^(?:end\\b)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:links\\b)/i,/^(?:link\\b)/i,/^(?:properties\\b)/i,/^(?:details\\b)/i,/^(?:over\\b)/i,/^(?:note\\b)/i,/^(?:activate\\b)/i,/^(?:deactivate\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:title:\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:sequenceDiagram\\b)/i,/^(?:autonumber\\b)/i,/^(?:off\\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\\+\\->:\\n,;]+((?!(-x|--x|-\\)|--\\)))[\\-]*[^\\+\\->:\\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\\)])/i,/^(?:--[\\)])/i,/^(?::(?:(?:no)?wrap)?[^#\\n;]+)/i,/^(?:\\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[46,47],inclusive:!1},acc_descr:{rules:[44],inclusive:!1},acc_title:{rules:[42],inclusive:!1},open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,14],inclusive:!1},ALIAS:{rules:[7,8,15,16],inclusive:!1},LINE:{rules:[7,8,27],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],inclusive:!0}}};function U(){this.yy={}}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1993).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3584:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,33],d=[1,23],p=[1,24],g=[1,25],y=[1,26],m=[1,27],b=[1,30],v=[1,31],_=[1,32],x=[1,35],k=[1,36],w=[1,37],T=[1,38],E=[1,34],C=[1,41],S=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],A=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],M=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],N=[4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],O={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,idStatement:11,DESCR:12,\"--\\x3e\":13,HIDE_EMPTY:14,scale:15,WIDTH:16,COMPOSIT_STATE:17,STRUCT_START:18,STRUCT_STOP:19,STATE_DESCR:20,AS:21,ID:22,FORK:23,JOIN:24,CHOICE:25,CONCURRENT:26,note:27,notePosition:28,NOTE_TEXT:29,direction:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,openDirective:36,typeDirective:37,closeDirective:38,\":\":39,argDirective:40,direction_tb:41,direction_bt:42,direction_rl:43,direction_lr:44,eol:45,\";\":46,EDGE_STATE:47,left_of:48,right_of:49,open_directive:50,type_directive:51,arg_directive:52,close_directive:53,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NL\",7:\"SD\",12:\"DESCR\",13:\"--\\x3e\",14:\"HIDE_EMPTY\",15:\"scale\",16:\"WIDTH\",17:\"COMPOSIT_STATE\",18:\"STRUCT_START\",19:\"STRUCT_STOP\",20:\"STATE_DESCR\",21:\"AS\",22:\"ID\",23:\"FORK\",24:\"JOIN\",25:\"CHOICE\",26:\"CONCURRENT\",27:\"note\",29:\"NOTE_TEXT\",31:\"acc_title\",32:\"acc_title_value\",33:\"acc_descr\",34:\"acc_descr_value\",35:\"acc_descr_multiline_value\",39:\":\",41:\"direction_tb\",42:\"direction_bt\",43:\"direction_rl\",44:\"direction_lr\",46:\";\",47:\"EDGE_STATE\",48:\"left_of\",49:\"right_of\",50:\"open_directive\",51:\"type_directive\",52:\"arg_directive\",53:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[45,1],[45,1],[11,1],[11,1],[28,1],[28,1],[36,1],[37,1],[40,1],[38,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.setRootDoc(a[s]),a[s];case 5:this.$=[];break;case 6:\"nl\"!=a[s]&&(a[s-1].push(a[s]),this.$=a[s-1]);break;case 7:case 8:case 39:case 40:this.$=a[s];break;case 9:this.$=\"nl\";break;case 10:this.$={stmt:\"state\",id:a[s],type:\"default\",description:\"\"};break;case 11:this.$={stmt:\"state\",id:a[s-1],type:\"default\",description:r.trimColon(a[s])};break;case 12:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-2],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s],type:\"default\",description:\"\"}};break;case 13:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-3],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s-1],type:\"default\",description:\"\"},description:a[s].substr(1).trim()};break;case 17:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:\"\",doc:a[s-1]};break;case 18:var c=a[s],l=a[s-2].trim();if(a[s].match(\":\")){var u=a[s].split(\":\");c=u[0],l=[l,u[1]]}this.$={stmt:\"state\",id:c,type:\"default\",description:l};break;case 19:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:a[s-5],doc:a[s-1]};break;case 20:this.$={stmt:\"state\",id:a[s],type:\"fork\"};break;case 21:this.$={stmt:\"state\",id:a[s],type:\"join\"};break;case 22:this.$={stmt:\"state\",id:a[s],type:\"choice\"};break;case 23:this.$={stmt:\"state\",id:r.getDividerId(),type:\"divider\"};break;case 24:this.$={stmt:\"state\",id:a[s-1].trim(),note:{position:a[s-2].trim(),text:a[s].trim()}};break;case 28:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:r.setDirection(\"TB\"),this.$={stmt:\"dir\",value:\"TB\"};break;case 34:r.setDirection(\"BT\"),this.$={stmt:\"dir\",value:\"BT\"};break;case 35:r.setDirection(\"RL\"),this.$={stmt:\"dir\",value:\"RL\"};break;case 36:r.setDirection(\"LR\"),this.$={stmt:\"dir\",value:\"LR\"};break;case 43:r.parseDirective(\"%%{\",\"open_directive\");break;case 44:r.parseDirective(a[s],\"type_directive\");break;case 45:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 46:r.parseDirective(\"}%%\",\"close_directive\",\"state\")}},table:[{3:1,4:e,5:n,6:4,7:r,36:6,50:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,36:6,50:i},{3:9,4:e,5:n,6:4,7:r,36:6,50:i},{3:10,4:e,5:n,6:4,7:r,36:6,50:i},t([1,4,5,14,15,17,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],a,{8:11}),{37:12,51:[1,13]},{51:[2,43]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},{38:39,39:[1,40],53:C},t([39,53],[2,44]),t(S,[2,6]),{6:28,10:42,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,8]),t(S,[2,9]),t(S,[2,10],{12:[1,43],13:[1,44]}),t(S,[2,14]),{16:[1,45]},t(S,[2,16],{18:[1,46]}),{21:[1,47]},t(S,[2,20]),t(S,[2,21]),t(S,[2,22]),t(S,[2,23]),{28:48,29:[1,49],48:[1,50],49:[1,51]},t(S,[2,26]),t(S,[2,27]),{32:[1,52]},{34:[1,53]},t(S,[2,30]),t(A,[2,39]),t(A,[2,40]),t(S,[2,33]),t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(M,[2,31]),{40:54,52:[1,55]},t(M,[2,46]),t(S,[2,7]),t(S,[2,11]),{11:56,22:f,47:E},t(S,[2,15]),t(N,a,{8:57}),{22:[1,58]},{22:[1,59]},{21:[1,60]},{22:[2,41]},{22:[2,42]},t(S,[2,28]),t(S,[2,29]),{38:61,53:C},{53:[2,45]},t(S,[2,12],{12:[1,62]}),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,63],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,18],{18:[1,64]}),{29:[1,65]},{22:[1,66]},t(M,[2,32]),t(S,[2,13]),t(S,[2,17]),t(N,a,{8:67}),t(S,[2,24]),t(S,[2,25]),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,68],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,19])],defaultActions:{7:[2,43],8:[2,1],9:[2,2],10:[2,3],50:[2,41],51:[2,42],55:[2,45]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},D={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:case 33:return 41;case 1:case 34:return 42;case 2:case 35:return 43;case 3:case 36:return 44;case 4:return this.begin(\"open_directive\"),50;case 5:return this.begin(\"type_directive\"),51;case 6:return this.popState(),this.begin(\"arg_directive\"),39;case 7:return this.popState(),this.popState(),53;case 8:return 52;case 9:case 10:case 12:case 13:case 14:case 15:case 46:case 52:break;case 11:case 66:return 5;case 16:return this.pushState(\"SCALE\"),15;case 17:return 16;case 18:case 24:case 40:case 43:this.popState();break;case 19:return this.begin(\"acc_title\"),31;case 20:return this.popState(),\"acc_title_value\";case 21:return this.begin(\"acc_descr\"),33;case 22:return this.popState(),\"acc_descr_value\";case 23:this.begin(\"acc_descr_multiline\");break;case 25:return\"acc_descr_multiline_value\";case 26:this.pushState(\"STATE\");break;case 27:case 30:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),23;case 28:case 31:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),24;case 29:case 32:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),25;case 37:this.begin(\"STATE_STRING\");break;case 38:return this.popState(),this.pushState(\"STATE_ID\"),\"AS\";case 39:case 54:return this.popState(),\"ID\";case 41:return\"STATE_DESCR\";case 42:return 17;case 44:return this.popState(),this.pushState(\"struct\"),18;case 45:return this.popState(),19;case 47:return this.begin(\"NOTE\"),27;case 48:return this.popState(),this.pushState(\"NOTE_ID\"),48;case 49:return this.popState(),this.pushState(\"NOTE_ID\"),49;case 50:this.popState(),this.pushState(\"FLOATING_NOTE\");break;case 51:return this.popState(),this.pushState(\"FLOATING_NOTE_ID\"),\"AS\";case 53:return\"NOTE_TEXT\";case 55:return this.popState(),this.pushState(\"NOTE_TEXT\"),22;case 56:return this.popState(),e.yytext=e.yytext.substr(2).trim(),29;case 57:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),29;case 58:case 59:return 7;case 60:return 14;case 61:return 47;case 62:return 22;case 63:return e.yytext=e.yytext.trim(),12;case 64:return 13;case 65:return 26;case 67:return\"INVALID\"}},rules:[/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:[\\s]+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:scale\\s+)/i,/^(?:\\d+)/i,/^(?:\\s+width\\b)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:state\\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\\[\\[fork\\]\\])/i,/^(?:.*\\[\\[join\\]\\])/i,/^(?:.*\\[\\[choice\\]\\])/i,/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:[\"])/i,/^(?:\\s*as\\s+)/i,/^(?:[^\\n\\{]*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n\\s\\{]+)/i,/^(?:\\n)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?:[\\n])/i,/^(?:note\\s+)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:\")/i,/^(?:\\s*as\\s*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n]*)/i,/^(?:\\s*[^:\\n\\s\\-]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:[\\s\\S]*?end note\\b)/i,/^(?:stateDiagram\\s+)/i,/^(?:stateDiagram-v2\\s+)/i,/^(?:hide empty description\\b)/i,/^(?:\\[\\*\\])/i,/^(?:[^:\\n\\s\\-\\{]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[13,14],inclusive:!1},close_directive:{rules:[13,14],inclusive:!1},arg_directive:{rules:[7,8,13,14],inclusive:!1},type_directive:{rules:[6,7,13,14],inclusive:!1},open_directive:{rules:[5,13,14],inclusive:!1},struct:{rules:[13,14,26,33,34,35,36,45,46,47,61,62,63,64,65],inclusive:!1},FLOATING_NOTE_ID:{rules:[54],inclusive:!1},FLOATING_NOTE:{rules:[51,52,53],inclusive:!1},NOTE_TEXT:{rules:[56,57],inclusive:!1},NOTE_ID:{rules:[55],inclusive:!1},NOTE:{rules:[48,49,50],inclusive:!1},acc_descr_multiline:{rules:[24,25],inclusive:!1},acc_descr:{rules:[22],inclusive:!1},acc_title:{rules:[20],inclusive:!1},SCALE:{rules:[17,18],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[39],inclusive:!1},STATE_STRING:{rules:[40,41],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[13,14,27,28,29,30,31,32,37,38,42,43,44],inclusive:!1},ID:{rules:[13,14],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,12,14,15,16,19,21,23,26,44,47,58,59,60,61,62,63,64,66,67],inclusive:!0}}};function B(){this.yy={}}return O.lexer=D,B.prototype=O,O.Parser=B,new B}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(3069).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9763:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,17,18,20,22,23,24,26],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,24],h=[4,6,9,11,17,18,20,22,23,24,26],f={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,taskName:24,taskData:25,open_directive:26,type_directive:27,arg_directive:28,close_directive:29,$accept:0,$end:1},terminals_:{2:\"error\",4:\"journey\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",17:\"title\",18:\"acc_title\",19:\"acc_title_value\",20:\"acc_descr\",21:\"acc_descr_value\",22:\"acc_descr_multiline_value\",23:\"section\",24:\"taskName\",25:\"taskData\",26:\"open_directive\",27:\"type_directive\",28:\"arg_directive\",29:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 11:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 16:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 18:r.parseDirective(\"%%{\",\"open_directive\");break;case 19:r.parseDirective(a[s],\"type_directive\");break;case 20:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 21:r.parseDirective(\"}%%\",\"close_directive\",\"journey\")}},table:[{3:1,4:e,7:3,12:4,26:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,26:n},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},{1:[2,2]},{14:22,15:[1,23],29:u},t([15,29],[2,19]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:21,10:25,12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),{19:[1,26]},{21:[1,27]},t(r,[2,14]),t(r,[2,15]),{25:[1,28]},t(r,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},t(r,[2,5]),t(r,[2,12]),t(r,[2,13]),t(r,[2,16]),t(h,[2,9]),{14:32,29:u},{29:[2,20]},{11:[1,33]},t(h,[2,10])],defaultActions:{5:[2,18],7:[2,2],24:[2,21],31:[2,20]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},d={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),26;case 1:return this.begin(\"type_directive\"),27;case 2:return this.popState(),this.begin(\"arg_directive\"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin(\"acc_title\"),18;case 13:return this.popState(),\"acc_title_value\";case 14:return this.begin(\"acc_descr\"),20;case 15:return this.popState(),\"acc_descr_value\";case 16:this.begin(\"acc_descr_multiline\");break;case 17:this.popState();break;case 18:return\"acc_descr_multiline_value\";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:journey\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};function p(){this.yy={}}return f.lexer=d,p.prototype=f,f.Parser=p,new p}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(9143).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},7967:(t,e)=>{e.N=void 0;var n=/^([^\\w]*)(javascript|data|vbscript)/im,r=/&#(\\w+)(^\\w|;)?/g,i=/[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]/gim,a=/^([^:]+):/gm,o=[\".\",\"/\"];e.N=function(t){var e,s=(e=t||\"\",e.replace(r,(function(t,e){return String.fromCharCode(e)}))).replace(i,\"\").trim();if(!s)return\"about:blank\";if(function(t){return o.indexOf(t[0])>-1}(s))return s;var c=s.match(a);if(!c)return s;var l=c[0];return n.test(l)?\"about:blank\":s}},3841:t=>{t.exports=function(t,e){return t.intersect(e)}},6187:(t,e,n)=>{n.d(e,{Z:()=>fu});var r=n(1941),i=n.n(r),a={debug:1,info:2,warn:3,error:4,fatal:5},o={debug:function(){},info:function(){},warn:function(){},error:function(){},fatal:function(){}},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"fatal\";isNaN(t)&&(t=t.toLowerCase(),void 0!==a[t]&&(t=a[t])),o.trace=function(){},o.debug=function(){},o.info=function(){},o.warn=function(){},o.error=function(){},o.fatal=function(){},t<=a.fatal&&(o.fatal=console.error?console.error.bind(console,c(\"FATAL\"),\"color: orange\"):console.log.bind(console,\"\u001b[35m\",c(\"FATAL\"))),t<=a.error&&(o.error=console.error?console.error.bind(console,c(\"ERROR\"),\"color: orange\"):console.log.bind(console,\"\u001b[31m\",c(\"ERROR\"))),t<=a.warn&&(o.warn=console.warn?console.warn.bind(console,c(\"WARN\"),\"color: orange\"):console.log.bind(console,\"\u001b[33m\",c(\"WARN\"))),t<=a.info&&(o.info=console.info?console.info.bind(console,c(\"INFO\"),\"color: lightblue\"):console.log.bind(console,\"\u001b[34m\",c(\"INFO\"))),t<=a.debug&&(o.debug=console.debug?console.debug.bind(console,c(\"DEBUG\"),\"color: lightgreen\"):console.log.bind(console,\"\u001b[32m\",c(\"DEBUG\")))},c=function(t){var e=i()().format(\"ss.SSS\");return\"%c\".concat(e,\" : \").concat(t,\" : \")},l=n(7543),u=\"comm\",h=\"rule\",f=\"decl\",d=Math.abs,p=String.fromCharCode;function g(t){return t.trim()}function y(t,e,n){return t.replace(e,n)}function m(t,e){return t.indexOf(e)}function b(t,e){return 0|t.charCodeAt(e)}function v(t,e,n){return t.slice(e,n)}function _(t){return t.length}function x(t){return t.length}function k(t,e){return e.push(t),t}function w(t,e){for(var n=\"\",r=x(t),i=0;i0?b(N,--A):0,C--,10===M&&(C=1,E--),M}function B(){return M=A2||R(M)>3?\"\":\" \"}function z(t,e){for(;--e&&B()&&!(M<48||M>102||M>57&&M<65||M>70&&M<97););return F(t,I()+(e<6&&32==L()&&32==B()))}function Y(t){for(;B();)switch(M){case t:return A;case 34:case 39:34!==t&&39!==t&&Y(M);break;case 40:41===t&&Y(t);break;case 92:B()}return A}function U(t,e){for(;B()&&t+M!==57&&(t+M!==84||47!==L()););return\"/*\"+F(e,A-1)+\"*\"+p(47===t?t:B())}function $(t){for(;!R(L());)B();return F(t,A)}function W(t){return function(t){return N=\"\",t}(q(\"\",null,null,null,[\"\"],t=function(t){return E=C=1,S=_(N=t),A=0,[]}(t),0,[0],t))}function q(t,e,n,r,i,a,o,s,c){for(var l=0,u=0,h=o,f=0,d=0,g=0,b=1,v=1,x=1,w=0,T=\"\",E=i,C=a,S=r,A=T;v;)switch(g=w,w=B()){case 40:if(108!=g&&58==A.charCodeAt(h-1)){-1!=m(A+=y(P(w),\"&\",\"&\\f\"),\"&\\f\")&&(x=-1);break}case 34:case 39:case 91:A+=P(w);break;case 9:case 10:case 13:case 32:A+=j(g);break;case 92:A+=z(I()-1,7);continue;case 47:switch(L()){case 42:case 47:k(V(U(B(),I()),e,n),c);break;default:A+=\"/\"}break;case 123*b:s[l++]=_(A)*x;case 125*b:case 59:case 0:switch(w){case 0:case 125:v=0;case 59+u:d>0&&_(A)-h&&k(d>32?G(A+\";\",r,n,h-1):G(y(A,\" \",\"\")+\";\",r,n,h-2),c);break;case 59:A+=\";\";default:if(k(S=H(A,e,n,l,u,i,s,T,E=[],C=[],h),a),123===w)if(0===u)q(A,e,S,S,E,a,h,s,C);else switch(f){case 100:case 109:case 115:q(t,S,S,r&&k(H(t,S,S,0,0,i,s,T,i,E=[],h),C),i,C,h,s,r?E:C);break;default:q(A,S,S,S,[\"\"],C,0,s,C)}}l=u=d=0,b=x=1,T=A=\"\",h=o;break;case 58:h=1+_(A),d=g;default:if(b<1)if(123==w)--b;else if(125==w&&0==b++&&125==D())continue;switch(A+=p(w),w*b){case 38:x=u>0?1:(A+=\"\\f\",-1);break;case 44:s[l++]=(_(A)-1)*x,x=1;break;case 64:45===L()&&(A+=P(B())),f=L(),u=h=_(T=A+=$(I())),w++;break;case 45:45===g&&2==_(A)&&(b=0)}}return a}function H(t,e,n,r,i,a,o,s,c,l,u){for(var f=i-1,p=0===i?a:[\"\"],m=x(p),b=0,_=0,k=0;b0?p[w]+\" \"+T:y(T,/&\\f/g,p[w])))&&(c[k++]=E);return O(t,e,n,0===i?h:s,c,l,u)}function V(t,e,n){return O(t,e,n,u,p(M),v(t,2,-2),0)}function G(t,e,n,r){return O(t,e,n,f,v(t,0,r),v(t,r+1,-1),r)}const X=\"9.1.7\";function Z(t){return Z=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Z(t)}const Q=function t(e,n,r){var i=Object.assign({depth:2,clobber:!1},r),a=i.depth,o=i.clobber;return Array.isArray(n)&&!Array.isArray(e)?(n.forEach((function(n){return t(e,n,r)})),e):Array.isArray(n)&&Array.isArray(e)?(n.forEach((function(t){-1===e.indexOf(t)&&e.push(t)})),e):void 0===e||a<=0?null!=e&&\"object\"===Z(e)&&\"object\"===Z(n)?Object.assign(e,n):n:(void 0!==n&&\"object\"===Z(e)&&\"object\"===Z(n)&&Object.keys(n).forEach((function(r){\"object\"!==Z(n[r])||void 0!==e[r]&&\"object\"!==Z(e[r])?(o||\"object\"!==Z(e[r])&&\"object\"!==Z(n[r]))&&(e[r]=n[r]):(void 0===e[r]&&(e[r]=Array.isArray(n[r])?[]:{}),e[r]=t(e[r],n[r],{depth:a-1,clobber:o}))})),e)},K={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return 2.55*n;t/=360,e/=100;const i=(n/=100)<.5?n*(1+e):n+e-n*e,a=2*n-i;switch(r){case\"r\":return 255*K.hue2rgb(a,i,t+1/3);case\"g\":return 255*K.hue2rgb(a,i,t);case\"b\":return 255*K.hue2rgb(a,i,t-1/3)}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),o=(i+a)/2;if(\"l\"===r)return 100*o;if(i===a)return 0;const s=i-a;if(\"s\"===r)return 100*(o>.5?s/(2-i-a):s/(i+a));switch(i){case t:return 60*((e-n)/s+(ee>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(1e10*t)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}},tt={};for(let t=0;t<=255;t++)tt[t]=J.unit.dec2hex(t);const et=new class{constructor(t,e){this.color=e,this.changed=!1,this.data=t,this.type=new class{constructor(){this.type=0}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error(\"Cannot change both RGB and HSL channels at the same time\");this.type=t}reset(){this.type=0}is(t){return this.type===t}}}set(t,e){return this.color=e,this.changed=!1,this.data=t,this.type.type=0,this}_ensureHSL(){const t=this.data,{h:e,s:n,l:r}=t;void 0===e&&(t.h=J.channel.rgb2hsl(t,\"h\")),void 0===n&&(t.s=J.channel.rgb2hsl(t,\"s\")),void 0===r&&(t.l=J.channel.rgb2hsl(t,\"l\"))}_ensureRGB(){const t=this.data,{r:e,g:n,b:r}=t;void 0===e&&(t.r=J.channel.hsl2rgb(t,\"r\")),void 0===n&&(t.g=J.channel.hsl2rgb(t,\"g\")),void 0===r&&(t.b=J.channel.hsl2rgb(t,\"b\"))}get r(){const t=this.data,e=t.r;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"r\")):e}get g(){const t=this.data,e=t.g;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"g\")):e}get b(){const t=this.data,e=t.b;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"b\")):e}get h(){const t=this.data,e=t.h;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"h\")):e}get s(){const t=this.data,e=t.s;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"s\")):e}get l(){const t=this.data,e=t.l;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"l\")):e}get a(){return this.data.a}set r(t){this.type.set(1),this.changed=!0,this.data.r=t}set g(t){this.type.set(1),this.changed=!0,this.data.g=t}set b(t){this.type.set(1),this.changed=!0,this.data.b=t}set h(t){this.type.set(2),this.changed=!0,this.data.h=t}set s(t){this.type.set(2),this.changed=!0,this.data.s=t}set l(t){this.type.set(2),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}({r:0,g:0,b:0,a:0},\"transparent\"),nt={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(35!==t.charCodeAt(0))return;const e=t.match(nt.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,a=i%4==0,o=i>4,s=o?1:17,c=o?8:4,l=a?0:-1,u=o?255:15;return et.set({r:(r>>c*(l+3)&u)*s,g:(r>>c*(l+2)&u)*s,b:(r>>c*(l+1)&u)*s,a:a?(r&u)*s/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}${tt[Math.round(255*i)]}`:`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}`}},rt=nt,it={re:/^hsla?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(?:deg|grad|rad|turn)?)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(%)?))?\\s*?\\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(it.hueRe);if(e){const[,t,n]=e;switch(n){case\"grad\":return J.channel.clamp.h(.9*parseFloat(t));case\"rad\":return J.channel.clamp.h(180*parseFloat(t)/Math.PI);case\"turn\":return J.channel.clamp.h(360*parseFloat(t))}}return J.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(104!==e&&72!==e)return;const n=t.match(it.re);if(!n)return;const[,r,i,a,o,s]=n;return et.set({h:it._hue2deg(r),s:J.channel.clamp.s(parseFloat(i)),l:J.channel.clamp.l(parseFloat(a)),a:o?J.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%, ${i})`:`hsl(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%)`}},at=it,ot={colors:{aliceblue:\"#f0f8ff\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",aquamarine:\"#7fffd4\",azure:\"#f0ffff\",beige:\"#f5f5dc\",bisque:\"#ffe4c4\",black:\"#000000\",blanchedalmond:\"#ffebcd\",blue:\"#0000ff\",blueviolet:\"#8a2be2\",brown:\"#a52a2a\",burlywood:\"#deb887\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",cornflowerblue:\"#6495ed\",cornsilk:\"#fff8dc\",crimson:\"#dc143c\",cyanaqua:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkgray:\"#a9a9a9\",darkgreen:\"#006400\",darkgrey:\"#a9a9a9\",darkkhaki:\"#bdb76b\",darkmagenta:\"#8b008b\",darkolivegreen:\"#556b2f\",darkorange:\"#ff8c00\",darkorchid:\"#9932cc\",darkred:\"#8b0000\",darksalmon:\"#e9967a\",darkseagreen:\"#8fbc8f\",darkslateblue:\"#483d8b\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",darkturquoise:\"#00ced1\",darkviolet:\"#9400d3\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",dimgray:\"#696969\",dimgrey:\"#696969\",dodgerblue:\"#1e90ff\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",forestgreen:\"#228b22\",fuchsia:\"#ff00ff\",gainsboro:\"#dcdcdc\",ghostwhite:\"#f8f8ff\",gold:\"#ffd700\",goldenrod:\"#daa520\",gray:\"#808080\",green:\"#008000\",greenyellow:\"#adff2f\",grey:\"#808080\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",ivory:\"#fffff0\",khaki:\"#f0e68c\",lavender:\"#e6e6fa\",lavenderblush:\"#fff0f5\",lawngreen:\"#7cfc00\",lemonchiffon:\"#fffacd\",lightblue:\"#add8e6\",lightcoral:\"#f08080\",lightcyan:\"#e0ffff\",lightgoldenrodyellow:\"#fafad2\",lightgray:\"#d3d3d3\",lightgreen:\"#90ee90\",lightgrey:\"#d3d3d3\",lightpink:\"#ffb6c1\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",lightskyblue:\"#87cefa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",lightsteelblue:\"#b0c4de\",lightyellow:\"#ffffe0\",lime:\"#00ff00\",limegreen:\"#32cd32\",linen:\"#faf0e6\",magenta:\"#ff00ff\",maroon:\"#800000\",mediumaquamarine:\"#66cdaa\",mediumblue:\"#0000cd\",mediumorchid:\"#ba55d3\",mediumpurple:\"#9370db\",mediumseagreen:\"#3cb371\",mediumslateblue:\"#7b68ee\",mediumspringgreen:\"#00fa9a\",mediumturquoise:\"#48d1cc\",mediumvioletred:\"#c71585\",midnightblue:\"#191970\",mintcream:\"#f5fffa\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",navajowhite:\"#ffdead\",navy:\"#000080\",oldlace:\"#fdf5e6\",olive:\"#808000\",olivedrab:\"#6b8e23\",orange:\"#ffa500\",orangered:\"#ff4500\",orchid:\"#da70d6\",palegoldenrod:\"#eee8aa\",palegreen:\"#98fb98\",paleturquoise:\"#afeeee\",palevioletred:\"#db7093\",papayawhip:\"#ffefd5\",peachpuff:\"#ffdab9\",peru:\"#cd853f\",pink:\"#ffc0cb\",plum:\"#dda0dd\",powderblue:\"#b0e0e6\",purple:\"#800080\",rebeccapurple:\"#663399\",red:\"#ff0000\",rosybrown:\"#bc8f8f\",royalblue:\"#4169e1\",saddlebrown:\"#8b4513\",salmon:\"#fa8072\",sandybrown:\"#f4a460\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",sienna:\"#a0522d\",silver:\"#c0c0c0\",skyblue:\"#87ceeb\",slateblue:\"#6a5acd\",slategray:\"#708090\",slategrey:\"#708090\",snow:\"#fffafa\",springgreen:\"#00ff7f\",tan:\"#d2b48c\",teal:\"#008080\",thistle:\"#d8bfd8\",transparent:\"#00000000\",turquoise:\"#40e0d0\",violet:\"#ee82ee\",wheat:\"#f5deb3\",white:\"#ffffff\",whitesmoke:\"#f5f5f5\",yellow:\"#ffff00\",yellowgreen:\"#9acd32\"},parse:t=>{t=t.toLowerCase();const e=ot.colors[t];if(e)return rt.parse(e)},stringify:t=>{const e=rt.stringify(t);for(const t in ot.colors)if(ot.colors[t]===e)return t}},st=ot,ct={re:/^rgba?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?)))?\\s*?\\)$/i,parse:t=>{const e=t.charCodeAt(0);if(114!==e&&82!==e)return;const n=t.match(ct.re);if(!n)return;const[,r,i,a,o,s,c,l,u]=n;return et.set({r:J.channel.clamp.r(i?2.55*parseFloat(r):parseFloat(r)),g:J.channel.clamp.g(o?2.55*parseFloat(a):parseFloat(a)),b:J.channel.clamp.b(c?2.55*parseFloat(s):parseFloat(s)),a:l?J.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)}, ${J.lang.round(i)})`:`rgb(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)})`}},lt=ct,ut={format:{keyword:st,hex:rt,rgb:lt,rgba:lt,hsl:at,hsla:at},parse:t=>{if(\"string\"!=typeof t)return t;const e=rt.parse(t)||lt.parse(t)||at.parse(t)||st.parse(t);if(e)return e;throw new Error(`Unsupported color format: \"${t}\"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(2)||void 0===t.data.r?at.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?lt.stringify(t):rt.stringify(t)},ht=(t,e)=>{const n=ut.parse(t);for(const t in e)n[t]=J.channel.clamp[t](e[t]);return ut.stringify(n)},ft=(t,e)=>{const n=ut.parse(t),r={};for(const t in e)e[t]&&(r[t]=n[t]+e[t]);return ht(t,r)},dt=(t,e,n=0,r=1)=>{if(\"number\"!=typeof t)return ht(t,{a:e});const i=et.set({r:J.channel.clamp.r(t),g:J.channel.clamp.g(e),b:J.channel.clamp.b(n),a:J.channel.clamp.a(r)});return ut.stringify(i)},pt=(t,e=100)=>{const n=ut.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,((t,e,n=50)=>{const{r,g:i,b:a,a:o}=ut.parse(t),{r:s,g:c,b:l,a:u}=ut.parse(e),h=n/100,f=2*h-1,d=o-u,p=((f*d==-1?f:(f+d)/(1+f*d))+1)/2,g=1-p;return dt(r*p+s*g,i*p+c*g,a*p+l*g,o*h+u*(1-h))})(n,t,e)},gt=(t,e,n)=>{const r=ut.parse(t),i=r[e],a=J.channel.clamp[e](i+n);return i!==a&&(r[e]=a),ut.stringify(r)},yt=(t,e)=>gt(t,\"l\",-e),mt=(t,e)=>gt(t,\"l\",e);var bt=function(t,e){return ft(t,e?{s:-40,l:10}:{s:-40,l:-10})};function vt(t){return vt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},vt(t)}function _t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:\"\";return Object.keys(e).reduce((function(r,i){return Array.isArray(e[i])?r:\"object\"===Rt(e[i])&&null!==e[i]?[].concat(It(r),[n+i],It(t(e[i],\"\"))):[].concat(It(r),[n+i])}),[])}(Pt,\"\");const zt=Pt;function Yt(t){return Yt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Yt(t)}var Ut,$t=Object.freeze(zt),Wt=Q({},$t),qt=[],Ht=Q({},$t),Vt=function(t,e){for(var n=Q({},t),r={},i=0;i-1||e[n].indexOf(\">\")>-1||e[n].indexOf(\"url(data:\")>-1)&&delete e[n],\"object\"===Yt(e[n])&&t(e[n])}))},Qt=function(t){t.fontFamily&&(t.themeVariables&&t.themeVariables.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),qt.push(t),Vt(Wt,qt)},Kt=function(){Vt(Wt,qt=[])},Jt=n(7856),te=n.n(Jt),ee=function(t){var e=t.replace(/\\\\u[\\dA-F]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\u/g,\"\"),16))}));return e=(e=(e=e.replace(/\\\\x([0-9a-f]{2})/gi,(function(t,e){return String.fromCharCode(parseInt(e,16))}))).replace(/\\\\[\\d\\d\\d]{3}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))).replace(/\\\\[\\d\\d\\d]{2}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))},ne=function(t){for(var e=\"\",n=0;n>=0;){if(!((n=t.indexOf(\"=0)){e+=t,n=-1;break}e+=t.substr(0,n),(n=(t=t.substr(n+1)).indexOf(\"<\\/script>\"))>=0&&(n+=9,t=t.substr(n))}var r=ee(e);return(r=(r=(r=(r=r.replace(/script>/gi,\"#\")).replace(/javascript:/gi,\"#\")).replace(/javascript&colon/gi,\"#\")).replace(/onerror=/gi,\"onerror:\")).replace(/')}else\"loose\"!==s.securityLevel&&(M=te().sanitize(M,{ADD_TAGS:[\"foreignobject\"],ADD_ATTR:[\"dominant-baseline\"]}));if(void 0!==n)switch(b){case\"flowchart\":case\"flowchart-v2\":n(M,la.bindFunctions);break;case\"gantt\":n(M,go.bindFunctions);break;case\"class\":case\"classDiagram\":n(M,fr.bindFunctions);break;default:n(M)}else o.debug(\"CB = undefined!\");vs.forEach((function(t){t()})),vs=[];var D=\"sandbox\"===s.securityLevel?\"#i\"+t:\"#d\"+t,B=(0,l.select)(D).node();if(null!==B&&\"function\"==typeof B.remove&&(0,l.select)(D).node().remove(),u)throw u;return M},parse:function(t,e){ru||(Vl(),ru=!0);var n=!1;try{var r=e||new Ql(t);return r.db.clear(),r.parse(t)}catch(t){if(n=!0,!fu.parseError)throw t;null!=t.str?fu.parseError(t.str,t.hash):fu.parseError(t)}return!n},parseDirective:function(t,e,n,r){try{if(void 0!==e)switch(e=e.trim(),n){case\"open_directive\":au={};break;case\"type_directive\":au.type=e.toLowerCase();break;case\"arg_directive\":au.args=JSON.parse(e);break;case\"close_directive\":(function(t,e,n){switch(o.debug(\"Directive type=\".concat(e.type,\" with args:\"),e.args),e.type){case\"init\":case\"initialize\":[\"config\"].forEach((function(t){void 0!==e.args[t]&&(\"flowchart-v2\"===n&&(n=\"flowchart\"),e.args[n]=e.args[t],delete e.args[t])})),o.debug(\"sanitize in handleDirective\",e.args),Cn(e.args),o.debug(\"sanitize in handleDirective (done)\",e.args),Qt(e.args);break;case\"wrap\":case\"nowrap\":t&&t.setWrap&&t.setWrap(\"wrap\"===e.type);break;case\"themeCss\":o.warn(\"themeCss encountered\");break;default:o.warn(\"Unhandled directive: source: '%%{\".concat(e.type,\": \").concat(JSON.stringify(e.args?e.args:{}),\"}%%\"),e)}})(t,au,r),au=null}}catch(t){o.error(\"Error while rendering sequenceDiagram directive: \".concat(e,\" jison context: \").concat(n)),o.error(t.message)}},initialize:function(t){var e;null!=t&&t.fontFamily&&(null!==(e=t.themeVariables)&&void 0!==e&&e.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),function(t){Ut=Q({},t)}(t),null!=t&&t.theme&&Lt[t.theme]?t.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Lt.default.getThemeVariables(t.themeVariables));var n=\"object\"===nu(t)?function(t){return Wt=Q({},$t),Wt=Q(Wt,t),t.theme&&Lt[t.theme]&&(Wt.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables)),Ht=Vt(Wt,qt),Wt}(t):Gt();ou(n),s(n.logLevel),ru||(Vl(),ru=!0)},getConfig:Xt,setConfig:function(t){return Q(Ht,t),Xt()},getSiteConfig:Gt,updateSiteConfig:function(t){return Wt=Q(Wt,t),Vt(Wt,qt),Wt},reset:function(){Kt()},globalReset:function(){Kt(),ou(Xt())},defaultConfig:$t});s(Xt().logLevel),Kt(Xt());const cu=su;var lu=function(){var t,e,n=cu.getConfig();arguments.length>=2?(void 0!==arguments[0]&&(hu.sequenceConfig=arguments[0]),t=arguments[1]):t=arguments[0],\"function\"==typeof arguments[arguments.length-1]?(e=arguments[arguments.length-1],o.debug(\"Callback function found\")):void 0!==n.mermaid&&(\"function\"==typeof n.mermaid.callback?(e=n.mermaid.callback,o.debug(\"Callback function found\")):o.debug(\"No Callback function found\")),t=void 0===t?document.querySelectorAll(\".mermaid\"):\"string\"==typeof t?document.querySelectorAll(t):t instanceof window.Node?[t]:t,o.debug(\"Start On Load before: \"+hu.startOnLoad),void 0!==hu.startOnLoad&&(o.debug(\"Start On Load inner: \"+hu.startOnLoad),cu.updateSiteConfig({startOnLoad:hu.startOnLoad})),void 0!==hu.ganttConfig&&cu.updateSiteConfig({gantt:hu.ganttConfig});for(var r,i=new An.initIdGenerator(n.deterministicIds,n.deterministicIDSeed),a=[],s=function(n){o.info(\"Rendering diagram: \"+t[n].id,n);var s=t[n];if(s.getAttribute(\"data-processed\"))return\"continue\";s.setAttribute(\"data-processed\",!0);var c=\"mermaid-\".concat(i.next());r=s.innerHTML,r=An.entityDecode(r).trim().replace(//gi,\"
\");var l=An.detectInit(r);l&&o.debug(\"Detected early reinit: \",l);try{cu.render(c,r,(function(t,n){s.innerHTML=t,void 0!==e&&e(c),n&&n(s)}),s)}catch(t){o.warn(\"Catching Error (bootstrap)\",t),\"function\"==typeof hu.parseError&&hu.parseError({error:t,str:t.str,hash:t.hash,message:t.str}),a.push({error:t,str:t.str,hash:t.hash,message:t.str})}},c=0;c0)throw a[0]},uu=function(){hu.startOnLoad?cu.getConfig().startOnLoad&&hu.init():void 0===hu.startOnLoad&&(o.debug(\"In start, no config\"),cu.getConfig().startOnLoad&&hu.init())};\"undefined\"!=typeof document&&window.addEventListener(\"load\",(function(){uu()}),!1);var hu={startOnLoad:!0,htmlLabels:!0,diagrams:{},mermaidAPI:cu,parse:null!=cu?cu.parse:null,render:null!=cu?cu.render:null,init:function(){try{lu.apply(void 0,arguments)}catch(t){o.warn(\"Syntax Error rendering\"),o.warn(t.str)}},initThrowsErrors:lu,initialize:function(t){void 0!==t.mermaid&&(void 0!==t.mermaid.startOnLoad&&(hu.startOnLoad=t.mermaid.startOnLoad),void 0!==t.mermaid.htmlLabels&&(hu.htmlLabels=\"false\"!==t.mermaid.htmlLabels&&!1!==t.mermaid.htmlLabels)),cu.initialize(t)},contentLoaded:uu,setParseErrorHandler:function(t){hu.parseError=t}};const fu=hu},4949:(t,e,n)=>{t.exports={graphlib:n(6614),dagre:n(6478),intersect:n(8114),render:n(5787),util:n(8355),version:n(5689)}},9144:(t,e,n)=>{var r=n(8355);function i(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 0 L 10 5 L 0 10 z\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])}t.exports={default:i,normal:i,vee:function(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 0 L 10 5 L 0 10 L 4 5 z\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])},undirected:function(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 5 L 10 5\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])}}},5632:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1322);t.exports=function(t,e){var n,o=e.nodes().filter((function(t){return r.isSubgraph(e,t)})),s=t.selectAll(\"g.cluster\").data(o,(function(t){return t}));return s.selectAll(\"*\").remove(),s.enter().append(\"g\").attr(\"class\",\"cluster\").attr(\"id\",(function(t){return e.node(t).id})).style(\"opacity\",0),s=t.selectAll(\"g.cluster\"),r.applyTransition(s,e).style(\"opacity\",1),s.each((function(t){var n=e.node(t),r=i.select(this);i.select(this).append(\"rect\");var o=r.append(\"g\").attr(\"class\",\"label\");a(o,n,n.clusterLabelPos)})),s.selectAll(\"rect\").each((function(t){var n=e.node(t),a=i.select(this);r.applyStyle(a,n.style)})),n=s.exit?s.exit():s.selectAll(null),r.applyTransition(n,e).style(\"opacity\",0).remove(),s}},6315:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e){var n,s=t.selectAll(\"g.edgeLabel\").data(e.edges(),(function(t){return a.edgeToId(t)})).classed(\"update\",!0);return s.exit().remove(),s.enter().append(\"g\").classed(\"edgeLabel\",!0).style(\"opacity\",0),(s=t.selectAll(\"g.edgeLabel\")).each((function(t){var n=o.select(this);n.select(\".label\").remove();var a=e.edge(t),s=i(n,e.edge(t),0,0).classed(\"label\",!0),c=s.node().getBBox();a.labelId&&s.attr(\"id\",a.labelId),r.has(a,\"width\")||(a.width=c.width),r.has(a,\"height\")||(a.height=c.height)})),n=s.exit?s.exit():s.selectAll(null),a.applyTransition(n,e).style(\"opacity\",0).remove(),s}},940:(t,e,n)=>{var r=n(1034),i=n(3042),a=n(8355),o=n(4322);function s(t,e){var n=(o.line||o.svg.line)().x((function(t){return t.x})).y((function(t){return t.y}));return(n.curve||n.interpolate)(t.curve),n(e)}t.exports=function(t,e,n){var c=t.selectAll(\"g.edgePath\").data(e.edges(),(function(t){return a.edgeToId(t)})).classed(\"update\",!0),l=function(t,e){var n=t.enter().append(\"g\").attr(\"class\",\"edgePath\").style(\"opacity\",0);return n.append(\"path\").attr(\"class\",\"path\").attr(\"d\",(function(t){var n=e.edge(t),i=e.node(t.v).elem;return s(n,r.range(n.points.length).map((function(){return e=(t=i).getBBox(),{x:(n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:n.f};var t,e,n})))})),n.append(\"defs\"),n}(c,e);!function(t,e){var n=t.exit();a.applyTransition(n,e).style(\"opacity\",0).remove()}(c,e);var u=void 0!==c.merge?c.merge(l):c;return a.applyTransition(u,e).style(\"opacity\",1),u.each((function(t){var n=o.select(this),r=e.edge(t);r.elem=this,r.id&&n.attr(\"id\",r.id),a.applyClass(n,r.class,(n.classed(\"update\")?\"update \":\"\")+\"edgePath\")})),u.selectAll(\"path.path\").each((function(t){var n=e.edge(t);n.arrowheadId=r.uniqueId(\"arrowhead\");var c=o.select(this).attr(\"marker-end\",(function(){return\"url(\"+(t=location.href,e=n.arrowheadId,t.split(\"#\")[0]+\"#\"+e+\")\");var t,e})).style(\"fill\",\"none\");a.applyTransition(c,e).attr(\"d\",(function(t){return function(t,e){var n=t.edge(e),r=t.node(e.v),a=t.node(e.w),o=n.points.slice(1,n.points.length-1);return o.unshift(i(r,o[0])),o.push(i(a,o[o.length-1])),s(n,o)}(e,t)})),a.applyStyle(c,n.style)})),u.selectAll(\"defs *\").remove(),u.selectAll(\"defs\").each((function(t){var r=e.edge(t);(0,n[r.arrowhead])(o.select(this),r.arrowheadId,r,\"arrowhead\")})),u}},607:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e,n){var s,c=e.nodes().filter((function(t){return!a.isSubgraph(e,t)})),l=t.selectAll(\"g.node\").data(c,(function(t){return t})).classed(\"update\",!0);return l.exit().remove(),l.enter().append(\"g\").attr(\"class\",\"node\").style(\"opacity\",0),(l=t.selectAll(\"g.node\")).each((function(t){var s=e.node(t),c=o.select(this);a.applyClass(c,s.class,(c.classed(\"update\")?\"update \":\"\")+\"node\"),c.select(\"g.label\").remove();var l=c.append(\"g\").attr(\"class\",\"label\"),u=i(l,s),h=n[s.shape],f=r.pick(u.node().getBBox(),\"width\",\"height\");s.elem=this,s.id&&c.attr(\"id\",s.id),s.labelId&&l.attr(\"id\",s.labelId),r.has(s,\"width\")&&(f.width=s.width),r.has(s,\"height\")&&(f.height=s.height),f.width+=s.paddingLeft+s.paddingRight,f.height+=s.paddingTop+s.paddingBottom,l.attr(\"transform\",\"translate(\"+(s.paddingLeft-s.paddingRight)/2+\",\"+(s.paddingTop-s.paddingBottom)/2+\")\");var d=o.select(this);d.select(\".label-container\").remove();var p=h(d,f,s).classed(\"label-container\",!0);a.applyStyle(p,s.style);var g=p.node().getBBox();s.width=g.width,s.height=g.height})),s=l.exit?l.exit():l.selectAll(null),a.applyTransition(s,e).style(\"opacity\",0).remove(),l}},4322:(t,e,n)=>{var r;if(!r)try{r=n(7543)}catch(t){}r||(r=window.d3),t.exports=r},6478:(t,e,n)=>{var r;try{r=n(681)}catch(t){}r||(r=window.dagre),t.exports=r},6614:(t,e,n)=>{var r;try{r=n(8282)}catch(t){}r||(r=window.graphlib),t.exports=r},8114:(t,e,n)=>{t.exports={node:n(3042),circle:n(6587),ellipse:n(3260),polygon:n(5337),rect:n(8049)}},6587:(t,e,n)=>{var r=n(3260);t.exports=function(t,e,n){return r(t,e,e,n)}},3260:t=>{t.exports=function(t,e,n,r){var i=t.x,a=t.y,o=i-r.x,s=a-r.y,c=Math.sqrt(e*e*s*s+n*n*o*o),l=Math.abs(e*n*o/c);r.x{function e(t,e){return t*e>0}t.exports=function(t,n,r,i){var a,o,s,c,l,u,h,f,d,p,g,y,m;if(!(a=n.y-t.y,s=t.x-n.x,l=n.x*t.y-t.x*n.y,d=a*r.x+s*r.y+l,p=a*i.x+s*i.y+l,0!==d&&0!==p&&e(d,p)||(o=i.y-r.y,c=r.x-i.x,u=i.x*r.y-r.x*i.y,h=o*t.x+c*t.y+u,f=o*n.x+c*n.y+u,0!==h&&0!==f&&e(h,f)||0==(g=a*c-o*s))))return y=Math.abs(g/2),{x:(m=s*u-c*l)<0?(m-y)/g:(m+y)/g,y:(m=o*l-a*u)<0?(m-y)/g:(m+y)/g}}},3042:t=>{t.exports=function(t,e){return t.intersect(e)}},5337:(t,e,n)=>{var r=n(6808);t.exports=function(t,e,n){var i=t.x,a=t.y,o=[],s=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;e.forEach((function(t){s=Math.min(s,t.x),c=Math.min(c,t.y)}));for(var l=i-t.width/2-s,u=a-t.height/2-c,h=0;h1&&o.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),o=e.x-n.x,s=e.y-n.y,c=Math.sqrt(o*o+s*s);return a{t.exports=function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=0===s?0:l*o/s,r=l):(o<0&&(c=-c),n=c,r=0===o?0:c*s/o),{x:i+n,y:a+r}}},8284:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t.append(\"foreignObject\").attr(\"width\",\"100000\"),i=n.append(\"xhtml:div\");i.attr(\"xmlns\",\"http://www.w3.org/1999/xhtml\");var a=e.label;switch(typeof a){case\"function\":i.insert(a);break;case\"object\":i.insert((function(){return a}));break;default:i.html(a)}r.applyStyle(i,e.labelStyle),i.style(\"display\",\"inline-block\"),i.style(\"white-space\",\"nowrap\");var o=i.node().getBoundingClientRect();return n.attr(\"width\",o.width).attr(\"height\",o.height),n}},1322:(t,e,n)=>{var r=n(7318),i=n(8284),a=n(8287);t.exports=function(t,e,n){var o=e.label,s=t.append(\"g\");\"svg\"===e.labelType?a(s,e):\"string\"!=typeof o||\"html\"===e.labelType?i(s,e):r(s,e);var c,l=s.node().getBBox();switch(n){case\"top\":c=-e.height/2;break;case\"bottom\":c=e.height/2-l.height;break;default:c=-l.height/2}return s.attr(\"transform\",\"translate(\"+-l.width/2+\",\"+c+\")\"),s}},8287:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t;return n.node().appendChild(e.label),r.applyStyle(n,e.labelStyle),n}},7318:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){for(var n=t.append(\"text\"),i=function(t){for(var e,n=\"\",r=!1,i=0;i{var r;try{r={defaults:n(1747),each:n(6073),isFunction:n(3560),isPlainObject:n(8630),pick:n(9722),has:n(8721),range:n(6026),uniqueId:n(3955)}}catch(t){}r||(r=window._),t.exports=r},6381:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){var n=t.filter((function(){return!i.select(this).classed(\"update\")}));function a(t){var n=e.node(t);return\"translate(\"+n.x+\",\"+n.y+\")\"}n.attr(\"transform\",a),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",a),r.applyTransition(n.selectAll(\"rect\"),e).attr(\"width\",(function(t){return e.node(t).width})).attr(\"height\",(function(t){return e.node(t).height})).attr(\"x\",(function(t){return-e.node(t).width/2})).attr(\"y\",(function(t){return-e.node(t).height/2}))}},4577:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1034);t.exports=function(t,e){function n(t){var n=e.edge(t);return a.has(n,\"x\")?\"translate(\"+n.x+\",\"+n.y+\")\":\"\"}t.filter((function(){return!i.select(this).classed(\"update\")})).attr(\"transform\",n),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",n)}},4849:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){function n(t){var n=e.node(t);return\"translate(\"+n.x+\",\"+n.y+\")\"}t.filter((function(){return!i.select(this).classed(\"update\")})).attr(\"transform\",n),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",n)}},5787:(t,e,n)=>{var r=n(1034),i=n(4322),a=n(6478).layout;t.exports=function(){var t=n(607),e=n(5632),i=n(6315),l=n(940),u=n(4849),h=n(4577),f=n(6381),d=n(4418),p=n(9144),g=function(n,g){!function(t){t.nodes().forEach((function(e){var n=t.node(e);r.has(n,\"label\")||t.children(e).length||(n.label=e),r.has(n,\"paddingX\")&&r.defaults(n,{paddingLeft:n.paddingX,paddingRight:n.paddingX}),r.has(n,\"paddingY\")&&r.defaults(n,{paddingTop:n.paddingY,paddingBottom:n.paddingY}),r.has(n,\"padding\")&&r.defaults(n,{paddingLeft:n.padding,paddingRight:n.padding,paddingTop:n.padding,paddingBottom:n.padding}),r.defaults(n,o),r.each([\"paddingLeft\",\"paddingRight\",\"paddingTop\",\"paddingBottom\"],(function(t){n[t]=Number(n[t])})),r.has(n,\"width\")&&(n._prevWidth=n.width),r.has(n,\"height\")&&(n._prevHeight=n.height)})),t.edges().forEach((function(e){var n=t.edge(e);r.has(n,\"label\")||(n.label=\"\"),r.defaults(n,s)}))}(g);var y=c(n,\"output\"),m=c(y,\"clusters\"),b=c(y,\"edgePaths\"),v=i(c(y,\"edgeLabels\"),g),_=t(c(y,\"nodes\"),g,d);a(g),u(_,g),h(v,g),l(b,g,p);var x=e(m,g);f(x,g),function(t){r.each(t.nodes(),(function(e){var n=t.node(e);r.has(n,\"_prevWidth\")?n.width=n._prevWidth:delete n.width,r.has(n,\"_prevHeight\")?n.height=n._prevHeight:delete n.height,delete n._prevWidth,delete n._prevHeight}))}(g)};return g.createNodes=function(e){return arguments.length?(t=e,g):t},g.createClusters=function(t){return arguments.length?(e=t,g):e},g.createEdgeLabels=function(t){return arguments.length?(i=t,g):i},g.createEdgePaths=function(t){return arguments.length?(l=t,g):l},g.shapes=function(t){return arguments.length?(d=t,g):d},g.arrows=function(t){return arguments.length?(p=t,g):p},g};var o={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:\"rect\"},s={arrowhead:\"normal\",curve:i.curveLinear};function c(t,e){var n=t.select(\"g.\"+e);return n.empty()&&(n=t.append(\"g\").attr(\"class\",e)),n}},4418:(t,e,n)=>{var r=n(8049),i=n(3260),a=n(6587),o=n(5337);t.exports={rect:function(t,e,n){var i=t.insert(\"rect\",\":first-child\").attr(\"rx\",n.rx).attr(\"ry\",n.ry).attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"width\",e.width).attr(\"height\",e.height);return n.intersect=function(t){return r(n,t)},i},ellipse:function(t,e,n){var r=e.width/2,a=e.height/2,o=t.insert(\"ellipse\",\":first-child\").attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"rx\",r).attr(\"ry\",a);return n.intersect=function(t){return i(n,r,a,t)},o},circle:function(t,e,n){var r=Math.max(e.width,e.height)/2,i=t.insert(\"circle\",\":first-child\").attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"r\",r);return n.intersect=function(t){return a(n,r,t)},i},diamond:function(t,e,n){var r=e.width*Math.SQRT2/2,i=e.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-r,y:0},{x:0,y:i},{x:r,y:0}],s=t.insert(\"polygon\",\":first-child\").attr(\"points\",a.map((function(t){return t.x+\",\"+t.y})).join(\" \"));return n.intersect=function(t){return o(n,a,t)},s}}},8355:(t,e,n)=>{var r=n(1034);t.exports={isSubgraph:function(t,e){return!!t.children(e).length},edgeToId:function(t){return a(t.v)+\":\"+a(t.w)+\":\"+a(t.name)},applyStyle:function(t,e){e&&t.attr(\"style\",e)},applyClass:function(t,e,n){e&&t.attr(\"class\",e).attr(\"class\",n+\" \"+t.attr(\"class\"))},applyTransition:function(t,e){var n=e.graph();if(r.isPlainObject(n)){var i=n.transition;if(r.isFunction(i))return i(t)}return t}};var i=/:/g;function a(t){return t?String(t).replace(i,\"\\\\:\"):\"\"}},5689:t=>{t.exports=\"0.6.4\"},681:(t,e,n)=>{t.exports={graphlib:n(574),layout:n(8123),debug:n(7570),util:{time:n(1138).time,notime:n(1138).notime},version:n(8177)}},2188:(t,e,n)=>{var r=n(8436),i=n(4079);t.exports={run:function(t){var e=\"greedy\"===t.graph().acyclicer?i(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},i={};return r.forEach(t.nodes(),(function a(o){r.has(i,o)||(i[o]=!0,n[o]=!0,r.forEach(t.outEdges(o),(function(t){r.has(n,t.w)?e.push(t):a(t.w)})),delete n[o])})),e}(t);r.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,r.uniqueId(\"rev\"))}))},undo:function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}}},1133:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,r,a,o){var s={width:0,height:0,rank:o,borderType:e},c=a[e][o-1],l=i.addDummyNode(t,\"border\",s,n);a[e][o]=l,t.setParent(l,r),c&&t.setEdge(c,l,{weight:1})}t.exports=function(t){r.forEach(t.children(),(function e(n){var i=t.children(n),o=t.node(n);if(i.length&&r.forEach(i,e),r.has(o,\"minRank\")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,c=o.maxRank+1;s{var r=n(8436);function i(t){r.forEach(t.nodes(),(function(e){a(t.node(e))})),r.forEach(t.edges(),(function(e){a(t.edge(e))}))}function a(t){var e=t.width;t.width=t.height,t.height=e}function o(t){t.y=-t.y}function s(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();\"lr\"!==e&&\"rl\"!==e||i(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();\"bt\"!==e&&\"rl\"!==e||function(t){r.forEach(t.nodes(),(function(e){o(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,o),r.has(n,\"y\")&&o(n)}))}(t),\"lr\"!==e&&\"rl\"!==e||(function(t){r.forEach(t.nodes(),(function(e){s(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,s),r.has(n,\"x\")&&s(n)}))}(t),i(t))}}},7822:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function n(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function r(t,e){if(\"_next\"!==t&&\"_prev\"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return n(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&n(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,r)),n=n._prev;return\"[\"+t.join(\", \")+\"]\"}},7570:(t,e,n)=>{var r=n(8436),i=n(1138),a=n(574).Graph;t.exports={debugOrdering:function(t){var e=i.buildLayerMatrix(t),n=new a({compound:!0,multigraph:!0}).setGraph({});return r.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,\"layer\"+t.node(e).rank)})),r.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),r.forEach(e,(function(t,e){var i=\"layer\"+e;n.setNode(i,{rank:\"same\"}),r.reduce(t,(function(t,e){return n.setEdge(t,e,{style:\"invis\"}),e}))})),n}}},574:(t,e,n)=>{var r;try{r=n(8282)}catch(t){}r||(r=window.graphlib),t.exports=r},4079:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(7822);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new i,o=0,s=0;r.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),r.forEach(t.edges(),(function(t){var r=n.edge(t.v,t.w)||0,i=e(t),a=r+i;n.setEdge(t.v,t.w,a),s=Math.max(s,n.node(t.v).out+=i),o=Math.max(o,n.node(t.w).in+=i)}));var l=r.range(s+o+3).map((function(){return new a})),u=o+1;return r.forEach(n.nodes(),(function(t){c(l,u,n.node(t))})),{graph:n,buckets:l,zeroIdx:u}}(t,e||o),l=function(t,e,n){for(var r,i=[],a=e[e.length-1],o=e[0];t.nodeCount();){for(;r=o.dequeue();)s(t,e,n,r);for(;r=a.dequeue();)s(t,e,n,r);if(t.nodeCount())for(var c=e.length-2;c>0;--c)if(r=e[c].dequeue()){i=i.concat(s(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(l,(function(e){return t.outEdges(e.v,e.w)})),!0)};var o=r.constant(1);function s(t,e,n,i,a){var o=a?[]:void 0;return r.forEach(t.inEdges(i.v),(function(r){var i=t.edge(r),s=t.node(r.v);a&&o.push({v:r.v,w:r.w}),s.out-=i,c(e,n,s)})),r.forEach(t.outEdges(i.v),(function(r){var i=t.edge(r),a=r.w,o=t.node(a);o.in-=i,c(e,n,o)})),t.removeNode(i.v),o}function c(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}},8123:(t,e,n)=>{var r=n(8436),i=n(2188),a=n(5995),o=n(8093),s=n(1138).normalizeRanks,c=n(4219),l=n(1138).removeEmptyRanks,u=n(2981),h=n(1133),f=n(3258),d=n(3408),p=n(7873),g=n(1138),y=n(574).Graph;t.exports=function(t,e){var n=e&&e.debugTiming?g.time:g.notime;n(\"layout\",(function(){var e=n(\" buildLayoutGraph\",(function(){return function(t){var e=new y({multigraph:!0,compound:!0}),n=C(t.graph());return e.setGraph(r.merge({},b,E(n,m),r.pick(n,v))),r.forEach(t.nodes(),(function(n){var i=C(t.node(n));e.setNode(n,r.defaults(E(i,_),x)),e.setParent(n,t.parent(n))})),r.forEach(t.edges(),(function(n){var i=C(t.edge(n));e.setEdge(n,r.merge({},w,E(i,k),r.pick(i,T)))})),e}(t)}));n(\" runLayout\",(function(){!function(t,e){e(\" makeSpaceForEdgeLabels\",(function(){!function(t){var e=t.graph();e.ranksep/=2,r.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,\"c\"!==r.labelpos.toLowerCase()&&(\"TB\"===e.rankdir||\"BT\"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(\" removeSelfEdges\",(function(){!function(t){r.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(\" acyclic\",(function(){i.run(t)})),e(\" nestingGraph.run\",(function(){u.run(t)})),e(\" rank\",(function(){o(g.asNonCompoundGraph(t))})),e(\" injectEdgeLabelProxies\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};g.addDummyNode(t,\"edge-proxy\",i,\"_ep\")}}))}(t)})),e(\" removeEmptyRanks\",(function(){l(t)})),e(\" nestingGraph.cleanup\",(function(){u.cleanup(t)})),e(\" normalizeRanks\",(function(){s(t)})),e(\" assignRankMinMax\",(function(){!function(t){var e=0;r.forEach(t.nodes(),(function(n){var i=t.node(n);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,e=r.max(e,i.maxRank))})),t.graph().maxRank=e}(t)})),e(\" removeEdgeLabelProxies\",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);\"edge-proxy\"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(\" normalize.run\",(function(){a.run(t)})),e(\" parentDummyChains\",(function(){c(t)})),e(\" addBorderSegments\",(function(){h(t)})),e(\" order\",(function(){d(t)})),e(\" insertSelfEdges\",(function(){!function(t){var e=g.buildLayerMatrix(t);r.forEach(e,(function(e){var n=0;r.forEach(e,(function(e,i){var a=t.node(e);a.order=i+n,r.forEach(a.selfEdges,(function(e){g.addDummyNode(t,\"selfedge\",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++n,e:e.e,label:e.label},\"_se\")})),delete a.selfEdges}))}))}(t)})),e(\" adjustCoordinateSystem\",(function(){f.adjust(t)})),e(\" position\",(function(){p(t)})),e(\" positionSelfEdges\",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);if(\"selfedge\"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(\" removeBorderNodes\",(function(){!function(t){r.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),i=t.node(n.borderTop),a=t.node(n.borderBottom),o=t.node(r.last(n.borderLeft)),s=t.node(r.last(n.borderRight));n.width=Math.abs(s.x-o.x),n.height=Math.abs(a.y-i.y),n.x=o.x+n.width/2,n.y=i.y+n.height/2}})),r.forEach(t.nodes(),(function(e){\"border\"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(\" normalize.undo\",(function(){a.undo(t)})),e(\" fixupEdgeLabelCoords\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(r.has(n,\"x\"))switch(\"l\"!==n.labelpos&&\"r\"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case\"l\":n.x-=n.width/2+n.labeloffset;break;case\"r\":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(\" undoCoordinateSystem\",(function(){f.undo(t)})),e(\" translateGraph\",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,a=0,o=t.graph(),s=o.marginx||0,c=o.marginy||0;function l(t){var r=t.x,o=t.y,s=t.width,c=t.height;e=Math.min(e,r-s/2),n=Math.max(n,r+s/2),i=Math.min(i,o-c/2),a=Math.max(a,o+c/2)}r.forEach(t.nodes(),(function(e){l(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.has(n,\"x\")&&l(n)})),e-=s,i-=c,r.forEach(t.nodes(),(function(n){var r=t.node(n);r.x-=e,r.y-=i})),r.forEach(t.edges(),(function(n){var a=t.edge(n);r.forEach(a.points,(function(t){t.x-=e,t.y-=i})),r.has(a,\"x\")&&(a.x-=e),r.has(a,\"y\")&&(a.y-=i)})),o.width=n-e+s,o.height=a-i+c}(t)})),e(\" assignNodeIntersects\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),a=t.node(e.v),o=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=o,r=a),i.points.unshift(g.intersectRect(a,n)),i.points.push(g.intersectRect(o,r))}))}(t)})),e(\" reversePoints\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(\" acyclic.undo\",(function(){i.undo(t)}))}(e,n)})),n(\" updateInputGraph\",(function(){!function(t,e){r.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),r.forEach(t.edges(),(function(n){var i=t.edge(n),a=e.edge(n);i.points=a.points,r.has(a,\"x\")&&(i.x=a.x,i.y=a.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=[\"nodesep\",\"edgesep\",\"ranksep\",\"marginx\",\"marginy\"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:\"tb\"},v=[\"acyclicer\",\"ranker\",\"rankdir\",\"align\"],_=[\"width\",\"height\"],x={width:0,height:0},k=[\"minlen\",\"weight\",\"width\",\"height\",\"labeloffset\"],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:\"r\"},T=[\"labelpos\"];function E(t,e){return r.mapValues(r.pick(t,e),Number)}function C(t){var e={};return r.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}},8436:(t,e,n)=>{var r;try{r={cloneDeep:n(361),constant:n(5703),defaults:n(1747),each:n(6073),filter:n(3105),find:n(3311),flatten:n(5564),forEach:n(4486),forIn:n(2620),has:n(8721),isUndefined:n(2353),last:n(928),map:n(5161),mapValues:n(6604),max:n(6162),merge:n(3857),min:n(3632),minBy:n(2762),now:n(7771),pick:n(9722),range:n(6026),reduce:n(4061),sortBy:n(9734),uniqueId:n(3955),values:n(2628),zipObject:n(7287)}}catch(t){}r||(r=window._),t.exports=r},2981:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,o,s,c,l){var u=t.children(l);if(u.length){var h=i.addBorderNode(t,\"_bt\"),f=i.addBorderNode(t,\"_bb\"),d=t.node(l);t.setParent(h,l),d.borderTop=h,t.setParent(f,l),d.borderBottom=f,r.forEach(u,(function(r){a(t,e,n,o,s,c,r);var i=t.node(r),u=i.borderTop?i.borderTop:r,d=i.borderBottom?i.borderBottom:r,p=i.borderTop?o:2*o,g=u!==d?1:s-c[l]+1;t.setEdge(h,u,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(d,f,{weight:p,minlen:g,nestingEdge:!0})})),t.parent(l)||t.setEdge(e,h,{weight:0,minlen:s+c[l]})}else l!==e&&t.setEdge(e,l,{weight:0,minlen:n})}t.exports={run:function(t){var e=i.addDummyNode(t,\"root\",{},\"_root\"),n=function(t){var e={};function n(i,a){var o=t.children(i);o&&o.length&&r.forEach(o,(function(t){n(t,a+1)})),e[i]=a}return r.forEach(t.children(),(function(t){n(t,1)})),e}(t),o=r.max(r.values(n))-1,s=2*o+1;t.graph().nestingRoot=e,r.forEach(t.edges(),(function(e){t.edge(e).minlen*=s}));var c=function(t){return r.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;r.forEach(t.children(),(function(r){a(t,e,s,c,o,n,r)})),t.graph().nodeRankFactor=s},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,r.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},5995:(t,e,n)=>{var r=n(8436),i=n(1138);t.exports={run:function(t){t.graph().dummyChains=[],r.forEach(t.edges(),(function(e){!function(t,e){var n,r,a,o=e.v,s=t.node(o).rank,c=e.w,l=t.node(c).rank,u=e.name,h=t.edge(e),f=h.labelRank;if(l!==s+1){for(t.removeEdge(e),a=0,++s;s{var r=n(8436);t.exports=function(t,e,n){var i,a={};r.forEach(n,(function(n){for(var r,o,s=t.parent(n);s;){if((r=t.parent(s))?(o=a[r],a[r]=s):(o=i,i=s),o&&o!==s)return void e.setEdge(o,s);s=r}}))}},5439:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){return r.map(e,(function(e){var n=t.inEdges(e);if(n.length){var i=r.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}return{v:e}}))}},3128:(t,e,n)=>{var r=n(8436),i=n(574).Graph;t.exports=function(t,e,n){var a=function(t){for(var e;t.hasNode(e=r.uniqueId(\"_root\")););return e}(t),o=new i({compound:!0}).setGraph({root:a}).setDefaultNodeLabel((function(e){return t.node(e)}));return r.forEach(t.nodes(),(function(i){var s=t.node(i),c=t.parent(i);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(o.setNode(i),o.setParent(i,c||a),r.forEach(t[n](i),(function(e){var n=e.v===i?e.w:e.v,a=o.edge(n,i),s=r.isUndefined(a)?0:a.weight;o.setEdge(n,i,{weight:t.edge(e).weight+s})})),r.has(s,\"minRank\")&&o.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))})),o}},6630:(t,e,n)=>{var r=n(8436);function i(t,e,n){for(var i=r.zipObject(n,r.map(n,(function(t,e){return e}))),a=r.flatten(r.map(e,(function(e){return r.sortBy(r.map(t.outEdges(e),(function(e){return{pos:i[e.w],weight:t.edge(e).weight}})),\"pos\")})),!0),o=1;o0;)e%2&&(n+=c[e+1]),c[e=e-1>>1]+=t.weight;l+=t.weight*n}))),l}t.exports=function(t,e){for(var n=0,r=1;r{var r=n(8436),i=n(2588),a=n(6630),o=n(1026),s=n(3128),c=n(5093),l=n(574).Graph,u=n(1138);function h(t,e,n){return r.map(e,(function(e){return s(t,e,n)}))}function f(t,e){var n=new l;r.forEach(t,(function(t){var i=t.graph().root,a=o(t,i,n,e);r.forEach(a.vs,(function(e,n){t.node(e).order=n})),c(t,n,a.vs)}))}function d(t,e){r.forEach(e,(function(e){r.forEach(e,(function(e,n){t.node(e).order=n}))}))}t.exports=function(t){var e=u.maxRank(t),n=h(t,r.range(1,e+1),\"inEdges\"),o=h(t,r.range(e-1,-1,-1),\"outEdges\"),s=i(t);d(t,s);for(var c,l=Number.POSITIVE_INFINITY,p=0,g=0;g<4;++p,++g){f(p%2?n:o,p%4>=2),s=u.buildLayerMatrix(t);var y=a(t,s);y{var r=n(8436);t.exports=function(t){var e={},n=r.filter(t.nodes(),(function(e){return!t.children(e).length})),i=r.max(r.map(n,(function(e){return t.node(e).rank}))),a=r.map(r.range(i+1),(function(){return[]})),o=r.sortBy(n,(function(e){return t.node(e).rank}));return r.forEach(o,(function n(i){if(!r.has(e,i)){e[i]=!0;var o=t.node(i);a[o.rank].push(i),r.forEach(t.successors(i),n)}})),a}},9567:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){var n={};return r.forEach(t,(function(t,e){var i=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};r.isUndefined(t.barycenter)||(i.barycenter=t.barycenter,i.weight=t.weight)})),r.forEach(e.edges(),(function(t){var e=n[t.v],i=n[t.w];r.isUndefined(e)||r.isUndefined(i)||(i.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){var n,i,a,o;e.merged||(r.isUndefined(e.barycenter)||r.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(i=e,a=0,o=0,(n=t).weight&&(a+=n.barycenter*n.weight,o+=n.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),n.vs=i.vs.concat(n.vs),n.barycenter=a/o,n.weight=o,n.i=Math.min(i.i,n.i),i.merged=!0)}}function i(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var a=t.pop();e.push(a),r.forEach(a.in.reverse(),n(a)),r.forEach(a.out,i(a))}return r.map(r.filter(e,(function(t){return!t.merged})),(function(t){return r.pick(t,[\"vs\",\"i\",\"barycenter\",\"weight\"])}))}(r.filter(n,(function(t){return!t.indegree})))}},1026:(t,e,n)=>{var r=n(8436),i=n(5439),a=n(9567),o=n(7304);t.exports=function t(e,n,s,c){var l=e.children(n),u=e.node(n),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,d={};h&&(l=r.filter(l,(function(t){return t!==h&&t!==f})));var p=i(e,l);r.forEach(p,(function(n){if(e.children(n.v).length){var i=t(e,n.v,s,c);d[n.v]=i,r.has(i,\"barycenter\")&&(a=n,o=i,r.isUndefined(a.barycenter)?(a.barycenter=o.barycenter,a.weight=o.weight):(a.barycenter=(a.barycenter*a.weight+o.barycenter*o.weight)/(a.weight+o.weight),a.weight+=o.weight))}var a,o}));var g=a(p,s);!function(t,e){r.forEach(t,(function(t){t.vs=r.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(g,d);var y=o(g,c);if(h&&(y.vs=r.flatten([h,y.vs,f],!0),e.predecessors(h).length)){var m=e.node(e.predecessors(h)[0]),b=e.node(e.predecessors(f)[0]);r.has(y,\"barycenter\")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y}},7304:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n){for(var i;e.length&&(i=r.last(e)).i<=n;)e.pop(),t.push(i.vs),n++;return n}t.exports=function(t,e){var n,o=i.partition(t,(function(t){return r.has(t,\"barycenter\")})),s=o.lhs,c=r.sortBy(o.rhs,(function(t){return-t.i})),l=[],u=0,h=0,f=0;s.sort((n=!!e,function(t,e){return t.barycentere.barycenter?1:n?e.i-t.i:t.i-e.i})),f=a(l,c,f),r.forEach(s,(function(t){f+=t.vs.length,l.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,f=a(l,c,f)}));var d={vs:r.flatten(l,!0)};return h&&(d.barycenter=u/h,d.weight=h),d}},4219:(t,e,n)=>{var r=n(8436);t.exports=function(t){var e=function(t){var e={},n=0;return r.forEach(t.children(),(function i(a){var o=n;r.forEach(t.children(a),i),e[a]={low:o,lim:n++}})),e}(t);r.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,a=function(t,e,n,r){var i,a,o=[],s=[],c=Math.min(e[n].low,e[r].low),l=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),o.push(i)}while(i&&(e[i].low>c||l>e[i].lim));for(a=i,i=r;(i=t.parent(i))!==a;)s.push(i);return{path:o.concat(s.reverse()),lca:a}}(t,e,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=t.node(n),u){for(;(l=o[c])!==s&&t.node(l).maxRank{var r=n(8436),i=n(574).Graph,a=n(1138);function o(t,e){var n={};return r.reduce(e,(function(e,i){var a=0,o=0,s=e.length,l=r.last(i);return r.forEach(i,(function(e,u){var h=function(t,e){if(t.node(e).dummy)return r.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=h?t.node(h).order:s;(h||e===l)&&(r.forEach(i.slice(o,u+1),(function(e){r.forEach(t.predecessors(e),(function(r){var i=t.node(r),o=i.order;!(os)&&c(n,e,l)}))}))}return r.reduce(e,(function(e,n){var a,o=-1,s=0;return r.forEach(n,(function(r,c){if(\"border\"===t.node(r).dummy){var l=t.predecessors(r);l.length&&(a=t.node(l[0]).order,i(n,s,c,o,a),s=c,o=a)}i(n,s,n.length,a,e.length)})),n})),n}function c(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function l(t,e,n){if(e>n){var i=e;e=n,n=i}return r.has(t[e],n)}function u(t,e,n,i){var a={},o={},s={};return r.forEach(e,(function(t){r.forEach(t,(function(t,e){a[t]=t,o[t]=t,s[t]=e}))})),r.forEach(e,(function(t){var e=-1;r.forEach(t,(function(t){var c=i(t);if(c.length){c=r.sortBy(c,(function(t){return s[t]}));for(var u=(c.length-1)/2,h=Math.floor(u),f=Math.ceil(u);h<=f;++h){var d=c[h];o[t]===t&&e{var r=n(8436),i=n(1138),a=n(3573).positionX;t.exports=function(t){(function(t){var e=i.buildLayerMatrix(t),n=t.graph().ranksep,a=0;r.forEach(e,(function(e){var i=r.max(r.map(e,(function(e){return t.node(e).height})));r.forEach(e,(function(e){t.node(e).y=a+i/2})),a+=i+n}))})(t=i.asNonCompoundGraph(t)),r.forEach(a(t),(function(e,n){t.node(n).x=e}))}},300:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(6681).slack;function o(t,e){return r.forEach(t.nodes(),(function n(i){r.forEach(e.nodeEdges(i),(function(r){var o=r.v,s=i===o?r.w:o;t.hasNode(s)||a(e,r)||(t.setNode(s,{}),t.setEdge(i,s,{}),n(s))}))})),t.nodeCount()}function s(t,e){return r.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return a(e,n)}))}function c(t,e,n){r.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}t.exports=function(t){var e,n,r=new i({directed:!1}),l=t.nodes()[0],u=t.nodeCount();for(r.setNode(l,{});o(r,t){var r=n(6681).longestPath,i=n(300),a=n(2472);t.exports=function(t){switch(t.graph().ranker){case\"network-simplex\":default:!function(t){a(t)}(t);break;case\"tight-tree\":!function(t){r(t),i(t)}(t);break;case\"longest-path\":o(t)}};var o=r},2472:(t,e,n)=>{var r=n(8436),i=n(300),a=n(6681).slack,o=n(6681).longestPath,s=n(574).alg.preorder,c=n(574).alg.postorder,l=n(1138).simplify;function u(t){t=l(t),o(t);var e,n=i(t);for(d(n),h(n,t);e=g(n);)m(n,t,e,y(n,t,e))}function h(t,e){var n=c(t,t.nodes());n=n.slice(0,n.length-1),r.forEach(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=f(t,e,n)}(t,e,n)}))}function f(t,e,n){var i=t.node(n).parent,a=!0,o=e.edge(n,i),s=0;return o||(a=!1,o=e.edge(i,n)),s=o.weight,r.forEach(e.nodeEdges(n),(function(r){var o,c,l=r.v===n,u=l?r.w:r.v;if(u!==i){var h=l===a,f=e.edge(r).weight;if(s+=h?f:-f,o=n,c=u,t.hasEdge(o,c)){var d=t.edge(n,u).cutvalue;s+=h?-d:d}}})),s}function d(t,e){arguments.length<2&&(e=t.nodes()[0]),p(t,{},1,e)}function p(t,e,n,i,a){var o=n,s=t.node(i);return e[i]=!0,r.forEach(t.neighbors(i),(function(a){r.has(e,a)||(n=p(t,e,n,a,i))})),s.low=o,s.lim=n++,a?s.parent=a:delete s.parent,n}function g(t){return r.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function y(t,e,n){var i=n.v,o=n.w;e.hasEdge(i,o)||(i=n.w,o=n.v);var s=t.node(i),c=t.node(o),l=s,u=!1;s.lim>c.lim&&(l=c,u=!0);var h=r.filter(e.edges(),(function(e){return u===b(0,t.node(e.v),l)&&u!==b(0,t.node(e.w),l)}));return r.minBy(h,(function(t){return a(e,t)}))}function m(t,e,n,i){var a=n.v,o=n.w;t.removeEdge(a,o),t.setEdge(i.v,i.w,{}),d(t),h(t,e),function(t,e){var n=r.find(t.nodes(),(function(t){return!e.node(t).parent})),i=s(t,n);i=i.slice(1),r.forEach(i,(function(n){var r=t.node(n).parent,i=e.edge(n,r),a=!1;i||(i=e.edge(r,n),a=!0),e.node(n).rank=e.node(r).rank+(a?i.minlen:-i.minlen)}))}(t,e)}function b(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}t.exports=u,u.initLowLimValues=d,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=g,u.enterEdge=y,u.exchangeEdges=m},6681:(t,e,n)=>{var r=n(8436);t.exports={longestPath:function(t){var e={};r.forEach(t.sources(),(function n(i){var a=t.node(i);if(r.has(e,i))return a.rank;e[i]=!0;var o=r.min(r.map(t.outEdges(i),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),a.rank=o}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},1138:(t,e,n)=>{var r=n(8436),i=n(574).Graph;function a(t,e,n,i){var a;do{a=r.uniqueId(i)}while(t.hasNode(a));return n.dummy=e,t.setNode(a,n),a}function o(t){return r.max(r.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!r.isUndefined(n))return n})))}t.exports={addDummyNode:a,simplify:function(t){var e=(new i).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),r.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new i({multigraph:t.isMultigraph()}).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),r.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return r.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return r.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;if(!o&&!s)throw new Error(\"Not possible to find intersection inside of the rectangle\");return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=l*o/s,r=l):(o<0&&(c=-c),n=c,r=c*s/o),{x:i+n,y:a+r}},buildLayerMatrix:function(t){var e=r.map(r.range(o(t)+1),(function(){return[]}));return r.forEach(t.nodes(),(function(n){var i=t.node(n),a=i.rank;r.isUndefined(a)||(e[a][i.order]=n)})),e},normalizeRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank})));r.forEach(t.nodes(),(function(n){var i=t.node(n);r.has(i,\"rank\")&&(i.rank-=e)}))},removeEmptyRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];r.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var i=0,a=t.graph().nodeRankFactor;r.forEach(n,(function(e,n){r.isUndefined(e)&&n%a!=0?--i:i&&r.forEach(e,(function(e){t.node(e).rank+=i}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),a(t,\"border\",i,e)},maxRank:o,partition:function(t,e){var n={lhs:[],rhs:[]};return r.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=r.now();try{return e()}finally{console.log(t+\" time: \"+(r.now()-n)+\"ms\")}},notime:function(t,e){return e()}}},8177:t=>{t.exports=\"0.8.5\"},7856:function(t){t.exports=function(){function t(e){return t=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,i,a){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var a=new(Function.bind.apply(t,i));return r&&e(a,r.prototype),a},r.apply(null,arguments)}function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if(\"undefined\"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t[\"@@iterator\"])return Array.from(t)}(t)||function(t,e){if(t){if(\"string\"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return\"Object\"===n&&t.constructor&&(n=t.constructor.name),\"Map\"===n||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?n-1:0),i=1;i/gm),q=f(/^data-[\\-\\w.\\u00B7-\\uFFFF]/),H=f(/^aria-[\\-\\w]+$/),V=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),G=f(/^(?:\\w+script|data):/i),X=f(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),Z=f(/^html$/i),Q=function(){return\"undefined\"==typeof window?null:window},K=function(e,n){if(\"object\"!==t(e)||\"function\"!=typeof e.createPolicy)return null;var r=null,i=\"data-tt-policy-suffix\";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var a=\"dompurify\"+(r?\"#\"+r:\"\");try{return e.createPolicy(a,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(t){return console.warn(\"TrustedTypes policy \"+a+\" could not be created.\"),null}};return function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q(),r=function(t){return e(t)};if(r.version=\"2.4.0\",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var a=n.document,o=n.document,s=n.DocumentFragment,c=n.HTMLTemplateElement,l=n.Node,u=n.Element,f=n.NodeFilter,d=n.NamedNodeMap,p=void 0===d?n.NamedNodeMap||n.MozNamedAttrMap:d,g=n.HTMLFormElement,y=n.DOMParser,m=n.trustedTypes,A=u.prototype,J=O(A,\"cloneNode\"),tt=O(A,\"nextSibling\"),et=O(A,\"childNodes\"),nt=O(A,\"parentNode\");if(\"function\"==typeof c){var rt=o.createElement(\"template\");rt.content&&rt.content.ownerDocument&&(o=rt.content.ownerDocument)}var it=K(m,a),at=it?it.createHTML(\"\"):\"\",ot=o,st=ot.implementation,ct=ot.createNodeIterator,lt=ot.createDocumentFragment,ut=ot.getElementsByTagName,ht=a.importNode,ft={};try{ft=N(o).documentMode?o.documentMode:{}}catch(t){}var dt={};r.isSupported=\"function\"==typeof nt&&st&&void 0!==st.createHTMLDocument&&9!==ft;var pt,gt,yt=$,mt=W,bt=q,vt=H,_t=G,xt=X,kt=V,wt=null,Tt=M({},[].concat(i(D),i(B),i(L),i(F),i(P))),Et=null,Ct=M({},[].concat(i(j),i(z),i(Y),i(U))),St=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),At=null,Mt=null,Nt=!0,Ot=!0,Dt=!1,Bt=!1,Lt=!1,It=!1,Ft=!1,Rt=!1,Pt=!1,jt=!1,zt=!0,Yt=!1,Ut=\"user-content-\",$t=!0,Wt=!1,qt={},Ht=null,Vt=M({},[\"annotation-xml\",\"audio\",\"colgroup\",\"desc\",\"foreignobject\",\"head\",\"iframe\",\"math\",\"mi\",\"mn\",\"mo\",\"ms\",\"mtext\",\"noembed\",\"noframes\",\"noscript\",\"plaintext\",\"script\",\"style\",\"svg\",\"template\",\"thead\",\"title\",\"video\",\"xmp\"]),Gt=null,Xt=M({},[\"audio\",\"video\",\"img\",\"source\",\"image\",\"track\"]),Zt=null,Qt=M({},[\"alt\",\"class\",\"for\",\"id\",\"label\",\"name\",\"pattern\",\"placeholder\",\"role\",\"summary\",\"title\",\"value\",\"style\",\"xmlns\"]),Kt=\"http://www.w3.org/1998/Math/MathML\",Jt=\"http://www.w3.org/2000/svg\",te=\"http://www.w3.org/1999/xhtml\",ee=te,ne=!1,re=[\"application/xhtml+xml\",\"text/html\"],ie=\"text/html\",ae=null,oe=o.createElement(\"form\"),se=function(t){return t instanceof RegExp||t instanceof Function},ce=function(e){ae&&ae===e||(e&&\"object\"===t(e)||(e={}),e=N(e),pt=pt=-1===re.indexOf(e.PARSER_MEDIA_TYPE)?ie:e.PARSER_MEDIA_TYPE,gt=\"application/xhtml+xml\"===pt?function(t){return t}:x,wt=\"ALLOWED_TAGS\"in e?M({},e.ALLOWED_TAGS,gt):Tt,Et=\"ALLOWED_ATTR\"in e?M({},e.ALLOWED_ATTR,gt):Ct,Zt=\"ADD_URI_SAFE_ATTR\"in e?M(N(Qt),e.ADD_URI_SAFE_ATTR,gt):Qt,Gt=\"ADD_DATA_URI_TAGS\"in e?M(N(Xt),e.ADD_DATA_URI_TAGS,gt):Xt,Ht=\"FORBID_CONTENTS\"in e?M({},e.FORBID_CONTENTS,gt):Vt,At=\"FORBID_TAGS\"in e?M({},e.FORBID_TAGS,gt):{},Mt=\"FORBID_ATTR\"in e?M({},e.FORBID_ATTR,gt):{},qt=\"USE_PROFILES\"in e&&e.USE_PROFILES,Nt=!1!==e.ALLOW_ARIA_ATTR,Ot=!1!==e.ALLOW_DATA_ATTR,Dt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Bt=e.SAFE_FOR_TEMPLATES||!1,Lt=e.WHOLE_DOCUMENT||!1,Rt=e.RETURN_DOM||!1,Pt=e.RETURN_DOM_FRAGMENT||!1,jt=e.RETURN_TRUSTED_TYPE||!1,Ft=e.FORCE_BODY||!1,zt=!1!==e.SANITIZE_DOM,Yt=e.SANITIZE_NAMED_PROPS||!1,$t=!1!==e.KEEP_CONTENT,Wt=e.IN_PLACE||!1,kt=e.ALLOWED_URI_REGEXP||kt,ee=e.NAMESPACE||te,e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(St.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(St.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&\"boolean\"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(St.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Bt&&(Ot=!1),Pt&&(Rt=!0),qt&&(wt=M({},i(P)),Et=[],!0===qt.html&&(M(wt,D),M(Et,j)),!0===qt.svg&&(M(wt,B),M(Et,z),M(Et,U)),!0===qt.svgFilters&&(M(wt,L),M(Et,z),M(Et,U)),!0===qt.mathMl&&(M(wt,F),M(Et,Y),M(Et,U))),e.ADD_TAGS&&(wt===Tt&&(wt=N(wt)),M(wt,e.ADD_TAGS,gt)),e.ADD_ATTR&&(Et===Ct&&(Et=N(Et)),M(Et,e.ADD_ATTR,gt)),e.ADD_URI_SAFE_ATTR&&M(Zt,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ht===Vt&&(Ht=N(Ht)),M(Ht,e.FORBID_CONTENTS,gt)),$t&&(wt[\"#text\"]=!0),Lt&&M(wt,[\"html\",\"head\",\"body\"]),wt.table&&(M(wt,[\"tbody\"]),delete At.tbody),h&&h(e),ae=e)},le=M({},[\"mi\",\"mo\",\"mn\",\"ms\",\"mtext\"]),ue=M({},[\"foreignobject\",\"desc\",\"title\",\"annotation-xml\"]),he=M({},[\"title\",\"style\",\"font\",\"a\",\"script\"]),fe=M({},B);M(fe,L),M(fe,I);var de=M({},F);M(de,R);var pe=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:te,tagName:\"template\"});var n=x(t.tagName),r=x(e.tagName);return t.namespaceURI===Jt?e.namespaceURI===te?\"svg\"===n:e.namespaceURI===Kt?\"svg\"===n&&(\"annotation-xml\"===r||le[r]):Boolean(fe[n]):t.namespaceURI===Kt?e.namespaceURI===te?\"math\"===n:e.namespaceURI===Jt?\"math\"===n&&ue[r]:Boolean(de[n]):t.namespaceURI===te&&!(e.namespaceURI===Jt&&!ue[r])&&!(e.namespaceURI===Kt&&!le[r])&&!de[n]&&(he[n]||!fe[n])},ge=function(t){_(r.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=at}catch(e){t.remove()}}},ye=function(t,e){try{_(r.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){_(r.removed,{attribute:null,from:e})}if(e.removeAttribute(t),\"is\"===t&&!Et[t])if(Rt||Pt)try{ge(e)}catch(t){}else try{e.setAttribute(t,\"\")}catch(t){}},me=function(t){var e,n;if(Ft)t=\"\"+t;else{var r=k(t,/^[\\r\\n\\t ]+/);n=r&&r[0]}\"application/xhtml+xml\"===pt&&(t=''+t+\"\");var i=it?it.createHTML(t):t;if(ee===te)try{e=(new y).parseFromString(i,pt)}catch(t){}if(!e||!e.documentElement){e=st.createDocument(ee,\"template\",null);try{e.documentElement.innerHTML=ne?\"\":i}catch(t){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),ee===te?ut.call(e,Lt?\"html\":\"body\")[0]:Lt?e.documentElement:a},be=function(t){return ct.call(t.ownerDocument||t,t,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,null,!1)},ve=function(t){return t instanceof g&&(\"string\"!=typeof t.nodeName||\"string\"!=typeof t.textContent||\"function\"!=typeof t.removeChild||!(t.attributes instanceof p)||\"function\"!=typeof t.removeAttribute||\"function\"!=typeof t.setAttribute||\"string\"!=typeof t.namespaceURI||\"function\"!=typeof t.insertBefore)},_e=function(e){return\"object\"===t(l)?e instanceof l:e&&\"object\"===t(e)&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName},xe=function(t,e,n){dt[t]&&b(dt[t],(function(t){t.call(r,e,n,ae)}))},ke=function(t){var e;if(xe(\"beforeSanitizeElements\",t,null),ve(t))return ge(t),!0;if(C(/[\\u0080-\\uFFFF]/,t.nodeName))return ge(t),!0;var n=gt(t.nodeName);if(xe(\"uponSanitizeElement\",t,{tagName:n,allowedTags:wt}),t.hasChildNodes()&&!_e(t.firstElementChild)&&(!_e(t.content)||!_e(t.content.firstElementChild))&&C(/<[/\\w]/g,t.innerHTML)&&C(/<[/\\w]/g,t.textContent))return ge(t),!0;if(\"select\"===n&&C(/