@bigduu/lotus-next 2026.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -0
- package/dist/asset-manifest.json +303 -0
- package/dist/assets/CodeBlock-dYUQ9iue.js +2 -0
- package/dist/assets/ErrorBoundary-DLCRl4Er.js +1 -0
- package/dist/assets/Markdown-DBG0vWxL.js +2 -0
- package/dist/assets/MermaidChart-U1Z5JCRh.js +1 -0
- package/dist/assets/Root-dWsRRTlH.js +7 -0
- package/dist/assets/Settings-BcsRaEDP.js +7 -0
- package/dist/assets/StreamdownMarkdown-CiLy0KJD.js +2 -0
- package/dist/assets/StreamdownMermaid-J7jSRtO6.js +1 -0
- package/dist/assets/bundle-mjs-B_AA55HL.js +1 -0
- package/dist/assets/defineProperty-o0OkIQd4.js +1 -0
- package/dist/assets/en-US-DOXBXLLy.js +3 -0
- package/dist/assets/html2canvas-ChX2ETZ3.js +1 -0
- package/dist/assets/index-CjY6eMv8.js +2 -0
- package/dist/assets/index-xUf4TnkE.css +2 -0
- package/dist/assets/index.es-BpPlqG76.js +5 -0
- package/dist/assets/lib-CFLxRXs3.js +1 -0
- package/dist/assets/renderPdf-DbvJnEQL.js +111 -0
- package/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/dist/assets/select-DYBAIyVx.js +131 -0
- package/dist/assets/strictConfig-Bf8nyKvx.js +1 -0
- package/dist/assets/unsupportedIterableToArray-BTCP7Haa.js +1 -0
- package/dist/assets/vendor-highlighter-ClvlgmIK.js +8 -0
- package/dist/assets/vendor-markdown-CfSBref-.js +30 -0
- package/dist/assets/vendor-mermaid-Da_wWrs4.js +3535 -0
- package/dist/assets/vendor-react-CCIEwYL0.js +9 -0
- package/dist/assets/vendor-streamdown-BIRX7zKm.js +113 -0
- package/dist/assets/vendor-streamdown-CXvuy5h3.css +1 -0
- package/dist/assets/vendor-streamdown-code-B6SuuZwa.js +152 -0
- package/dist/assets/zh-CN-C4xbZjjC.js +3 -0
- package/dist/bundle-ownership.json +597 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.html +27 -0
- package/dist/lotus-next-manifest.json +181 -0
- package/package.json +94 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{i as n,r,t as i}from"./vendor-react-CCIEwYL0.js";import{t as a}from"./index-CjY6eMv8.js";import{_ as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,p as _,r as v,s as y,t as b,u as x}from"./vendor-markdown-CfSBref-.js";import{n as ee,t as S}from"./bundle-mjs-B_AA55HL.js";import{t as C}from"./lib-CFLxRXs3.js";var w=t(n(),1),T=Object.defineProperty,E=Object.defineProperties,te=Object.getOwnPropertyDescriptors,ne=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,D=(e,t,n)=>t in e?T(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||={})re.call(t,n)&&D(e,n,t[n]);if(ne)for(var n of ne(t))ie.call(t,n)&&D(e,n,t[n]);return e},ae=(e,t)=>E(e,te(t)),oe=e=>{let t=new Uint8Array(e.length+1),n=!1,r=!1,i=0;for(;i<e.length;){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){let e=n||r?1:0;t[i+1]=e,t[i+2]=e,i+=2;continue}if(e.substring(i,i+3)==="```"){r=!r;let a=n||r?1:0,o=Math.min(i+3,e.length);for(let e=i+1;e<=o;e+=1)t[e]=a;i=o;continue}!r&&e[i]==="`"&&(n=!n),t[i+1]=n||r?1:0,i+=1}return t},k=null,A=(e,t)=>{let n=k;return(n===null||n.text!==e)&&(n={text:e,lookup:oe(e)},k=n),n.lookup[Math.min(t,e.length)]===1},se=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},ce=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!se(e,n)&&(t+=1)}return t},j=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`")if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}return!1},le=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,ue=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(le,(t,n,r,i)=>A(e,i)?t:`${n}\\>${r}`),M=/(\*\*)([^*]*\*?)$/,N=/(__)([^_]*?)$/,de=/(\*\*\*)([^*]*?)$/,P=/(\*)([^*]*?)$/,fe=/(_)([^_]*?)$/,pe=/(`)([^`]*?)$/,me=/(~~)([^~]*?)$/,F=/^[\s_~*`]*$/,he=/^[\s]*[-*+][\s]+$/,ge=/[\p{L}\p{N}_]/u,I=/^```[^`\n]*```?$/,_e=/^\*{4,}$/,ve=/(__)([^_]+)_$/,ye=/(~~)([^~]+)~$/,be=/~~/g,L=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:ge.test(e)},xe=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},Se=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},Ce=e=>e===`inlineLatex`||e===`blockLatex`,we=(e,t)=>t===`[`&&e===`none`?`blockLatex`:t===`]`&&e===`blockLatex`?`none`:t===`(`&&e===`none`?`inlineLatex`:t===`)`&&e===`inlineLatex`?`none`:null,Te=(e,t)=>t?e===`blockDollar`?`none`:`blockDollar`:e===`blockDollar`?e:e===`inlineDollar`?`none`:`inlineDollar`,Ee=(e,t)=>{let n=`none`;for(let r=0;r<e.length&&r<t;r+=1){if(e[r]===`\\`&&e[r+1]===`$`){r+=1;continue}if(e[r]===`\\`){let t=we(n,e[r+1]);if(t!==null){n=t,r+=1;continue}}if(e[r]===`$`&&!Ce(n)){let t=e[r+1]===`$`;n=Te(n,t),t&&(r+=1)}}return n!==`none`},De=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
2
|
+
`)return!1}return!1},Oe=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`)`)return!1;if(e[n]===`(`)return n>0&&e[n-1]===`]`?De(e,t):!1;if(e[n]===`
|
|
3
|
+
`)return!1}return!1},ke=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`>`)return!1;if(e[n]===`<`){let t=n+1<e.length?e[n+1]:``;return t>=`a`&&t<=`z`||t>=`A`&&t<=`Z`||t===`/`}if(e[n]===`
|
|
4
|
+
`)return!1}return!1},Ae=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;--n)if(e[n]===`
|
|
5
|
+
`){r=n+1;break}let i=e.length;for(let n=t;n<e.length;n+=1)if(e[n]===`
|
|
6
|
+
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},je=e=>e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`),Me=(e,t,n,r)=>n===`\\`||je(e)&&Ee(e,t)?!0:n!==`*`&&r===`*`?(t<e.length-2?e[t+2]:``)!==`*`:n===`*`||(!n||n===` `||n===` `||n===`
|
|
7
|
+
`)&&(!r||r===` `||r===` `||r===`
|
|
8
|
+
`),Ne=e=>e===` `||e===` `||e===`
|
|
9
|
+
`,Pe=(e,t)=>!!(e&&t&&L(e)&&L(t)),Fe=(e,t,n,r)=>{let i=Pe(e,t),a=!!t&&!Ne(t),o=!!e&&!Ne(e);return i&&n%2==0&&!r?{count:!1}:o&&n%2==1||a?{count:!0,inWordAsteriskChain:i}:{count:!1}},Ie=e=>{let t=0,n=!1,r=!1,i=e.length;for(let a=0;a<i;a+=1){if(e[a]==="`"&&a+2<i&&e[a+1]==="`"&&e[a+2]==="`"){n=!n,a+=2;continue}if(n)continue;if(e[a]!==`*`){L(e[a])||(r=!1);continue}let o=a>0?e[a-1]:``,s=a<i-1?e[a+1]:``;if(Me(e,a,o,s))continue;let c=Fe(o,s,t,r);c.count&&(t+=1,r=c.inWordAsteriskChain)}return t},Le=(e,t,n,r)=>!!(n===`\\`||je(e)&&Ee(e,t)||Oe(e,t)||ke(e,t)||n===`_`||r===`_`||n&&r&&L(n)&&L(r)),Re=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`_`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;Le(e,i,a,o)||(t+=1)}return t},ze=e=>{let t=0,n=0,r=!1;for(let i=0;i<e.length;i+=1){if(e[i]==="`"&&i+2<e.length&&e[i+1]==="`"&&e[i+2]==="`"){n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,i+=2;continue}r||(e[i]===`*`?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0))}return n>=3&&(t+=Math.floor(n/3)),t},Be=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`*`&&r+1<e.length&&e[r+1]===`*`&&(t+=1,r+=1)}return t},Ve=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`_`&&r+1<e.length&&e[r+1]===`_`&&(t+=1,r+=1)}return t},He=(e,t,n)=>{if(!t||F.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
10
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return he.test(a)&&t.includes(`
|
|
11
|
+
`)?!0:Ae(e,n,`*`)},Ue=e=>{let t=e.match(M);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return A(e,r)||j(e,r)||He(e,n,r)?e:Be(e)%2==1?n.endsWith(`*`)?`${e}*`:`${e}**`:e},We=(e,t,n)=>{if(!t||F.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
12
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return he.test(a)&&t.includes(`
|
|
13
|
+
`)?!0:Ae(e,n,`_`)},Ge=e=>{let t=e.match(N);if(!t){let t=e.match(ve);if(t){let n=e.lastIndexOf(t[1]);if(!(A(e,n)||j(e,n))&&Ve(e)%2==1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return A(e,r)||j(e,r)||We(e,n,r)?e:Ve(e)%2==1?`${e}__`:e},Ke=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`&&!Ee(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``,i=!t||Ne(t),a=!r||Ne(r);if(i&&a||t&&r&&L(t)&&L(r)||a)continue;return n}}return-1},qe=e=>{if(!e.match(P))return e;let t=Ke(e);if(t===-1||A(e,t)||j(e,t))return e;let n=e.substring(t+1);return!n||F.test(n)?e:Ie(e)%2==1?`${e}*`:e},Je=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!Ee(e,n)&&!Oe(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if(t&&r&&L(t)&&L(r))continue;return n}}return-1},Ye=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
14
|
+
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},Xe=e=>{if(!e.endsWith(`**`))return null;let t=e.slice(0,-2);if(Be(t)%2!=1)return null;let n=t.indexOf(`**`),r=Je(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},Ze=e=>{if(!e.match(fe))return e;let t=Je(e);if(t===-1)return e;let n=e.substring(t+1);if(!n||F.test(n)||A(e,t)||j(e,t))return e;if(Re(e)%2==1){let t=Xe(e);return t===null?Ye(e):t}return e},Qe=e=>{let t=Be(e),n=Ie(e);return t%2==0&&n%2==0},$e=(e,t,n)=>!t||F.test(t)||A(e,n)||j(e,n)?!0:Ae(e,n,`*`),et=e=>{if(_e.test(e))return e;let t=e.match(de);if(!t)return e;let n=t[2];return $e(e,n,e.lastIndexOf(t[1]))?e:ze(e)%2==1?Qe(e)?e:`${e}***`:e},tt=/<[a-zA-Z/][^>]*$/,nt=e=>{let t=e.match(tt);return!t||t.index===void 0||A(e,t.index)?e:e.substring(0,t.index).trimEnd()},rt=e=>!e.match(I)||e.includes(`
|
|
15
|
+
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,it=e=>(e.match(/```/g)||[]).length%2==1,at=e=>{let t=rt(e);if(t!==null)return t;let n=e.match(pe);if(n&&!it(e)){let t=n[2];if(!t||F.test(t))return e;if(ce(e)%2==1)return`${e}\``}return e},ot=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",st=e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)e[r]==="`"&&!ot(e,r)&&(n=!n),!n&&e[r]===`$`&&e[r+1]===`$`&&(t+=1,r+=1);return t},ct=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]===`\\`){r+=1;continue}if(e[r]==="`"&&!ot(e,r)){n=!n;continue}!n&&e[r]===`$`&&(r+1<e.length&&e[r+1]===`$`?r+=1:t+=1)}return t},lt=e=>{if(e.endsWith(`$`)&&!e.endsWith(`$$`))return`${e}$`;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
16
|
+
`,t)!==-1&&!e.endsWith(`
|
|
17
|
+
`)?`${e}
|
|
18
|
+
$$`:`${e}$$`},ut=e=>st(e)%2==0?e:lt(e),dt=e=>ct(e)%2==1?`${e}$`:e,ft=(e,t,n)=>{if(e.substring(t+2).includes(`)`))return null;let r=xe(e,t);if(r===-1||A(e,r))return null;let i=r>0&&e[r-1]===`!`,a=i?r-1:r,o=e.substring(0,a);if(i)return o;let s=e.substring(r+1,t);return n===`text-only`?`${o}${s}`:`${o}[${s}](streamdown:incomplete-link)`},pt=(e,t)=>{for(let n=0;n<t;n++)if(e[n]===`[`&&!A(e,n)){if(n>0&&e[n-1]===`!`)continue;let t=Se(e,n);if(t===-1)return n;if(t+1<e.length&&e[t+1]===`(`){let r=e.indexOf(`)`,t+2);r!==-1&&(n=r)}}return t},mt=(e,t,n)=>{let r=t>0&&e[t-1]===`!`,i=r?t-1:t;if(!e.substring(t+1).includes(`]`)){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=pt(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}if(Se(e,t)===-1){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=pt(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},ht=(e,t=`protocol`)=>{let n=e.lastIndexOf(`](`);if(n!==-1&&!A(e,n)){let r=ft(e,n,t);if(r!==null)return r}for(let n=e.length-1;n>=0;--n)if(e[n]===`[`&&!A(e,n)){let r=mt(e,n,t);if(r!==null)return r}return e},gt=/^-{1,2}$/,_t=/^[\s]*-{1,2}[\s]+$/,vt=/^={1,2}$/,yt=/^[\s]*={1,2}[\s]+$/,bt=e=>{if(!e||typeof e!=`string`)return e;let t=e.lastIndexOf(`
|
|
19
|
+
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(gt.test(i)&&!n.match(_t)){let t=r.split(`
|
|
20
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(vt.test(i)&&!n.match(yt)){let t=r.split(`
|
|
21
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},xt=/([\p{L}\p{N}_])~(?!~)(?=[\p{L}\p{N}_])/gu,St=e=>!e||typeof e!=`string`||!e.includes(`~`)?e:e.replace(xt,(t,n,r)=>A(e,r+n.length)?t:`${n}\\~`),Ct=e=>{let t=e.match(me);if(t){let n=t[2];if(!n||F.test(n))return e;let r=e.lastIndexOf(t[1]);if(A(e,r)||j(e,r))return e;if(e.match(be)?.length%2==1)return`${e}~~`}else{let t=e.match(ye);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(A(e,n)||j(e,n))return e;if(e.match(be)?.length%2==1)return`${e}~`}}return e},wt=e=>e!==!1,Tt=e=>e===!0,R={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},Et=[{handler:{name:`singleTilde`,handle:St,priority:R.SINGLE_TILDE},optionKey:`singleTilde`},{handler:{name:`comparisonOperators`,handle:ue,priority:R.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:nt,priority:R.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:bt,priority:R.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:ht,priority:R.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)},{handler:{name:`boldItalic`,handle:et,priority:R.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:Ue,priority:R.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:Ge,priority:R.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:qe,priority:R.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:Ze,priority:R.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:at,priority:R.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:Ct,priority:R.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:ut,priority:R.KATEX},optionKey:`katex`},{handler:{name:`inlineKatex`,handle:dt,priority:R.INLINE_KATEX},optionKey:`inlineKatex`}],Dt=e=>{let t=e?.linkMode??`protocol`;return Et.filter(({handler:t,optionKey:n})=>t.name===`links`?wt(e?.links)||wt(e?.images):t.name===`inlineKatex`?Tt(e?.inlineKatex):wt(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:ae(O({},e),{handle:e=>ht(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},Ot=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=Dt(t),i=(t?.handlers??[]).map(e=>({handler:ae(O({},e),{priority:e.priority??R.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n},kt=t(r(),1),z=i();function At(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var B=At();function jt(e){B=e}var V={exec:()=>null};function H(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(U.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Mt=(()=>{try{return!0}catch{return!1}})(),U={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Nt=/^(?:[ \t]*(?:\n|$))+/,Pt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ft=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,It=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Rt=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,zt=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bt=H(zt).replace(/bull/g,Rt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Vt=H(zt).replace(/bull/g,Rt).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ht=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ut=/^[^\n]+/,Wt=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Gt=H(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Wt).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Kt=H(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Rt).getRegex(),qt=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Jt=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Yt=H(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Jt).replace(`tag`,qt).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xt=H(Ht).replace(`hr`,It).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qt).getRegex(),Zt={blockquote:H(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Xt).getRegex(),code:Pt,def:Gt,fences:Ft,heading:Lt,hr:It,html:Yt,lheading:Bt,list:Kt,newline:Nt,paragraph:Xt,table:V,text:Ut},Qt=H(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,It).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qt).getRegex(),$t={...Zt,lheading:Vt,table:Qt,paragraph:H(Ht).replace(`hr`,It).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Qt).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,qt).getRegex()},en={...Zt,html:H(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Jt).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:V,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:H(Ht).replace(`hr`,It).replace(`heading`,` *#{1,6} *[^
|
|
22
|
+
]`).replace(`lheading`,Bt).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},tn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rn=/^( {2,}|\\)\n(?!\s*$)/,an=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,on=/[\p{P}\p{S}]/u,sn=/[\s\p{P}\p{S}]/u,cn=/[^\s\p{P}\p{S}]/u,ln=H(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,sn).getRegex(),un=/(?!~)[\p{P}\p{S}]/u,dn=/(?!~)[\s\p{P}\p{S}]/u,fn=/(?:[^\s\p{P}\p{S}]|~)/u,pn=H(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Mt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),mn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hn=H(mn,`u`).replace(/punct/g,on).getRegex(),gn=H(mn,`u`).replace(/punct/g,un).getRegex(),_n=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,vn=H(_n,`gu`).replace(/notPunctSpace/g,cn).replace(/punctSpace/g,sn).replace(/punct/g,on).getRegex(),yn=H(_n,`gu`).replace(/notPunctSpace/g,fn).replace(/punctSpace/g,dn).replace(/punct/g,un).getRegex(),bn=H(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,cn).replace(/punctSpace/g,sn).replace(/punct/g,on).getRegex(),xn=H(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,on).getRegex(),Sn=H(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,cn).replace(/punctSpace/g,sn).replace(/punct/g,on).getRegex(),Cn=H(/\\(punct)/,`gu`).replace(/punct/g,on).getRegex(),wn=H(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Tn=H(Jt).replace(`(?:-->|$)`,`-->`).getRegex(),En=H(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Tn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Dn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,On=H(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Dn).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kn=H(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Dn).replace(`ref`,Wt).getRegex(),An=H(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Wt).getRegex(),jn=H(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,kn).replace(`nolink`,An).getRegex(),Mn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Nn={_backpedal:V,anyPunctuation:Cn,autolink:wn,blockSkip:pn,br:rn,code:nn,del:V,delLDelim:V,delRDelim:V,emStrongLDelim:hn,emStrongRDelimAst:vn,emStrongRDelimUnd:bn,escape:tn,link:On,nolink:An,punctuation:ln,reflink:kn,reflinkSearch:jn,tag:En,text:an,url:V},Pn={...Nn,link:H(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Dn).getRegex(),reflink:H(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Dn).getRegex()},Fn={...Nn,emStrongRDelimAst:yn,emStrongLDelim:gn,delLDelim:xn,delRDelim:Sn,url:H(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Mn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:H(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Mn).getRegex()},In={...Fn,br:H(rn).replace(`{2,}`,`*`).getRegex(),text:H(Fn.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ln={normal:Zt,gfm:$t,pedantic:en},Rn={normal:Nn,gfm:Fn,breaks:In,pedantic:Pn},zn={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Bn=e=>zn[e];function W(e,t){if(t){if(U.escapeTest.test(e))return e.replace(U.escapeReplace,Bn)}else if(U.escapeTestNoEncode.test(e))return e.replace(U.escapeReplaceNoEncode,Bn);return e}function Vn(e){try{e=encodeURI(e).replace(U.percentDecode,`%`)}catch{return null}return e}function Hn(e,t){let n=e.replace(U.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(U.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(U.slashPipe,`|`);return n}function Un(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Wn(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Gn(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Kn(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function qn(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
23
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
24
|
+
`)}var Jn=class{options;rules;lexer;constructor(e){this.options=e||B}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:Un(e,`
|
|
25
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=qn(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=Un(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Un(t[0],`
|
|
26
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Un(t[0],`
|
|
27
|
+
`).split(`
|
|
28
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
29
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
30
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
31
|
+
${s}`:s,r=r?`${r}
|
|
32
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
33
|
+
`+e.join(`
|
|
34
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
35
|
+
`+e.join(`
|
|
36
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
37
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Gn(t[2].split(`
|
|
38
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
39
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
40
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
41
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
42
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
43
|
+
`+l}u=!l.trim(),r+=p+`
|
|
44
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Hn(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
45
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Hn(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
46
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Un(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Wn(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Kn(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Kn(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},G=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new Jn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:U,block:Ln.normal,inline:Rn.normal};this.options.pedantic?(t.block=Ln.pedantic,t.inline=Rn.pedantic):this.options.gfm&&(t.block=Ln.gfm,this.options.breaks?t.inline=Rn.breaks:t.inline=Rn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ln,inline:Rn}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(U.carriageReturn,`
|
|
47
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(U.tabCharGlobal,` `).replace(U.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
48
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
49
|
+
`)?``:`
|
|
50
|
+
`)+r.raw,n.text+=`
|
|
51
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
52
|
+
`)?``:`
|
|
53
|
+
`)+r.raw,n.text+=`
|
|
54
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
55
|
+
`)?``:`
|
|
56
|
+
`)+r.raw,a.text+=`
|
|
57
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
58
|
+
`)?``:`
|
|
59
|
+
`)+r.raw,n.text+=`
|
|
60
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},Yn=class{options;parser;constructor(e){this.options=e||B}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(U.notSpaceStart)?.[0],i=e.replace(U.endingNewline,``)+`
|
|
61
|
+
`;return r?`<pre><code class="language-`+W(r)+`">`+(n?i:W(i,!0))+`</code></pre>
|
|
62
|
+
`:`<pre><code>`+(n?i:W(i,!0))+`</code></pre>
|
|
63
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
64
|
+
${this.parser.parse(e)}</blockquote>
|
|
65
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
66
|
+
`}hr(e){return`<hr>
|
|
67
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
68
|
+
`+r+`</`+i+`>
|
|
69
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
70
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
71
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
72
|
+
<thead>
|
|
73
|
+
`+t+`</thead>
|
|
74
|
+
`+r+`</table>
|
|
75
|
+
`}tablerow({text:e}){return`<tr>
|
|
76
|
+
${e}</tr>
|
|
77
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
78
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${W(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Vn(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+W(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Vn(e);if(i===null)return W(n);e=i;let a=`<img src="${e}" alt="${W(n)}"`;return t&&(a+=` title="${W(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:W(e.text)}},Xn=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},K=class e{options;renderer;textRenderer;constructor(e){this.options=e||B,this.options.renderer=this.options.renderer||new Yn,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Xn}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Zn=class{options;block;constructor(e){this.options=e||B}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?G.lex:G.lexInline}provideParser(e=this.block){return e?K.parse:K.parseInline}},q=new class{defaults=At();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=K;Renderer=Yn;TextRenderer=Xn;Lexer=G;Tokenizer=Jn;Hooks=Zn;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Yn(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Jn(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Zn;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Zn.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Zn.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return G.lex(e,t??this.defaults)}parser(e,t){return K.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?G.lex:G.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?K.parse:K.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?G.lex:G.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?K.parse:K.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
79
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+W(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function J(e,t){return q.parse(e,t)}J.options=J.setOptions=function(e){return q.setOptions(e),J.defaults=q.defaults,jt(J.defaults),J},J.getDefaults=At,J.defaults=B,J.use=function(...e){return q.use(...e),J.defaults=q.defaults,jt(J.defaults),J},J.walkTokens=function(e,t){return q.walkTokens(e,t)},J.parseInline=q.parseInline,J.Parser=K,J.parser=K.parse,J.Renderer=Yn,J.TextRenderer=Xn,J.Lexer=G,J.lexer=G.lex,J.Tokenizer=Jn,J.Hooks=Zn,J.parse=J,J.options,J.setOptions,J.use,J.walkTokens,J.parseInline,K.parse,G.lex;var Qn=300,$n=`300px`,er=500;function tr(e={}){let{immediate:t=!1,debounceDelay:n=Qn,rootMargin:r=$n,idleTimeout:i=er}=e,[a,o]=(0,w.useState)(!1),s=(0,w.useRef)(null),c=(0,w.useRef)(null),l=(0,w.useRef)(null),u=(0,w.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,w.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,w.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,w.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var nr=320,rr=4,ir=()=>typeof performance>`u`?Date.now():performance.now();function ar(e){let t=e?.now??ir,n=e?.maxBacklogMs??nr,r=0,i=0;return{now:t,beginPass(e){i=Math.min(Math.max(r,e),e+n)},mark(){return i},rewind(e){i=e},take(e,t,r){if(e<=0)return{baseDelay:0,step:Math.max(0,t)};let a=Math.max(0,t),o=a===0?0:Math.min(a,rr),s=Math.max(i,r),c=r+n,l=s+Math.max(0,e-1)*a,u=a;if(l>c&&e>1)if(s<c){let t=c-s;u=Math.max(o,t/(e-1))}else u=o;let d=Math.max(0,Math.round(s-r));return i=s+e*u,{baseDelay:d,step:u}},commitPass(){r=i}}}var or=/\s/,sr=/^\s+$/,cr=new Set([`pre`,`svg`,`math`,`annotation`]),lr=new Set([`img`,`hr`]),ur=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,dr=e=>e.some(e=>ur(e)&&cr.has(e.tagName)),fr=e=>{for(let t=e.length-1;t>=0;t--){let n=e[t];if(ur(n)&&n.tagName===`li`)return n}},pr=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate-marker`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(n)}ms;--sd-marker-easing:${r}`},mr=new Set([`ul`,`ol`,`li`]),hr=e=>{for(let t of e.children)if(ur(t)){if(t.tagName===`input`)return t;if(mr.has(t.tagName))continue;let e=hr(t);if(e)return e}},gr=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${n}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(r)}ms`},_r=(e,t,n,r)=>{let i=hr(e);i&&gr(i,t,n,r)},vr=(e,t,n,r,i,a)=>{if(dr(t))return;let o=r.prevContentLength,s=i.count;i.count+=1;let c=o>0&&s<o,l=c?0:a.baseDelay+i.newIndex++*a.step;gr(e,n,c?0:n.duration,l)},yr=e=>{var t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(ur(r)){if((t=r.properties)!=null&&t[`data-sd-animated`])break;r.properties={...r.properties,"data-sd-animated":!0}}}},br=e=>{let t=[],n=``,r=!1;for(let i of e){let e=or.test(i);if(e!==r&&n){if(e){n+=i,r=!0;continue}t.push(n),n=``}n+=i,r=e}return n&&t.push(n),t},xr=e=>{let t=[],n=``;for(let r of e)or.test(r)?t.length>0&&!sr.test(t.at(-1))?t[t.length-1]+=r:n+=r:(n&&=(t.push(n),``),t.push(r));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},Sr=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${Math.round(a)}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},Cr=(e,t)=>!(e>0&&t<e),wr=e=>ur(e)&&lr.has(e.tagName),Tr=(e,t,n)=>{let r=0,i=0;return o(e,e=>e.type===`text`||wr(e),(e,a)=>{if(dr(a))return u;if(wr(e)){Cr(n,i)&&(r+=1),i+=1;return}let o=e.value;if(!o.trim()){i+=o.length;return}let s=t.sep===`char`?xr(o):br(o);for(let e of s){let t=i;i+=e.length,!sr.test(e)&&Cr(n,t)&&(r+=1)}}),r},Er=(e,t,n,r,i,a)=>{var o;let s=t.at(-1);if(!(s&&`children`in s))return;if(dr(t))return u;let c=s,l=c.children.indexOf(e);if(l===-1)return;let d=e.value;if(!d.trim()){i.count+=d.length;return}let f=n.sep===`char`?xr(d):br(d),p=r.prevContentLength,m=!1,h=fr(t),g=!!(h&&!((o=h.properties)!=null&&o[`data-sd-animate-marker`])),_=!1,v=f.map(e=>{let t=i.count;if(i.count+=e.length,sr.test(e))return{type:`text`,value:e};let r=p>0&&t<p,o=r?0:a.baseDelay+i.newIndex++*a.step;if(m=!0,h&&g&&!_){let e=r?0:n.duration;pr(h,e,o,n.easing),_r(h,n,e,o),_=!0}return Sr(e,n.animation,n.duration,n.easing,r,o)});return m&&yr(t),c.children.splice(l,1,...v),l+v.length},Dr=0;function Or(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40,timeline:e?.timeline},n={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},r=Dr++,i=()=>e=>{let r={count:0,newIndex:0};n.prevContentLength=n.committedCharCount;let i=t.timeline,a=i?.now()??ir();i&&(n.pendingMark===null?n.pendingMark=i.mark():i.rewind(n.pendingMark));let s=i?i.take(Tr(e,t,n.prevContentLength),t.stagger,a):{baseDelay:0,step:t.stagger};o(e,e=>e.type===`text`||wr(e),(e,i)=>{if(e.type===`text`)return Er(e,i,t,n,r,s);vr(e,i,t,n,r,s)}),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.committedCharCount=e,n.prevContentLength=e},getLastRenderCharCount(){return n.lastRenderCharCount},commit(){n.committedCharCount=n.lastRenderCharCount,n.pendingMark=null}}}Or();var kr=(0,w.createContext)(!1),Ar=()=>(0,w.useContext)(kr),jr=(...e)=>S(ee(e)),Mr=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},Nr=e=>e?(...t)=>Mr(e,S(ee(t))):jr,Pr=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},Fr=(0,w.createContext)(jr),Y=()=>(0,w.useContext)(Fr),Ir=8,Lr=e=>{if(!(e===void 0||e===0||e===1/0)){if(typeof e==`number`)return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(!(e===`0`||e===`none`||e===`Infinity`))return e}},Rr=(e,t,n)=>{let r=(0,w.useRef)(null),i=(0,w.useRef)(!0),a=(0,w.useRef)(!1);return(0,w.useEffect)(()=>{let e=r.current;if(!(e&&t))return;let n=()=>{i.current=e.scrollHeight-e.scrollTop-e.clientHeight<Ir};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[t]),(0,w.useEffect)(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),(0,w.useEffect)(()=>{let n=r.current;n&&t&&e&&i.current&&n.scrollTo({top:n.scrollHeight,behavior:`instant`})},[e,t,n]),r},zr=jr(`block`),Br=jr(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),Vr=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},Hr=(0,w.memo)(({children:e,result:t,language:n,className:r,maxHeight:i,startLine:a,lineNumbers:o=!0,...s})=>{let c=Y(),{isAnimating:l}=(0,w.useContext)($),u=Lr(i),d=Rr(l,!!u,t),f=(0,w.useMemo)(()=>c(Br),[c]),p=(0,w.useMemo)(()=>c(zr),[c]),m=(0,w.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,Vr(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,z.jsx)(`div`,{className:c(r,u?`overflow-y-auto`:null,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,ref:d,style:u?{maxHeight:u}:void 0,...s,children:(0,z.jsx)(`pre`,{className:c(r,`bg-[var(--sdm-bg,inherit)]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]`),style:m,children:(0,z.jsx)(`code`,{className:o?c(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:o&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((e,t)=>(0,z.jsx)(`span`,{className:o?f:p,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
80
|
+
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,z.jsx)(`span`,{className:c(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})}),Ur=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,z.jsx)(`div`,{className:Y()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),Wr=(0,w.createContext)({code:``}),Gr=()=>(0,w.useContext)(Wr),Kr=({language:e})=>{let t=Y();return(0,z.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,z.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},qr=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
81
|
+
`;)t--;return e.slice(0,t)},Jr=(0,w.lazy)(()=>a(()=>Promise.resolve().then(()=>Do).then(e=>({default:e.HighlightedCodeBlockBody})),void 0,import.meta.url)),Yr=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=Y(),{codeBlockMaxHeight:l}=(0,w.useContext)($),u=(0,w.useMemo)(()=>qr(e),[e]),d=(0,w.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
|
|
82
|
+
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,z.jsx)(Wr.Provider,{value:{code:e},children:(0,z.jsxs)(Ur,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,z.jsx)(Kr,{language:t}),r?(0,z.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,z.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,z.jsx)(w.Suspense,{fallback:(0,z.jsx)(Hr,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,z.jsx)(Jr,{className:n,code:u,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},Xr={CheckIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,z.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,z.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,z.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,z.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,z.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},Zr=(0,w.createContext)(Xr),Qr=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},$r=({icons:e,children:t})=>{let n=(0,w.useRef)(e),r=(0,w.useRef)(e?{...Xr,...e}:Xr);Qr(n.current,e)||(n.current=e,r.current=e?{...Xr,...e}:Xr);let i=r.current;return(0,z.jsx)(Zr.Provider,{value:i,children:t})},X=()=>(0,w.useContext)(Zr),ei={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},ti=(0,w.createContext)(ei),Z=()=>(0,w.useContext)(ti),ni=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=Y(),[c,l]=(0,w.useState)(!1),u=(0,w.useRef)(0),{code:d}=Gr(),{isAnimating:f}=(0,w.useContext)($),p=Z(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,w.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=X(),_=c?g.CheckIcon:g.CopyIcon;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{"aria-label":p.copyCode,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,z.jsx)(_,{"aria-hidden":`true`,size:14})}),c&&(0,z.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},ri=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},ii={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},ai=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=Y(),{code:c}=Gr(),{isAnimating:l,controls:u}=(0,w.useContext)($),d=Z(),f=X(),p=a??c,m=n&&n in ii?ii[n]:`txt`,h=`${ri(u,`code`,`file`)}.${m}`;return(0,z.jsx)(`button`,{"aria-label":d.downloadFile,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{Pr(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,z.jsx)(f.DownloadIcon,{size:14})})},oi=()=>{let{Loader2Icon:e}=X(),t=Y();return(0,z.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,z.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,z.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,z.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},si=/\.[^/.]+$/,ci=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=X(),u=Y(),d=(0,w.useRef)(null),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(!1),g=Z(),_=c.width!=null||c.height!=null,v=(f||_)&&!m&&o&&s,y=m&&!_;(0,w.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let b=(0,w.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),x=(0,w.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),ee=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(si,``)}.${i}`}Pr(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,z.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,z.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,y&&`hidden`,t),"data-streamdown":`image`,onError:x,onLoad:b,ref:d,src:n,...c}),y&&(0,z.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,z.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),v&&(0,z.jsx)(`button`,{className:u(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:ee,title:g.downloadImage,type:`button`,children:(0,z.jsx)(l,{size:14})})]}):null},li=0,ui=()=>{li+=1,li===1&&(document.body.style.overflow=`hidden`)},di=()=>{li=Math.max(0,li-1),li===0&&(document.body.style.overflow=``)},fi=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=X(),c=Y(),[l,u]=(0,w.useState)(!1),d=Z(),f=(0,w.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,w.useCallback)(()=>{r(),n()},[r,n]);return(0,w.useEffect)(()=>{if(t){ui();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),di()}}},[t,n]),!t||typeof document>`u`?null:(0,kt.createPortal)((0,z.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,z.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,z.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,z.jsx)(s,{size:16})}),(0,z.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,z.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,z.jsx)(o,{size:20}),(0,z.jsx)(`span`,{children:d.openExternalLink})]}),(0,z.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,z.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,z.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,z.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(i,{size:14}),(0,z.jsx)(`span`,{children:d.copied})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(a,{size:14}),(0,z.jsx)(`span`,{children:d.copyLink})]})}),(0,z.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,z.jsx)(o,{size:14}),(0,z.jsx)(`span`,{children:d.openLink})]})]})]})}),document.body)},pi=(0,w.createContext)(null),mi=()=>(0,w.useContext)(pi),hi=()=>mi()?.code??null,gi=()=>mi()?.mermaid??null,_i=e=>{var t;let n=mi();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},vi=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},yi=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),bi=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=Y(),[s,c]=(0,w.useState)(!1),l=(0,w.useRef)(null),{isAnimating:u,controls:d}=(0,w.useContext)($),f=X(),p=gi(),m=Z(),h=ri(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){Pr(`${h}.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}let u=vi(l);if(t===`svg`){Pr(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await yi(u);Pr(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,w.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,z.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,z.jsx)(`button`,{"aria-label":m.downloadDiagram,className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,z.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,z.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,z.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,z.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},xi=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=X(),c=Y(),[l,u]=(0,w.useState)(!1),{isAnimating:d,controls:f}=(0,w.useContext)($),p=Z(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.download!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.copy!==!1})(),_=()=>{u(!l)};return(0,w.useEffect)(()=>{if(l){ui();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),di()}}},[l]),(0,w.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:_,title:p.viewFullscreen,type:`button`,...a,"aria-label":p.viewFullscreen,children:(0,z.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,kt.createPortal)((0,z.jsxs)(`div`,{"aria-label":p.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:_,onKeyDown:e=>{e.key===`Escape`&&_()},role:`dialog`,children:[(0,z.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[h?(0,z.jsx)(bi,{chart:e,config:t}):null,g?(0,z.jsx)(ni,{code:e}):null,(0,z.jsx)(`button`,{"aria-label":p.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:_,title:p.exitFullscreen,type:`button`,children:(0,z.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,z.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,z.jsx)(Eo,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})};function Si(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
|
|
83
|
+
`:Array.from(t.childNodes).map(Si).join(``)}var Ci=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(Si(e).trim());let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(Si(e).trim());n.push(t)}return{headers:t,rows:n}},wi=e=>{if(typeof e!=`object`)return`,`;let t=e.table;return typeof t==`object`?t.csvSeparator??`,`:`,`},Ti=(e,t=`,`)=>{let n;n=t===`auto`?Intl.NumberFormat().format(1.1).includes(`,`)?`;`:`,`:t;let{headers:r,rows:i}=e,a=e=>{let t=!1;for(let r of e)if(r===n||r===`"`||r===`
|
|
84
|
+
`||r===`\r`){t=!0;break}return t?`"${e.replace(/"/g,`""`)}"`:e},o=r.length>0?i.length+1:i.length,s=Array(o),c=0;r.length>0&&(s[c]=r.map(a).join(n),c+=1);for(let e of i)s[c]=e.map(a).join(n),c+=1;return s.join(`
|
|
85
|
+
`)},Ei=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
86
|
+
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
87
|
+
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
88
|
+
`)},Di=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`||n===`
|
|
89
|
+
`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):t===`
|
|
90
|
+
`?n.push(`<br>`):n.push(t);return n.join(``)},Oi=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>Di(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?Di(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>Di(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
91
|
+
`)},ki=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=Y(),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(!1),u=(0,w.useRef)(null),d=(0,w.useRef)(0),{isAnimating:f,controls:p}=(0,w.useContext)($),m=Z(),h=wi(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Ci(t),o=``;o=e===`csv`?Ti(a,h):e===`tsv`?Ei(a):Oi(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,w.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=X(),v=c?_.CheckIcon:_.CopyIcon;return(0,z.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,z.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,z.jsx)(v,{height:14,width:14})}),o?(0,z.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,z.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},Ai=({children:e,className:t,onDownload:n,onError:r})=>{let i=Y(),[a,o]=(0,w.useState)(!1),s=(0,w.useRef)(null),{isAnimating:c,controls:l}=(0,w.useContext)($),u=Z(),d=X(),f=wi(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Ci(t),a=e===`csv`?Ti(i,f):Oi(i),c=e===`csv`?`csv`:`md`;Pr(`${ri(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,w.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,z.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,z.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,z.jsx)(d.DownloadIcon,{size:14})}),a?(0,z.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,z.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},ji=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=X(),o=Y(),[s,c]=(0,w.useState)(!1),{isAnimating:l}=(0,w.useContext)($),u=Z(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,w.useEffect)(()=>{if(s){ui();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),di()}}},[s]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,z.jsx)(i,{size:14})}),s?(0,kt.createPortal)((0,z.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,z.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,z.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,z.jsx)(ki,{}):null,r?(0,z.jsx)(Ai,{}):null,(0,z.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,z.jsx)(a,{size:20})})]}),(0,z.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,z.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},Mi=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=Y(),{isAnimating:l}=(0,w.useContext)($),u=Lr(n),d=Rr(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,z.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,z.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,z.jsx)(ki,{}):null,p?(0,z.jsx)(Ai,{}):null,m?(0,z.jsx)(ji,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,z.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,z.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},Ni=/startLine=(\d+)/,Pi=/\bnoLineNumbers\b/,Fi=(0,w.lazy)(()=>a(()=>Promise.resolve().then(()=>ko).then(e=>({default:e.Mermaid})),void 0,import.meta.url)),Ii=/language-([^\s]+)/,Li=`node`;function Q(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==Li&&!Object.is(r[e],i[e]))return!1;return!0}function Ri(e,t){return e?.properties?.metastring===t?.properties?.metastring}var zi=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,Bi=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},Vi=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},Hi=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},Ui=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},Wi=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ol`,{className:Y()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>Q(e,t));Wi.displayName=`MarkdownOl`;var Gi=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`li`,{className:Y()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>Q(e,t));Gi.displayName=`MarkdownLi`;var Ki=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`ul`,{className:Y()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>Q(e,t));Ki.displayName=`MarkdownUl`;var qi=(0,w.memo)(({className:e,node:t,...n})=>(0,z.jsx)(`hr`,{className:Y()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>Q(e,t));qi.displayName=`MarkdownHr`;var Ji=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`span`,{className:Y()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>Q(e,t));Ji.displayName=`MarkdownStrong`;var Yi=(0,w.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=Y(),{linkSafety:o}=(0,w.useContext)($),[s,c]=(0,w.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,w.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,w.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,w.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,z.jsx)(fi,{...p})]}):(0,z.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>Q(e,t));Yi.displayName=`MarkdownA`;var Xi=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h1`,{className:Y()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>Q(e,t));Xi.displayName=`MarkdownH1`;var Zi=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h2`,{className:Y()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>Q(e,t));Zi.displayName=`MarkdownH2`;var Qi=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h3`,{className:Y()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>Q(e,t));Qi.displayName=`MarkdownH3`;var $i=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h4`,{className:Y()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>Q(e,t));$i.displayName=`MarkdownH4`;var ea=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h5`,{className:Y()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>Q(e,t));ea.displayName=`MarkdownH5`;var ta=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`h6`,{className:Y()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>Q(e,t));ta.displayName=`MarkdownH6`;var na=(0,w.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,w.useContext)($);return(0,z.jsx)(Mi,{className:t,maxHeight:a,showControls:zi(i,`table`),showCopy:Bi(i,`copy`),showDownload:Bi(i,`download`),showFullscreen:Bi(i,`fullscreen`),...r,children:e})},(e,t)=>Q(e,t));na.displayName=`MarkdownTable`;var ra=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`thead`,{className:Y()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>Q(e,t));ra.displayName=`MarkdownThead`;var ia=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tbody`,{className:Y()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>Q(e,t));ia.displayName=`MarkdownTbody`;var aa=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`tr`,{className:Y()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>Q(e,t));aa.displayName=`MarkdownTr`;var oa=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`th`,{className:Y()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>Q(e,t));oa.displayName=`MarkdownTh`;var sa=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`td`,{className:Y()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>Q(e,t));sa.displayName=`MarkdownTd`;var ca=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`blockquote`,{className:Y()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>Q(e,t));ca.displayName=`MarkdownBlockquote`;var la=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sup`,{className:Y()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>Q(e,t));la.displayName=`MarkdownSup`;var ua=(0,w.memo)(({children:e,className:t,node:n,...r})=>(0,z.jsx)(`sub`,{className:Y()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>Q(e,t));ua.displayName=`MarkdownSub`;var da=(0,w.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,w.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,w.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,w.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,w.isValidElement)(e))return e;if(e.type===Wi){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,z.jsx)(`section`,{className:t,...r,children:i}):null}return(0,z.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>Q(e,t));da.displayName=`MarkdownSection`;var fa=(0,w.memo)(({node:e,className:t,children:n,...r})=>{let i=Y(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,w.useContext)($),l=gi(),u=Ar(),d=(t?.match(Ii))?.at(1)??``,f=_i(d);if(a)return(0,z.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(Ni),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&Pi.test(p))&&c!==!1,v=``;if((0,w.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,z.jsx)(w.Suspense,{fallback:(0,z.jsx)(oi,{}),children:(0,z.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=zi(s,`mermaid`),n=Hi(s,`download`),r=Hi(s,`copy`),a=Hi(s,`fullscreen`),c=Hi(s,`panZoom`),l=e&&(n||r||a);return(0,z.jsx)(w.Suspense,{fallback:(0,z.jsx)(oi,{}),children:(0,z.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,z.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,z.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,z.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,z.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,z.jsx)(bi,{chart:v,config:o?.config}):null,r?(0,z.jsx)(ni,{code:v}):null,a?(0,z.jsx)(xi,{chart:v,config:o?.config}):null]})}):null,(0,z.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,z.jsx)(Fi,{chart:v,config:o?.config,showControls:c})})]})})}let y=zi(s,`code`),b=Vi(s,`download`),x=Vi(s,`copy`),{"data-block":ee,...S}=r;return(0,z.jsx)(Yr,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,...S,children:y?(0,z.jsxs)(z.Fragment,{children:[b?(0,z.jsx)(ai,{code:v,language:d}):null,x?(0,z.jsx)(ni,{}):null]}):null})},(e,t)=>Q(e,t)&&Ri(e.node,t.node));fa.displayName=`MarkdownCode`;var pa=(0,w.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,w.useContext)($),i=zi(r,`image`);return(0,z.jsx)(ci,{className:t,node:e,showControls:i,showDownloadControl:i&&Ui(r,`download`),...n})},(e,t)=>Q(e,t));pa.displayName=`MarkdownImg`;var ma=(0,w.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,w.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,z.jsx)(z.Fragment,{children:e})}return(0,z.jsx)(`p`,{...n,children:e})},(e,t)=>Q(e,t));ma.displayName=`MarkdownParagraph`;var ha={ol:Wi,li:Gi,ul:Ki,hr:qi,strong:Ji,a:Yi,h1:Xi,h2:Zi,h3:Qi,h4:$i,h5:ea,h6:ta,table:na,thead:ra,tbody:ia,tr:aa,th:oa,td:sa,blockquote:ca,code:fa,img:pa,pre:({children:e})=>(0,w.isValidElement)(e)?(0,w.cloneElement)(e,{"data-block":`true`}):e,sup:la,sub:ua,p:ma,section:da},ga=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,_a=/\p{L}/u;function va(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t){if(ga.test(e)){n??=`rtl`,i+=1;continue}_a.test(e)&&(n??=`ltr`,r+=1)}return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var ya=/^[ \t]{0,3}(`{3,}|~{3,})/,ba=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,xa=e=>{let t=e.split(`
|
|
92
|
+
`),n=null,r=0;for(let e of t){let t=ya.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},Sa=e=>{let t=e.split(`
|
|
93
|
+
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&ba.test(t))return!0}return!1},Ca=()=>e=>{d(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},wa=[],Ta={allowDangerousHtml:!0},Ea=new WeakMap,Da=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=Ea.get(e);n||(n=e.name,Ea.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=Ea.get(r);e||(e=r.name,Ea.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},Oa=e=>{let t=ka(e),n=e.children||``;return Ia(t.runSync(t.parse(n),n),e)},ka=e=>{let t=Da.get(e);if(t)return t;let n=ja(e);return Da.set(e,n),n},Aa=e=>e.some(e=>Array.isArray(e)?e[0]===_:e===_),ja=e=>{let t=e.rehypePlugins||wa,n=e.remarkPlugins||wa,r=Aa(t)?n:[...n,Ca],i=e.remarkRehypeOptions?{...Ta,...e.remarkRehypeOptions}:Ta;return g().use(s).use(r).use(y,i).use(t)},Ma=e=>e,Na=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},Pa=(e,t)=>{for(let n in C)if(Object.hasOwn(C,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=C[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},Fa=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},Ia=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||Ma;d(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return Na(c,s,a,e.value),s;if(e.type===`element`&&(Pa(e,t),Fa(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return p(e,{Fragment:z.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:z.jsx,jsxs:z.jsxs,passKeys:!0,passNode:!0})},La=/\[\^[\w-]{1,200}\](?!:)/,Ra=/\[\^[\w-]{1,200}\]:/,za=/<([A-Za-z][\w:-]*)[\s>/]/,Ba=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),Va=new Map,Ha=new Map,Ua=e=>{let t=e.toLowerCase(),n=Va.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return Va.set(t,r),r},Wa=e=>{let t=e.toLowerCase(),n=Ha.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return Ha.set(t,r),r},Ga=(e,t)=>{if(Ba.has(t.toLowerCase()))return 0;let n=e.match(Ua(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},Ka=(e,t)=>{let n=e.match(Wa(t));return n?n.length:0},qa=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},Ja=e=>{let t=La.test(e),n=Ra.test(e);if(t||n)return[e];let r=G.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=Ga(t,e),o=Ka(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(za);if(e){let n=e[1];Ga(t,n)>Ka(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(qa(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},Ya=/^\n*/,Xa=/\n*$/,Za=/\n\n/g,Qa=(e,t,n)=>t.includes(`
|
|
94
|
+
`)?`${e}${t.replace(Za,`
|
|
95
|
+
<!---->
|
|
96
|
+
`).replace(Ya,`
|
|
97
|
+
|
|
98
|
+
`).replace(Xa,`
|
|
99
|
+
|
|
100
|
+
`)}${n}
|
|
101
|
+
|
|
102
|
+
`:e+t+n,$a=(e,t)=>{let n=RegExp(`<(${t})(?=[\\s>/])([^>]*)>`,`gi`),r=``,i=0,a=n.exec(e);for(;a;){let t=a[0],o=a[1],s=a.index+t.length,c=e.slice(s);if(RegExp(`</${o}\\s*>`,`i`).test(c)){a=n.exec(e);continue}if(r+=e.slice(i,a.index),c.length===0){r+=t,i=s,a=n.exec(e);continue}if(c.startsWith(`
|
|
103
|
+
|
|
104
|
+
`)){let n=c.slice(2).replace(Za,`
|
|
105
|
+
<!---->
|
|
106
|
+
`);r+=`${t}
|
|
107
|
+
|
|
108
|
+
${n}`,i=e.length;break}if(!c.startsWith(`
|
|
109
|
+
`)){r+=t,i=s,a=n.exec(e);continue}let l=c.slice(1);if(l.trim().length===0){r+=t,i=s,a=n.exec(e);continue}let u=l.replace(Za,`
|
|
110
|
+
<!---->
|
|
111
|
+
`);r+=`${t}
|
|
112
|
+
|
|
113
|
+
${u}`,i=e.length;break}return i===0?e:r+e.slice(i)},eo=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>Qa(t,n,r)),n=$a(n,e)}return n},to=/([\\`*_~[\]|])/g,no=e=>e.replace(to,`\\$1`),ro=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+no(n).replace(/\n\n/g,` `)+r)}return n},io=new Set([`blockquote`,`dd`,`dt`,`figcaption`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`]),ao=new Set([`code`,`kbd`,`pre`,`samp`,`var`]);function oo(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`&&!ao.has(e.tagName)?oo(e):``).join(``)}function so(){return e=>{d(e,`element`,e=>{if(ao.has(e.tagName)){e.properties??={},e.properties.dir=`ltr`;return}io.has(e.tagName)&&(e.properties??={},typeof e.properties.dir!=`string`&&(e.properties.dir=va(oo(e))))})}}var co=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(co).join(``):``,lo=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));d(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=co(e);e.children=t?[{type:`text`,value:t}]:[]}})},uo=()=>e=>{d(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},fo=/^[ \t]*<[\w!/?-]/,po=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,mo=e=>typeof e!=`string`||e.length===0||!fo.test(e)?e:e.replace(po,`$1`),ho={...l,clobberPrefix:``,protocols:{...l.protocols,href:[...l.protocols?.href??[],`tel`,`streamdown`]},attributes:{...l.attributes,code:[...l.attributes?.code??[],`metastring`]}},go={raw:_,sanitize:[c,ho],harden:[m,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},_o={gfm:[x,{}],codeMeta:uo},vo=Object.values(go),yo=Object.values(_o),bo={block:` ▋`,circle:` ●`},xo=[`github-light`,`github-dark`],So={enabled:!0},$=(0,w.createContext)({codeBlockMaxHeight:400,shikiTheme:xo,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:So,tableMaxHeight:300}),Co=(0,w.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{(0,w.useLayoutEffect)(()=>{o?.commit()});let c=typeof e==`string`&&n?mo(e):e,l=(0,z.jsx)(Oa,{...s,children:c});return(0,z.jsx)(kr.Provider,{value:i,children:a?(0,z.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins||!!e.animatePlugin!=!!t.animatePlugin)});Co.displayName=`Block`;var wo=(0,w.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=vo,remarkPlugins:s=yo,className:l,shikiTheme:u,mermaid:d,codeBlockMaxHeight:f=400,controls:p=!0,isAnimating:m=!1,tableMaxHeight:h=300,animated:g,BlockComponent:_=Co,parseMarkdownIntoBlocksFn:v=Ja,caret:y,plugins:b,remend:x,linkSafety:ee=So,lineNumbers:S=!0,allowedTags:C,literalTagContent:T,translations:E,icons:te,prefix:ne,onAnimationStart:re,onAnimationEnd:ie,...D})=>{let O=(0,w.useId)(),ae=(0,w.useMemo)(()=>Nr(ne),[ne]),oe=(0,w.useRef)(null),k=(0,w.useRef)(re),A=(0,w.useRef)(ie);k.current=re,A.current=ie,(0,w.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=oe.current;if(oe.current=m,i===null){m&&((e=k.current)==null||e.call(k));return}m&&!i?(n=k.current)==null||n.call(k):!m&&i&&((r=A.current)==null||r.call(A))},[m,t]);let se=(0,w.useMemo)(()=>C?Object.keys(C):[],[C]),ce=(0,w.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?Ot(e,x):e;return T&&T.length>0&&(n=ro(n,T)),se.length>0&&(n=eo(n,se)),n},[e,t,r,x,se,T]),j=(0,w.useMemo)(()=>v(ce),[ce,v]),le=(0,w.useMemo)(()=>n===`auto`?j.map(va):void 0,[j,n]),ue=(0,w.useMemo)(()=>j.map((e,t)=>`${O}-${t}`),[j.length,O]),M=(0,w.useMemo)(()=>g===!0?`true`:g?JSON.stringify(g):``,[g]),N=(0,w.useRef)(null),de=(0,w.useRef)([]),P=(0,w.useRef)([]),fe=(0,w.useRef)(null),pe=(0,w.useRef)(``);M?(pe.current===M?N.current||=ar():(pe.current=M,N.current=ar({maxBacklogMs:M===`true`?void 0:g.maxBacklogMs}),de.current=[],P.current=[]),m&&N.current&&N.current.beginPass(N.current.now())):(N.current=null,de.current=[],P.current=[],pe.current=``),(0,w.useLayoutEffect)(()=>{var e;m&&((e=N.current)==null||e.commitPass())});let me=(0,w.useMemo)(()=>({codeBlockMaxHeight:f,shikiTheme:u??(b?.code)?.getThemes()??xo,controls:p,isAnimating:m,lineNumbers:S,mode:t,mermaid:d,linkSafety:ee,tableMaxHeight:h}),[f,u,p,m,S,t,d,ee,b?.code,h]),F=(0,w.useMemo)(()=>({...ei,...E}),[(0,w.useMemo)(()=>E?JSON.stringify(E):``,[E])]),he=(0,w.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...ha,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,w.createElement)(t,n):null:(0,w.createElement)(e,n)}return n},[a]),ge=(0,w.useMemo)(()=>{let e=[];return b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsBefore]),e=[...e,...s],b!=null&&b.cjk&&(e=[...e,...b.cjk.remarkPluginsAfter]),b!=null&&b.math&&(e=[...e,b.math.remarkPlugin]),e},[s,b?.math,b?.cjk]),I=(0,w.useMemo)(()=>{let e=o;if(C&&Object.keys(C).length>0&&o===vo){let t={...ho,tagNames:[...ho.tagNames??[],...Object.keys(C)],attributes:{...ho.attributes,...C}};e=[go.raw,[c,t],go.harden]}return T&&T.length>0&&(e=[...e,[lo,T]]),b!=null&&b.math&&(e=[...e,b.math.rehypePlugin]),n===`auto`&&t===`static`&&(e=[...e,so]),e},[o,b?.math,C,T,n,t]),_e=(0,w.useMemo)(()=>{if(!m||j.length===0)return!1;let e=j.at(-1);return xa(e)||Sa(e)},[m,j]),ve=(0,w.useMemo)(()=>y&&m&&!_e?{"--streamdown-caret":`"${bo[y]}"`}:void 0,[y,m,_e]),ye=e=>{let t=null;if(N.current&&m){if(!de.current[e]){let{maxBacklogMs:t,...n}=M&&M!==`true`?g:{};de.current[e]=Or({...n,timeline:N.current})}t=de.current[e]}fe.current!==I&&(P.current=[],fe.current=I),t&&!P.current[e]&&(P.current[e]=[...I,t.rehypePlugin]);let n=t&&P.current[e]?P.current[e]:I;return{blockAnimatePlugin:t,blockRehypePlugins:n}};return t===`static`?(0,z.jsx)(ti.Provider,{value:F,children:(0,z.jsx)(pi.Provider,{value:b??null,children:(0,z.jsx)($.Provider,{value:me,children:(0,z.jsx)($r,{icons:te,children:(0,z.jsx)(Fr.Provider,{value:ae,children:(0,z.jsx)(`div`,{className:ae(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,l),dir:n===`auto`?void 0:n,children:(0,z.jsx)(Oa,{components:he,rehypePlugins:I,remarkPlugins:ge,...D,children:ce})})})})})})}):(0,z.jsx)(ti.Provider,{value:F,children:(0,z.jsx)(pi.Provider,{value:b??null,children:(0,z.jsx)($.Provider,{value:me,children:(0,z.jsx)($r,{icons:te,children:(0,z.jsx)(Fr.Provider,{value:ae,children:(0,z.jsxs)(`div`,{className:ae(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,y&&!_e?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,l),style:ve,children:[j.length===0&&y&&m&&(0,z.jsx)(`span`,{}),j.map((e,t)=>{let a=t===j.length-1,o=m&&a&&xa(e),{blockAnimatePlugin:s,blockRehypePlugins:c}=ye(t);return(0,z.jsx)(_,{animatePlugin:s,components:he,content:e,dir:le?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:c,remarkPlugins:ge,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...D},ue[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.codeBlockMaxHeight===t.codeBlockMaxHeight&&e.tableMaxHeight===t.tableMaxHeight&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);wo.displayName=`Streamdown`;var To=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=X(),d=Y(),f=Z(),p=(0,w.useRef)(null),m=(0,w.useRef)(null),[h,g]=(0,w.useState)(o),[_,v]=(0,w.useState)({x:0,y:0}),[y,b]=(0,w.useState)(!1),[x,ee]=(0,w.useState)({x:0,y:0}),[S,C]=(0,w.useState)({x:0,y:0}),T=(0,w.useCallback)(e=>{g(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),E=(0,w.useCallback)(()=>{T(i)},[T,i]),te=(0,w.useCallback)(()=>{T(-i)},[T,i]),ne=(0,w.useCallback)(()=>{g(o),v({x:0,y:0})},[o]),re=(0,w.useCallback)(e=>{e.preventDefault(),T(e.deltaY>0?-i:i)},[T,i]),ie=(0,w.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;b(!0),ee({x:e.clientX,y:e.clientY}),C(_);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[_]),D=(0,w.useCallback)(e=>{if(!y)return;e.preventDefault();let t=e.clientX-x.x,n=e.clientY-x.y;v({x:S.x+t,y:S.y+n})},[y,x,S]),O=(0,w.useCallback)(e=>{b(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,w.useEffect)(()=>{let e=p.current;if(e)return e.addEventListener(`wheel`,re,{passive:!1}),()=>{e.removeEventListener(`wheel`,re)}},[re]),(0,w.useEffect)(()=>{let e=m.current;if(e&&y)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,D,{passive:!1}),e.addEventListener(`pointerup`,O),e.addEventListener(`pointercancel`,O),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,D),e.removeEventListener(`pointerup`,O),e.removeEventListener(`pointercancel`,O)}},[y,D,O]),(0,z.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:p,style:{cursor:y?`grabbing`:`grab`},children:[a?(0,z.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,z.jsx)(`button`,{"aria-label":f.zoomIn,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h>=r,onClick:E,title:f.zoomIn,type:`button`,children:(0,z.jsx)(l,{"aria-hidden":`true`,size:16})}),(0,z.jsx)(`button`,{"aria-label":f.zoomOut,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:h<=n,onClick:te,title:f.zoomOut,type:`button`,children:(0,z.jsx)(u,{"aria-hidden":`true`,size:16})}),(0,z.jsx)(`button`,{"aria-label":f.resetView,className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:ne,title:f.resetView,type:`button`,children:(0,z.jsx)(c,{"aria-hidden":`true`,size:16})})]}):null,(0,z.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:ie,ref:m,role:`application`,style:{transform:`translate(${_.x}px, ${_.y}px) scale(${h})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},Eo=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=Y(),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(!1),[u,d]=(0,w.useState)(``),[f,p]=(0,w.useState)(``),[m,h]=(0,w.useState)(0),{mermaid:g}=(0,w.useContext)($),_=gi(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=tr({immediate:r});if((0,w.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,z.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,z.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,z.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,z.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,z.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,z.jsx)(`div`,{ref:b,children:(0,z.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,z.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,z.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,z.jsxs)(`details`,{className:a(`mt-2`),children:[(0,z.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,z.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,z.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,z.jsx)(To,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,z.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})},Do=e({HighlightedCodeBlockBody:()=>Oo}),Oo=({code:e,language:t,maxHeight:n,raw:r,className:i,startLine:a,lineNumbers:o,...s})=>{let{shikiTheme:c}=(0,w.useContext)($),l=hi(),[u,d]=(0,w.useState)(r);return(0,w.useEffect)(()=>{if(!l){d(r);return}let n=l.highlight({code:e,language:t,themes:c},e=>{d(e)});n&&d(n)},[e,t,c,l,r]),(0,z.jsx)(Hr,{className:i,language:t,lineNumbers:o,maxHeight:n,result:u,startLine:a,...s})},ko=e({Mermaid:()=>Eo});function Ao(){let e=this.data();(e.micromarkExtensions||=[]).push(f())}function jo(){let e=this.data();(e.toMarkdownExtensions||=[]).push(v())}function Mo(){Ao.call(this),jo.call(this)}var No=Mo;function Po(e){let t=this.data();(t.micromarkExtensions||=[]).push(h(e))}function Fo(){let e=this.data();(e.toMarkdownExtensions||=[]).push(b())}function Io(e){Po.call(this,e),Fo.call(this)}var Lo=Io,Ro=new Set([`。`,`.`,`,`,`、`,`?`,`!`,`:`,`;`,`(`,`)`,`【`,`】`,`「`,`」`,`『`,`』`,`〈`,`〉`,`《`,`》`]),zo=/^(https?:\/\/|mailto:|www\.)/i,Bo=e=>{if(e.children.length!==1)return!1;let t=e.children[0];return t.type===`text`&&t.value===e.url},Vo=e=>{let t=0;for(let n of e){if(Ro.has(n))return t;t+=n.length}return null},Ho=(e,t)=>({...t,url:e,children:[{type:`text`,value:e}]}),Uo=e=>({type:`text`,value:e}),Wo=()=>e=>{d(e,`link`,(e,t,n)=>{if(!n||typeof t!=`number`||!Bo(e)||!zo.test(e.url))return;let r=Vo(e.url);if(r===null||r===0)return;let i=e.url.slice(0,r),a=e.url.slice(r),o=Ho(i,e),s=Uo(a);return n.children.splice(t,1,o,s),t+1})};function Go(){let e=[No],t=[Wo,Lo];return{name:`cjk`,type:`cjk`,remarkPluginsBefore:e,remarkPluginsAfter:t,remarkPlugins:[...e,...t]}}var Ko=Go();export{go as n,wo as r,Ko as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@keyframes sd-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes sd-blurIn{0%{opacity:0;filter:blur(4px)}to{opacity:1;filter:blur()}}@keyframes sd-slideUp{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}[data-sd-animate]{animation:var(--sd-animation,sd-fadeIn) var(--sd-duration,.15s) var(--sd-easing,ease) var(--sd-delay,0s) both}@keyframes sd-markerIn{0%{color:#0000}}[data-sd-animate-marker]::marker{animation:sd-markerIn var(--sd-marker-duration,.15s) var(--sd-marker-easing,ease) var(--sd-marker-delay,0s) both}
|