From 277376054bb7fb5725df02bc39068cc0a6ee3914 Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:46:17 +0000 Subject: [PATCH 1/6] Write the byte-order mark as an escape in the source It was a literal U+FEFF character inside the string, which works but is invisible in an editor and easy to delete by accident. --- frontend/src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/main.js b/frontend/src/main.js index 4d9a45c..f03f53f 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -26,7 +26,7 @@ const scroll = { get: () => (editing() ? $preview.scrollTop : window.scrollY), set: (y) => (editing() ? ($preview.scrollTop = y) : window.scrollTo(0, y)), }; -const BOM = ""; +const BOM = "\uFEFF"; const paint = (text) => renderInto($content, text.startsWith(BOM) ? text.slice(1) : text, scroll); function setDirty(v) { From a2a219173095c1e7726cd74fd20fc4457c126436 Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:46:52 +0000 Subject: [PATCH 2/6] Add find, a contents panel, alerts, image zoom and line-based scroll sync - Ctrl/Cmd+F finds text in the rendered page, with a match count, Enter/Shift+Enter (also F3 and Ctrl/Cmd+G) to step through, and Esc to close. Matches can span inline formatting but not blocks, and are redone whenever the page re-renders. In the editor, CodeMirror's own search still takes the shortcut. - Ctrl/Cmd+Shift+O (or Contents in the right-click menu) shows a panel listing the headings, highlighting the section being read. Clicking one jumps there; in edit mode the editor moves and the preview follows. - GitHub-style alerts: > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION] become coloured callouts with a title. - Clicking an image shown smaller than its real size opens it full size. - Every rendered block now carries its source line (data-line), and the preview follows the editor line by line instead of by scroll percentage, which drifted around images, diagrams and code. - window.__toast lets the app show a message in the page. --- dist/app-css.css | 2 +- dist/app.js | 9 +- dist/chunks/chart-24LXX2TX.js | 1 + dist/chunks/chart-PELGCLPX.js | 1 - .../{chunk-NO5BK2IH.js => chunk-A7SFTXEQ.js} | 2 +- dist/chunks/chunk-FE6DSGFD.js | 3 + .../{chunk-TNHQAXF3.js => chunk-FL2ILWU6.js} | 31 +-- dist/chunks/chunk-USGABQGL.js | 3 - ...{editor-NGOILUZO.js => editor-J3NDK5HN.js} | 2 +- .../{math-T547EQXU.js => math-2ONFTABO.js} | 2 +- dist/chunks/mermaid-4OQNCKUU.js | 2 + dist/chunks/mermaid-O4TCBJV4.js | 2 - .../{model-MGZXFMWN.js => model-6PF44EF3.js} | 2 +- .../{print-TJHD2ZSG.js => print-3WY3XNT3.js} | 2 +- dist/index.html | 2 +- frontend/src/alerts.js | 38 ++++ frontend/src/blocks/chart.js | 1 + frontend/src/blocks/lazy.js | 1 + frontend/src/blocks/mermaid.js | 1 + frontend/src/editor.js | 18 +- frontend/src/find.js | 181 ++++++++++++++++++ frontend/src/main.js | 94 ++++++++- frontend/src/math.js | 3 +- frontend/src/outline.js | 86 +++++++++ frontend/src/render.js | 20 +- frontend/src/style.css | 46 ++++- 26 files changed, 514 insertions(+), 41 deletions(-) create mode 100644 dist/chunks/chart-24LXX2TX.js delete mode 100644 dist/chunks/chart-PELGCLPX.js rename dist/chunks/{chunk-NO5BK2IH.js => chunk-A7SFTXEQ.js} (96%) create mode 100644 dist/chunks/chunk-FE6DSGFD.js rename dist/chunks/{chunk-TNHQAXF3.js => chunk-FL2ILWU6.js} (69%) delete mode 100644 dist/chunks/chunk-USGABQGL.js rename dist/chunks/{editor-NGOILUZO.js => editor-J3NDK5HN.js} (99%) rename dist/chunks/{math-T547EQXU.js => math-2ONFTABO.js} (83%) create mode 100644 dist/chunks/mermaid-4OQNCKUU.js delete mode 100644 dist/chunks/mermaid-O4TCBJV4.js rename dist/chunks/{model-MGZXFMWN.js => model-6PF44EF3.js} (52%) rename dist/chunks/{print-TJHD2ZSG.js => print-3WY3XNT3.js} (69%) create mode 100644 frontend/src/alerts.js create mode 100644 frontend/src/find.js create mode 100644 frontend/src/outline.js diff --git a/dist/app-css.css b/dist/app-css.css index 0a50216..29817d8 100644 --- a/dist/app-css.css +++ b/dist/app-css.css @@ -1 +1 @@ -:root{color-scheme:light dark;--bg:#fff;--fg:#1f2328;--muted:#59636e;--border:#d1d9e0;--code:#f6f8fa;--link:#0969da}:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0d1117;--fg:#e6edf3;--muted:#9198a1;--border:#3d444d;--code:#161b22;--link:#4493f8}}:root[data-theme=dark]{--bg:#0d1117;--fg:#e6edf3;--muted:#9198a1;--border:#3d444d;--code:#161b22;--link:#4493f8}html{background:var(--bg)}body{margin:0;color:var(--fg);font:16px/1.6 system-ui,-apple-system,Segoe UI,sans-serif}#content{max-width:860px;margin:0 auto;padding:32px 28px 64px;overflow-wrap:break-word}:root[data-width=wide] #content{max-width:1280px}h1,h2,h3,h4,h5,h6{line-height:1.25;margin:1.6em 0 .6em}h1,h2{padding-bottom:.3em;border-bottom:1px solid var(--border)}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}#content>:first-child{margin-top:0}a{color:var(--link);text-decoration:none}a:hover{text-decoration:underline}code,pre{font:85% ui-monospace,SFMono-Regular,Consolas,monospace}code{background:var(--code);padding:.2em .4em;border-radius:6px}pre{background:var(--code);padding:16px;border-radius:6px;overflow:auto;line-height:1.45}pre code{background:none;padding:0;font-size:inherit}blockquote{margin:0;padding:0 1em;color:var(--muted);border-left:.25em solid var(--border)}table{border-collapse:collapse;display:block;overflow:auto}th,td{border:1px solid var(--border);padding:6px 13px}tr:nth-child(2n){background:var(--code)}img{max-width:100%}hr{border:0;border-top:1px solid var(--border);margin:24px 0}.task-list-item{list-style:none}.task-list-item input{margin:0 .5em 0 -1.4em}.footnotes{font-size:.9em;color:var(--muted)}@media print{:root,html:root[data-theme]{--bg:#fff;--fg:#000;--muted:#555;--border:#ccc;--code:#f5f5f5;--link:#0645ad;color-scheme:light}html:root[data-width] #content{max-width:none;padding:0}pre,blockquote,table,img{break-inside:avoid}h1,h2,h3{break-after:avoid}}:root{--h-kw:#cf222e;--h-str:#0a3069;--h-num:#0550ae;--h-com:#6e7781;--h-fn:#8250df;--h-attr:#116329;--h-add:#116329;--h-del:#82071e}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--h-kw:#ff7b72;--h-str:#a5d6ff;--h-num:#79c0ff;--h-com:#8b949e;--h-fn:#d2a8ff;--h-attr:#7ee787;--h-add:#7ee787;--h-del:#ffa198}}:root[data-theme=dark]{--h-kw:#ff7b72;--h-str:#a5d6ff;--h-num:#79c0ff;--h-com:#8b949e;--h-fn:#d2a8ff;--h-attr:#7ee787;--h-add:#7ee787;--h-del:#ffa198}.hljs-keyword,.hljs-doctag,.hljs-type,.hljs-meta .hljs-keyword,.hljs-selector-tag{color:var(--h-kw)}.hljs-string,.hljs-regexp,.hljs-meta .hljs-string,.hljs-selector-attr{color:var(--h-str)}.hljs-number,.hljs-literal,.hljs-built_in,.hljs-symbol,.hljs-variable,.hljs-template-variable{color:var(--h-num)}.hljs-comment,.hljs-quote{color:var(--h-com);font-style:italic}.hljs-title,.hljs-section,.hljs-function .hljs-title{color:var(--h-fn)}.hljs-attr,.hljs-attribute,.hljs-name,.hljs-tag,.hljs-selector-class,.hljs-selector-id,.hljs-property{color:var(--h-attr)}.hljs-addition{color:var(--h-add)}.hljs-deletion{color:var(--h-del)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:600}figure.mermaid,figure.chart{margin:1em 0;text-align:center}figure.mermaid svg{max-width:100%;height:auto}figure.chart{position:relative;max-width:100%}div.math[data-math]{margin:1em 0;overflow-x:auto;text-align:center}.math-error{color:#cf222e}.block-error{margin:1em 0;padding:8px 14px;border:1px solid #cf222e;border-left-width:4px;border-radius:6px;background:color-mix(in srgb,#cf222e 8%,transparent)}.block-error pre{margin:6px 0 0;padding:0;background:none;white-space:pre-wrap;color:var(--muted)}div.model{position:relative;height:420px;margin:1em 0;border:1px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14px;overflow:hidden}div.model canvas{position:absolute;inset:0;width:100%;height:100%;cursor:grab;touch-action:none}div.model canvas:active{cursor:grabbing}#editor{display:none}body.editing{overflow:hidden;display:flex;flex-direction:column;height:100vh}body.editing #app{display:grid;grid-template-columns:1fr 1fr;flex:1;min-height:0}body.editing #editor{display:block;min-width:0;overflow:hidden;border-right:1px solid var(--border)}body.editing #preview{min-width:0;overflow:auto}body.editing #content{padding:24px 24px 64px}.cm-editor{height:100%}@media(max-width:760px){body.editing #app{grid-template-columns:1fr;grid-template-rows:1fr 1fr}body.editing #editor{border-right:0;border-bottom:1px solid var(--border)}}#banner{position:sticky;top:0;z-index:20;flex:none;display:flex;gap:10px;align-items:center;justify-content:center;padding:8px 12px;background:var(--code);border-bottom:1px solid var(--border);font-size:14px}#banner[hidden],#dialog[hidden],#toast[hidden]{display:none}#dialog{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;background:#0006}#dialog .box{min-width:300px;max-width:420px;padding:18px 20px;background:var(--bg);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 30px #00000059}#dialog p{margin:8px 0 16px;color:var(--muted)}#dialog .row{display:flex;gap:8px;justify-content:flex-end}#toast{position:fixed;bottom:16px;left:50%;transform:translate(-50%);z-index:40;padding:8px 14px;border-radius:8px;background:var(--fg);color:var(--bg);font-size:14px;box-shadow:0 4px 16px #0000004d}#toast.error{background:#cf222e;color:#fff}.menu{position:fixed;z-index:50;min-width:210px;padding:4px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 28px #0000004d;font:13px/1.3 system-ui,-apple-system,Segoe UI,sans-serif;user-select:none;cursor:default}.menu hr{margin:4px 6px;border:0;border-top:1px solid var(--border)}.menu .item{position:relative;display:flex;align-items:center;gap:12px;padding:5px 10px 5px 26px;border-radius:5px;white-space:nowrap}.menu .item.active,.menu .item.open{background:color-mix(in srgb,var(--fg) 10%,transparent)}.menu .item.disabled{color:var(--muted);opacity:.55}.menu .check{position:absolute;left:9px}.menu .label{flex:1}.menu .hint{color:var(--muted)}.menu .arrow{margin-right:-2px;color:var(--muted)}.menu .flyout{display:none;position:absolute;left:100%;top:-5px;margin-left:2px}.menu.flip .flyout{left:auto;right:100%;margin:0 2px 0 0}.menu .item.open>.flyout,.menu.measure .flyout{display:block}.menu.measure .flyout{visibility:hidden}button{font:inherit;font-size:14px;padding:4px 12px;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:6px;cursor:pointer}button:hover{background:var(--code)}button.primary{background:var(--link);border-color:var(--link);color:#fff}img.snap{display:none}@media print{#editor,#banner,#dialog,#toast,#menu{display:none!important}body.editing{overflow:visible}body.editing{display:block;height:auto}body.editing #app{display:block}body.editing #preview{overflow:visible}figure.chart canvas,div.model canvas{display:none!important}img.snap{display:block;max-width:100%;margin:0 auto}div.model{height:auto;border:0}figure.mermaid,figure.chart,div.model,div.math{break-inside:avoid}:root,html:root[data-theme]{--h-kw:#cf222e;--h-str:#0a3069;--h-num:#0550ae;--h-com:#6e7781;--h-fn:#8250df;--h-attr:#116329;--h-add:#116329;--h-del:#82071e}pre{white-space:pre-wrap}a{color:inherit;text-decoration:underline}} +:root{color-scheme:light dark;--bg:#fff;--fg:#1f2328;--muted:#59636e;--border:#d1d9e0;--code:#f6f8fa;--link:#0969da}:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0d1117;--fg:#e6edf3;--muted:#9198a1;--border:#3d444d;--code:#161b22;--link:#4493f8}}:root[data-theme=dark]{--bg:#0d1117;--fg:#e6edf3;--muted:#9198a1;--border:#3d444d;--code:#161b22;--link:#4493f8}html{background:var(--bg)}body{margin:0;color:var(--fg);font:16px/1.6 system-ui,-apple-system,Segoe UI,sans-serif}#content{max-width:860px;margin:0 auto;padding:32px 28px 64px;overflow-wrap:break-word}:root[data-width=wide] #content{max-width:1280px}h1,h2,h3,h4,h5,h6{line-height:1.25;margin:1.6em 0 .6em}h1,h2{padding-bottom:.3em;border-bottom:1px solid var(--border)}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}#content>:first-child{margin-top:0}a{color:var(--link);text-decoration:none}a:hover{text-decoration:underline}code,pre{font:85% ui-monospace,SFMono-Regular,Consolas,monospace}code{background:var(--code);padding:.2em .4em;border-radius:6px}pre{background:var(--code);padding:16px;border-radius:6px;overflow:auto;line-height:1.45}pre code{background:none;padding:0;font-size:inherit}blockquote{margin:0;padding:0 1em;color:var(--muted);border-left:.25em solid var(--border)}table{border-collapse:collapse;display:block;overflow:auto}th,td{border:1px solid var(--border);padding:6px 13px}tr:nth-child(2n){background:var(--code)}img{max-width:100%}hr{border:0;border-top:1px solid var(--border);margin:24px 0}.task-list-item{list-style:none}.task-list-item input{margin:0 .5em 0 -1.4em}.footnotes{font-size:.9em;color:var(--muted)}:root{--a-note:#0969da;--a-tip:#1a7f37;--a-important:#8250df;--a-warning:#9a6700;--a-caution:#d1242f}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--a-note:#4493f8;--a-tip:#3fb950;--a-important:#ab7df8;--a-warning:#d29922;--a-caution:#f85149}}:root[data-theme=dark]{--a-note:#4493f8;--a-tip:#3fb950;--a-important:#ab7df8;--a-warning:#d29922;--a-caution:#f85149}blockquote.alert{color:inherit;padding:.5em 1em;margin:1em 0;border-left-color:var(--accent)}blockquote.alert>:last-child{margin-bottom:0}.alert-title{margin:0;font-weight:600;color:var(--accent)}.alert-title+*{margin-top:.35em}.alert-note{--accent:var(--a-note)}.alert-tip{--accent:var(--a-tip)}.alert-important{--accent:var(--a-important)}.alert-warning{--accent:var(--a-warning)}.alert-caution{--accent:var(--a-caution)}img.zoomable{cursor:zoom-in}@media print{:root,html:root[data-theme]{--bg:#fff;--fg:#000;--muted:#555;--border:#ccc;--code:#f5f5f5;--link:#0645ad;color-scheme:light}html:root[data-width] #content{max-width:none;padding:0}pre,blockquote,table,img{break-inside:avoid}h1,h2,h3{break-after:avoid}}:root{--h-kw:#cf222e;--h-str:#0a3069;--h-num:#0550ae;--h-com:#6e7781;--h-fn:#8250df;--h-attr:#116329;--h-add:#116329;--h-del:#82071e}@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--h-kw:#ff7b72;--h-str:#a5d6ff;--h-num:#79c0ff;--h-com:#8b949e;--h-fn:#d2a8ff;--h-attr:#7ee787;--h-add:#7ee787;--h-del:#ffa198}}:root[data-theme=dark]{--h-kw:#ff7b72;--h-str:#a5d6ff;--h-num:#79c0ff;--h-com:#8b949e;--h-fn:#d2a8ff;--h-attr:#7ee787;--h-add:#7ee787;--h-del:#ffa198}.hljs-keyword,.hljs-doctag,.hljs-type,.hljs-meta .hljs-keyword,.hljs-selector-tag{color:var(--h-kw)}.hljs-string,.hljs-regexp,.hljs-meta .hljs-string,.hljs-selector-attr{color:var(--h-str)}.hljs-number,.hljs-literal,.hljs-built_in,.hljs-symbol,.hljs-variable,.hljs-template-variable{color:var(--h-num)}.hljs-comment,.hljs-quote{color:var(--h-com);font-style:italic}.hljs-title,.hljs-section,.hljs-function .hljs-title{color:var(--h-fn)}.hljs-attr,.hljs-attribute,.hljs-name,.hljs-tag,.hljs-selector-class,.hljs-selector-id,.hljs-property{color:var(--h-attr)}.hljs-addition{color:var(--h-add)}.hljs-deletion{color:var(--h-del)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:600}figure.mermaid,figure.chart{margin:1em 0;text-align:center}figure.mermaid svg{max-width:100%;height:auto}figure.chart{position:relative;max-width:100%}div.math[data-math]{margin:1em 0;overflow-x:auto;text-align:center}.math-error{color:#cf222e}.block-error{margin:1em 0;padding:8px 14px;border:1px solid #cf222e;border-left-width:4px;border-radius:6px;background:color-mix(in srgb,#cf222e 8%,transparent)}.block-error pre{margin:6px 0 0;padding:0;background:none;white-space:pre-wrap;color:var(--muted)}div.model{position:relative;height:420px;margin:1em 0;border:1px solid var(--border);border-radius:6px;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14px;overflow:hidden}div.model canvas{position:absolute;inset:0;width:100%;height:100%;cursor:grab;touch-action:none}div.model canvas:active{cursor:grabbing}#editor{display:none}body.editing{overflow:hidden;display:flex;flex-direction:column;height:100vh}body.editing #app{display:grid;grid-template-columns:1fr 1fr;flex:1;min-height:0}body.editing #editor{display:block;min-width:0;overflow:hidden;border-right:1px solid var(--border)}body.editing #preview{min-width:0;overflow:auto}body.editing #content{padding:24px 24px 64px}.cm-editor{height:100%}@media(max-width:760px){body.editing #app{grid-template-columns:1fr;grid-template-rows:1fr 1fr}body.editing #editor{border-right:0;border-bottom:1px solid var(--border)}}#banner{position:sticky;top:0;z-index:20;flex:none;display:flex;gap:10px;align-items:center;justify-content:center;padding:8px 12px;background:var(--code);border-bottom:1px solid var(--border);font-size:14px}#banner[hidden],#dialog[hidden],#toast[hidden]{display:none}#dialog{position:fixed;inset:0;z-index:30;display:flex;align-items:center;justify-content:center;background:#0006}#dialog .box{min-width:300px;max-width:420px;padding:18px 20px;background:var(--bg);border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 30px #00000059}#dialog p{margin:8px 0 16px;color:var(--muted)}#dialog .row{display:flex;gap:8px;justify-content:flex-end}#toast{position:fixed;bottom:16px;left:50%;transform:translate(-50%);z-index:40;padding:8px 14px;border-radius:8px;background:var(--fg);color:var(--bg);font-size:14px;box-shadow:0 4px 16px #0000004d}#toast.error{background:#cf222e;color:#fff}.menu{position:fixed;z-index:50;min-width:210px;padding:4px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 28px #0000004d;font:13px/1.3 system-ui,-apple-system,Segoe UI,sans-serif;user-select:none;cursor:default}.menu hr{margin:4px 6px;border:0;border-top:1px solid var(--border)}.menu .item{position:relative;display:flex;align-items:center;gap:12px;padding:5px 10px 5px 26px;border-radius:5px;white-space:nowrap}.menu .item.active,.menu .item.open{background:color-mix(in srgb,var(--fg) 10%,transparent)}.menu .item.disabled{color:var(--muted);opacity:.55}.menu .check{position:absolute;left:9px}.menu .label{flex:1}.menu .hint{color:var(--muted)}.menu .arrow{margin-right:-2px;color:var(--muted)}.menu .flyout{display:none;position:absolute;left:100%;top:-5px;margin-left:2px}.menu.flip .flyout{left:auto;right:100%;margin:0 2px 0 0}.menu .item.open>.flyout,.menu.measure .flyout{display:block}.menu.measure .flyout{visibility:hidden}#find{position:fixed;top:10px;right:18px;z-index:25;display:flex;gap:4px;align-items:center;padding:5px;background:var(--bg);border:1px solid var(--border);border-radius:8px;box-shadow:0 4px 16px #0003;font:13px/1.3 system-ui,-apple-system,Segoe UI,sans-serif}#find[hidden]{display:none}#find input{width:200px;padding:4px 8px;font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:5px;outline:none}#find input:focus{border-color:var(--link)}#find.none input{border-color:#cf222e}#find .count{min-width:70px;color:var(--muted);text-align:center;font-variant-numeric:tabular-nums}#find button{padding:2px 8px;font-size:13px}mark.find{color:inherit;background:color-mix(in srgb,#d4a72c 35%,transparent);border-radius:2px}mark.find.current{background:color-mix(in srgb,#d4a72c 75%,transparent)}#outline{display:none;position:fixed;top:0;bottom:0;left:0;z-index:15;width:250px;box-sizing:border-box;overflow:auto;padding:14px 8px 24px;background:var(--bg);border-right:1px solid var(--border);font:13px/1.35 system-ui,-apple-system,Segoe UI,sans-serif}body.outline-open #outline{display:block}body.outline-open #app{margin-left:250px}#outline .title{padding:0 8px 8px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;font-size:11px}#outline ol{list-style:none;margin:0;padding:0}#outline a{display:block;padding:3px 8px;border-radius:5px;color:var(--fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#outline a:hover{background:color-mix(in srgb,var(--fg) 7%,transparent);text-decoration:none}#outline a.active{color:var(--link);background:color-mix(in srgb,var(--link) 12%,transparent)}#outline .empty{padding:3px 8px;color:var(--muted)}@media(max-width:700px){body.outline-open #app{margin-left:0}#outline{box-shadow:4px 0 20px #00000040}}#lightbox{position:fixed;inset:0;z-index:35;display:flex;align-items:center;justify-content:center;background:#000000d1;cursor:zoom-out}#lightbox img{max-width:96vw;max-height:96vh;object-fit:contain}button{font:inherit;font-size:14px;padding:4px 12px;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:6px;cursor:pointer}button:hover{background:var(--code)}button.primary{background:var(--link);border-color:var(--link);color:#fff}img.snap{display:none}@media print{#editor,#banner,#dialog,#toast,#menu,#find,#outline,#lightbox{display:none!important}body.outline-open #app{margin-left:0}mark.find,mark.find.current{background:none}body.editing{overflow:visible}body.editing{display:block;height:auto}body.editing #app{display:block}body.editing #preview{overflow:visible}figure.chart canvas,div.model canvas{display:none!important}img.snap{display:block;max-width:100%;margin:0 auto}div.model{height:auto;border:0}figure.mermaid,figure.chart,div.model,div.math{break-inside:avoid}:root,html:root[data-theme]{--h-kw:#cf222e;--h-str:#0a3069;--h-num:#0550ae;--h-com:#6e7781;--h-fn:#8250df;--h-attr:#116329;--h-add:#116329;--h-del:#82071e}pre{white-space:pre-wrap}a{color:inherit;text-decoration:underline}} diff --git a/dist/app.js b/dist/app.js index 0d6323a..95678bb 100644 --- a/dist/app.js +++ b/dist/app.js @@ -1,4 +1,5 @@ -import{a as q,b as I}from"./chunks/chunk-TNHQAXF3.js";import"./chunks/chunk-FTY6WLQF.js";import"./chunks/chunk-NO5BK2IH.js";import{e as w}from"./chunks/chunk-USGABQGL.js";import"./chunks/chunk-EMBIDUMY.js";var C=e=>document.getElementById(e);function Y(e,t,n=!1){let o=document.createElement("button");return o.textContent=e,o.className=n?"primary":"",o.addEventListener("click",t),o}function V(e,t){let n=C("banner");n.replaceChildren(Object.assign(document.createElement("span"),{textContent:e}));for(let[o,i]of t)n.appendChild(Y(o,()=>{D(),i()}));n.hidden=!1}function D(){C("banner").hidden=!0}function X(e,t,n){let o=C("dialog"),i=document.createElement("div");i.className="box",i.setAttribute("role","alertdialog");let r=Object.assign(document.createElement("strong"),{textContent:e}),c=Object.assign(document.createElement("p"),{textContent:t}),f=document.createElement("div");f.className="row";for(let[a,_,N]of n)f.appendChild(Y(a,()=>{o.hidden=!0,_()},N));i.append(r,c,f),o.replaceChildren(i),o.hidden=!1,f.querySelector(".primary, button")?.focus()}var J=()=>!C("dialog").hidden,U;function b(e,t=!1){let n=C("toast");n.textContent=e,n.className=t?"error":"",n.hidden=!1,clearTimeout(U),U=setTimeout(()=>n.hidden=!0,4e3)}var s=null,l=null;function h(){if(s){s.remove(),s=null,l=null;for(let[e,t,n]of Q)window.removeEventListener(e,t,n)}}var H=e=>[...e.querySelectorAll(":scope > .item:not(.disabled)")];function x(e){l?.classList.remove("active"),l=e,l?.classList.add("active")}function j(e){for(let o of e.parentElement.querySelectorAll(":scope > .item.open"))o!==e&&o.classList.remove("open");if(!e.classList.contains("sub"))return;e.classList.add("open");let t=e.querySelector(":scope > .menu");t.style.top="";let n=t.getBoundingClientRect().bottom-(document.documentElement.clientHeight-6);n>0&&(t.style.top=`${-4-n}px`)}function Z(e){if(e.classList.contains("sub"))return j(e);let{action:t}=e;h(),t?.()}function G(e,t=!1){let n=document.createElement("div");n.className=t?"menu flyout":"menu",n.setAttribute("role","menu");for(let o of e){if(o==="-"){n.appendChild(Object.assign(document.createElement("hr"),{role:"separator"}));continue}let i=document.createElement("div");i.className="item"+(o.disabled?" disabled":"")+(o.items?" sub":""),i.setAttribute("role",o.checked!==void 0?"menuitemradio":"menuitem"),o.checked!==void 0&&i.setAttribute("aria-checked",String(o.checked)),o.disabled&&i.setAttribute("aria-disabled","true"),i.action=o.action,i.append(Object.assign(document.createElement("span"),{className:"check",textContent:o.checked?"\u2713":""}),Object.assign(document.createElement("span"),{className:"label",textContent:o.label}),Object.assign(document.createElement("span"),{className:"hint",textContent:o.hint??""})),o.items&&(i.appendChild(Object.assign(document.createElement("span"),{className:"arrow",textContent:"\u203A"})),i.appendChild(G(o.items,!0))),i.addEventListener("mouseover",r=>{r.stopPropagation(),!o.disabled&&(x(i),j(i))}),i.addEventListener("click",r=>{r.stopPropagation(),o.disabled||Z(i)}),n.appendChild(i)}return n}function fe(e){let t=l?l.parentElement:s,n=H(t),o=n.indexOf(l);if(e.key==="Escape")h();else if(e.key==="ArrowDown")x(n[(o+1)%n.length]);else if(e.key==="ArrowUp")x(n[o<0?n.length-1:(o-1+n.length)%n.length]);else if(e.key==="ArrowRight"&&l?.classList.contains("sub"))j(l),x(H(l.querySelector(":scope > .menu"))[0]??l);else if(e.key==="ArrowLeft"&&l?.parentElement.classList.contains("flyout")){let i=l.parentElement.parentElement;i.classList.remove("open"),x(i)}else if((e.key==="Enter"||e.key===" ")&&l)Z(l);else{if(e.key==="ArrowLeft"||e.key==="ArrowRight")return;if(!["Shift","Control","Alt","Meta"].includes(e.key)){h();return}}e.preventDefault(),e.stopPropagation()}var Q=[["keydown",fe,!0],["mousedown",e=>{s?.contains(e.target)?e.preventDefault():h()},!0],["blur",h,!1],["resize",h,!1],["wheel",h,{capture:!0,passive:!0}],["contextmenu",e=>{s?.contains(e.target)&&(e.preventDefault(),e.stopPropagation())},!0]];function ee(e,t,n){h(),s=G(n),s.id="menu",document.body.appendChild(s);let{clientWidth:o,clientHeight:i}=document.documentElement,{width:r,height:c}=s.getBoundingClientRect();s.style.left=`${Math.max(4,Math.min(e,o-r-4))}px`,s.style.top=`${Math.max(4,Math.min(t,i-c-4))}px`,s.classList.add("measure");let f=Math.max(0,...[...s.querySelectorAll(".flyout")].map(a=>a.getBoundingClientRect().width));s.classList.remove("measure"),s.classList.toggle("flip",o-s.getBoundingClientRect().rightwindow.ipc.postMessage(JSON.stringify(e)),m=null,p=null,k=null,M=!1,d=null,K=null,P=!1,O=()=>document.body.classList.contains("editing"),pe={get:()=>O()?T.scrollTop:window.scrollY,set:e=>O()?T.scrollTop=e:window.scrollTo(0,e)},z="\uFEFF",R=e=>q(oe,e.startsWith(z)?e.slice(1):e,pe);function A(e){e!==M&&(M=e,g({t:"dirty",v:e}))}var S={bom:!1,crlf:!1,lossy:!1};function ie(e,t){let n=/\r?\n/.exec(e);S={bom:e.startsWith(z),crlf:n?.[0]===`\r -`,lossy:t}}var se=e=>(e.startsWith(z)?e.slice(1):e).replace(/\r\n?/g,` -`),ae=e=>(S.bom?z:"")+(S.crlf?e.replace(/\n/g,`\r -`):e);async function he(){let e=await fetch("/doc",{cache:"no-store"});if(!e.ok)return null;let t=await e.arrayBuffer();try{return{text:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t),lossy:!1}}catch{return{text:new TextDecoder("utf-8",{ignoreBOM:!0}).decode(t),lossy:!0}}}async function le(){let e=await he();if(e===null)return;let{text:t,lossy:n}=e;if(m===null)return m=p=t,ie(t,n),R(t);if(t!==m){if(t===p)return m=t,A(!1);if(!M)return te(t,n);k=e,V("This file changed on disk.",[["Reload",()=>te(k.text,k.lossy)],["Keep mine",()=>{m=k.text}]])}}function te(e,t){return m=p=e,ie(e,t),k=null,d?.setDoc(se(e)),A(!1),D(),R(e)}var $;function ye(){A(!0),clearTimeout($),$=setTimeout(ge,200)}function ge(){p=ae(d.getDoc()),A(p!==m),R(p)}async function re(){if(O()){document.body.classList.remove("editing");return}if(!d){let{createEditor:e}=await import("./chunks/editor-NGOILUZO.js");d=e(me,{doc:se(p??""),onChange:ye,onScroll:t=>{T.scrollTop=t*(T.scrollHeight-T.clientHeight)}}),window.__editor=d}document.body.classList.add("editing"),d.focus(),S.lossy&&b("This file isn't UTF-8 text. You can edit it, but saving is turned off.",!0)}function W(){if(d){if(S.lossy){P=!1,b("This file isn't UTF-8 text, so mdown won't save over it.",!0);return}clearTimeout($),p=K=ae(d.getDoc()),g({t:"save",text:K})}}window.__saved=()=>{m=K,A(p!==m),D(),P&&g({t:"close"})};window.__saveFailed=e=>{P=!1,b("Could not save: "+e,!0)};var B=document.documentElement,L=["system","light","dark"],E={width:B.dataset.width,zoom:Number(B.dataset.zoom)};function ce(e){!L.includes(e)||e===w.mode||(w.mode=e,B.dataset.theme=e,I())}function de(e){B.dataset.width=E.width=e}function y(e,t){e==="theme"&&ce(t),e==="width"&&de(t),g({t:"setting",key:e,value:t})}var be={theme:()=>"Theme: "+w.mode,width:()=>"Page width: "+E.width,zoom:()=>`Text size: ${Math.round(E.zoom*100)}%`};window.__applySettings=(e,t)=>{ce(e.theme),de(e.width),E.zoom=e.zoom,t&&b(be[t]())};function we(){y("theme",L[(L.indexOf(w.mode)+1)%L.length])}var u=F?"\u2318":"Ctrl+";async function v(e,t){try{await navigator.clipboard.writeText(e)}catch{let n=Object.assign(document.createElement("textarea"),{value:e});n.style.cssText="position:fixed;opacity:0",document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}t&&b(t)}async function ve(){try{d.replaceSelection(await navigator.clipboard.readText())}catch{b(`Paste isn't available here. Use ${u}V.`,!0)}}function Ee(e){let t=e.target.closest?e.target:e.target.parentElement,n=d!==null&&!!t.closest("#editor"),o=t.closest("a[href]"),i=t.closest("pre"),r=n?d.getSelection():String(getSelection()),c=[];n?c.push({label:"Cut",hint:u+"X",disabled:!r,action:()=>{v(r),d.replaceSelection("")}},{label:"Copy",hint:u+"C",disabled:!r,action:()=>v(r)},{label:"Paste",hint:u+"V",action:ve},{label:"Select all",hint:u+"A",action:()=>d.selectAll()}):(c.push({label:"Copy",hint:u+"C",disabled:!r,action:()=>v(r)}),o&&c.push({label:"Copy link address",action:()=>v(o.getAttribute("href"),"Link copied")}),i&&c.push({label:"Copy code",action:()=>v((i.querySelector("code")??i).textContent.replace(/\n$/,""),"Code copied")}),c.push({label:"Select all",hint:u+"A",action:()=>getSelection().selectAllChildren(oe)})),c.push("-",{label:O()?"View mode":"Edit mode",hint:u+"E",action:re}),d&&c.push({label:"Save",hint:u+"S",disabled:!M,action:W}),c.push({label:"Print / Save as PDF\u2026",hint:u+"P",action:ue},"-");let f=Math.round(E.zoom*100);return c.push({label:"Theme",items:L.map(a=>({label:a[0].toUpperCase()+a.slice(1),checked:w.mode===a,action:()=>y("theme",a)}))},{label:"Text size",hint:f===100?"":f+"%",items:[{label:"Larger",hint:u+"+",disabled:f>=300,action:()=>y("zoom","in")},{label:"Smaller",hint:u+"-",disabled:f<=50,action:()=>y("zoom","out")},{label:"Actual size",hint:u+"0",disabled:f===100,action:()=>y("zoom","reset")}]},{label:"Page width",items:["normal","wide"].map(a=>({label:a[0].toUpperCase()+a.slice(1),checked:E.width===a,action:()=>y("width",a)}))},"-",{label:F?"Reveal in Finder":"Show in File Explorer",action:()=>g({t:"reveal"})},{label:"Copy file path",action:async()=>v((await(await fetch("/meta")).json()).path,"Path copied")}),c}document.addEventListener("contextmenu",e=>{e.preventDefault(),J()||ee(e.clientX,e.clientY,Ee(e))});var ne=0;document.addEventListener("wheel",e=>{e.ctrlKey&&(e.preventDefault(),!(e.timeStamp-ne<150)&&(ne=e.timeStamp,y("zoom",e.deltaY<0?"in":"out")))},{passive:!1});window.__askClose=()=>{X("Save changes before closing?","Your edits to this file have not been saved.",[["Save",()=>{P=!0,W()},!0],["Don't save",()=>g({t:"close"})],["Cancel",()=>{}]])};async function ue(){let{preparePrint:e}=await import("./chunks/print-TJHD2ZSG.js");await e(),g({t:"print"});let t=async()=>{window.removeEventListener("afterprint",t),window.removeEventListener("focus",n),(await import("./chunks/print-TJHD2ZSG.js")).restoreAfterPrint()},n=()=>setTimeout(t,1500);window.addEventListener("afterprint",t),setTimeout(()=>window.addEventListener("focus",n),1e3),setTimeout(t,6e4)}document.addEventListener("keydown",e=>{let t=F?e.metaKey:e.ctrlKey,n=e.key.toLowerCase();if(t&&e.shiftKey&&!e.altKey&&n==="l")e.preventDefault(),we();else if(t&&!e.altKey&&["e","s","p","r"].includes(n)){if(e.preventDefault(),e.shiftKey)return;n==="e"?re():n==="s"?W():n==="p"&&ue()}else t&&!e.altKey&&["=","+","-","_","0"].includes(e.key)?(e.preventDefault(),y("zoom",e.key==="0"?"reset":e.key==="-"||e.key==="_"?"out":"in")):e.key==="F5"&&e.preventDefault()},!0);document.addEventListener("click",e=>{let t=e.target.closest("a[href]");if(!t)return;let n=t.getAttribute("href");n.startsWith("#")||(e.preventDefault(),g({t:"link",href:n}))});for(let e of["dragover","drop"])document.addEventListener(e,t=>t.preventDefault());window.__reload=le;window.__print={prepare:async()=>(await import("./chunks/print-TJHD2ZSG.js")).preparePrint(),restore:async()=>(await import("./chunks/print-TJHD2ZSG.js")).restoreAfterPrint()};le(); +import{a as ye,b as ve}from"./chunks/chunk-FL2ILWU6.js";import"./chunks/chunk-FTY6WLQF.js";import"./chunks/chunk-A7SFTXEQ.js";import{e as O}from"./chunks/chunk-FE6DSGFD.js";import"./chunks/chunk-EMBIDUMY.js";var _=e=>document.getElementById(e);function xe(e,t,n=!1){let o=document.createElement("button");return o.textContent=e,o.className=n?"primary":"",o.addEventListener("click",t),o}function Ce(e,t){let n=_("banner");n.replaceChildren(Object.assign(document.createElement("span"),{textContent:e}));for(let[o,i]of t)n.appendChild(xe(o,()=>{H(),i()}));n.hidden=!1}function H(){_("banner").hidden=!0}function ke(e,t,n){let o=_("dialog"),i=document.createElement("div");i.className="box",i.setAttribute("role","alertdialog");let s=Object.assign(document.createElement("strong"),{textContent:e}),l=Object.assign(document.createElement("p"),{textContent:t}),r=document.createElement("div");r.className="row";for(let[a,c,x]of n)r.appendChild(xe(a,()=>{o.hidden=!0,c()},x));i.append(s,l,r),o.replaceChildren(i),o.hidden=!1,r.querySelector(".primary, button")?.focus()}var Le=()=>!_("dialog").hidden,we;function k(e,t=!1){let n=_("toast");n.textContent=e,n.className=t?"error":"",n.hidden=!1,clearTimeout(we),we=setTimeout(()=>n.hidden=!0,4e3)}var d=null,m=null;function C(){if(d){d.remove(),d=null,m=null;for(let[e,t,n]of Ae)window.removeEventListener(e,t,n)}}var Ee=e=>[...e.querySelectorAll(":scope > .item:not(.disabled)")];function P(e){m?.classList.remove("active"),m=e,m?.classList.add("active")}function se(e){for(let o of e.parentElement.querySelectorAll(":scope > .item.open"))o!==e&&o.classList.remove("open");if(!e.classList.contains("sub"))return;e.classList.add("open");let t=e.querySelector(":scope > .menu");t.style.top="";let n=t.getBoundingClientRect().bottom-(document.documentElement.clientHeight-6);n>0&&(t.style.top=`${-4-n}px`)}function Te(e){if(e.classList.contains("sub"))return se(e);let{action:t}=e;C(),t?.()}function Se(e,t=!1){let n=document.createElement("div");n.className=t?"menu flyout":"menu",n.setAttribute("role","menu");for(let o of e){if(o==="-"){n.appendChild(Object.assign(document.createElement("hr"),{role:"separator"}));continue}let i=document.createElement("div");i.className="item"+(o.disabled?" disabled":"")+(o.items?" sub":""),i.setAttribute("role",o.checked!==void 0?"menuitemradio":"menuitem"),o.checked!==void 0&&i.setAttribute("aria-checked",String(o.checked)),o.disabled&&i.setAttribute("aria-disabled","true"),i.action=o.action,i.append(Object.assign(document.createElement("span"),{className:"check",textContent:o.checked?"\u2713":""}),Object.assign(document.createElement("span"),{className:"label",textContent:o.label}),Object.assign(document.createElement("span"),{className:"hint",textContent:o.hint??""})),o.items&&(i.appendChild(Object.assign(document.createElement("span"),{className:"arrow",textContent:"\u203A"})),i.appendChild(Se(o.items,!0))),i.addEventListener("mouseover",s=>{s.stopPropagation(),!o.disabled&&(P(i),se(i))}),i.addEventListener("click",s=>{s.stopPropagation(),o.disabled||Te(i)}),n.appendChild(i)}return n}function Qe(e){let t=m?m.parentElement:d,n=Ee(t),o=n.indexOf(m);if(e.key==="Escape")C();else if(e.key==="ArrowDown")P(n[(o+1)%n.length]);else if(e.key==="ArrowUp")P(n[o<0?n.length-1:(o-1+n.length)%n.length]);else if(e.key==="ArrowRight"&&m?.classList.contains("sub"))se(m),P(Ee(m.querySelector(":scope > .menu"))[0]??m);else if(e.key==="ArrowLeft"&&m?.parentElement.classList.contains("flyout")){let i=m.parentElement.parentElement;i.classList.remove("open"),P(i)}else if((e.key==="Enter"||e.key===" ")&&m)Te(m);else{if(e.key==="ArrowLeft"||e.key==="ArrowRight")return;if(!["Shift","Control","Alt","Meta"].includes(e.key)){C();return}}e.preventDefault(),e.stopPropagation()}var Ae=[["keydown",Qe,!0],["mousedown",e=>{d?.contains(e.target)?e.preventDefault():C()},!0],["blur",C,!1],["resize",C,!1],["wheel",C,{capture:!0,passive:!0}],["contextmenu",e=>{d?.contains(e.target)&&(e.preventDefault(),e.stopPropagation())},!0]];function Ne(e,t,n){C(),d=Se(n),d.id="menu",document.body.appendChild(d);let{clientWidth:o,clientHeight:i}=document.documentElement,{width:s,height:l}=d.getBoundingClientRect();d.style.left=`${Math.max(4,Math.min(e,o-s-4))}px`,d.style.top=`${Math.max(4,Math.min(t,i-l-4))}px`,d.classList.add("measure");let r=Math.max(0,...[...d.querySelectorAll(".flyout")].map(a=>a.getBoundingClientRect().width));d.classList.remove("measure"),d.classList.toggle("flip",o-d.getBoundingClientRect().righte.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=()=>!!h&&!h.hidden;function nt(){h=document.createElement("div"),h.id="find",h.setAttribute("role","search"),b=Object.assign(document.createElement("input"),{type:"text",placeholder:"Find",spellcheck:!1}),b.setAttribute("aria-label","Find in document"),N=Object.assign(document.createElement("span"),{className:"count"}),N.setAttribute("aria-live","polite");let e=(t,n,o)=>{let i=Object.assign(document.createElement("button"),{textContent:t,title:n});return i.setAttribute("aria-label",n),i.addEventListener("mousedown",s=>s.preventDefault()),i.addEventListener("click",o),i};h.append(b,N,e("\u2191","Previous match (Shift+Enter)",()=>z(-1)),e("\u2193","Next match (Enter)",()=>z(1)),e("\u2715","Close (Esc)",U)),b.addEventListener("input",()=>{clearTimeout(le),le=setTimeout(()=>X({fromView:!0}),120)}),b.addEventListener("keydown",t=>{t.key==="Enter"?(t.preventDefault(),clearTimeout(le),De()?X({fromView:!0}):z(t.shiftKey?-1:1)):t.key==="Escape"&&(t.preventDefault(),U())}),document.body.appendChild(h)}var re="",De=()=>b.value!==re;function Fe(e,t){Oe=e,h||nt(),h.hidden=!1,t&&!t.includes(` +`)&&(b.value=t),b.focus(),b.select(),(De()||!u.length)&&X({fromView:!0})}function U(){h&&(h.hidden=!0,Be(),re="",N.textContent="")}function Me(){if(!Y())return;let e=L;u=[],X({keep:e})}function z(e){u.length&&ae((L+e+u.length)%u.length,!0)}function Be(){let e=new Set;for(let t of u)for(let n of t)n.isConnected&&(e.add(n.parentNode),n.replaceWith(...n.childNodes));for(let t of e)t.normalize();u=[],L=-1}function ot(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:s=>s.nodeValue&&!s.parentElement.closest(Ze)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),n=[],o="",i=null;for(let s;s=t.nextNode();){let l=s.parentElement.closest(et);l!==i&&o&&(o+="\0"),i=l,n.push({node:s,start:o.length,len:s.nodeValue.length}),o+=s.nodeValue}return{nodes:n,text:o}}function X({fromView:e=!1,keep:t=-1}={}){Be();let n=b.value;if(re=n,!n){N.textContent="";return}let{nodes:o,text:i}=ot(Oe),s=[],l=new RegExp(tt(n),"gi");for(let c;(c=l.exec(i))&&s.length<2e3;)s.push([c.index,c.index+c[0].length]);let r=o.length-1;for(let c=s.length-1;c>=0;c--){let[x,y]=s[c],ge=[];for(;r>0&&o[r].start>=y;)r--;for(let B=r;B>=0&&o[B].start+o[B].len>x;B--){let{node:q,start:V,len:Ge}=o[B],ne=Math.max(x,V)-V,oe=Math.min(y,V+Ge)-V;if(oe<=ne)continue;oe0?q.splitText(ne):q,ie=Object.assign(document.createElement("mark"),{className:"find"});be.replaceWith(ie),ie.appendChild(be),ge.unshift(ie)}u.unshift(ge)}if(!u.length){N.textContent="No results",h.classList.add("none");return}if(h.classList.remove("none"),t>=0)return ae(Math.min(t,u.length-1),!1);let a=e?u.findIndex(c=>c[0].getBoundingClientRect().bottom>0):0;ae(a<0?0:a,!0)}function ae(e,t){for(let n of u[L]??[])n.classList.remove("current");L=e;for(let n of u[L])n.classList.add("current");N.textContent=`${L+1} of ${u.length}${u.length>=2e3?"+":""}`,t&&u[L][0].scrollIntoView({block:"center",inline:"nearest"})}var g=null,J,Pe,_e,v=[],ce=0,K=()=>document.body.classList.contains("outline-open");function it(){g=document.createElement("nav"),g.id="outline",g.setAttribute("aria-label","Contents");let e=Object.assign(document.createElement("div"),{className:"title",textContent:"Contents"});J=document.createElement("ol"),g.append(e,J),g.addEventListener("click",t=>{let n=t.target.closest("a");if(!n)return;t.preventDefault();let o=v[Number(n.dataset.i)]?.[0];o&&_e(o)}),g.addEventListener("keydown",t=>{t.key==="Escape"&&de()}),document.body.appendChild(g),window.addEventListener("scroll",()=>{K()&&!ce&&(ce=requestAnimationFrame(ze))},!0)}function de(e,t){e&&([Pe,_e]=[e,t]),g||it();let n=!K();document.body.classList.toggle("outline-open",n),n&&ue()}function ue(){if(!K())return;let e=[...Pe.querySelectorAll("h1, h2, h3, h4, h5, h6")].filter(n=>!n.closest(".footnotes")),t=Math.min(6,...e.map(n=>Number(n.tagName[1])));v=e.map((n,o)=>{let i=document.createElement("a");return i.href=n.id?"#"+n.id:"#",i.dataset.i=o,i.textContent=n.textContent.trim()||"(untitled)",i.title=i.textContent,i.style.paddingLeft=`${8+(Number(n.tagName[1])-t)*14}px`,document.createElement("li").appendChild(i),[n,i]}),J.replaceChildren(...v.map(([,n])=>n.parentElement)),v.length||J.appendChild(Object.assign(document.createElement("li"),{className:"empty",textContent:"No headings"})),ze()}function ze(){if(ce=0,!v.length)return;let e=document.body.classList.contains("editing")?document.getElementById("preview"):null,t=e?e.getBoundingClientRect().top:0,n=0;for(let l=0;ls.bottom&&(g.scrollTop+=i.bottom-s.bottom+8)}var T=document.getElementById("preview"),F=document.getElementById("content"),st=document.getElementById("editor"),G=/Mac/.test(navigator.platform),A=e=>window.ipc.postMessage(JSON.stringify(e)),w=null,E=null,j=null,Q=!1,f=null,fe=null,ee=!1,I=()=>document.body.classList.contains("editing"),lt={get:()=>I()?T.scrollTop:window.scrollY,set:e=>I()?T.scrollTop=e:window.scrollTo(0,e)},te="\uFEFF";async function pe(e){await ye(F,e.startsWith(te)?e.slice(1):e,lt),Me(),ue()}function W(e){e!==Q&&(Q=e,A({t:"dirty",v:e}))}var $={bom:!1,crlf:!1,lossy:!1};function Re(e,t){let n=/\r?\n/.exec(e);$={bom:e.startsWith(te),crlf:n?.[0]===`\r +`,lossy:t}}var Ie=e=>(e.startsWith(te)?e.slice(1):e).replace(/\r\n?/g,` +`),$e=e=>($.bom?te:"")+($.crlf?e.replace(/\n/g,`\r +`):e);async function at(){let e=await fetch("/doc",{cache:"no-store"});if(!e.ok)return null;let t=await e.arrayBuffer();try{return{text:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}).decode(t),lossy:!1}}catch{return{text:new TextDecoder("utf-8",{ignoreBOM:!0}).decode(t),lossy:!0}}}async function We(){let e=await at();if(e===null)return;let{text:t,lossy:n}=e;if(w===null)return w=E=t,Re(t,n),pe(t);if(t!==w){if(t===E)return w=t,W(!1);if(!Q)return Ke(t,n);j=e,Ce("This file changed on disk.",[["Reload",()=>Ke(j.text,j.lossy)],["Keep mine",()=>{w=j.text}]])}}function Ke(e,t){return w=E=e,Re(e,t),j=null,f?.setDoc(Ie(e)),W(!1),H(),pe(e)}var me;function rt(){W(!0),clearTimeout(me),me=setTimeout(ct,200)}function ct(){E=$e(f.getDoc()),W(E!==w),pe(E)}async function qe(){if(I()){document.body.classList.remove("editing");return}if(!f){let{createEditor:e}=await import("./chunks/editor-J3NDK5HN.js");f=e(st,{doc:Ie(E??""),onChange:rt,onScroll:dt}),window.__editor=f}document.body.classList.add("editing"),f.focus(),$.lossy&&k("This file isn't UTF-8 text. You can edit it, but saving is turned off.",!0)}function dt({line:e,lines:t,atTop:n,atEnd:o}){if(n)return T.scrollTop=0;if(o)return T.scrollTop=T.scrollHeight;let i=null,s=null;for(let y of F.querySelectorAll("[data-line]"))if(!y.closest(".footnotes"))if(Number(y.dataset.line)<=e)i=y;else{s=y;break}let l=T.getBoundingClientRect().top-T.scrollTop,r=y=>y.getBoundingClientRect().top-l,a=i?{line:Number(i.dataset.line),y:r(i)}:{line:0,y:0},c=s?{line:Number(s.dataset.line),y:r(s)}:{line:t,y:F.scrollHeight},x=c.line>a.line?(e-a.line)/(c.line-a.line):0;T.scrollTop=a.y+Math.min(1,Math.max(0,x))*(c.y-a.y)}function ut(e){I()&&f&&e.dataset.line?f.scrollToLine(Number(e.dataset.line)):e.scrollIntoView({block:"start"})}var Ve=()=>Fe(F,String(getSelection()).trim()),He=()=>de(F,ut),Ue=e=>e.matches("#content img:not(.snap)")&&!e.closest("a")&&(e.naturalWidth>e.clientWidth+1||e.naturalHeight>e.clientHeight+1);function ft(e){let t=document.createElement("div");t.id="lightbox",t.setAttribute("role","dialog"),t.setAttribute("aria-label",e.alt||"Image"),t.appendChild(Object.assign(document.createElement("img"),{src:e.currentSrc||e.src,alt:e.alt}));let n=()=>{t.remove(),window.removeEventListener("keydown",o,!0)},o=i=>{i.preventDefault(),i.stopPropagation(),n()};t.addEventListener("click",n),window.addEventListener("keydown",o,!0),document.body.appendChild(t)}document.addEventListener("mouseover",e=>{e.target.tagName==="IMG"&&e.target.classList.toggle("zoomable",Ue(e.target))});function he(){if(f){if($.lossy){ee=!1,k("This file isn't UTF-8 text, so mdown won't save over it.",!0);return}clearTimeout(me),E=fe=$e(f.getDoc()),A({t:"save",text:fe})}}window.__saved=()=>{w=fe,W(E!==w),H(),ee&&A({t:"close"})};window.__saveFailed=e=>{ee=!1,k("Could not save: "+e,!0)};var Z=document.documentElement,R=["system","light","dark"],M={width:Z.dataset.width,zoom:Number(Z.dataset.zoom)};function Xe(e){!R.includes(e)||e===O.mode||(O.mode=e,Z.dataset.theme=e,ve())}function Ye(e){Z.dataset.width=M.width=e}function S(e,t){e==="theme"&&Xe(t),e==="width"&&Ye(t),A({t:"setting",key:e,value:t})}var mt={theme:()=>"Theme: "+O.mode,width:()=>"Page width: "+M.width,zoom:()=>`Text size: ${Math.round(M.zoom*100)}%`};window.__applySettings=(e,t)=>{Xe(e.theme),Ye(e.width),M.zoom=e.zoom,t&&k(mt[t]())};function pt(){S("theme",R[(R.indexOf(O.mode)+1)%R.length])}var p=G?"\u2318":"Ctrl+";async function D(e,t){try{await navigator.clipboard.writeText(e)}catch{let n=Object.assign(document.createElement("textarea"),{value:e});n.style.cssText="position:fixed;opacity:0",document.body.appendChild(n),n.select(),document.execCommand("copy"),n.remove()}t&&k(t)}async function ht(){try{f.replaceSelection(await navigator.clipboard.readText())}catch{k(`Paste isn't available here. Use ${p}V.`,!0)}}function gt(e){let t=e.target.closest?e.target:e.target.parentElement,n=f!==null&&!!t.closest("#editor"),o=t.closest("a[href]"),i=t.closest("pre"),s=n?f.getSelection():String(getSelection()),l=[];n?l.push({label:"Cut",hint:p+"X",disabled:!s,action:()=>{D(s),f.replaceSelection("")}},{label:"Copy",hint:p+"C",disabled:!s,action:()=>D(s)},{label:"Paste",hint:p+"V",action:ht},{label:"Select all",hint:p+"A",action:()=>f.selectAll()}):(l.push({label:"Copy",hint:p+"C",disabled:!s,action:()=>D(s)}),o&&l.push({label:"Copy link address",action:()=>D(o.getAttribute("href"),"Link copied")}),i&&l.push({label:"Copy code",action:()=>D((i.querySelector("code")??i).textContent.replace(/\n$/,""),"Code copied")}),l.push({label:"Select all",hint:p+"A",action:()=>getSelection().selectAllChildren(F)}),l.push({label:"Find\u2026",hint:p+"F",action:Ve})),l.push("-",{label:I()?"View mode":"Edit mode",hint:p+"E",action:qe}),f&&l.push({label:"Save",hint:p+"S",disabled:!Q,action:he}),l.push({label:"Print / Save as PDF\u2026",hint:p+"P",action:Je},"-"),l.push({label:"Contents",hint:p+(G?"\u21E7O":"Shift+O"),checked:K(),action:He});let r=Math.round(M.zoom*100);return l.push({label:"Theme",items:R.map(a=>({label:a[0].toUpperCase()+a.slice(1),checked:O.mode===a,action:()=>S("theme",a)}))},{label:"Text size",hint:r===100?"":r+"%",items:[{label:"Larger",hint:p+"+",disabled:r>=300,action:()=>S("zoom","in")},{label:"Smaller",hint:p+"-",disabled:r<=50,action:()=>S("zoom","out")},{label:"Actual size",hint:p+"0",disabled:r===100,action:()=>S("zoom","reset")}]},{label:"Page width",items:["normal","wide"].map(a=>({label:a[0].toUpperCase()+a.slice(1),checked:M.width===a,action:()=>S("width",a)}))},"-",{label:G?"Reveal in Finder":"Show in File Explorer",action:()=>A({t:"reveal"})},{label:"Copy file path",action:async()=>D((await(await fetch("/meta")).json()).path,"Path copied")}),l}document.addEventListener("contextmenu",e=>{e.preventDefault(),Le()||Ne(e.clientX,e.clientY,gt(e))});var je=0;document.addEventListener("wheel",e=>{e.ctrlKey&&(e.preventDefault(),!(e.timeStamp-je<150)&&(je=e.timeStamp,S("zoom",e.deltaY<0?"in":"out")))},{passive:!1});window.__askClose=()=>{ke("Save changes before closing?","Your edits to this file have not been saved.",[["Save",()=>{ee=!0,he()},!0],["Don't save",()=>A({t:"close"})],["Cancel",()=>{}]])};async function Je(){let{preparePrint:e}=await import("./chunks/print-3WY3XNT3.js");await e(),A({t:"print"});let t=async()=>{window.removeEventListener("afterprint",t),window.removeEventListener("focus",n),(await import("./chunks/print-3WY3XNT3.js")).restoreAfterPrint()},n=()=>setTimeout(t,1500);window.addEventListener("afterprint",t),setTimeout(()=>window.addEventListener("focus",n),1e3),setTimeout(t,6e4)}document.addEventListener("keydown",e=>{let t=G?e.metaKey:e.ctrlKey,n=e.key.toLowerCase(),o=!!e.target.closest?.("#editor");if(t&&e.shiftKey&&!e.altKey&&n==="l")e.preventDefault(),pt();else if(t&&e.shiftKey&&!e.altKey&&n==="o")e.preventDefault(),He();else if(t&&!e.shiftKey&&!e.altKey&&n==="f"&&!o)e.preventDefault(),Ve();else if(Y()&&(e.key==="F3"||t&&!e.altKey&&n==="g"))e.preventDefault(),z(e.shiftKey?-1:1);else if(Y()&&e.key==="Escape"&&!o&&!e.target.closest?.("#find"))U();else if(t&&!e.altKey&&["e","s","p","r"].includes(n)){if(e.preventDefault(),e.shiftKey)return;n==="e"?qe():n==="s"?he():n==="p"&&Je()}else t&&!e.altKey&&["=","+","-","_","0"].includes(e.key)?(e.preventDefault(),S("zoom",e.key==="0"?"reset":e.key==="-"||e.key==="_"?"out":"in")):e.key==="F5"&&e.preventDefault()},!0);document.addEventListener("click",e=>{if(e.target.tagName==="IMG"&&Ue(e.target))return ft(e.target);let t=e.target.closest("a[href]");if(!t)return;let n=t.getAttribute("href");n.startsWith("#")||(e.preventDefault(),A({t:"link",href:n}))});for(let e of["dragover","drop"])document.addEventListener(e,t=>t.preventDefault());window.__reload=We;window.__toast=k;window.__print={prepare:async()=>(await import("./chunks/print-3WY3XNT3.js")).preparePrint(),restore:async()=>(await import("./chunks/print-3WY3XNT3.js")).restoreAfterPrint()};We(); diff --git a/dist/chunks/chart-24LXX2TX.js b/dist/chunks/chart-24LXX2TX.js new file mode 100644 index 0000000..b9db4af --- /dev/null +++ b/dist/chunks/chart-24LXX2TX.js @@ -0,0 +1 @@ +import{b as i,c as l,f as d,g as f}from"./chunk-FE6DSGFD.js";import"./chunk-EMBIDUMY.js";var n,u;async function h(){n??=(await import("./auto-W5SIIXTF.js")).default,u??=n.defaults.animation,n.defaults.animation=d.on?!1:u;let r=f();return n.defaults.color=r?"#9198a1":"#59636e",n.defaults.scale.grid.color=r?"#3d444d":"#d1d9e0",n}async function p(r){let a=await h();for(let t of r){let c;try{c=JSON.parse(t.textContent)}catch(o){i(t.parentElement,"Chart (invalid JSON)",o);continue}let e=document.createElement("figure");e.className="chart";let s=document.createElement("canvas");e.appendChild(s),e._config=c,t.parentElement.dataset.line&&(e.dataset.line=t.parentElement.dataset.line),t.parentElement.replaceWith(e);try{e._chart=new a(s,structuredClone(c)),l(()=>e._chart?.destroy())}catch(o){i(e,"Chart",o)}}}async function g(){let r=[...document.querySelectorAll("figure.chart")].filter(t=>t._chart);if(!r.length)return;let a=await h();for(let t of r)t._chart.destroy(),t._chart=new a(t.querySelector("canvas"),structuredClone(t._config))}export{p as renderCharts,g as rethemeCharts}; diff --git a/dist/chunks/chart-PELGCLPX.js b/dist/chunks/chart-PELGCLPX.js deleted file mode 100644 index c684c30..0000000 --- a/dist/chunks/chart-PELGCLPX.js +++ /dev/null @@ -1 +0,0 @@ -import{b as i,c as l,f,g as d}from"./chunk-USGABQGL.js";import"./chunk-EMBIDUMY.js";var n,u;async function h(){n??=(await import("./auto-W5SIIXTF.js")).default,u??=n.defaults.animation,n.defaults.animation=f.on?!1:u;let e=d();return n.defaults.color=e?"#9198a1":"#59636e",n.defaults.scale.grid.color=e?"#3d444d":"#d1d9e0",n}async function g(e){let a=await h();for(let t of e){let c;try{c=JSON.parse(t.textContent)}catch(o){i(t.parentElement,"Chart (invalid JSON)",o);continue}let r=document.createElement("figure");r.className="chart";let s=document.createElement("canvas");r.appendChild(s),r._config=c,t.parentElement.replaceWith(r);try{r._chart=new a(s,structuredClone(c)),l(()=>r._chart?.destroy())}catch(o){i(r,"Chart",o)}}}async function p(){let e=[...document.querySelectorAll("figure.chart")].filter(t=>t._chart);if(!e.length)return;let a=await h();for(let t of e)t._chart.destroy(),t._chart=new a(t.querySelector("canvas"),structuredClone(t._config))}export{g as renderCharts,p as rethemeCharts}; diff --git a/dist/chunks/chunk-NO5BK2IH.js b/dist/chunks/chunk-A7SFTXEQ.js similarity index 96% rename from dist/chunks/chunk-NO5BK2IH.js rename to dist/chunks/chunk-A7SFTXEQ.js index 2e6e9b9..9ed4546 100644 --- a/dist/chunks/chunk-NO5BK2IH.js +++ b/dist/chunks/chunk-A7SFTXEQ.js @@ -1 +1 @@ -import{b as u,c as g}from"./chunk-USGABQGL.js";var y=/\.(glb|gltf|stl)(?:[?#]|$)/i,P=t=>y.test(t);async function z(t){let e=await import("./three.module-IQMID6NF.js"),{OrbitControls:c}=await import("./OrbitControls-R3UEDILL.js");await Promise.all(t.map(s=>v(s,e,c).catch(n=>u(s,"3D model",n))))}async function b(t,e){if(y.exec(e)[1].toLowerCase()==="stl"){let{STLLoader:n}=await import("./STLLoader-XQFFJ2RZ.js"),a=await new n().loadAsync(e);a.attributes.normal||a.computeVertexNormals();let o=new t.Mesh(a,new t.MeshStandardMaterial({color:10135476,metalness:.1,roughness:.55}));return o.rotation.x=-Math.PI/2,o}let{GLTFLoader:s}=await import("./GLTFLoader-T573S6N7.js");return(await new s().loadAsync(e)).scene}async function v(t,e,c){let s=await b(e,t.dataset.src);if(!t.isConnected)return;let n=new e.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});n.setPixelRatio(window.devicePixelRatio),t.textContent="",t.appendChild(n.domElement);let a=new e.Scene,o=new e.PerspectiveCamera(40,1,.1,1e3);a.add(new e.HemisphereLight(16777215,4478310,1.4));let L=new e.DirectionalLight(16777215,2.2);o.add(L),a.add(o);let d=new e.Group;d.add(s),a.add(d);let f=new e.Box3().setFromObject(d),m=f.getSize(new e.Vector3);s.position.sub(f.getCenter(new e.Vector3));let w=Math.max(m.x,m.y,m.z)||1,M=w/(2*Math.tan(o.fov*Math.PI/360))*1.7;o.near=w/100,o.far=w*100,o.position.set(.8,.55,1).normalize().multiplyScalar(M),o.updateProjectionMatrix();let l=new c(o,n.domElement),p=()=>n.render(a,o);l.addEventListener("change",p);let x=()=>{let r=t.clientWidth,i=t.clientHeight;!r||!i||(n.setSize(r,i,!1),o.aspect=r/i,o.updateProjectionMatrix(),p())},h=new ResizeObserver(x);h.observe(t),x(),t.classList.add("ready"),g(()=>{h.disconnect(),l.dispose(),s.traverse(r=>{r.geometry?.dispose();for(let i of[].concat(r.material||[]))i.dispose()}),n.dispose(),n.forceContextLoss()})}export{P as a,z as b}; +import{b as u,c as g}from"./chunk-FE6DSGFD.js";var y=/\.(glb|gltf|stl)(?:[?#]|$)/i,P=t=>y.test(t);async function z(t){let e=await import("./three.module-IQMID6NF.js"),{OrbitControls:c}=await import("./OrbitControls-R3UEDILL.js");await Promise.all(t.map(s=>v(s,e,c).catch(n=>u(s,"3D model",n))))}async function b(t,e){if(y.exec(e)[1].toLowerCase()==="stl"){let{STLLoader:n}=await import("./STLLoader-XQFFJ2RZ.js"),a=await new n().loadAsync(e);a.attributes.normal||a.computeVertexNormals();let o=new t.Mesh(a,new t.MeshStandardMaterial({color:10135476,metalness:.1,roughness:.55}));return o.rotation.x=-Math.PI/2,o}let{GLTFLoader:s}=await import("./GLTFLoader-T573S6N7.js");return(await new s().loadAsync(e)).scene}async function v(t,e,c){let s=await b(e,t.dataset.src);if(!t.isConnected)return;let n=new e.WebGLRenderer({antialias:!0,alpha:!0,preserveDrawingBuffer:!0});n.setPixelRatio(window.devicePixelRatio),t.textContent="",t.appendChild(n.domElement);let a=new e.Scene,o=new e.PerspectiveCamera(40,1,.1,1e3);a.add(new e.HemisphereLight(16777215,4478310,1.4));let L=new e.DirectionalLight(16777215,2.2);o.add(L),a.add(o);let d=new e.Group;d.add(s),a.add(d);let f=new e.Box3().setFromObject(d),m=f.getSize(new e.Vector3);s.position.sub(f.getCenter(new e.Vector3));let w=Math.max(m.x,m.y,m.z)||1,M=w/(2*Math.tan(o.fov*Math.PI/360))*1.7;o.near=w/100,o.far=w*100,o.position.set(.8,.55,1).normalize().multiplyScalar(M),o.updateProjectionMatrix();let l=new c(o,n.domElement),p=()=>n.render(a,o);l.addEventListener("change",p);let x=()=>{let r=t.clientWidth,i=t.clientHeight;!r||!i||(n.setSize(r,i,!1),o.aspect=r/i,o.updateProjectionMatrix(),p())},h=new ResizeObserver(x);h.observe(t),x(),t.classList.add("ready"),g(()=>{h.disconnect(),l.dispose(),s.traverse(r=>{r.geometry?.dispose();for(let i of[].concat(r.material||[]))i.dispose()}),n.dispose(),n.forceContextLoss()})}export{P as a,z as b}; diff --git a/dist/chunks/chunk-FE6DSGFD.js b/dist/chunks/chunk-FE6DSGFD.js new file mode 100644 index 0000000..71d17b6 --- /dev/null +++ b/dist/chunks/chunk-FE6DSGFD.js @@ -0,0 +1,3 @@ +var s=new Map;function i(e){return s.has(e)||s.set(e,new Promise((n,o)=>{let t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=n,t.onerror=()=>o(new Error("failed to load "+e)),document.head.appendChild(t)})),s.get(e)}function l(e,n,o){let t=document.createElement("div");t.className="block-error";let d=String(o&&o.message?o.message:o).split(` +`).slice(0,6).join(` +`);t.innerHTML="
",t.firstChild.textContent=n+" failed",t.lastChild.textContent=d,e.dataset?.line&&(t.dataset.line=e.dataset.line),e.replaceWith(t)}var r=new Set,m=e=>r.add(e);function p(){for(let e of r)try{e()}catch{}r.clear()}var a={mode:document.documentElement.dataset.theme||"system"},c={on:!1},h=()=>!c.on&&(a.mode==="dark"||a.mode==="system"&&matchMedia("(prefers-color-scheme: dark)").matches);export{i as a,l as b,m as c,p as d,a as e,c as f,h as g};
diff --git a/dist/chunks/chunk-TNHQAXF3.js b/dist/chunks/chunk-FL2ILWU6.js
similarity index 69%
rename from dist/chunks/chunk-TNHQAXF3.js
rename to dist/chunks/chunk-FL2ILWU6.js
index d0e1f92..863dda8 100644
--- a/dist/chunks/chunk-TNHQAXF3.js
+++ b/dist/chunks/chunk-FL2ILWU6.js
@@ -1,28 +1,29 @@
-import{a as He}from"./chunk-FTY6WLQF.js";import{a as Ge}from"./chunk-NO5BK2IH.js";import{b as Xe,d as Ye}from"./chunk-USGABQGL.js";import{b as qe,c as We,d as Ze}from"./chunk-EMBIDUMY.js";var st=qe((es,ot)=>{var Ne=!0,rt=!1,it=!1;ot.exports=function(e,n){n&&(Ne=!n.enabled,rt=!!n.label,it=!!n.labelAfter),e.core.ruler.after("inline","github-task-lists",function(t){for(var r=t.tokens,i=2;i=0;r--)if(e[r].level===t)return r;return-1}function Wi(e,n){return Ki(e[n])&&Vi(e[n-1])&&Qi(e[n-2])&&eo(e[n])}function Zi(e,n){if(e.children.unshift(Hi(e,n)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),rt)if(it){e.children.pop();var t="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+t+'">',e.children.push(Gi(e.content,t,n))}else e.children.unshift(Xi(n)),e.children.push(Yi(n))}function Hi(e,n){var t=new n("html_inline","",0),r=Ne?' disabled="" ':"";return e.content.indexOf("[ ] ")===0?t.content='':(e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0)&&(t.content=''),t}function Xi(e){var n=new e("html_inline","",0);return n.content="",n}function Gi(e,n,t){var r=new t("html_inline","",0);return r.content='",r.attrs=[{for:n}],r}function Ki(e){return e.type==="inline"}function Vi(e){return e.type==="paragraph_open"}function Qi(e){return e.type==="list_item_open"}function eo(e){return e.content.indexOf("[ ] ")===0||e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0}});var pt=qe((ts,dt)=>{"use strict";dt.exports=function(n,t){var r=3,i="-",o=i.charCodeAt(0),u=i.length;function s(c,l,f,a){var p,d,h,b,k,x,R,_=!1,m=c.bMarks[l]+c.tShift[l],g=c.eMarks[l];if(l!==0||o!==c.src.charCodeAt(0))return!1;for(p=m+1;p<=g;p++)if(i[(p-m)%u]!==c.src[p]){R=p+1;break}if(h=Math.floor((p-m)/u),h=f||c.src.slice(m,g)==="..."||(m=c.bMarks[d]+c.tShift[d],g=c.eMarks[d],m=4)){for(p=m+1;p<=g&&i[(p-m)%u]===c.src[p];p++);if(!(Math.floor((p-m)/u)G,encode:()=>P,format:()=>H,parse:()=>K});var Ke={};function bt(e){let n=Ke[e];if(n)return n;n=Ke[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);n.push(r)}for(let t=0;t=55296&&f<=57343?i+="\uFFFD\uFFFD\uFFFD":i+=String.fromCharCode(f),o+=6;continue}}if((s&248)===240&&o+91114111?i+="\uFFFD\uFFFD\uFFFD\uFFFD":(a-=65536,i+=String.fromCharCode(55296+(a>>10),56320+(a&1023))),o+=9;continue}}i+="\uFFFD"}return i})}ue.defaultChars=";/?:@&=+$,#";ue.componentChars="";var G=ue;var Ve={};function xt(e){let n=Ve[e];if(n)return n;n=Ve[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);/^[0-9a-z]$/i.test(r)?n.push(r):n.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2))}for(let t=0;t"u"&&(t=!0);let r=xt(n),i="";for(let o=0,u=e.length;o=55296&&s<=57343){if(s>=55296&&s<=56319&&o+1=56320&&c<=57343){i+=encodeURIComponent(e[o]+e[o+1]),o++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(e[o])}return i}ce.defaultChars=";/?:@&=+$,-_.!~*'()#";ce.componentChars="-_.!~*'()";var P=ce;function H(e){let n="";return n+=e.protocol||"",n+=e.slashes?"//":"",n+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?n+="["+e.hostname+"]":n+=e.hostname||"",n+=e.port?":"+e.port:"",n+=e.pathname||"",n+=e.search||"",n+=e.hash||"",n}function le(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Rt=/^([a-z0-9.+-]+:)/i,Ct=/:[0-9]*$/,vt=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,At=["<",">",'"',"`"," ","\r",`
-`,"	"],wt=["{","}","|","\\","^","`"].concat(At),Dt=["'"].concat(wt),Qe=["%","/","?",";","#"].concat(Dt),en=["/","?","#"],Et=255,nn=/^[+a-z0-9A-Z_-]{0,63}$/,yt=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,tn={javascript:!0,"javascript:":!0},rn={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ft(e,n){if(e&&e instanceof le)return e;let t=new le;return t.parse(e,n),t}le.prototype.parse=function(e,n){let t,r,i,o=e;if(o=o.trim(),!n&&e.split("#").length===1){let l=vt.exec(o);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let u=Rt.exec(o);if(u&&(u=u[0],t=u.toLowerCase(),this.protocol=u,o=o.substr(u.length)),(n||u||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=o.substr(0,2)==="//",i&&!(u&&tn[u])&&(o=o.substr(2),this.slashes=!0)),!tn[u]&&(i||u&&!rn[u])){let l=-1;for(let h=0;h127?R+="x":R+=x[_];if(!R.match(nn)){let _=h.slice(0,b),m=h.slice(b+1),g=x.match(yt);g&&(_.push(g[1]),m.unshift(g[2])),m.length&&(o=m.join(".")+o),this.hostname=_.join(".");break}}}}this.hostname.length>Et&&(this.hostname=""),d&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=o.indexOf("#");s!==-1&&(this.hash=o.substr(s),o=o.slice(0,s));let c=o.indexOf("?");return c!==-1&&(this.search=o.substr(c),o=o.slice(0,c)),o&&(this.pathname=o),rn[t]&&this.hostname&&!this.pathname&&(this.pathname=""),this};le.prototype.parseHost=function(e){let n=Ct.exec(e);n&&(n=n[0],n!==":"&&(this.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(this.hostname=e)};var K=Ft;var Ae={};We(Ae,{Any:()=>xe,Cc:()=>Re,Cf:()=>Tt,P:()=>V,S:()=>Ce,Z:()=>ve});var xe=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Re=/[\0-\x1F\x7F-\x9F]/,Tt=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,V=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,Ce=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,ve=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var Bt=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function It(e){return e===0||e>=55296&&e<=57343||e>1114111}function on(e){return It(e)?65533:e>=128&&e<=159&&Bt[e-128]||e}function sn(e){return e-1>>>0<127||e-160>>>0<55136?String.fromCharCode(e):String.fromCodePoint(on(e))}var z=(()=>{let e=new Uint8Array(127),n=0;for(let t=33;t<=126;t++)t!==34&&t!==36&&t!==92&&(e[t]=n++);return e})();function un(e,n,t,r,i,o){let s=e.length,c=o*90,l=0,f=()=>{let w=z[e.charCodeAt(l++)];return w=o&&(w=w*91-c+z[e.charCodeAt(l++)]);let T=d[w];if(T<0){let D=h[w],B=D+b[w];for(;D%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37w+vu9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a06Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:96Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2vyRgNj8w)v86Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|icQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf3Ds}KvGB)_6Vyk2sM=6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;RmRm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQRmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.>bU{0j9udv:Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_gg5u-rqJvy'!@9RkQcH(T#=>Ri~@Ri}@2@@=aybb}XjWv0Q~EfEj3vLv;5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=!|l=w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8waiL2b`{QJv*_Ouv2qgjZa&!*UaA=2Wls3cH#T(@Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@Ri{cNu+vlax-!(#a0qa9aY?C9:9au@9Cb]}9cl#U*5;5KqRlR=c>Z,k#u3vWs@u2]krvgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9Awwn;;Rn=c:Z'ARn<=Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(XaRn7Jw0!&>Rn5>Rn9Lunw?&a2!,5ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Shx'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUgA9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8uuq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{NaU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#cB{/T#=ayaL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[gJvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`aRfk=ayb^}4~Ad1#`*@@=aybb{w2@>==KqRlT=c>Z,k#u3vWs@u2]kqReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJRkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}wRn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']ox7gL#TzuwjirRipcon;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJRn1~?rOc:Z&Rn2=w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUgw*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!bRhG<7@C5vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2!a)-g>>hn;return n===we?fn:n}function dn(e){return e-I.ZERO>>>0<=9}function jt(e){return(e|ae)-I.LOWER_A>>>0<=5}function pn(e){return(e|ae)-I.LOWER_A>>>0<=25}function zt(e){return e===I.EQUALS||pn(e)||dn(e)}var ln;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ln||(ln={}));var De;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(De||(De={}));function Jt(e,n,t,r){let i=(n&F.BRANCH_LENGTH)>>7,o=n&F.JUMP_TABLE;if(o){if(i===0)return r===o?t:-1;let c=r-o;if(c>>>0>=i)return-1;let l=e[t+c];return l===0?-1:t+i+l-1&65535}if(i===0)return-1;let u=i+1>>1,s=t+u+i;for(let c=0;c>1)]>>((c&1)<<3)&255;if(f===r){let a=t+u+c;return s+e[a]&65535}if(f>r)return-1}return-1}function an(e,n,t){return t===1?String.fromCharCode(e[n]&F.VALUE_MASK):t===2?String.fromCharCode(e[n+1]):String.fromCharCode(e[n+1],e[n+2])}function Lt(e,n,t){let r=n+1,i=0,o=r;if(r>>0>9)break;i=i*10+s,r+=1}if(r===o)return 0;r1114111&&(i=1114112);let u=r-n;return u>=we&&(fn=u,u=we),u<>7;do{let a=i+1,p=e.charCodeAt(a),d,h;if(p===I.NUM){let b=Lt(e,a,o);d=Mt(b),n&&d>0&&e.charCodeAt(a+d-1)!==I.SEMI&&(d=0),h=d===0?"":sn(b&St)}else if(pn(p)){d=0,h="";let b=p-l,k;if(b>>>0>7;if(w===0){if(e.charCodeAt(m)!==y)break e;k+=1}else{let T=e.charCodeAt(m)-y;if(T>>>0>=w)break e;let D=r[k+1+T];if(D===0)break e;k=k+w+D&65535}if(_=r[k],m+=1,m>=o)break e}if((_&(F.VALUE_LENGTH|F.FLAG13))===F.FLAG13){let y=(_&F.BRANCH_LENGTH)>>7;if(e.charCodeAt(m)!==(_&F.JUMP_TABLE))break;m+=1;let w=y-1,T=k+1,D=0;for(;D+1>8&255)))break e;m+=1,T+=1}if(D>1),_=r[k];continue}let g=_>>>14,v=e.charCodeAt(m);if(g!==0){if(v===I.SEMI){d=m-a+1,h=g===1?String.fromCharCode(_&F.VALUE_MASK):an(r,k,g);break}if(!n&&(_&F.FLAG13)===0&&(d=m-a,x=k,R=g),g===1)break}let A=Jt(r,_,k+(g||1),v);if(A<0)break;k=A,_=r[k],m+=1}if(h===""){let g=_>>>14;g!==0&&!n&&(_&F.FLAG13)===0&&(d=m-a,x=k,R=g),d>0&&(h=an(r,x,R))}}else d=0,h="";d===0||t&&p!==I.NUM&&e.charCodeAt(a+d-1)!==I.SEMI&&a+d=0);return s+e.slice(u)}function he(e){return Nt(e,!0,!1)}var mn;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(mn||(mn={}));var _n;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(_n||(_n={}));var Ot=class{src_Any=xe.source;src_Cc=Re.source;src_Z=ve.source;src_P=V.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,n,t=4){let r=this.escapeRE(e),i=this.escapeRE(n),o=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,u=`${r}${o}{0,1000}${i}`;for(let s=2;s<=t;s++)u=`${r}(?:${o}|${u}){0,1000}${i}`;return u}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){let e="[0-9A-Fa-f]{1,4}",n=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${n}|::(?:${e}:){5}${n}|(?:${e})?::(?:${e}:){4}${n}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${n}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${n}|(?:(?:${e}:){0,3}${e})?::${e}:${n}|(?:(?:${e}:){0,4}${e})?::${n}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uFF5C]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uFF5C])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><\uFF5C]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},Ee={validate:(e,n,t)=>{let r=t.re.get_http_validator();r.lastIndex=n;let i=r.exec(e);return i?i[0].length:0},normalize:(e,n)=>n.normalize(e)},$t={"http:":Ee,"https:":Ee,"ftp:":Ee,"//":{validate:function(e,n,t){let r=t.re.get_relative_proto_validator();r.lastIndex=n;let i=r.exec(e);return i?n>=3&&e[n-3]===":"||n>=3&&e[n-3]==="/"?0:i[0].length:0},normalize:(e,n)=>n.normalize(e)},"mailto:":{validate:function(e,n,t){let r=t.re.get_mailto_validator();r.lastIndex=n;let i=r.exec(e);return i?i[0].length:0},normalize:(e,n)=>n.normalize(e)}},Ut="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",qt="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444";function Wt(){let e=qt.split("|");return Ut.split("|").forEach(n=>{let t=n.indexOf(":"),r=n.slice(0,t);for(let i of n.slice(t+1))e.push(r+i)}),e}var Zt={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Wt(),urlAuth:!1,maxLength:1e4},kn=class{schema;index;lastIndex;raw;text;url;constructor(e,n,t,r){let i=e.slice(t,r);this.schema=n.toLowerCase(),this.index=t,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},gn=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:n,...t}=e;this.__opts__={...Zt,...t},this.__schemas__={...$t},this.re=n||new Ot,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,n=null){if(!n)delete this.__schemas__[e];else{let t={normalize:(r,i)=>i.normalize(r),...n};this.__schemas__[e]=t}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let n,t;for(t=this.re.get_schema_search(),t.lastIndex=0;(n=t.exec(e))!==null;)if(this.testSchemaAt(e,n[2],t.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(t=this.re.get_fuzzy_link_search(),t.lastIndex=0,t.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){let r=this.re.get_fuzzy_mail_host_search(),i=this.re.get_mail_name_validator();for(r.lastIndex=0;(n=r.exec(e))!==null;){let o=e.slice(Math.max(0,n.index-65),n.index);if(i.test(o))return!0}}return!1}testSchemaAt(e,n,t){return this.__schemas__[n.toLowerCase()]?this.__schemas__[n.toLowerCase()].validate(e.slice(0,t+this.__opts__.maxLength),t,this):0}match(e){let n=[],t=this.re.get_schema_search(),r,i,o,u,s,c,l=!1,f=!1,a=!1,p=0;if(!e.length)return null;for(t.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,o=this.re.get_mail_name_validator());;){let d=Math.max(p-1,0);if(i&&o&&!a&&(!s||s.index=p)break;i.lastIndex=p)break;r.lastIndexh.lastIndex))&&(h=u);let b;if(!l)for(;;){if(!c){t.lastIndexh.index)break;let R=c;c=void 0;let _=this.testSchemaAt(e,R.schema,R.lastIndex);if(_){b={schema:R.schema,index:R.index,lastIndex:R.lastIndex+_};break}}let k=b;if((!k||s&&(s.indexk.lastIndex))&&(k=s),(!k||u&&(u.indexk.lastIndex))&&(k=u),!k)break;k===s?s=void 0:k===u&&(u=void 0);let x=new kn(e,k.schema,k.index,k.lastIndex);x.schema?this.__schemas__[x.schema].normalize(x,this):this.normalize(x),n.push(x),p=k.lastIndex}return n.length?n:null}matchAtStart(e){if(!e.length)return null;let n=this.re.get_schema_at_start().exec(e);if(!n)return null;let t=this.testSchemaAt(e,n[2],n[0].length);if(!t)return null;let r=new kn(e,n[2],n.index+n[1].length,n.index+n[0].length+t);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,n=!1){return e=Array.isArray(e)?e:[e],n?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};var Ht=/^xn--/,Xt=/[^\0-\x7F]/,Yt=/[\x2E\u3002\uFF0E\uFF61]/g,Gt={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ye=35,J=Math.floor,Fe=String.fromCharCode;function O(e){throw new RangeError(Gt[e])}function Kt(e,n){let t=[],r=e.length;for(;r--;)t[r]=n(e[r]);return t}function xn(e,n){let t=e.split("@"),r="";t.length>1&&(r=t[0]+"@",e=t[1]),e=e.replace(Yt,".");let i=e.split("."),o=Kt(i,n).join(".");return r+o}function Rn(e){let n=[],t=0,r=e.length;for(;t=55296&&i<=56319&&tString.fromCodePoint(...e),Qt=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},bn=function(e,n){return e+22+75*(e<26)-((n!=0)<<5)},Cn=function(e,n,t){let r=0;for(e=t?J(e/700):e>>1,e+=J(e/n);e>ye*26>>1;r+=36)e=J(e/ye);return J(r+(ye+1)*e/(e+38))},vn=function(e){let n=[],t=e.length,r=0,i=128,o=72,u=e.lastIndexOf("-");u<0&&(u=0);for(let s=0;s=128&&O("not-basic"),n.push(e.charCodeAt(s));for(let s=u>0?u+1:0;s=t&&O("invalid-input");let p=Qt(e.charCodeAt(s++));p>=36&&O("invalid-input"),p>J((2147483647-r)/f)&&O("overflow"),r+=p*f;let d=a<=o?1:a>=o+26?26:a-o;if(pJ(2147483647/h)&&O("overflow"),f*=h}let l=n.length+1;o=Cn(r-c,l,c==0),J(r/l)>2147483647-i&&O("overflow"),i+=J(r/l),r%=l,n.splice(r++,0,i)}return String.fromCodePoint(...n)},An=function(e){let n=[];e=Rn(e);let t=e.length,r=128,i=0,o=72;for(let c of e)c<128&&n.push(Fe(c));let u=n.length,s=u;for(u&&n.push("-");s=r&&fJ((2147483647-i)/l)&&O("overflow"),i+=(c-r)*l,r=c;for(let f of e)if(f2147483647&&O("overflow"),f===r){let a=i;for(let p=36;;p+=36){let d=p<=o?1:p>=o+26?26:p-o;if(a{let t={};for(var r in e)wn(t,r,{get:e[r],enumerable:!0});return n||wn(t,Symbol.toStringTag,{value:"Module"}),t},rr=Jn({arrayReplaceAt:()=>ir,asciiTrim:()=>_e,callable:()=>Ln,escapeHtml:()=>$,escapeRE:()=>pr,fromCodePoint:()=>ee,isMdAsciiPunct:()=>re,isPunctChar:()=>Pn,isPunctCharCode:()=>te,isSpace:()=>E,isValidEntityCode:()=>ze,isWhiteSpace:()=>ne,lib:()=>mr,normalizeReference:()=>me,unescapeAll:()=>X,unescapeMd:()=>cr});function Ln(e){let n=function(...t){return Reflect.construct(e,t,new.target&&new.target!==n?new.target:e)};return Object.defineProperty(n,"name",{value:e.name}),Object.setPrototypeOf(n,e),n.prototype=e.prototype,n}function ir(e,n,t){return[].concat(e.slice(0,n),t,e.slice(n+1))}function ze(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function ee(e){if(e>65535){e-=65536;let n=55296+(e>>10),t=56320+(e&1023);return String.fromCharCode(n,t)}return String.fromCharCode(e)}var Nn=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,or=new RegExp(`${Nn.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),sr=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function ur(e,n){if(n.charCodeAt(0)===35&&sr.test(n)){let r=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return ze(r)?ee(r):e}let t=he(e);return t!==e?t:e}function cr(e){return e.indexOf("\\")<0?e:e.replace(Nn,"$1")}function X(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(or,function(n,t,r){return t||ur(n,r)})}var lr=/[&<>"]/,ar=/[&<>"]/g,hr={"&":"&","<":"<",">":">",'"':"""};function fr(e){return hr[e]}function $(e){return lr.test(e)?e.replace(ar,fr):e}var dr=/[.?*+^$[\]\\(){}|-]/g;function pr(e){return e.replace(dr,"\\$&")}function E(e){switch(e){case 9:case 32:return!0}return!1}function ne(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Pn(e){return V.test(e)||Ce.test(e)}function te(e){return Pn(ee(e))}function re(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function me(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function Dn(e){return e===32||e===9||e===10||e===13}function _e(e){let n=0;for(;n=n&&Dn(e.charCodeAt(t));t--);return e.slice(n,t+1)}var mr={mdurl:be,ucmicro:Ae};function _r(e,n,t){let r,i,o,u,s=e.posMax,c=e.pos;for(e.pos=n+1,r=1;e.pos32))return o;if(r===41){if(u===0)break;u--}i++}return n===i||u!==0||(o.str=X(e.slice(n,i)),o.pos=i,o.ok=!0),o}function gr(e,n,t,r){let i,o=n,u={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)u.str=r.str,u.marker=r.marker;else{if(o>=t)return u;let s=e.charCodeAt(o);if(s!==34&&s!==39&&s!==40)return u;n++,o++,s===40&&(s=41),u.marker=s}for(;okr,parseLinkLabel:()=>_r,parseLinkTitle:()=>gr});function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ie(e)}function xr(e,n){if(ie(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var r=t.call(e,n||"default");if(ie(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Rr(e){var n=xr(e,"string");return ie(n)=="symbol"?n:n+""}function C(e,n,t){return(n=Rr(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var q=class{constructor(e,n,t){C(this,"map",null),C(this,"level",0),C(this,"children",null),C(this,"content",""),C(this,"markup",""),C(this,"info",""),C(this,"block",!1),C(this,"hidden",!1),this.type=e,this.tag=n,this.attrs=null,this.nesting=t,this.meta=null}attrIndex(e){if(!this.attrs)return-1;let n=this.attrs;for(let t=0,r=n.length;t=0&&(t=this.attrs[n][1]),t}attrJoin(e,n){let t=this.attrIndex(e);t<0?this.attrPush([e,n]):this.attrs[t][1]=`${this.attrs[t][1]} ${n}`}},oe=class{constructor(){C(this,"__rules__",[]),C(this,"__cache__",null)}__find__(e){for(let n=0;n{n.enabled&&n.alt.forEach(t=>{t&&e.add(t)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(n=>{n.enabled&&this.__cache__[""].push(n.fn)}),e.forEach(n=>{this.__cache__[n]=[],this.__rules__.forEach(t=>{t.enabled&&t.alt.indexOf(n)>=0&&this.__cache__[n].push(t.fn)})})}at(e,n,t={}){let r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=n,this.__rules__[r].alt=t.alt||[],this.__cache__=null}before(e,n,t,r={}){let i=this.__find__(e);if(i===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(i,0,{name:n,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}after(e,n,t,r={}){let i=this.__find__(e);if(i===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(i+1,0,{name:n,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}push(e,n,t={}){this.__rules__.push({name:e,enabled:!0,fn:n,alt:t.alt||[]}),this.__cache__=null}enable(e,n=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let i=this.__find__(r);if(i<0){if(n)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[i].enabled=!0,t.push(r)}),this.__cache__=null,t}enableOnly(e,n=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(t=>{t.enabled=!1}),this.enable(e,n)}disable(e,n=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let i=this.__find__(r);if(i<0){if(n)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[i].enabled=!1,t.push(r)}),this.__cache__=null,t}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},L={};L.code_inline=function(e,n,t,r,i){let o=e[n];return`${$(o.content)}`};L.code_block=function(e,n,t,r,i){let o=e[n];return`${$(e[n].content)}
-`};L.fence=function(e,n,t,r,i){let o=e[n],u=o.info?X(o.info).trim():"",s="",c="";if(u){let f=u.split(/(\s+)/g);s=f[0],c=f.slice(2).join("")}let l;if(t.highlight?l=t.highlight(o.content,s,c)||$(o.content):l=$(o.content),l.indexOf("${l}
+import{a as Xe}from"./chunk-FTY6WLQF.js";import{a as Ke}from"./chunk-A7SFTXEQ.js";import{b as Ye,d as Ge}from"./chunk-FE6DSGFD.js";import{b as We,c as Ze,d as He}from"./chunk-EMBIDUMY.js";var ut=We((os,st)=>{var Ne=!0,it=!1,ot=!1;st.exports=function(e,n){n&&(Ne=!n.enabled,it=!!n.label,ot=!!n.labelAfter),e.core.ruler.after("inline","github-task-lists",function(t){for(var r=t.tokens,i=2;i=0;r--)if(e[r].level===t)return r;return-1}function Zi(e,n){return Vi(e[n])&&Qi(e[n-1])&&eo(e[n-2])&&no(e[n])}function Hi(e,n){if(e.children.unshift(Xi(e,n)),e.children[1].content=e.children[1].content.slice(3),e.content=e.content.slice(3),it)if(ot){e.children.pop();var t="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);e.children[0].content=e.children[0].content.slice(0,-1)+' id="'+t+'">',e.children.push(Ki(e.content,t,n))}else e.children.unshift(Yi(n)),e.children.push(Gi(n))}function Xi(e,n){var t=new n("html_inline","",0),r=Ne?' disabled="" ':"";return e.content.indexOf("[ ] ")===0?t.content='':(e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0)&&(t.content=''),t}function Yi(e){var n=new e("html_inline","",0);return n.content="",n}function Ki(e,n,t){var r=new t("html_inline","",0);return r.content='",r.attrs=[{for:n}],r}function Vi(e){return e.type==="inline"}function Qi(e){return e.type==="paragraph_open"}function eo(e){return e.type==="list_item_open"}function no(e){return e.content.indexOf("[ ] ")===0||e.content.indexOf("[x] ")===0||e.content.indexOf("[X] ")===0}});var mt=We((us,pt)=>{"use strict";pt.exports=function(n,t){var r=3,i="-",o=i.charCodeAt(0),u=i.length;function s(c,l,h,a){var p,d,f,b,k,x,R,_=!1,m=c.bMarks[l]+c.tShift[l],g=c.eMarks[l];if(l!==0||o!==c.src.charCodeAt(0))return!1;for(p=m+1;p<=g;p++)if(i[(p-m)%u]!==c.src[p]){R=p+1;break}if(f=Math.floor((p-m)/u),f=h||c.src.slice(m,g)==="..."||(m=c.bMarks[d]+c.tShift[d],g=c.eMarks[d],m=4)){for(p=m+1;p<=g&&i[(p-m)%u]===c.src[p];p++);if(!(Math.floor((p-m)/u)G,encode:()=>P,format:()=>H,parse:()=>K});var Ve={};function xt(e){let n=Ve[e];if(n)return n;n=Ve[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);n.push(r)}for(let t=0;t=55296&&h<=57343?i+="\uFFFD\uFFFD\uFFFD":i+=String.fromCharCode(h),o+=6;continue}}if((s&248)===240&&o+91114111?i+="\uFFFD\uFFFD\uFFFD\uFFFD":(a-=65536,i+=String.fromCharCode(55296+(a>>10),56320+(a&1023))),o+=9;continue}}i+="\uFFFD"}return i})}ue.defaultChars=";/?:@&=+$,#";ue.componentChars="";var G=ue;var Qe={};function Rt(e){let n=Qe[e];if(n)return n;n=Qe[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);/^[0-9a-z]$/i.test(r)?n.push(r):n.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2))}for(let t=0;t"u"&&(t=!0);let r=Rt(n),i="";for(let o=0,u=e.length;o=55296&&s<=57343){if(s>=55296&&s<=56319&&o+1=56320&&c<=57343){i+=encodeURIComponent(e[o]+e[o+1]),o++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(e[o])}return i}ce.defaultChars=";/?:@&=+$,-_.!~*'()#";ce.componentChars="-_.!~*'()";var P=ce;function H(e){let n="";return n+=e.protocol||"",n+=e.slashes?"//":"",n+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?n+="["+e.hostname+"]":n+=e.hostname||"",n+=e.port?":"+e.port:"",n+=e.pathname||"",n+=e.search||"",n+=e.hash||"",n}function le(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Ct=/^([a-z0-9.+-]+:)/i,vt=/:[0-9]*$/,At=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,wt=["<",">",'"',"`"," ","\r",`
+`,"	"],Dt=["{","}","|","\\","^","`"].concat(wt),Et=["'"].concat(Dt),en=["%","/","?",";","#"].concat(Et),nn=["/","?","#"],yt=255,tn=/^[+a-z0-9A-Z_-]{0,63}$/,Ft=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,rn={javascript:!0,"javascript:":!0},on={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Tt(e,n){if(e&&e instanceof le)return e;let t=new le;return t.parse(e,n),t}le.prototype.parse=function(e,n){let t,r,i,o=e;if(o=o.trim(),!n&&e.split("#").length===1){let l=At.exec(o);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let u=Ct.exec(o);if(u&&(u=u[0],t=u.toLowerCase(),this.protocol=u,o=o.substr(u.length)),(n||u||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=o.substr(0,2)==="//",i&&!(u&&rn[u])&&(o=o.substr(2),this.slashes=!0)),!rn[u]&&(i||u&&!on[u])){let l=-1;for(let f=0;f127?R+="x":R+=x[_];if(!R.match(tn)){let _=f.slice(0,b),m=f.slice(b+1),g=x.match(Ft);g&&(_.push(g[1]),m.unshift(g[2])),m.length&&(o=m.join(".")+o),this.hostname=_.join(".");break}}}}this.hostname.length>yt&&(this.hostname=""),d&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=o.indexOf("#");s!==-1&&(this.hash=o.substr(s),o=o.slice(0,s));let c=o.indexOf("?");return c!==-1&&(this.search=o.substr(c),o=o.slice(0,c)),o&&(this.pathname=o),on[t]&&this.hostname&&!this.pathname&&(this.pathname=""),this};le.prototype.parseHost=function(e){let n=vt.exec(e);n&&(n=n[0],n!==":"&&(this.port=n.substr(1)),e=e.substr(0,e.length-n.length)),e&&(this.hostname=e)};var K=Tt;var Ae={};Ze(Ae,{Any:()=>xe,Cc:()=>Re,Cf:()=>Bt,P:()=>V,S:()=>Ce,Z:()=>ve});var xe=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Re=/[\0-\x1F\x7F-\x9F]/,Bt=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,V=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,Ce=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,ve=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var It=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function St(e){return e===0||e>=55296&&e<=57343||e>1114111}function sn(e){return St(e)?65533:e>=128&&e<=159&&It[e-128]||e}function un(e){return e-1>>>0<127||e-160>>>0<55136?String.fromCharCode(e):String.fromCodePoint(sn(e))}var z=(()=>{let e=new Uint8Array(127),n=0;for(let t=33;t<=126;t++)t!==34&&t!==36&&t!==92&&(e[t]=n++);return e})();function cn(e,n,t,r,i,o){let s=e.length,c=o*90,l=0,h=()=>{let w=z[e.charCodeAt(l++)];return w=o&&(w=w*91-c+z[e.charCodeAt(l++)]);let T=d[w];if(T<0){let D=f[w],B=D+b[w];for(;D%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37w+vu9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a06Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:96Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2vyRgNj8w)v86Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|icQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf3Ds}KvGB)_6Vyk2sM=6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;RmRm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQRmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.>bU{0j9udv:Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_gg5u-rqJvy'!@9RkQcH(T#=>Ri~@Ri}@2@@=aybb}XjWv0Q~EfEj3vLv;5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=!|l=w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8waiL2b`{QJv*_Ouv2qgjZa&!*UaA=2Wls3cH#T(@Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@Ri{cNu+vlax-!(#a0qa9aY?C9:9au@9Cb]}9cl#U*5;5KqRlR=c>Z,k#u3vWs@u2]krvgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9Awwn;;Rn=c:Z'ARn<=Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(XaRn7Jw0!&>Rn5>Rn9Lunw?&a2!,5ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Shx'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUgA9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8uuq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{NaU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#cB{/T#=ayaL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[gJvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`aRfk=ayb^}4~Ad1#`*@@=aybb{w2@>==KqRlT=c>Z,k#u3vWs@u2]kqReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJRkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}wRn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']ox7gL#TzuwjirRipcon;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJRn1~?rOc:Z&Rn2=w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUgw*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!bRhG<7@C5vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2!a)-g>>hn;return n===we?dn:n}function pn(e){return e-I.ZERO>>>0<=9}function zt(e){return(e|ae)-I.LOWER_A>>>0<=5}function mn(e){return(e|ae)-I.LOWER_A>>>0<=25}function Jt(e){return e===I.EQUALS||mn(e)||pn(e)}var an;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(an||(an={}));var De;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(De||(De={}));function Lt(e,n,t,r){let i=(n&F.BRANCH_LENGTH)>>7,o=n&F.JUMP_TABLE;if(o){if(i===0)return r===o?t:-1;let c=r-o;if(c>>>0>=i)return-1;let l=e[t+c];return l===0?-1:t+i+l-1&65535}if(i===0)return-1;let u=i+1>>1,s=t+u+i;for(let c=0;c>1)]>>((c&1)<<3)&255;if(h===r){let a=t+u+c;return s+e[a]&65535}if(h>r)return-1}return-1}function fn(e,n,t){return t===1?String.fromCharCode(e[n]&F.VALUE_MASK):t===2?String.fromCharCode(e[n+1]):String.fromCharCode(e[n+1],e[n+2])}function Nt(e,n,t){let r=n+1,i=0,o=r;if(r>>0>9)break;i=i*10+s,r+=1}if(r===o)return 0;r1114111&&(i=1114112);let u=r-n;return u>=we&&(dn=u,u=we),u<>7;do{let a=i+1,p=e.charCodeAt(a),d,f;if(p===I.NUM){let b=Nt(e,a,o);d=jt(b),n&&d>0&&e.charCodeAt(a+d-1)!==I.SEMI&&(d=0),f=d===0?"":un(b&Mt)}else if(mn(p)){d=0,f="";let b=p-l,k;if(b>>>0>7;if(w===0){if(e.charCodeAt(m)!==y)break e;k+=1}else{let T=e.charCodeAt(m)-y;if(T>>>0>=w)break e;let D=r[k+1+T];if(D===0)break e;k=k+w+D&65535}if(_=r[k],m+=1,m>=o)break e}if((_&(F.VALUE_LENGTH|F.FLAG13))===F.FLAG13){let y=(_&F.BRANCH_LENGTH)>>7;if(e.charCodeAt(m)!==(_&F.JUMP_TABLE))break;m+=1;let w=y-1,T=k+1,D=0;for(;D+1>8&255)))break e;m+=1,T+=1}if(D>1),_=r[k];continue}let g=_>>>14,v=e.charCodeAt(m);if(g!==0){if(v===I.SEMI){d=m-a+1,f=g===1?String.fromCharCode(_&F.VALUE_MASK):fn(r,k,g);break}if(!n&&(_&F.FLAG13)===0&&(d=m-a,x=k,R=g),g===1)break}let A=Lt(r,_,k+(g||1),v);if(A<0)break;k=A,_=r[k],m+=1}if(f===""){let g=_>>>14;g!==0&&!n&&(_&F.FLAG13)===0&&(d=m-a,x=k,R=g),d>0&&(f=fn(r,x,R))}}else d=0,f="";d===0||t&&p!==I.NUM&&e.charCodeAt(a+d-1)!==I.SEMI&&a+d=0);return s+e.slice(u)}function fe(e){return Pt(e,!0,!1)}var _n;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(_n||(_n={}));var kn;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(kn||(kn={}));var $t=class{src_Any=xe.source;src_Cc=Re.source;src_Z=ve.source;src_P=V.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,n,t=4){let r=this.escapeRE(e),i=this.escapeRE(n),o=`(?:(?!${this.src_ZCc}|${r}|${i}).)`,u=`${r}${o}{0,1000}${i}`;for(let s=2;s<=t;s++)u=`${r}(?:${o}|${u}){0,1000}${i}`;return u}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){let e="[0-9A-Fa-f]{1,4}",n=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${n}|::(?:${e}:){5}${n}|(?:${e})?::(?:${e}:){4}${n}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${n}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${n}|(?:(?:${e}:){0,3}${e})?::${e}:${n}|(?:(?:${e}:){0,4}${e})?::${n}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uFF5C]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uFF5C])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><\uFF5C]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},Ee={validate:(e,n,t)=>{let r=t.re.get_http_validator();r.lastIndex=n;let i=r.exec(e);return i?i[0].length:0},normalize:(e,n)=>n.normalize(e)},Ut={"http:":Ee,"https:":Ee,"ftp:":Ee,"//":{validate:function(e,n,t){let r=t.re.get_relative_proto_validator();r.lastIndex=n;let i=r.exec(e);return i?n>=3&&e[n-3]===":"||n>=3&&e[n-3]==="/"?0:i[0].length:0},normalize:(e,n)=>n.normalize(e)},"mailto:":{validate:function(e,n,t){let r=t.re.get_mailto_validator();r.lastIndex=n;let i=r.exec(e);return i?i[0].length:0},normalize:(e,n)=>n.normalize(e)}},qt="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",Wt="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444";function Zt(){let e=Wt.split("|");return qt.split("|").forEach(n=>{let t=n.indexOf(":"),r=n.slice(0,t);for(let i of n.slice(t+1))e.push(r+i)}),e}var Ht={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:Zt(),urlAuth:!1,maxLength:1e4},gn=class{schema;index;lastIndex;raw;text;url;constructor(e,n,t,r){let i=e.slice(t,r);this.schema=n.toLowerCase(),this.index=t,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}},bn=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:n,...t}=e;this.__opts__={...Ht,...t},this.__schemas__={...Ut},this.re=n||new $t,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,n=null){if(!n)delete this.__schemas__[e];else{let t={normalize:(r,i)=>i.normalize(r),...n};this.__schemas__[e]=t}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let n,t;for(t=this.re.get_schema_search(),t.lastIndex=0;(n=t.exec(e))!==null;)if(this.testSchemaAt(e,n[2],t.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(t=this.re.get_fuzzy_link_search(),t.lastIndex=0,t.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){let r=this.re.get_fuzzy_mail_host_search(),i=this.re.get_mail_name_validator();for(r.lastIndex=0;(n=r.exec(e))!==null;){let o=e.slice(Math.max(0,n.index-65),n.index);if(i.test(o))return!0}}return!1}testSchemaAt(e,n,t){return this.__schemas__[n.toLowerCase()]?this.__schemas__[n.toLowerCase()].validate(e.slice(0,t+this.__opts__.maxLength),t,this):0}match(e){let n=[],t=this.re.get_schema_search(),r,i,o,u,s,c,l=!1,h=!1,a=!1,p=0;if(!e.length)return null;for(t.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(i=this.re.get_fuzzy_mail_host_search(),i.lastIndex=0,o=this.re.get_mail_name_validator());;){let d=Math.max(p-1,0);if(i&&o&&!a&&(!s||s.index=p)break;i.lastIndex=p)break;r.lastIndexf.lastIndex))&&(f=u);let b;if(!l)for(;;){if(!c){t.lastIndexf.index)break;let R=c;c=void 0;let _=this.testSchemaAt(e,R.schema,R.lastIndex);if(_){b={schema:R.schema,index:R.index,lastIndex:R.lastIndex+_};break}}let k=b;if((!k||s&&(s.indexk.lastIndex))&&(k=s),(!k||u&&(u.indexk.lastIndex))&&(k=u),!k)break;k===s?s=void 0:k===u&&(u=void 0);let x=new gn(e,k.schema,k.index,k.lastIndex);x.schema?this.__schemas__[x.schema].normalize(x,this):this.normalize(x),n.push(x),p=k.lastIndex}return n.length?n:null}matchAtStart(e){if(!e.length)return null;let n=this.re.get_schema_at_start().exec(e);if(!n)return null;let t=this.testSchemaAt(e,n[2],n[0].length);if(!t)return null;let r=new gn(e,n[2],n.index+n[1].length,n.index+n[0].length+t);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,n=!1){return e=Array.isArray(e)?e:[e],n?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};var Xt=/^xn--/,Yt=/[^\0-\x7F]/,Gt=/[\x2E\u3002\uFF0E\uFF61]/g,Kt={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ye=35,J=Math.floor,Fe=String.fromCharCode;function O(e){throw new RangeError(Kt[e])}function Vt(e,n){let t=[],r=e.length;for(;r--;)t[r]=n(e[r]);return t}function Rn(e,n){let t=e.split("@"),r="";t.length>1&&(r=t[0]+"@",e=t[1]),e=e.replace(Gt,".");let i=e.split("."),o=Vt(i,n).join(".");return r+o}function Cn(e){let n=[],t=0,r=e.length;for(;t=55296&&i<=56319&&tString.fromCodePoint(...e),er=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},xn=function(e,n){return e+22+75*(e<26)-((n!=0)<<5)},vn=function(e,n,t){let r=0;for(e=t?J(e/700):e>>1,e+=J(e/n);e>ye*26>>1;r+=36)e=J(e/ye);return J(r+(ye+1)*e/(e+38))},An=function(e){let n=[],t=e.length,r=0,i=128,o=72,u=e.lastIndexOf("-");u<0&&(u=0);for(let s=0;s=128&&O("not-basic"),n.push(e.charCodeAt(s));for(let s=u>0?u+1:0;s=t&&O("invalid-input");let p=er(e.charCodeAt(s++));p>=36&&O("invalid-input"),p>J((2147483647-r)/h)&&O("overflow"),r+=p*h;let d=a<=o?1:a>=o+26?26:a-o;if(pJ(2147483647/f)&&O("overflow"),h*=f}let l=n.length+1;o=vn(r-c,l,c==0),J(r/l)>2147483647-i&&O("overflow"),i+=J(r/l),r%=l,n.splice(r++,0,i)}return String.fromCodePoint(...n)},wn=function(e){let n=[];e=Cn(e);let t=e.length,r=128,i=0,o=72;for(let c of e)c<128&&n.push(Fe(c));let u=n.length,s=u;for(u&&n.push("-");s=r&&hJ((2147483647-i)/l)&&O("overflow"),i+=(c-r)*l,r=c;for(let h of e)if(h2147483647&&O("overflow"),h===r){let a=i;for(let p=36;;p+=36){let d=p<=o?1:p>=o+26?26:p-o;if(a{let t={};for(var r in e)Dn(t,r,{get:e[r],enumerable:!0});return n||Dn(t,Symbol.toStringTag,{value:"Module"}),t},ir=Ln({arrayReplaceAt:()=>or,asciiTrim:()=>_e,callable:()=>Nn,escapeHtml:()=>$,escapeRE:()=>mr,fromCodePoint:()=>ee,isMdAsciiPunct:()=>re,isPunctChar:()=>On,isPunctCharCode:()=>te,isSpace:()=>E,isValidEntityCode:()=>ze,isWhiteSpace:()=>ne,lib:()=>_r,normalizeReference:()=>me,unescapeAll:()=>X,unescapeMd:()=>lr});function Nn(e){let n=function(...t){return Reflect.construct(e,t,new.target&&new.target!==n?new.target:e)};return Object.defineProperty(n,"name",{value:e.name}),Object.setPrototypeOf(n,e),n.prototype=e.prototype,n}function or(e,n,t){return[].concat(e.slice(0,n),t,e.slice(n+1))}function ze(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function ee(e){if(e>65535){e-=65536;let n=55296+(e>>10),t=56320+(e&1023);return String.fromCharCode(n,t)}return String.fromCharCode(e)}var Pn=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,sr=new RegExp(`${Pn.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),ur=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function cr(e,n){if(n.charCodeAt(0)===35&&ur.test(n)){let r=n[1].toLowerCase()==="x"?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return ze(r)?ee(r):e}let t=fe(e);return t!==e?t:e}function lr(e){return e.indexOf("\\")<0?e:e.replace(Pn,"$1")}function X(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(sr,function(n,t,r){return t||cr(n,r)})}var ar=/[&<>"]/,fr=/[&<>"]/g,hr={"&":"&","<":"<",">":">",'"':"""};function dr(e){return hr[e]}function $(e){return ar.test(e)?e.replace(fr,dr):e}var pr=/[.?*+^$[\]\\(){}|-]/g;function mr(e){return e.replace(pr,"\\$&")}function E(e){switch(e){case 9:case 32:return!0}return!1}function ne(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function On(e){return V.test(e)||Ce.test(e)}function te(e){return On(ee(e))}function re(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function me(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function En(e){return e===32||e===9||e===10||e===13}function _e(e){let n=0;for(;n=n&&En(e.charCodeAt(t));t--);return e.slice(n,t+1)}var _r={mdurl:be,ucmicro:Ae};function kr(e,n,t){let r,i,o,u,s=e.posMax,c=e.pos;for(e.pos=n+1,r=1;e.pos32))return o;if(r===41){if(u===0)break;u--}i++}return n===i||u!==0||(o.str=X(e.slice(n,i)),o.pos=i,o.ok=!0),o}function br(e,n,t,r){let i,o=n,u={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)u.str=r.str,u.marker=r.marker;else{if(o>=t)return u;let s=e.charCodeAt(o);if(s!==34&&s!==39&&s!==40)return u;n++,o++,s===40&&(s=41),u.marker=s}for(;ogr,parseLinkLabel:()=>kr,parseLinkTitle:()=>br});function ie(e){"@babel/helpers - typeof";return ie=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ie(e)}function Rr(e,n){if(ie(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var r=t.call(e,n||"default");if(ie(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Cr(e){var n=Rr(e,"string");return ie(n)=="symbol"?n:n+""}function C(e,n,t){return(n=Cr(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var q=class{constructor(e,n,t){C(this,"map",null),C(this,"level",0),C(this,"children",null),C(this,"content",""),C(this,"markup",""),C(this,"info",""),C(this,"block",!1),C(this,"hidden",!1),this.type=e,this.tag=n,this.attrs=null,this.nesting=t,this.meta=null}attrIndex(e){if(!this.attrs)return-1;let n=this.attrs;for(let t=0,r=n.length;t=0&&(t=this.attrs[n][1]),t}attrJoin(e,n){let t=this.attrIndex(e);t<0?this.attrPush([e,n]):this.attrs[t][1]=`${this.attrs[t][1]} ${n}`}},oe=class{constructor(){C(this,"__rules__",[]),C(this,"__cache__",null)}__find__(e){for(let n=0;n{n.enabled&&n.alt.forEach(t=>{t&&e.add(t)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(n=>{n.enabled&&this.__cache__[""].push(n.fn)}),e.forEach(n=>{this.__cache__[n]=[],this.__rules__.forEach(t=>{t.enabled&&t.alt.indexOf(n)>=0&&this.__cache__[n].push(t.fn)})})}at(e,n,t={}){let r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=n,this.__rules__[r].alt=t.alt||[],this.__cache__=null}before(e,n,t,r={}){let i=this.__find__(e);if(i===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(i,0,{name:n,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}after(e,n,t,r={}){let i=this.__find__(e);if(i===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(i+1,0,{name:n,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}push(e,n,t={}){this.__rules__.push({name:e,enabled:!0,fn:n,alt:t.alt||[]}),this.__cache__=null}enable(e,n=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let i=this.__find__(r);if(i<0){if(n)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[i].enabled=!0,t.push(r)}),this.__cache__=null,t}enableOnly(e,n=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(t=>{t.enabled=!1}),this.enable(e,n)}disable(e,n=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let i=this.__find__(r);if(i<0){if(n)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[i].enabled=!1,t.push(r)}),this.__cache__=null,t}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},L={};L.code_inline=function(e,n,t,r,i){let o=e[n];return`${$(o.content)}`};L.code_block=function(e,n,t,r,i){let o=e[n];return`${$(e[n].content)}
+`};L.fence=function(e,n,t,r,i){let o=e[n],u=o.info?X(o.info).trim():"",s="",c="";if(u){let h=u.split(/(\s+)/g);s=h[0],c=h.slice(2).join("")}let l;if(t.highlight?l=t.highlight(o.content,s,c)||$(o.content):l=$(o.content),l.indexOf("${l}
 `}return`
${l}
`};L.image=function(e,n,t,r,i){let o=e[n];return o.attrs[o.attrIndex("alt")][1]=i.renderInlineAsText(o.children,t,r),i.renderToken(e,n,t)};L.hardbreak=function(e,n,t){return t.xhtmlOut?`
`:`
`};L.softbreak=function(e,n,t){return t.breaks?t.xhtmlOut?`
`:`
`:` -`};L.text=function(e,n){return $(e[n].content)};L.html_block=function(e,n){return e[n].content};L.html_inline=function(e,n){return e[n].content};var On=class{constructor(){C(this,"rules",Object.assign({},L))}renderAttrs(e){let n,t,r;if(!e.attrs)return"";for(r="",n=0,t=e.attrs.length;n=0&&e[o].hidden&&e[o].nesting===0;)o--;r.block&&r.nesting!==-1&&o>=0&&e[o].hidden&&e[o].nesting===-1&&(i+=` +`};L.text=function(e,n){return $(e[n].content)};L.html_block=function(e,n){return e[n].content};L.html_inline=function(e,n){return e[n].content};var $n=class{constructor(){C(this,"rules",Object.assign({},L))}renderAttrs(e){let n,t,r;if(!e.attrs)return"";for(r="",n=0,t=e.attrs.length;n=0&&e[o].hidden&&e[o].nesting===0;)o--;r.block&&r.nesting!==-1&&o>=0&&e[o].hidden&&e[o].nesting===-1&&(i+=` `),i+=(r.nesting===-1?" `:">",i}renderInline(e,n,t){let r="",i=this.rules;for(let o=0,u=e.length;o\s]/i.test(e)}function Fr(e){return/^<\/a\s*>/i.test(e)}function Tr(e){let n=e.tokens;if(e.md.options.linkify)for(let t=0,r=n.length;t=0;s--){let c=i[s];if(c.type==="link_close"){for(s--;i[s].level!==c.level&&i[s].type!=="link_open";)s--;continue}if(c.type==="html_inline"&&(yr(c.content)&&u>0&&u--,Fr(c.content)&&u++),!(u>0)&&c.type==="text"&&e.md.linkify.test(c.content)){let l=c.content,f=e.md.linkify.match(l),a=[],p=c.level,d=0;f.length>0&&f[0].index===0&&s>0&&i[s-1].type==="text_special"&&(f=f.slice(1));for(let h=0;hd){let v=new e.Token("text","",0);v.content=l.slice(d,R),v.level=p,a.push(v)}let _=new e.Token("link_open","a",1);_.attrs=[["href",k]],_.level=p++,_.markup="linkify",_.info="auto",a.push(_);let m=new e.Token("text","",0);m.content=x,m.level=p,a.push(m);let g=new e.Token("link_close","a",-1);g.level=--p,g.markup="linkify",g.info="auto",a.push(g),d=f[h].lastIndex}if(d0){let s=i.length;for(let a of o)s+=a.nodes.length-1;let c=new Array(s),l=0,f=0;o.reverse();for(let a=0;a=0;t--){let r=e[t];r.type==="text"&&!n&&(r.content=r.content.replace(Ir,Mr)),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}}function zr(e){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r.type==="text"&&!n&&Un.test(r.content)&&(r.content=r.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1\u2014").replace(/(^|\s)--(?=\s|$)/gm,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1\u2013")),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}}function Jr(e){let n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(Br.test(e.tokens[n].content)&&jr(e.tokens[n].children),Un.test(e.tokens[n].content)&&zr(e.tokens[n].children))}var Lr=/['"]/,En=/['"]/g,yn="\u2019",Nr=1e3;function Fn(e,n,t){for(;e.length>t;){let r=e.pop();r.isSingleQuote?n.single=r.prevSameQuoteIdx:n.double=r.prevSameQuoteIdx}}function fe(e,n,t,r){e[n]||(e[n]=[]),e[n].push({pos:t,ch:r})}function Pr(e,n){let t="",r=0;n.sort((i,o)=>i.pos-o.pos);for(let i=0;i=0&&!(r[t].level<=c);t--);if(Fn(r,i,t+1),s.type!=="text")continue;let l=s.content,f=0,a=l.length;e:for(;f=0)k=l.charCodeAt(p.index-1);else for(t=u-1;t>=0&&!(e[t].type==="softbreak"||e[t].type==="hardbreak");t--)if(e[t].content){k=e[t].content.charCodeAt(e[t].content.length-1);break}let x=32;if(f=48&&k<=57&&(h=d=!1),d&&h&&(d=R,h=_),!d&&!h){b&&fe(o,u,p.index,yn);continue}if(h&&(t=b?i.single:i.double,t>=0&&r[t].level===c)){let v=r[t],A,y;b?(A=n.md.options.quotes[2],y=n.md.options.quotes[3]):(A=n.md.options.quotes[0],y=n.md.options.quotes[1]),fe(o,u,p.index,y),fe(o,v.tokenIdx,v.contentPos,A),Fn(r,i,t);continue e}if(d){if(r.length>=Nr)return;r.push({tokenIdx:u,contentPos:p.index,isSingleQuote:b,level:c,prevSameQuoteIdx:b?i.single:i.double}),b?i.single=r.length-1:i.double=r.length-1}else h&&b&&fe(o,u,p.index,yn)}}Object.keys(o).forEach(function(u){let s=Number(u);e[s].content=Pr(e[s].content,o[u])})}function $r(e){if(e.md.options.typographer)for(let n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!Lr.test(e.tokens[n].content)||Or(e.tokens[n].children,e)}function Ur(e){let n,t,r=e.length;for(n=0;n0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let n=this.lineMax;en;)if(!E(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,n){for(let t=this.src.length;et;)if(n!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,n,t,r){if(e>=n)return"";let i=new Array(n-e);for(let o=0,u=e;ut?i[o]=new Array(s-t+1).join(" ")+this.src.slice(l,f):i[o]=this.src.slice(l,f)}return i.join("")}},Wr=65536;function Ie(e,n){let t=e.bMarks[n]+e.tShift[n],r=e.eMarks[n];return e.src.slice(t,r)}function Tn(e){let n=[],t=e.length,r=0,i=e.charCodeAt(r),o=!1,u=0,s="";for(;rt)return!1;let i=n+1;if(e.sCount[i]=4)return!1;let o=e.bMarks[i]+e.tShift[i];if(o>=e.eMarks[i])return!1;let u=e.src.charCodeAt(o++);if(u!==124&&u!==45&&u!==58||o>=e.eMarks[i])return!1;let s=e.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58&&!E(s)||u===45&&E(s))return!1;for(;o=4)return!1;l=Tn(c),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let a=l.length;if(a===0||a!==f.length)return!1;if(r)return!0;let p=e.parentType;e.parentType="table";let d=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),b=[n,0];h.map=b;let k=e.push("thead_open","thead",1);k.map=[n,n+1];let x=e.push("tr_open","tr",1);x.map=[n,n+1];for(let m=0;m=4||(l=Tn(c),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),_+=a-l.length,_>Wr))break;if(i===n+2){let v=e.push("tbody_open","tbody",1);v.map=R=[n+2,0]}let g=e.push("tr_open","tr",1);g.map=[i,i+1];for(let v=0;v=4){r++,i=r;continue}break}e.line=i;let o=e.push("code_block","code",0);return o.content=e.getLines(n,i,4+e.blkIndent,!1)+` -`,o.map=[n,e.line],!0}function Xr(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||i+3>o)return!1;let u=e.src.charCodeAt(i);if(u!==126&&u!==96)return!1;let s=i;i=e.skipChars(i,u);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),f=e.src.slice(i,o);if(u===96&&f.indexOf(String.fromCharCode(u))>=0)return!1;if(r)return!0;let a=n,p=!1;for(;a++,!(a>=t||(i=s=e.bMarks[a]+e.tShift[a],o=e.eMarks[a],i=4)&&(i=e.skipChars(i,u),!(i-s=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],f=[],a=e.md.block.ruler.getRules("blockquote"),p=e.parentType;e.parentType="blockquote";let d=!1,h;for(h=n;h=o)break;if(e.src.charCodeAt(i++)===62&&!_){let g=e.sCount[h]+1,v,A;e.src.charCodeAt(i)===32?(i++,g++,A=!1,v=!0):e.src.charCodeAt(i)===9?(v=!0,(e.bsCount[h]+g)%4===3?(i++,g++,A=!1):A=!0):v=!1;let y=g;for(s.push(e.bMarks[h]),e.bMarks[h]=i;i=o,c.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(v?1:0),l.push(e.sCount[h]),e.sCount[h]=y-g,f.push(e.tShift[h]),e.tShift[h]=i-e.bMarks[h];continue}if(d)break;let m=!1;for(let g=0,v=a.length;g";let x=[n,0];k.map=x,e.md.block.tokenize(e,n,h);let R=e.push("blockquote_close","blockquote",-1);R.markup=">",e.lineMax=u,e.parentType=p,x[1]=e.line;for(let _=0;_=4)return!1;let o=e.bMarks[n]+e.tShift[n],u=e.src.charCodeAt(o++);if(u!==42&&u!==45&&u!==95)return!1;let s=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-t>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]=e.blkIndent&&(f=!0);let a,p,d;if((d=In(e,c))>=0){if(a=!0,u=e.bMarks[c]+e.tShift[c],p=Number(e.src.slice(u,d-1)),f&&p!==1)return!1}else if((d=Bn(e,c))>=0)a=!1;else return!1;if(f&&e.skipSpaces(d)>=e.eMarks[c])return!1;if(r)return!0;let h=e.src.charCodeAt(d-1),b=e.tokens.length;a?(s=e.push("ordered_list_open","ol",1),p!==1&&(s.attrs=[["start",p]])):s=e.push("bullet_list_open","ul",1);let k=[c,0];s.map=k,s.markup=String.fromCharCode(h);let x=!1,R=e.md.block.ruler.getRules("list"),_=e.parentType;for(e.parentType="list";c=i?A=1:A=g-m,A>4&&(A=1);let y=m+A;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(h);let w=[c,0];s.map=w,a&&(s.info=e.src.slice(u,d-1));let T=e.tight,D=e.tShift[c],B=e.sCount[c],j=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[c]=v-e.bMarks[c],e.sCount[c]=g,v>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,c,t),(!e.tight||x)&&(l=!1),x=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=j,e.tShift[c]=D,e.sCount[c]=B,e.tight=T,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(h),c=e.line,w[1]=c,c>=t||e.sCount[c]=4)break;let M=!1;for(let S=0,gt=R.length;S56319)continue;let i=e.charCodeAt(t+1);i>=56320&&i<=57343&&(n--,t++)}return n}function Q(e,n){return Math.min(e.eMarks[n]+1,e.src.length)}function de(e,n){let t=e.lineMax;if(n>=t||e.isEmpty(n))return-1;let r=!1;if(e.sCount[n]-e.blkIndent>3&&(r=!0),e.sCount[n]<0&&(r=!0),!r){let i=e.md.block.ruler.getRules("reference"),o=e.parentType;e.parentType="reference";let u=!1;for(let s=0,c=i.length;s=4||i.charCodeAt(o)!==91)return!1;let s=Q(e,n),c="",l=-1,f=++o;for(;oSe*2)return!1;let v=i.charCodeAt(o);if(v===91)return!1;if(v===93){l=o;break}if(v===92&&(v=i.charCodeAt(++o)),v===10&&oSe&&Qr(c)>Se))return!1;for(o=l+2;o"u"&&(e.env.references={}),typeof e.env.references[_]>"u"&&(e.env.references[_]={title:R,href:p});let m=e.push("reference_definition","",0);m.map=[n,u],m.hidden=!0;let g=Object.create(null);return g.label=_,m.meta=g,e.line=u,!0}var ni=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zn=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Hn="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";new RegExp(`^(?:${Zn}|${Hn}||<[?][\\s\\S]*?[?]>|]*>|)`);var Xn=new RegExp(`^(?:${Zn}|${Hn})`),U=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp(`^|$))`,"i"),/^$/,!0],[new RegExp(`${Xn.source}\\s*$`),/^$/,!1]];function ti(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let u=e.src.slice(i,o),s=0;for(;s=4)return!1;let u=e.src.charCodeAt(i);if(u!==35||i>=o)return!1;let s=1;for(u=e.src.charCodeAt(++i);u===35&&i6||ii&&E(e.src.charCodeAt(c-1))&&(o=c),e.line=n+1;let l=e.push("heading_open",`h${s}`,1);l.markup="########".slice(0,s),l.map=[n,e.line];let f=e.push("inline","",0);f.content=_e(e.src.slice(i,o)),f.map=[n,e.line],f.children=[];let a=e.push("heading_close",`h${s}`,-1);return a.markup="########".slice(0,s),!0}function ii(e,n,t){let r=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType="paragraph";let o=0,u,s=n+1;for(;s3)continue;if(e.sCount[s]>=e.blkIndent){let d=e.bMarks[s]+e.tShift[s],h=e.eMarks[s];if(d=h))){o=u===61?1:2;break}}if(e.sCount[s]<0)continue;let p=!1;for(let d=0,h=r.length;d3||e.sCount[o]<0)continue;let l=!1;for(let f=0,a=r.length;f=t||e.sCount[u]=o){e.line=t;break}let c=e.line,l=!1;for(let f=0;f=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),u=e.line,u0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,n){let t=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)===55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)===56320){let h=this.src.charCodeAt(e-2);i=(h&64512)===55296?65536+(h-55296<<10)+(i-56320):65533}else(i&64512)===55296&&(i=65533);let o=e;for(;o=65&&e<=90||e>=97&&e<=122}function li(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===45||e===46}function ai(e,n){if(!e.md.options.linkify||e.linkLevel>0)return!1;let t=e.pos,r=e.posMax;if(t+3>r||e.src.charCodeAt(t)!==58||e.src.charCodeAt(t+1)!==47||e.src.charCodeAt(t+2)!==47)return!1;let i=t-Math.min(10,e.pending.length,t),o=t;for(;o>i&&li(e.src.charCodeAt(o-1));)o--;if(o===t||!ci(e.src.charCodeAt(o)))return!1;let u=t-o,s=e.md.linkify.matchAtStart(e.src.slice(o));if(!s)return!1;let c=s.url;if(c.length<=u)return!1;let l=c.length;for(;l>0&&c.charCodeAt(l-1)===42;)l--;l!==c.length&&(c=c.slice(0,l));let f=e.md.normalizeLink(c);if(!e.md.validateLink(f))return!1;if(!n){e.pending=e.pending.slice(0,-u);let a=e.push("link_open","a",1);a.attrs=[["href",f]],a.markup="linkify",a.info="auto";let p=e.push("text","",0);p.content=e.md.normalizeLinkText(c);let d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=c.length-u,!0}function hi(e,n){let t=e.pos;if(e.src.charCodeAt(t)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!n)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(t++;t?@[]^_`{|}~-".split("").forEach(function(e){Je[e.charCodeAt(0)]=1});function fi(e,n){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==92||(t++,t>=r))return!1;let i=e.src.charCodeAt(t);if(i===10){for(n||e.push("hardbreak","br",0),t++;t=55296&&i<=56319&&t+1=56320&&s<=57343&&(o+=e.src[t+1],t++)}let u="\\"+o;if(!n){let s=e.push("text_special","",0);i<256&&Je[i]!==0?s.content=o:s.content=u,s.markup=u,s.info="escape"}return e.pos=t+1,!0}function di(e){let n={},t=0;for(;(t=e.indexOf("`",t))!==-1;){let r=t;for(;e.charCodeAt(++t)===96;);n[t-r]=r}return n}function pi(e,n){var t;let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;let i=e.posMax,o=r+1;for(;o=o){let c=o,l;for(;(l=e.src.indexOf("`",c))!==-1&&li)break;if(c-l===s){if(!n){let f=e.push("code_inline","code",0);f.markup=u;let a=e.src.slice(o,l).replace(/\n/g," ");a.startsWith(" ")&&a.endsWith(" ")&&/[^ ]/.test(a)&&(a=a.slice(1,-1)),f.content=a}return e.pos=c,!0}}}return n||(e.pending+=u),e.pos=o,!0}function mi(e,n){let t=e.pos,r=e.src.charCodeAt(t);if(n||r!==126)return!1;let i=e.scanDelims(e.pos,!0),o=i.length,u=String.fromCharCode(r);if(o<2)return!1;let s;o%2&&(s=e.push("text","",0),s.content=u,o--);for(let c=0;c=0;r--){let i=n[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;let o=n[i.end],u=r>0&&n[r-1].end===i.end+1&&n[r-1].marker===i.marker&&n[r-1].token===i.token-1&&n[i.end+1].token===o.token+1,s=String.fromCharCode(i.marker),c=e.tokens[i.token];c.type=u?"strong_open":"em_open",c.tag=u?"strong":"em",c.nesting=1,c.markup=u?s+s:s,c.content="";let l=e.tokens[o.token];l.type=u?"strong_close":"em_close",l.tag=u?"strong":"em",l.nesting=-1,l.markup=u?s+s:s,l.content="",u&&(e.tokens[n[r-1].token].content="",e.tokens[n[i.end+1].token].content="",r--)}}function gi(e){let n=e.tokens_meta,t=e.tokens_meta.length;Mn(e,e.delimiters);for(let i=0;i=a)return!1;if(c=h,i=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),i.ok){for(u=e.md.normalizeLink(i.str),e.md.validateLink(u)?h=i.pos:u="",c=h;h=a||e.src.charCodeAt(h)!==41)&&(l=!0),h++}if(l){if(typeof e.env.references>"u")return!1;if(h=0?r=e.src.slice(c,h++):h=d+1):h=d+1,r||(r=e.src.slice(p,d)),r=me(r),o=e.env.references[r],!o)return e.pos=f,!1;u=o.href,s=o.title}if(!n){e.pos=p,e.posMax=d;let b=e.push("link_open","a",1),k=[["href",u]];if(b.attrs=k,s&&k.push(["title",s]),r){let x=Object.create(null);x.label=r,b.meta=x}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=a,!0}function xi(e,n){let t,r,i,o,u,s,c,l,f="",a=e.pos,p=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let d=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(o=h+1,o=p)return!1;for(l=o,s=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),s.ok&&(f=e.md.normalizeLink(s.str),e.md.validateLink(f)?o=s.pos:f=""),l=o;o=p||e.src.charCodeAt(o)!==41)return e.pos=a,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=h+1):o=h+1,i||(i=e.src.slice(d,h)),i=me(i),u=e.env.references[i],!u)return e.pos=a,!1;f=u.href,c=u.title}if(!n){r=e.src.slice(d,h);let b=[];e.md.inline.parse(r,e.md,e.env,b);let k=e.push("image","img",0),x=[["src",f],["alt",""]];if(k.attrs=x,k.children=b,k.content=r,c&&x.push(["title",c]),i){let R=Object.create(null);R.label=i,k.meta=R}}return e.pos=o,e.posMax=p,!0}var Ri=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Ci=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function vi(e,n){let t=e.pos;if(e.src.charCodeAt(t)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++t>=i)return!1;let u=e.src.charCodeAt(t);if(u===60)return!1;if(u===62)break}let o=e.src.slice(r+1,t);if(Ci.test(o)){let u=e.md.normalizeLink(o);if(!e.md.validateLink(u))return!1;if(!n){let s=e.push("link_open","a",1);s.attrs=[["href",u]],s.markup="autolink",s.info="auto";let c=e.push("text","",0);c.content=e.md.normalizeLinkText(o);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(Ri.test(o)){let u=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(u))return!1;if(!n){let s=e.push("link_open","a",1);s.attrs=[["href",u]],s.markup="autolink",s.info="auto";let c=e.push("text","",0);c.content=e.md.normalizeLinkText(o);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function Ai(e){return/^\s]/i.test(e)}function wi(e){return/^<\/a\s*>/i.test(e)}function Qn(e){let n=e|32;return n>=97&&n<=122}function Di(e,n){let t=e.src,r,i;if(t.startsWith(""}else if(t.startsWith("";else if(t.charCodeAt(n+1)===63)r=n+2,i="?>";else if(Qn(t.charCodeAt(n+2)))r=n+3,i=">";else return-1;if(e.skipHtmlSpecial)return-1;let o=t.indexOf(i,r);return o<0?(e.skipHtmlSpecial=!0,-1):o+i.length}function Ei(e,n){if(!e.md.options.html)return!1;let t=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=t)return!1;let i,o=e.src.charCodeAt(r+1);if(o===33||o===63)i=Di(e,r);else if(o===47||Qn(o)){let u=e.src.slice(r).match(Xn);i=u?r+u[0].length:-1}else return!1;if(i<0)return!1;if(!n){let u=e.push("html_inline","",0);u.content=e.src.slice(r,i),Ai(u.content)&&e.linkLevel++,wi(u.content)&&e.linkLevel--}return e.pos=i,!0}var yi=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Fi=/^&([a-z][a-z0-9]{1,31});/i;function Ti(e,n){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==38||t+1>=r)return!1;if(e.src.charCodeAt(t+1)===35){let i=e.src.slice(t).match(yi);if(i){if(!n){let o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),u=e.push("text_special","",0);u.content=ze(o)?ee(o):ee(65533),u.markup=i[0],u.info="entity"}return e.pos+=i[0].length,!0}}else{let i=e.src.slice(t).match(Fi);if(i){let o=he(i[0]);if(o!==i[0]){if(!n){let u=e.push("text_special","",0);u.content=o,u.markup=i[0],u.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function jn(e){let n={},t=e.length;if(!t)return;let r=0,i=-2,o=[];for(let u=0;uc;l-=o[l]+1){let a=e[l];if(a.marker===s.marker&&a.open&&a.end<0){let p=!1;if((a.close||s.open)&&(a.length+s.length)%3===0&&(a.length%3!==0||s.length%3!==0)&&(p=!0),!p){let d=l>0&&!e[l-1].open?o[l-1]+1:0;o[u]=u-l+d,o[l]=d,s.open=!1,a.end=u,a.close=!1,f=-1,i=-2;break}}}f!==-1&&(n[s.marker][(s.open?3:0)+(s.length||0)%3]=f)}}function Bi(e){let n=e.tokens_meta,t=e.tokens_meta.length;jn(e.delimiters);for(let i=0;i0&&r++,i[n].type==="text"&&n+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;u||e.pos++,o[n]=e.pos}tokenize(e){let n=this.ruler.getRules(""),t=n.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(u){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,n,t,r){let i=new this.State(e,n,t,r);this.tokenize(i);let o=this.ruler2.getRules(""),u=o.length;for(let s=0;s=0))try{n.hostname=Te.toASCII(n.hostname)}catch{}return n.auth&&(n.auth=P(n.auth)),n.hostname&&(n.hostname=P(n.hostname)),n.pathname&&(n.pathname=P(n.pathname)),n.search&&(n.search=P(n.search)),n.hash&&(n.hash=P(n.hash)),H(n)}normalizeLinkText(e){let n=K(e,!0);if(n.hostname&&(!n.protocol||zn.indexOf(n.protocol)>=0))try{n.hostname=Te.toUnicode(n.hostname)}catch{}return G(H(n),G.defaultChars+"%")}constructor(...e){C(this,"inline",new et),C(this,"block",new Yn),C(this,"core",new qn),C(this,"renderer",new On),C(this,"linkify",new gn),C(this,"utils",rr),C(this,"helpers",Object.assign({},br));let[n,t]=e;typeof n=="string"?(this.configure(n),t&&this.set(t)):(this.configure("default"),this.set(n||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let n;if(typeof e=="string"){let i=e;if(n=Si[i],!n)throw new Error(`Wrong 'markdown-it' preset "${i}", check name`)}else n=e;if(!n)throw new Error("Wrong `markdown-it` preset, can't be empty");n.options&&(this.options={...n.options});let t=n.components;if(t){var r;["core","block","inline"].forEach(o=>{var u;let s=(u=t[o])===null||u===void 0?void 0:u.rules;s&&this[o].ruler.enableOnly(s)});let i=(r=t.inline)===null||r===void 0?void 0:r.rules2;i&&this.inline.ruler2.enableOnly(i)}return this}enable(e,n=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(i=>{t=t.concat(this[i].ruler.enable(e,!0))}),t=t.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(i=>t.indexOf(i)<0);if(r.length&&!n)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,n=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(i=>{t=t.concat(this[i].ruler.disable(e,!0))}),t=t.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(i=>t.indexOf(i)<0);if(r.length&&!n)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...n){return e.apply(e,[this,...n]),this}parse(e,n){if(typeof e!="string")throw new Error("Input data should be a String");let t=new this.core.State(e,this,n);return this.core.process(t),t.tokens}render(e,n={}){return this.renderer.render(this.parse(e,n),this.options,n)}parseInline(e,n){let t=new this.core.State(e,this,n);return t.inlineMode=!0,this.core.process(t),t.tokens}renderInline(e,n={}){return this.renderer.render(this.parseInline(e,n),this.options,n)}};C(N,"Token",q);C(N,"Ruler",oe);C(N,"Renderer",On);C(N,"ParserCore",qn);C(N,"StateCore",$n);C(N,"ParserBlock",Yn);C(N,"StateBlock",Wn);C(N,"ParserInline",et);C(N,"StateInline",Gn);var nt=Ln(N);function zi(e,n,t,r){let i=Number(e[n].meta.id+1).toString(),o="";return typeof r.docId=="string"&&(o=`-${r.docId}-`),o+i}function Ji(e,n){let t=Number(e[n].meta.id+1).toString();return e[n].meta.subId>0&&(t+=`:${e[n].meta.subId}`),`[${t}]`}function Li(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i),u=i.rules.footnote_caption(e,n,t,r,i),s=o;return e[n].meta.subId>0&&(s+=`:${e[n].meta.subId}`),`${u}`}function Ni(e,n,t){return(t.xhtmlOut?`
+`}return r}render(e,n,t){let r="",i=this.rules;for(let o=0,u=e.length;o\s]/i.test(e)}function Tr(e){return/^<\/a\s*>/i.test(e)}function Br(e){let n=e.tokens;if(e.md.options.linkify)for(let t=0,r=n.length;t=0;s--){let c=i[s];if(c.type==="link_close"){for(s--;i[s].level!==c.level&&i[s].type!=="link_open";)s--;continue}if(c.type==="html_inline"&&(Fr(c.content)&&u>0&&u--,Tr(c.content)&&u++),!(u>0)&&c.type==="text"&&e.md.linkify.test(c.content)){let l=c.content,h=e.md.linkify.match(l),a=[],p=c.level,d=0;h.length>0&&h[0].index===0&&s>0&&i[s-1].type==="text_special"&&(h=h.slice(1));for(let f=0;fd){let v=new e.Token("text","",0);v.content=l.slice(d,R),v.level=p,a.push(v)}let _=new e.Token("link_open","a",1);_.attrs=[["href",k]],_.level=p++,_.markup="linkify",_.info="auto",a.push(_);let m=new e.Token("text","",0);m.content=x,m.level=p,a.push(m);let g=new e.Token("link_close","a",-1);g.level=--p,g.markup="linkify",g.info="auto",a.push(g),d=h[f].lastIndex}if(d0){let s=i.length;for(let a of o)s+=a.nodes.length-1;let c=new Array(s),l=0,h=0;o.reverse();for(let a=0;a=0;t--){let r=e[t];r.type==="text"&&!n&&(r.content=r.content.replace(Sr,jr)),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}}function Jr(e){let n=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r.type==="text"&&!n&&qn.test(r.content)&&(r.content=r.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1\u2014").replace(/(^|\s)--(?=\s|$)/gm,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1\u2013")),r.type==="link_open"&&r.info==="auto"&&n--,r.type==="link_close"&&r.info==="auto"&&n++}}function Lr(e){let n;if(e.md.options.typographer)for(n=e.tokens.length-1;n>=0;n--)e.tokens[n].type==="inline"&&(Ir.test(e.tokens[n].content)&&zr(e.tokens[n].children),qn.test(e.tokens[n].content)&&Jr(e.tokens[n].children))}var Nr=/['"]/,yn=/['"]/g,Fn="\u2019",Pr=1e3;function Tn(e,n,t){for(;e.length>t;){let r=e.pop();r.isSingleQuote?n.single=r.prevSameQuoteIdx:n.double=r.prevSameQuoteIdx}}function he(e,n,t,r){e[n]||(e[n]=[]),e[n].push({pos:t,ch:r})}function Or(e,n){let t="",r=0;n.sort((i,o)=>i.pos-o.pos);for(let i=0;i=0&&!(r[t].level<=c);t--);if(Tn(r,i,t+1),s.type!=="text")continue;let l=s.content,h=0,a=l.length;e:for(;h=0)k=l.charCodeAt(p.index-1);else for(t=u-1;t>=0&&!(e[t].type==="softbreak"||e[t].type==="hardbreak");t--)if(e[t].content){k=e[t].content.charCodeAt(e[t].content.length-1);break}let x=32;if(h=48&&k<=57&&(f=d=!1),d&&f&&(d=R,f=_),!d&&!f){b&&he(o,u,p.index,Fn);continue}if(f&&(t=b?i.single:i.double,t>=0&&r[t].level===c)){let v=r[t],A,y;b?(A=n.md.options.quotes[2],y=n.md.options.quotes[3]):(A=n.md.options.quotes[0],y=n.md.options.quotes[1]),he(o,u,p.index,y),he(o,v.tokenIdx,v.contentPos,A),Tn(r,i,t);continue e}if(d){if(r.length>=Pr)return;r.push({tokenIdx:u,contentPos:p.index,isSingleQuote:b,level:c,prevSameQuoteIdx:b?i.single:i.double}),b?i.single=r.length-1:i.double=r.length-1}else f&&b&&he(o,u,p.index,Fn)}}Object.keys(o).forEach(function(u){let s=Number(u);e[s].content=Or(e[s].content,o[u])})}function Ur(e){if(e.md.options.typographer)for(let n=e.tokens.length-1;n>=0;n--)e.tokens[n].type!=="inline"||!Nr.test(e.tokens[n].content)||$r(e.tokens[n].children,e)}function qr(e){let n,t,r=e.length;for(n=0;n0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let n=this.lineMax;en;)if(!E(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,n){for(let t=this.src.length;et;)if(n!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,n,t,r){if(e>=n)return"";let i=new Array(n-e);for(let o=0,u=e;ut?i[o]=new Array(s-t+1).join(" ")+this.src.slice(l,h):i[o]=this.src.slice(l,h)}return i.join("")}},Zr=65536;function Ie(e,n){let t=e.bMarks[n]+e.tShift[n],r=e.eMarks[n];return e.src.slice(t,r)}function Bn(e){let n=[],t=e.length,r=0,i=e.charCodeAt(r),o=!1,u=0,s="";for(;rt)return!1;let i=n+1;if(e.sCount[i]=4)return!1;let o=e.bMarks[i]+e.tShift[i];if(o>=e.eMarks[i])return!1;let u=e.src.charCodeAt(o++);if(u!==124&&u!==45&&u!==58||o>=e.eMarks[i])return!1;let s=e.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58&&!E(s)||u===45&&E(s))return!1;for(;o=4)return!1;l=Bn(c),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let a=l.length;if(a===0||a!==h.length)return!1;if(r)return!0;let p=e.parentType;e.parentType="table";let d=e.md.block.ruler.getRules("blockquote"),f=e.push("table_open","table",1),b=[n,0];f.map=b;let k=e.push("thead_open","thead",1);k.map=[n,n+1];let x=e.push("tr_open","tr",1);x.map=[n,n+1];for(let m=0;m=4||(l=Bn(c),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),_+=a-l.length,_>Zr))break;if(i===n+2){let v=e.push("tbody_open","tbody",1);v.map=R=[n+2,0]}let g=e.push("tr_open","tr",1);g.map=[i,i+1];for(let v=0;v=4){r++,i=r;continue}break}e.line=i;let o=e.push("code_block","code",0);return o.content=e.getLines(n,i,4+e.blkIndent,!1)+` +`,o.map=[n,e.line],!0}function Yr(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||i+3>o)return!1;let u=e.src.charCodeAt(i);if(u!==126&&u!==96)return!1;let s=i;i=e.skipChars(i,u);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),h=e.src.slice(i,o);if(u===96&&h.indexOf(String.fromCharCode(u))>=0)return!1;if(r)return!0;let a=n,p=!1;for(;a++,!(a>=t||(i=s=e.bMarks[a]+e.tShift[a],o=e.eMarks[a],i=4)&&(i=e.skipChars(i,u),!(i-s=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],h=[],a=e.md.block.ruler.getRules("blockquote"),p=e.parentType;e.parentType="blockquote";let d=!1,f;for(f=n;f=o)break;if(e.src.charCodeAt(i++)===62&&!_){let g=e.sCount[f]+1,v,A;e.src.charCodeAt(i)===32?(i++,g++,A=!1,v=!0):e.src.charCodeAt(i)===9?(v=!0,(e.bsCount[f]+g)%4===3?(i++,g++,A=!1):A=!0):v=!1;let y=g;for(s.push(e.bMarks[f]),e.bMarks[f]=i;i=o,c.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(v?1:0),l.push(e.sCount[f]),e.sCount[f]=y-g,h.push(e.tShift[f]),e.tShift[f]=i-e.bMarks[f];continue}if(d)break;let m=!1;for(let g=0,v=a.length;g";let x=[n,0];k.map=x,e.md.block.tokenize(e,n,f);let R=e.push("blockquote_close","blockquote",-1);R.markup=">",e.lineMax=u,e.parentType=p,x[1]=e.line;for(let _=0;_=4)return!1;let o=e.bMarks[n]+e.tShift[n],u=e.src.charCodeAt(o++);if(u!==42&&u!==45&&u!==95)return!1;let s=1;for(;o=r)return-1;let o=e.src.charCodeAt(i++);if(o<48||o>57)return-1;for(;;){if(i>=r)return-1;if(o=e.src.charCodeAt(i++),o>=48&&o<=57){if(i-t>=10)return-1;continue}if(o===41||o===46)break;return-1}return i=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]=e.blkIndent&&(h=!0);let a,p,d;if((d=Sn(e,c))>=0){if(a=!0,u=e.bMarks[c]+e.tShift[c],p=Number(e.src.slice(u,d-1)),h&&p!==1)return!1}else if((d=In(e,c))>=0)a=!1;else return!1;if(h&&e.skipSpaces(d)>=e.eMarks[c])return!1;if(r)return!0;let f=e.src.charCodeAt(d-1),b=e.tokens.length;a?(s=e.push("ordered_list_open","ol",1),p!==1&&(s.attrs=[["start",p]])):s=e.push("bullet_list_open","ul",1);let k=[c,0];s.map=k,s.markup=String.fromCharCode(f);let x=!1,R=e.md.block.ruler.getRules("list"),_=e.parentType;for(e.parentType="list";c=i?A=1:A=g-m,A>4&&(A=1);let y=m+A;s=e.push("list_item_open","li",1),s.markup=String.fromCharCode(f);let w=[c,0];s.map=w,a&&(s.info=e.src.slice(u,d-1));let T=e.tight,D=e.tShift[c],B=e.sCount[c],j=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=y,e.tight=!0,e.tShift[c]=v-e.bMarks[c],e.sCount[c]=g,v>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,c,t),(!e.tight||x)&&(l=!1),x=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=j,e.tShift[c]=D,e.sCount[c]=B,e.tight=T,s=e.push("list_item_close","li",-1),s.markup=String.fromCharCode(f),c=e.line,w[1]=c,c>=t||e.sCount[c]=4)break;let M=!1;for(let S=0,bt=R.length;S56319)continue;let i=e.charCodeAt(t+1);i>=56320&&i<=57343&&(n--,t++)}return n}function Q(e,n){return Math.min(e.eMarks[n]+1,e.src.length)}function de(e,n){let t=e.lineMax;if(n>=t||e.isEmpty(n))return-1;let r=!1;if(e.sCount[n]-e.blkIndent>3&&(r=!0),e.sCount[n]<0&&(r=!0),!r){let i=e.md.block.ruler.getRules("reference"),o=e.parentType;e.parentType="reference";let u=!1;for(let s=0,c=i.length;s=4||i.charCodeAt(o)!==91)return!1;let s=Q(e,n),c="",l=-1,h=++o;for(;oSe*2)return!1;let v=i.charCodeAt(o);if(v===91)return!1;if(v===93){l=o;break}if(v===92&&(v=i.charCodeAt(++o)),v===10&&oSe&&ei(c)>Se))return!1;for(o=l+2;o"u"&&(e.env.references={}),typeof e.env.references[_]>"u"&&(e.env.references[_]={title:R,href:p});let m=e.push("reference_definition","",0);m.map=[n,u],m.hidden=!0;let g=Object.create(null);return g.label=_,m.meta=g,e.line=u,!0}var ti=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Hn=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,Xn="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";new RegExp(`^(?:${Hn}|${Xn}||<[?][\\s\\S]*?[?]>|]*>|)`);var Yn=new RegExp(`^(?:${Hn}|${Xn})`),U=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp(`^|$))`,"i"),/^$/,!0],[new RegExp(`${Yn.source}\\s*$`),/^$/,!1]];function ri(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let u=e.src.slice(i,o),s=0;for(;s=4)return!1;let u=e.src.charCodeAt(i);if(u!==35||i>=o)return!1;let s=1;for(u=e.src.charCodeAt(++i);u===35&&i6||ii&&E(e.src.charCodeAt(c-1))&&(o=c),e.line=n+1;let l=e.push("heading_open",`h${s}`,1);l.markup="########".slice(0,s),l.map=[n,e.line];let h=e.push("inline","",0);h.content=_e(e.src.slice(i,o)),h.map=[n,e.line],h.children=[];let a=e.push("heading_close",`h${s}`,-1);return a.markup="########".slice(0,s),!0}function oi(e,n,t){let r=e.md.block.ruler.getRules("paragraph");if(e.sCount[n]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType="paragraph";let o=0,u,s=n+1;for(;s3)continue;if(e.sCount[s]>=e.blkIndent){let d=e.bMarks[s]+e.tShift[s],f=e.eMarks[s];if(d=f))){o=u===61?1:2;break}}if(e.sCount[s]<0)continue;let p=!1;for(let d=0,f=r.length;d3||e.sCount[o]<0)continue;let l=!1;for(let h=0,a=r.length;h=t||e.sCount[u]=o){e.line=t;break}let c=e.line,l=!1;for(let h=0;h=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),u=e.line,u0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r}scanDelims(e,n){let t=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)===55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)===56320){let f=this.src.charCodeAt(e-2);i=(f&64512)===55296?65536+(f-55296<<10)+(i-56320):65533}else(i&64512)===55296&&(i=65533);let o=e;for(;o=65&&e<=90||e>=97&&e<=122}function ai(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===45||e===46}function fi(e,n){if(!e.md.options.linkify||e.linkLevel>0)return!1;let t=e.pos,r=e.posMax;if(t+3>r||e.src.charCodeAt(t)!==58||e.src.charCodeAt(t+1)!==47||e.src.charCodeAt(t+2)!==47)return!1;let i=t-Math.min(10,e.pending.length,t),o=t;for(;o>i&&ai(e.src.charCodeAt(o-1));)o--;if(o===t||!li(e.src.charCodeAt(o)))return!1;let u=t-o,s=e.md.linkify.matchAtStart(e.src.slice(o));if(!s)return!1;let c=s.url;if(c.length<=u)return!1;let l=c.length;for(;l>0&&c.charCodeAt(l-1)===42;)l--;l!==c.length&&(c=c.slice(0,l));let h=e.md.normalizeLink(c);if(!e.md.validateLink(h))return!1;if(!n){e.pending=e.pending.slice(0,-u);let a=e.push("link_open","a",1);a.attrs=[["href",h]],a.markup="linkify",a.info="auto";let p=e.push("text","",0);p.content=e.md.normalizeLinkText(c);let d=e.push("link_close","a",-1);d.markup="linkify",d.info="auto"}return e.pos+=c.length-u,!0}function hi(e,n){let t=e.pos;if(e.src.charCodeAt(t)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!n)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let o=r-1;for(;o>=1&&e.pending.charCodeAt(o-1)===32;)o--;e.pending=e.pending.slice(0,o),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(t++;t?@[]^_`{|}~-".split("").forEach(function(e){Je[e.charCodeAt(0)]=1});function di(e,n){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==92||(t++,t>=r))return!1;let i=e.src.charCodeAt(t);if(i===10){for(n||e.push("hardbreak","br",0),t++;t=55296&&i<=56319&&t+1=56320&&s<=57343&&(o+=e.src[t+1],t++)}let u="\\"+o;if(!n){let s=e.push("text_special","",0);i<256&&Je[i]!==0?s.content=o:s.content=u,s.markup=u,s.info="escape"}return e.pos=t+1,!0}function pi(e){let n={},t=0;for(;(t=e.indexOf("`",t))!==-1;){let r=t;for(;e.charCodeAt(++t)===96;);n[t-r]=r}return n}function mi(e,n){var t;let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;let i=e.posMax,o=r+1;for(;o=o){let c=o,l;for(;(l=e.src.indexOf("`",c))!==-1&&li)break;if(c-l===s){if(!n){let h=e.push("code_inline","code",0);h.markup=u;let a=e.src.slice(o,l).replace(/\n/g," ");a.startsWith(" ")&&a.endsWith(" ")&&/[^ ]/.test(a)&&(a=a.slice(1,-1)),h.content=a}return e.pos=c,!0}}}return n||(e.pending+=u),e.pos=o,!0}function _i(e,n){let t=e.pos,r=e.src.charCodeAt(t);if(n||r!==126)return!1;let i=e.scanDelims(e.pos,!0),o=i.length,u=String.fromCharCode(r);if(o<2)return!1;let s;o%2&&(s=e.push("text","",0),s.content=u,o--);for(let c=0;c=0;r--){let i=n[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;let o=n[i.end],u=r>0&&n[r-1].end===i.end+1&&n[r-1].marker===i.marker&&n[r-1].token===i.token-1&&n[i.end+1].token===o.token+1,s=String.fromCharCode(i.marker),c=e.tokens[i.token];c.type=u?"strong_open":"em_open",c.tag=u?"strong":"em",c.nesting=1,c.markup=u?s+s:s,c.content="";let l=e.tokens[o.token];l.type=u?"strong_close":"em_close",l.tag=u?"strong":"em",l.nesting=-1,l.markup=u?s+s:s,l.content="",u&&(e.tokens[n[r-1].token].content="",e.tokens[n[i.end+1].token].content="",r--)}}function bi(e){let n=e.tokens_meta,t=e.tokens_meta.length;jn(e,e.delimiters);for(let i=0;i=a)return!1;if(c=f,i=e.md.helpers.parseLinkDestination(e.src,f,e.posMax),i.ok){for(u=e.md.normalizeLink(i.str),e.md.validateLink(u)?f=i.pos:u="",c=f;f=a||e.src.charCodeAt(f)!==41)&&(l=!0),f++}if(l){if(typeof e.env.references>"u")return!1;if(f=0?r=e.src.slice(c,f++):f=d+1):f=d+1,r||(r=e.src.slice(p,d)),r=me(r),o=e.env.references[r],!o)return e.pos=h,!1;u=o.href,s=o.title}if(!n){e.pos=p,e.posMax=d;let b=e.push("link_open","a",1),k=[["href",u]];if(b.attrs=k,s&&k.push(["title",s]),r){let x=Object.create(null);x.label=r,b.meta=x}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=f,e.posMax=a,!0}function Ri(e,n){let t,r,i,o,u,s,c,l,h="",a=e.pos,p=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let d=e.pos+2,f=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(f<0)return!1;if(o=f+1,o=p)return!1;for(l=o,s=e.md.helpers.parseLinkDestination(e.src,o,e.posMax),s.ok&&(h=e.md.normalizeLink(s.str),e.md.validateLink(h)?o=s.pos:h=""),l=o;o=p||e.src.charCodeAt(o)!==41)return e.pos=a,!1;o++}else{if(typeof e.env.references>"u")return!1;if(o=0?i=e.src.slice(l,o++):o=f+1):o=f+1,i||(i=e.src.slice(d,f)),i=me(i),u=e.env.references[i],!u)return e.pos=a,!1;h=u.href,c=u.title}if(!n){r=e.src.slice(d,f);let b=[];e.md.inline.parse(r,e.md,e.env,b);let k=e.push("image","img",0),x=[["src",h],["alt",""]];if(k.attrs=x,k.children=b,k.content=r,c&&x.push(["title",c]),i){let R=Object.create(null);R.label=i,k.meta=R}}return e.pos=o,e.posMax=p,!0}var Ci=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,vi=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Ai(e,n){let t=e.pos;if(e.src.charCodeAt(t)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++t>=i)return!1;let u=e.src.charCodeAt(t);if(u===60)return!1;if(u===62)break}let o=e.src.slice(r+1,t);if(vi.test(o)){let u=e.md.normalizeLink(o);if(!e.md.validateLink(u))return!1;if(!n){let s=e.push("link_open","a",1);s.attrs=[["href",u]],s.markup="autolink",s.info="auto";let c=e.push("text","",0);c.content=e.md.normalizeLinkText(o);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}if(Ci.test(o)){let u=e.md.normalizeLink(`mailto:${o}`);if(!e.md.validateLink(u))return!1;if(!n){let s=e.push("link_open","a",1);s.attrs=[["href",u]],s.markup="autolink",s.info="auto";let c=e.push("text","",0);c.content=e.md.normalizeLinkText(o);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=o.length+2,!0}return!1}function wi(e){return/^\s]/i.test(e)}function Di(e){return/^<\/a\s*>/i.test(e)}function et(e){let n=e|32;return n>=97&&n<=122}function Ei(e,n){let t=e.src,r,i;if(t.startsWith(""}else if(t.startsWith("";else if(t.charCodeAt(n+1)===63)r=n+2,i="?>";else if(et(t.charCodeAt(n+2)))r=n+3,i=">";else return-1;if(e.skipHtmlSpecial)return-1;let o=t.indexOf(i,r);return o<0?(e.skipHtmlSpecial=!0,-1):o+i.length}function yi(e,n){if(!e.md.options.html)return!1;let t=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=t)return!1;let i,o=e.src.charCodeAt(r+1);if(o===33||o===63)i=Ei(e,r);else if(o===47||et(o)){let u=e.src.slice(r).match(Yn);i=u?r+u[0].length:-1}else return!1;if(i<0)return!1;if(!n){let u=e.push("html_inline","",0);u.content=e.src.slice(r,i),wi(u.content)&&e.linkLevel++,Di(u.content)&&e.linkLevel--}return e.pos=i,!0}var Fi=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Ti=/^&([a-z][a-z0-9]{1,31});/i;function Bi(e,n){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==38||t+1>=r)return!1;if(e.src.charCodeAt(t+1)===35){let i=e.src.slice(t).match(Fi);if(i){if(!n){let o=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),u=e.push("text_special","",0);u.content=ze(o)?ee(o):ee(65533),u.markup=i[0],u.info="entity"}return e.pos+=i[0].length,!0}}else{let i=e.src.slice(t).match(Ti);if(i){let o=fe(i[0]);if(o!==i[0]){if(!n){let u=e.push("text_special","",0);u.content=o,u.markup=i[0],u.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function zn(e){let n={},t=e.length;if(!t)return;let r=0,i=-2,o=[];for(let u=0;uc;l-=o[l]+1){let a=e[l];if(a.marker===s.marker&&a.open&&a.end<0){let p=!1;if((a.close||s.open)&&(a.length+s.length)%3===0&&(a.length%3!==0||s.length%3!==0)&&(p=!0),!p){let d=l>0&&!e[l-1].open?o[l-1]+1:0;o[u]=u-l+d,o[l]=d,s.open=!1,a.end=u,a.close=!1,h=-1,i=-2;break}}}h!==-1&&(n[s.marker][(s.open?3:0)+(s.length||0)%3]=h)}}function Ii(e){let n=e.tokens_meta,t=e.tokens_meta.length;zn(e.delimiters);for(let i=0;i0&&r++,i[n].type==="text"&&n+1=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;u||e.pos++,o[n]=e.pos}tokenize(e){let n=this.ruler.getRules(""),t=n.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(u){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,n,t,r){let i=new this.State(e,n,t,r);this.tokenize(i);let o=this.ruler2.getRules(""),u=o.length;for(let s=0;s=0))try{n.hostname=Te.toASCII(n.hostname)}catch{}return n.auth&&(n.auth=P(n.auth)),n.hostname&&(n.hostname=P(n.hostname)),n.pathname&&(n.pathname=P(n.pathname)),n.search&&(n.search=P(n.search)),n.hash&&(n.hash=P(n.hash)),H(n)}normalizeLinkText(e){let n=K(e,!0);if(n.hostname&&(!n.protocol||Jn.indexOf(n.protocol)>=0))try{n.hostname=Te.toUnicode(n.hostname)}catch{}return G(H(n),G.defaultChars+"%")}constructor(...e){C(this,"inline",new nt),C(this,"block",new Gn),C(this,"core",new Wn),C(this,"renderer",new $n),C(this,"linkify",new bn),C(this,"utils",ir),C(this,"helpers",Object.assign({},xr));let[n,t]=e;typeof n=="string"?(this.configure(n),t&&this.set(t)):(this.configure("default"),this.set(n||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let n;if(typeof e=="string"){let i=e;if(n=Mi[i],!n)throw new Error(`Wrong 'markdown-it' preset "${i}", check name`)}else n=e;if(!n)throw new Error("Wrong `markdown-it` preset, can't be empty");n.options&&(this.options={...n.options});let t=n.components;if(t){var r;["core","block","inline"].forEach(o=>{var u;let s=(u=t[o])===null||u===void 0?void 0:u.rules;s&&this[o].ruler.enableOnly(s)});let i=(r=t.inline)===null||r===void 0?void 0:r.rules2;i&&this.inline.ruler2.enableOnly(i)}return this}enable(e,n=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(i=>{t=t.concat(this[i].ruler.enable(e,!0))}),t=t.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(i=>t.indexOf(i)<0);if(r.length&&!n)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,n=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(i=>{t=t.concat(this[i].ruler.disable(e,!0))}),t=t.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(i=>t.indexOf(i)<0);if(r.length&&!n)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...n){return e.apply(e,[this,...n]),this}parse(e,n){if(typeof e!="string")throw new Error("Input data should be a String");let t=new this.core.State(e,this,n);return this.core.process(t),t.tokens}render(e,n={}){return this.renderer.render(this.parse(e,n),this.options,n)}parseInline(e,n){let t=new this.core.State(e,this,n);return t.inlineMode=!0,this.core.process(t),t.tokens}renderInline(e,n={}){return this.renderer.render(this.parseInline(e,n),this.options,n)}};C(N,"Token",q);C(N,"Ruler",oe);C(N,"Renderer",$n);C(N,"ParserCore",Wn);C(N,"StateCore",Un);C(N,"ParserBlock",Gn);C(N,"StateBlock",Zn);C(N,"ParserInline",nt);C(N,"StateInline",Kn);var tt=Nn(N);function Ji(e,n,t,r){let i=Number(e[n].meta.id+1).toString(),o="";return typeof r.docId=="string"&&(o=`-${r.docId}-`),o+i}function Li(e,n){let t=Number(e[n].meta.id+1).toString();return e[n].meta.subId>0&&(t+=`:${e[n].meta.subId}`),`[${t}]`}function Ni(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i),u=i.rules.footnote_caption(e,n,t,r,i),s=o;return e[n].meta.subId>0&&(s+=`:${e[n].meta.subId}`),`${u}`}function Pi(e,n,t){return(t.xhtmlOut?`
`:`
`)+`
    -`}function Pi(){return`
+`}function Oi(){return`
-`}function Oi(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i);return e[n].meta.subId>0&&(o+=`:${e[n].meta.subId}`),`
  • `}function $i(){return`
  • -`}function Ui(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i);return e[n].meta.subId>0&&(o+=`:${e[n].meta.subId}`),` \u21A9\uFE0E`}function Le(e){let n=e.helpers.parseLinkLabel,t=e.utils.isSpace;e.renderer.rules.footnote_ref=Li,e.renderer.rules.footnote_block_open=Ni,e.renderer.rules.footnote_block_close=Pi,e.renderer.rules.footnote_open=Oi,e.renderer.rules.footnote_close=$i,e.renderer.rules.footnote_anchor=Ui,e.renderer.rules.footnote_caption=Ji,e.renderer.rules.footnote_anchor_name=zi;function r(s,c,l,f){let a=s.bMarks[c]+s.tShift[c],p=s.eMarks[c];if(a+4>p||s.src.charCodeAt(a)!==91||s.src.charCodeAt(a+1)!==94)return!1;let d;for(d=a+2;d=p||s.src.charCodeAt(++d)!==58)return!1;if(f)return!0;d++,s.env.footnotes||(s.env.footnotes={}),s.env.footnotes.refs||(s.env.footnotes.refs={});let h=s.src.slice(a+2,d-2);s.env.footnotes.refs[`:${h}`]=-1;let b=new s.Token("footnote_reference_open","",1);b.meta={label:h},b.level=s.level++,s.tokens.push(b);let k=s.bMarks[c],x=s.tShift[c],R=s.sCount[c],_=s.parentType,m=d,g=s.sCount[c]+d-(s.bMarks[c]+s.tShift[c]),v=g;for(;d=l||s.src.charCodeAt(f)!==94||s.src.charCodeAt(f+1)!==91)return!1;let a=f+2,p=n(s,f+1);if(p<0)return!1;if(!c){s.env.footnotes||(s.env.footnotes={}),s.env.footnotes.list||(s.env.footnotes.list=[]);let d=s.env.footnotes.list.length,h=[];s.md.inline.parse(s.src.slice(a,p),s.md,s.env,h);let b=s.push("footnote_ref","",0);b.meta={id:d},s.env.footnotes.list[d]={content:s.src.slice(a,p),tokens:h}}return s.pos=p+1,s.posMax=l,!0}function o(s,c){let l=s.posMax,f=s.pos;if(f+3>l||!s.env.footnotes||!s.env.footnotes.refs||s.src.charCodeAt(f)!==91||s.src.charCodeAt(f+1)!==94)return!1;let a;for(a=f+2;a=l)return!1;a++;let p=s.src.slice(f+2,a-1);if(typeof s.env.footnotes.refs[`:${p}`]>"u")return!1;if(!c){s.env.footnotes.list||(s.env.footnotes.list=[]);let d;s.env.footnotes.refs[`:${p}`]<0?(d=s.env.footnotes.list.length,s.env.footnotes.list[d]={label:p,count:0},s.env.footnotes.refs[`:${p}`]=d):d=s.env.footnotes.refs[`:${p}`];let h=s.env.footnotes.list[d].count;s.env.footnotes.list[d].count++;let b=s.push("footnote_ref","",0);b.meta={id:d,subId:h,label:p}}return s.pos=a,s.posMax=l,!0}function u(s){let c,l,f,a=!1,p={};if(!s.env.footnotes||(s.tokens=s.tokens.filter(function(h){return h.type==="footnote_reference_open"?(a=!0,l=[],f=h.meta.label,!1):h.type==="footnote_reference_close"?(a=!1,p[":"+f]=l,!1):(a&&l.push(h),!a)}),!s.env.footnotes.list))return;let d=s.env.footnotes.list;s.tokens.push(new s.Token("footnote_block_open","",1));for(let h=0,b=d.length;h0?d[h].count:1;for(let _=0;_0&&t.unshift(["class",n.join(" ")]),t}var ge=se(function(e,n,t,r,i){var o,u=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe([].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],n.ariaHidden?[["aria-hidden","true"]]:[],Object.entries(n.renderAttrs(e,r))))}),Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}),new r.Token("link_close","a",-1)];if(n.space){var s=typeof n.space=="string"?n.space:" ";r.tokens[i+1].children[Y[n.placement]](Object.assign(new r.Token(typeof n.space=="string"?"html_inline":"text","",0),{content:s}))}(o=r.tokens[i+1].children)[Y[n.placement]].apply(o,u)});Object.assign(ge.defaults,{space:!0,placement:"after",ariaHidden:!1});var W=se(ge.renderPermalinkImpl);W.defaults=Object.assign({},ge.defaults,{ariaHidden:!0});var ft=se(function(e,n,t,r,i){var o=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe([].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],Object.entries(n.renderAttrs(e,r))))})].concat(n.safariReaderFix?[new r.Token("span_open","span",1)]:[],r.tokens[i+1].children,n.safariReaderFix?[new r.Token("span_close","span",-1)]:[],[new r.Token("link_close","a",-1)]);r.tokens[i+1].children=o});Object.assign(ft.defaults,{safariReaderFix:!1});var ct=se(function(e,n,t,r,i){var o;if(!["visually-hidden","aria-label","aria-describedby","aria-labelledby"].includes(n.style))throw new Error("`permalink.linkAfterHeader` called with unknown style option `"+n.style+"`");if(!["aria-describedby","aria-labelledby"].includes(n.style)&&!n.assistiveText)throw new Error("`permalink.linkAfterHeader` called without the `assistiveText` option in `"+n.style+"` style");if(n.style==="visually-hidden"&&!n.visuallyHiddenClass)throw new Error("`permalink.linkAfterHeader` called without the `visuallyHiddenClass` option in `visually-hidden` style");var u=r.tokens[i+1].children.filter(function(a){return a.type==="text"||a.type==="code_inline"}).reduce(function(a,p){return a+p.content},""),s=[],c=[];if(n.class&&c.push(["class",n.class]),c.push(["href",n.renderHref(e,r)]),c.push.apply(c,Object.entries(n.renderAttrs(e,r))),n.style==="visually-hidden"){if(s.push(Object.assign(new r.Token("span_open","span",1),{attrs:[["class",n.visuallyHiddenClass]]}),Object.assign(new r.Token("text","",0),{content:n.assistiveText(u)}),new r.Token("span_close","span",-1)),n.space){var l=typeof n.space=="string"?n.space:" ";s[Y[n.placement]](Object.assign(new r.Token(typeof n.space=="string"?"html_inline":"text","",0),{content:l}))}s[Y[n.placement]](Object.assign(new r.Token("span_open","span",1),{attrs:[["aria-hidden","true"]]}),Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}),new r.Token("span_close","span",-1))}else s.push(Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}));n.style==="aria-label"?c.push(["aria-label",n.assistiveText(u)]):["aria-describedby","aria-labelledby"].includes(n.style)&&c.push([n.style,e]);var f=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe(c)})].concat(s,[new r.Token("link_close","a",-1)]);(o=r.tokens).splice.apply(o,[i+3,0].concat(f)),n.wrapper&&(r.tokens.splice(i,0,Object.assign(new r.Token("html_block","",0),{content:n.wrapper[0]+` -`})),r.tokens.splice(i+3+f.length+1,0,Object.assign(new r.Token("html_block","",0),{content:n.wrapper[1]+` -`})))});function lt(e,n,t,r){var i=e,o=r;if(t&&Object.prototype.hasOwnProperty.call(n,i))throw new Error("User defined `id` attribute `"+e+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(n,i);)i=e+"-"+o,o+=1;return n[i]=!0,i}function Z(e,n){n=Object.assign({},Z.defaults,n),e.core.ruler.push("anchor",function(t){t.env.markdownItAnchor||(t.env.markdownItAnchor={});for(var r,i=t.env.markdownItAnchor.slugs||(t.env.markdownItAnchor.slugs={}),o=t.tokens,u=Array.isArray(n.level)?(r=n.level,function(a){return r.includes(a)}):(function(a){return function(p){return p>=a}})(n.level),s=0;s=48&&s<=57)return!1;if(!n){let c=e.push("math_inline","span",0);c.content=t.slice(r+1,o)}return e.pos=o+1,!0}function ro(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.slice(i,i+2)!=="$$")return!1;i+=2;let u=e.src.slice(i,o);if(r)return!0;let s="",c=n,l=!1;if(u.trim().endsWith("$$"))s=u.trim().slice(0,-2),l=!0;else for(s=u.trim()?u+` +`}function $i(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i);return e[n].meta.subId>0&&(o+=`:${e[n].meta.subId}`),`
  • `}function Ui(){return`
  • +`}function qi(e,n,t,r,i){let o=i.rules.footnote_anchor_name(e,n,t,r,i);return e[n].meta.subId>0&&(o+=`:${e[n].meta.subId}`),` \u21A9\uFE0E`}function Le(e){let n=e.helpers.parseLinkLabel,t=e.utils.isSpace;e.renderer.rules.footnote_ref=Ni,e.renderer.rules.footnote_block_open=Pi,e.renderer.rules.footnote_block_close=Oi,e.renderer.rules.footnote_open=$i,e.renderer.rules.footnote_close=Ui,e.renderer.rules.footnote_anchor=qi,e.renderer.rules.footnote_caption=Li,e.renderer.rules.footnote_anchor_name=Ji;function r(s,c,l,h){let a=s.bMarks[c]+s.tShift[c],p=s.eMarks[c];if(a+4>p||s.src.charCodeAt(a)!==91||s.src.charCodeAt(a+1)!==94)return!1;let d;for(d=a+2;d=p||s.src.charCodeAt(++d)!==58)return!1;if(h)return!0;d++,s.env.footnotes||(s.env.footnotes={}),s.env.footnotes.refs||(s.env.footnotes.refs={});let f=s.src.slice(a+2,d-2);s.env.footnotes.refs[`:${f}`]=-1;let b=new s.Token("footnote_reference_open","",1);b.meta={label:f},b.level=s.level++,s.tokens.push(b);let k=s.bMarks[c],x=s.tShift[c],R=s.sCount[c],_=s.parentType,m=d,g=s.sCount[c]+d-(s.bMarks[c]+s.tShift[c]),v=g;for(;d=l||s.src.charCodeAt(h)!==94||s.src.charCodeAt(h+1)!==91)return!1;let a=h+2,p=n(s,h+1);if(p<0)return!1;if(!c){s.env.footnotes||(s.env.footnotes={}),s.env.footnotes.list||(s.env.footnotes.list=[]);let d=s.env.footnotes.list.length,f=[];s.md.inline.parse(s.src.slice(a,p),s.md,s.env,f);let b=s.push("footnote_ref","",0);b.meta={id:d},s.env.footnotes.list[d]={content:s.src.slice(a,p),tokens:f}}return s.pos=p+1,s.posMax=l,!0}function o(s,c){let l=s.posMax,h=s.pos;if(h+3>l||!s.env.footnotes||!s.env.footnotes.refs||s.src.charCodeAt(h)!==91||s.src.charCodeAt(h+1)!==94)return!1;let a;for(a=h+2;a=l)return!1;a++;let p=s.src.slice(h+2,a-1);if(typeof s.env.footnotes.refs[`:${p}`]>"u")return!1;if(!c){s.env.footnotes.list||(s.env.footnotes.list=[]);let d;s.env.footnotes.refs[`:${p}`]<0?(d=s.env.footnotes.list.length,s.env.footnotes.list[d]={label:p,count:0},s.env.footnotes.refs[`:${p}`]=d):d=s.env.footnotes.refs[`:${p}`];let f=s.env.footnotes.list[d].count;s.env.footnotes.list[d].count++;let b=s.push("footnote_ref","",0);b.meta={id:d,subId:f,label:p}}return s.pos=a,s.posMax=l,!0}function u(s){let c,l,h,a=!1,p={};if(!s.env.footnotes||(s.tokens=s.tokens.filter(function(f){return f.type==="footnote_reference_open"?(a=!0,l=[],h=f.meta.label,!1):f.type==="footnote_reference_close"?(a=!1,p[":"+h]=l,!1):(a&&l.push(f),!a)}),!s.env.footnotes.list))return;let d=s.env.footnotes.list;s.tokens.push(new s.Token("footnote_block_open","",1));for(let f=0,b=d.length;f0?d[f].count:1;for(let _=0;_0&&t.unshift(["class",n.join(" ")]),t}var ge=se(function(e,n,t,r,i){var o,u=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe([].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],n.ariaHidden?[["aria-hidden","true"]]:[],Object.entries(n.renderAttrs(e,r))))}),Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}),new r.Token("link_close","a",-1)];if(n.space){var s=typeof n.space=="string"?n.space:" ";r.tokens[i+1].children[Y[n.placement]](Object.assign(new r.Token(typeof n.space=="string"?"html_inline":"text","",0),{content:s}))}(o=r.tokens[i+1].children)[Y[n.placement]].apply(o,u)});Object.assign(ge.defaults,{space:!0,placement:"after",ariaHidden:!1});var W=se(ge.renderPermalinkImpl);W.defaults=Object.assign({},ge.defaults,{ariaHidden:!0});var dt=se(function(e,n,t,r,i){var o=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe([].concat(n.class?[["class",n.class]]:[],[["href",n.renderHref(e,r)]],Object.entries(n.renderAttrs(e,r))))})].concat(n.safariReaderFix?[new r.Token("span_open","span",1)]:[],r.tokens[i+1].children,n.safariReaderFix?[new r.Token("span_close","span",-1)]:[],[new r.Token("link_close","a",-1)]);r.tokens[i+1].children=o});Object.assign(dt.defaults,{safariReaderFix:!1});var lt=se(function(e,n,t,r,i){var o;if(!["visually-hidden","aria-label","aria-describedby","aria-labelledby"].includes(n.style))throw new Error("`permalink.linkAfterHeader` called with unknown style option `"+n.style+"`");if(!["aria-describedby","aria-labelledby"].includes(n.style)&&!n.assistiveText)throw new Error("`permalink.linkAfterHeader` called without the `assistiveText` option in `"+n.style+"` style");if(n.style==="visually-hidden"&&!n.visuallyHiddenClass)throw new Error("`permalink.linkAfterHeader` called without the `visuallyHiddenClass` option in `visually-hidden` style");var u=r.tokens[i+1].children.filter(function(a){return a.type==="text"||a.type==="code_inline"}).reduce(function(a,p){return a+p.content},""),s=[],c=[];if(n.class&&c.push(["class",n.class]),c.push(["href",n.renderHref(e,r)]),c.push.apply(c,Object.entries(n.renderAttrs(e,r))),n.style==="visually-hidden"){if(s.push(Object.assign(new r.Token("span_open","span",1),{attrs:[["class",n.visuallyHiddenClass]]}),Object.assign(new r.Token("text","",0),{content:n.assistiveText(u)}),new r.Token("span_close","span",-1)),n.space){var l=typeof n.space=="string"?n.space:" ";s[Y[n.placement]](Object.assign(new r.Token(typeof n.space=="string"?"html_inline":"text","",0),{content:l}))}s[Y[n.placement]](Object.assign(new r.Token("span_open","span",1),{attrs:[["aria-hidden","true"]]}),Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}),new r.Token("span_close","span",-1))}else s.push(Object.assign(new r.Token("html_inline","",0),{content:n.symbol,meta:ke}));n.style==="aria-label"?c.push(["aria-label",n.assistiveText(u)]):["aria-describedby","aria-labelledby"].includes(n.style)&&c.push([n.style,e]);var h=[Object.assign(new r.Token("link_open","a",1),{attrs:Oe(c)})].concat(s,[new r.Token("link_close","a",-1)]);(o=r.tokens).splice.apply(o,[i+3,0].concat(h)),n.wrapper&&(r.tokens.splice(i,0,Object.assign(new r.Token("html_block","",0),{content:n.wrapper[0]+` +`})),r.tokens.splice(i+3+h.length+1,0,Object.assign(new r.Token("html_block","",0),{content:n.wrapper[1]+` +`})))});function at(e,n,t,r){var i=e,o=r;if(t&&Object.prototype.hasOwnProperty.call(n,i))throw new Error("User defined `id` attribute `"+e+"` is not unique. Please fix it in your Markdown to continue.");for(;Object.prototype.hasOwnProperty.call(n,i);)i=e+"-"+o,o+=1;return n[i]=!0,i}function Z(e,n){n=Object.assign({},Z.defaults,n),e.core.ruler.push("anchor",function(t){t.env.markdownItAnchor||(t.env.markdownItAnchor={});for(var r,i=t.env.markdownItAnchor.slugs||(t.env.markdownItAnchor.slugs={}),o=t.tokens,u=Array.isArray(n.level)?(r=n.level,function(a){return r.includes(a)}):(function(a){return function(p){return p>=a}})(n.level),s=0;s=48&&s<=57)return!1;if(!n){let c=e.push("math_inline","span",0);c.content=t.slice(r+1,o)}return e.pos=o+1,!0}function io(e,n,t,r){let i=e.bMarks[n]+e.tShift[n],o=e.eMarks[n];if(e.sCount[n]-e.blkIndent>=4||e.src.slice(i,i+2)!=="$$")return!1;i+=2;let u=e.src.slice(i,o);if(r)return!0;let s="",c=n,l=!1;if(u.trim().endsWith("$$"))s=u.trim().slice(0,-2),l=!0;else for(s=u.trim()?u+` `:"";++c`${n(t[r].content)}`,e.renderer.rules.math_block=(t,r)=>`
    ${n(t[r].content)}
    -`}var io=new nt({html:!0,linkify:!0,typographer:!1}).use($e).use(Le).use(_t.default,{enabled:!1}).use(Z,{tabIndex:!1}).use(kt.default,()=>{}),mt=e=>{try{return decodeURIComponent(e)}catch{return e}};function oo(e){if(/^([a-z][a-z0-9+.-]*:|\/\/|#)/i.test(e))return e;let n=e.split(/[?#]/)[0];if(n.startsWith("/"))return"/a/"+encodeURIComponent(mt(n));let t=[],r=0;for(let i of n.split("/"))i===""||i==="."||(i===".."?t.length?t.pop():r++:t.push(encodeURIComponent(mt(i))));return(r?`/up/${r}/`:"/a/")+t.join("/")}function so(e){for(let n of e.querySelectorAll("img[src]")){let t=oo(n.getAttribute("src"));if(Ge(t)){let r=document.createElement("div");r.className="model",r.dataset.src=t,r.setAttribute("role","img"),r.setAttribute("aria-label",n.alt||"3D model"),r.textContent=n.alt?"Loading "+n.alt+"\u2026":"Loading 3D model\u2026",n.replaceWith(r)}else n.src=t,n.loading="lazy"}}var Ue=0;async function hs(e,n,t){let r=++Ue,i=He.sanitize(io.render(n),{ADD_ATTR:["target"]}),o=t.get();e.style.minHeight=e.offsetHeight+"px",Ye(),e.innerHTML=i,so(e),t.set(o),await uo(e,r),r===Ue&&(e.style.minHeight="",t.set(o))}function uo(e,n){let t=()=>n!==Ue,r=a=>[...e.querySelectorAll(`pre > code.language-${a}`)],i=r("mermaid"),o=r("chart"),u=new Set([...i,...o]),s=[...e.querySelectorAll("pre > code[class*='language-']")].filter(a=>!u.has(a)),c=[...e.querySelectorAll(".math")],l=[...e.querySelectorAll("div.model")],f=(a,p,d)=>a.length?d().then(h=>!t()&&h(a)).catch(h=>a.forEach(b=>!t()&&b.isConnected&&Xe(b.closest("pre")||b,p,h))):Promise.resolve();return Promise.allSettled([f(s,"Code highlighting",async()=>(await import("./code-45EXS5WV.js")).highlightAll),f(c,"Math",async()=>(await import("./math-T547EQXU.js")).renderMath),f(i,"Mermaid",async()=>(await import("./mermaid-O4TCBJV4.js")).renderMermaid),f(o,"Chart",async()=>(await import("./chart-PELGCLPX.js")).renderCharts),f(l,"3D viewer",async()=>(await import("./model-MGZXFMWN.js")).renderModels)])}async function co(){let e=[];document.querySelector("figure.mermaid")&&e.push(import("./mermaid-O4TCBJV4.js").then(n=>n.rethemeMermaid())),document.querySelector("figure.chart")&&e.push(import("./chart-PELGCLPX.js").then(n=>n.rethemeCharts())),await Promise.allSettled(e)}matchMedia("(prefers-color-scheme: dark)").addEventListener("change",co);export{hs as a,co as b}; +`}if(!l)return!1;e.line=c+1;let h=e.push("math_block","div",0);return h.content=s.trim(),h.map=[n,e.line],!0}function $e(e){e.inline.ruler.after("escape","math_inline",ro),e.block.ruler.after("blockquote","math_block",io,{alt:["paragraph","reference","blockquote","list"]});let n=e.utils.escapeHtml;e.renderer.rules.math_inline=(t,r)=>`${n(t[r].content)}`,e.renderer.rules.math_block=(t,r,i,o,u)=>`
    ${n(t[r].content)}
    +`}var oo={note:"Note",tip:"Tip",important:"Important",warning:"Warning",caution:"Caution"},so=/^\[!(note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i;function uo(e){let n=e.tokens;for(let t=0;t+2c.type==="paragraph_close");s&&(s.hidden=!0)}}}function Ue(e){e.core.ruler.before("inline","github_alerts",uo);let n=e.renderer.rules.blockquote_open??((t,r,i,o,u)=>u.renderToken(t,r,i));e.renderer.rules.blockquote_open=(t,r,i,o,u)=>{let s=n(t,r,i,o,u),c=t[r].meta?.alert;return c?`${s}

    ${oo[c]}

    +`:s}}function co(e){e.core.ruler.push("source_lines",n=>{for(let t of n.tokens)t.map&&t.nesting>=0&&t.type!=="inline"&&t.attrSet("data-line",String(t.map[0]))})}var lo=new tt({html:!0,linkify:!0,typographer:!1}).use($e).use(Le).use(kt.default,{enabled:!1}).use(Z,{tabIndex:!1}).use(gt.default,()=>{}).use(Ue).use(co),_t=e=>{try{return decodeURIComponent(e)}catch{return e}};function ao(e){if(/^([a-z][a-z0-9+.-]*:|\/\/|#)/i.test(e))return e;let n=e.split(/[?#]/)[0];if(n.startsWith("/"))return"/a/"+encodeURIComponent(_t(n));let t=[],r=0;for(let i of n.split("/"))i===""||i==="."||(i===".."?t.length?t.pop():r++:t.push(encodeURIComponent(_t(i))));return(r?`/up/${r}/`:"/a/")+t.join("/")}function fo(e){for(let n of e.querySelectorAll("img[src]")){let t=ao(n.getAttribute("src"));if(Ke(t)){let r=document.createElement("div");r.className="model",r.dataset.src=t,r.setAttribute("role","img"),r.setAttribute("aria-label",n.alt||"3D model"),r.textContent=n.alt?"Loading "+n.alt+"\u2026":"Loading 3D model\u2026",n.replaceWith(r)}else n.src=t,n.loading="lazy"}}var qe=0;async function gs(e,n,t){let r=++qe,i=Xe.sanitize(lo.render(n),{ADD_ATTR:["target"]}),o=t.get();e.style.minHeight=e.offsetHeight+"px",Ge(),e.innerHTML=i;for(let u of e.querySelectorAll("pre > code[data-line]"))u.parentElement.dataset.line=u.dataset.line,u.removeAttribute("data-line");fo(e),t.set(o),await ho(e,r),r===qe&&(e.style.minHeight="",t.set(o))}function ho(e,n){let t=()=>n!==qe,r=a=>[...e.querySelectorAll(`pre > code.language-${a}`)],i=r("mermaid"),o=r("chart"),u=new Set([...i,...o]),s=[...e.querySelectorAll("pre > code[class*='language-']")].filter(a=>!u.has(a)),c=[...e.querySelectorAll(".math")],l=[...e.querySelectorAll("div.model")],h=(a,p,d)=>a.length?d().then(f=>!t()&&f(a)).catch(f=>a.forEach(b=>!t()&&b.isConnected&&Ye(b.closest("pre")||b,p,f))):Promise.resolve();return Promise.allSettled([h(s,"Code highlighting",async()=>(await import("./code-45EXS5WV.js")).highlightAll),h(c,"Math",async()=>(await import("./math-2ONFTABO.js")).renderMath),h(i,"Mermaid",async()=>(await import("./mermaid-4OQNCKUU.js")).renderMermaid),h(o,"Chart",async()=>(await import("./chart-24LXX2TX.js")).renderCharts),h(l,"3D viewer",async()=>(await import("./model-6PF44EF3.js")).renderModels)])}async function po(){let e=[];document.querySelector("figure.mermaid")&&e.push(import("./mermaid-4OQNCKUU.js").then(n=>n.rethemeMermaid())),document.querySelector("figure.chart")&&e.push(import("./chart-24LXX2TX.js").then(n=>n.rethemeCharts())),await Promise.allSettled(e)}matchMedia("(prefers-color-scheme: dark)").addEventListener("change",po);export{gs as a,po as b}; diff --git a/dist/chunks/chunk-USGABQGL.js b/dist/chunks/chunk-USGABQGL.js deleted file mode 100644 index 3cb1698..0000000 --- a/dist/chunks/chunk-USGABQGL.js +++ /dev/null @@ -1,3 +0,0 @@ -var s=new Map;function i(e){return s.has(e)||s.set(e,new Promise((n,o)=>{let t=document.createElement("link");t.rel="stylesheet",t.href=e,t.onload=n,t.onerror=()=>o(new Error("failed to load "+e)),document.head.appendChild(t)})),s.get(e)}function l(e,n,o){let t=document.createElement("div");t.className="block-error";let a=String(o&&o.message?o.message:o).split(` -`).slice(0,6).join(` -`);t.innerHTML="
    ",t.firstChild.textContent=n+" failed",t.lastChild.textContent=a,e.replaceWith(t)}var r=new Set,m=e=>r.add(e);function p(){for(let e of r)try{e()}catch{}r.clear()}var c={mode:document.documentElement.dataset.theme||"system"},d={on:!1},h=()=>!d.on&&(c.mode==="dark"||c.mode==="system"&&matchMedia("(prefers-color-scheme: dark)").matches);export{i as a,l as b,m as c,p as d,c as e,d as f,h as g};
    diff --git a/dist/chunks/editor-NGOILUZO.js b/dist/chunks/editor-J3NDK5HN.js
    similarity index 99%
    rename from dist/chunks/editor-NGOILUZO.js
    rename to dist/chunks/editor-J3NDK5HN.js
    index 63e11e1..da8052b 100644
    --- a/dist/chunks/editor-NGOILUZO.js
    +++ b/dist/chunks/editor-J3NDK5HN.js
    @@ -25,4 +25,4 @@ import"./chunk-EMBIDUMY.js";var xs=[],Ba=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,
     		\${}
     	}
     }`,{label:"class",detail:"definition",type:"keyword"}),ye('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ye('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],RS=Ud.concat([ye("interface ${name} {\n	${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ye("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ye("enum ${name} {\n	${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Id=new ji,Gd=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function _n(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}var MS=["FunctionDeclaration"],LS={FunctionDeclaration:_n("function"),ClassDeclaration:_n("class"),ClassExpression:()=>!0,EnumDeclaration:_n("constant"),TypeAliasDeclaration:_n("type"),NamespaceDeclaration:_n("namespace"),VariableDefinition(n,e){n.matchContext(MS)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function Fd(n,e){let t=Id.get(e);if(t)return t;let i=[],r=!0;function s(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(M.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=LS[o.name];if(l&&l(o,s)||Gd.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Fd(n,o.node))i.push(l);return!1}}),Id.set(e,i),i}var Vd=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Hd=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function jS(n){let e=V(n.state).resolveInner(n.pos,-1);if(Hd.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Vd.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let r=e;r;r=r.parent)Gd.has(r.name)&&(i=i.concat(Fd(n.state.doc,r)));return{options:i,from:t?e.from:n.pos,validFor:Vd}}var et=Lt.define({name:"javascript",parser:Bd.configure({props:[bt.add({IfStatement:Di({except:/^\s*({|else\b)/}),TryStatement:Di({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Qf,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:yf({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Di({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),St.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":zr,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Kd={test:n=>/^JSX/.test(n.name),facet:kn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},ba=et.configure({dialect:"ts"},"typescript"),Sa=et.configure({dialect:"jsx",props:[Yr.add(n=>n.isTop?[Kd]:void 0)]}),ya=et.configure({dialect:"jsx ts",props:[Yr.add(n=>n.isTop?[Kd]:void 0)]},"typescript"),Jd=n=>({label:n,type:"keyword"}),eO="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Jd),ES=eO.concat(["declare","implements","private","protected","public"].map(Jd));function tO(n={}){let e=n.jsx?n.typescript?ya:Sa:n.typescript?ba:et,t=n.typescript?RS.concat(ES):Ud.concat(eO);return new Fe(e,[et.data.of({autocomplete:yu(Hd,Su(t))}),et.data.of({autocomplete:jS}),n.jsx?YS:[]])}function _S(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function Nd(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}var DS=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),YS=C.inputHandler.of((n,e,t,i,r)=>{if((DS?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!et.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=V(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:""}};if(i=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,O=d.parent;if(O&&d.from==c-2&&((u=Nd(o.doc,O.firstChild,c))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let p=`${u}>`;return{range:S.cursor(c+p.length,-1),changes:{from:c,insert:p}}}}else if(i==">"){let d=_S(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=Nd(o.doc,d,c)))return{range:a,changes:{from:c,insert:``}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Dn=["_blank","_self","_top","_parent"],xa=["ascii","utf-8","utf-16","latin1","latin1"],Qa=["get","post","put","delete"],ka=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Re=["true","false"],T={},zS={a:{attrs:{href:null,ping:null,type:null,media:null,target:Dn,hreflang:null}},abbr:T,address:T,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:T,aside:T,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:T,base:{attrs:{href:null,target:Dn}},bdi:T,bdo:T,blockquote:{attrs:{cite:null}},body:T,br:T,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ka,formmethod:Qa,formnovalidate:["novalidate"],formtarget:Dn,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:T,center:T,cite:T,code:T,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:T,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:T,div:T,dl:T,dt:T,em:T,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:T,figure:T,footer:T,form:{attrs:{action:null,name:null,"accept-charset":xa,autocomplete:["on","off"],enctype:ka,method:Qa,novalidate:["novalidate"],target:Dn}},h1:T,h2:T,h3:T,h4:T,h5:T,h6:T,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:T,hgroup:T,hr:T,html:{attrs:{manifest:null}},i:T,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:ka,formmethod:Qa,formnovalidate:["novalidate"],formtarget:Dn,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:T,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:T,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:T,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:xa,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:T,noscript:T,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:T,param:{attrs:{name:null,value:null}},pre:T,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:T,rt:T,ruby:T,samp:T,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:xa}},section:T,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:T,source:{attrs:{src:null,type:null,media:null}},span:T,strong:T,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:T,summary:T,sup:T,table:T,tbody:T,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:T,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:T,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:T,time:{attrs:{datetime:null}},title:T,tr:T,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:T,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:T},sO={accesskey:null,class:null,contenteditable:Re,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Re,autocorrect:Re,autocapitalize:Re,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Re,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Re,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Re,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Re,"aria-hidden":Re,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Re,"aria-multiselectable":Re,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Re,"aria-relevant":null,"aria-required":Re,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},oO="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(n=>"on"+n);for(let n of oO)sO[n]=null;var ci=class{constructor(e,t){this.tags={...zS,...e},this.globalAttrs={...sO,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};ci.default=new ci;function fi(n,e,t=n.length){if(!e)return"";let i=e.firstChild,r=i&&i.getChild("TagName");return r?n.sliceString(r.from,Math.min(r.to,t)):""}function Ii(n,e=!1){for(;n;n=n.parent)if(n.name=="Element")if(e)e=!1;else return n;return null}function lO(n,e,t){let i=t.tags[fi(n,Ii(e))];return i?.children||t.allTags}function wa(n,e){let t=[];for(let i=Ii(e);i&&!i.type.isTop;i=Ii(i.parent)){let r=fi(n,i);if(r&&i.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(r)}return t}var aO=/^[:\-\.\w\u00b7-\uffff]*$/;function iO(n,e,t,i,r){let s=/\s*>/.test(n.sliceDoc(r,r+5))?"":">",o=Ii(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:r,options:lO(n.doc,o,e).map(l=>({label:l,type:"type"})).concat(wa(n.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function nO(n,e,t,i){let r=/\s*>/.test(n.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:wa(n.doc,e).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:aO}}function qS(n,e,t,i){let r=[],s=0;for(let o of lO(n.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of wa(n.doc,t))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function WS(n,e,t,i,r){let s=Ii(t),o=s?e.tags[fi(n.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:r,options:a.map(h=>({label:h,type:"property"})),validFor:aO}}function BS(n,e,t,i,r){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a;if(o){let h=n.sliceDoc(o.from,o.to),c=e.globalAttrs[h];if(!c){let f=Ii(t),u=f?e.tags[fi(n.doc,f)]:null;c=u?.attrs&&u.attrs[h]}if(c){let f=n.sliceDoc(i,r).toLowerCase(),u='"',d='"';/^['"]/.test(f)?(a=f[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",d=n.sliceDoc(r,r+1)==f[0]?"":f[0],f=f.slice(1),i++):a=/^[^\s<>='"]*$/;for(let O of c)l.push({label:O,apply:u+O+d,type:"constant"})}}return{from:i,to:r,options:l,validFor:a}}function hO(n,e){let{state:t,pos:i}=e,r=V(t).resolveInner(i,-1),s=r.resolve(i);for(let o=i,l;s==r&&(l=r.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromhO(i,r)}var VS=et.parser.configure({top:"SingleExpression"}),fO=[{tag:"script",attrs:n=>n.type=="text/typescript"||n.lang=="ts",parser:ba.parser},{tag:"script",attrs:n=>n.type=="text/babel"||n.type=="text/jsx",parser:Sa.parser},{tag:"script",attrs:n=>n.type=="text/typescript-jsx",parser:ya.parser},{tag:"script",attrs(n){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(n.type)},parser:VS},{tag:"script",attrs(n){return!n.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(n.type)},parser:et.parser},{tag:"style",attrs(n){return(!n.lang||n.lang=="css")&&(!n.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(n.type))},parser:En.parser}],uO=[{name:"style",parser:En.parser.configure({top:"Styles"})}].concat(oO.map(n=>({name:n,parser:et.parser}))),dO=Lt.define({name:"html",parser:vd.configure({props:[bt.add({Element(n){let e=/^(\s*)(<\/)?/.exec(n.textAfter);return n.node.to<=n.pos+e[0].length?n.continue():n.lineIndent(n.node.from)+(e[2]?0:n.unit)},"OpenTag CloseTag SelfClosingTag"(n){return n.column(n.node.from)+n.unit},Document(n){if(n.pos+/\s*/.exec(n.textAfter)[0].lengthn.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ss=dO.configure({wrap:fa(fO,uO)});function OO(n={}){let e="",t;n.matchClosingTags===!1&&(e="noMatch"),n.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(n.nestedLanguages&&n.nestedLanguages.length||n.nestedAttributes&&n.nestedAttributes.length)&&(t=fa((n.nestedLanguages||[]).concat(fO),(n.nestedAttributes||[]).concat(uO)));let i=t?dO.configure({wrap:t,dialect:e}):e?ss.configure({dialect:e}):ss;return new Fe(i,[ss.data.of({autocomplete:IS(n)}),n.autoCloseTags!==!1?US:[],tO().support,zd().support])}var rO=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function NS(n,e,t){for(var i;;){if(((i=e.lastChild)===null||i===void 0?void 0:i.name)!="CloseTag")return!1;let r=e.parent;if(!r||fi(n,r)!=t)return!0;e=r}}var US=C.inputHandler.of((n,e,t,i,r)=>{if(n.composing||n.state.readOnly||e!=t||i!=">"&&i!="/"||!ss.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let c=o.doc.sliceString(a.from-1,a.to)==i,{head:f}=a,u=V(o).resolveInner(f,-1),d;if(c&&i==">"&&u.name=="EndTag"){let O=u.parent;if((d=fi(o.doc,O.parent,f))&&!rO.has(d)&&!NS(o.doc,O.parent,d)){let p=f+(o.doc.sliceString(f,f+1)===">"?1:0),g=``;return{range:a,changes:{from:f,to:p,insert:g}}}}else if(c&&i=="/"&&u.name=="IncompleteCloseTag"){let O=u.parent;if(u.from==f-2&&((h=O.lastChild)===null||h===void 0?void 0:h.name)!="CloseTag"&&(d=fi(o.doc,O,f))&&!rO.has(d)){let p=f+(o.doc.sliceString(f,f+1)===">"?1:0),g=`${d}>`;return{range:S.cursor(f+g.length,-1),changes:{from:f,to:p,insert:g}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var gO=kn({commentTokens:{block:{open:""}}}),bO=new Z,SO=Hu.configure({props:[St.add(n=>!n.is("Block")||n.is("Document")||va(n)!=null||GS(n)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),bO.add(va),bt.add({Document:()=>null}),Mt.add({Document:gO})]});function va(n){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(n.name);return e?+e[1]:void 0}function GS(n){return n.name=="OrderedList"||n.name=="BulletList"}function FS(n,e){let t=n;for(;;){let i=t.nextSibling,r;if(!i||(r=va(i.type))!=null&&r<=e)break;t=i}return t.to}var HS=kf.of((n,e,t)=>{for(let i=V(n).resolveInner(t,-1);i&&!(i.fromt)return{from:t,to:s}}return null});function Ca(n){return new Se(gO,n,[],"markdown")}var KS=Ca(SO),JS=SO.configure([ed,nd,id,rd,{props:[St.add({Table:(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}]),os=Ca(JS);function e1(n,e){return t=>{if(t&&n){let i=null;if(t=/\S*/.exec(t)[0],typeof n=="function"?i=n(t):i=Qn.matchLanguageName(n,t,!0),i instanceof Qn)return i.support?i.support.language.parser:yn.getSkippingParser(i.load());if(i)return i.parser}return e?e.parser:null}}var Yn=class{constructor(e,t,i,r,s,o,l){this.node=e,this.from=t,this.to=i,this.spaceBefore=r,this.spaceAfter=s,this.type=o,this.item=l}blank(e,t=!0){let i=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;i.length0;r--)i+=" ";return i+(t?this.spaceAfter:"")}}marker(e,t){let i=this.node.name=="OrderedList"?String(+xO(this.item,e)[2]+t):"";return this.spaceBefore+i+this.type+this.spaceAfter}};function yO(n,e){let t=[],i=[];for(let r=n;r;r=r.parent){if(r.name=="FencedCode")return i;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let s=t[r],o,l=e.lineAt(s.from),a=s.from-l.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(a))))i.push(new Yn(s,a,a+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(a)))){let h=o[3],c=o[0].length;h.length>=4&&(h=h.slice(0,h.length-4),c-=4),i.push(new Yn(s.parent,a,a+c,o[1],h,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(a)))){let h=o[4],c=o[0].length;h.length>4&&(h=h.slice(0,h.length-4),c-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),i.push(new Yn(s.parent,a,a+c,o[1],h,f,s))}}return i}function xO(n,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(n.from,n.from+10))}function $a(n,e,t,i=0){for(let r=-1,s=n;;){if(s.name=="ListItem"){let l=xO(s,e),a=+l[2];if(r>=0){if(a!=r+1)return;t.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(r+2+i)})}r=a}let o=s.nextSibling;if(!o)break;s=o}}function Xa(n,e){let t=/^[ \t]*/.exec(n)[0].length;if(!t||e.facet(jt)!="	")return n;let i=ve(n,4,t),r="";for(let s=i;s>0;)s>=4?(r+="	",s-=4):(r+=" ",s--);return r+n.slice(t)}var t1=(n={})=>({state:e,dispatch:t})=>{let i=V(e),{doc:r}=e,s=null,o=e.changeByRange(l=>{if(!l.empty||!os.isActiveAt(e,l.from,-1)&&!os.isActiveAt(e,l.from,1))return s={range:l};let a=l.from,h=r.lineAt(a),c=yO(i.resolveInner(a,-1),r);for(;c.length&&c[c.length-1].from>a-h.from;)c.pop();if(!c.length)return s={range:l};let f=c[c.length-1];if(f.to-f.spaceAfter.length>a-h.from)return s={range:l};let u=a>=f.to-f.spaceAfter.length&&!/\S/.test(h.text.slice(f.to));if(f.item&&u){if(f.item.from]*$/.test(h.text.slice(0,f.to)))return s={range:l};let b=f.node.firstChild,k=f.node.getChild("ListItem","ListItem");if(b.to>=a||k&&k.to0&&!/[^\s>]/.test(r.lineAt(h.from-1).text)||n.nonTightLists===!1){let y=c.length>1?c[c.length-2]:null,A,x="";y&&y.item?(A=h.from+y.from,x=y.marker(r,1)):A=h.from+(y?y.to:0);let w=[{from:A,to:a,insert:x}];return f.node.name=="OrderedList"&&$a(f.item,r,w,-2),y&&y.node.name=="OrderedList"&&$a(y.item,r,w),{range:S.cursor(A+x.length),changes:w}}else{let y=mO(c,e,h);return{range:S.cursor(a+y.length+1),changes:{from:h.from,insert:y+e.lineBreak}}}}if(f.node.name=="Blockquote"&&u&&h.from){let b=r.lineAt(h.from-1),k=/>\s*$/.exec(b.text);if(k&&k.index==f.from){let y=e.changes([{from:b.from+k.index,to:b.to},{from:h.from+f.from,to:h.to}]);return{range:l.map(y),changes:y}}}let d=[];f.node.name=="OrderedList"&&$a(f.item,r,d);let O=f.item&&f.item.from]*/.exec(h.text)[0].length>=f.to)for(let b=0,k=c.length-1;b<=k;b++)p+=b==k&&!O?c[b].marker(r,1):c[b].blank(bh.from&&/\s/.test(h.text.charAt(g-h.from-1));)g--;return p=Xa(p,e),n1(f.node,e.doc)&&(p=mO(c,e,h)+e.lineBreak+p),d.push({from:g,to:a,insert:e.lineBreak+p}),{range:S.cursor(g+p.length+1),changes:d}});return s?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},i1=t1();function pO(n){return n.name=="QuoteMark"||n.name=="ListMark"}function n1(n,e){if(n.name!="OrderedList"&&n.name!="BulletList")return!1;let t=n.firstChild,i=n.getChild("ListItem","ListItem");if(!i)return!1;let r=e.lineAt(t.to),s=e.lineAt(i.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1){let t=V(n),i=null,r=n.changeByRange(s=>{let o=s.from,{doc:l}=n;if(s.empty&&os.isActiveAt(n,s.from)){let a=l.lineAt(o),h=yO(r1(t,o),l);if(h.length){let c=h[h.length-1],f=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-a.from>f&&!/\S/.test(a.text.slice(f,o-a.from)))return{range:S.cursor(a.from+f),changes:{from:a.from+f,to:o}};if(o-a.from==f&&(c.item&&a.from<=c.item.from||/^[\s>]*$/.test(a.text.slice(0,c.to)))){let u=a.from+c.from;if(c.item&&c.node.from{var t;let{main:i}=e.state.selection;if(i.empty)return!1;let r=(t=n.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!os.isActiveAt(e.state,i.from,1)))return!1;let s=V(e.state),o=!1;return s.iterate({from:i.from,to:i.to,enter:l=>{(l.from>i.from||h1.test(l.name))&&(o=!0)},leave:l=>{l.ton.normalize("NFKD"):n=>n,ui=class{constructor(e,t,i=0,r=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=s?l=>s(wO(l)):wO,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ji(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=js(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=en(e);let r=this.normalize(t);if(r.length)for(let s=0,o=i,l=!0;;s++){let a=r.charCodeAt(s),h=this.match(a,o,l,this.bufferPos+this.bufferStart,s==r.length-1);if(h)return this.value=h,this;if(s==r.length-1)break;l&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,r=i+t[0].length;if(this.matchPos=us(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||r.to<=t){let l=new n(t,e.sliceString(t,i));return Ta.set(e,l),l}if(r.from==t&&r.to==i)return r;let{text:s,from:o}=r;return o>t&&(s=e.sliceString(t,o)+s,o=t),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,r=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,precise:!0,match:t},this.matchPos=us(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=cs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(hs.prototype[Symbol.iterator]=fs.prototype[Symbol.iterator]=function(){return this});function f1(n){try{return new RegExp(n,ja),!0}catch{return!1}}function us(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}var u1=n=>{let e=Fc(n,"cm-goto-line");if(e){let o=e.dom.querySelector("input[type=text]");return o&&o.select(),!0}let{state:t}=n,i=String(t.doc.lineAt(n.state.selection.main.head).number),{close:r,result:s}=Gc(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return s.then(o=>{let l=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!l){n.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,h,c,f,u]=l,d=f?+f.slice(1):0,O=c?+c:a.number;if(c&&u){let b=O/100;h&&(b=b*(h=="-"?-1:1)+a.number/t.doc.lines),O=Math.round(t.doc.lines*b)}else c&&h&&(O=O*(h=="-"?-1:1)+a.number);let p=t.doc.line(Math.max(1,Math.min(t.doc.lines,O))),g=S.cursor(p.from+Math.max(0,Math.min(d,p.length)));n.dispatch({effects:[r,C.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0};var d1=({state:n,dispatch:e})=>{let{selection:t}=n,i=S.create(t.ranges.map(r=>n.wordAt(r.head)||S.cursor(r.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function O1(n,e){let{main:t,ranges:i}=n.selection,r=n.wordAt(t.head),s=r&&r.from==t.from&&r.to==t.to;for(let o=!1,l=new ui(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ui(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(s){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var p1=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return d1({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=i))return!1;let r=O1(n,i);return r?(e(n.update({selection:n.selection.addRange(S.range(r.from,r.to),!1),effects:C.scrollIntoView(r.to)})),!0):!1},di=X.define({combine(n){return kt(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ma(e),scrollToMatch:e=>C.scrollIntoView(e)})}});function vO(n){return n?[di.of(n),La]:La}var ds=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||f1(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?`
    -`:i=="r"?"\r":i=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Za(this):new Aa(this)}getCursor(e,t=0,i){let r=e.doc?e:I.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Ni(this,r,t,i):Vi(this,r,t,i)}},Os=class{constructor(e){this.spec=e}};function m1(n,e,t){return(i,r,s,o)=>{if(t&&!t(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):e.doc.sliceString(i,r);return n(l,e,i,r)}}function Vi(n,e,t,i){let r;return n.wholeWord&&(r=g1(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(r=m1(n.test,e,r)),new ui(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),r)}function g1(n,e){return(t,i,r,s)=>((s>t||s+r.length=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Vi(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function b1(n,e,t){return(i,r,s)=>(!t||t(i,r,s))&&n(s[0],e,i,r)}function Ni(n,e,t,i){let r;return n.wholeWord&&(r=S1(e.charCategorizer(e.selection.main.head))),n.test&&(r=b1(n.test,e,r)),new hs(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:r},t,i)}function ps(n,e){return n.slice(ie(n,e,!1),e)}function ms(n,e){return n.slice(e,ie(n,e))}function S1(n){return(e,t,i)=>!i[0].length||(n(ps(i.input,i.index))!=te.Word||n(ms(i.input,i.index))!=te.Word)&&(n(ms(i.input,i.index+i[0].length))!=te.Word||n(ps(i.input,i.index+i[0].length))!=te.Word)}var Za=class extends Os{nextMatch(e,t,i){let r=Ni(this.spec,e,i,e.doc.length).next();return r.done&&(r=Ni(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let s=Math.max(t,i-r*1e4),o=Ni(this.spec,e,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Ni(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},qn=_.define(),Ea=_.define(),qt=fe.define({create(n){return new zn(Ra(n).create(),null)},update(n,e){for(let t of e.effects)t.is(qn)?n=new zn(t.value.create(),n.panel):t.is(Ea)&&(n=new zn(n.query,t.value?_a:null));return n},provide:n=>pn.from(n,e=>e.panel)});var zn=class{constructor(e,t){this.query=e,this.panel=t}},y1=q.mark({class:"cm-searchMatch"}),x1=q.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Q1=Xe.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(qt))}update(n){let e=n.state.field(qt);(e!=n.startState.field(qt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return q.none;let{view:t}=this,i=new nt;for(let r=0,s=t.visibleRanges,o=s.length;rs[r+1].from-500;)a=s[++r].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?x1:y1)})}return i.finish()}},{decorations:n=>n.decorations});function Wn(n){return e=>{let t=e.state.field(qt,!1);return t&&t.query.spec.valid?n(e,t):TO(e)}}var gs=Wn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let r=S.single(i.from,i.to),s=n.state.facet(di);return n.dispatch({selection:r,effects:[Da(n,i),s.scrollToMatch(r.main,n)],userEvent:"select.search"}),XO(n),!0}),bs=Wn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)return!1;let s=S.single(r.from,r.to),o=n.state.facet(di);return n.dispatch({selection:s,effects:[Da(n,r),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),XO(n),!0}),k1=Wn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:S.create(t.map(i=>S.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),w1=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:r}=t.main,s=[],o=0;for(let l=new ui(n.doc,n.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(S.range(l.value.from,l.value.to))}return e(n.update({selection:S.create(s,o),userEvent:"select.search.matches"})),!0},$O=Wn((n,{query:e})=>{let{state:t}=n,{from:i,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,i,i);if(!s)return!1;let o=s,l=[],a,h,c=[];o.precise?o.from==i&&o.to==r&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(C.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=S.single(o.from,o.to).map(f),c.push(Da(n,o)),c.push(t.facet(di).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),$1=Wn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let r of e.matchAll(n.state,1e9)){let{from:s,to:o,precise:l}=r;l&&t.push({from:s,to:o,insert:e.getReplacement(r)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:C.announce.of(i),userEvent:"input.replace.all"}),!0});function _a(n){return n.state.facet(di).createPanel(n)}function Ra(n,e){var t,i,r,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(di);return new ds({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:h.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function CO(n){let e=Xr(n,_a);return e&&e.dom.querySelector("[main-field]")}function XO(n){let e=CO(n);e&&e==n.root.activeElement&&e.select()}var TO=n=>{let e=n.state.field(qt,!1);if(e&&e.panel){let t=CO(n);if(t&&t!=n.root.activeElement){let i=Ra(n.state,e.query.spec);i.valid&&n.dispatch({effects:qn.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Ea.of(!0),e?qn.of(Ra(n.state,e.query.spec)):_.appendConfig.of(La)]});return!0},AO=n=>{let e=n.state.field(qt,!1);if(!e||!e.panel)return!1;let t=Xr(n,_a);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Ea.of(!1)}),!0},ZO=[{key:"Mod-f",run:TO,scope:"editor search-panel"},{key:"F3",run:gs,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:gs,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:AO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:w1},{key:"Mod-Alt-g",run:u1},{key:"Mod-d",run:p1,preventDefault:!0}],Ma=class{constructor(e){this.view=e;let t=this.query=e.state.field(qt).query.spec;this.commit=this.commit.bind(this),this.searchField=ne("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ne("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ne("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ne("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ne("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(r,s,o){return ne("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=ne("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>gs(e),[Me(e,"next")]),i("prev",()=>bs(e),[Me(e,"previous")]),i("select",()=>k1(e),[Me(e,"all")]),ne("label",null,[this.caseField,Me(e,"match case")]),ne("label",null,[this.reField,Me(e,"regexp")]),ne("label",null,[this.wordField,Me(e,"by word")]),...e.state.readOnly?[]:[ne("br"),this.replaceField,i("replace",()=>$O(e),[Me(e,"replace")]),i("replaceAll",()=>$1(e),[Me(e,"replace all")])],ne("button",{name:"close",onclick:()=>AO(e),"aria-label":Me(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new ds({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:qn.of(e)}))}keydown(e){zc(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?bs:gs)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),$O(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(qn)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(di).top}};function Me(n,e){return n.state.phrase(e)}var ls=30,as=/[\s\.,:;?!]/;function Da(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),r=n.state.doc.lineAt(t).to,s=Math.max(i.from,e-ls),o=Math.min(r,t+ls),l=n.state.sliceDoc(s,o);if(s!=i.from){for(let a=0;al.length-ls;a--)if(!as.test(l[a-1])&&as.test(l[a])){l=l.slice(0,a);break}}return C.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}var P1=C.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),La=[qt,_e.low(Q1),P1];var v1=C.theme({"&":{color:"var(--fg)",backgroundColor:"var(--bg)",height:"100%",fontSize:"14px"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Consolas, monospace",lineHeight:"1.55"},".cm-content":{padding:"16px 0",caretColor:"var(--fg)"},".cm-line":{padding:"0 20px"},".cm-cursor":{borderLeftColor:"var(--fg)"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--fg) 5%, transparent)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"color-mix(in srgb, var(--link) 28%, transparent)"},".cm-panels":{backgroundColor:"var(--code)",color:"var(--fg)",borderColor:"var(--border)"},".cm-panels input, .cm-panels button":{font:"inherit",color:"var(--fg)",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"4px"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #d4a72c 35%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #d4a72c 65%, transparent)"}}),C1=_i.define([{tag:m.heading,color:"var(--fg)",fontWeight:"700"},{tag:m.strong,fontWeight:"700"},{tag:m.emphasis,fontStyle:"italic"},{tag:m.strikethrough,textDecoration:"line-through"},{tag:[m.link,m.url],color:"var(--link)"},{tag:m.monospace,color:"var(--h-str)"},{tag:m.quote,color:"var(--muted)",fontStyle:"italic"},{tag:[m.processingInstruction,m.meta,m.contentSeparator],color:"var(--h-com)"},{tag:m.list,color:"var(--h-kw)"},{tag:m.keyword,color:"var(--h-kw)"},{tag:[m.string,m.attributeValue],color:"var(--h-str)"},{tag:m.comment,color:"var(--h-com)"}]),RO=ue.define();function xx(n,{doc:e,onChange:t,onScroll:i}){let r=new C({parent:n,state:I.create({doc:e,extensions:[Ef(),Ic(),Nc(),vO({top:!0}),kO(),C.lineWrapping,ei.of([...ZO,...zf,mu,...pu]),v1,$f(C1),C.updateListener.of(s=>{s.docChanged&&!s.transactions.some(o=>o.annotation(RO))&&t()})]})});return r.scrollDOM.addEventListener("scroll",()=>{let s=r.scrollDOM.scrollHeight-r.scrollDOM.clientHeight;i(s>0?r.scrollDOM.scrollTop/s:0)}),{view:r,getDoc:()=>r.state.doc.toString(),setDoc(s){s!==r.state.doc.toString()&&r.dispatch({changes:{from:0,to:r.state.doc.length,insert:s},annotations:RO.of(!0)})},focus:()=>r.focus(),getSelection:()=>r.state.sliceDoc(r.state.selection.main.from,r.state.selection.main.to),replaceSelection(s){r.dispatch(r.state.replaceSelection(s),{scrollIntoView:!0,userEvent:"input"}),r.focus()},selectAll(){r.dispatch({selection:{anchor:0,head:r.state.doc.length}}),r.focus()}}}export{xx as createEditor};
    +`:i=="r"?"\r":i=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Za(this):new Aa(this)}getCursor(e,t=0,i){let r=e.doc?e:I.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Ni(this,r,t,i):Vi(this,r,t,i)}},Os=class{constructor(e){this.spec=e}};function m1(n,e,t){return(i,r,s,o)=>{if(t&&!t(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):e.doc.sliceString(i,r);return n(l,e,i,r)}}function Vi(n,e,t,i){let r;return n.wholeWord&&(r=g1(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(r=m1(n.test,e,r)),new ui(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),r)}function g1(n,e){return(t,i,r,s)=>((s>t||s+r.length=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Vi(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function b1(n,e,t){return(i,r,s)=>(!t||t(i,r,s))&&n(s[0],e,i,r)}function Ni(n,e,t,i){let r;return n.wholeWord&&(r=S1(e.charCategorizer(e.selection.main.head))),n.test&&(r=b1(n.test,e,r)),new hs(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:r},t,i)}function ps(n,e){return n.slice(ie(n,e,!1),e)}function ms(n,e){return n.slice(e,ie(n,e))}function S1(n){return(e,t,i)=>!i[0].length||(n(ps(i.input,i.index))!=te.Word||n(ms(i.input,i.index))!=te.Word)&&(n(ms(i.input,i.index+i[0].length))!=te.Word||n(ps(i.input,i.index+i[0].length))!=te.Word)}var Za=class extends Os{nextMatch(e,t,i){let r=Ni(this.spec,e,i,e.doc.length).next();return r.done&&(r=Ni(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let s=Math.max(t,i-r*1e4),o=Ni(this.spec,e,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Ni(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},qn=_.define(),Ea=_.define(),qt=fe.define({create(n){return new zn(Ra(n).create(),null)},update(n,e){for(let t of e.effects)t.is(qn)?n=new zn(t.value.create(),n.panel):t.is(Ea)&&(n=new zn(n.query,t.value?_a:null));return n},provide:n=>pn.from(n,e=>e.panel)});var zn=class{constructor(e,t){this.query=e,this.panel=t}},y1=q.mark({class:"cm-searchMatch"}),x1=q.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Q1=Xe.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(qt))}update(n){let e=n.state.field(qt);(e!=n.startState.field(qt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return q.none;let{view:t}=this,i=new nt;for(let r=0,s=t.visibleRanges,o=s.length;rs[r+1].from-500;)a=s[++r].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?x1:y1)})}return i.finish()}},{decorations:n=>n.decorations});function Wn(n){return e=>{let t=e.state.field(qt,!1);return t&&t.query.spec.valid?n(e,t):TO(e)}}var gs=Wn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let r=S.single(i.from,i.to),s=n.state.facet(di);return n.dispatch({selection:r,effects:[Da(n,i),s.scrollToMatch(r.main,n)],userEvent:"select.search"}),XO(n),!0}),bs=Wn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)return!1;let s=S.single(r.from,r.to),o=n.state.facet(di);return n.dispatch({selection:s,effects:[Da(n,r),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),XO(n),!0}),k1=Wn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:S.create(t.map(i=>S.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),w1=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:r}=t.main,s=[],o=0;for(let l=new ui(n.doc,n.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(S.range(l.value.from,l.value.to))}return e(n.update({selection:S.create(s,o),userEvent:"select.search.matches"})),!0},$O=Wn((n,{query:e})=>{let{state:t}=n,{from:i,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,i,i);if(!s)return!1;let o=s,l=[],a,h,c=[];o.precise?o.from==i&&o.to==r&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(C.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):o=e.nextMatch(t,o.from,o.to);let f=n.state.changes(l);return o&&(a=S.single(o.from,o.to).map(f),c.push(Da(n,o)),c.push(t.facet(di).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),$1=Wn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let r of e.matchAll(n.state,1e9)){let{from:s,to:o,precise:l}=r;l&&t.push({from:s,to:o,insert:e.getReplacement(r)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:C.announce.of(i),userEvent:"input.replace.all"}),!0});function _a(n){return n.state.facet(di).createPanel(n)}function Ra(n,e){var t,i,r,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(di);return new ds({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:h.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function CO(n){let e=Xr(n,_a);return e&&e.dom.querySelector("[main-field]")}function XO(n){let e=CO(n);e&&e==n.root.activeElement&&e.select()}var TO=n=>{let e=n.state.field(qt,!1);if(e&&e.panel){let t=CO(n);if(t&&t!=n.root.activeElement){let i=Ra(n.state,e.query.spec);i.valid&&n.dispatch({effects:qn.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Ea.of(!0),e?qn.of(Ra(n.state,e.query.spec)):_.appendConfig.of(La)]});return!0},AO=n=>{let e=n.state.field(qt,!1);if(!e||!e.panel)return!1;let t=Xr(n,_a);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Ea.of(!1)}),!0},ZO=[{key:"Mod-f",run:TO,scope:"editor search-panel"},{key:"F3",run:gs,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:gs,shift:bs,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:AO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:w1},{key:"Mod-Alt-g",run:u1},{key:"Mod-d",run:p1,preventDefault:!0}],Ma=class{constructor(e){this.view=e;let t=this.query=e.state.field(qt).query.spec;this.commit=this.commit.bind(this),this.searchField=ne("input",{value:t.search,placeholder:Me(e,"Find"),"aria-label":Me(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ne("input",{value:t.replace,placeholder:Me(e,"Replace"),"aria-label":Me(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ne("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=ne("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=ne("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(r,s,o){return ne("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=ne("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>gs(e),[Me(e,"next")]),i("prev",()=>bs(e),[Me(e,"previous")]),i("select",()=>k1(e),[Me(e,"all")]),ne("label",null,[this.caseField,Me(e,"match case")]),ne("label",null,[this.reField,Me(e,"regexp")]),ne("label",null,[this.wordField,Me(e,"by word")]),...e.state.readOnly?[]:[ne("br"),this.replaceField,i("replace",()=>$O(e),[Me(e,"replace")]),i("replaceAll",()=>$1(e),[Me(e,"replace all")])],ne("button",{name:"close",onclick:()=>AO(e),"aria-label":Me(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new ds({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:qn.of(e)}))}keydown(e){zc(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?bs:gs)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),$O(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(qn)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(di).top}};function Me(n,e){return n.state.phrase(e)}var ls=30,as=/[\s\.,:;?!]/;function Da(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),r=n.state.doc.lineAt(t).to,s=Math.max(i.from,e-ls),o=Math.min(r,t+ls),l=n.state.sliceDoc(s,o);if(s!=i.from){for(let a=0;al.length-ls;a--)if(!as.test(l[a-1])&&as.test(l[a])){l=l.slice(0,a);break}}return C.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}var P1=C.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),La=[qt,_e.low(Q1),P1];var v1=C.theme({"&":{color:"var(--fg)",backgroundColor:"var(--bg)",height:"100%",fontSize:"14px"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"ui-monospace, SFMono-Regular, Consolas, monospace",lineHeight:"1.55"},".cm-content":{padding:"16px 0",caretColor:"var(--fg)"},".cm-line":{padding:"0 20px"},".cm-cursor":{borderLeftColor:"var(--fg)"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--fg) 5%, transparent)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"color-mix(in srgb, var(--link) 28%, transparent)"},".cm-panels":{backgroundColor:"var(--code)",color:"var(--fg)",borderColor:"var(--border)"},".cm-panels input, .cm-panels button":{font:"inherit",color:"var(--fg)",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"4px"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #d4a72c 35%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #d4a72c 65%, transparent)"}}),C1=_i.define([{tag:m.heading,color:"var(--fg)",fontWeight:"700"},{tag:m.strong,fontWeight:"700"},{tag:m.emphasis,fontStyle:"italic"},{tag:m.strikethrough,textDecoration:"line-through"},{tag:[m.link,m.url],color:"var(--link)"},{tag:m.monospace,color:"var(--h-str)"},{tag:m.quote,color:"var(--muted)",fontStyle:"italic"},{tag:[m.processingInstruction,m.meta,m.contentSeparator],color:"var(--h-com)"},{tag:m.list,color:"var(--h-kw)"},{tag:m.keyword,color:"var(--h-kw)"},{tag:[m.string,m.attributeValue],color:"var(--h-str)"},{tag:m.comment,color:"var(--h-com)"}]),RO=ue.define();function xx(n,{doc:e,onChange:t,onScroll:i}){let r=new C({parent:n,state:I.create({doc:e,extensions:[Ef(),Ic(),Nc(),vO({top:!0}),kO(),C.lineWrapping,ei.of([...ZO,...zf,mu,...pu]),v1,$f(C1),C.updateListener.of(s=>{s.docChanged&&!s.transactions.some(o=>o.annotation(RO))&&t()})]})});return r.scrollDOM.addEventListener("scroll",()=>{let{scrollTop:s,scrollHeight:o,clientHeight:l}=r.scrollDOM,a=r.scrollDOM.getBoundingClientRect().top-r.documentTop,h=r.lineBlockAtHeight(a),c=h.height>0?Math.min(1,Math.max(0,(a-h.top)/h.height)):0;i({line:r.state.doc.lineAt(h.from).number-1+c,lines:r.state.doc.lines,atTop:s<=0,atEnd:s>=o-l-1})}),{view:r,getDoc:()=>r.state.doc.toString(),setDoc(s){s!==r.state.doc.toString()&&r.dispatch({changes:{from:0,to:r.state.doc.length,insert:s},annotations:RO.of(!0)})},focus:()=>r.focus(),scrollToLine(s){let o=r.state.doc.line(Math.min(r.state.doc.lines,s+1)).from;r.dispatch({selection:{anchor:o},effects:C.scrollIntoView(o,{y:"start"})})},getSelection:()=>r.state.sliceDoc(r.state.selection.main.from,r.state.selection.main.to),replaceSelection(s){r.dispatch(r.state.replaceSelection(s),{scrollIntoView:!0,userEvent:"input"}),r.focus()},selectAll(){r.dispatch({selection:{anchor:0,head:r.state.doc.length}}),r.focus()}}}export{xx as createEditor};
    diff --git a/dist/chunks/math-T547EQXU.js b/dist/chunks/math-2ONFTABO.js
    similarity index 83%
    rename from dist/chunks/math-T547EQXU.js
    rename to dist/chunks/math-2ONFTABO.js
    index 4096452..bdc91fa 100644
    --- a/dist/chunks/math-T547EQXU.js
    +++ b/dist/chunks/math-2ONFTABO.js
    @@ -1 +1 @@
    -import{a}from"./chunk-USGABQGL.js";import"./chunk-EMBIDUMY.js";async function n(e){let[{default:o}]=await Promise.all([import("./katex-ESPZXGUZ.js"),a("/katex.css")]);for(let t of e)try{o.render(t.textContent,t,{displayMode:t.dataset.math==="display",throwOnError:!0,output:"htmlAndMathml"})}catch(r){t.classList.add("math-error"),t.title=String(r.message||r)}}export{n as renderMath};
    +import{a}from"./chunk-FE6DSGFD.js";import"./chunk-EMBIDUMY.js";async function n(e){let[{default:o}]=await Promise.all([import("./katex-ESPZXGUZ.js"),a("/katex.css")]);for(let t of e)try{o.render(t.textContent,t,{displayMode:t.dataset.math==="display",throwOnError:!0,output:"htmlAndMathml"})}catch(r){t.classList.add("math-error"),t.title=String(r.message||r)}}export{n as renderMath};
    diff --git a/dist/chunks/mermaid-4OQNCKUU.js b/dist/chunks/mermaid-4OQNCKUU.js
    new file mode 100644
    index 0000000..fd587a1
    --- /dev/null
    +++ b/dist/chunks/mermaid-4OQNCKUU.js
    @@ -0,0 +1,2 @@
    +import{b as d,g as s}from"./chunk-FE6DSGFD.js";import"./chunk-EMBIDUMY.js";var o,f=0,c;async function m(){return o??=(await import("./mermaid.core-O27S2ROA.js")).default,c!==s()&&(c=s(),o.initialize({startOnLoad:!1,securityLevel:"strict",theme:c?"dark":"default"})),o}async function p(n){let t=await m();for(let e of n){let a=document.createElement("figure");a.className="mermaid",a.dataset.src=e.textContent,e.parentElement.dataset.line&&(a.dataset.line=e.parentElement.dataset.line),e.parentElement.replaceWith(a),await l(t,a)}}var r=new Map;async function l(n,t){let e=c+`
    +`+t.dataset.src;if(r.has(e)){t.innerHTML=r.get(e);return}let a="mmd"+f++;try{let{svg:i}=await n.render(a,t.dataset.src);r.size>50&&r.clear(),r.set(e,i),t.innerHTML=i}catch(i){document.getElementById("d"+a)?.remove(),d(t,"Mermaid diagram",i)}}async function w(){let n=document.querySelectorAll("figure.mermaid");if(!n.length)return;let t=await m();for(let e of n)await l(t,e)}export{p as renderMermaid,w as rethemeMermaid};
    diff --git a/dist/chunks/mermaid-O4TCBJV4.js b/dist/chunks/mermaid-O4TCBJV4.js
    deleted file mode 100644
    index 812115a..0000000
    --- a/dist/chunks/mermaid-O4TCBJV4.js
    +++ /dev/null
    @@ -1,2 +0,0 @@
    -import{b as m,g as o}from"./chunk-USGABQGL.js";import"./chunk-EMBIDUMY.js";var s,f=0,c;async function d(){return s??=(await import("./mermaid.core-O27S2ROA.js")).default,c!==o()&&(c=o(),s.initialize({startOnLoad:!1,securityLevel:"strict",theme:c?"dark":"default"})),s}async function w(a){let e=await d();for(let t of a){let r=document.createElement("figure");r.className="mermaid",r.dataset.src=t.textContent,t.parentElement.replaceWith(r),await l(e,r)}}var n=new Map;async function l(a,e){let t=c+`
    -`+e.dataset.src;if(n.has(t)){e.innerHTML=n.get(t);return}let r="mmd"+f++;try{let{svg:i}=await a.render(r,e.dataset.src);n.size>50&&n.clear(),n.set(t,i),e.innerHTML=i}catch(i){document.getElementById("d"+r)?.remove(),m(e,"Mermaid diagram",i)}}async function y(){let a=document.querySelectorAll("figure.mermaid");if(!a.length)return;let e=await d();for(let t of a)await l(e,t)}export{w as renderMermaid,y as rethemeMermaid};
    diff --git a/dist/chunks/model-MGZXFMWN.js b/dist/chunks/model-6PF44EF3.js
    similarity index 52%
    rename from dist/chunks/model-MGZXFMWN.js
    rename to dist/chunks/model-6PF44EF3.js
    index 2499177..f5050e2 100644
    --- a/dist/chunks/model-MGZXFMWN.js
    +++ b/dist/chunks/model-6PF44EF3.js
    @@ -1 +1 @@
    -import{a,b}from"./chunk-NO5BK2IH.js";import"./chunk-USGABQGL.js";import"./chunk-EMBIDUMY.js";export{a as isModelUrl,b as renderModels};
    +import{a,b}from"./chunk-A7SFTXEQ.js";import"./chunk-FE6DSGFD.js";import"./chunk-EMBIDUMY.js";export{a as isModelUrl,b as renderModels};
    diff --git a/dist/chunks/print-TJHD2ZSG.js b/dist/chunks/print-3WY3XNT3.js
    similarity index 69%
    rename from dist/chunks/print-TJHD2ZSG.js
    rename to dist/chunks/print-3WY3XNT3.js
    index 5ab69b8..e6d2890 100644
    --- a/dist/chunks/print-TJHD2ZSG.js
    +++ b/dist/chunks/print-3WY3XNT3.js
    @@ -1 +1 @@
    -import{b as a}from"./chunk-TNHQAXF3.js";import"./chunk-FTY6WLQF.js";import"./chunk-NO5BK2IH.js";import{f as n}from"./chunk-USGABQGL.js";import"./chunk-EMBIDUMY.js";var r=()=>new Promise(t=>requestAnimationFrame(()=>t()));async function c(){n.on=!0,await a(),await r();for(let t of document.querySelectorAll("figure.chart canvas, div.model canvas")){let e=t.nextElementSibling;(!e||!e.classList.contains("snap"))&&(e=document.createElement("img"),e.className="snap",t.after(e));try{e.src=t.toDataURL("image/png")}catch{e.remove()}}}async function s(){n.on&&(n.on=!1,await a())}export{c as preparePrint,s as restoreAfterPrint};
    +import{b as a}from"./chunk-FL2ILWU6.js";import"./chunk-FTY6WLQF.js";import"./chunk-A7SFTXEQ.js";import{f as n}from"./chunk-FE6DSGFD.js";import"./chunk-EMBIDUMY.js";var r=()=>new Promise(t=>requestAnimationFrame(()=>t()));async function c(){n.on=!0,await a(),await r();for(let t of document.querySelectorAll("figure.chart canvas, div.model canvas")){let e=t.nextElementSibling;(!e||!e.classList.contains("snap"))&&(e=document.createElement("img"),e.className="snap",t.after(e));try{e.src=t.toDataURL("image/png")}catch{e.remove()}}}async function s(){n.on&&(n.on=!1,await a())}export{c as preparePrint,s as restoreAfterPrint};
    diff --git a/dist/index.html b/dist/index.html
    index 7abdae4..1d140e1 100644
    --- a/dist/index.html
    +++ b/dist/index.html
    @@ -1 +1 @@
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/frontend/src/alerts.js b/frontend/src/alerts.js new file mode 100644 index 0000000..43cd39d --- /dev/null +++ b/frontend/src/alerts.js @@ -0,0 +1,38 @@ +// GitHub-style alerts: a blockquote whose first line is [!NOTE], [!TIP], [!IMPORTANT], +// [!WARNING] or [!CAUTION] becomes a coloured callout with a title. Anything else after the +// marker on that line means it isn't an alert, as on GitHub. + +const KINDS = { note: "Note", tip: "Tip", important: "Important", warning: "Warning", caution: "Caution" }; +const MARKER = /^\[!(note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i; + +function findAlerts(state) { + const tokens = state.tokens; + for (let i = 0; i + 2 < tokens.length; i++) { + if (tokens[i].type !== "blockquote_open") continue; + const [open, inline] = [tokens[i + 1], tokens[i + 2]]; + if (open.type !== "paragraph_open" || inline.type !== "inline") continue; + const m = MARKER.exec(inline.content); + if (!m) continue; + const kind = m[1].toLowerCase(); + tokens[i].meta = { ...tokens[i].meta, alert: kind }; + tokens[i].attrJoin("class", `alert alert-${kind}`); + inline.content = inline.content.slice(m[0].length); + if (!inline.content.trim()) { + // "> [!NOTE]" alone on its line, the text following in its own paragraph. + open.hidden = true; + const close = tokens.slice(i + 3).find((t) => t.type === "paragraph_close"); + if (close) close.hidden = true; + } + } +} + +export default function alerts(md) { + // Before inline parsing, so the marker is gone before the rest of the line is rendered. + md.core.ruler.before("inline", "github_alerts", findAlerts); + const fallback = md.renderer.rules.blockquote_open ?? ((t, i, o, e, self) => self.renderToken(t, i, o)); + md.renderer.rules.blockquote_open = (tokens, i, options, env, self) => { + const out = fallback(tokens, i, options, env, self); + const kind = tokens[i].meta?.alert; + return kind ? `${out}

    ${KINDS[kind]}

    \n` : out; + }; +} diff --git a/frontend/src/blocks/chart.js b/frontend/src/blocks/chart.js index 2ed3c1b..5f2a13b 100644 --- a/frontend/src/blocks/chart.js +++ b/frontend/src/blocks/chart.js @@ -30,6 +30,7 @@ export async function renderCharts(codes) { const canvas = document.createElement("canvas"); fig.appendChild(canvas); fig._config = config; + if (code.parentElement.dataset.line) fig.dataset.line = code.parentElement.dataset.line; code.parentElement.replaceWith(fig); try { fig._chart = new C(canvas, structuredClone(config)); diff --git a/frontend/src/blocks/lazy.js b/frontend/src/blocks/lazy.js index 4b95a90..6ec46f2 100644 --- a/frontend/src/blocks/lazy.js +++ b/frontend/src/blocks/lazy.js @@ -22,6 +22,7 @@ export function showError(el, what, err) { box.innerHTML = "
    ";
       box.firstChild.textContent = what + " failed";
       box.lastChild.textContent = msg;
    +  if (el.dataset?.line) box.dataset.line = el.dataset.line; // keeps scroll sync anchored
       el.replaceWith(box);
     }
     
    diff --git a/frontend/src/blocks/mermaid.js b/frontend/src/blocks/mermaid.js
    index 5a83528..7b04ba0 100644
    --- a/frontend/src/blocks/mermaid.js
    +++ b/frontend/src/blocks/mermaid.js
    @@ -20,6 +20,7 @@ export async function renderMermaid(codes) {
         const fig = document.createElement("figure");
         fig.className = "mermaid";
         fig.dataset.src = code.textContent;
    +    if (code.parentElement.dataset.line) fig.dataset.line = code.parentElement.dataset.line;
         code.parentElement.replaceWith(fig);
         await draw(m, fig);
       }
    diff --git a/frontend/src/editor.js b/frontend/src/editor.js
    index c999b1e..6452331 100644
    --- a/frontend/src/editor.js
    +++ b/frontend/src/editor.js
    @@ -64,9 +64,18 @@ export function createEditor(parent, { doc, onChange, onScroll }) {
           ],
         }),
       });
    +  // Reports the (fractional, 0-based) source line at the top of the view, for the preview to follow.
       view.scrollDOM.addEventListener("scroll", () => {
    -    const max = view.scrollDOM.scrollHeight - view.scrollDOM.clientHeight;
    -    onScroll(max > 0 ? view.scrollDOM.scrollTop / max : 0);
    +    const { scrollTop, scrollHeight, clientHeight } = view.scrollDOM;
    +    const height = view.scrollDOM.getBoundingClientRect().top - view.documentTop;
    +    const block = view.lineBlockAtHeight(height);
    +    const within = block.height > 0 ? Math.min(1, Math.max(0, (height - block.top) / block.height)) : 0;
    +    onScroll({
    +      line: view.state.doc.lineAt(block.from).number - 1 + within,
    +      lines: view.state.doc.lines,
    +      atTop: scrollTop <= 0,
    +      atEnd: scrollTop >= scrollHeight - clientHeight - 1,
    +    });
       });
       return {
         view,
    @@ -79,6 +88,11 @@ export function createEditor(parent, { doc, onChange, onScroll }) {
           });
         },
         focus: () => view.focus(),
    +    // Puts a (0-based) source line at the top of the editor.
    +    scrollToLine(line) {
    +      const pos = view.state.doc.line(Math.min(view.state.doc.lines, line + 1)).from;
    +      view.dispatch({ selection: { anchor: pos }, effects: EditorView.scrollIntoView(pos, { y: "start" }) });
    +    },
         // Used by the context menu, which can't rely on the browser's own clipboard commands.
         getSelection: () => view.state.sliceDoc(view.state.selection.main.from, view.state.selection.main.to),
         replaceSelection(text) {
    diff --git a/frontend/src/find.js b/frontend/src/find.js
    new file mode 100644
    index 0000000..7b16c1a
    --- /dev/null
    +++ b/frontend/src/find.js
    @@ -0,0 +1,181 @@
    +// Find in the rendered page (Ctrl/Cmd+F outside the editor, which has its own search).
    +// Matches are wrapped in  elements. A match may span several text nodes
    +// ("foo **bar**" matches "foo bar"), but never two blocks, and nothing inside diagrams or
    +// KaTeX's hidden MathML is searched.
    +
    +const SKIP = "svg, .katex-mathml, script, style, canvas";
    +const BLOCK = "p, li, h1, h2, h3, h4, h5, h6, td, th, pre, blockquote, dt, dd, figcaption, summary, div, table, tr";
    +const MAX = 2000;
    +
    +let $content;
    +let bar = null;
    +let input;
    +let count;
    +let matches = []; // one array of  elements per match
    +let current = -1;
    +let timer;
    +
    +const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
    +
    +export const findOpen = () => !!bar && !bar.hidden;
    +
    +function build() {
    +  bar = document.createElement("div");
    +  bar.id = "find";
    +  bar.setAttribute("role", "search");
    +  input = Object.assign(document.createElement("input"), { type: "text", placeholder: "Find", spellcheck: false });
    +  input.setAttribute("aria-label", "Find in document");
    +  count = Object.assign(document.createElement("span"), { className: "count" });
    +  count.setAttribute("aria-live", "polite");
    +  const button = (label, title, fn) => {
    +    const b = Object.assign(document.createElement("button"), { textContent: label, title });
    +    b.setAttribute("aria-label", title);
    +    b.addEventListener("mousedown", (e) => e.preventDefault()); // keep focus in the input
    +    b.addEventListener("click", fn);
    +    return b;
    +  };
    +  bar.append(
    +    input,
    +    count,
    +    button("↑", "Previous match (Shift+Enter)", () => step(-1)),
    +    button("↓", "Next match (Enter)", () => step(1)),
    +    button("✕", "Close (Esc)", closeFind),
    +  );
    +  input.addEventListener("input", () => {
    +    clearTimeout(timer);
    +    timer = setTimeout(() => search({ fromView: true }), 120);
    +  });
    +  input.addEventListener("keydown", (e) => {
    +    if (e.key === "Enter") {
    +      e.preventDefault();
    +      clearTimeout(timer);
    +      if (pendingSearch()) search({ fromView: true });
    +      else step(e.shiftKey ? -1 : 1);
    +    } else if (e.key === "Escape") {
    +      e.preventDefault();
    +      closeFind();
    +    }
    +  });
    +  document.body.appendChild(bar);
    +}
    +
    +let lastQuery = "";
    +const pendingSearch = () => input.value !== lastQuery;
    +
    +export function openFind(content, prefill) {
    +  $content = content;
    +  if (!bar) build();
    +  bar.hidden = false;
    +  if (prefill && !prefill.includes("\n")) input.value = prefill;
    +  input.focus();
    +  input.select();
    +  if (pendingSearch() || !matches.length) search({ fromView: true });
    +}
    +
    +export function closeFind() {
    +  if (!bar) return;
    +  bar.hidden = true;
    +  clear();
    +  lastQuery = "";
    +  count.textContent = "";
    +}
    +
    +// The page was re-rendered (file changed, or typing in the editor): the old marks are gone.
    +// Search again, staying on the same match number and without scrolling.
    +export function refreshFind() {
    +  if (!findOpen()) return;
    +  const keep = current;
    +  matches = [];
    +  search({ keep });
    +}
    +
    +/** F3 / Shift+F3 and Ctrl/Cmd+G while the bar is open. */
    +export function step(dir) {
    +  if (!matches.length) return;
    +  select((current + dir + matches.length) % matches.length, true);
    +}
    +
    +function clear() {
    +  const parents = new Set();
    +  for (const marks of matches) {
    +    for (const m of marks) {
    +      if (!m.isConnected) continue;
    +      parents.add(m.parentNode);
    +      m.replaceWith(...m.childNodes);
    +    }
    +  }
    +  for (const p of parents) p.normalize();
    +  matches = [];
    +  current = -1;
    +}
    +
    +function textIndex(root) {
    +  const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
    +    acceptNode: (n) => (n.nodeValue && !n.parentElement.closest(SKIP) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT),
    +  });
    +  const nodes = [];
    +  let text = "";
    +  let block = null;
    +  for (let n; (n = walker.nextNode()); ) {
    +    const b = n.parentElement.closest(BLOCK);
    +    if (b !== block && text) text += "\u0000"; // never matches, so no match crosses blocks
    +    block = b;
    +    nodes.push({ node: n, start: text.length, len: n.nodeValue.length });
    +    text += n.nodeValue;
    +  }
    +  return { nodes, text };
    +}
    +
    +function search({ fromView = false, keep = -1 } = {}) {
    +  clear();
    +  const query = input.value;
    +  lastQuery = query;
    +  if (!query) {
    +    count.textContent = "";
    +    return;
    +  }
    +  const { nodes, text } = textIndex($content);
    +  const found = [];
    +  const re = new RegExp(escape(query), "gi");
    +  for (let m; (m = re.exec(text)) && found.length < MAX; ) found.push([m.index, m.index + m[0].length]);
    +
    +  // Wrap from the last match back, so splitting a text node never moves an earlier match.
    +  let k = nodes.length - 1;
    +  for (let i = found.length - 1; i >= 0; i--) {
    +    const [s, e] = found[i];
    +    const marks = [];
    +    while (k > 0 && nodes[k].start >= e) k--;
    +    for (let j = k; j >= 0 && nodes[j].start + nodes[j].len > s; j--) {
    +      const { node, start, len } = nodes[j];
    +      const a = Math.max(s, start) - start;
    +      const b = Math.min(e, start + len) - start;
    +      if (b <= a) continue;
    +      if (b < node.nodeValue.length) node.splitText(b);
    +      const piece = a > 0 ? node.splitText(a) : node;
    +      const mark = Object.assign(document.createElement("mark"), { className: "find" });
    +      piece.replaceWith(mark);
    +      mark.appendChild(piece);
    +      marks.unshift(mark);
    +    }
    +    matches.unshift(marks);
    +  }
    +
    +  if (!matches.length) {
    +    count.textContent = "No results";
    +    bar.classList.add("none");
    +    return;
    +  }
    +  bar.classList.remove("none");
    +  if (keep >= 0) return select(Math.min(keep, matches.length - 1), false);
    +  // Start from the first match on screen, not the top of the document.
    +  const first = fromView ? matches.findIndex((marks) => marks[0].getBoundingClientRect().bottom > 0) : 0;
    +  select(first < 0 ? 0 : first, true);
    +}
    +
    +function select(i, scroll) {
    +  for (const m of matches[current] ?? []) m.classList.remove("current");
    +  current = i;
    +  for (const m of matches[current]) m.classList.add("current");
    +  count.textContent = `${current + 1} of ${matches.length}${matches.length >= MAX ? "+" : ""}`;
    +  if (scroll) matches[current][0].scrollIntoView({ block: "center", inline: "nearest" });
    +}
    diff --git a/frontend/src/main.js b/frontend/src/main.js
    index f03f53f..97e8db4 100644
    --- a/frontend/src/main.js
    +++ b/frontend/src/main.js
    @@ -1,6 +1,8 @@
     import { renderInto, rethemeAll } from "./render.js";
     import { showBanner, hideBanner, confirmDialog, dialogOpen, toast, showMenu } from "./ui.js";
     import { theme } from "./blocks/lazy.js";
    +import { openFind, closeFind, refreshFind, findOpen, step as findStep } from "./find.js";
    +import { toggleOutline, refreshOutline, outlineOpen } from "./outline.js";
     
     const $preview = document.getElementById("preview");
     const $content = document.getElementById("content");
    @@ -27,7 +29,11 @@ const scroll = {
       set: (y) => (editing() ? ($preview.scrollTop = y) : window.scrollTo(0, y)),
     };
     const BOM = "\uFEFF";
    -const paint = (text) => renderInto($content, text.startsWith(BOM) ? text.slice(1) : text, scroll);
    +async function paint(text) {
    +  await renderInto($content, text.startsWith(BOM) ? text.slice(1) : text, scroll);
    +  refreshFind();
    +  refreshOutline();
    +}
     
     function setDirty(v) {
       if (v === dirty) return;
    @@ -120,9 +126,7 @@ async function toggleEdit() {
         editor = createEditor($editor, {
           doc: fromDisk(bufferText ?? ""),
           onChange: onEdit,
    -      onScroll: (ratio) => {
    -        $preview.scrollTop = ratio * ($preview.scrollHeight - $preview.clientHeight);
    -      },
    +      onScroll: followEditor,
         });
         window.__editor = editor; // handy for tests and debugging
       }
    @@ -131,6 +135,71 @@ async function toggleEdit() {
       if (format.lossy) toast("This file isn't UTF-8 text. You can edit it, but saving is turned off.", true);
     }
     
    +// Keeps the preview on the part of the document the editor shows. Blocks carry the source line
    +// they start on (data-line); the position between two of them is interpolated, so a long
    +// paragraph or a tall diagram still scrolls smoothly.
    +function followEditor({ line, lines, atTop, atEnd }) {
    +  if (atTop) return ($preview.scrollTop = 0);
    +  if (atEnd) return ($preview.scrollTop = $preview.scrollHeight);
    +  let before = null;
    +  let after = null;
    +  for (const el of $content.querySelectorAll("[data-line]")) {
    +    if (el.closest(".footnotes")) continue; // rendered at the end, whatever their source line
    +    if (Number(el.dataset.line) <= line) before = el;
    +    else {
    +      after = el;
    +      break;
    +    }
    +  }
    +  const base = $preview.getBoundingClientRect().top - $preview.scrollTop;
    +  const y = (el) => el.getBoundingClientRect().top - base;
    +  const from = before ? { line: Number(before.dataset.line), y: y(before) } : { line: 0, y: 0 };
    +  const to = after ? { line: Number(after.dataset.line), y: y(after) } : { line: lines, y: $content.scrollHeight };
    +  const t = to.line > from.line ? (line - from.line) / (to.line - from.line) : 0;
    +  $preview.scrollTop = from.y + Math.min(1, Math.max(0, t)) * (to.y - from.y);
    +}
    +
    +// Outline clicks: in edit mode the editor moves and the preview follows it.
    +function jumpTo(heading) {
    +  if (editing() && editor && heading.dataset.line) editor.scrollToLine(Number(heading.dataset.line));
    +  else heading.scrollIntoView({ block: "start" });
    +}
    +
    +const find = () => openFind($content, String(getSelection()).trim());
    +const outline = () => toggleOutline($content, jumpTo);
    +
    +// ---- image zoom ------------------------------------------------------------------------
    +//
    +// An image shown smaller than its real size opens full size in an overlay; any click or key
    +// closes it.
    +
    +const zoomable = (img) =>
    +  img.matches("#content img:not(.snap)") && !img.closest("a") && (img.naturalWidth > img.clientWidth + 1 || img.naturalHeight > img.clientHeight + 1);
    +
    +function zoomImage(img) {
    +  const box = document.createElement("div");
    +  box.id = "lightbox";
    +  box.setAttribute("role", "dialog");
    +  box.setAttribute("aria-label", img.alt || "Image");
    +  box.appendChild(Object.assign(document.createElement("img"), { src: img.currentSrc || img.src, alt: img.alt }));
    +  const close = () => {
    +    box.remove();
    +    window.removeEventListener("keydown", onKey, true);
    +  };
    +  const onKey = (e) => {
    +    e.preventDefault();
    +    e.stopPropagation();
    +    close();
    +  };
    +  box.addEventListener("click", close);
    +  window.addEventListener("keydown", onKey, true);
    +  document.body.appendChild(box);
    +}
    +
    +document.addEventListener("mouseover", (e) => {
    +  if (e.target.tagName === "IMG") e.target.classList.toggle("zoomable", zoomable(e.target));
    +});
    +
     function save() {
       if (!editor) return;
       if (format.lossy) {
    @@ -246,10 +315,12 @@ function menuItems(e) {
         if (link) items.push({ label: "Copy link address", action: () => copyText(link.getAttribute("href"), "Link copied") });
         if (code) items.push({ label: "Copy code", action: () => copyText((code.querySelector("code") ?? code).textContent.replace(/\n$/, ""), "Code copied") });
         items.push({ label: "Select all", hint: mod + "A", action: () => getSelection().selectAllChildren($content) });
    +    items.push({ label: "Find…", hint: mod + "F", action: find });
       }
       items.push("-", { label: editing() ? "View mode" : "Edit mode", hint: mod + "E", action: toggleEdit });
       if (editor) items.push({ label: "Save", hint: mod + "S", disabled: !dirty, action: save });
       items.push({ label: "Print / Save as PDF…", hint: mod + "P", action: printPage }, "-");
    +  items.push({ label: "Contents", hint: mod + (isMac ? "⇧O" : "Shift+O"), checked: outlineOpen(), action: outline });
     
       const pct = Math.round(prefs.zoom * 100);
       items.push(
    @@ -330,9 +401,22 @@ document.addEventListener(
       (e) => {
         const cmd = isMac ? e.metaKey : e.ctrlKey;
         const key = e.key.toLowerCase();
    +    const inEditor = !!e.target.closest?.("#editor");
         if (cmd && e.shiftKey && !e.altKey && key === "l") {
           e.preventDefault();
           cycleTheme();
    +    } else if (cmd && e.shiftKey && !e.altKey && key === "o") {
    +      e.preventDefault();
    +      outline();
    +    } else if (cmd && !e.shiftKey && !e.altKey && key === "f" && !inEditor) {
    +      // In the editor, CodeMirror's own search panel takes Ctrl/Cmd+F.
    +      e.preventDefault();
    +      find();
    +    } else if (findOpen() && (e.key === "F3" || (cmd && !e.altKey && key === "g"))) {
    +      e.preventDefault();
    +      findStep(e.shiftKey ? -1 : 1);
    +    } else if (findOpen() && e.key === "Escape" && !inEditor && !e.target.closest?.("#find")) {
    +      closeFind();
         } else if (cmd && !e.altKey && ["e", "s", "p", "r"].includes(key)) {
           e.preventDefault();
           if (e.shiftKey) return;
    @@ -350,6 +434,7 @@ document.addEventListener(
     );
     
     document.addEventListener("click", (e) => {
    +  if (e.target.tagName === "IMG" && zoomable(e.target)) return zoomImage(e.target);
       const a = e.target.closest("a[href]");
       if (!a) return;
       const href = a.getAttribute("href");
    @@ -362,6 +447,7 @@ document.addEventListener("click", (e) => {
     for (const type of ["dragover", "drop"]) document.addEventListener(type, (e) => e.preventDefault());
     
     window.__reload = reload;
    +window.__toast = toast; // for messages from the app, such as a dropped file it can't open
     // Lets automated checks render the print view without opening the system print dialog.
     window.__print = {
       prepare: async () => (await import("./print.js")).preparePrint(),
    diff --git a/frontend/src/math.js b/frontend/src/math.js
    index f76bf56..f554ba8 100644
    --- a/frontend/src/math.js
    +++ b/frontend/src/math.js
    @@ -69,5 +69,6 @@ export default function math(md) {
       md.block.ruler.after("blockquote", "math_block", blockMath, { alt: ["paragraph", "reference", "blockquote", "list"] });
       const e = md.utils.escapeHtml;
       md.renderer.rules.math_inline = (t, i) => `${e(t[i].content)}`;
    -  md.renderer.rules.math_block = (t, i) => `
    ${e(t[i].content)}
    \n`; + md.renderer.rules.math_block = (t, i, o, env, self) => + `
    ${e(t[i].content)}
    \n`; } diff --git a/frontend/src/outline.js b/frontend/src/outline.js new file mode 100644 index 0000000..fd6a503 --- /dev/null +++ b/frontend/src/outline.js @@ -0,0 +1,86 @@ +// A table of contents in a side panel (Ctrl/Cmd+Shift+O): every heading, indented by level, +// with the section being read highlighted. It belongs to the window and isn't saved. + +let panel = null; +let list; +let $content; +let onJump; +let items = []; // [heading element, link] pairs +let frame = 0; + +export const outlineOpen = () => document.body.classList.contains("outline-open"); + +function build() { + panel = document.createElement("nav"); + panel.id = "outline"; + panel.setAttribute("aria-label", "Contents"); + const title = Object.assign(document.createElement("div"), { className: "title", textContent: "Contents" }); + list = document.createElement("ol"); + panel.append(title, list); + panel.addEventListener("click", (e) => { + const link = e.target.closest("a"); + if (!link) return; + e.preventDefault(); + const heading = items[Number(link.dataset.i)]?.[0]; + if (heading) onJump(heading); + }); + panel.addEventListener("keydown", (e) => { + if (e.key === "Escape") toggleOutline(); + }); + document.body.appendChild(panel); + // Scroll events don't bubble, but a capturing listener sees the window's and the preview's. + window.addEventListener("scroll", () => { + if (outlineOpen() && !frame) frame = requestAnimationFrame(markCurrent); + }, true); +} + +/** `jump(heading)` scrolls to a heading; main.js decides how, since edit mode differs. */ +export function toggleOutline(content, jump) { + if (content) [$content, onJump] = [content, jump]; + if (!panel) build(); + const open = !outlineOpen(); + document.body.classList.toggle("outline-open", open); + if (open) refreshOutline(); +} + +// Rebuilds the list from the page's headings (after every render). +export function refreshOutline() { + if (!outlineOpen()) return; + const headings = [...$content.querySelectorAll("h1, h2, h3, h4, h5, h6")].filter((h) => !h.closest(".footnotes")); + const top = Math.min(6, ...headings.map((h) => Number(h.tagName[1]))); + items = headings.map((h, i) => { + const link = document.createElement("a"); + link.href = h.id ? "#" + h.id : "#"; + link.dataset.i = i; + link.textContent = h.textContent.trim() || "(untitled)"; + link.title = link.textContent; + link.style.paddingLeft = `${8 + (Number(h.tagName[1]) - top) * 14}px`; + const li = document.createElement("li"); + li.appendChild(link); + return [h, link]; + }); + list.replaceChildren(...items.map(([, link]) => link.parentElement)); + if (!items.length) list.appendChild(Object.assign(document.createElement("li"), { className: "empty", textContent: "No headings" })); + markCurrent(); +} + +// The current section is the last heading that has scrolled past the top of the view. +function markCurrent() { + frame = 0; + if (!items.length) return; + const scroller = document.body.classList.contains("editing") ? document.getElementById("preview") : null; + const viewTop = scroller ? scroller.getBoundingClientRect().top : 0; + let at = 0; + for (let i = 0; i < items.length; i++) { + if (items[i][0].getBoundingClientRect().top - viewTop <= 40) at = i; + else break; + } + for (const [, link] of items) link.classList.remove("active"); + const link = items[at][1]; + link.classList.add("active"); + // Keep it visible in the panel (scrollIntoView could also move the page). + const r = link.getBoundingClientRect(); + const p = panel.getBoundingClientRect(); + if (r.top < p.top + 30) panel.scrollTop -= p.top + 30 - r.top; + else if (r.bottom > p.bottom) panel.scrollTop += r.bottom - p.bottom + 8; +} diff --git a/frontend/src/render.js b/frontend/src/render.js index 342a6df..32ed51f 100644 --- a/frontend/src/render.js +++ b/frontend/src/render.js @@ -5,15 +5,28 @@ import anchor from "markdown-it-anchor"; import frontMatter from "markdown-it-front-matter"; import DOMPurify from "dompurify"; import math from "./math.js"; +import alerts from "./alerts.js"; import { showError, disposeAll } from "./blocks/lazy.js"; import { isModelUrl } from "./blocks/model.js"; +// Stamps each block with the source line it starts on (data-line, 0-based), so the preview can +// follow the editor line by line and the outline can move the editor to a heading. +function sourceLines(md) { + md.core.ruler.push("source_lines", (state) => { + for (const t of state.tokens) { + if (t.map && t.nesting >= 0 && t.type !== "inline") t.attrSet("data-line", String(t.map[0])); + } + }); +} + const md = new MarkdownIt({ html: true, linkify: true, typographer: false }) .use(math) .use(footnote) .use(taskLists, { enabled: false }) .use(anchor, { tabIndex: false }) - .use(frontMatter, () => {}); + .use(frontMatter, () => {}) + .use(alerts) + .use(sourceLines); const decode = (s) => { try { @@ -73,6 +86,11 @@ export async function renderInto(root, text, scroll) { root.style.minHeight = root.offsetHeight + "px"; disposeAll(); root.innerHTML = html; + // markdown-it puts a fence's attributes on ; the line belongs to the whole block. + for (const code of root.querySelectorAll("pre > code[data-line]")) { + code.parentElement.dataset.line = code.dataset.line; + code.removeAttribute("data-line"); + } rewriteAssets(root); scroll.set(y); await hydrate(root, gen); diff --git a/frontend/src/style.css b/frontend/src/style.css index 37ba744..2c2f962 100644 --- a/frontend/src/style.css +++ b/frontend/src/style.css @@ -25,6 +25,18 @@ img { max-width:100%; } hr { border:0; border-top:1px solid var(--border); margin:24px 0; } .task-list-item { list-style:none; } .task-list-item input { margin:0 .5em 0 -1.4em; } .footnotes { font-size:.9em; color:var(--muted); } + +/* GitHub-style alerts: > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION] */ +:root { --a-note:#0969da; --a-tip:#1a7f37; --a-important:#8250df; --a-warning:#9a6700; --a-caution:#d1242f; } +@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --a-note:#4493f8; --a-tip:#3fb950; --a-important:#ab7df8; --a-warning:#d29922; --a-caution:#f85149; } } +:root[data-theme="dark"] { --a-note:#4493f8; --a-tip:#3fb950; --a-important:#ab7df8; --a-warning:#d29922; --a-caution:#f85149; } +blockquote.alert { color:inherit; padding:.5em 1em; margin:1em 0; border-left-color:var(--accent); } +blockquote.alert > :last-child { margin-bottom:0; } +.alert-title { margin:0; font-weight:600; color:var(--accent); } +.alert-title + * { margin-top:.35em; } +.alert-note { --accent:var(--a-note); } .alert-tip { --accent:var(--a-tip); } .alert-important { --accent:var(--a-important); } +.alert-warning { --accent:var(--a-warning); } .alert-caution { --accent:var(--a-caution); } +img.zoomable { cursor:zoom-in; } @media print { /* html:root[data-theme] outranks the forced-dark rule above, so paper is always light */ :root, html:root[data-theme] { --bg:#fff; --fg:#000; --muted:#555; --border:#ccc; --code:#f5f5f5; --link:#0645ad; color-scheme:light; } @@ -97,6 +109,36 @@ body.editing #content { padding:24px 24px 64px; } .menu.flip .flyout { left:auto; right:100%; margin:0 2px 0 0; } .menu .item.open > .flyout, .menu.measure .flyout { display:block; } .menu.measure .flyout { visibility:hidden; } +/* find bar (Ctrl/Cmd+F in the preview) and its matches; colours match the editor's search */ +#find { position:fixed; top:10px; right:18px; z-index:25; display:flex; gap:4px; align-items:center; padding:5px; background:var(--bg); border:1px solid var(--border); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,.2); font:13px/1.3 system-ui,-apple-system,"Segoe UI",sans-serif; } +#find[hidden] { display:none; } +#find input { width:200px; padding:4px 8px; font:inherit; color:var(--fg); background:var(--bg); border:1px solid var(--border); border-radius:5px; outline:none; } +#find input:focus { border-color:var(--link); } +#find.none input { border-color:#cf222e; } +#find .count { min-width:70px; color:var(--muted); text-align:center; font-variant-numeric:tabular-nums; } +#find button { padding:2px 8px; font-size:13px; } +mark.find { color:inherit; background:color-mix(in srgb, #d4a72c 35%, transparent); border-radius:2px; } +mark.find.current { background:color-mix(in srgb, #d4a72c 75%, transparent); } + +/* contents panel (Ctrl/Cmd+Shift+O) */ +#outline { display:none; position:fixed; top:0; bottom:0; left:0; z-index:15; width:250px; box-sizing:border-box; overflow:auto; padding:14px 8px 24px; background:var(--bg); border-right:1px solid var(--border); font:13px/1.35 system-ui,-apple-system,"Segoe UI",sans-serif; } +body.outline-open #outline { display:block; } +body.outline-open #app { margin-left:250px; } +#outline .title { padding:0 8px 8px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; font-size:11px; } +#outline ol { list-style:none; margin:0; padding:0; } +#outline a { display:block; padding:3px 8px; border-radius:5px; color:var(--fg); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +#outline a:hover { background:color-mix(in srgb, var(--fg) 7%, transparent); text-decoration:none; } +#outline a.active { color:var(--link); background:color-mix(in srgb, var(--link) 12%, transparent); } +#outline .empty { padding:3px 8px; color:var(--muted); } +@media (max-width: 700px) { + body.outline-open #app { margin-left:0; } + #outline { box-shadow:4px 0 20px rgba(0,0,0,.25); } +} + +/* image zoom */ +#lightbox { position:fixed; inset:0; z-index:35; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.82); cursor:zoom-out; } +#lightbox img { max-width:96vw; max-height:96vh; object-fit:contain; } + button { font:inherit; font-size:14px; padding:4px 12px; color:var(--fg); background:var(--bg); border:1px solid var(--border); border-radius:6px; cursor:pointer; } button:hover { background:var(--code); } button.primary { background:var(--link); border-color:var(--link); color:#fff; } @@ -104,7 +146,9 @@ button.primary { background:var(--link); border-color:var(--link); color:#fff; } /* print: canvases are swapped for the static images print.js makes; chrome is hidden */ img.snap { display:none; } @media print { - #editor,#banner,#dialog,#toast,#menu { display:none !important; } + #editor,#banner,#dialog,#toast,#menu,#find,#outline,#lightbox { display:none !important; } + body.outline-open #app { margin-left:0; } + mark.find, mark.find.current { background:none; } body.editing { overflow:visible; } body.editing { display:block; height:auto; } body.editing #app { display:block; } From ac8bdabc8deff713ad50158d4aeec07aa1a5b35c Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:46:52 +0000 Subject: [PATCH 3/6] Open Markdown files dropped on a window Uses wry's native drop handler, which has the real file paths. Each dropped .md or .markdown file opens in its own window; anything else gets a short message instead of being ignored. --- src/main.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f2ac7af..1638492 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,6 +29,8 @@ const ORIGIN: &str = "mdown://localhost"; enum Ev { Reload(WindowId), Open(PathBuf), + /// Files were dropped on a window. + Dropped(WindowId, Vec), /// Run a script in a window's page. Eval(WindowId, String), /// A window changed a setting (already saved); bring every window in line with the file. @@ -163,12 +165,23 @@ fn open_viewer( let doc_base = base.clone(); let root = assets::asset_root(&base); let ipc = Ipc { id, file: file.clone(), base, proxy: proxy.clone() }; + let drop_proxy = proxy.clone(); let builder = WebViewBuilder::new_with_web_context(context); #[cfg(feature = "debug-hooks")] let builder = builder.with_initialization_script(TIMING_SCRIPT); let webview = builder .with_custom_protocol("mdown".into(), move |_, req| assets::respond(&doc, &doc_base, &root, req)) .with_ipc_handler(move |req| handle_ipc(&ipc, req.body())) + // Dropped files arrive here with their real paths (the page only sees anonymous blobs). + // Returning true keeps the webview from navigating to a dropped file. + .with_drag_drop_handler(move |event| match event { + wry::DragDropEvent::Enter { paths, .. } => !paths.is_empty(), + wry::DragDropEvent::Drop { paths, .. } if !paths.is_empty() => { + let _ = drop_proxy.send_event(Ev::Dropped(id, paths)); + true + } + _ => false, + }) // The page owns Ctrl/Cmd +, -, 0 and Ctrl+wheel so the level is a saved setting. .with_background_color(page_background(&prefs.theme, &window)) .with_hotkeys_zoom(false) @@ -249,6 +262,15 @@ fn run(files: Vec) { // same values twice changes nothing. Event::UserEvent(Ev::SettingsFile) => apply_settings(&viewers, None), Event::UserEvent(Ev::Open(path)) => open_path(target, &proxy, &mut context, &mut viewers, path), + Event::UserEvent(Ev::Dropped(id, paths)) => { + let (docs, others): (Vec<_>, Vec<_>) = paths.into_iter().partition(|p| p.is_file() && is_markdown(p)); + for path in docs { + open_path(target, &proxy, &mut context, &mut viewers, path); + } + if !others.is_empty() { + eval(&viewers, id, "window.__toast && window.__toast(\"mdown opens Markdown files (.md, .markdown).\", true)"); + } + } Event::UserEvent(Ev::Dirty(id, dirty)) => { if let Some(v) = viewers.get_mut(&id) { v.dirty = dirty; @@ -444,6 +466,10 @@ fn reveal(file: &Path) { } } +fn is_markdown(path: &Path) -> bool { + path.extension().is_some_and(|e| e.eq_ignore_ascii_case("md") || e.eq_ignore_ascii_case("markdown")) +} + /// Files a link may open in their default app. Anything else (programs, scripts, installers, /// documents that can carry macros) is shown in the file manager instead, so a click in a /// document never runs something. @@ -462,7 +488,7 @@ fn open_link(base: &Path, proxy: &EventLoopProxy, href: &str) { let ext = target.extension().map(|e| e.to_string_lossy().to_ascii_lowercase()).unwrap_or_default(); if target.is_dir() { let _ = open::that(&target); - } else if ext == "md" || ext == "markdown" { + } else if is_markdown(&target) { let _ = proxy.send_event(Ev::Open(target)); } else if OPENABLE.contains(&ext.as_str()) { let _ = open::that(&target); From 2eae17de6c7493459f28e8662bee9a2697788d10 Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:46:52 +0000 Subject: [PATCH 4/6] Document find, contents, alerts, image zoom and drag-and-drop --- PLAN.md | 4 +++- README.md | 14 +++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/PLAN.md b/PLAN.md index 22ccfd0..b903dce 100644 --- a/PLAN.md +++ b/PLAN.md @@ -27,7 +27,9 @@ Double-click a `.md` file and it opens in its own small window, fully rendered, - **Theme (built):** `system` (default, follows the OS), `light` or `dark`. Cycle with Ctrl/Cmd+Shift+L (saved globally and pushed to every open window), set with `mdown theme [system|light|dark]`, or edit `settings.json` (`%APPDATA%\mdown\` on Windows, `~/Library/Application Support/mdown/` on macOS; `{ "theme": "dark" }`). The saved theme is stamped on `` when the page is served, so there is no flash; the title bar follows via tao's `set_theme`. Mermaid, Chart.js, code highlighting, the editor and the 3D viewer follow it; print is always light. - **Settings (built):** `settings.json` holds `theme`, `width` (`normal` | `wide`, the reading column) and `zoom` (0.5 to 3.0, in 0.1 steps). Invalid or missing values fall back to defaults and unknown keys survive a save. The page sends one generic IPC message (`{t:"setting", key, value}`); Rust validates and saves it, then evaluates `__applySettings(settings, changedKey)` in every window (the window that asked also shows a toast). Text size is the webview's native zoom (`WebView::zoom`), with wry's built-in hotkey zoom turned off so the page owns the shortcuts. Theme, width and zoom are stamped on `` at serve time. - **Context menu (built):** a right-click menu drawn in the page (same look on both OSes, no extra crates). Top section depends on the target: Copy / Select all in the preview, plus Copy link address on links and Copy code on code blocks; Cut / Copy / Paste / Select all in the editor. Then Edit mode or View mode, Save (enabled while there are unsaved edits), Print / Save as PDF, flyouts for Theme, Text size and Page width, Show in File Explorer / Reveal in Finder, and Copy file path. Mouse presses on the menu are swallowed so the selection survives; arrow keys, Enter and Escape work. WebView2 needs `with_clipboard(true)` or Paste raises a permission prompt. -- **Shortcuts:** Ctrl/Cmd+E edit, +S save, +P print/PDF, +Shift+L cycle theme, +`+` / +`-` / +0 text size (Ctrl+wheel and trackpad pinch too); Cmd+C/V/X/A/Z/W/Q on macOS come from the menu bar. +- **Reading (built):** Ctrl/Cmd+F opens a find bar over the preview (`frontend/src/find.js`): matches are wrapped in `` elements, may span inline formatting but not blocks, skip SVG and KaTeX's MathML, and are redone after every re-render. Ctrl/Cmd+Shift+O toggles a per-window *Contents* panel (`outline.js`) that tracks the current section. GitHub alerts (`alerts.js`), click-to-zoom for images shown below their natural size, and dropping `.md` files on a window (wry's native drop handler, which has the real paths) to open them. +- **Source lines (built):** every rendered block carries `data-line`, its 0-based source line. The preview follows the editor by interpolating between the blocks around the editor's top line, and outline clicks in edit mode move the editor. +- **Shortcuts:** Ctrl/Cmd+F find, +Shift+O contents, Ctrl/Cmd+E edit, +S save, +P print/PDF, +Shift+L cycle theme, +`+` / +`-` / +0 text size (Ctrl+wheel and trackpad pinch too); Cmd+C/V/X/A/Z/W/Q on macOS come from the menu bar. - **Window:** sensible default size, remember last size globally (a small config file), title shows the file name, plus a dirty marker in edit mode. ### Open-file handling diff --git a/README.md b/README.md index 46fa481..b3e8706 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ mdown notes.md # open a file mdown a.md b.md c.md # one window each ``` -Links between Markdown files open in a new window (`../` links included), links to folders, PDFs, images and text files open in their usual app, and links to anything else are shown in the file manager rather than run. Images and models resolve relative to the document, and the view updates by itself whenever the file changes on disk. If you have unsaved edits when that happens, mdown asks before replacing them. +Drop `.md` files on a window to open them too. Links between Markdown files open in a new window (`../` links included), links to folders, PDFs, images and text files open in their usual app, and links to anything else are shown in the file manager rather than run. Images and models resolve relative to the document, and the view updates by itself whenever the file changes on disk. If you have unsaved edits when that happens, mdown asks before replacing them. ### Open `.md` files from the file manager @@ -49,6 +49,8 @@ For scripts: `mdown install --context-menu`, `--default` or `--all`, with `--yes ## What it renders - **Markdown**: tables, task lists, footnotes, heading anchors, strikethrough, autolinks, front matter (hidden), and inline HTML (sanitized). +- **Alerts**: GitHub's `> [!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]` and `[!CAUTION]` callouts. +- **Images**: click one that's shown smaller than its real size to see it full size. - **Code**: syntax highlighting for 28 common languages, loaded only when a document uses them. - **Math**: `$inline$` and `$$display$$` with KaTeX. - **Diagrams**: ```` ```mermaid ```` fences. @@ -57,15 +59,19 @@ For scripts: `mdown install --context-menu`, `--default` or `--all`, with `--yes A block that fails (bad Mermaid, broken JSON, a missing model) shows an inline error and the rest of the page renders normally. Each of the heavier features is loaded only when the document needs it, so plain Markdown stays quick. See [`docs/showcase.md`](docs/showcase.md) for the document in the screenshots. +## Reading + +Ctrl/⌘+F finds text in the page (Enter and Shift+Enter step through the matches, Esc closes). Ctrl/⌘+Shift+O opens a *Contents* panel listing the headings, with the section you're reading highlighted; click one to jump to it. + ## Editing and PDF -Ctrl/⌘+E splits the window into an editor and a live preview (a CodeMirror editor with Markdown highlighting, undo history and search); press it again to go back to reading. Ctrl/⌘+S saves. Closing a window with unsaved edits asks first. +Ctrl/⌘+E splits the window into an editor and a live preview (a CodeMirror editor with Markdown highlighting, undo history and search); press it again to go back to reading. The preview follows the editor line by line as you scroll, and clicking a heading in the *Contents* panel moves the editor there. Ctrl/⌘+S saves. Closing a window with unsaved edits asks first. Ctrl/⌘+P opens the system print dialog, where *Save as PDF* is one of the printers. Printing always uses a clean light layout, with diagrams, charts and 3D models drawn as static images. ## Right-click menu -Right-click anywhere for copy and select-all (cut and paste in the editor), *Copy link address* and *Copy code* on links and code blocks, edit/view mode, save, print, the **theme**, **text size** and **page width** settings, *Show in File Explorer* / *Reveal in Finder*, and *Copy file path*. +Right-click anywhere for copy and select-all (cut and paste in the editor), *Copy link address* and *Copy code* on links and code blocks, *Find*, edit/view mode, save, print, *Contents*, the **theme**, **text size** and **page width** settings, *Show in File Explorer* / *Reveal in Finder*, and *Copy file path*.

    the right-click menu with the Theme submenu open

    @@ -73,6 +79,8 @@ Right-click anywhere for copy and select-all (cut and paste in the editor), *Cop | | | |---|---| +| Ctrl/⌘+F | Find (in the editor: the editor's search) | +| Ctrl/⌘+Shift+O | Show or hide the *Contents* panel | | Ctrl/⌘+E | Toggle edit mode | | Ctrl/⌘+S | Save | | Ctrl/⌘+P | Print or save as PDF | From 315685bb3ea6fb74ad7dc8bcb226ac391f89201c Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:53:24 +0000 Subject: [PATCH 5/6] Attach the archives when the release was made on GitHub Publishing a release from the Releases page creates its tag, which starts this workflow, and the last step then failed because the release already existed. That is how v0.1.1 ended up on crates.io with no archives on its release. The step now uploads the archives to an existing release and only creates one when there isn't one. --- .github/workflows/release.yml | 17 ++++++++++++----- PLAN.md | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf13bb2..8c46b56 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,9 +4,10 @@ name: Release # release with the archives attached (cargo-binstall reads them, see [package.metadata.binstall]). # To release, bump `version` in Cargo.toml (and the mdown entry in Cargo.lock), commit, then either # - in the browser: Actions > Release > Run workflow, on main. The release step creates the -# tag v on that commit; or +# tag v on that commit (preferred: nothing appears until the crate is published); +# - in the browser: Releases > Draft a new release, with a new tag v on main. The +# tag starts this workflow, which attaches the archives to that release when it's done; or # - from a terminal: git tag v && git push origin v -# Don't create the release by hand on GitHub: this workflow makes it once the crate is published. # Publishing needs a crates.io API token stored as the repository secret CARGO_REGISTRY_TOKEN. on: @@ -110,8 +111,14 @@ jobs: with: path: dist merge-multiple: true - - name: Create the release + - name: Create the release, or add the archives to one made on GitHub env: GH_TOKEN: ${{ github.token }} - # On a manual run the tag doesn't exist yet; --target creates it on the commit just built. - run: gh release create "${{ needs.check.outputs.tag }}" dist/* --repo "${{ github.repository }}" --target "${{ github.sha }}" --title "${{ needs.check.outputs.tag }}" --generate-notes + TAG: ${{ needs.check.outputs.tag }} + run: | + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --clobber + else + # On a manual run the tag doesn't exist yet; --target creates it on the commit just built. + gh release create "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "$TAG" --generate-notes + fi diff --git a/PLAN.md b/PLAN.md index b903dce..7877b8a 100644 --- a/PLAN.md +++ b/PLAN.md @@ -128,7 +128,7 @@ crates.io limits a published crate to 10 MB compressed. The embedded frontend (m - **Icon (built):** `frontend/mkicon.mjs` draws `assets/icon.svg` and writes every format into `assets/`, all committed so a build never needs Node: `icon.ico`, `icon.icns`, `icon.png`, `icon-64.rgba` (window icon) and `mdown.res`, a precompiled Windows resource that `build.rs` links into both exes (MSVC only; no `rc.exe` needed). Windows shows it in the exe, Explorer, the title bar and the registry entries; `mdown install` on macOS writes the `.icns` into `mdown.app` (validated with `iconutil`). The design is a simple placeholder-quality mark and is easy to replace: edit the SVG in `mkicon.mjs` and rerun it. - **README (built):** `README.md` with light/dark/edit/menu screenshots in `docs/` (captured from `docs/showcase.md` through the WebView2 debug port). - **Crate metadata (built):** description, MIT license (`LICENSE`), keywords, categories, `rust-version = "1.90"` (set by the macOS-only `muda`), binstall metadata, `.github/workflows/ci.yml` (tests and a release build on Windows and macOS for pushes to `main` and PRs) and `release.yml`. Repository: https://github.com/RAZKOM/mdown. -- **Releasing:** bump `version` in `Cargo.toml` (and the `mdown` entry in `Cargo.lock`, or `cargo publish` refuses the dirty tree), commit, then either run *Actions → Release → Run workflow* on `main` from the browser (the last step creates the tag `v`), or `git tag v && git push origin v`. Don't create the GitHub release by hand: the workflow makes it, and would fail if it already existed. `release.yml` runs `check` (a pushed tag must equal the Cargo.toml version; a manual run must be on `main` and the tag must not exist yet), `build` (Windows x64 and macOS arm64/x64 archives), `publish` (`cargo publish` from a Windows runner, using the repository secret `CARGO_REGISTRY_TOKEN`), then `release` (GitHub release with the archives, which `cargo binstall` downloads). The first publish of a new crate name needs a crates.io API token; trusted publishing can replace the token once the crate exists. +- **Releasing:** bump `version` in `Cargo.toml` (and the `mdown` entry in `Cargo.lock`, or `cargo publish` refuses the dirty tree), commit, then either run *Actions → Release → Run workflow* on `main` from the browser (the last step creates the tag `v`), or `git tag v && git push origin v`. Publishing a release from GitHub's *Releases* page with a new tag also works: the tag starts the workflow, which attaches the archives to that release instead of creating one (v0.1.1 went out this way before that step existed, so its release has no archives and binstall builds it from source). `release.yml` runs `check` (a pushed tag must equal the Cargo.toml version; a manual run must be on `main` and the tag must not exist yet), `build` (Windows x64 and macOS arm64/x64 archives), `publish` (`cargo publish` from a Windows runner, using the repository secret `CARGO_REGISTRY_TOKEN`), then `release` (GitHub release with the archives, which `cargo binstall` downloads). The first publish of a new crate name needs a crates.io API token; trusted publishing can replace the token once the crate exists. - **Dev hooks:** `MDOWN_DEBUG_JS` and the startup timing marks exist only with `--features debug-hooks`; `window.__editor` / `window.__print` stay in the page as test hooks. - **Package check:** `cargo publish --dry-run` packages 201 files, 7.6 MiB (2.5 MiB compressed, limit 10 MiB) and builds from the tarball. From 25b74c696eb12fa34288fcd986cc7aa01eb36065 Mon Sep 17 00:00:00 2001 From: RAZKOM <269026521+RAZKOM@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:53:24 +0000 Subject: [PATCH 6/6] Bump the version to 0.2.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff22eb2..c2bf8ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1189,7 +1189,7 @@ dependencies = [ [[package]] name = "mdown" -version = "0.1.1" +version = "0.2.0" dependencies = [ "core-foundation", "dirs", diff --git a/Cargo.toml b/Cargo.toml index b5d742f..29de8d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mdown" -version = "0.1.1" +version = "0.2.0" edition = "2024" rust-version = "1.90" description = "A lightweight native Markdown viewer and editor with math, diagrams, charts and 3D models"