perun-core 4.5.7 → 4.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -24
- package/package.json +1 -1
- package/www/csv.perun-core.js +2 -0
- package/www/markdown.perun-core.js +67 -0
- package/www/pdfmake.perun-core.js +25 -91
- package/www/perun-core.js +70 -722
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ The front-end module of the Svarog framework, containing the core functionalitie
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- [Node.js](https://nodejs.org/) (v22.
|
|
8
|
-
- [pnpm](https://pnpm.io/) (
|
|
7
|
+
- [Node.js](https://nodejs.org/) (v22.22.2 or higher, which the unit tests' jsdom requires; installing and building need 22.13)
|
|
8
|
+
- [pnpm](https://pnpm.io/) (v11 or higher)
|
|
9
9
|
|
|
10
10
|
## Getting Started
|
|
11
11
|
|
|
@@ -21,14 +21,56 @@ pnpm install
|
|
|
21
21
|
|---------|-------------|
|
|
22
22
|
| `pnpm build` | Production build under `/www` (minified, no source maps, no debug) |
|
|
23
23
|
| `pnpm build-dev` | The same production build with source maps and debug enabled; CI builds the `dev` branch this way |
|
|
24
|
-
| `pnpm dev` | Serves `www/index.html` on port 8080 with the bundle rebuilt on every save (unminified, source maps, debug) and the page reloaded after each rebuild. The bundle is served under `/perun/`, as a deployment serves it, so its sources show under `/perun/frontend/` in DevTools. Everything else is proxied to the backend that `
|
|
25
|
-
| `pnpm lint` | Lints `frontend/` with oxlint; fails on an error |
|
|
24
|
+
| `pnpm dev` | Serves `www/index.html` on port 8080 (or the next free one) with the bundle rebuilt on every save (unminified, source maps, debug) and the page reloaded after each rebuild. The bundle is served under `/perun/`, as a deployment serves it, so its sources show under `/perun/frontend/` in DevTools. Everything else is proxied to the backend that `PERUN_BACKEND` names (see [Running Perun Core Locally](#running-perun-core-locally)) |
|
|
25
|
+
| `pnpm lint` | Lints `frontend/` and `test/` with oxlint; fails on an error |
|
|
26
26
|
| `pnpm lint:fix` | The same, fixing what oxlint can |
|
|
27
|
+
| `pnpm test` | Runs the unit tests in `test/` once with Vitest |
|
|
28
|
+
| `pnpm test:watch` | The same, rerunning the affected tests on every save |
|
|
27
29
|
|
|
28
30
|
## Environment Variables
|
|
29
31
|
|
|
30
32
|
This project has no required build-time environment variables. Google Analytics is configured at runtime via the `GOOGLE_ANALYTICS_ID` system parameter fetched from the server (`WsConf/params/get/sys/GOOGLE_ANALYTICS_ID`). reCAPTCHA is loaded conditionally based on the `GOOGLE_CAPTCHA_ENABLED` system parameter (`WsConf/params/get/sys/GOOGLE_CAPTCHA_ENABLED`); set it to `"true"` to enable it.
|
|
31
33
|
|
|
34
|
+
## Versions
|
|
35
|
+
|
|
36
|
+
The version is the one in `pom.xml`: the OSGi bundle svarog runs, with `www/perun-core.js` inside it,
|
|
37
|
+
carries it as its `Bundle-Version`. Between releases `dev`'s pom names the next one with `-SNAPSHOT`, as
|
|
38
|
+
Maven expects.
|
|
39
|
+
|
|
40
|
+
`package.json` names the last version cut, a release or a release candidate, and the bundle's `version`
|
|
41
|
+
export reports it at runtime. Each is tagged with its number, as a lightweight tag, on the commit whose
|
|
42
|
+
`package.json` says it, and that commit's `www/perun-core.js` is a `pnpm build` of it.
|
|
43
|
+
|
|
44
|
+
- A candidate is cut on `dev`. It sets `package.json` to the pom's number with `-rc.N` (`4.5.8-rc.1`),
|
|
45
|
+
rebuilds the bundle, and is tagged. The pom keeps its `-SNAPSHOT`, so nothing is released to Maven.
|
|
46
|
+
- A release starts on `dev` too: the commit that adds its section to `CHANGELOG.md` sets `package.json`
|
|
47
|
+
to the release's number and rebuilds the bundle. `dev` is then merged into `main` with `--no-ff`, the
|
|
48
|
+
merge setting the pom to the same number, and the merge is tagged (`4.5.8`). Pushing `main` deploys it
|
|
49
|
+
to GitLab's Maven repository, and pushing the tag publishes it to Maven Central, from the GitHub
|
|
50
|
+
mirror's release workflow. Back on `dev`, the next commit moves the pom to the next snapshot, and
|
|
51
|
+
`package.json` stays until the next candidate.
|
|
52
|
+
|
|
53
|
+
Push each tag by name (`git push origin 4.5.8`); `--follow-tags` skips lightweight tags. A consumer
|
|
54
|
+
depends on perun-core by tag:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
"perun-core": "git+https://git@gitlab.prtech.mk/svarog4/perun-core#semver:^4.5.8-rc.1"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
pnpm takes the newest tag in the range, and the lockfile records its commit. `^4.5.8-rc.1` takes
|
|
61
|
+
candidates of 4.5.8 and then 4.5.8 itself, once a `pnpm update perun-core` asks for it; `^4.5.8` skips
|
|
62
|
+
candidates, and `#4.5.8` pins one release. A consumer whose other git dependencies declare a
|
|
63
|
+
perun-core of their own names the same specifier in its overrides as well (`overrides` in
|
|
64
|
+
`pnpm-workspace.yaml`), which is what makes them one copy.
|
|
65
|
+
|
|
66
|
+
A range takes every later version under the same major, on the next `pnpm update`. A change that a
|
|
67
|
+
module has to be adapted to therefore moves the major, not the patch.
|
|
68
|
+
|
|
69
|
+
The tags have to stay lightweight: for an annotated tag pnpm 9 and 10 record the tag's own hash and
|
|
70
|
+
pnpm 11 the commit's, and pnpm 11 then refuses a lockfile the others wrote. 4.5.0 to 4.5.7 were tagged
|
|
71
|
+
`v4.5.0` to `v4.5.7`, annotated, before this; they are retagged the same way now, on the same `main`
|
|
72
|
+
merges. Their `package.json` still says `0.2.0`, so that is the version pnpm lists for them.
|
|
73
|
+
|
|
32
74
|
## Local Development Guide
|
|
33
75
|
|
|
34
76
|
The following workflow applies both when developing `perun-core` itself and when developing a project that uses it as a dependency.
|
|
@@ -42,14 +84,29 @@ The following workflow applies both when developing `perun-core` itself and when
|
|
|
42
84
|
Or use `pnpm build-dev` if you need source maps for debugging.
|
|
43
85
|
2. Copy `perun-core/www/perun-core.js` into your project at `your-project/node_modules/perun-core/www/`,
|
|
44
86
|
along with the modules beside it (`tabler-icons-react.perun-core.js`, `pdfmake.perun-core.js`,
|
|
45
|
-
`xlsx.perun-core.js`). Those are loaded on demand
|
|
46
|
-
|
|
87
|
+
`xlsx.perun-core.js`, `csv.perun-core.js`, `markdown.perun-core.js`). Those are loaded on demand
|
|
88
|
+
from the same directory as the bundle, so a copy without them leaves the icon set, the user guides,
|
|
89
|
+
the guide PDF export and the grids' Excel and CSV exports unable to load.
|
|
47
90
|
|
|
48
91
|
Since the built script is periodically committed to the repository, your project may already have a recent version of `perun-core.js` in `node_modules/perun-core/www/` after running `pnpm install`. This step is only necessary when you need changes that haven't been published yet.
|
|
49
92
|
|
|
50
|
-
###
|
|
93
|
+
### Running Perun Core Locally
|
|
51
94
|
|
|
52
|
-
|
|
95
|
+
`pnpm dev` serves the committed `www/index.html`, the page a deployment serves, so there is nothing in `www/` to create or edit. Everything it does not serve itself goes to one backend through a proxy, and that backend's origin is `PERUN_BACKEND`, set in an untracked `.env.local` at the repository root:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
PERUN_BACKEND=http://<host>:<port>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
or in the environment, which takes precedence over the file (`PERUN_BACKEND=http://<host>:<port> pnpm dev`). `.gitignore` covers `*.local`, so the file stays on your machine. Without it, `pnpm dev` stops at startup and says what is missing.
|
|
102
|
+
|
|
103
|
+
Open http://localhost:8080/ (or the port the dev server printed, if 8080 was taken). The page loads `window.server` from `../services/WsConf/getServer` and sweetalert2 from `../perun-assets/`, as it does deployed, and both reach the backend through the proxy, as do the API, the shared assets and the module bundles. The bundle, and the modules it loads on demand, come from `www/` under `/perun/`, rebuilt on every save. If a backend's `getServer` answers with an absolute `window.server` (its `frontend.server` property is a URL rather than `'/services'`), the dev server answers `/services` in its place, so the page still makes every request to localhost.
|
|
104
|
+
|
|
105
|
+
`www/config.js` is no longer used or tracked. A copy left in an older checkout can be deleted once its host is in `.env.local`.
|
|
106
|
+
|
|
107
|
+
### Setting Up a Module's Entry Point
|
|
108
|
+
|
|
109
|
+
A module repository's dev page is its own `backend/www/index.html`, and its dev server still reads the backend from a `config.js` beside it. Create these two files in `backend/www`:
|
|
53
110
|
|
|
54
111
|
**`config.js`** - Configure the server URL for your environment:
|
|
55
112
|
|
|
@@ -70,11 +127,6 @@ window.server = 'http://<host>:<port>/services'
|
|
|
70
127
|
<body>
|
|
71
128
|
<div id="app"></div>
|
|
72
129
|
<script src="config.js"></script>
|
|
73
|
-
<script>
|
|
74
|
-
// If your project uses spatial features, add these (see Spatial Support section):
|
|
75
|
-
// window.sysCrs = 'EPSG:3857'
|
|
76
|
-
// window.sysCenter = { lat: 41.294, lng: 74.597 }
|
|
77
|
-
</script>
|
|
78
130
|
<script>
|
|
79
131
|
const assetsUrl = `${window.server}/WsConf/params/get/sys/FRONTEND_ASSETS_LOCATION`
|
|
80
132
|
fetch(assetsUrl).then(response => response.json()).then(res => {
|
|
@@ -121,19 +173,14 @@ To simulate a server unavailability scenario locally, block the `getServer` requ
|
|
|
121
173
|
|
|
122
174
|
### Spatial Support
|
|
123
175
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```js
|
|
127
|
-
window.sysCrs = 'EPSG:3857'
|
|
128
|
-
window.sysCenter = { lat: 41.294, lng: 74.597 }
|
|
129
|
-
```
|
|
176
|
+
Spatial settings do not go in `index.html`. They are system parameters (`SVAROG_SYS_PARAMS`) at the environment level, which perun-atlas reads at startup and hands to the spatial engine. A map needs these two, and without either one perun-atlas stops at startup and names the missing parameter:
|
|
130
177
|
|
|
131
|
-
|
|
178
|
+
| System Parameter | Example value |
|
|
179
|
+
|------------------|---------------|
|
|
180
|
+
| `SPATIAL_CRS` | `EPSG:3857` |
|
|
181
|
+
| `SPATIAL_CENTER` | `{"lat": 41.294, "lng": 74.597}` |
|
|
132
182
|
|
|
133
|
-
|
|
134
|
-
|-----------------|------------------|
|
|
135
|
-
| `window.sysCrs` | `SYS_CRS` |
|
|
136
|
-
| `window.sysCenter` | `SYS_CENTER` |
|
|
183
|
+
The optional ones (`SPATIAL_BOUNDS`, `SPATIAL_ZOOM`, `SPATIAL_MEASUREMENT_SYSTEM` and the rest) are listed in perun-atlas's `frontend/config/Schema.js`. The `window.sysCrs` and `window.sysCenter` globals that older pages set, and the `SYS_CRS` and `SYS_CENTER` parameters behind them, are not needed.
|
|
137
184
|
|
|
138
185
|
### Icons
|
|
139
186
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return e==null?``:`${e}`}function t(e={}){let{separator:t,decimals:n}=e;return t?n===void 0?e=>`${e}`.replace(`.`,t):e=>e.toFixed(n).replace(`.`,t):n===void 0?e=>`${e}`:e=>e.toFixed(n)}function n(e={}){let t=typeof e.quote==`string`?e.quote:`"`,n=typeof e.escapedQuote==`string`?e.escapedQuote:`${t}${t}`;return!t||t===n?e=>e:e=>(e.includes(t)&&(e=e.replaceAll(t,n)),`${t}${e}${t}`)}function r(e={stringFormatter:n()}){return t=>{if(t===null)return``;let n=JSON.stringify(t);return n===void 0?``:(n[0]===`"`&&(n=n.replace(/^"(.+)"$/,`$1`)),e.stringFormatter(n))}}function i(e={stringFormatter:n()}){return t=>e.stringFormatter(t.toString().slice(7,-1))}var a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/,s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,l=Object.create(null);function u(e,t){if(Array.isArray(e))return!1;let n=typeof e;return n===`number`||n===`symbol`||n===`boolean`||e==null||o.test(e)||!a.test(e)||t!=null&&e in Object(t)}function d(e){let t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(s,(e,n,r,i)=>(t.push(r?i.replace(c,`$1`):n||e),e)),t}function f(e,t){if(Array.isArray(e))return e;let n=e;return u(n,t)?[n]:d(String(n))}function p(e,t,n){let r=e;for(let e of t)if(r=r?.[e],r===void 0)return n;return r}function m(e,t){let n=f(e,l);return n.length===1&&n[0]===e?n=>{let r=n[e];return r===void 0?t:r}:r=>{if(e in r){let n=r[e];return n===void 0?t:n}return p(r,n,t)}}function h(e,t){if(Array.isArray(t))for(let n of t)e.push(n);else e.push(t);return e}function g(e,t){let n=!0;return e.reduce((e,r)=>(r??(r=``),n?(n=!1,`${r}`):`${e}${t}${r}`),``)}var _;(function(e){e.header=`header`,e.undefined=`undefined`,e.boolean=`boolean`,e.number=`number`,e.bigint=`bigint`,e.string=`string`,e.symbol=`symbol`,e.function=`function`,e.object=`object`})(_||(_={}));var v=class{constructor(e){this.opts=this.preprocessOpts(e)}preprocessOpts(a){let o=Object.assign({},a);o.fields&&(o.fields=this.preprocessFieldsInfo(o.fields,o.defaultValue)),o.transforms=o.transforms||[];let s=o.formatters?.string||n(),c=r({stringFormatter:s});return o.formatters={header:s,undefined:e,boolean:e,number:t(),bigint:e,string:s,symbol:i({stringFormatter:s}),function:c,object:c,...o.formatters},o.delimiter=o.delimiter||`,`,o.eol=o.eol||`
|
|
2
|
+
`,o.header=o.header!==!1,o.includeEmptyRows=o.includeEmptyRows||!1,o.withBOM=o.withBOM||!1,o}preprocessFieldsInfo(e,t){return e.map(e=>{if(typeof e==`string`)return{label:e,value:m(e,t)};if(typeof e==`object`){let n=`default`in e?e.default:t;if(typeof e.value==`string`){let t=e.value;return{label:e.label||e.value,value:m(t,n)}}if(typeof e.value==`function`){let t=e.label||e.value.name||``,r={label:t,default:n},i=e.value;return{label:t,value(e){let t=i(e,r);return t===void 0?n:t}}}}throw Error(`Invalid field info option. ${JSON.stringify(e)}`)})}getHeader(){return g(this.opts.fields.map(e=>this.opts.formatters.header(e.label)),this.opts.delimiter)}preprocessRow(e){return this.opts.transforms.reduce((e,t)=>e.map(e=>t(e)).reduce(h,[]),[e])}processRow(e){if(!e)return;let t=this.opts.fields.map(t=>this.processCell(e,t));if(this.opts.includeEmptyRows||!t.every(e=>e===``))return g(t,this.opts.delimiter)}processCell(e,t){return this.processValue(t.value(e))}processValue(e){let t=this.opts.formatters[typeof e];return t(e)}},y=class extends v{parse(e){let t=this.preprocessData(e);if(!this.opts.fields){let e=/* @__PURE__ */ new Set;for(let n of t)for(let t of Object.keys(n))e.add(t);this.opts.fields=this.preprocessFieldsInfo([...e],this.opts.defaultValue)}let n=this.opts.header?this.getHeader():``,r=this.processData(t);return(this.opts.withBOM?``:``)+n+(n&&r?this.opts.eol:``)+r}preprocessData(e){let t=Array.isArray(e)?e:[e];if(!this.opts.fields){if(e==null||t.length===0)throw Error(`Data should not be empty or the "fields" option should be included`);if(t[0]===null||typeof t[0]!=`object`)throw Error(`Data items should be objects or the "fields" option should be included`)}return this.opts.transforms.length===0?t:t.map(e=>this.preprocessRow(e)).reduce(h,[])}processData(e){return g(e.map(e=>this.processRow(e)).filter(e=>e!==void 0),this.opts.eol)}};export{y as Parser};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}function n(n){var r=t(n,`string`);return e(r)==`symbol`?r:r+``}function r(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function a(e,t){i(e,t),t.add(e)}function o(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}var s,c;function l(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var u=l();function d(e){u=e}var f={exec:()=>null};function p(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function m(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(g.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var h=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),g={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:p(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:p(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:p(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:p(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:p(e=>RegExp(`^ {0,${e}}(?:</?(?:${x})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:p(e=>RegExp(`^ {0,${e}}>`))},ee=/^(?:[ \t]*(?:\n|$))+/,te=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ne=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,re=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ie=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,v=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ae=m(v).replace(/bull/g,ie).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),oe=m(v).replace(/bull/g,ie).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),se=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,y=/^[^\n]+/,b=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ce=m(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,b).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),le=m(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ie).getRegex(),x=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,ue=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,de=m(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,ue).replace(`tag`,x).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fe=e=>m(se).replace(`hr`,_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex(),pe=fe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),me=fe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),he={blockquote:m(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,me).getRegex(),code:te,def:ce,fences:ne,heading:re,hr:_,html:de,lheading:ae,list:le,newline:ee,paragraph:pe,table:f,text:y},ge=m(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex(),_e={...he,lheading:oe,table:ge,paragraph:m(se).replace(`hr`,_).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ge).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex()},ve={...he,html:m(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,ue).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:f,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:m(se).replace(`hr`,_).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,ae).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ye=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,S=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,be=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,xe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,C=/[\p{P}\p{S}]/u,Se=/[\s\p{P}\p{S}]/u,Ce=/[^\s\p{P}\p{S}]/u,we=m(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Se).getRegex(),Te=/[\p{Pi}\p{Ps}"']/u,Ee=/(?!~)[\p{P}\p{S}]/u,De=/(?!~)[\s\p{P}\p{S}]/u,w=/(?:[^\s\p{P}\p{S}]|~)/u,Oe=m(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,h?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),T=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ke=m(T,`u`).replace(/punct/g,C).getRegex(),E=m(T,`u`).replace(/punct/g,Ee).getRegex(),Ae=m(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Te).replace(/punct/g,C).getRegex(),je=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,D=m(je,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,C).getRegex(),Me=m(je,`gu`).replace(/notPunctSpace/g,w).replace(/punctSpace/g,De).replace(/punct/g,Ee).getRegex(),Ne=m(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,C).getRegex(),Pe=m(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,C).getRegex(),Fe=m(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,C).getRegex(),O=m(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,C).getRegex(),k=m(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ce).replace(/punctSpace/g,Se).replace(/punct/g,C).getRegex(),Ie=m(/\\(punct)/,`gu`).replace(/punct/g,C).getRegex(),Le=m(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,C).getRegex(),Re=m(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[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])?)+(?![-_])/).getRegex(),ze=m(ue).replace(`(?:-->|$)`,`-->`).getRegex(),Be=m(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,ze).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ve=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,He=m(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Ve).getRegex(),Ue=m(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,He).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),We=m(/^!?\[(label)\]\[(ref)\]/).replace(`label`,He).replace(`ref`,b).getRegex(),Ge=m(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,b).getRegex(),Ke=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,qe=m(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Ve).getRegex(),Je=m(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,m(/^!?\[(label)\]\[(ref)\]/).replace(`label`,qe).replace(`ref`,Ke).getRegex()).replace(`nolink`,m(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ke).getRegex()).getRegex(),A=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ye=m(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),j={_backpedal:f,anyPunctuation:Ie,anyPunctuationOutsideCode:Le,autolink:Re,blockSkip:Oe,br:be,code:S,del:f,delLDelim:f,delRDelim:f,emStrongLDelim:ke,emStrongRDelimAst:D,emStrongRDelimUnd:Pe,escape:ye,link:Ue,nolink:Ge,punctuation:we,reflink:We,reflinkSearch:Je,tag:Be,text:xe,url:f},Xe={...j,emStrongLDelim:Ae,emStrongRDelimAst:Ne,emStrongRDelimUnd:Fe,link:m(/^!?\[(label)\]\((.*?)\)/).replace(`label`,He).getRegex(),reflink:m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,He).getRegex()},Ze={...j,emStrongRDelimAst:Me,emStrongLDelim:E,delLDelim:O,delRDelim:k,url:m(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Ye).replace(`protocol`,A).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:m(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,A).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Qe={...Ze,br:m(be).replace(`{2,}`,`*`).getRegex(),text:m(Ze.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},$e={normal:he,gfm:_e,pedantic:ve},et={normal:j,gfm:Ze,breaks:Qe,pedantic:Xe},tt={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},nt=e=>tt[e];function M(e,t){if(t){if(g.escapeTest.test(e))return e.replace(g.escapeReplace,nt)}else if(g.escapeTestNoEncode.test(e))return e.replace(g.escapeReplaceNoEncode,nt);return e}function rt(e){return g.numericCharacterReference.test(e)?e.replace(g.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function it(e){try{e=encodeURI(e).replace(g.percentDecode,`%`)}catch{return null}return e}function at(e,t){let n=e.replace(g.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(g.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(g.slashPipe,`|`);return n}function N(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function ot(e){let t=e.split(`
|
|
3
|
+
`),n=t.length-1;for(;n>=0&&g.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
+
`)}function st(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function ct(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function lt(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ut(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function dt(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
5
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
6
|
+
`)}function ft(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var P=class{constructor(e){r(this,`options`,void 0),r(this,`rules`,void 0),r(this,`lexer`,void 0),this.options=e||u}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:ot(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=dt(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=N(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:N(t[0],`
|
|
7
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:N(t[0],`
|
|
8
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=N(t[0],`
|
|
9
|
+
`).split(`
|
|
10
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
11
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
12
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
13
|
+
${s}`:s,r=r?`${r}
|
|
14
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
15
|
+
`),o=t.raw+`
|
|
16
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
17
|
+
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
18
|
+
${d.join(`
|
|
19
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
20
|
+
`+e.join(`
|
|
21
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
22
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
|
|
23
|
+
`,1)[0],d=t[1].length,f=this.options.pedantic?lt(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>lt(e,d)),p=e.split(`
|
|
24
|
+
`,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
|
|
25
|
+
`,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>lt(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
|
|
26
|
+
`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;a+=`
|
|
27
|
+
`+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&(e.task=!1)}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=ot(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&ct(t[2],`()`)!==-1)return;let e=st(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:N(t[0],`
|
|
28
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=at(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
29
|
+
`):[],a={type:`table`,raw:N(t[0],`
|
|
30
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(at(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:N(t[0],`
|
|
31
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
32
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ft(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=N(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=ct(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),ut(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&ft(e,n[1],r,this.rules))return;let i=t[st((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return ut(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:rt(t[0]),escaped:e}}}},F=(s=/* @__PURE__ */ new WeakSet,class e{constructor(e){a(this,s),r(this,`tokens`,void 0),r(this,`options`,void 0),r(this,`state`,void 0),r(this,`inlineQueue`,void 0),r(this,`tokenizer`,void 0),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||u,this.options.tokenizer=this.options.tokenizer||new P,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:g,block:$e.normal,inline:et.normal};this.options.pedantic?(t.block=$e.pedantic,t.inline=et.pedantic):this.options.gfm&&(t.block=$e.gfm,t.inline=this.options.breaks?et.breaks:et.gfm),this.tokenizer.rules=t}static get rules(){return{block:$e,inline:et}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(g.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(g.tabCharGlobal,` `).replace(g.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
34
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
35
|
+
`)?``:`
|
|
36
|
+
`)+i.raw,n.text+=`
|
|
37
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
38
|
+
`)?``:`
|
|
39
|
+
`)+i.raw,n.text+=`
|
|
40
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+i.raw,r.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+i.raw,n.text+=`
|
|
46
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,st(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return o(s,this,pt).call(this,e,t)}finally{this.state.linkParenPossible=n}}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}});function pt(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,st(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}var mt=class{constructor(e){r(this,`options`,void 0),r(this,`parser`,void 0),this.options=e||u}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(g.notSpaceStart)?.[0],i=e?e.replace(g.endingNewline,``)+`
|
|
47
|
+
`:``;return r?`<pre><code class="language-`+M(r)+`">`+(n?i:M(i,!0))+`</code></pre>
|
|
48
|
+
`:`<pre><code>`+(n?i:M(i,!0))+`</code></pre>
|
|
49
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
50
|
+
${this.parser.parse(e)}</blockquote>
|
|
51
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
52
|
+
`}hr(e){return`<hr>
|
|
53
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
54
|
+
`+r+`</`+i+`>
|
|
55
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
56
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
57
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
58
|
+
<thead>
|
|
59
|
+
`+t+`</thead>
|
|
60
|
+
`+r+`</table>
|
|
61
|
+
`}tablerow({text:e}){return`<tr>
|
|
62
|
+
${e}</tr>
|
|
63
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
64
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${M(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?M(n,!0):this.parser.parseInline(r),o=it(e);if(o===null)return a;e=M(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+M(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=it(e);if(i===null)return M(n);e=i;let a=`<img src="${M(e)}" alt="${M(n)}"`;return t&&(a+=` title="${M(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:M(e.text)}},ht=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},I=class e{constructor(e){r(this,`options`,void 0),r(this,`renderer`,void 0),r(this,`textRenderer`,void 0),this.options=e||u,this.options.renderer=this.options.renderer||new mt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ht}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},gt=(c=class{constructor(e){r(this,`options`,void 0),r(this,`block`,void 0),this.options=e||u}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?F.lex:F.lexInline}provideParser(e=this.block){return e?I.parse:I.parseInline}},r(c,`passThroughHooks`,/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`])),r(c,`passThroughHooksRespectAsync`,/* @__PURE__ */ new Set([`preprocess`,`postprocess`,`processAllTokens`])),c);function L(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var R=new class{constructor(...e){r(this,`defaults`,l()),r(this,`options`,this.setOptions),r(this,`parse`,this.parseMarkdown(!0)),r(this,`parseInline`,this.parseMarkdown(!1)),r(this,`Parser`,I),r(this,`Renderer`,mt),r(this,`TextRenderer`,ht),r(this,`Lexer`,F),r(this,`Tokenizer`,P),r(this,`Hooks`,gt),this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(L(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)L(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)L(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;L(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);L(n,this.walkTokens(i,t))}):e.tokens&&L(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new mt(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new P(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new gt;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=gt.passThroughHooks.has(n)?e=>{if(this.defaults.async&>.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&L(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return F.lex(e,t??this.defaults)}parser(e,t){return I.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(/* @__PURE__ */ Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(/* @__PURE__ */ Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(/* @__PURE__ */ Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?F.lex:F.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?I.parse:I.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?F.lex:F.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?I.parse:I.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+M(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function z(e,t){return R.parse(e,t)}z.options=z.setOptions=function(e){return R.setOptions(e),z.defaults=R.defaults,d(z.defaults),z},z.getDefaults=l,z.defaults=u;function _t(...e){return R.use(...e),z.defaults=R.defaults,d(z.defaults),z}z.use=_t,z.walkTokens=function(e,t){return R.walkTokens(e,t)},z.parseInline=R.parseInline,z.Parser=I,z.parser=I.parse,z.Renderer=mt,z.TextRenderer=ht,z.Lexer=F,z.lexer=F.lex,z.Tokenizer=P,z.Hooks=gt,z.parse=z,z.options,z.setOptions,z.walkTokens,z.parseInline,I.parse,F.lex;function B(e,t){this.v=e,this.k=t}function vt(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function yt(e){if(Array.isArray(e))return e}function bt(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function xt(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
66
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function St(e,t){return yt(e)||bt(e,t)||Ct(e,t)||xt()}function Ct(e,t){if(e){if(typeof e==`string`)return vt(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vt(e,t):void 0}}function wt(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof B;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}wt.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},wt.prototype.next=function(e){return this._invoke(`next`,e)},wt.prototype.throw=function(e){return this._invoke(`throw`,e)},wt.prototype.return=function(e){return this._invoke(`return`,e)};var Tt=Object.entries,Et=Object.setPrototypeOf,Dt=Object.isFrozen,Ot=Object.getPrototypeOf,kt=Object.getOwnPropertyDescriptor,V=Object.freeze,H=Object.seal,At=Object.create,jt=typeof Reflect<`u`&&Reflect,Mt=jt.apply,Nt=jt.construct;V||(V=function(e){return e}),H||(H=function(e){return e}),Mt||(Mt=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)}),Nt||(Nt=function(e){return new e(...[...arguments].slice(1))});var U=q(Array.prototype.forEach);Array.prototype.indexOf;var Pt=q(Array.prototype.lastIndexOf),Ft=q(Array.prototype.pop),It=q(Array.prototype.push),Lt=q(Array.prototype.slice),Rt=q(Array.prototype.splice),zt=Array.isArray,Bt=J(Set),Vt=q(Set.prototype.add),Ht=q(Set.prototype.has),Ut=q(String.prototype.toLowerCase),Wt=q(String.prototype.toString),Gt=q(String.prototype.match),Kt=q(String.prototype.replace),qt=q(String.prototype.indexOf),Jt=q(String.prototype.trim),Yt=q(Number.prototype.toString),Xt=q(Boolean.prototype.toString),Zt=typeof BigInt>`u`?null:q(BigInt.prototype.toString),Qt=typeof Symbol>`u`?null:q(Symbol.prototype.toString),W=q(Object.prototype.hasOwnProperty),$t=q(Object.prototype.toString),G=q(RegExp.prototype.test),K=J(TypeError);function q(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Mt(e,t,n)}}function J(e){return function(){return Nt(e,[...arguments])}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ut;if(Et&&Et(e,null),!zt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Dt(t)||(t[r]=e),i=e)}e[i]=!0}return e}function en(e){for(let t=0;t<e.length;t++)W(e,t)||(e[t]=null);return e}function X(e){let t=At(null);for(let r of Tt(e)){var n=St(r,2);let i=n[0],a=n[1];W(e,i)&&(t[i]=zt(a)?en(a):a&&typeof a==`object`&&a.constructor===Object?X(a):a)}return t}function tn(e){switch(typeof e){case`string`:return e;case`number`:return Yt(e);case`boolean`:return Xt(e);case`bigint`:return Zt?Zt(e):`0`;case`symbol`:return Qt?Qt(e):`Symbol()`;case`undefined`:return $t(e);case`function`:case`object`:{if(e===null)return $t(e);let t=e,n=Z(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:$t(e)}return $t(e)}default:return $t(e)}}function Z(e,t){for(;e!==null;){let n=kt(e,t);if(n){if(n.get)return q(n.get);if(typeof n.value==`function`)return q(n.value)}e=Ot(e)}function n(){return null}return n}function nn(e,t){for(;e!==null;){let n=kt(e,t);if(n)return n.get?q(n.get):null;e=Ot(e)}return null}function rn(e){try{return G(e,``),!0}catch{return!1}}var an=V(/* @__PURE__ */ `a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),on=V(/* @__PURE__ */ `svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),sn=V([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),cn=V([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),ln=V(/* @__PURE__ */ `math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),un=V([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),dn=V([`#text`]),fn=V(/* @__PURE__ */ `accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),pn=V(/* @__PURE__ */ `accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),mn=V(/* @__PURE__ */ `accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),hn=V([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),gn=H(/{{[\w\W]*|^[\w\W]*}}/g),_n=H(/<%[\w\W]*|^[\w\W]*%>/g),vn=H(/\${[\w\W]*/g),yn=H(/^data-[\-\w.\u00B7-\uFFFF]+$/),bn=H(/^aria-[\-\w]+$/),xn=H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sn=H(/^(?:\w+script|data):/i),Cn=H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wn=H(/^html$/i),Tn=H(/^[a-z][.\w]*(-[.\w]+)+$/i),En=H(/<[/\w!]/g),Dn=H(/<[/\w]/g),On=H(/<\/no(script|embed|frames)/i),kn=H(/\/>/i),Q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},An=V(Y({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),jn=function(){return typeof window>`u`?null:window},Mn=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Nn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Pn=function(e,t,n,r){return W(e,t)&&zt(e[t])?Y(r.base?X(r.base):{},e[t],r.transform):n},Fn=function(e,t,n){let r=W(e,t)?e[t]:void 0;return r&&typeof r==`object`?X(r):n()};function In(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jn(),t=e=>In(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Q.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Z(d,`cloneNode`),p=Z(d,`remove`),m=Z(d,`removeAttributeNode`),h=Z(d,`nextSibling`),g=Z(d,`childNodes`),ee=Z(d,`parentNode`),te=Z(d,`shadowRoot`),ne=Z(d,`attributes`),_=o&&o.prototype?Z(o.prototype,`nodeType`):null,re=o&&o.prototype?Z(o.prototype,`nodeName`):null,ie=o&&o.prototype?Z(o.prototype,`ownerDocument`):null,v=function(e){return _?_(e):e.nodeType},ae=function(e){return re?re(e):e.nodeName},oe=nn(d,`namespaceURI`),se=function(e){return oe?oe(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let y,b=``,ce,le=!1,x=0,ue=function(){if(x>0)throw K(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},de=function(e){ue(),x++;try{return y.createHTML(e)}finally{x--}},fe=function(e){ue(),x++;try{return y.createScriptURL(e)}finally{x--}},pe=function(){return le||(ce=Mn(u,i),le=!0),ce},me=n,he=me.implementation,ge=me.createNodeIterator,_e=me.createDocumentFragment,ve=me.getElementsByTagName,ye=r.importNode,S=Nn();t.isSupported=typeof Tt==`function`&&typeof ee==`function`&&he&&he.createHTMLDocument!==void 0;let be=gn,xe=_n,C=vn,Se=yn,Ce=bn,we=Sn,Te=Cn,Ee=Tn,De=xn,w=null,Oe=Y({},[...an,...on,...sn,...ln,...dn]),T=null,ke=Y({},[...fn,...pn,...mn,...hn]),E=Object.seal(At(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,je=null,D=Object.seal(At(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Me=!0,Ne=!0,Pe=!1,Fe=!0,O=!1,k=!0,Ie=!1,Le=!1,Re=null,ze=null,Be=!1,Ve=!1,He=!1,Ue=!1,We=!0,Ge=!1,Ke=`user-content-`,qe=!0,Je=!1,A=null,Ye={},j=null,Xe=Y({},/* @__PURE__ */ `annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ze=null,Qe=Y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),$e=null,et=Y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),tt=`http://www.w3.org/1998/Math/MathML`,nt=`http://www.w3.org/2000/svg`,M=`http://www.w3.org/1999/xhtml`,rt=M,it=!1,at=null,N=Y({},[tt,nt,M],Wt),ot=V([`mi`,`mo`,`mn`,`ms`,`mtext`]),st=Y({},ot),ct=V([`annotation-xml`]),lt=Y({},ct),ut=Y({},[`title`,`style`,`font`,`a`,`script`]),dt=null,ft=[`application/xhtml+xml`,`text/html`],P=null,F=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(F&&F===e)return;(!e||typeof e!=`object`)&&(e={}),e=X(e),dt=ft.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,P=dt===`application/xhtml+xml`?Wt:Ut,w=Pn(e,`ALLOWED_TAGS`,Oe,{transform:P}),T=Pn(e,`ALLOWED_ATTR`,ke,{transform:P}),at=Pn(e,`ALLOWED_NAMESPACES`,N,{transform:Wt}),$e=Pn(e,`ADD_URI_SAFE_ATTR`,et,{transform:P,base:et}),Ze=Pn(e,`ADD_DATA_URI_TAGS`,Qe,{transform:P,base:Qe}),j=Pn(e,`FORBID_CONTENTS`,Xe,{transform:P}),Ae=Pn(e,`FORBID_TAGS`,X({}),{transform:P}),je=Pn(e,`FORBID_ATTR`,X({}),{transform:P}),Ye=W(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?X(e.USE_PROFILES):e.USE_PROFILES:!1,Me=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,Pe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,O=e.SAFE_FOR_TEMPLATES||!1,k=e.SAFE_FOR_XML!==!1,Ie=e.WHOLE_DOCUMENT||!1,Ve=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,We=e.SANITIZE_DOM!==!1,Ge=e.SANITIZE_NAMED_PROPS||!1,qe=e.KEEP_CONTENT!==!1,Je=e.IN_PLACE||!1,De=rn(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:xn,rt=typeof e.NAMESPACE==`string`?e.NAMESPACE:M,st=Fn(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Y({},ot)),lt=Fn(e,`HTML_INTEGRATION_POINTS`,()=>Y({},ct));let t=Fn(e,`CUSTOM_ELEMENT_HANDLING`,()=>At(null));if(E=At(null),W(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(E.tagNameCheck=t.tagNameCheck),W(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(E.attributeNameCheck=t.attributeNameCheck),W(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(E.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),H(E),O&&(Ne=!1),He&&(Ve=!0),Ye&&(w=Y({},dn),T=At(null),Ye.html===!0&&(Y(w,an),Y(T,fn)),Ye.svg===!0&&(Y(w,on),Y(T,pn),Y(T,hn)),Ye.svgFilters===!0&&(Y(w,sn),Y(T,pn),Y(T,hn)),Ye.mathMl===!0&&(Y(w,ln),Y(T,mn),Y(T,hn))),D.tagCheck=null,D.attributeCheck=null,W(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?D.tagCheck=e.ADD_TAGS:zt(e.ADD_TAGS)&&(w===Oe&&(w=X(w)),Y(w,e.ADD_TAGS,P))),W(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?D.attributeCheck=e.ADD_ATTR:zt(e.ADD_ATTR)&&(T===ke&&(T=X(T)),Y(T,e.ADD_ATTR,P))),W(e,`ADD_FORBID_CONTENTS`)&&zt(e.ADD_FORBID_CONTENTS)&&(j===Xe&&(j=X(j)),Y(j,e.ADD_FORBID_CONTENTS,P)),qe&&(w[`#text`]=!0),Ie&&Y(w,[`html`,`head`,`body`]),w.table&&(Y(w,[`tbody`]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw K(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw K(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=y;y=e.TRUSTED_TYPES_POLICY;try{b=de(``)}catch(e){throw y=t,e}}else e.TRUSTED_TYPES_POLICY===null?(y=void 0,b=``):(y===void 0&&(y=pe()),y&&typeof b==`string`&&(b=de(``)));V&&V(e),F=e},I=Y({},[...on,...sn,...cn]),gt=Y({},[...ln,...un]),L=function(e,t,n){return t.namespaceURI===M?e===`svg`:t.namespaceURI===tt?e===`svg`&&(n===`annotation-xml`||st[n]):!!I[e]},R=function(e,t,n){return t.namespaceURI===M?e===`math`:t.namespaceURI===nt?e===`math`&<[n]:!!gt[e]},z=function(e,t,n){return t.namespaceURI===nt&&!lt[n]||t.namespaceURI===tt&&!st[n]?!1:!gt[e]&&(ut[e]||!I[e])},_t=function(e){let t=se(e),n=Ut(ae(e)),r=ee(e),i,a;return r&&v(r)===Q.element?(i={namespaceURI:se(r)},a=Ut(ae(r))):(i={namespaceURI:rt},a=`template`),at[t]?t===nt?L(n,i,a):t===tt?R(n,i,a):t===M?z(n,i,a):!!(dt===`application/xhtml+xml`&&at[t]):!1},B=function(e){It(t.removed,{element:e});try{ee(e).removeChild(e)}catch{if(p(e),!ee(e))throw K(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},vt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},yt=function(e){Ct(e);let t=g(e);t&&U(Lt(t),e=>{try{p(e)}catch{}});let n=v(e)===Q.element?ne(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&vt(e,r,i)}},bt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}It(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Ve||He)try{B(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},xt=function(e){let t=ne(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||T[P(i)]||vt(e,r,i)}},St=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&v(e)===Q.element){let t=te(e);J(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Ct=function(e){St(e,e=>{v(e)===Q.element&&xt(e)})},wt=function(e){let t=[];return St(e,e=>{t.push(e)},!0),t},Et=function(e,t){let n=Bt();U(wt(e),e=>{v(e)===Q.element&&Vt(n,e)}),U(t,e=>{v(e)===Q.element&&!Ht(n,e)&&xt(e)})},Dt=function(e,n){let r=!1;return U(t.removed,t=>{t.element&&(r=r||t.element===e,Ct(t.element))}),Et(e,n),r},Ot=function(e,t){let n=A,r=null,i=()=>(r||(r=Bt(),U(t,e=>{Vt(r,e)})),r);for(let t=0;;t++){let r=wt(e),a=[e],o=!1;if(U(r,e=>{v(e)===Q.documentFragment?It(a,e):!o&&!Ht(n,e)&&(o=Ht(i(),e))}),!o)return;if(t>=8)throw K(`the tree kept changing during in-place sanitization; refusing to return it`);U(a,(t,n)=>{kt(t,n>0,e,i())})}},kt=function(e,t,n,r){let i=Xt(e),a;for(;a=i.nextNode();)Ht(r,a)&&!Ht(A,a)&&(t&&$(S.uponSanitizeShadowNode,a,null),Hn(a,n),Yn(a,n),J(a.content)&&Xn(a.content))},jt=function(e){A&&Vt(A,e)},Mt=function(e,t){return k?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Nt=function(e){k&&St(e,e=>{let t=v(e);if(t===Q.processingInstruction||t===Q.comment&&G(Dn,e.data)){try{p(e)}catch{}return!1}if(t===Q.element){let t=e,n=P(ae(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Mt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Yt=function(e){let t=null,r=null;if(Be)e=`<remove></remove>`+e;else{let t=Gt(e,/^[\r\n\t ]+/);r=t&&t[0]}dt===`application/xhtml+xml`&&rt===M&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=y?de(e):e;if(rt===M)try{t=new l().parseFromString(i,dt)}catch{}if(!t||!t.documentElement){t=he.createDocument(rt,`template`,null);try{t.documentElement.innerHTML=it?b:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),rt===M?ve.call(t,Ie?`html`:`body`)[0]:Ie?t.documentElement:a},Xt=function(e){let t=ie?ie(e):e.ownerDocument;return ge.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Zt=function(e){return e=Kt(e,be,` `),e=Kt(e,xe,` `),e=Kt(e,C,` `),e},Qt=function(e){$t(e);let t=e.querySelectorAll?.call(e,`template`);t&&U(t,e=>{J(e.content)&&Qt(e.content)})},$t=function(e){e.normalize();let t=ie?ie(e):e.ownerDocument,n=ge.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Zt(r.data),r=n.nextNode()},q=function(e){let t=re?re(e):null;return typeof t!=`string`||P(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ne(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==_(e)||e.childNodes!==g(e)},J=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return _(e)===Q.documentFragment}catch{return!1}},en=function(e){if(!_||typeof e!=`object`||!e)return!1;try{return typeof _(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&U(e,e=>{e.call(t,n,r,F)})}let Ln=function(e,t){return!!(k&&e.hasChildNodes()&&!en(e.firstElementChild)&&G(En,e.textContent)&&G(En,e.innerHTML)||k&&An[t]&&v(e)===Q.element&&se(e)===M&&(en(e.firstElementChild)||typeof e.textContent==`string`&&G(En,e.textContent))||e.nodeType===Q.processingInstruction||k&&e.nodeType===Q.comment&&G(Dn,e.data))},Rn=function(e,t){return e instanceof RegExp?G(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},zn=function(e,t,n){if(!Ae[t]&&Gn(t)&&Rn(E.tagNameCheck,t))return!1;if(qe&&!j[t]&&!j[Ut(t)]){let t=ee(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return B(e),!0},Bn=function(e,t,n,r){return e.length===0?t:t===n||t===r?X(t):t},Vn=function(e,t){return e===t||ee(e)!==null?!1:(Je&&Ct(e),!0)},Hn=function(e,n){if(jt(e),$(S.beforeSanitizeElements,e,null),Vn(e,n))return!0;if(q(e))return B(e),!0;let r=P(ae(e));if(w=Bn(S.uponSanitizeElement,w,Oe,Re),$(S.uponSanitizeElement,e,{tagName:r,allowedTags:w}),Vn(e,n))return!0;if(Ln(e,r))return B(e),!0;if(Ae[r]||!(D.tagCheck instanceof Function&&D.tagCheck(r))&&!w[r]){let t=zn(e,r,n);return t===!1&&($(S.afterSanitizeElements,e,null),Vn(e,n))?!0:t}if(v(e)===Q.element&&!_t(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&G(On,e.innerHTML))return B(e),!0;if(O&&e.nodeType===Q.text){let n=Zt(e.textContent);e.textContent!==n&&(It(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(S.afterSanitizeElements,e,null),Vn(e,n)},Un=function(e,t,r){if(je[t]||Mt(t,e)||We&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=T[t]||D.attributeCheck instanceof Function&&D.attributeCheck(t,e);return Ne&&G(Se,t)||Me&&G(Ce,t)?!0:i?$e[t]||G(De,Kt(r,Te,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&qt(r,`data:`)===0&&Ze[e]||Pe&&!G(we,Kt(r,Te,``))?!0:!r:Gn(e)&&Rn(E.tagNameCheck,e)&&Rn(E.attributeNameCheck,t,e)||t===`is`&&E.allowCustomizedBuiltInElements&&Rn(E.tagNameCheck,r)},Wn=Y({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Gn=function(e){return!Wn[Ut(e)]&&G(Ee,e)},Kn=function(e,t,n,r){if(y&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return de(r);case`TrustedScriptURL`:return fe(r)}return r},qn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!q(e)||(B(e),!1)}catch{return bt(t,e),!1}},Jn=function(e,t){return k&&G(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Ut(e)===`attributename`&&Gt(t,`href`)!==null},Yn=function(e,n){if($(S.beforeSanitizeAttributes,e,null),Vn(e,n))return;let r=e.attributes;if(!r||q(e))return;T=Bn(S.uponSanitizeAttribute,T,ke,ze);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0},a=r.length,o=P(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=P(s),d=l,f=s===`value`?d:Jt(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(S.uponSanitizeAttribute,e,i),f=i.attrValue,Ge&&(u===`id`||u===`name`)&&qt(f,Ke)!==0&&(bt(s,e,n),f=Ke+f,p=!0),Jn(s,f)){bt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){bt(s,e,n);continue}if(!Fe&&G(kn,f)){bt(s,e,n);continue}if(O&&(f=Zt(f)),!Un(o,u,f)){bt(s,e,n);continue}f=Kn(o,u,c,f),f!==d&&qn(e,s,c,f)&&p&&Ft(t.removed)}}$(S.afterSanitizeAttributes,e,null),Vn(e,n)},Xn=function(e){let t=null,n=Xt(e);for($(S.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(S.uponSanitizeShadowNode,t,null),Hn(t,e),Yn(t,e),J(t.content)&&Xn(t.content),v(t)===Q.element){let e=te(t);J(e)&&(Zn(e),Xn(e))}O&&$t(e),$(S.afterSanitizeShadowDOM,e,null)},Zn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xn(e.shadow);continue}let n=e.node,r=v(n)===Q.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=re?re(n):null;if(typeof e==`string`&&P(e)===`template`){let e=n.content;J(e)&&t.push({node:e,shadow:null})}}if(r){let e=te(n);J(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(it=!e,it&&(e=`<!-->`),typeof e!=`string`&&!en(e)&&(e=tn(e),typeof e!=`string`))throw K(`dirty is not a string, aborting`);if(!t.isSupported)return e;Le?(w=Re,T=ze):ht(n),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(w=X(w)),S.uponSanitizeAttribute.length>0&&(T=X(T)),t.removed=[];let c=Je&&typeof e!=`string`&&en(e),l=[],u=A;if(c){Nt(e);let t=ae(e);if(typeof t==`string`){let n=P(t);if(!w[n]||Ae[n])throw yt(e),K(`root node is forbidden and cannot be sanitized in-place`)}if(q(e))throw yt(e),K(`root node is clobbered and cannot be sanitized in-place`);l=wt(e),A=Bt()}else if(en(e))i=Yt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Q.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zn(i);else{if(!Ve&&!O&&!Ie&&e.indexOf(`<`)===-1)return y&&Ue?de(e):e;if(i=Yt(e),!i)return Ve?null:Ue?b:``}i&&Be&&B(i.firstChild);let d=c?e:i;try{c&&Zn(e);let t=Xt(d);for(;o=t.nextNode();)Hn(o,d),Yn(o,d),J(o.content)&&Xn(o.content);c&&Ot(e,l)}catch(t){throw c&&(yt(e),Dt(e,l)),t}finally{A=u}if(c){if(Dt(e,l))throw K(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return O&&Qt(e),e}if(Ve){if(O&&Qt(i),He)for(s=_e.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(T.shadowroot||T.shadowrootmode)&&(s=ye.call(r,s,!0)),s}let f=Ie?i.outerHTML:i.innerHTML;return Ie&&w[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&G(wn,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
67
|
+
`+f),O&&(f=Zt(f)),y&&Ue?de(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Le=!0,Re=w,ze=T},t.clearConfig=function(){F=null,Le=!1,Re=null,ze=null,y=ce,b=``},t.isValidAttribute=function(e,t,n){F||ht({});let r=P(e),i=P(t);return typeof n==`string`&&(Jn(t,n)||!Fe&&G(kn,n))?!1:Un(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&W(S,e)&&It(S[e],t)},t.removeHook=function(e,t){if(W(S,e)){if(t!==void 0){let n=Pt(S[e],t);return n===-1?void 0:Rt(S[e],n,1)[0]}return Ft(S[e])}},t.removeHooks=function(e){W(S,e)&&(S[e]=[])},t.removeAllHooks=function(){S=Nn()},t}var $=In();export{$ as DOMPurify,z as marked};
|