@likec4/mcp 1.58.0 → 1.59.1

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.
Files changed (41) hide show
  1. package/dist/chunks/libs/@chevrotain/cst-dts-gen.mjs +1 -0
  2. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +1 -1
  3. package/dist/chunks/libs/@hono/mcp.mjs +6 -6
  4. package/dist/chunks/libs/@hono/node-server.mjs +3 -1
  5. package/dist/chunks/libs/@logtape/logtape.mjs +4 -4
  6. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +4 -11
  7. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
  8. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  9. package/dist/chunks/libs/chevrotain.mjs +33 -33
  10. package/dist/chunks/libs/chokidar.mjs +2 -2
  11. package/dist/chunks/libs/chroma-js.mjs +2 -2
  12. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  13. package/dist/chunks/libs/graphology-dag.mjs +1 -1
  14. package/dist/chunks/libs/graphology.mjs +1 -1
  15. package/dist/chunks/libs/hast-util-sanitize.mjs +1 -1
  16. package/dist/chunks/libs/hast-util-to-html.mjs +2 -2
  17. package/dist/chunks/libs/hono.mjs +1 -1
  18. package/dist/chunks/libs/immer.mjs +1 -1
  19. package/dist/chunks/libs/langium.mjs +9 -22
  20. package/dist/chunks/libs/markdown-table.mjs +1 -1
  21. package/dist/chunks/libs/mdast-util-from-markdown.mjs +2 -2
  22. package/dist/chunks/libs/mdast-util-gfm.mjs +1 -1
  23. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  24. package/dist/chunks/libs/micromark-extension-gfm.mjs +1 -1
  25. package/dist/chunks/libs/mnemonist.mjs +1 -1
  26. package/dist/chunks/libs/nano-spawn.mjs +1 -1
  27. package/dist/chunks/libs/p-queue.mjs +1 -1
  28. package/dist/chunks/libs/picomatch.mjs +1 -0
  29. package/dist/chunks/libs/remark-github-blockquote-alert.mjs +1 -1
  30. package/dist/chunks/libs/remeda.mjs +1 -1
  31. package/dist/chunks/libs/ufo.mjs +1 -1
  32. package/dist/chunks/libs/unified.mjs +1 -1
  33. package/dist/chunks/rolldown-runtime.mjs +1 -1
  34. package/dist/chunks/src.mjs +102 -101
  35. package/dist/cli.mjs +3 -3
  36. package/package.json +18 -18
  37. package/dist/chunks/libs/@chevrotain/gast.mjs +0 -1
  38. package/dist/chunks/libs/@lume/kiwi.mjs +0 -1
  39. package/dist/chunks/libs/fdir.mjs +0 -1
  40. package/dist/chunks/libs/json5.mjs +0 -14
  41. package/dist/chunks/libs/which.mjs +0 -1
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime.mjs";function defaultStringLength(e){return e.length}function markdownTable(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||defaultStringLength,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=serialize(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=toAlignment(r[d]);else{let e=toAlignment(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
1
+ import"../rolldown-runtime.mjs";function defaultStringLength(e){return e.length}function markdownTable(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||defaultStringLength,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=serialize(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=toAlignment(r[d]);else{let e=toAlignment(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
2
2
  `)}function serialize(e){return e==null?``:String(e)}function toAlignment(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}export{markdownTable as t};
@@ -1,3 +1,3 @@
1
- import{i as e,r as t}from"../rolldown-runtime.mjs";import{t as n}from"./character-entities.mjs";const r=regexCheck(/[A-Za-z]/),i=regexCheck(/[\dA-Za-z]/),a=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(e){return e!==null&&(e<32||e===127)}const o=regexCheck(/\d/),s=regexCheck(/[\dA-Fa-f]/),c=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(e){return e!==null&&e<-2}function markdownLineEndingOrSpace(e){return e!==null&&(e<0||e===32)}function markdownSpace(e){return e===-2||e===-1||e===32}const l=regexCheck(/\p{P}|\p{S}/u),u=regexCheck(/\s/);function regexCheck(e){return check;function check(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function normalizeIdentifier(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}function classifyCharacter(e){if(e===null||markdownLineEndingOrSpace(e)||u(e))return 1;if(l(e))return 2}const d={};function toString(e,t){let n=t||d;return one(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function one(e,t,n){if(node(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return all(e.children,t,n)}return Array.isArray(e)?all(e,t,n):``}function all(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=one(e[i],t,n);return r.join(``)}function node(e){return!!(e&&typeof e==`object`)}const f={}.hasOwnProperty;function decodeNamedCharacterReference(e){return f.call(n,e)?n[e]:!1}function decodeNumericCharacterReference(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}const p=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function decodeString(e){return e.replace(p,decode)}function decode(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return decodeNumericCharacterReference(n.slice(t?2:1),t?16:10)}return decodeNamedCharacterReference(n)||e}function splice(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function push(e,t){return e.length>0?(splice(e,e.length,0,t),e):t}const m={}.hasOwnProperty;function combineExtensions(e){let t={},n=-1;for(;++n<e.length;)syntaxExtension(t,e[n]);return t}function syntaxExtension(e,t){let n;for(n in t){let r=(m.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){m.call(r,a)||(r[a]=[]);let e=i[a];constructs(r[a],Array.isArray(e)?e:e?[e]:[])}}}function constructs(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);splice(e,0,0,r)}function resolveAll(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const h={name:`attention`,resolveAll:resolveAllAttention,tokenize:tokenizeAttention};function resolveAllAttention(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};movePoint(d,-c),movePoint(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=push(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=push(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=push(l,resolveAll(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=push(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=push(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,splice(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function tokenizeAttention(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=classifyCharacter(r),a;return start;function start(t){return a=t,e.enter(`attentionSequence`),inside(t)}function inside(o){if(o===a)return e.consume(o),inside;let s=e.exit(`attentionSequence`),c=classifyCharacter(o),l=!c||c===2&&i||n.includes(o),u=!i||i===2&&c||n.includes(r);return s._open=!!(a===42?l:l&&(i||!u)),s._close=!!(a===42?u:u&&(c||!l)),t(o)}}function movePoint(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g={name:`autolink`,tokenize:tokenizeAutolink};function tokenizeAutolink(e,t,n){let o=0;return start;function start(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),open}function open(t){return r(t)?(e.consume(t),schemeOrEmailAtext):t===64?n(t):emailAtext(t)}function schemeOrEmailAtext(e){return e===43||e===45||e===46||i(e)?(o=1,schemeInsideOrEmailAtext(e)):emailAtext(e)}function schemeInsideOrEmailAtext(t){return t===58?(e.consume(t),o=0,urlInside):(t===43||t===45||t===46||i(t))&&o++<32?(e.consume(t),schemeInsideOrEmailAtext):(o=0,emailAtext(t))}function urlInside(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||asciiControl(r)?n(r):(e.consume(r),urlInside)}function emailAtext(t){return t===64?(e.consume(t),emailAtSignOrDot):a(t)?(e.consume(t),emailAtext):n(t)}function emailAtSignOrDot(e){return i(e)?emailLabel(e):n(e)}function emailLabel(n){return n===46?(e.consume(n),o=0,emailAtSignOrDot):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):emailValue(n)}function emailValue(t){if((t===45||i(t))&&o++<63){let n=t===45?emailValue:emailLabel;return e.consume(t),n}return n(t)}}function factorySpace(e,t,n,r){let i=r?r-1:1/0,a=0;return start;function start(r){return markdownSpace(r)?(e.enter(n),prefix(r)):t(r)}function prefix(r){return markdownSpace(r)&&a++<i?(e.consume(r),prefix):(e.exit(n),t(r))}}const _={partial:!0,tokenize:tokenizeBlankLine};function tokenizeBlankLine(e,t,n){return start;function start(t){return markdownSpace(t)?factorySpace(e,after,`linePrefix`)(t):after(t)}function after(e){return e===null||markdownLineEnding(e)?t(e):n(e)}}const v={continuation:{tokenize:tokenizeBlockQuoteContinuation},exit,name:`blockQuote`,tokenize:tokenizeBlockQuoteStart};function tokenizeBlockQuoteStart(e,t,n){let r=this;return start;function start(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),after}return n(t)}function after(n){return markdownSpace(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function tokenizeBlockQuoteContinuation(e,t,n){let r=this;return contStart;function contStart(t){return markdownSpace(t)?factorySpace(e,contBefore,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):contBefore(t)}function contBefore(r){return e.attempt(v,t,n)(r)}}function exit(e){e.exit(`blockQuote`)}const y={name:`characterEscape`,tokenize:tokenizeCharacterEscape};function tokenizeCharacterEscape(e,t,n){return start;function start(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),inside}function inside(r){return c(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const b={name:`characterReference`,tokenize:tokenizeCharacterReference};function tokenizeCharacterReference(e,t,n){let r=this,a=0,c,l;return start;function start(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),open}function open(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),numeric):(e.enter(`characterReferenceValue`),c=31,l=i,value(t))}function numeric(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),c=6,l=s,value):(e.enter(`characterReferenceValue`),c=7,l=o,value(t))}function value(o){if(o===59&&a){let a=e.exit(`characterReferenceValue`);return l===i&&!decodeNamedCharacterReference(r.sliceSerialize(a))?n(o):(e.enter(`characterReferenceMarker`),e.consume(o),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return l(o)&&a++<c?(e.consume(o),value):n(o)}}const x={partial:!0,tokenize:tokenizeNonLazyContinuation},S={concrete:!0,name:`codeFenced`,tokenize:tokenizeCodeFenced};function tokenizeCodeFenced(e,t,n){let r=this,i={partial:!0,tokenize:tokenizeCloseStart},a=0,o=0,s;return start;function start(e){return beforeSequenceOpen(e)}function beforeSequenceOpen(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===s?(o++,e.consume(t),sequenceOpen):o<3?n(t):(e.exit(`codeFencedFenceSequence`),markdownSpace(t)?factorySpace(e,infoBefore,`whitespace`)(t):infoBefore(t))}function infoBefore(n){return n===null||markdownLineEnding(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(x,atNonLazyBreak,after)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),info(n))}function info(t){return t===null||markdownLineEnding(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),infoBefore(t)):markdownSpace(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),factorySpace(e,metaBefore,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),info)}function metaBefore(t){return t===null||markdownLineEnding(t)?infoBefore(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),meta(t))}function meta(t){return t===null||markdownLineEnding(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),infoBefore(t)):t===96&&t===s?n(t):(e.consume(t),meta)}function atNonLazyBreak(t){return e.attempt(i,after,contentBefore)(t)}function contentBefore(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),contentStart}function contentStart(t){return a>0&&markdownSpace(t)?factorySpace(e,beforeContentChunk,`linePrefix`,a+1)(t):beforeContentChunk(t)}function beforeContentChunk(t){return t===null||markdownLineEnding(t)?e.check(x,atNonLazyBreak,after)(t):(e.enter(`codeFlowValue`),contentChunk(t))}function contentChunk(t){return t===null||markdownLineEnding(t)?(e.exit(`codeFlowValue`),beforeContentChunk(t)):(e.consume(t),contentChunk)}function after(n){return e.exit(`codeFenced`),t(n)}function tokenizeCloseStart(e,t,n){let i=0;return startBefore;function startBefore(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),start}function start(t){return e.enter(`codeFencedFence`),markdownSpace(t)?factorySpace(e,beforeSequenceClose,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):beforeSequenceClose(t)}function beforeSequenceClose(t){return t===s?(e.enter(`codeFencedFenceSequence`),sequenceClose(t)):n(t)}function sequenceClose(t){return t===s?(i++,e.consume(t),sequenceClose):i>=o?(e.exit(`codeFencedFenceSequence`),markdownSpace(t)?factorySpace(e,sequenceCloseAfter,`whitespace`)(t):sequenceCloseAfter(t)):n(t)}function sequenceCloseAfter(r){return r===null||markdownLineEnding(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function tokenizeNonLazyContinuation(e,t,n){let r=this;return start;function start(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),lineStart)}function lineStart(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const C={name:`codeIndented`,tokenize:tokenizeCodeIndented},ee={partial:!0,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(e,t,n){let r=this;return start;function start(t){return e.enter(`codeIndented`),factorySpace(e,afterPrefix,`linePrefix`,5)(t)}function afterPrefix(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?atBreak(e):n(e)}function atBreak(t){return t===null?after(t):markdownLineEnding(t)?e.attempt(ee,atBreak,after)(t):(e.enter(`codeFlowValue`),inside(t))}function inside(t){return t===null||markdownLineEnding(t)?(e.exit(`codeFlowValue`),atBreak(t)):(e.consume(t),inside)}function after(n){return e.exit(`codeIndented`),t(n)}}function tokenizeFurtherStart(e,t,n){let r=this;return furtherStart;function furtherStart(t){return r.parser.lazy[r.now().line]?n(t):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),furtherStart):factorySpace(e,afterPrefix,`linePrefix`,5)(t)}function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`linePrefix`&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):markdownLineEnding(e)?furtherStart(e):n(e)}}const w={name:`codeText`,previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function previous(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function tokenizeCodeText(e,t,n){let r=0,i,a;return start;function start(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===96?(e.consume(t),r++,sequenceOpen):(e.exit(`codeTextSequence`),between(t))}function between(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),between):t===96?(a=e.enter(`codeTextSequence`),i=0,sequenceClose(t)):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),between):(e.enter(`codeTextData`),data(t))}function data(t){return t===null||t===32||t===96||markdownLineEnding(t)?(e.exit(`codeTextData`),between(t)):(e.consume(t),data)}function sequenceClose(n){return n===96?(e.consume(n),i++,sequenceClose):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,data(n))}}var SpliceBuffer=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&chunkedPush(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),chunkedPush(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),chunkedPush(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);chunkedPush(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);chunkedPush(this.left,t.reverse())}}};function chunkedPush(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function subtokenize(e){let t={},n=-1,r,i,a,o,s,c,l,u=new SpliceBuffer(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,subcontent(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return splice(e,0,1/0,u.slice(0)),!l}function subcontent(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const T={resolve:resolveContent,tokenize:tokenizeContent},E={partial:!0,tokenize:tokenizeContinuation};function resolveContent(e){return subtokenize(e),e}function tokenizeContent(e,t){let n;return chunkStart;function chunkStart(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),chunkInside(t)}function chunkInside(t){return t===null?contentEnd(t):markdownLineEnding(t)?e.check(E,contentContinue,contentEnd)(t):(e.consume(t),chunkInside)}function contentEnd(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function contentContinue(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,chunkInside}}function tokenizeContinuation(e,t,n){let r=this;return startLookahead;function startLookahead(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),factorySpace(e,prefixed,`linePrefix`)}function prefixed(i){if(i===null||markdownLineEnding(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function factoryDestination(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return start;function start(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),enclosedBefore):t===null||t===32||t===41||asciiControl(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),raw(t))}function enclosedBefore(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),enclosed(n))}function enclosed(t){return t===62?(e.exit(`chunkString`),e.exit(s),enclosedBefore(t)):t===null||t===60||markdownLineEnding(t)?n(t):(e.consume(t),t===92?enclosedEscape:enclosed)}function enclosedEscape(t){return t===60||t===62||t===92?(e.consume(t),enclosed):enclosed(t)}function raw(i){return!u&&(i===null||i===41||markdownLineEndingOrSpace(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,raw):i===41?(e.consume(i),u--,raw):i===null||i===32||i===40||asciiControl(i)?n(i):(e.consume(i),i===92?rawEscape:raw)}function rawEscape(t){return t===40||t===41||t===92?(e.consume(t),raw):raw(t)}}function factoryLabel(e,t,n,r,i,a){let o=this,s=0,c;return start;function start(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),atBreak}function atBreak(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):markdownLineEnding(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),atBreak):(e.enter(`chunkString`,{contentType:`string`}),labelInside(l))}function labelInside(t){return t===null||t===91||t===93||markdownLineEnding(t)||s++>999?(e.exit(`chunkString`),atBreak(t)):(e.consume(t),c||=!markdownSpace(t),t===92?labelEscape:labelInside)}function labelEscape(t){return t===91||t===92||t===93?(e.consume(t),s++,labelInside):labelInside(t)}}function factoryTitle(e,t,n,r,i,a){let o;return start;function start(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,begin):n(t)}function begin(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),atBreak(n))}function atBreak(t){return t===o?(e.exit(a),begin(o)):t===null?n(t):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),factorySpace(e,atBreak,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),inside(t))}function inside(t){return t===o||t===null||markdownLineEnding(t)?(e.exit(`chunkString`),atBreak(t)):(e.consume(t),t===92?escape:inside)}function escape(t){return t===o||t===92?(e.consume(t),inside):inside(t)}}function factoryWhitespace(e,t){let n;return start;function start(r){return markdownLineEnding(r)?(e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),n=!0,start):markdownSpace(r)?factorySpace(e,start,n?`linePrefix`:`lineSuffix`)(r):t(r)}}const D={name:`definition`,tokenize:tokenizeDefinition},O={partial:!0,tokenize:tokenizeTitleBefore};function tokenizeDefinition(e,t,n){let r=this,i;return start;function start(t){return e.enter(`definition`),before(t)}function before(t){return factoryLabel.call(r,e,labelAfter,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function labelAfter(t){return i=normalizeIdentifier(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),markerAfter):n(t)}function markerAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,destinationBefore)(t):destinationBefore(t)}function destinationBefore(t){return factoryDestination(e,destinationAfter,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function destinationAfter(t){return e.attempt(O,after,after)(t)}function after(t){return markdownSpace(t)?factorySpace(e,afterWhitespace,`whitespace`)(t):afterWhitespace(t)}function afterWhitespace(a){return a===null||markdownLineEnding(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function tokenizeTitleBefore(e,t,n){return titleBefore;function titleBefore(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,beforeMarker)(t):n(t)}function beforeMarker(t){return factoryTitle(e,titleAfter,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function titleAfter(t){return markdownSpace(t)?factorySpace(e,titleAfterOptionalWhitespace,`whitespace`)(t):titleAfterOptionalWhitespace(t)}function titleAfterOptionalWhitespace(e){return e===null||markdownLineEnding(e)?t(e):n(e)}}const k={name:`hardBreakEscape`,tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(e,t,n){return start;function start(t){return e.enter(`hardBreakEscape`),e.consume(t),after}function after(r){return markdownLineEnding(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const te={name:`headingAtx`,resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},splice(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function tokenizeHeadingAtx(e,t,n){let r=0;return start;function start(t){return e.enter(`atxHeading`),before(t)}function before(t){return e.enter(`atxHeadingSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===35&&r++<6?(e.consume(t),sequenceOpen):t===null||markdownLineEndingOrSpace(t)?(e.exit(`atxHeadingSequence`),atBreak(t)):n(t)}function atBreak(n){return n===35?(e.enter(`atxHeadingSequence`),sequenceFurther(n)):n===null||markdownLineEnding(n)?(e.exit(`atxHeading`),t(n)):markdownSpace(n)?factorySpace(e,atBreak,`whitespace`)(n):(e.enter(`atxHeadingText`),data(n))}function sequenceFurther(t){return t===35?(e.consume(t),sequenceFurther):(e.exit(`atxHeadingSequence`),atBreak(t))}function data(t){return t===null||t===35||markdownLineEndingOrSpace(t)?(e.exit(`atxHeadingText`),atBreak(t)):(e.consume(t),data)}}const ne=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),A=[`pre`,`script`,`style`,`textarea`],j={concrete:!0,name:`htmlFlow`,resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow},M={partial:!0,tokenize:tokenizeBlankLineBefore},N={partial:!0,tokenize:tokenizeNonLazyContinuationStart};function resolveToHtmlFlow(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function tokenizeHtmlFlow(e,t,n){let a=this,o,s,c,l,u;return start;function start(e){return before(e)}function before(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),open}function open(i){return i===33?(e.consume(i),declarationOpen):i===47?(e.consume(i),s=!0,tagCloseStart):i===63?(e.consume(i),o=3,a.interrupt?t:continuationDeclarationInside):r(i)?(e.consume(i),c=String.fromCharCode(i),tagName):n(i)}function declarationOpen(i){return i===45?(e.consume(i),o=2,commentOpenInside):i===91?(e.consume(i),o=5,l=0,cdataOpenInside):r(i)?(e.consume(i),o=4,a.interrupt?t:continuationDeclarationInside):n(i)}function commentOpenInside(r){return r===45?(e.consume(r),a.interrupt?t:continuationDeclarationInside):n(r)}function cdataOpenInside(r){return r===`CDATA[`.charCodeAt(l++)?(e.consume(r),l===6?a.interrupt?t:continuation:cdataOpenInside):n(r)}function tagCloseStart(t){return r(t)?(e.consume(t),c=String.fromCharCode(t),tagName):n(t)}function tagName(r){if(r===null||r===47||r===62||markdownLineEndingOrSpace(r)){let i=r===47,l=c.toLowerCase();return!i&&!s&&A.includes(l)?(o=1,a.interrupt?t(r):continuation(r)):ne.includes(c.toLowerCase())?(o=6,i?(e.consume(r),basicSelfClosing):a.interrupt?t(r):continuation(r)):(o=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(r):s?completeClosingTagAfter(r):completeAttributeNameBefore(r))}return r===45||i(r)?(e.consume(r),c+=String.fromCharCode(r),tagName):n(r)}function basicSelfClosing(r){return r===62?(e.consume(r),a.interrupt?t:continuation):n(r)}function completeClosingTagAfter(t){return markdownSpace(t)?(e.consume(t),completeClosingTagAfter):completeEnd(t)}function completeAttributeNameBefore(t){return t===47?(e.consume(t),completeEnd):t===58||t===95||r(t)?(e.consume(t),completeAttributeName):markdownSpace(t)?(e.consume(t),completeAttributeNameBefore):completeEnd(t)}function completeAttributeName(t){return t===45||t===46||t===58||t===95||i(t)?(e.consume(t),completeAttributeName):completeAttributeNameAfter(t)}function completeAttributeNameAfter(t){return t===61?(e.consume(t),completeAttributeValueBefore):markdownSpace(t)?(e.consume(t),completeAttributeNameAfter):completeAttributeNameBefore(t)}function completeAttributeValueBefore(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),u=t,completeAttributeValueQuoted):markdownSpace(t)?(e.consume(t),completeAttributeValueBefore):completeAttributeValueUnquoted(t)}function completeAttributeValueQuoted(t){return t===u?(e.consume(t),u=null,completeAttributeValueQuotedAfter):t===null||markdownLineEnding(t)?n(t):(e.consume(t),completeAttributeValueQuoted)}function completeAttributeValueUnquoted(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||markdownLineEndingOrSpace(t)?completeAttributeNameAfter(t):(e.consume(t),completeAttributeValueUnquoted)}function completeAttributeValueQuotedAfter(e){return e===47||e===62||markdownSpace(e)?completeAttributeNameBefore(e):n(e)}function completeEnd(t){return t===62?(e.consume(t),completeAfter):n(t)}function completeAfter(t){return t===null||markdownLineEnding(t)?continuation(t):markdownSpace(t)?(e.consume(t),completeAfter):n(t)}function continuation(t){return t===45&&o===2?(e.consume(t),continuationCommentInside):t===60&&o===1?(e.consume(t),continuationRawTagOpen):t===62&&o===4?(e.consume(t),continuationClose):t===63&&o===3?(e.consume(t),continuationDeclarationInside):t===93&&o===5?(e.consume(t),continuationCdataInside):markdownLineEnding(t)&&(o===6||o===7)?(e.exit(`htmlFlowData`),e.check(M,continuationAfter,continuationStart)(t)):t===null||markdownLineEnding(t)?(e.exit(`htmlFlowData`),continuationStart(t)):(e.consume(t),continuation)}function continuationStart(t){return e.check(N,continuationStartNonLazy,continuationAfter)(t)}function continuationStartNonLazy(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),continuationBefore}function continuationBefore(t){return t===null||markdownLineEnding(t)?continuationStart(t):(e.enter(`htmlFlowData`),continuation(t))}function continuationCommentInside(t){return t===45?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationRawTagOpen(t){return t===47?(e.consume(t),c=``,continuationRawEndTag):continuation(t)}function continuationRawEndTag(t){if(t===62){let n=c.toLowerCase();return A.includes(n)?(e.consume(t),continuationClose):continuation(t)}return r(t)&&c.length<8?(e.consume(t),c+=String.fromCharCode(t),continuationRawEndTag):continuation(t)}function continuationCdataInside(t){return t===93?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationDeclarationInside(t){return t===62?(e.consume(t),continuationClose):t===45&&o===2?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationClose(t){return t===null||markdownLineEnding(t)?(e.exit(`htmlFlowData`),continuationAfter(t)):(e.consume(t),continuationClose)}function continuationAfter(n){return e.exit(`htmlFlow`),t(n)}}function tokenizeNonLazyContinuationStart(e,t,n){let r=this;return start;function start(t){return markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),after):n(t)}function after(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function tokenizeBlankLineBefore(e,t,n){return start;function start(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(_,t,n)}}const P={name:`htmlText`,tokenize:tokenizeHtmlText};function tokenizeHtmlText(e,t,n){let a=this,o,s,c;return start;function start(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),open}function open(t){return t===33?(e.consume(t),declarationOpen):t===47?(e.consume(t),tagCloseStart):t===63?(e.consume(t),instruction):r(t)?(e.consume(t),tagOpen):n(t)}function declarationOpen(t){return t===45?(e.consume(t),commentOpenInside):t===91?(e.consume(t),s=0,cdataOpenInside):r(t)?(e.consume(t),declaration):n(t)}function commentOpenInside(t){return t===45?(e.consume(t),commentEnd):n(t)}function comment(t){return t===null?n(t):t===45?(e.consume(t),commentClose):markdownLineEnding(t)?(c=comment,lineEndingBefore(t)):(e.consume(t),comment)}function commentClose(t){return t===45?(e.consume(t),commentEnd):comment(t)}function commentEnd(e){return e===62?end(e):e===45?commentClose(e):comment(e)}function cdataOpenInside(t){return t===`CDATA[`.charCodeAt(s++)?(e.consume(t),s===6?cdata:cdataOpenInside):n(t)}function cdata(t){return t===null?n(t):t===93?(e.consume(t),cdataClose):markdownLineEnding(t)?(c=cdata,lineEndingBefore(t)):(e.consume(t),cdata)}function cdataClose(t){return t===93?(e.consume(t),cdataEnd):cdata(t)}function cdataEnd(t){return t===62?end(t):t===93?(e.consume(t),cdataEnd):cdata(t)}function declaration(t){return t===null||t===62?end(t):markdownLineEnding(t)?(c=declaration,lineEndingBefore(t)):(e.consume(t),declaration)}function instruction(t){return t===null?n(t):t===63?(e.consume(t),instructionClose):markdownLineEnding(t)?(c=instruction,lineEndingBefore(t)):(e.consume(t),instruction)}function instructionClose(e){return e===62?end(e):instruction(e)}function tagCloseStart(t){return r(t)?(e.consume(t),tagClose):n(t)}function tagClose(t){return t===45||i(t)?(e.consume(t),tagClose):tagCloseBetween(t)}function tagCloseBetween(t){return markdownLineEnding(t)?(c=tagCloseBetween,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagCloseBetween):end(t)}function tagOpen(t){return t===45||i(t)?(e.consume(t),tagOpen):t===47||t===62||markdownLineEndingOrSpace(t)?tagOpenBetween(t):n(t)}function tagOpenBetween(t){return t===47?(e.consume(t),end):t===58||t===95||r(t)?(e.consume(t),tagOpenAttributeName):markdownLineEnding(t)?(c=tagOpenBetween,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenBetween):end(t)}function tagOpenAttributeName(t){return t===45||t===46||t===58||t===95||i(t)?(e.consume(t),tagOpenAttributeName):tagOpenAttributeNameAfter(t)}function tagOpenAttributeNameAfter(t){return t===61?(e.consume(t),tagOpenAttributeValueBefore):markdownLineEnding(t)?(c=tagOpenAttributeNameAfter,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenAttributeNameAfter):tagOpenBetween(t)}function tagOpenAttributeValueBefore(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),o=t,tagOpenAttributeValueQuoted):markdownLineEnding(t)?(c=tagOpenAttributeValueBefore,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenAttributeValueBefore):(e.consume(t),tagOpenAttributeValueUnquoted)}function tagOpenAttributeValueQuoted(t){return t===o?(e.consume(t),o=void 0,tagOpenAttributeValueQuotedAfter):t===null?n(t):markdownLineEnding(t)?(c=tagOpenAttributeValueQuoted,lineEndingBefore(t)):(e.consume(t),tagOpenAttributeValueQuoted)}function tagOpenAttributeValueUnquoted(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||markdownLineEndingOrSpace(t)?tagOpenBetween(t):(e.consume(t),tagOpenAttributeValueUnquoted)}function tagOpenAttributeValueQuotedAfter(e){return e===47||e===62||markdownLineEndingOrSpace(e)?tagOpenBetween(e):n(e)}function end(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function lineEndingBefore(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),lineEndingAfter}function lineEndingAfter(t){return markdownSpace(t)?factorySpace(e,lineEndingAfterPrefix,`linePrefix`,a.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):lineEndingAfterPrefix(t)}function lineEndingAfterPrefix(t){return e.enter(`htmlTextData`),c(t)}}const F={name:`labelEnd`,resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd},I={tokenize:tokenizeResource},L={tokenize:tokenizeReferenceFull},R={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&splice(e,0,e.length,n),e}function resolveToLabelEnd(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=push(s,e.slice(a+1,a+r+3)),s=push(s,[[`enter`,u,t]]),s=push(s,resolveAll(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=push(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=push(s,e.slice(o+1)),s=push(s,[[`exit`,c,t]]),splice(e,a,e.length,s),e}function tokenizeLabelEnd(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return start;function start(t){return a?a._inactive?labelEndNok(t):(o=r.parser.defined.includes(normalizeIdentifier(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),after):n(t)}function after(t){return t===40?e.attempt(I,labelEndOk,o?labelEndOk:labelEndNok)(t):t===91?e.attempt(L,labelEndOk,o?referenceNotFull:labelEndNok)(t):o?labelEndOk(t):labelEndNok(t)}function referenceNotFull(t){return e.attempt(R,labelEndOk,labelEndNok)(t)}function labelEndOk(e){return t(e)}function labelEndNok(e){return a._balanced=!0,n(e)}}function tokenizeResource(e,t,n){return resourceStart;function resourceStart(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),resourceBefore}function resourceBefore(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceOpen)(t):resourceOpen(t)}function resourceOpen(t){return t===41?resourceEnd(t):factoryDestination(e,resourceDestinationAfter,resourceDestinationMissing,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function resourceDestinationAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceBetween)(t):resourceEnd(t)}function resourceDestinationMissing(e){return n(e)}function resourceBetween(t){return t===34||t===39||t===40?factoryTitle(e,resourceTitleAfter,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):resourceEnd(t)}function resourceTitleAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceEnd)(t):resourceEnd(t)}function resourceEnd(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function tokenizeReferenceFull(e,t,n){let r=this;return referenceFull;function referenceFull(t){return factoryLabel.call(r,e,referenceFullAfter,referenceFullMissing,`reference`,`referenceMarker`,`referenceString`)(t)}function referenceFullAfter(e){return r.parser.defined.includes(normalizeIdentifier(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function referenceFullMissing(e){return n(e)}}function tokenizeReferenceCollapsed(e,t,n){return referenceCollapsedStart;function referenceCollapsedStart(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),referenceCollapsedOpen}function referenceCollapsedOpen(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const z={name:`labelStartImage`,resolveAll:F.resolveAll,tokenize:tokenizeLabelStartImage};function tokenizeLabelStartImage(e,t,n){let r=this;return start;function start(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),open}function open(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),after):n(t)}function after(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const B={name:`labelStartLink`,resolveAll:F.resolveAll,tokenize:tokenizeLabelStartLink};function tokenizeLabelStartLink(e,t,n){let r=this;return start;function start(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),after}function after(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const V={name:`lineEnding`,tokenize:tokenizeLineEnding};function tokenizeLineEnding(e,t){return start;function start(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),factorySpace(e,t,`linePrefix`)}}const H={name:`thematicBreak`,tokenize:tokenizeThematicBreak};function tokenizeThematicBreak(e,t,n){let r=0,i;return start;function start(t){return e.enter(`thematicBreak`),before(t)}function before(e){return i=e,atBreak(e)}function atBreak(a){return a===i?(e.enter(`thematicBreakSequence`),sequence(a)):r>=3&&(a===null||markdownLineEnding(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function sequence(t){return t===i?(e.consume(t),r++,sequence):(e.exit(`thematicBreakSequence`),markdownSpace(t)?factorySpace(e,atBreak,`whitespace`)(t):atBreak(t))}}const U={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:`list`,tokenize:tokenizeListStart},W={partial:!0,tokenize:tokenizeListItemPrefixWhitespace},G={partial:!0,tokenize:tokenizeIndent};function tokenizeListStart(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,s=0;return start;function start(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:o(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(H,n,atMarker)(t):atMarker(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),inside(t)}return n(t)}function inside(t){return o(t)&&++s<10?(e.consume(t),inside):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),atMarker(t)):n(t)}function atMarker(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(_,r.interrupt?n:onBlank,e.attempt(W,endOfPrefix,otherPrefix))}function onBlank(e){return r.containerState.initialBlankLine=!0,a++,endOfPrefix(e)}function otherPrefix(t){return markdownSpace(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),endOfPrefix):n(t)}function endOfPrefix(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function tokenizeListContinuation(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(_,onBlank,notBlank);function onBlank(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,factorySpace(e,t,`listItemIndent`,r.containerState.size+1)(n)}function notBlank(n){return r.containerState.furtherBlankLines||!markdownSpace(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,notInCurrentItem(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(G,t,notInCurrentItem)(n))}function notInCurrentItem(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,factorySpace(e,e.attempt(U,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function tokenizeIndent(e,t,n){let r=this;return factorySpace(e,afterPrefix,`listItemIndent`,r.containerState.size+1);function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function tokenizeListEnd(e){e.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(e,t,n){let r=this;return factorySpace(e,afterPrefix,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function afterPrefix(e){let i=r.events[r.events.length-1];return!markdownSpace(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const K={name:`setextUnderline`,resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function tokenizeSetextUnderline(e,t,n){let r=this,i;return start;function start(t){let a=r.events.length,o;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){o=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||o)?(e.enter(`setextHeadingLine`),i=t,before(t)):n(t)}function before(t){return e.enter(`setextHeadingLineSequence`),inside(t)}function inside(t){return t===i?(e.consume(t),inside):(e.exit(`setextHeadingLineSequence`),markdownSpace(t)?factorySpace(e,after,`lineSuffix`)(t):after(t))}function after(r){return r===null||markdownLineEnding(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const re={tokenize:initializeContent};function initializeContent(e){let t=e.attempt(this.parser.constructs.contentInitial,afterContentStartConstruct,paragraphInitial),n;return t;function afterContentStartConstruct(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),factorySpace(e,t,`linePrefix`)}function paragraphInitial(t){return e.enter(`paragraph`),lineStart(t)}function lineStart(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,data(t)}function data(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return markdownLineEnding(t)?(e.consume(t),e.exit(`chunkText`),lineStart):(e.consume(t),data)}}const q={tokenize:initializeDocument},J={tokenize:tokenizeContainer};function initializeDocument(e){let t=this,n=[],r=0,i,a,o;return start;function start(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,documentContinue,checkNewContainers)(i)}return checkNewContainers(i)}function documentContinue(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&closeFlow();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}exitContainers(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return splice(t.events,a+1,0,t.events.slice(n)),t.events.length=s,checkNewContainers(e)}return start(e)}function checkNewContainers(a){if(r===n.length){if(!i)return documentContinued(a);if(i.currentConstruct&&i.currentConstruct.concrete)return flowStart(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(J,thereIsANewContainer,thereIsNoNewContainer)(a)}function thereIsANewContainer(e){return i&&closeFlow(),exitContainers(r),documentContinued(e)}function thereIsNoNewContainer(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,flowStart(e)}function documentContinued(n){return t.containerState={},e.attempt(J,containerContinue,flowStart)(n)}function containerContinue(e){return r++,n.push([t.currentConstruct,t.containerState]),documentContinued(e)}function flowStart(n){if(n===null){i&&closeFlow(),exitContainers(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),flowContinue(n)}function flowContinue(n){if(n===null){writeToChild(e.exit(`chunkFlow`),!0),exitContainers(0),e.consume(n);return}return markdownLineEnding(n)?(e.consume(n),writeToChild(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,start):(e.consume(n),flowContinue)}function writeToChild(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(exitContainers(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;splice(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function exitContainers(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function closeFlow(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tokenizeContainer(e,t,n){return factorySpace(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}const Y={tokenize:initializeFlow};function initializeFlow(e){let t=this,n=e.attempt(_,atBlankEnding,e.attempt(this.parser.constructs.flowInitial,afterConstruct,factorySpace(e,e.attempt(this.parser.constructs.flow,afterConstruct,e.attempt(T,afterConstruct)),`linePrefix`)));return n;function atBlankEnding(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function afterConstruct(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}const X={resolveAll:createResolver()},ie=initializeFactory(`string`),ae=initializeFactory(`text`);function initializeFactory(e){return{resolveAll:createResolver(e===`text`?resolveAllLineSuffixes:void 0),tokenize:initializeText};function initializeText(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,start,notText);return start;function start(e){return atBreak(e)?i(e):notText(e)}function notText(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),data}function data(e){return atBreak(e)?(t.exit(`data`),i(e)):(t.consume(e),data)}function atBreak(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function createResolver(e){return resolveAllText;function resolveAllText(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function resolveAllLineSuffixes(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var oe=t({attentionMarkers:()=>pe,contentInitial:()=>ce,disable:()=>me,document:()=>se,flow:()=>le,flowInitial:()=>Z,insideSpan:()=>fe,string:()=>ue,text:()=>de});const se={42:U,43:U,45:U,48:U,49:U,50:U,51:U,52:U,53:U,54:U,55:U,56:U,57:U,62:v},ce={91:D},Z={[-2]:C,[-1]:C,32:C},le={35:te,42:H,45:[K,H],60:j,61:K,95:H,96:S,126:S},ue={38:b,92:y},de={[-5]:V,[-4]:V,[-3]:V,33:z,38:b,42:h,60:[g,P],91:B,92:[k,y],93:F,95:h,96:w},fe={null:[h,X]},pe={null:[42,95]},me={null:[]};function createTokenizer(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:constructFactory(onsuccessfulconstruct),check:constructFactory(onsuccessfulcheck),consume,enter,exit,interrupt:constructFactory(onsuccessfulcheck,{interrupt:!0})},l={code:null,containerState:{},defineSkip,events:[],now,parser:e,previous:null,sliceSerialize,sliceStream,write},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function write(e){return o=push(o,e),main(),o[o.length-1]===null?(addResult(t,0),l.events=resolveAll(a,l.events,l),l.events):[]}function sliceSerialize(e,t){return serializeChunks(sliceStream(e),t)}function sliceStream(e){return sliceChunks(o,e)}function now(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function defineSkip(e){i[e.line]=e.column,accountForPotentialSkip()}function main(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)go(t.charCodeAt(r._bufferIndex));else go(t)}}function go(e){u=u(e)}function consume(e){markdownLineEnding(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,accountForPotentialSkip()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function enter(e,t){let n=t||{};return n.type=e,n.start=now(),l.events.push([`enter`,n,l]),s.push(n),n}function exit(e){let t=s.pop();return t.end=now(),l.events.push([`exit`,t,l]),t}function onsuccessfulconstruct(e,t){addResult(e,t.from)}function onsuccessfulcheck(e,t){t.restore()}function constructFactory(e,t){return hook;function hook(n,r,i){let a,o,s,u;return Array.isArray(n)?handleListOfConstructs(n):`tokenize`in n?handleListOfConstructs([n]):handleMapOfConstructs(n);function handleMapOfConstructs(e){return start;function start(t){let n=t!==null&&e[t],r=t!==null&&e.null;return handleListOfConstructs([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function handleListOfConstructs(e){return a=e,o=0,e.length===0?i:handleConstruct(e[o])}function handleConstruct(e){return start;function start(n){return u=store(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?nok(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,ok,nok)(n)}}function ok(t){return e(s,u),r}function nok(e){return u.restore(),++o<a.length?handleConstruct(a[o]):i}}}function addResult(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&splice(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function store(){let e=now(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore};function restore(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,accountForPotentialSkip()}}function accountForPotentialSkip(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function sliceChunks(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function serializeChunks(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
1
+ import{n as e,r as t}from"../rolldown-runtime.mjs";import{t as n}from"./character-entities.mjs";const r=regexCheck(/[A-Za-z]/),i=regexCheck(/[\dA-Za-z]/),a=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(e){return e!==null&&(e<32||e===127)}const o=regexCheck(/\d/),s=regexCheck(/[\dA-Fa-f]/),c=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(e){return e!==null&&e<-2}function markdownLineEndingOrSpace(e){return e!==null&&(e<0||e===32)}function markdownSpace(e){return e===-2||e===-1||e===32}const l=regexCheck(/\p{P}|\p{S}/u),u=regexCheck(/\s/);function regexCheck(e){return check;function check(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function normalizeIdentifier(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}function classifyCharacter(e){if(e===null||markdownLineEndingOrSpace(e)||u(e))return 1;if(l(e))return 2}const d={};function toString(e,t){let n=t||d;return one(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function one(e,t,n){if(node(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return all(e.children,t,n)}return Array.isArray(e)?all(e,t,n):``}function all(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=one(e[i],t,n);return r.join(``)}function node(e){return!!(e&&typeof e==`object`)}const f={}.hasOwnProperty;function decodeNamedCharacterReference(e){return f.call(n,e)?n[e]:!1}function decodeNumericCharacterReference(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}const p=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function decodeString(e){return e.replace(p,decode)}function decode(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return decodeNumericCharacterReference(n.slice(t?2:1),t?16:10)}return decodeNamedCharacterReference(n)||e}function splice(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function push(e,t){return e.length>0?(splice(e,e.length,0,t),e):t}const m={}.hasOwnProperty;function combineExtensions(e){let t={},n=-1;for(;++n<e.length;)syntaxExtension(t,e[n]);return t}function syntaxExtension(e,t){let n;for(n in t){let r=(m.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){m.call(r,a)||(r[a]=[]);let e=i[a];constructs(r[a],Array.isArray(e)?e:e?[e]:[])}}}function constructs(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);splice(e,0,0,r)}function resolveAll(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const h={name:`attention`,resolveAll:resolveAllAttention,tokenize:tokenizeAttention};function resolveAllAttention(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};movePoint(d,-c),movePoint(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=push(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=push(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=push(l,resolveAll(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=push(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=push(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,splice(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function tokenizeAttention(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=classifyCharacter(r),a;return start;function start(t){return a=t,e.enter(`attentionSequence`),inside(t)}function inside(o){if(o===a)return e.consume(o),inside;let s=e.exit(`attentionSequence`),c=classifyCharacter(o),l=!c||c===2&&i||n.includes(o),u=!i||i===2&&c||n.includes(r);return s._open=!!(a===42?l:l&&(i||!u)),s._close=!!(a===42?u:u&&(c||!l)),t(o)}}function movePoint(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const g={name:`autolink`,tokenize:tokenizeAutolink};function tokenizeAutolink(e,t,n){let o=0;return start;function start(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),open}function open(t){return r(t)?(e.consume(t),schemeOrEmailAtext):t===64?n(t):emailAtext(t)}function schemeOrEmailAtext(e){return e===43||e===45||e===46||i(e)?(o=1,schemeInsideOrEmailAtext(e)):emailAtext(e)}function schemeInsideOrEmailAtext(t){return t===58?(e.consume(t),o=0,urlInside):(t===43||t===45||t===46||i(t))&&o++<32?(e.consume(t),schemeInsideOrEmailAtext):(o=0,emailAtext(t))}function urlInside(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||asciiControl(r)?n(r):(e.consume(r),urlInside)}function emailAtext(t){return t===64?(e.consume(t),emailAtSignOrDot):a(t)?(e.consume(t),emailAtext):n(t)}function emailAtSignOrDot(e){return i(e)?emailLabel(e):n(e)}function emailLabel(n){return n===46?(e.consume(n),o=0,emailAtSignOrDot):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):emailValue(n)}function emailValue(t){if((t===45||i(t))&&o++<63){let n=t===45?emailValue:emailLabel;return e.consume(t),n}return n(t)}}function factorySpace(e,t,n,r){let i=r?r-1:1/0,a=0;return start;function start(r){return markdownSpace(r)?(e.enter(n),prefix(r)):t(r)}function prefix(r){return markdownSpace(r)&&a++<i?(e.consume(r),prefix):(e.exit(n),t(r))}}const _={partial:!0,tokenize:tokenizeBlankLine};function tokenizeBlankLine(e,t,n){return start;function start(t){return markdownSpace(t)?factorySpace(e,after,`linePrefix`)(t):after(t)}function after(e){return e===null||markdownLineEnding(e)?t(e):n(e)}}const v={continuation:{tokenize:tokenizeBlockQuoteContinuation},exit,name:`blockQuote`,tokenize:tokenizeBlockQuoteStart};function tokenizeBlockQuoteStart(e,t,n){let r=this;return start;function start(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),after}return n(t)}function after(n){return markdownSpace(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function tokenizeBlockQuoteContinuation(e,t,n){let r=this;return contStart;function contStart(t){return markdownSpace(t)?factorySpace(e,contBefore,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):contBefore(t)}function contBefore(r){return e.attempt(v,t,n)(r)}}function exit(e){e.exit(`blockQuote`)}const y={name:`characterEscape`,tokenize:tokenizeCharacterEscape};function tokenizeCharacterEscape(e,t,n){return start;function start(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),inside}function inside(r){return c(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}const b={name:`characterReference`,tokenize:tokenizeCharacterReference};function tokenizeCharacterReference(e,t,n){let r=this,a=0,c,l;return start;function start(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),open}function open(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),numeric):(e.enter(`characterReferenceValue`),c=31,l=i,value(t))}function numeric(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),c=6,l=s,value):(e.enter(`characterReferenceValue`),c=7,l=o,value(t))}function value(o){if(o===59&&a){let a=e.exit(`characterReferenceValue`);return l===i&&!decodeNamedCharacterReference(r.sliceSerialize(a))?n(o):(e.enter(`characterReferenceMarker`),e.consume(o),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return l(o)&&a++<c?(e.consume(o),value):n(o)}}const x={partial:!0,tokenize:tokenizeNonLazyContinuation},S={concrete:!0,name:`codeFenced`,tokenize:tokenizeCodeFenced};function tokenizeCodeFenced(e,t,n){let r=this,i={partial:!0,tokenize:tokenizeCloseStart},a=0,o=0,s;return start;function start(e){return beforeSequenceOpen(e)}function beforeSequenceOpen(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===s?(o++,e.consume(t),sequenceOpen):o<3?n(t):(e.exit(`codeFencedFenceSequence`),markdownSpace(t)?factorySpace(e,infoBefore,`whitespace`)(t):infoBefore(t))}function infoBefore(n){return n===null||markdownLineEnding(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(x,atNonLazyBreak,after)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),info(n))}function info(t){return t===null||markdownLineEnding(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),infoBefore(t)):markdownSpace(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),factorySpace(e,metaBefore,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),info)}function metaBefore(t){return t===null||markdownLineEnding(t)?infoBefore(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),meta(t))}function meta(t){return t===null||markdownLineEnding(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),infoBefore(t)):t===96&&t===s?n(t):(e.consume(t),meta)}function atNonLazyBreak(t){return e.attempt(i,after,contentBefore)(t)}function contentBefore(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),contentStart}function contentStart(t){return a>0&&markdownSpace(t)?factorySpace(e,beforeContentChunk,`linePrefix`,a+1)(t):beforeContentChunk(t)}function beforeContentChunk(t){return t===null||markdownLineEnding(t)?e.check(x,atNonLazyBreak,after)(t):(e.enter(`codeFlowValue`),contentChunk(t))}function contentChunk(t){return t===null||markdownLineEnding(t)?(e.exit(`codeFlowValue`),beforeContentChunk(t)):(e.consume(t),contentChunk)}function after(n){return e.exit(`codeFenced`),t(n)}function tokenizeCloseStart(e,t,n){let i=0;return startBefore;function startBefore(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),start}function start(t){return e.enter(`codeFencedFence`),markdownSpace(t)?factorySpace(e,beforeSequenceClose,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):beforeSequenceClose(t)}function beforeSequenceClose(t){return t===s?(e.enter(`codeFencedFenceSequence`),sequenceClose(t)):n(t)}function sequenceClose(t){return t===s?(i++,e.consume(t),sequenceClose):i>=o?(e.exit(`codeFencedFenceSequence`),markdownSpace(t)?factorySpace(e,sequenceCloseAfter,`whitespace`)(t):sequenceCloseAfter(t)):n(t)}function sequenceCloseAfter(r){return r===null||markdownLineEnding(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function tokenizeNonLazyContinuation(e,t,n){let r=this;return start;function start(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),lineStart)}function lineStart(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}const C={name:`codeIndented`,tokenize:tokenizeCodeIndented},ee={partial:!0,tokenize:tokenizeFurtherStart};function tokenizeCodeIndented(e,t,n){let r=this;return start;function start(t){return e.enter(`codeIndented`),factorySpace(e,afterPrefix,`linePrefix`,5)(t)}function afterPrefix(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?atBreak(e):n(e)}function atBreak(t){return t===null?after(t):markdownLineEnding(t)?e.attempt(ee,atBreak,after)(t):(e.enter(`codeFlowValue`),inside(t))}function inside(t){return t===null||markdownLineEnding(t)?(e.exit(`codeFlowValue`),atBreak(t)):(e.consume(t),inside)}function after(n){return e.exit(`codeIndented`),t(n)}}function tokenizeFurtherStart(e,t,n){let r=this;return furtherStart;function furtherStart(t){return r.parser.lazy[r.now().line]?n(t):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),furtherStart):factorySpace(e,afterPrefix,`linePrefix`,5)(t)}function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`linePrefix`&&i[2].sliceSerialize(i[1],!0).length>=4?t(e):markdownLineEnding(e)?furtherStart(e):n(e)}}const w={name:`codeText`,previous,resolve:resolveCodeText,tokenize:tokenizeCodeText};function resolveCodeText(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function previous(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function tokenizeCodeText(e,t,n){let r=0,i,a;return start;function start(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===96?(e.consume(t),r++,sequenceOpen):(e.exit(`codeTextSequence`),between(t))}function between(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),between):t===96?(a=e.enter(`codeTextSequence`),i=0,sequenceClose(t)):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),between):(e.enter(`codeTextData`),data(t))}function data(t){return t===null||t===32||t===96||markdownLineEnding(t)?(e.exit(`codeTextData`),between(t)):(e.consume(t),data)}function sequenceClose(n){return n===96?(e.consume(n),i++,sequenceClose):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,data(n))}}var SpliceBuffer=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&chunkedPush(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),chunkedPush(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),chunkedPush(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);chunkedPush(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);chunkedPush(this.left,t.reverse())}}};function chunkedPush(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function subtokenize(e){let t={},n=-1,r,i,a,o,s,c,l,u=new SpliceBuffer(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,subcontent(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return splice(e,0,1/0,u.slice(0)),!l}function subcontent(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}const T={resolve:resolveContent,tokenize:tokenizeContent},E={partial:!0,tokenize:tokenizeContinuation};function resolveContent(e){return subtokenize(e),e}function tokenizeContent(e,t){let n;return chunkStart;function chunkStart(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),chunkInside(t)}function chunkInside(t){return t===null?contentEnd(t):markdownLineEnding(t)?e.check(E,contentContinue,contentEnd)(t):(e.consume(t),chunkInside)}function contentEnd(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function contentContinue(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,chunkInside}}function tokenizeContinuation(e,t,n){let r=this;return startLookahead;function startLookahead(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),factorySpace(e,prefixed,`linePrefix`)}function prefixed(i){if(i===null||markdownLineEnding(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function factoryDestination(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return start;function start(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),enclosedBefore):t===null||t===32||t===41||asciiControl(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),raw(t))}function enclosedBefore(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),enclosed(n))}function enclosed(t){return t===62?(e.exit(`chunkString`),e.exit(s),enclosedBefore(t)):t===null||t===60||markdownLineEnding(t)?n(t):(e.consume(t),t===92?enclosedEscape:enclosed)}function enclosedEscape(t){return t===60||t===62||t===92?(e.consume(t),enclosed):enclosed(t)}function raw(i){return!u&&(i===null||i===41||markdownLineEndingOrSpace(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,raw):i===41?(e.consume(i),u--,raw):i===null||i===32||i===40||asciiControl(i)?n(i):(e.consume(i),i===92?rawEscape:raw)}function rawEscape(t){return t===40||t===41||t===92?(e.consume(t),raw):raw(t)}}function factoryLabel(e,t,n,r,i,a){let o=this,s=0,c;return start;function start(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),atBreak}function atBreak(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):markdownLineEnding(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),atBreak):(e.enter(`chunkString`,{contentType:`string`}),labelInside(l))}function labelInside(t){return t===null||t===91||t===93||markdownLineEnding(t)||s++>999?(e.exit(`chunkString`),atBreak(t)):(e.consume(t),c||=!markdownSpace(t),t===92?labelEscape:labelInside)}function labelEscape(t){return t===91||t===92||t===93?(e.consume(t),s++,labelInside):labelInside(t)}}function factoryTitle(e,t,n,r,i,a){let o;return start;function start(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,begin):n(t)}function begin(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),atBreak(n))}function atBreak(t){return t===o?(e.exit(a),begin(o)):t===null?n(t):markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),factorySpace(e,atBreak,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),inside(t))}function inside(t){return t===o||t===null||markdownLineEnding(t)?(e.exit(`chunkString`),atBreak(t)):(e.consume(t),t===92?escape:inside)}function escape(t){return t===o||t===92?(e.consume(t),inside):inside(t)}}function factoryWhitespace(e,t){let n;return start;function start(r){return markdownLineEnding(r)?(e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),n=!0,start):markdownSpace(r)?factorySpace(e,start,n?`linePrefix`:`lineSuffix`)(r):t(r)}}const D={name:`definition`,tokenize:tokenizeDefinition},O={partial:!0,tokenize:tokenizeTitleBefore};function tokenizeDefinition(e,t,n){let r=this,i;return start;function start(t){return e.enter(`definition`),before(t)}function before(t){return factoryLabel.call(r,e,labelAfter,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function labelAfter(t){return i=normalizeIdentifier(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),markerAfter):n(t)}function markerAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,destinationBefore)(t):destinationBefore(t)}function destinationBefore(t){return factoryDestination(e,destinationAfter,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function destinationAfter(t){return e.attempt(O,after,after)(t)}function after(t){return markdownSpace(t)?factorySpace(e,afterWhitespace,`whitespace`)(t):afterWhitespace(t)}function afterWhitespace(a){return a===null||markdownLineEnding(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function tokenizeTitleBefore(e,t,n){return titleBefore;function titleBefore(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,beforeMarker)(t):n(t)}function beforeMarker(t){return factoryTitle(e,titleAfter,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function titleAfter(t){return markdownSpace(t)?factorySpace(e,titleAfterOptionalWhitespace,`whitespace`)(t):titleAfterOptionalWhitespace(t)}function titleAfterOptionalWhitespace(e){return e===null||markdownLineEnding(e)?t(e):n(e)}}const k={name:`hardBreakEscape`,tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(e,t,n){return start;function start(t){return e.enter(`hardBreakEscape`),e.consume(t),after}function after(r){return markdownLineEnding(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}const te={name:`headingAtx`,resolve:resolveHeadingAtx,tokenize:tokenizeHeadingAtx};function resolveHeadingAtx(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},splice(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function tokenizeHeadingAtx(e,t,n){let r=0;return start;function start(t){return e.enter(`atxHeading`),before(t)}function before(t){return e.enter(`atxHeadingSequence`),sequenceOpen(t)}function sequenceOpen(t){return t===35&&r++<6?(e.consume(t),sequenceOpen):t===null||markdownLineEndingOrSpace(t)?(e.exit(`atxHeadingSequence`),atBreak(t)):n(t)}function atBreak(n){return n===35?(e.enter(`atxHeadingSequence`),sequenceFurther(n)):n===null||markdownLineEnding(n)?(e.exit(`atxHeading`),t(n)):markdownSpace(n)?factorySpace(e,atBreak,`whitespace`)(n):(e.enter(`atxHeadingText`),data(n))}function sequenceFurther(t){return t===35?(e.consume(t),sequenceFurther):(e.exit(`atxHeadingSequence`),atBreak(t))}function data(t){return t===null||t===35||markdownLineEndingOrSpace(t)?(e.exit(`atxHeadingText`),atBreak(t)):(e.consume(t),data)}}const ne=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),A=[`pre`,`script`,`style`,`textarea`],j={concrete:!0,name:`htmlFlow`,resolveTo:resolveToHtmlFlow,tokenize:tokenizeHtmlFlow},M={partial:!0,tokenize:tokenizeBlankLineBefore},N={partial:!0,tokenize:tokenizeNonLazyContinuationStart};function resolveToHtmlFlow(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function tokenizeHtmlFlow(e,t,n){let a=this,o,s,c,l,u;return start;function start(e){return before(e)}function before(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),open}function open(i){return i===33?(e.consume(i),declarationOpen):i===47?(e.consume(i),s=!0,tagCloseStart):i===63?(e.consume(i),o=3,a.interrupt?t:continuationDeclarationInside):r(i)?(e.consume(i),c=String.fromCharCode(i),tagName):n(i)}function declarationOpen(i){return i===45?(e.consume(i),o=2,commentOpenInside):i===91?(e.consume(i),o=5,l=0,cdataOpenInside):r(i)?(e.consume(i),o=4,a.interrupt?t:continuationDeclarationInside):n(i)}function commentOpenInside(r){return r===45?(e.consume(r),a.interrupt?t:continuationDeclarationInside):n(r)}function cdataOpenInside(r){return r===`CDATA[`.charCodeAt(l++)?(e.consume(r),l===6?a.interrupt?t:continuation:cdataOpenInside):n(r)}function tagCloseStart(t){return r(t)?(e.consume(t),c=String.fromCharCode(t),tagName):n(t)}function tagName(r){if(r===null||r===47||r===62||markdownLineEndingOrSpace(r)){let i=r===47,l=c.toLowerCase();return!i&&!s&&A.includes(l)?(o=1,a.interrupt?t(r):continuation(r)):ne.includes(c.toLowerCase())?(o=6,i?(e.consume(r),basicSelfClosing):a.interrupt?t(r):continuation(r)):(o=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(r):s?completeClosingTagAfter(r):completeAttributeNameBefore(r))}return r===45||i(r)?(e.consume(r),c+=String.fromCharCode(r),tagName):n(r)}function basicSelfClosing(r){return r===62?(e.consume(r),a.interrupt?t:continuation):n(r)}function completeClosingTagAfter(t){return markdownSpace(t)?(e.consume(t),completeClosingTagAfter):completeEnd(t)}function completeAttributeNameBefore(t){return t===47?(e.consume(t),completeEnd):t===58||t===95||r(t)?(e.consume(t),completeAttributeName):markdownSpace(t)?(e.consume(t),completeAttributeNameBefore):completeEnd(t)}function completeAttributeName(t){return t===45||t===46||t===58||t===95||i(t)?(e.consume(t),completeAttributeName):completeAttributeNameAfter(t)}function completeAttributeNameAfter(t){return t===61?(e.consume(t),completeAttributeValueBefore):markdownSpace(t)?(e.consume(t),completeAttributeNameAfter):completeAttributeNameBefore(t)}function completeAttributeValueBefore(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),u=t,completeAttributeValueQuoted):markdownSpace(t)?(e.consume(t),completeAttributeValueBefore):completeAttributeValueUnquoted(t)}function completeAttributeValueQuoted(t){return t===u?(e.consume(t),u=null,completeAttributeValueQuotedAfter):t===null||markdownLineEnding(t)?n(t):(e.consume(t),completeAttributeValueQuoted)}function completeAttributeValueUnquoted(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||markdownLineEndingOrSpace(t)?completeAttributeNameAfter(t):(e.consume(t),completeAttributeValueUnquoted)}function completeAttributeValueQuotedAfter(e){return e===47||e===62||markdownSpace(e)?completeAttributeNameBefore(e):n(e)}function completeEnd(t){return t===62?(e.consume(t),completeAfter):n(t)}function completeAfter(t){return t===null||markdownLineEnding(t)?continuation(t):markdownSpace(t)?(e.consume(t),completeAfter):n(t)}function continuation(t){return t===45&&o===2?(e.consume(t),continuationCommentInside):t===60&&o===1?(e.consume(t),continuationRawTagOpen):t===62&&o===4?(e.consume(t),continuationClose):t===63&&o===3?(e.consume(t),continuationDeclarationInside):t===93&&o===5?(e.consume(t),continuationCdataInside):markdownLineEnding(t)&&(o===6||o===7)?(e.exit(`htmlFlowData`),e.check(M,continuationAfter,continuationStart)(t)):t===null||markdownLineEnding(t)?(e.exit(`htmlFlowData`),continuationStart(t)):(e.consume(t),continuation)}function continuationStart(t){return e.check(N,continuationStartNonLazy,continuationAfter)(t)}function continuationStartNonLazy(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),continuationBefore}function continuationBefore(t){return t===null||markdownLineEnding(t)?continuationStart(t):(e.enter(`htmlFlowData`),continuation(t))}function continuationCommentInside(t){return t===45?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationRawTagOpen(t){return t===47?(e.consume(t),c=``,continuationRawEndTag):continuation(t)}function continuationRawEndTag(t){if(t===62){let n=c.toLowerCase();return A.includes(n)?(e.consume(t),continuationClose):continuation(t)}return r(t)&&c.length<8?(e.consume(t),c+=String.fromCharCode(t),continuationRawEndTag):continuation(t)}function continuationCdataInside(t){return t===93?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationDeclarationInside(t){return t===62?(e.consume(t),continuationClose):t===45&&o===2?(e.consume(t),continuationDeclarationInside):continuation(t)}function continuationClose(t){return t===null||markdownLineEnding(t)?(e.exit(`htmlFlowData`),continuationAfter(t)):(e.consume(t),continuationClose)}function continuationAfter(n){return e.exit(`htmlFlow`),t(n)}}function tokenizeNonLazyContinuationStart(e,t,n){let r=this;return start;function start(t){return markdownLineEnding(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),after):n(t)}function after(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function tokenizeBlankLineBefore(e,t,n){return start;function start(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(_,t,n)}}const P={name:`htmlText`,tokenize:tokenizeHtmlText};function tokenizeHtmlText(e,t,n){let a=this,o,s,c;return start;function start(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),open}function open(t){return t===33?(e.consume(t),declarationOpen):t===47?(e.consume(t),tagCloseStart):t===63?(e.consume(t),instruction):r(t)?(e.consume(t),tagOpen):n(t)}function declarationOpen(t){return t===45?(e.consume(t),commentOpenInside):t===91?(e.consume(t),s=0,cdataOpenInside):r(t)?(e.consume(t),declaration):n(t)}function commentOpenInside(t){return t===45?(e.consume(t),commentEnd):n(t)}function comment(t){return t===null?n(t):t===45?(e.consume(t),commentClose):markdownLineEnding(t)?(c=comment,lineEndingBefore(t)):(e.consume(t),comment)}function commentClose(t){return t===45?(e.consume(t),commentEnd):comment(t)}function commentEnd(e){return e===62?end(e):e===45?commentClose(e):comment(e)}function cdataOpenInside(t){return t===`CDATA[`.charCodeAt(s++)?(e.consume(t),s===6?cdata:cdataOpenInside):n(t)}function cdata(t){return t===null?n(t):t===93?(e.consume(t),cdataClose):markdownLineEnding(t)?(c=cdata,lineEndingBefore(t)):(e.consume(t),cdata)}function cdataClose(t){return t===93?(e.consume(t),cdataEnd):cdata(t)}function cdataEnd(t){return t===62?end(t):t===93?(e.consume(t),cdataEnd):cdata(t)}function declaration(t){return t===null||t===62?end(t):markdownLineEnding(t)?(c=declaration,lineEndingBefore(t)):(e.consume(t),declaration)}function instruction(t){return t===null?n(t):t===63?(e.consume(t),instructionClose):markdownLineEnding(t)?(c=instruction,lineEndingBefore(t)):(e.consume(t),instruction)}function instructionClose(e){return e===62?end(e):instruction(e)}function tagCloseStart(t){return r(t)?(e.consume(t),tagClose):n(t)}function tagClose(t){return t===45||i(t)?(e.consume(t),tagClose):tagCloseBetween(t)}function tagCloseBetween(t){return markdownLineEnding(t)?(c=tagCloseBetween,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagCloseBetween):end(t)}function tagOpen(t){return t===45||i(t)?(e.consume(t),tagOpen):t===47||t===62||markdownLineEndingOrSpace(t)?tagOpenBetween(t):n(t)}function tagOpenBetween(t){return t===47?(e.consume(t),end):t===58||t===95||r(t)?(e.consume(t),tagOpenAttributeName):markdownLineEnding(t)?(c=tagOpenBetween,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenBetween):end(t)}function tagOpenAttributeName(t){return t===45||t===46||t===58||t===95||i(t)?(e.consume(t),tagOpenAttributeName):tagOpenAttributeNameAfter(t)}function tagOpenAttributeNameAfter(t){return t===61?(e.consume(t),tagOpenAttributeValueBefore):markdownLineEnding(t)?(c=tagOpenAttributeNameAfter,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenAttributeNameAfter):tagOpenBetween(t)}function tagOpenAttributeValueBefore(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),o=t,tagOpenAttributeValueQuoted):markdownLineEnding(t)?(c=tagOpenAttributeValueBefore,lineEndingBefore(t)):markdownSpace(t)?(e.consume(t),tagOpenAttributeValueBefore):(e.consume(t),tagOpenAttributeValueUnquoted)}function tagOpenAttributeValueQuoted(t){return t===o?(e.consume(t),o=void 0,tagOpenAttributeValueQuotedAfter):t===null?n(t):markdownLineEnding(t)?(c=tagOpenAttributeValueQuoted,lineEndingBefore(t)):(e.consume(t),tagOpenAttributeValueQuoted)}function tagOpenAttributeValueUnquoted(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||markdownLineEndingOrSpace(t)?tagOpenBetween(t):(e.consume(t),tagOpenAttributeValueUnquoted)}function tagOpenAttributeValueQuotedAfter(e){return e===47||e===62||markdownLineEndingOrSpace(e)?tagOpenBetween(e):n(e)}function end(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function lineEndingBefore(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),lineEndingAfter}function lineEndingAfter(t){return markdownSpace(t)?factorySpace(e,lineEndingAfterPrefix,`linePrefix`,a.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):lineEndingAfterPrefix(t)}function lineEndingAfterPrefix(t){return e.enter(`htmlTextData`),c(t)}}const F={name:`labelEnd`,resolveAll:resolveAllLabelEnd,resolveTo:resolveToLabelEnd,tokenize:tokenizeLabelEnd},I={tokenize:tokenizeResource},L={tokenize:tokenizeReferenceFull},R={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&splice(e,0,e.length,n),e}function resolveToLabelEnd(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=push(s,e.slice(a+1,a+r+3)),s=push(s,[[`enter`,u,t]]),s=push(s,resolveAll(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=push(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=push(s,e.slice(o+1)),s=push(s,[[`exit`,c,t]]),splice(e,a,e.length,s),e}function tokenizeLabelEnd(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return start;function start(t){return a?a._inactive?labelEndNok(t):(o=r.parser.defined.includes(normalizeIdentifier(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),after):n(t)}function after(t){return t===40?e.attempt(I,labelEndOk,o?labelEndOk:labelEndNok)(t):t===91?e.attempt(L,labelEndOk,o?referenceNotFull:labelEndNok)(t):o?labelEndOk(t):labelEndNok(t)}function referenceNotFull(t){return e.attempt(R,labelEndOk,labelEndNok)(t)}function labelEndOk(e){return t(e)}function labelEndNok(e){return a._balanced=!0,n(e)}}function tokenizeResource(e,t,n){return resourceStart;function resourceStart(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),resourceBefore}function resourceBefore(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceOpen)(t):resourceOpen(t)}function resourceOpen(t){return t===41?resourceEnd(t):factoryDestination(e,resourceDestinationAfter,resourceDestinationMissing,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function resourceDestinationAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceBetween)(t):resourceEnd(t)}function resourceDestinationMissing(e){return n(e)}function resourceBetween(t){return t===34||t===39||t===40?factoryTitle(e,resourceTitleAfter,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):resourceEnd(t)}function resourceTitleAfter(t){return markdownLineEndingOrSpace(t)?factoryWhitespace(e,resourceEnd)(t):resourceEnd(t)}function resourceEnd(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function tokenizeReferenceFull(e,t,n){let r=this;return referenceFull;function referenceFull(t){return factoryLabel.call(r,e,referenceFullAfter,referenceFullMissing,`reference`,`referenceMarker`,`referenceString`)(t)}function referenceFullAfter(e){return r.parser.defined.includes(normalizeIdentifier(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function referenceFullMissing(e){return n(e)}}function tokenizeReferenceCollapsed(e,t,n){return referenceCollapsedStart;function referenceCollapsedStart(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),referenceCollapsedOpen}function referenceCollapsedOpen(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}const z={name:`labelStartImage`,resolveAll:F.resolveAll,tokenize:tokenizeLabelStartImage};function tokenizeLabelStartImage(e,t,n){let r=this;return start;function start(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),open}function open(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),after):n(t)}function after(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const B={name:`labelStartLink`,resolveAll:F.resolveAll,tokenize:tokenizeLabelStartLink};function tokenizeLabelStartLink(e,t,n){let r=this;return start;function start(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),after}function after(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}const V={name:`lineEnding`,tokenize:tokenizeLineEnding};function tokenizeLineEnding(e,t){return start;function start(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),factorySpace(e,t,`linePrefix`)}}const H={name:`thematicBreak`,tokenize:tokenizeThematicBreak};function tokenizeThematicBreak(e,t,n){let r=0,i;return start;function start(t){return e.enter(`thematicBreak`),before(t)}function before(e){return i=e,atBreak(e)}function atBreak(a){return a===i?(e.enter(`thematicBreakSequence`),sequence(a)):r>=3&&(a===null||markdownLineEnding(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function sequence(t){return t===i?(e.consume(t),r++,sequence):(e.exit(`thematicBreakSequence`),markdownSpace(t)?factorySpace(e,atBreak,`whitespace`)(t):atBreak(t))}}const U={continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd,name:`list`,tokenize:tokenizeListStart},W={partial:!0,tokenize:tokenizeListItemPrefixWhitespace},G={partial:!0,tokenize:tokenizeIndent};function tokenizeListStart(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,s=0;return start;function start(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:o(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(H,n,atMarker)(t):atMarker(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),inside(t)}return n(t)}function inside(t){return o(t)&&++s<10?(e.consume(t),inside):(!r.interrupt||s<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),atMarker(t)):n(t)}function atMarker(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(_,r.interrupt?n:onBlank,e.attempt(W,endOfPrefix,otherPrefix))}function onBlank(e){return r.containerState.initialBlankLine=!0,a++,endOfPrefix(e)}function otherPrefix(t){return markdownSpace(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),endOfPrefix):n(t)}function endOfPrefix(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function tokenizeListContinuation(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(_,onBlank,notBlank);function onBlank(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,factorySpace(e,t,`listItemIndent`,r.containerState.size+1)(n)}function notBlank(n){return r.containerState.furtherBlankLines||!markdownSpace(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,notInCurrentItem(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(G,t,notInCurrentItem)(n))}function notInCurrentItem(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,factorySpace(e,e.attempt(U,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function tokenizeIndent(e,t,n){let r=this;return factorySpace(e,afterPrefix,`listItemIndent`,r.containerState.size+1);function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function tokenizeListEnd(e){e.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(e,t,n){let r=this;return factorySpace(e,afterPrefix,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function afterPrefix(e){let i=r.events[r.events.length-1];return!markdownSpace(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}const K={name:`setextUnderline`,resolveTo:resolveToSetextUnderline,tokenize:tokenizeSetextUnderline};function resolveToSetextUnderline(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function tokenizeSetextUnderline(e,t,n){let r=this,i;return start;function start(t){let a=r.events.length,o;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){o=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||o)?(e.enter(`setextHeadingLine`),i=t,before(t)):n(t)}function before(t){return e.enter(`setextHeadingLineSequence`),inside(t)}function inside(t){return t===i?(e.consume(t),inside):(e.exit(`setextHeadingLineSequence`),markdownSpace(t)?factorySpace(e,after,`lineSuffix`)(t):after(t))}function after(r){return r===null||markdownLineEnding(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}const re={tokenize:initializeContent};function initializeContent(e){let t=e.attempt(this.parser.constructs.contentInitial,afterContentStartConstruct,paragraphInitial),n;return t;function afterContentStartConstruct(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),factorySpace(e,t,`linePrefix`)}function paragraphInitial(t){return e.enter(`paragraph`),lineStart(t)}function lineStart(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,data(t)}function data(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return markdownLineEnding(t)?(e.consume(t),e.exit(`chunkText`),lineStart):(e.consume(t),data)}}const q={tokenize:initializeDocument},J={tokenize:tokenizeContainer};function initializeDocument(e){let t=this,n=[],r=0,i,a,o;return start;function start(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,documentContinue,checkNewContainers)(i)}return checkNewContainers(i)}function documentContinue(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&closeFlow();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}exitContainers(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return splice(t.events,a+1,0,t.events.slice(n)),t.events.length=s,checkNewContainers(e)}return start(e)}function checkNewContainers(a){if(r===n.length){if(!i)return documentContinued(a);if(i.currentConstruct&&i.currentConstruct.concrete)return flowStart(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(J,thereIsANewContainer,thereIsNoNewContainer)(a)}function thereIsANewContainer(e){return i&&closeFlow(),exitContainers(r),documentContinued(e)}function thereIsNoNewContainer(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,flowStart(e)}function documentContinued(n){return t.containerState={},e.attempt(J,containerContinue,flowStart)(n)}function containerContinue(e){return r++,n.push([t.currentConstruct,t.containerState]),documentContinued(e)}function flowStart(n){if(n===null){i&&closeFlow(),exitContainers(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),flowContinue(n)}function flowContinue(n){if(n===null){writeToChild(e.exit(`chunkFlow`),!0),exitContainers(0),e.consume(n);return}return markdownLineEnding(n)?(e.consume(n),writeToChild(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,start):(e.consume(n),flowContinue)}function writeToChild(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(exitContainers(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;splice(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function exitContainers(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function closeFlow(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function tokenizeContainer(e,t,n){return factorySpace(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}const Y={tokenize:initializeFlow};function initializeFlow(e){let t=this,n=e.attempt(_,atBlankEnding,e.attempt(this.parser.constructs.flowInitial,afterConstruct,factorySpace(e,e.attempt(this.parser.constructs.flow,afterConstruct,e.attempt(T,afterConstruct)),`linePrefix`)));return n;function atBlankEnding(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function afterConstruct(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}const X={resolveAll:createResolver()},ie=initializeFactory(`string`),ae=initializeFactory(`text`);function initializeFactory(e){return{resolveAll:createResolver(e===`text`?resolveAllLineSuffixes:void 0),tokenize:initializeText};function initializeText(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,start,notText);return start;function start(e){return atBreak(e)?i(e):notText(e)}function notText(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),data}function data(e){return atBreak(e)?(t.exit(`data`),i(e)):(t.consume(e),data)}function atBreak(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function createResolver(e){return resolveAllText;function resolveAllText(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function resolveAllLineSuffixes(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var oe=e({attentionMarkers:()=>pe,contentInitial:()=>ce,disable:()=>me,document:()=>se,flow:()=>le,flowInitial:()=>Z,insideSpan:()=>fe,string:()=>ue,text:()=>de});const se={42:U,43:U,45:U,48:U,49:U,50:U,51:U,52:U,53:U,54:U,55:U,56:U,57:U,62:v},ce={91:D},Z={[-2]:C,[-1]:C,32:C},le={35:te,42:H,45:[K,H],60:j,61:K,95:H,96:S,126:S},ue={38:b,92:y},de={[-5]:V,[-4]:V,[-3]:V,33:z,38:b,42:h,60:[g,P],91:B,92:[k,y],93:F,95:h,96:w},fe={null:[h,X]},pe={null:[42,95]},me={null:[]};function createTokenizer(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:constructFactory(onsuccessfulconstruct),check:constructFactory(onsuccessfulcheck),consume,enter,exit,interrupt:constructFactory(onsuccessfulcheck,{interrupt:!0})},l={code:null,containerState:{},defineSkip,events:[],now,parser:e,previous:null,sliceSerialize,sliceStream,write},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function write(e){return o=push(o,e),main(),o[o.length-1]===null?(addResult(t,0),l.events=resolveAll(a,l.events,l),l.events):[]}function sliceSerialize(e,t){return serializeChunks(sliceStream(e),t)}function sliceStream(e){return sliceChunks(o,e)}function now(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function defineSkip(e){i[e.line]=e.column,accountForPotentialSkip()}function main(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)go(t.charCodeAt(r._bufferIndex));else go(t)}}function go(e){u=u(e)}function consume(e){markdownLineEnding(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,accountForPotentialSkip()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function enter(e,t){let n=t||{};return n.type=e,n.start=now(),l.events.push([`enter`,n,l]),s.push(n),n}function exit(e){let t=s.pop();return t.end=now(),l.events.push([`exit`,t,l]),t}function onsuccessfulconstruct(e,t){addResult(e,t.from)}function onsuccessfulcheck(e,t){t.restore()}function constructFactory(e,t){return hook;function hook(n,r,i){let a,o,s,u;return Array.isArray(n)?handleListOfConstructs(n):`tokenize`in n?handleListOfConstructs([n]):handleMapOfConstructs(n);function handleMapOfConstructs(e){return start;function start(t){let n=t!==null&&e[t],r=t!==null&&e.null;return handleListOfConstructs([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function handleListOfConstructs(e){return a=e,o=0,e.length===0?i:handleConstruct(e[o])}function handleConstruct(e){return start;function start(n){return u=store(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?nok(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,ok,nok)(n)}}function ok(t){return e(s,u),r}function nok(e){return u.restore(),++o<a.length?handleConstruct(a[o]):i}}}function addResult(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&splice(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function store(){let e=now(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore};function restore(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,accountForPotentialSkip()}}function accountForPotentialSkip(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function sliceChunks(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function serializeChunks(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
2
2
  `;break;case-3:o=`\r
3
- `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function parse(e){let t={constructs:combineExtensions([oe,...(e||{}).extensions||[]]),content:create(re),defined:[],document:create(q),flow:create(Y),lazy:{},string:create(ie),text:create(ae)};return t;function create(e){return creator;function creator(n){return createTokenizer(t,e,n)}}}function postprocess(e){for(;!subtokenize(e););return e}const Q=/[\0\t\n\r]/g;function preprocess(){let e=1,t=``,n=!0,r;return preprocessor;function preprocessor(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Q.lastIndex=u,c=Q.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}function stringifyPosition(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?position(e.position):`start`in e||`end`in e?position(e):`line`in e||`column`in e?point$1(e):``}function point$1(e){return index(e&&e.line)+`:`+index(e&&e.column)}e(point$1,`point`);function position(e){return point$1(e&&e.start)+`-`+point$1(e&&e.end)}function index(e){return e&&typeof e==`number`?e:1}const $={}.hasOwnProperty;function fromMarkdown(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),compiler(n)(postprocess(parse(n).document().write(preprocess()(e,t,!0))))}function compiler(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:opener(link),autolinkProtocol:onenterdata,autolinkEmail:onenterdata,atxHeading:opener(heading),blockQuote:opener(blockQuote),characterEscape:onenterdata,characterReference:onenterdata,codeFenced:opener(codeFlow),codeFencedFenceInfo:buffer,codeFencedFenceMeta:buffer,codeIndented:opener(codeFlow,buffer),codeText:opener(codeText,buffer),codeTextData:onenterdata,data:onenterdata,codeFlowValue:onenterdata,definition:opener(definition),definitionDestinationString:buffer,definitionLabelString:buffer,definitionTitleString:buffer,emphasis:opener(emphasis),hardBreakEscape:opener(hardBreak),hardBreakTrailing:opener(hardBreak),htmlFlow:opener(html,buffer),htmlFlowData:onenterdata,htmlText:opener(html,buffer),htmlTextData:onenterdata,image:opener(image),label:buffer,link:opener(link),listItem:opener(listItem),listItemValue:onenterlistitemvalue,listOrdered:opener(list,onenterlistordered),listUnordered:opener(list),paragraph:opener(paragraph),reference:onenterreference,referenceString:buffer,resourceDestinationString:buffer,resourceTitleString:buffer,setextHeading:opener(heading),strong:opener(strong),thematicBreak:opener(thematicBreak)},exit:{atxHeading:closer(),atxHeadingSequence:onexitatxheadingsequence,autolink:closer(),autolinkEmail:onexitautolinkemail,autolinkProtocol:onexitautolinkprotocol,blockQuote:closer(),characterEscapeValue:onexitdata,characterReferenceMarkerHexadecimal:onexitcharacterreferencemarker,characterReferenceMarkerNumeric:onexitcharacterreferencemarker,characterReferenceValue:onexitcharacterreferencevalue,characterReference:onexitcharacterreference,codeFenced:closer(onexitcodefenced),codeFencedFence:onexitcodefencedfence,codeFencedFenceInfo:onexitcodefencedfenceinfo,codeFencedFenceMeta:onexitcodefencedfencemeta,codeFlowValue:onexitdata,codeIndented:closer(onexitcodeindented),codeText:closer(onexitcodetext),codeTextData:onexitdata,data:onexitdata,definition:closer(),definitionDestinationString:onexitdefinitiondestinationstring,definitionLabelString:onexitdefinitionlabelstring,definitionTitleString:onexitdefinitiontitlestring,emphasis:closer(),hardBreakEscape:closer(onexithardbreak),hardBreakTrailing:closer(onexithardbreak),htmlFlow:closer(onexithtmlflow),htmlFlowData:onexitdata,htmlText:closer(onexithtmltext),htmlTextData:onexitdata,image:closer(onexitimage),label:onexitlabel,labelText:onexitlabeltext,lineEnding:onexitlineending,link:closer(onexitlink),listItem:closer(),listOrdered:closer(),listUnordered:closer(),paragraph:closer(),referenceString:onexitreferencestring,resourceDestinationString:onexitresourcedestinationstring,resourceTitleString:onexitresourcetitlestring,resource:onexitresource,setextHeading:closer(onexitsetextheading),setextHeadingLineSequence:onexitsetextheadinglinesequence,setextHeadingText:onexitsetextheadingtext,strong:closer(),thematicBreak:closer()}};configure(t,(e||{}).mdastExtensions||[]);let n={};return compile;function compile(e){let r={type:`root`,children:[]},i={stack:[r],tokenStack:[],config:t,enter,exit,buffer,resume,data:n},a=[],o=-1;for(;++o<e.length;)(e[o][1].type===`listOrdered`||e[o][1].type===`listUnordered`)&&(e[o][0]===`enter`?a.push(o):o=prepareList(e,a.pop(),o));for(o=-1;++o<e.length;){let n=t[e[o][0]];$.call(n,e[o][1].type)&&n[e[o][1].type].call(Object.assign({sliceSerialize:e[o][2].sliceSerialize},i),e[o][1])}if(i.tokenStack.length>0){let e=i.tokenStack[i.tokenStack.length-1];(e[1]||defaultOnError).call(i,void 0,e[0])}for(r.position={start:point(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:point(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},o=-1;++o<t.transforms.length;)r=t.transforms[o](r)||r;return r}function prepareList(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function opener(e,t){return open;function open(n){enter.call(this,e(n),n),t&&t.call(this,n)}}function buffer(){this.stack.push({type:`fragment`,children:[]})}function enter(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:point(t.start),end:void 0}}function closer(e){return close;function close(t){e&&e.call(this,t),exit.call(this,t)}}function exit(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||defaultOnError).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+stringifyPosition({start:e.start,end:e.end})+`): it’s not open`);n.position.end=point(e.end)}function resume(){return toString(this.stack.pop())}function onenterlistordered(){this.data.expectingFirstListItemValue=!0}function onenterlistitemvalue(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function onexitcodefencedfenceinfo(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function onexitcodefencedfencemeta(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function onexitcodefencedfence(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function onexitcodefenced(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function onexitcodeindented(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function onexitdefinitionlabelstring(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase()}function onexitdefinitiontitlestring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function onexitdefinitiondestinationstring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function onexitatxheadingsequence(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function onexitsetextheadingtext(){this.data.setextHeadingSlurpLineEnding=!0}function onexitsetextheadinglinesequence(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function onexitsetextheading(){this.data.setextHeadingSlurpLineEnding=void 0}function onenterdata(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=text(),n.position={start:point(e.start),end:void 0},t.push(n)),this.stack.push(n)}function onexitdata(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=point(e.end)}function onexitlineending(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=point(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(onenterdata.call(this,e),onexitdata.call(this,e))}function onexithardbreak(){this.data.atHardBreak=!0}function onexithtmlflow(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexithtmltext(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexitcodetext(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexitlink(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function onexitimage(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function onexitlabeltext(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=decodeString(t),n.identifier=normalizeIdentifier(t).toLowerCase()}function onexitlabel(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function onexitresourcedestinationstring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function onexitresourcetitlestring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function onexitresource(){this.data.inReference=void 0}function onenterreference(){this.data.referenceType=`collapsed`}function onexitreferencestring(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function onexitcharacterreferencemarker(e){this.data.characterReferenceType=e.type}function onexitcharacterreferencevalue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=decodeNumericCharacterReference(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=decodeNamedCharacterReference(t);let i=this.stack[this.stack.length-1];i.value+=r}function onexitcharacterreference(e){let t=this.stack.pop();t.position.end=point(e.end)}function onexitautolinkprotocol(e){onexitdata.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function onexitautolinkemail(e){onexitdata.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function blockQuote(){return{type:`blockquote`,children:[]}}function codeFlow(){return{type:`code`,lang:null,meta:null,value:``}}function codeText(){return{type:`inlineCode`,value:``}}function definition(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function emphasis(){return{type:`emphasis`,children:[]}}function heading(){return{type:`heading`,depth:0,children:[]}}function hardBreak(){return{type:`break`}}function html(){return{type:`html`,value:``}}function image(){return{type:`image`,title:null,url:``,alt:null}}function link(){return{type:`link`,title:null,url:``,children:[]}}function list(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function listItem(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function paragraph(){return{type:`paragraph`,children:[]}}function strong(){return{type:`strong`,children:[]}}function text(){return{type:`text`,value:``}}function thematicBreak(){return{type:`thematicBreak`}}}function point(e){return{line:e.line,column:e.column,offset:e.offset}}function configure(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?configure(e,r):extension(e,r)}}function extension(e,t){let n;for(n in t)if($.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function defaultOnError(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+stringifyPosition({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+stringifyPosition({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+stringifyPosition({start:t.start,end:t.end})+`) is still open`)}export{l as _,resolveAll as a,toString as c,r as d,i as f,markdownSpace as g,markdownLineEndingOrSpace as h,factorySpace as i,classifyCharacter as l,markdownLineEnding as m,stringifyPosition as n,combineExtensions as o,asciiControl as p,_ as r,splice as s,fromMarkdown as t,normalizeIdentifier as u,u as v};
3
+ `;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function parse(e){let t={constructs:combineExtensions([oe,...(e||{}).extensions||[]]),content:create(re),defined:[],document:create(q),flow:create(Y),lazy:{},string:create(ie),text:create(ae)};return t;function create(e){return creator;function creator(n){return createTokenizer(t,e,n)}}}function postprocess(e){for(;!subtokenize(e););return e}const Q=/[\0\t\n\r]/g;function preprocess(){let e=1,t=``,n=!0,r;return preprocessor;function preprocessor(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Q.lastIndex=u,c=Q.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}function stringifyPosition(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?position(e.position):`start`in e||`end`in e?position(e):`line`in e||`column`in e?point$1(e):``}function point$1(e){return index(e&&e.line)+`:`+index(e&&e.column)}t(point$1,`point`);function position(e){return point$1(e&&e.start)+`-`+point$1(e&&e.end)}function index(e){return e&&typeof e==`number`?e:1}const $={}.hasOwnProperty;function fromMarkdown(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),compiler(n)(postprocess(parse(n).document().write(preprocess()(e,t,!0))))}function compiler(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:opener(link),autolinkProtocol:onenterdata,autolinkEmail:onenterdata,atxHeading:opener(heading),blockQuote:opener(blockQuote),characterEscape:onenterdata,characterReference:onenterdata,codeFenced:opener(codeFlow),codeFencedFenceInfo:buffer,codeFencedFenceMeta:buffer,codeIndented:opener(codeFlow,buffer),codeText:opener(codeText,buffer),codeTextData:onenterdata,data:onenterdata,codeFlowValue:onenterdata,definition:opener(definition),definitionDestinationString:buffer,definitionLabelString:buffer,definitionTitleString:buffer,emphasis:opener(emphasis),hardBreakEscape:opener(hardBreak),hardBreakTrailing:opener(hardBreak),htmlFlow:opener(html,buffer),htmlFlowData:onenterdata,htmlText:opener(html,buffer),htmlTextData:onenterdata,image:opener(image),label:buffer,link:opener(link),listItem:opener(listItem),listItemValue:onenterlistitemvalue,listOrdered:opener(list,onenterlistordered),listUnordered:opener(list),paragraph:opener(paragraph),reference:onenterreference,referenceString:buffer,resourceDestinationString:buffer,resourceTitleString:buffer,setextHeading:opener(heading),strong:opener(strong),thematicBreak:opener(thematicBreak)},exit:{atxHeading:closer(),atxHeadingSequence:onexitatxheadingsequence,autolink:closer(),autolinkEmail:onexitautolinkemail,autolinkProtocol:onexitautolinkprotocol,blockQuote:closer(),characterEscapeValue:onexitdata,characterReferenceMarkerHexadecimal:onexitcharacterreferencemarker,characterReferenceMarkerNumeric:onexitcharacterreferencemarker,characterReferenceValue:onexitcharacterreferencevalue,characterReference:onexitcharacterreference,codeFenced:closer(onexitcodefenced),codeFencedFence:onexitcodefencedfence,codeFencedFenceInfo:onexitcodefencedfenceinfo,codeFencedFenceMeta:onexitcodefencedfencemeta,codeFlowValue:onexitdata,codeIndented:closer(onexitcodeindented),codeText:closer(onexitcodetext),codeTextData:onexitdata,data:onexitdata,definition:closer(),definitionDestinationString:onexitdefinitiondestinationstring,definitionLabelString:onexitdefinitionlabelstring,definitionTitleString:onexitdefinitiontitlestring,emphasis:closer(),hardBreakEscape:closer(onexithardbreak),hardBreakTrailing:closer(onexithardbreak),htmlFlow:closer(onexithtmlflow),htmlFlowData:onexitdata,htmlText:closer(onexithtmltext),htmlTextData:onexitdata,image:closer(onexitimage),label:onexitlabel,labelText:onexitlabeltext,lineEnding:onexitlineending,link:closer(onexitlink),listItem:closer(),listOrdered:closer(),listUnordered:closer(),paragraph:closer(),referenceString:onexitreferencestring,resourceDestinationString:onexitresourcedestinationstring,resourceTitleString:onexitresourcetitlestring,resource:onexitresource,setextHeading:closer(onexitsetextheading),setextHeadingLineSequence:onexitsetextheadinglinesequence,setextHeadingText:onexitsetextheadingtext,strong:closer(),thematicBreak:closer()}};configure(t,(e||{}).mdastExtensions||[]);let n={};return compile;function compile(e){let r={type:`root`,children:[]},i={stack:[r],tokenStack:[],config:t,enter,exit,buffer,resume,data:n},a=[],o=-1;for(;++o<e.length;)(e[o][1].type===`listOrdered`||e[o][1].type===`listUnordered`)&&(e[o][0]===`enter`?a.push(o):o=prepareList(e,a.pop(),o));for(o=-1;++o<e.length;){let n=t[e[o][0]];$.call(n,e[o][1].type)&&n[e[o][1].type].call(Object.assign({sliceSerialize:e[o][2].sliceSerialize},i),e[o][1])}if(i.tokenStack.length>0){let e=i.tokenStack[i.tokenStack.length-1];(e[1]||defaultOnError).call(i,void 0,e[0])}for(r.position={start:point(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:point(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},o=-1;++o<t.transforms.length;)r=t.transforms[o](r)||r;return r}function prepareList(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function opener(e,t){return open;function open(n){enter.call(this,e(n),n),t&&t.call(this,n)}}function buffer(){this.stack.push({type:`fragment`,children:[]})}function enter(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:point(t.start),end:void 0}}function closer(e){return close;function close(t){e&&e.call(this,t),exit.call(this,t)}}function exit(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||defaultOnError).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+stringifyPosition({start:e.start,end:e.end})+`): it’s not open`);n.position.end=point(e.end)}function resume(){return toString(this.stack.pop())}function onenterlistordered(){this.data.expectingFirstListItemValue=!0}function onenterlistitemvalue(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function onexitcodefencedfenceinfo(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function onexitcodefencedfencemeta(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function onexitcodefencedfence(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function onexitcodefenced(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function onexitcodeindented(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function onexitdefinitionlabelstring(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase()}function onexitdefinitiontitlestring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function onexitdefinitiondestinationstring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function onexitatxheadingsequence(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function onexitsetextheadingtext(){this.data.setextHeadingSlurpLineEnding=!0}function onexitsetextheadinglinesequence(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function onexitsetextheading(){this.data.setextHeadingSlurpLineEnding=void 0}function onenterdata(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=text(),n.position={start:point(e.start),end:void 0},t.push(n)),this.stack.push(n)}function onexitdata(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=point(e.end)}function onexitlineending(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=point(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(onenterdata.call(this,e),onexitdata.call(this,e))}function onexithardbreak(){this.data.atHardBreak=!0}function onexithtmlflow(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexithtmltext(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexitcodetext(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function onexitlink(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function onexitimage(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function onexitlabeltext(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=decodeString(t),n.identifier=normalizeIdentifier(t).toLowerCase()}function onexitlabel(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function onexitresourcedestinationstring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function onexitresourcetitlestring(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function onexitresource(){this.data.inReference=void 0}function onenterreference(){this.data.referenceType=`collapsed`}function onexitreferencestring(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=normalizeIdentifier(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function onexitcharacterreferencemarker(e){this.data.characterReferenceType=e.type}function onexitcharacterreferencevalue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=decodeNumericCharacterReference(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=decodeNamedCharacterReference(t);let i=this.stack[this.stack.length-1];i.value+=r}function onexitcharacterreference(e){let t=this.stack.pop();t.position.end=point(e.end)}function onexitautolinkprotocol(e){onexitdata.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function onexitautolinkemail(e){onexitdata.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function blockQuote(){return{type:`blockquote`,children:[]}}function codeFlow(){return{type:`code`,lang:null,meta:null,value:``}}function codeText(){return{type:`inlineCode`,value:``}}function definition(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function emphasis(){return{type:`emphasis`,children:[]}}function heading(){return{type:`heading`,depth:0,children:[]}}function hardBreak(){return{type:`break`}}function html(){return{type:`html`,value:``}}function image(){return{type:`image`,title:null,url:``,alt:null}}function link(){return{type:`link`,title:null,url:``,children:[]}}function list(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function listItem(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function paragraph(){return{type:`paragraph`,children:[]}}function strong(){return{type:`strong`,children:[]}}function text(){return{type:`text`,value:``}}function thematicBreak(){return{type:`thematicBreak`}}}function point(e){return{line:e.line,column:e.column,offset:e.offset}}function configure(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?configure(e,r):extension(e,r)}}function extension(e,t){let n;for(n in t)if($.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function defaultOnError(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+stringifyPosition({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+stringifyPosition({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+stringifyPosition({start:t.start,end:t.end})+`) is still open`)}export{l as _,resolveAll as a,toString as c,r as d,i as f,markdownSpace as g,markdownLineEndingOrSpace as h,factorySpace as i,classifyCharacter as l,markdownLineEnding as m,stringifyPosition as n,combineExtensions as o,asciiControl as p,_ as r,splice as s,fromMarkdown as t,normalizeIdentifier as u,u as v};
@@ -1,4 +1,4 @@
1
- import{i as e}from"../rolldown-runtime.mjs";import{n as t}from"./hast-util-to-html.mjs";import{_ as n,c as r,l as i,u as a,v as o}from"./mdast-util-from-markdown.mjs";import{n as s,r as c,t as l}from"./mdast-util-find-and-replace.mjs";import{t as u}from"./markdown-table.mjs";function ok(){}const d=`phrasing`,f=[`autolink`,`link`,`image`,`label`];function gfmAutolinkLiteralFromMarkdown(){return{transforms:[transformGfmAutolinkLiterals],enter:{literalAutolink:enterLiteralAutolink,literalAutolinkEmail:enterLiteralAutolinkValue,literalAutolinkHttp:enterLiteralAutolinkValue,literalAutolinkWww:enterLiteralAutolinkValue},exit:{literalAutolink:exitLiteralAutolink,literalAutolinkEmail:exitLiteralAutolinkEmail,literalAutolinkHttp:exitLiteralAutolinkHttp,literalAutolinkWww:exitLiteralAutolinkWww}}}function gfmAutolinkLiteralToMarkdown(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:d,notInConstruct:f},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:d,notInConstruct:f},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:d,notInConstruct:f}]}}function enterLiteralAutolink(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function enterLiteralAutolinkValue(e){this.config.enter.autolinkProtocol.call(this,e)}function exitLiteralAutolinkHttp(e){this.config.exit.autolinkProtocol.call(this,e)}function exitLiteralAutolinkWww(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function exitLiteralAutolinkEmail(e){this.config.exit.autolinkEmail.call(this,e)}function exitLiteralAutolink(e){this.exit(e)}function transformGfmAutolinkLiterals(e){l(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,findUrl],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,findEmail]],{ignore:[`link`,`linkReference`]})}function findUrl(e,t,n,r,i){let a=``;if(!previous(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!isCorrectDomain(n)))return!1;let o=splitUrl(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function findEmail(e,t,n,r){return!previous(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function isCorrectDomain(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function splitUrl(e){let n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(`)`),a=t(e,`(`),o=t(e,`)`);for(;i!==-1&&a>o;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(`)`),o++;return[e,r]}function previous(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||o(r)||n(r))&&(!t||r!==47)}footnoteReference.peek=footnoteReferencePeek;function enterFootnoteCallString(){this.buffer()}function enterFootnoteCall(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function enterFootnoteDefinitionLabelString(){this.buffer()}function enterFootnoteDefinition(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function exitFootnoteCallString(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function exitFootnoteCall(e){this.exit(e)}function exitFootnoteDefinitionLabelString(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function exitFootnoteDefinition(e){this.exit(e)}function footnoteReferencePeek(){return`[`}function footnoteReference(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function gfmFootnoteFromMarkdown(){return{enter:{gfmFootnoteCallString:enterFootnoteCallString,gfmFootnoteCall:enterFootnoteCall,gfmFootnoteDefinitionLabelString:enterFootnoteDefinitionLabelString,gfmFootnoteDefinition:enterFootnoteDefinition},exit:{gfmFootnoteCallString:exitFootnoteCallString,gfmFootnoteCall:exitFootnoteCall,gfmFootnoteDefinitionLabelString:exitFootnoteDefinitionLabelString,gfmFootnoteDefinition:exitFootnoteDefinition}}}function gfmFootnoteToMarkdown(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition,footnoteReference},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function footnoteDefinition(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
1
+ import{r as e}from"../rolldown-runtime.mjs";import{n as t}from"./hast-util-to-html.mjs";import{_ as n,c as r,l as i,u as a,v as o}from"./mdast-util-from-markdown.mjs";import{n as s,r as c,t as l}from"./mdast-util-find-and-replace.mjs";import{t as u}from"./markdown-table.mjs";function ok(){}const d=`phrasing`,f=[`autolink`,`link`,`image`,`label`];function gfmAutolinkLiteralFromMarkdown(){return{transforms:[transformGfmAutolinkLiterals],enter:{literalAutolink:enterLiteralAutolink,literalAutolinkEmail:enterLiteralAutolinkValue,literalAutolinkHttp:enterLiteralAutolinkValue,literalAutolinkWww:enterLiteralAutolinkValue},exit:{literalAutolink:exitLiteralAutolink,literalAutolinkEmail:exitLiteralAutolinkEmail,literalAutolinkHttp:exitLiteralAutolinkHttp,literalAutolinkWww:exitLiteralAutolinkWww}}}function gfmAutolinkLiteralToMarkdown(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:d,notInConstruct:f},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:d,notInConstruct:f},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:d,notInConstruct:f}]}}function enterLiteralAutolink(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function enterLiteralAutolinkValue(e){this.config.enter.autolinkProtocol.call(this,e)}function exitLiteralAutolinkHttp(e){this.config.exit.autolinkProtocol.call(this,e)}function exitLiteralAutolinkWww(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function exitLiteralAutolinkEmail(e){this.config.exit.autolinkEmail.call(this,e)}function exitLiteralAutolink(e){this.exit(e)}function transformGfmAutolinkLiterals(e){l(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,findUrl],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,findEmail]],{ignore:[`link`,`linkReference`]})}function findUrl(e,t,n,r,i){let a=``;if(!previous(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!isCorrectDomain(n)))return!1;let o=splitUrl(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function findEmail(e,t,n,r){return!previous(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function isCorrectDomain(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function splitUrl(e){let n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(`)`),a=t(e,`(`),o=t(e,`)`);for(;i!==-1&&a>o;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(`)`),o++;return[e,r]}function previous(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||o(r)||n(r))&&(!t||r!==47)}footnoteReference.peek=footnoteReferencePeek;function enterFootnoteCallString(){this.buffer()}function enterFootnoteCall(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function enterFootnoteDefinitionLabelString(){this.buffer()}function enterFootnoteDefinition(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function exitFootnoteCallString(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function exitFootnoteCall(e){this.exit(e)}function exitFootnoteDefinitionLabelString(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=a(this.sliceSerialize(e)).toLowerCase(),n.label=t}function exitFootnoteDefinition(e){this.exit(e)}function footnoteReferencePeek(){return`[`}function footnoteReference(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function gfmFootnoteFromMarkdown(){return{enter:{gfmFootnoteCallString:enterFootnoteCallString,gfmFootnoteCall:enterFootnoteCall,gfmFootnoteDefinitionLabelString:enterFootnoteDefinitionLabelString,gfmFootnoteDefinition:enterFootnoteDefinition},exit:{gfmFootnoteCallString:exitFootnoteCallString,gfmFootnoteCall:exitFootnoteCall,gfmFootnoteDefinitionLabelString:exitFootnoteDefinitionLabelString,gfmFootnoteDefinition:exitFootnoteDefinition}}}function gfmFootnoteToMarkdown(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition,footnoteReference},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function footnoteDefinition(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
2
2
  `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?mapAll:mapExceptFirst))),s(),o}}function mapExceptFirst(e,t,n){return t===0?e:mapAll(e,t,n)}function mapAll(e,t,n){return(n?``:` `)+e}const p=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];handleDelete.peek=peekDelete;function gfmStrikethroughFromMarkdown(){return{canContainEols:[`delete`],enter:{strikethrough:enterStrikethrough},exit:{strikethrough:exitStrikethrough}}}function gfmStrikethroughToMarkdown(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:p}],handlers:{delete:handleDelete}}}function enterStrikethrough(e){this.enter({type:`delete`,children:[]},e)}function exitStrikethrough(e){this.exit(e)}function handleDelete(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function peekDelete(){return`~`}function blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),map$1);return i(),o}function map$1(e,t,n){return`>`+(n?``:` `)+e}e(map$1,`map`);function patternInScope(e,t){return listInScope(e,t.inConstruct,!0)&&!listInScope(e,t.notInConstruct,!1)}function listInScope(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function hardBreak(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
3
3
  `&&patternInScope(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
4
4
  `}function longestStreak(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function formatCodeAsIndented(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function checkFence(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function code(e,t,n,r){let i=checkFence(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(formatCodeAsIndented(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,map);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(longestStreak(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
@@ -1,2 +1,2 @@
1
- import{i as e}from"../rolldown-runtime.mjs";function isPlainObject(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const normalizeDescriptors=e=>{t.forEach(t=>{n(e,t)})},t=[`name`,`message`,`stack`,`cause`,`errors`],n=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){r(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,r=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?r(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?r(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&r(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:r(e,`cause`,n)},isErrorInstance=e=>isInstanceOfError(e)||hasErrorTag(e),isInstanceOfError=e=>{try{return e instanceof Error}catch{return!1}},hasErrorTag=e=>{try{return i.has(Object.prototype.toString.call(e))}catch{return!1}},i=new Set([`[object Error]`,`[object DOMException]`,`[object DOMError]`,`[object Exception]`]),isNonModifiableError=e=>!Object.isExtensible(e)||t.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{r(e,`stack`,a(e.message,e.name))},a=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",t);return Object.defineProperty(n.prototype,"name",t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let n=getOwnKeys(e);for(let r of t)isInheritedProp(e,r)&&n.push(r);return n},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...s}=copyObject(e),c=o(n,s),l=newError(t,c);return n===c&&assignObjectProps(l,s),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},o=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<s?e:`${e.slice(0,s)}...`,s=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in c?new c[e](t):Error(t),c={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&r(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:l}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):isErrorInstance(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return isPlainObject(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return l.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(u(e.name))return;let t=Object.getPrototypeOf(e).name;r(e,`name`,u(t)?t:e.constructor.name)},normalizeMessage=e=>{u(e.message)||r(e,`message`,``)},normalizeStack=e=>{u(e.stack)||setStack(e)},u=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),d=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,f=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&f(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},p=e((e,t)=>{shouldUpdateStack(e,t)&&f(e,`stack`,h(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:m,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,"name",e),Object.defineProperty(StackError.prototype,"name",e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(m)},m=`SetErrorClassError`,h=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=g(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),g=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=d(r,t,n);return updatePrototype(r,t),p(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!isPlainObject(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,...s}=e,c=`value`in e;return validateDescriptor({enumerable:t,writable:n,configurable:r,get:a,set:o,unknownProps:s,hasValue:c}),{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,hasValue:c}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>(setProperty(e,t,mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t))),e),getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,t,n={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(t,`Second argument`),!isPlainObject(n))throw TypeError(`Options must be a plain object: ${n}`);let{soft:r=!1}=n;if(typeof r!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${r}`);return{soft:r}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>isPlainObject(e)||isErrorInstance(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!y.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in _||v.has(e),_=Error(`check`),v=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:y}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},b=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{t===n||!stackIncludesMessage()||setNonEnumProp(e,`stack`,b(e,t,n))},stackIncludesMessage=()=>{let{stack:e}=Error(x);return typeof e==`string`&&e.includes(x)},x=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(S)?n.endsWith(C)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,S=`:`,C=`
1
+ import{r as e}from"../rolldown-runtime.mjs";function isPlainObject(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}const normalizeDescriptors=e=>{t.forEach(t=>{n(e,t)})},t=[`name`,`message`,`stack`,`cause`,`errors`],n=e((e,t)=>{let n=getDescriptor(e,t);if(n!==void 0){if(isReadonlyGetter(n)){r(e,t,e[t]);return}isInvalidDescriptor(n)&&setErrorDescriptor(e,t,n)}},`normalizeDescriptor`),getDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?void 0:getDescriptor(r,t)},isReadonlyGetter=({get:e,set:t})=>e!==void 0&&t===void 0,isInvalidDescriptor=({enumerable:e,writable:t})=>e||!t,r=e((e,t,n)=>{setErrorDescriptor(e,t,{value:n})},`setErrorProperty`),setErrorDescriptor=(e,t,n)=>{Object.defineProperty(e,t,{...n,...`get`in n||`set`in n?{}:{writable:!0},enumerable:!1,configurable:!0})},normalizeAggregate=(e,t)=>{Array.isArray(e.errors)?r(e,`errors`,e.errors.filter(isDefined).map(t).filter(Boolean)):isAggregateError(e)?r(e,`errors`,[]):e.errors!==void 0&&deleteAggregateErrors(e)},isDefined=e=>e!==void 0,isAggregateError=e=>`AggregateError`in globalThis&&(e.name===`AggregateError`||e instanceof AggregateError),deleteAggregateErrors=e=>{delete e.errors,e.errors!==void 0&&r(e,`errors`,[])},normalizeCause=(e,t)=>{if(!(`cause`in e))return;let n=e.cause===void 0?e.cause:t(e.cause);n===void 0?delete e.cause:r(e,`cause`,n)},isErrorInstance=e=>isInstanceOfError(e)||hasErrorTag(e),isInstanceOfError=e=>{try{return e instanceof Error}catch{return!1}},hasErrorTag=e=>{try{return i.has(Object.prototype.toString.call(e))}catch{return!1}},i=new Set([`[object Error]`,`[object DOMException]`,`[object DOMError]`,`[object Exception]`]),isNonModifiableError=e=>!Object.isExtensible(e)||t.some(t=>isNonConfigurableProp(e,t)||isThrowingProp(e,t)),isNonConfigurableProp=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&!n.configurable},isThrowingProp=(e,t)=>{try{return e[t],!1}catch{return!0}},setStack=e=>{r(e,`stack`,a(e.message,e.name))},a=e((e=``,t=`Error`)=>{let{stack:n}=new(getErrorClass(t))(e);return typeof n==`string`&&n!==``?n:`${t}: ${e}`},`getStack`),getErrorClass=e=>{let t={value:e,enumerable:!1,writable:!0,configurable:!0},n=Object.defineProperty(class extends Error{},"name",t);return Object.defineProperty(n.prototype,"name",t),n},copyObject=e=>{let t={};for(let n of getPropsToCopy(e))try{let r=e[n],{enumerable:i,configurable:a,writable:o=!0}=getDescriptor(e,n);Object.defineProperty(t,n,{value:r,enumerable:i,configurable:a,writable:o})}catch{}return t},getPropsToCopy=e=>{let n=getOwnKeys(e);for(let r of t)isInheritedProp(e,r)&&n.push(r);return n},getOwnKeys=e=>{try{return Reflect.ownKeys(e)}catch{return[]}},isInheritedProp=(e,t)=>{try{return t in e&&!Object.hasOwn(e,t)}catch{return!1}},objectifyError=e=>{let{name:t,message:n,stack:r,cause:i,errors:a,...s}=copyObject(e),c=o(n,s),l=newError(t,c);return n===c&&assignObjectProps(l,s),Object.entries({name:t,stack:r,cause:i,errors:a}).forEach(([e,t])=>{setNewErrorProperty(l,e,t)}),r===void 0&&setStack(l),l},o=e((e,t)=>typeof e==`string`&&e!==``?e:truncateMessage(safeJsonStringify(t)),`getMessage`),safeJsonStringify=e=>{try{return JSON.stringify(e)}catch{return safeStringify(e)}},safeStringify=e=>{try{return String(e)}catch{return`Invalid error`}},truncateMessage=e=>e.length<s?e:`${e.slice(0,s)}...`,s=1e3,newError=(e,t)=>e===`AggregateError`&&`AggregateError`in globalThis?AggregateError([],t):e in c?new c[e](t):Error(t),c={Error,ReferenceError,TypeError,SyntaxError,RangeError,URIError,EvalError},assignObjectProps=(e,t)=>{for(let n in t)n in e||(e[n]=t[n])},setNewErrorProperty=(e,t,n)=>{n!==void 0&&r(e,t,n)},stringifyError=e=>{try{let t=Error(String(e));return setStack(t),t}catch(e){return e}},{toString:l}=Object.prototype,createError=e=>isErrorPlainObj(e)?objectifyError(e):isErrorInstance(e)?isInvalidError(e)?objectifyError(e):e:stringifyError(e),isErrorPlainObj=e=>{try{return isPlainObject(e)}catch{return!1}},isInvalidError=e=>isProxy(e)||isNonModifiableError(e)||hasInvalidConstructor(e),isProxy=e=>{try{return l.call(e)===`[object Object]`}catch{return!0}},hasInvalidConstructor=e=>typeof e.constructor!=`function`||typeof e.constructor.name!=`string`||e.constructor.name===``||e.constructor.prototype!==Object.getPrototypeOf(e),normalizeException=(e,{shallow:t=!1}={})=>recurseException(e,[],t),recurseException=(e,t,n)=>{if(t.includes(e))return;let r=n?identity:r=>recurseException(r,[...t,e],n),i=createError(e);return normalizeProps(i,r),i},identity=e=>e,normalizeProps=(e,t)=>{normalizeName(e),normalizeMessage(e),normalizeStack(e),normalizeCause(e,t),normalizeAggregate(e,t),normalizeDescriptors(e)},normalizeName=e=>{if(u(e.name))return;let t=Object.getPrototypeOf(e).name;r(e,`name`,u(t)?t:e.constructor.name)},normalizeMessage=e=>{u(e.message)||r(e,`message`,``)},normalizeStack=e=>{u(e.stack)||setStack(e)},u=e(e=>typeof e==`string`&&e!==``,`isDefinedString`),d=e((e,t,n=e.name)=>{if(validateErrorClass(t),typeof n!=`string`)throw TypeError(`currentName must be a string: ${n}`);return n},`normalizeArgs`),validateErrorClass=e=>{if(!isClass(e))throw TypeError(`ErrorClass must be a class: ${e}`);if(!isErrorClass(e.prototype))throw TypeError(`ErrorClass must inherit from Error: ${e}`);if(!hasConstructor(e))throw TypeError(`ErrorClass must be have a valid constructor: ${e}`)},isClass=e=>typeof e==`function`&&typeof e.prototype==`object`&&e.prototype!==null,isErrorClass=e=>e!==null&&(e.name===`Error`||isErrorClass(Object.getPrototypeOf(e))),hasConstructor=e=>typeof e.prototype.constructor==`function`,f=e((e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},`setNonEnumProp`),updatePrototype=(e,t)=>{Object.getPrototypeOf(e)!==t.prototype&&(setPrototype(e,t),deleteOwnProperty(e,`constructor`),fixName(e,t))},setPrototype=(e,t)=>{Object.setPrototypeOf(e,t.prototype)},fixName=(e,t)=>{deleteOwnProperty(e,`name`);let n=getClassName(t.prototype);e.name!==n&&f(e,`name`,n)},getClassName=e=>getPrototypeName(e)??getConstructorName(e)??getClassName(Object.getPrototypeOf(e)),getPrototypeName=e=>Object.hasOwn(e,`name`)&&isDefinedString(e.name)?e.name:void 0,getConstructorName=e=>typeof e.constructor==`function`&&isDefinedString(e.constructor.name)?e.constructor.name:void 0,isDefinedString=e=>typeof e==`string`&&e!==``,deleteOwnProperty=(e,t)=>{Object.hasOwn(e,t)&&delete e[t]},p=e((e,t)=>{shouldUpdateStack(e,t)&&f(e,`stack`,h(e,t))},`updateStack`),shouldUpdateStack=(e,t)=>t!==e.name&&t!==``&&e.stack.includes(t)&&stackIncludesName(),stackIncludesName=()=>{class StackError extends Error{}let e={value:m,enumerable:!1,writable:!0,configurable:!0};Object.defineProperty(StackError,"name",e),Object.defineProperty(StackError.prototype,"name",e);let{stack:t}=new StackError(``);return typeof t==`string`&&t.includes(m)},m=`SetErrorClassError`,h=e(({name:e,stack:t},n)=>{if(t.startsWith(`${n}: `))return t.replace(n,e);let[r,i]=g(n,e).find(([e])=>t.includes(e));return t.replace(r,i)},`getStack`),g=e((e,t)=>[[`\n${e}: `,`\n${t}: `],[`${e}: `,`${t}: `],[`${e} `,`${t} `],[e,t]],`getReplacers`),setErrorClass=(e,t,n)=>{let r=normalizeException(e),i=d(r,t,n);return updatePrototype(r,t),p(r,i),r},mergeDescriptors=(e,t)=>t.configurable===!1?mergeNonConfig(e,t):mergeConfig(e,t),mergeNonConfig=(e,t)=>({...t,...getNonConfigWritable(e,t),...getNonConfigValue(e,t)}),getNonConfigWritable=(e,t)=>t.writable===!0&&e.writable===!1?{writable:!1}:{},getNonConfigValue=(e,t)=>e.hasValue&&`value`in t&&t.writable===!0?{value:e.value}:{},mergeConfig=(e,t)=>{let n=mergeDescriptor(e.enumerable,t.enumerable,!0),r=mergeDescriptor(e.writable,t.writable,!0),i=mergeDescriptor(e.configurable,t.configurable,!0);return{...mergeValue(e,t,r),enumerable:n,configurable:i}},mergeValue=(e,t,n)=>e.hasValue?{value:e.value,writable:n}:!hasGetSet(e)&&!hasGetSet(t)?{value:t.value,writable:n}:{get:mergeDescriptor(e.get,t.get),set:mergeDescriptor(e.set,t.set)},hasGetSet=({get:e,set:t})=>e!==void 0||t!==void 0,mergeDescriptor=(e,t,n)=>e??t??n,normalizeInput=(e,t,n)=>{if(!isAnyObj(e))throw TypeError(`Argument must be an object: ${e}`);if(!isValidKey(t))throw TypeError(`Property key must be a string, a symbol or an integer: ${t}`);return normalizeDescriptor(n)},isAnyObj=e=>typeof e==`object`&&!!e,isValidKey=e=>{let t=typeof e;return t===`string`||t===`symbol`||t===`number`},normalizeDescriptor=e=>{if(!isPlainObject(e))throw TypeError(`Descriptor must be a plain object: ${e}`);let{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,...s}=e,c=`value`in e;return validateDescriptor({enumerable:t,writable:n,configurable:r,get:a,set:o,unknownProps:s,hasValue:c}),{enumerable:t,writable:n,configurable:r,value:i,get:a,set:o,hasValue:c}},validateDescriptor=({enumerable:e,writable:t,configurable:n,get:r,set:i,unknownProps:a,hasValue:o})=>{validateGetSet(o,r,`get`),validateGetSet(o,i,`set`),validateBoolean(e,`enumerable`),validateBoolean(t,`writable`),validateBoolean(n,`configurable`),validateUnknownProps(a)},validateGetSet=(e,t,n)=>{if(validateFunction(t,n),e&&t!==void 0)throw TypeError(`Descriptor property "value" and "${n}" must not both be defined: ${t}`)},validateFunction=(e,t)=>{if(e!==void 0&&typeof e!=`function`)throw TypeError(`Descriptor property "${t}" must be a function: ${e}`)},validateBoolean=(e,t)=>{if(e!==void 0&&typeof e!=`boolean`)throw TypeError(`Descriptor property "${t}" must be a boolean: ${e}`)},validateUnknownProps=e=>{let[t]=Object.keys(e);if(t!==void 0)throw TypeError(`Unknown descriptor property "${t}": ${e[t]}`)},redefineProperty=(e,t,n)=>{let r=mergeDescriptors(normalizeInput(e,t,n),getCurrentDescriptor(e,t));return setProperty(e,t,r),e},getCurrentDescriptor=(e,t)=>{let n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n;let r=Object.getPrototypeOf(e);return r===null?{}:getCurrentDescriptor(r,t)},setProperty=(e,t,n)=>{try{Object.defineProperty(e,t,n)}catch{}},assignProp=(e,t,n)=>{if(n!==void 0)return setProp(e,t,n);try{delete e[t]}catch{}if(e[t]!==void 0)return setProp(e,t)},setProp=(e,t,n)=>{redefineProperty(e,t,{value:n,...getNonEnum(t)})},getNonEnum=e=>typeof e==`string`&&e.startsWith(`_`)?{enumerable:!1}:{},normalizeOptions=(e,t,n={})=>{if(validateErrorOrObject(e,`First argument`),validateErrorOrObject(t,`Second argument`),!isPlainObject(n))throw TypeError(`Options must be a plain object: ${n}`);let{soft:r=!1}=n;if(typeof r!=`boolean`)throw TypeError(`Option "soft" must be a boolean: ${r}`);return{soft:r}},validateErrorOrObject=(e,t)=>{if(e===void 0)throw TypeError(`${t} is required.`);if(!isErrorOrObject(e))throw TypeError(`${t} must be a plain object or an error: ${e}`)},isErrorOrObject=e=>isPlainObject(e)||isErrorInstance(e),shouldSkipProp=({error:e,props:t,propName:n,soft:r})=>isIgnoredPropName(n)||!y.call(t,n)||r&&e[n]!==void 0,isIgnoredPropName=e=>e in _||v.has(e),_=Error(`check`),v=new Set([`prototype`,`errors`,`cause`]),{propertyIsEnumerable:y}=Object.prototype,setErrorProps=(e,t,n)=>{let{soft:r}=normalizeOptions(e,t,n);for(let n of Reflect.ownKeys(t))setErrorProp({error:e,props:t,propName:n,soft:r});return e},setErrorProp=({error:e,props:t,propName:n,soft:r})=>{shouldSkipProp({error:e,props:t,propName:n,soft:r})||assignProp(e,n,t[n])},setErrorProperty=(e,t,n)=>{Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!1,configurable:!0})},mergeAggregateCauses=(e,t)=>{e.errors!==void 0&&setErrorProperty(e,`errors`,e.errors.map(e=>t(e).error).filter(Boolean))},mergeAggregateErrors=({target:e,source:t,parent:n,child:r})=>{if(!hasErrors(e)){mergeSourceErrors(e,t);return}hasErrors(t)&&setErrorProperty(e,`errors`,[...r.errors,...n.errors])},mergeSourceErrors=(e,t)=>{t.errors!==void 0&&setErrorProperty(e,`errors`,t.errors)},hasErrors=e=>e.errors!==void 0&&e.errors.length!==0,normalizeArgs=(e,t,n=e.message)=>{if(typeof t!=`string`)throw TypeError(`newMessage must be a string: ${t}`);if(typeof n!=`string`)throw TypeError(`currentMessage must be a string: ${n}`);return n},b=e(({name:e,stack:t},n,r)=>r!==``&&t.includes(r)?replaceMessage({name:e,stack:t,newMessage:n,currentMessage:r}):insertMessage(e,t,n),`getStack`),replaceMessage=({name:e,stack:t,newMessage:n,currentMessage:r})=>{let[i,a]=getReplacers(e,n,r).find(([e])=>t.includes(e));return t.replace(i,a)},getReplacers=(e,t,n)=>[[`${e}: ${n}`,`${e}: ${t}`],[`: ${n}`,`: ${t}`],[`\n${n}`,`\n${t}`],[` ${n}`,` ${t}`],[n,t]],insertMessage=(e,t,n)=>{let r=`${e}: `,i=n.trimEnd();return t===e||t.startsWith(`${e}\n`)?t.replace(e,`${r}${i}`):t.startsWith(r)?t.replace(r,`${r}${i}\n`):`${r}${i}\n${t}`},setErrorMessage=(e,t,n)=>{let r=normalizeException(e),i=normalizeArgs(r,t,n);return setNonEnumProp(r,`message`,t),updateStack(r,t,i),r},updateStack=(e,t,n)=>{if(t===n||!stackIncludesMessage())return;let r=b(e,t,n);setNonEnumProp(e,`stack`,r)},stackIncludesMessage=()=>{let{stack:e}=Error(x);return typeof e==`string`&&e.includes(x)},x=`set-error-message test message`,setNonEnumProp=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})},wrapErrorMessage=(e,t,n)=>{if(typeof t!=`string`)throw TypeError(`Second argument must be a message string: ${t}`);let r=normalizeException(e);return setErrorMessage(r,getMessage(t,r.message),n)},getMessage=(e,t)=>{let n=e.trim(),r=t.trim();return n===``?r:r===``?n:concatMessages(n,r,e)},concatMessages=(e,t,n)=>e.endsWith(S)?n.endsWith(C)?`${e}\n${t}`:`${e} ${t}`:`${t}\n${e}`,S=`:`,C=`
2
2
  `,mergeMessage=({parent:e,child:t,target:n,stackError:r})=>{let i=e.message,a=r.message;return n.message=t.message,wrapErrorMessage(n,i,a)},hasStack=(e,t)=>getStack(e)===t,getStack=e=>typeof e==`object`&&e?e.stack:void 0,mergeStack=({wrap:e,target:t,source:n,childHasStack:r})=>e===r?t:(setErrorProperty(t,`stack`,n.stack),n),getWrap=e=>{let{wrap:t,name:n}=e;return typeof t==`boolean`?(Object.hasOwn(e,`wrap`)&&delete e.wrap,t):n===`Error`},mergeErrorCause=e=>mergeError(e,[]).error,mergeError=(e,t)=>{if(t.includes(e))return{};let recurse=n=>mergeError(n,[...t,e]),n=getStack(e),r=normalizeException(e,{shallow:!0}),i=hasStack(r,n);mergeAggregateCauses(r,recurse);let{parent:a,childHasStack:o}=mergeCause(r,recurse);return{error:a,errorHasStack:i||o}},mergeCause=(e,t)=>{let n=getWrap(e);if(e.cause===void 0)return{parent:e,childHasStack:!1};let{error:r,errorHasStack:i}=t(e.cause);return delete e.cause,{parent:mergeChild({parent:e,child:r,childHasStack:i,wrap:n}),childHasStack:i}},mergeChild=({parent:e,child:t,childHasStack:n,wrap:r})=>{if(t===void 0)return e;let[i,a]=r?[t,e]:[e,t],o=mergeStack({wrap:r,target:i,source:a,childHasStack:n}),s=mergeMessage({parent:e,child:t,target:setErrorClass(i,i.constructor,o.name),stackError:o});return mergeAggregateErrors({target:s,source:a,parent:e,child:t}),setErrorProps(s,a,{soft:!r})};export{wrapErrorMessage as n,isPlainObject as r,mergeErrorCause as t};
@@ -1 +1 @@
1
- import"../rolldown-runtime.mjs";import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,r as d,s as f,u as p,v as m}from"./mdast-util-from-markdown.mjs";const h={tokenize:tokenizeWwwPrefix,partial:!0},g={tokenize:tokenizeDomain,partial:!0},_={tokenize:tokenizePath,partial:!0},v={tokenize:tokenizeTrail,partial:!0},y={tokenize:tokenizeEmailDomainDotTrail,partial:!0},b={name:`wwwAutolink`,tokenize:tokenizeWwwAutolink,previous:previousWww},x={name:`protocolAutolink`,tokenize:tokenizeProtocolAutolink,previous:previousProtocol},S={name:`emailAutolink`,tokenize:tokenizeEmailAutolink,previous:previousEmail},C={};function gfmAutolinkLiteral(){return{text:C}}let w=48;for(;w<123;)C[w]=S,w++,w===58?w=65:w===91&&(w=97);C[43]=S,C[45]=S,C[46]=S,C[95]=S,C[72]=[S,x],C[104]=[S,x],C[87]=[S,b],C[119]=[S,b];function tokenizeEmailAutolink(e,t,i){let a=this,o,s;return start;function start(t){return!gfmAtext(t)||!previousEmail.call(a,a.previous)||previousUnbalanced(a.events)?i(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),atext(t))}function atext(t){return gfmAtext(t)?(e.consume(t),atext):t===64?(e.consume(t),emailDomain):i(t)}function emailDomain(t){return t===46?e.check(y,emailDomainAfter,emailDomainDot)(t):t===45||t===95||r(t)?(s=!0,e.consume(t),emailDomain):emailDomainAfter(t)}function emailDomainDot(t){return e.consume(t),o=!0,emailDomain}function emailDomainAfter(r){return s&&o&&n(a.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(r)):i(r)}}function tokenizeWwwAutolink(e,t,n){let r=this;return wwwStart;function wwwStart(t){return t!==87&&t!==119||!previousWww.call(r,r.previous)||previousUnbalanced(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(h,e.attempt(g,e.attempt(_,wwwAfter),n),n)(t))}function wwwAfter(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function tokenizeProtocolAutolink(t,r,i){let o=this,s=``,c=!1;return protocolStart;function protocolStart(e){return(e===72||e===104)&&previousProtocol.call(o,o.previous)&&!previousUnbalanced(o.events)?(t.enter(`literalAutolink`),t.enter(`literalAutolinkHttp`),s+=String.fromCodePoint(e),t.consume(e),protocolPrefixInside):i(e)}function protocolPrefixInside(e){if(n(e)&&s.length<5)return s+=String.fromCodePoint(e),t.consume(e),protocolPrefixInside;if(e===58){let n=s.toLowerCase();if(n===`http`||n===`https`)return t.consume(e),protocolSlashesInside}return i(e)}function protocolSlashesInside(e){return e===47?(t.consume(e),c?afterProtocol:(c=!0,protocolSlashesInside)):i(e)}function afterProtocol(n){return n===null||u(n)||a(n)||m(n)||e(n)?i(n):t.attempt(g,t.attempt(_,protocolAfter),i)(n)}function protocolAfter(e){return t.exit(`literalAutolinkHttp`),t.exit(`literalAutolink`),r(e)}}function tokenizeWwwPrefix(e,t,n){let r=0;return wwwPrefixInside;function wwwPrefixInside(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),wwwPrefixInside):t===46&&r===3?(e.consume(t),wwwPrefixAfter):n(t)}function wwwPrefixAfter(e){return e===null?n(e):t(e)}}function tokenizeDomain(t,n,r){let i,o,s;return domainInside;function domainInside(n){return n===46||n===95?t.check(v,domainAfter,domainAtPunctuation)(n):n===null||a(n)||m(n)||n!==45&&e(n)?domainAfter(n):(s=!0,t.consume(n),domainInside)}function domainAtPunctuation(e){return e===95?i=!0:(o=i,i=void 0),t.consume(e),domainInside}function domainAfter(e){return o||i||!s?r(e):n(e)}}function tokenizePath(e,t){let n=0,r=0;return pathInside;function pathInside(i){return i===40?(n++,e.consume(i),pathInside):i===41&&r<n?pathAtPunctuation(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(v,t,pathAtPunctuation)(i):i===null||a(i)||m(i)?t(i):(e.consume(i),pathInside)}function pathAtPunctuation(t){return t===41&&r++,e.consume(t),pathInside}}function tokenizeTrail(e,t,r){return trail;function trail(n){return n===33||n===34||n===39||n===41||n===42||n===44||n===46||n===58||n===59||n===63||n===95||n===126?(e.consume(n),trail):n===38?(e.consume(n),trailCharacterReferenceStart):n===93?(e.consume(n),trailBracketAfter):n===60||n===null||a(n)||m(n)?t(n):r(n)}function trailBracketAfter(e){return e===null||e===40||e===91||a(e)||m(e)?t(e):trail(e)}function trailCharacterReferenceStart(e){return n(e)?trailCharacterReferenceInside(e):r(e)}function trailCharacterReferenceInside(t){return t===59?(e.consume(t),trail):n(t)?(e.consume(t),trailCharacterReferenceInside):r(t)}}function tokenizeEmailDomainDotTrail(e,t,n){return start;function start(t){return e.consume(t),after}function after(e){return r(e)?n(e):t(e)}}function previousWww(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||a(e)}function previousProtocol(e){return!n(e)}function previousEmail(e){return!(e===47||gfmAtext(e))}function gfmAtext(e){return e===43||e===45||e===46||e===95||r(e)}function previousUnbalanced(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const T={tokenize:tokenizeIndent,partial:!0};function gfmFootnote(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:tokenizeDefinitionStart,continuation:{tokenize:tokenizeDefinitionContinuation},exit:gfmFootnoteDefinitionEnd}},text:{91:{name:`gfmFootnoteCall`,tokenize:tokenizeGfmFootnoteCall},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:tokenizePotentialGfmFootnoteCall,resolveTo:resolveToPotentialGfmFootnoteCall}}}}function tokenizePotentialGfmFootnoteCall(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return start;function start(i){if(!o||!o._balanced)return n(i);let s=p(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function resolveToPotentialGfmFootnoteCall(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function tokenizeGfmFootnoteCall(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o=0,s;return start;function start(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),callStart}function callStart(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,callData):n(t)}function callData(c){if(o>999||c===93&&!s||c===null||c===91||a(c))return n(c);if(c===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(p(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(c),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(c)}return a(c)||(s=!0),o++,e.consume(c),c===92?callEscape:callData}function callEscape(t){return t===91||t===92||t===93?(e.consume(t),o++,callData):callData(t)}}function tokenizeDefinitionStart(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),s,c=0,l;return start;function start(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),labelAtMarker}function labelAtMarker(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,labelInside):n(t)}function labelInside(t){if(c>999||t===93&&!l||t===null||t===91||a(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return s=p(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),labelAfter}return a(t)||(l=!0),c++,e.consume(t),t===92?labelEscape:labelInside}function labelEscape(t){return t===91||t===92||t===93?(e.consume(t),c++,labelInside):labelInside(t)}function labelAfter(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(s)||i.push(s),o(e,whitespaceAfter,`gfmFootnoteDefinitionWhitespace`)):n(t)}function whitespaceAfter(e){return t(e)}}function tokenizeDefinitionContinuation(e,t,n){return e.check(d,t,e.attempt(T,t,n))}function gfmFootnoteDefinitionEnd(e){e.exit(`gfmFootnoteDefinition`)}function tokenizeIndent(e,t,n){let r=this;return o(e,afterPrefix,`gfmFootnoteDefinitionIndent`,5);function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function gfmStrikethrough(e){let n=(e||{}).singleTilde,r={name:`strikethrough`,tokenize:tokenizeStrikethrough,resolveAll:resolveAllStrikethrough};return n??=!0,{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function resolveAllStrikethrough(e,n){let r=-1;for(;++r<e.length;)if(e[r][0]===`enter`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._close){let i=r;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`strikethroughSequenceTemporary`&&e[i][1]._open&&e[r][1].end.offset-e[r][1].start.offset===e[i][1].end.offset-e[i][1].start.offset){e[r][1].type=`strikethroughSequence`,e[i][1].type=`strikethroughSequence`;let a={type:`strikethrough`,start:Object.assign({},e[i][1].start),end:Object.assign({},e[r][1].end)},o={type:`strikethroughText`,start:Object.assign({},e[i][1].end),end:Object.assign({},e[r][1].start)},s=[[`enter`,a,n],[`enter`,e[i][1],n],[`exit`,e[i][1],n],[`enter`,o,n]],c=n.parser.constructs.insideSpan.null;c&&f(s,s.length,0,t(c,e.slice(i+1,r),n)),f(s,s.length,0,[[`exit`,o,n],[`enter`,e[r][1],n],[`exit`,e[r][1],n],[`exit`,a,n]]),f(e,i-1,r-i+3,s),r=i+s.length-2;break}}for(r=-1;++r<e.length;)e[r][1].type===`strikethroughSequenceTemporary`&&(e[r][1].type=`data`);return e}function tokenizeStrikethrough(e,t,r){let i=this.previous,a=this.events,o=0;return start;function start(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),more(t))}function more(a){let c=s(i);if(a===126)return o>1?r(a):(e.consume(a),o++,more);if(o<2&&!n)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=s(a);return l._open=!u||u===2&&!!c,l._close=!c||c===2&&!!u,t(a)}}}var EditMap=class{constructor(){this.map=[]}add(e,t,n){addImplementation(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function addImplementation(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function gfmTableAlign(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function gfmTable(){return{flow:{null:{name:`table`,tokenize:tokenizeTable,resolveAll:resolveTable}}}}function tokenizeTable(e,t,n){let r=this,s=0,l=0,u;return start;function start(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?bodyRowStart:headRowBefore;return a===bodyRowStart&&r.parser.lazy[r.now().line]?n(e):a(e)}function headRowBefore(t){return e.enter(`tableHead`),e.enter(`tableRow`),headRowStart(t)}function headRowStart(e){return e===124?headRowBreak(e):(u=!0,l+=1,headRowBreak(e))}function headRowBreak(t){return t===null?n(t):c(t)?l>1?(l=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),headDelimiterStart):n(t):i(t)?o(e,headRowBreak,`whitespace`)(t):(l+=1,u&&(u=!1,s+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),u=!0,headRowBreak):(e.enter(`data`),headRowData(t)))}function headRowData(t){return t===null||t===124||a(t)?(e.exit(`data`),headRowBreak(t)):(e.consume(t),t===92?headRowEscape:headRowData)}function headRowEscape(t){return t===92||t===124?(e.consume(t),headRowData):headRowData(t)}function headDelimiterStart(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),u=!1,i(t)?o(e,headDelimiterBefore,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):headDelimiterBefore(t))}function headDelimiterBefore(t){return t===45||t===58?headDelimiterValueBefore(t):t===124?(u=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),headDelimiterCellBefore):headDelimiterNok(t)}function headDelimiterCellBefore(t){return i(t)?o(e,headDelimiterValueBefore,`whitespace`)(t):headDelimiterValueBefore(t)}function headDelimiterValueBefore(t){return t===58?(l+=1,u=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),headDelimiterLeftAlignmentAfter):t===45?(l+=1,headDelimiterLeftAlignmentAfter(t)):t===null||c(t)?headDelimiterCellAfter(t):headDelimiterNok(t)}function headDelimiterLeftAlignmentAfter(t){return t===45?(e.enter(`tableDelimiterFiller`),headDelimiterFiller(t)):headDelimiterNok(t)}function headDelimiterFiller(t){return t===45?(e.consume(t),headDelimiterFiller):t===58?(u=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),headDelimiterRightAlignmentAfter):(e.exit(`tableDelimiterFiller`),headDelimiterRightAlignmentAfter(t))}function headDelimiterRightAlignmentAfter(t){return i(t)?o(e,headDelimiterCellAfter,`whitespace`)(t):headDelimiterCellAfter(t)}function headDelimiterCellAfter(n){return n===124?headDelimiterBefore(n):n===null||c(n)?!u||s!==l?headDelimiterNok(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):headDelimiterNok(n)}function headDelimiterNok(e){return n(e)}function bodyRowStart(t){return e.enter(`tableRow`),bodyRowBreak(t)}function bodyRowBreak(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),bodyRowBreak):n===null||c(n)?(e.exit(`tableRow`),t(n)):i(n)?o(e,bodyRowBreak,`whitespace`)(n):(e.enter(`data`),bodyRowData(n))}function bodyRowData(t){return t===null||t===124||a(t)?(e.exit(`data`),bodyRowBreak(t)):(e.consume(t),t===92?bodyRowEscape:bodyRowData)}function bodyRowEscape(t){return t===92||t===124?(e.consume(t),bodyRowData):bodyRowData(t)}}function resolveTable(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new EditMap;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(flushTableEnd(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=flushCell(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=flushCell(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=flushCell(f,t,o,i,n,d)):(o[0]=o[1],d=flushCell(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&flushTableEnd(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gfmTableAlign(t.events,n))}return e}function flushCell(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},getPoint(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=getPoint(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=getPoint(t.events,n[2]),a=getPoint(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},getPoint(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function flushTableEnd(e,t,n,r,i){let a=[],o=getPoint(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function getPoint(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const E={name:`tasklistCheck`,tokenize:tokenizeTasklistCheck};function gfmTaskListItem(){return{text:{91:E}}}function tokenizeTasklistCheck(e,t,n){let r=this;return open;function open(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),inside)}function inside(t){return a(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),close):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),close):n(t)}function close(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),after):n(t)}function after(r){return c(r)?t(r):i(r)?e.check({tokenize:spaceThenNonSpace},t,n)(r):n(r)}}function spaceThenNonSpace(e,t,n){return o(e,after,`whitespace`);function after(e){return e===null?n(e):t(e)}}function gfm(e){return l([gfmAutolinkLiteral(),gfmFootnote(),gfmStrikethrough(e),gfmTable(),gfmTaskListItem()])}export{gfm as t};
1
+ import"../rolldown-runtime.mjs";import{_ as e,a as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,o as l,p as u,r as d,s as f,u as p,v as m}from"./mdast-util-from-markdown.mjs";const h={tokenize:tokenizeWwwPrefix,partial:!0},g={tokenize:tokenizeDomain,partial:!0},_={tokenize:tokenizePath,partial:!0},v={tokenize:tokenizeTrail,partial:!0},y={tokenize:tokenizeEmailDomainDotTrail,partial:!0},b={name:`wwwAutolink`,tokenize:tokenizeWwwAutolink,previous:previousWww},x={name:`protocolAutolink`,tokenize:tokenizeProtocolAutolink,previous:previousProtocol},S={name:`emailAutolink`,tokenize:tokenizeEmailAutolink,previous:previousEmail},C={};function gfmAutolinkLiteral(){return{text:C}}let w=48;for(;w<123;)C[w]=S,w++,w===58?w=65:w===91&&(w=97);C[43]=S,C[45]=S,C[46]=S,C[95]=S,C[72]=[S,x],C[104]=[S,x],C[87]=[S,b],C[119]=[S,b];function tokenizeEmailAutolink(e,t,i){let a=this,o,s;return start;function start(t){return!gfmAtext(t)||!previousEmail.call(a,a.previous)||previousUnbalanced(a.events)?i(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),atext(t))}function atext(t){return gfmAtext(t)?(e.consume(t),atext):t===64?(e.consume(t),emailDomain):i(t)}function emailDomain(t){return t===46?e.check(y,emailDomainAfter,emailDomainDot)(t):t===45||t===95||r(t)?(s=!0,e.consume(t),emailDomain):emailDomainAfter(t)}function emailDomainDot(t){return e.consume(t),o=!0,emailDomain}function emailDomainAfter(r){return s&&o&&n(a.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(r)):i(r)}}function tokenizeWwwAutolink(e,t,n){let r=this;return wwwStart;function wwwStart(t){return t!==87&&t!==119||!previousWww.call(r,r.previous)||previousUnbalanced(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(h,e.attempt(g,e.attempt(_,wwwAfter),n),n)(t))}function wwwAfter(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function tokenizeProtocolAutolink(t,r,i){let o=this,s=``,c=!1;return protocolStart;function protocolStart(e){return(e===72||e===104)&&previousProtocol.call(o,o.previous)&&!previousUnbalanced(o.events)?(t.enter(`literalAutolink`),t.enter(`literalAutolinkHttp`),s+=String.fromCodePoint(e),t.consume(e),protocolPrefixInside):i(e)}function protocolPrefixInside(e){if(n(e)&&s.length<5)return s+=String.fromCodePoint(e),t.consume(e),protocolPrefixInside;if(e===58){let n=s.toLowerCase();if(n===`http`||n===`https`)return t.consume(e),protocolSlashesInside}return i(e)}function protocolSlashesInside(e){return e===47?(t.consume(e),c?afterProtocol:(c=!0,protocolSlashesInside)):i(e)}function afterProtocol(n){return n===null||u(n)||a(n)||m(n)||e(n)?i(n):t.attempt(g,t.attempt(_,protocolAfter),i)(n)}function protocolAfter(e){return t.exit(`literalAutolinkHttp`),t.exit(`literalAutolink`),r(e)}}function tokenizeWwwPrefix(e,t,n){let r=0;return wwwPrefixInside;function wwwPrefixInside(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),wwwPrefixInside):t===46&&r===3?(e.consume(t),wwwPrefixAfter):n(t)}function wwwPrefixAfter(e){return e===null?n(e):t(e)}}function tokenizeDomain(t,n,r){let i,o,s;return domainInside;function domainInside(n){return n===46||n===95?t.check(v,domainAfter,domainAtPunctuation)(n):n===null||a(n)||m(n)||n!==45&&e(n)?domainAfter(n):(s=!0,t.consume(n),domainInside)}function domainAtPunctuation(e){return e===95?i=!0:(o=i,i=void 0),t.consume(e),domainInside}function domainAfter(e){return o||i||!s?r(e):n(e)}}function tokenizePath(e,t){let n=0,r=0;return pathInside;function pathInside(i){return i===40?(n++,e.consume(i),pathInside):i===41&&r<n?pathAtPunctuation(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(v,t,pathAtPunctuation)(i):i===null||a(i)||m(i)?t(i):(e.consume(i),pathInside)}function pathAtPunctuation(t){return t===41&&r++,e.consume(t),pathInside}}function tokenizeTrail(e,t,r){return trail;function trail(n){return n===33||n===34||n===39||n===41||n===42||n===44||n===46||n===58||n===59||n===63||n===95||n===126?(e.consume(n),trail):n===38?(e.consume(n),trailCharacterReferenceStart):n===93?(e.consume(n),trailBracketAfter):n===60||n===null||a(n)||m(n)?t(n):r(n)}function trailBracketAfter(e){return e===null||e===40||e===91||a(e)||m(e)?t(e):trail(e)}function trailCharacterReferenceStart(e){return n(e)?trailCharacterReferenceInside(e):r(e)}function trailCharacterReferenceInside(t){return t===59?(e.consume(t),trail):n(t)?(e.consume(t),trailCharacterReferenceInside):r(t)}}function tokenizeEmailDomainDotTrail(e,t,n){return start;function start(t){return e.consume(t),after}function after(e){return r(e)?n(e):t(e)}}function previousWww(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||a(e)}function previousProtocol(e){return!n(e)}function previousEmail(e){return!(e===47||gfmAtext(e))}function gfmAtext(e){return e===43||e===45||e===46||e===95||r(e)}function previousUnbalanced(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const T={tokenize:tokenizeIndent,partial:!0};function gfmFootnote(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:tokenizeDefinitionStart,continuation:{tokenize:tokenizeDefinitionContinuation},exit:gfmFootnoteDefinitionEnd}},text:{91:{name:`gfmFootnoteCall`,tokenize:tokenizeGfmFootnoteCall},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:tokenizePotentialGfmFootnoteCall,resolveTo:resolveToPotentialGfmFootnoteCall}}}}function tokenizePotentialGfmFootnoteCall(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return start;function start(i){if(!o||!o._balanced)return n(i);let s=p(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function resolveToPotentialGfmFootnoteCall(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function tokenizeGfmFootnoteCall(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o=0,s;return start;function start(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),callStart}function callStart(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,callData):n(t)}function callData(c){if(o>999||c===93&&!s||c===null||c===91||a(c))return n(c);if(c===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(p(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(c),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(c)}return a(c)||(s=!0),o++,e.consume(c),c===92?callEscape:callData}function callEscape(t){return t===91||t===92||t===93?(e.consume(t),o++,callData):callData(t)}}function tokenizeDefinitionStart(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),s,c=0,l;return start;function start(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),labelAtMarker}function labelAtMarker(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,labelInside):n(t)}function labelInside(t){if(c>999||t===93&&!l||t===null||t===91||a(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return s=p(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),labelAfter}return a(t)||(l=!0),c++,e.consume(t),t===92?labelEscape:labelInside}function labelEscape(t){return t===91||t===92||t===93?(e.consume(t),c++,labelInside):labelInside(t)}function labelAfter(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(s)||i.push(s),o(e,whitespaceAfter,`gfmFootnoteDefinitionWhitespace`)):n(t)}function whitespaceAfter(e){return t(e)}}function tokenizeDefinitionContinuation(e,t,n){return e.check(d,t,e.attempt(T,t,n))}function gfmFootnoteDefinitionEnd(e){e.exit(`gfmFootnoteDefinition`)}function tokenizeIndent(e,t,n){let r=this;return o(e,afterPrefix,`gfmFootnoteDefinitionIndent`,5);function afterPrefix(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function gfmStrikethrough(e){let n=(e||{}).singleTilde,r={name:`strikethrough`,tokenize:tokenizeStrikethrough,resolveAll:resolveAllStrikethrough};return n??=!0,{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function resolveAllStrikethrough(e,n){let r=-1;for(;++r<e.length;)if(e[r][0]===`enter`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._close){let i=r;for(;i--;)if(e[i][0]===`exit`&&e[i][1].type===`strikethroughSequenceTemporary`&&e[i][1]._open&&e[r][1].end.offset-e[r][1].start.offset===e[i][1].end.offset-e[i][1].start.offset){e[r][1].type=`strikethroughSequence`,e[i][1].type=`strikethroughSequence`;let a={type:`strikethrough`,start:Object.assign({},e[i][1].start),end:Object.assign({},e[r][1].end)},o={type:`strikethroughText`,start:Object.assign({},e[i][1].end),end:Object.assign({},e[r][1].start)},s=[[`enter`,a,n],[`enter`,e[i][1],n],[`exit`,e[i][1],n],[`enter`,o,n]],c=n.parser.constructs.insideSpan.null;c&&f(s,s.length,0,t(c,e.slice(i+1,r),n)),f(s,s.length,0,[[`exit`,o,n],[`enter`,e[r][1],n],[`exit`,e[r][1],n],[`exit`,a,n]]),f(e,i-1,r-i+3,s),r=i+s.length-2;break}}for(r=-1;++r<e.length;)e[r][1].type===`strikethroughSequenceTemporary`&&(e[r][1].type=`data`);return e}function tokenizeStrikethrough(e,t,r){let i=this.previous,a=this.events,o=0;return start;function start(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),more(t))}function more(a){let c=s(i);if(a===126)return o>1?r(a):(e.consume(a),o++,more);if(o<2&&!n)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=s(a);return l._open=!u||u===2&&!!c,l._close=!c||c===2&&!!u,t(a)}}}var EditMap=class{constructor(){this.map=[]}add(e,t,n){addImplementation(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function addImplementation(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function gfmTableAlign(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function gfmTable(){return{flow:{null:{name:`table`,tokenize:tokenizeTable,resolveAll:resolveTable}}}}function tokenizeTable(e,t,n){let r=this,s=0,l=0,u;return start;function start(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?bodyRowStart:headRowBefore;return a===bodyRowStart&&r.parser.lazy[r.now().line]?n(e):a(e)}function headRowBefore(t){return e.enter(`tableHead`),e.enter(`tableRow`),headRowStart(t)}function headRowStart(e){return e===124?headRowBreak(e):(u=!0,l+=1,headRowBreak(e))}function headRowBreak(t){return t===null?n(t):c(t)?l>1?(l=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),headDelimiterStart):n(t):i(t)?o(e,headRowBreak,`whitespace`)(t):(l+=1,u&&(u=!1,s+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),u=!0,headRowBreak):(e.enter(`data`),headRowData(t)))}function headRowData(t){return t===null||t===124||a(t)?(e.exit(`data`),headRowBreak(t)):(e.consume(t),t===92?headRowEscape:headRowData)}function headRowEscape(t){return t===92||t===124?(e.consume(t),headRowData):headRowData(t)}function headDelimiterStart(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),u=!1,i(t)?o(e,headDelimiterBefore,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):headDelimiterBefore(t))}function headDelimiterBefore(t){return t===45||t===58?headDelimiterValueBefore(t):t===124?(u=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),headDelimiterCellBefore):headDelimiterNok(t)}function headDelimiterCellBefore(t){return i(t)?o(e,headDelimiterValueBefore,`whitespace`)(t):headDelimiterValueBefore(t)}function headDelimiterValueBefore(t){return t===58?(l+=1,u=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),headDelimiterLeftAlignmentAfter):t===45?(l+=1,headDelimiterLeftAlignmentAfter(t)):t===null||c(t)?headDelimiterCellAfter(t):headDelimiterNok(t)}function headDelimiterLeftAlignmentAfter(t){return t===45?(e.enter(`tableDelimiterFiller`),headDelimiterFiller(t)):headDelimiterNok(t)}function headDelimiterFiller(t){return t===45?(e.consume(t),headDelimiterFiller):t===58?(u=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),headDelimiterRightAlignmentAfter):(e.exit(`tableDelimiterFiller`),headDelimiterRightAlignmentAfter(t))}function headDelimiterRightAlignmentAfter(t){return i(t)?o(e,headDelimiterCellAfter,`whitespace`)(t):headDelimiterCellAfter(t)}function headDelimiterCellAfter(n){return n===124?headDelimiterBefore(n):n===null||c(n)?!u||s!==l?headDelimiterNok(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):headDelimiterNok(n)}function headDelimiterNok(e){return n(e)}function bodyRowStart(t){return e.enter(`tableRow`),bodyRowBreak(t)}function bodyRowBreak(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),bodyRowBreak):n===null||c(n)?(e.exit(`tableRow`),t(n)):i(n)?o(e,bodyRowBreak,`whitespace`)(n):(e.enter(`data`),bodyRowData(n))}function bodyRowData(t){return t===null||t===124||a(t)?(e.exit(`data`),bodyRowBreak(t)):(e.consume(t),t===92?bodyRowEscape:bodyRowData)}function bodyRowEscape(t){return t===92||t===124?(e.consume(t),bodyRowData):bodyRowData(t)}}function resolveTable(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new EditMap;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(flushTableEnd(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=flushCell(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=flushCell(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=flushCell(f,t,o,i,n,d)):(o[0]=o[1],d=flushCell(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&flushTableEnd(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=gfmTableAlign(t.events,n))}return e}function flushCell(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},getPoint(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=getPoint(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=getPoint(t.events,n[2]),a=getPoint(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},getPoint(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function flushTableEnd(e,t,n,r,i){let a=[],o=getPoint(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function getPoint(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}const E={name:`tasklistCheck`,tokenize:tokenizeTasklistCheck};function gfmTaskListItem(){return{text:{91:E}}}function tokenizeTasklistCheck(e,t,n){let r=this;return open;function open(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),inside)}function inside(t){return a(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),close):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),close):n(t)}function close(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),after):n(t)}function after(r){return c(r)?t(r):i(r)?e.check({tokenize:spaceThenNonSpace},t,n)(r):n(r)}}function spaceThenNonSpace(e,t,n){return o(e,after,`whitespace`);function after(e){return e===null?n(e):t(e)}}function gfm(e){return l([gfmAutolinkLiteral(),gfmFootnote(),gfmStrikethrough(e),gfmTable(),gfmTaskListItem()])}export{gfm as t};