streamdown 2.1.0 → 2.3.0

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 CHANGED
@@ -28,13 +28,33 @@ Streamdown powers the [AI Elements Message](https://ai-sdk.dev/elements/componen
28
28
  npm i streamdown
29
29
  ```
30
30
 
31
- Then, update your Tailwind `globals.css` to include the following.
31
+ Then, update your Tailwind `globals.css` to include the following so that Tailwind can detect the utility classes used by Streamdown.
32
32
 
33
33
  ```css
34
34
  @source "../node_modules/streamdown/dist/*.js";
35
35
  ```
36
36
 
37
- Make sure the path matches the location of the `node_modules` folder in your project. This will ensure that the Streamdown styles are applied to your project.
37
+ The path must be relative from your CSS file to the `node_modules` folder containing `streamdown`. In a standard Next.js project where `globals.css` lives in `app/`, the default path above should work.
38
+
39
+ ### Monorepo setup
40
+
41
+ In a monorepo (npm workspaces, Turbo, pnpm, etc.), dependencies are typically hoisted to the root `node_modules`. You need to adjust the relative path to point there:
42
+
43
+ ```
44
+ monorepo/
45
+ ├── node_modules/streamdown/ ← hoisted here
46
+ ├── apps/
47
+ │ └── web/
48
+ │ └── app/
49
+ │ └── globals.css ← your CSS file
50
+ ```
51
+
52
+ ```css
53
+ /* apps/web/app/globals.css → 3 levels up to reach root node_modules */
54
+ @source "../../../node_modules/streamdown/dist/*.js";
55
+ ```
56
+
57
+ Adjust the number of `../` segments based on where your CSS file lives relative to the root `node_modules`.
38
58
 
39
59
  ## Usage
40
60
 
@@ -48,6 +68,7 @@ import { mermaid } from "@streamdown/mermaid";
48
68
  import { math } from "@streamdown/math";
49
69
  import { cjk } from "@streamdown/cjk";
50
70
  import "katex/dist/katex.min.css";
71
+ import "streamdown/styles.css";
51
72
 
52
73
  export default function Chat() {
53
74
  const { messages, status } = useChat();
@@ -61,6 +82,7 @@ export default function Chat() {
61
82
  part.type === 'text' ? (
62
83
  <Streamdown
63
84
  key={index}
85
+ animated
64
86
  plugins={{ code, mermaid, math, cjk }}
65
87
  isAnimating={status === 'streaming'}
66
88
  >
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import {createContext,memo,useMemo,lazy,useContext,isValidElement,useId,useTransition,useState,useEffect,cloneElement,useCallback,useRef,Suspense}from'react';import {harden}from'rehype-harden';import po from'rehype-raw';import To,{defaultSchema}from'rehype-sanitize';import Er from'remark-gfm';import Hr from'remend';import {visitParents,SKIP}from'unist-util-visit-parents';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {toJsxRuntime}from'hast-util-to-jsx-runtime';import {urlAttributes}from'html-url-attributes';import ar from'remark-parse';import ir from'remark-rehype';import {unified}from'unified';import {visit}from'unist-util-visit';import {Lexer}from'marked';var Oo=300,Vo="300px",Ao=500;function Ge(e={}){let{immediate:t=false,debounceDelay:o=Oo,rootMargin:n=Vo,idleTimeout:s=Ao}=e,[r,i]=useState(false),c=useRef(null),a=useRef(null),l=useRef(null),m=useMemo(()=>g=>{let b=Date.now();return window.setTimeout(()=>{g({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-b))});},1)},[]),d=useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(g,b)=>window.requestIdleCallback(g,b):m,[m]),p=useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?g=>window.cancelIdleCallback(g):g=>{clearTimeout(g);},[]);return useEffect(()=>{if(t){i(true);return}let g=c.current;if(!g)return;a.current&&(clearTimeout(a.current),a.current=null),l.current&&(p(l.current),l.current=null);let b=()=>{a.current&&(clearTimeout(a.current),a.current=null),l.current&&(p(l.current),l.current=null);},h=w=>{l.current=d(T=>{T.timeRemaining()>0||T.didTimeout?(i(true),w.disconnect()):l.current=d(()=>{i(true),w.disconnect();},{timeout:s/2});},{timeout:s});},u=w=>{b(),a.current=window.setTimeout(()=>{var S,B;let T=w.takeRecords();(T.length===0||(B=(S=T.at(-1))==null?void 0:S.isIntersecting)!=null&&B)&&h(w);},o);},C=(w,T)=>{w.isIntersecting?u(T):b();},k=new IntersectionObserver(w=>{for(let T of w)C(T,k);},{rootMargin:n,threshold:0});return k.observe(g),()=>{a.current&&clearTimeout(a.current),l.current&&p(l.current),k.disconnect();}},[t,o,n,s,p,d]),{shouldRender:r,containerRef:c}}var Ye=/\s/,qo=/^\s+$/,_o=new Set(["code","pre","svg","math","annotation"]),Zo=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Wo=e=>e.some(t=>Zo(t)&&_o.has(t.tagName)),$o=e=>{let t=[],o="",n=false;for(let s of e){let r=Ye.test(s);r!==n&&o&&(t.push(o),o=""),o+=s,n=r;}return o&&t.push(o),t},Fo=e=>{let t=[],o="";for(let n of e)Ye.test(n)?o+=n:(o&&(t.push(o),o=""),t.push(n));return o&&t.push(o),t},Uo=(e,t,o,n)=>({type:"element",tagName:"span",properties:{"data-sd-animate":true,style:`--sd-animation:sd-${t};--sd-duration:${o}ms;--sd-easing:${n}`},children:[{type:"text",value:e}]}),Xo=(e,t,o)=>{let n=t.at(-1);if(!(n&&"children"in n))return;if(Wo(t))return SKIP;let s=n,r=s.children.indexOf(e);if(r===-1)return;let i=e.value;if(!i.trim())return;let a=(o.sep==="char"?Fo(i):$o(i)).map(l=>qo.test(l)?{type:"text",value:l}:Uo(l,o.animation,o.duration,o.easing));return s.children.splice(r,1,...a),r+a.length};function Q(e){var n,s,r,i;let t={animation:(n=e==null?void 0:e.animation)!=null?n:"fadeIn",duration:(s=e==null?void 0:e.duration)!=null?s:150,easing:(r=e==null?void 0:e.easing)!=null?r:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word"};return {name:"animate",type:"animate",rehypePlugin:()=>c=>{visitParents(c,"text",(a,l)=>Xo(a,l,t));}}}Q();var Re=createContext(false),Ie=()=>useContext(Re);var f=(...e)=>twMerge(clsx(e)),q=(e,t,o)=>{let n=typeof t=="string"?new Blob([t],{type:o}):t,s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s);};var tn=f("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"),on=e=>{let t={};for(let o of e.split(";")){let n=o.indexOf(":");if(n>0){let s=o.slice(0,n).trim(),r=o.slice(n+1).trim();s&&r&&(t[s]=r);}}return t},Qe=memo(({children:e,result:t,language:o,className:n,...s})=>{let r=useMemo(()=>{let i={};return t.bg&&(i["--sdm-bg"]=t.bg),t.fg&&(i["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(i,on(t.rootStyle)),i},[t.bg,t.fg,t.rootStyle]);return jsx("div",{className:f(n,"overflow-hidden rounded-md border border-border bg-background p-4 text-sm"),"data-language":o,"data-streamdown":"code-block-body",...s,children:jsx("pre",{className:f(n,"bg-[var(--sdm-bg,inherit]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),style:r,children:jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:t.tokens.map((i,c)=>jsx("span",{className:tn,children:i.map((a,l)=>{let m={},d=!!a.bgColor;if(a.color&&(m["--sdm-c"]=a.color),a.bgColor&&(m["--sdm-tbg"]=a.bgColor),a.htmlStyle)for(let[p,g]of Object.entries(a.htmlStyle))p==="color"?m["--sdm-c"]=g:p==="background-color"?(m["--sdm-tbg"]=g,d=true):m[p]=g;return jsx("span",{className:f("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",d&&"bg-[var(--sdm-tbg)]",d&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:m,...a.htmlAttrs,children:a.content},l)})},c))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className);var et=({className:e,language:t,style:o,isIncomplete:n,...s})=>jsx("div",{className:f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",e),"data-incomplete":n||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...o},...s});var Se=createContext({code:""}),de=()=>useContext(Se);var ot=({language:e})=>jsx("div",{className:"flex h-8 items-center text-muted-foreground text-xs","data-language":e,"data-streamdown":"code-block-header",children:jsx("span",{className:"ml-1 font-mono lowercase",children:e})});var cn=/\n+$/,dn=lazy(()=>import('./highlighted-body-B3W2YXNL.js').then(e=>({default:e.HighlightedCodeBlockBody}))),rt=({code:e,language:t,className:o,children:n,isIncomplete:s=false,...r})=>{let i=useMemo(()=>e.replace(cn,""),[e]),c=useMemo(()=>({bg:"transparent",fg:"inherit",tokens:i.split(`
3
+ `).map(a=>[{content:a,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[i]);return jsx(Se.Provider,{value:{code:e},children:jsxs(et,{isIncomplete:s,language:t,children:[jsx(ot,{language:t}),n?jsx("div",{className:"pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end",children:jsx("div",{className:"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:n})}):null,jsx(Suspense,{fallback:jsx(Qe,{className:o,language:t,result:c,...r}),children:jsx(dn,{className:o,code:i,language:t,raw:c,...r})})]})})};var J=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),K=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),Z=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),st=e=>jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),at=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),it=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),me=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),Ee=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),lt=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),ct=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})});var He=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:s,code:r,...i})=>{let[c,a]=useState(false),l=useRef(0),{code:m}=de(),{isAnimating:d}=useContext(R),p=r!=null?r:m,g=async()=>{var h;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{c||(await navigator.clipboard.writeText(p),a(!0),e==null||e(),l.current=window.setTimeout(()=>a(!1),o));}catch(u){t==null||t(u);}};useEffect(()=>()=>{window.clearTimeout(l.current);},[]);let b=c?J:K;return jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),"data-streamdown":"code-block-copy-button",disabled:d,onClick:g,title:"Copy Code",type:"button",...i,children:n!=null?n:jsx(b,{size:14})})};var mt={"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",\u6587\u8A00:"wy"},ut=({onDownload:e,onError:t,language:o,children:n,className:s,code:r,...i})=>{let{code:c}=de(),{isAnimating:a}=useContext(R),l=r!=null?r:c,d=`file.${o&&o in mt?mt[o]:"txt"}`,p="text/plain",g=()=>{try{q(d,l,p),e==null||e();}catch(b){t==null||t(b);}};return jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),"data-streamdown":"code-block-download-button",disabled:a,onClick:g,title:"Download file",type:"button",...i,children:n!=null?n:jsx(Z,{size:14})})};var ft=()=>jsxs("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[jsx("div",{className:"h-[46px] w-full bg-muted/80"}),jsx("div",{className:"flex w-full items-center justify-center p-4",children:jsx(st,{className:"size-4 animate-spin"})})]});var Cn=/\.[^/.]+$/,ht=({node:e,className:t,src:o,alt:n,onLoad:s,onError:r,...i})=>{let c=useRef(null),[a,l]=useState(false),[m,d]=useState(false),p=i.width!=null||i.height!=null,g=(a||p)&&!m,b=m&&!p;useEffect(()=>{let k=c.current;if(k!=null&&k.complete){let w=k.naturalWidth>0;l(w),d(!w);}},[]);let h=useCallback(k=>{l(true),d(false),s==null||s(k);},[s]),u=useCallback(k=>{l(false),d(true),r==null||r(k);},[r]),C=async()=>{if(o)try{let w=await(await fetch(o)).blob(),H=new URL(o,window.location.origin).pathname.split("/").pop()||"",S=H.split(".").pop(),B=H.includes(".")&&S!==void 0&&S.length<=4,O="";if(B)O=H;else {let E=w.type,I="png";E.includes("jpeg")||E.includes("jpg")?I="jpg":E.includes("png")?I="png":E.includes("svg")?I="svg":E.includes("gif")?I="gif":E.includes("webp")&&(I="webp"),O=`${(n||H||"image").replace(Cn,"")}.${I}`;}q(O,w,w.type);}catch(k){window.open(o,"_blank");}};return o?jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[jsx("img",{alt:n,className:f("max-w-full rounded-lg",b&&"hidden",t),"data-streamdown":"image",onError:u,onLoad:h,ref:c,src:o,...i}),b&&jsx("span",{className:"text-muted-foreground text-xs italic","data-streamdown":"image-fallback",children:"Image not available"}),jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),g&&jsx("button",{className:f("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:C,title:"Download image",type:"button",children:jsx(Z,{size:14})})]}):null};var oe=0,Mn=()=>{oe+=1,oe===1&&(document.body.style.overflow="hidden");},Tn=()=>{oe=Math.max(0,oe-1),oe===0&&(document.body.style.overflow="");},kt=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let[s,r]=useState(false),i=useCallback(async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3);}catch(a){}},[e]),c=useCallback(()=>{n(),o();},[n,o]);return useEffect(()=>{if(t){Mn();let a=l=>{l.key==="Escape"&&o();};return document.addEventListener("keydown",a),()=>{document.removeEventListener("keydown",a),Tn();}}},[t,o]),t?jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:o,onKeyDown:a=>{a.key==="Escape"&&o();},role:"button",tabIndex:0,children:jsxs("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:a=>a.stopPropagation(),onKeyDown:a=>a.stopPropagation(),role:"presentation",children:[jsx("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:o,title:"Close",type:"button",children:jsx(me,{size:16})}),jsxs("div",{className:"flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[jsx(Ee,{size:20}),jsx("span",{children:"Open external link?"})]}),jsx("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),jsx("div",{className:f("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{className:"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:i,type:"button",children:s?jsxs(Fragment,{children:[jsx(J,{size:14}),jsx("span",{children:"Copied"})]}):jsxs(Fragment,{children:[jsx(K,{size:14}),jsx("span",{children:"Copy link"})]})}),jsxs("button",{className:"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:c,type:"button",children:[jsx(Ee,{size:14}),jsx("span",{children:"Open link"})]})]})]})}):null};var pe=createContext(null),Ct=()=>useContext(pe),Ks=()=>{var t;let e=Ct();return (t=e==null?void 0:e.code)!=null?t:null},G=()=>{var t;let e=Ct();return (t=e==null?void 0:e.mermaid)!=null?t:null};var vt=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((s,r)=>{let i="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),c=new Image;c.crossOrigin="anonymous",c.onload=()=>{let a=document.createElement("canvas"),l=c.width*o,m=c.height*o;a.width=l,a.height=m;let d=a.getContext("2d");if(!d){r(new Error("Failed to create 2D canvas context for PNG export"));return}d.drawImage(c,0,0,l,m),a.toBlob(p=>{if(!p){r(new Error("Failed to create PNG blob"));return}s(p);},"image/png");},c.onerror=()=>r(new Error("Failed to load SVG image")),c.src=i;})};var Pt=({chart:e,children:t,className:o,onDownload:n,config:s,onError:r})=>{let[i,c]=useState(false),a=useRef(null),{isAnimating:l}=useContext(R),m=G(),d=async p=>{try{if(p==="mmd"){q("diagram.mmd",e,"text/plain"),c(!1),n==null||n(p);return}if(!m){r==null||r(new Error("Mermaid plugin not available"));return}let g=m.getMermaid(s),b=e.split("").reduce((C,k)=>(C<<5)-C+k.charCodeAt(0)|0,0),h=`mermaid-${Math.abs(b)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:u}=await g.render(h,e);if(!u){r==null||r(new Error("SVG not found. Please wait for the diagram to render."));return}if(p==="svg"){q("diagram.svg",u,"image/svg+xml"),c(!1),n==null||n(p);return}if(p==="png"){let C=await vt(u);q("diagram.png",C,"image/png"),n==null||n(p),c(!1);return}}catch(g){r==null||r(g);}};return useEffect(()=>{let p=g=>{let b=g.composedPath();a.current&&!b.includes(a.current)&&c(false);};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[]),jsxs("div",{className:"relative",ref:a,children:[jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:l,onClick:()=>c(!i),title:"Download diagram",type:"button",children:t!=null?t:jsx(Z,{size:14})}),i?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})};var re=0,On=()=>{re+=1,re===1&&(document.body.style.overflow="hidden");},Vn=()=>{re=Math.max(0,re-1),re===0&&(document.body.style.overflow="");},Lt=({chart:e,config:t,onFullscreen:o,onExit:n,className:s,...r})=>{let[i,c]=useState(false),{isAnimating:a,controls:l}=useContext(R),m=(()=>{if(typeof l=="boolean")return l;let p=l.mermaid;return p===false?false:p===true||p===void 0?true:p.panZoom!==false})(),d=()=>{c(!i);};return useEffect(()=>{if(i){On();let p=g=>{g.key==="Escape"&&c(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),Vn();}}},[i]),useEffect(()=>{i?o==null||o():n&&n();},[i,o,n]),jsxs(Fragment,{children:[jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",s),disabled:a,onClick:d,title:"View fullscreen",type:"button",...r,children:jsx(at,{size:14})}),i?createPortal(jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:d,onKeyDown:p=>{p.key==="Escape"&&d();},role:"button",tabIndex:0,children:[jsx("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:d,title:"Exit fullscreen",type:"button",children:jsx(me,{size:20})}),jsx("div",{className:"flex size-full items-center justify-center p-4",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:jsx(Nt,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:true,showControls:m})})]}),document.body):null]})};var ue=e=>{var r,i;let t=[],o=[],n=e.querySelectorAll("thead th");for(let c of n)t.push(((r=c.textContent)==null?void 0:r.trim())||"");let s=e.querySelectorAll("tbody tr");for(let c of s){let a=[],l=c.querySelectorAll("td");for(let m of l)a.push(((i=m.textContent)==null?void 0:i.trim())||"");o.push(a);}return {headers:t,rows:o}},fe=e=>{let{headers:t,rows:o}=e,n=c=>{let a=false,l=false;for(let m of c){if(m==='"'){a=true,l=true;break}(m===","||m===`
4
+ `)&&(a=true);}return a?l?`"${c.replace(/"/g,'""')}"`:`"${c}"`:c},s=t.length>0?o.length+1:o.length,r=new Array(s),i=0;t.length>0&&(r[i]=t.map(n).join(","),i+=1);for(let c of o)r[i]=c.map(n).join(","),i+=1;return r.join(`
5
+ `)},Rt=e=>{let{headers:t,rows:o}=e,n=c=>{let a=false;for(let m of c)if(m===" "||m===`
6
+ `||m==="\r"){a=true;break}if(!a)return c;let l=[];for(let m of c)m===" "?l.push("\\t"):m===`
7
+ `?l.push("\\n"):m==="\r"?l.push("\\r"):l.push(m);return l.join("")},s=t.length>0?o.length+1:o.length,r=new Array(s),i=0;t.length>0&&(r[i]=t.map(n).join(" "),i+=1);for(let c of o)r[i]=c.map(n).join(" "),i+=1;return r.join(`
8
+ `)},De=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):o.push(n);return o.join("")},se=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),s=0,r=t.map(c=>De(c));n[s]=`| ${r.join(" | ")} |`,s+=1;let i=new Array(t.length);for(let c=0;c<t.length;c+=1)i[c]="---";n[s]=`| ${i.join(" | ")} |`,s+=1;for(let c of o)if(c.length<t.length){let a=new Array(t.length);for(let l=0;l<t.length;l+=1)a[l]=l<c.length?De(c[l]):"";n[s]=`| ${a.join(" | ")} |`,s+=1;}else {let a=c.map(l=>De(l));n[s]=`| ${a.join(" | ")} |`,s+=1;}return n.join(`
9
+ `)};var Ht=({children:e,className:t,onCopy:o,onError:n,timeout:s=2e3})=>{let[r,i]=useState(false),[c,a]=useState(false),l=useRef(null),m=useRef(0),{isAnimating:d}=useContext(R),p=async b=>{var h,u;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.write)){n==null||n(new Error("Clipboard API not available"));return}try{let C=(u=l.current)==null?void 0:u.closest('[data-streamdown="table-wrapper"]'),k=C==null?void 0:C.querySelector("table");if(!k){n==null||n(new Error("Table not found"));return}let w=ue(k),S=({csv:fe,tsv:Rt,md:se}[b]||se)(w),B=new ClipboardItem({"text/plain":new Blob([S],{type:"text/plain"}),"text/html":new Blob([k.outerHTML],{type:"text/html"})});await navigator.clipboard.write([B]),a(!0),i(!1),o==null||o(b),m.current=window.setTimeout(()=>a(!1),s);}catch(C){n==null||n(C);}};useEffect(()=>{let b=h=>{let u=h.composedPath();l.current&&!u.includes(l.current)&&i(false);};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b),window.clearTimeout(m.current);}},[]);let g=c?J:K;return jsxs("div",{className:"relative",ref:l,children:[jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:d,onClick:()=>i(!r),title:"Copy table",type:"button",children:e!=null?e:jsx(g,{size:14})}),r?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("md"),title:"Copy table as Markdown",type:"button",children:"Markdown"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})};var Dt=({children:e,className:t,onDownload:o,onError:n})=>{let[s,r]=useState(false),i=useRef(null),{isAnimating:c}=useContext(R),a=l=>{var m;try{let d=(m=i.current)==null?void 0:m.closest('[data-streamdown="table-wrapper"]'),p=d==null?void 0:d.querySelector("table");if(!p){n==null||n(new Error("Table not found"));return}let g=ue(p),b=l==="csv"?fe(g):se(g);q(`table.${l==="csv"?"csv":"md"}`,b,l==="csv"?"text/csv":"text/markdown"),r(!1),o==null||o(l);}catch(d){n==null||n(d);}};return useEffect(()=>{let l=m=>{let d=m.composedPath();i.current&&!d.includes(i.current)&&r(false);};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l);}},[]),jsxs("div",{className:"relative",ref:i,children:[jsx("button",{className:f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:()=>r(!s),title:"Download table",type:"button",children:e!=null?e:jsx(Z,{size:14})}),s?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>a("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>a("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})};var Vt=({children:e,className:t,showControls:o,...n})=>jsxs("div",{className:"my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2","data-streamdown":"table-wrapper",children:[o?jsxs("div",{className:"flex items-center justify-end gap-1",children:[jsx(Ht,{}),jsx(Dt,{})]}):null,jsx("div",{className:"border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background",children:jsx("table",{className:f("w-full divide-y divide-border",t),"data-streamdown":"table",...n,children:e})})]});var Jn=lazy(()=>import('./mermaid-3ZIDBTTL.js').then(e=>({default:e.Mermaid}))),Kn=/language-([^\s]+)/;function ke(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,s=e.position.end,r=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(s==null?void 0:s.line)===(r==null?void 0:r.line)&&(s==null?void 0:s.column)===(r==null?void 0:r.column)}function N(e,t){return e.className===t.className&&ke(e.node,t.node)}var Ve=(e,t)=>typeof e=="boolean"?e:e[t]!==false,he=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},je=memo(({children:e,className:t,node:o,...n})=>jsx("ol",{className:f("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>N(e,t));je.displayName="MarkdownOl";var At=memo(({children:e,className:t,node:o,...n})=>jsx("li",{className:f("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&ke(e.node,t.node));At.displayName="MarkdownLi";var jt=memo(({children:e,className:t,node:o,...n})=>jsx("ul",{className:f("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>N(e,t));jt.displayName="MarkdownUl";var zt=memo(({className:e,node:t,...o})=>jsx("hr",{className:f("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o}),(e,t)=>N(e,t));zt.displayName="MarkdownHr";var qt=memo(({children:e,className:t,node:o,...n})=>jsx("span",{className:f("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>N(e,t));qt.displayName="MarkdownStrong";var Gn=({children:e,className:t,href:o,node:n,...s})=>{let{linkSafety:r}=useContext(R),[i,c]=useState(false),a=o==="streamdown:incomplete-link",l=useCallback(async g=>{if(!(!(r!=null&&r.enabled&&o)||a)){if(g.preventDefault(),r.onLinkCheck&&await r.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}c(true);}},[r,o,a]),m=useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),d=useCallback(()=>{c(false);},[]),p={url:o!=null?o:"",isOpen:i,onClose:d,onConfirm:m};return r!=null&&r.enabled&&o?jsxs(Fragment,{children:[jsx("button",{className:f("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":a,"data-streamdown":"link",onClick:l,type:"button",children:e}),r.renderModal?r.renderModal(p):jsx(kt,{...p})]}):jsx("a",{className:f("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":a,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...s,children:e})},_t=memo(Gn,(e,t)=>N(e,t)&&e.href===t.href);_t.displayName="MarkdownA";var Zt=memo(({children:e,className:t,node:o,...n})=>jsx("h1",{className:f("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>N(e,t));Zt.displayName="MarkdownH1";var Wt=memo(({children:e,className:t,node:o,...n})=>jsx("h2",{className:f("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>N(e,t));Wt.displayName="MarkdownH2";var $t=memo(({children:e,className:t,node:o,...n})=>jsx("h3",{className:f("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>N(e,t));$t.displayName="MarkdownH3";var Ft=memo(({children:e,className:t,node:o,...n})=>jsx("h4",{className:f("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>N(e,t));Ft.displayName="MarkdownH4";var Ut=memo(({children:e,className:t,node:o,...n})=>jsx("h5",{className:f("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>N(e,t));Ut.displayName="MarkdownH5";var Xt=memo(({children:e,className:t,node:o,...n})=>jsx("h6",{className:f("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>N(e,t));Xt.displayName="MarkdownH6";var Jt=memo(({children:e,className:t,node:o,...n})=>{let{controls:s}=useContext(R),r=Ve(s,"table");return jsx(Vt,{className:t,showControls:r,...n,children:e})},(e,t)=>N(e,t));Jt.displayName="MarkdownTable";var Kt=memo(({children:e,className:t,node:o,...n})=>jsx("thead",{className:f("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>N(e,t));Kt.displayName="MarkdownThead";var Gt=memo(({children:e,className:t,node:o,...n})=>jsx("tbody",{className:f("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>N(e,t));Gt.displayName="MarkdownTbody";var Yt=memo(({children:e,className:t,node:o,...n})=>jsx("tr",{className:f("border-border",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>N(e,t));Yt.displayName="MarkdownTr";var Qt=memo(({children:e,className:t,node:o,...n})=>jsx("th",{className:f("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>N(e,t));Qt.displayName="MarkdownTh";var eo=memo(({children:e,className:t,node:o,...n})=>jsx("td",{className:f("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>N(e,t));eo.displayName="MarkdownTd";var to=memo(({children:e,className:t,node:o,...n})=>jsx("blockquote",{className:f("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>N(e,t));to.displayName="MarkdownBlockquote";var oo=memo(({children:e,className:t,node:o,...n})=>jsx("sup",{className:f("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>N(e,t));oo.displayName="MarkdownSup";var no=memo(({children:e,className:t,node:o,...n})=>jsx("sub",{className:f("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>N(e,t));no.displayName="MarkdownSub";var ro=memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let r=a=>{var p,g;if(!isValidElement(a))return false;let l=Array.isArray(a.props.children)?a.props.children:[a.props.children],m=false,d=false;for(let b of l)if(b){if(typeof b=="string")b.trim()!==""&&(m=true);else if(isValidElement(b))if(((p=b.props)==null?void 0:p["data-footnote-backref"])!==void 0)d=true;else {let h=Array.isArray(b.props.children)?b.props.children:[b.props.children];for(let u of h){if(typeof u=="string"&&u.trim()!==""){m=true;break}if(isValidElement(u)&&((g=u.props)==null?void 0:g["data-footnote-backref"])===void 0){m=true;break}}}}return d&&!m},i=Array.isArray(e)?e.map(a=>{if(!isValidElement(a))return a;if(a.type===je){let m=(Array.isArray(a.props.children)?a.props.children:[a.props.children]).filter(d=>!r(d));return m.length===0?null:{...a,props:{...a.props,children:m}}}return a}):e;return (Array.isArray(i)?i.some(a=>a!==null):i!==null)?jsx("section",{className:t,...n,children:i}):null}return jsx("section",{className:t,...n,children:e})},(e,t)=>N(e,t));ro.displayName="MarkdownSection";var Yn=({node:e,className:t,children:o,...n})=>{var g;let s=!("data-block"in n),{mermaid:r,controls:i}=useContext(R),c=G(),a=Ie();if(s)return jsx("code",{className:f("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let l=t==null?void 0:t.match(Kn),m=(g=l==null?void 0:l.at(1))!=null?g:"",d="";if(isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?d=o.props.children:typeof o=="string"&&(d=o),m==="mermaid"&&c){let b=Ve(i,"mermaid"),h=he(i,"download"),u=he(i,"copy"),C=he(i,"fullscreen"),k=he(i,"panZoom"),w=b&&(h||u||C);return jsx(Suspense,{fallback:jsx(ft,{}),children:jsxs("div",{className:f("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:[jsx("div",{className:"flex h-8 items-center text-muted-foreground text-xs",children:jsx("span",{className:"ml-1 font-mono lowercase",children:"mermaid"})}),w?jsx("div",{className:"pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end",children:jsxs("div",{className:"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:[h?jsx(Pt,{chart:d,config:r==null?void 0:r.config}):null,u?jsx(He,{code:d}):null,C?jsx(Lt,{chart:d,config:r==null?void 0:r.config}):null]})}):null,jsx("div",{className:"rounded-md border border-border bg-background",children:jsx(Jn,{chart:d,config:r==null?void 0:r.config,showControls:k})})]})})}let p=Ve(i,"code");return jsx(rt,{className:t,code:d,isIncomplete:a,language:m,children:p?jsxs(Fragment,{children:[jsx(ut,{code:d,language:m}),jsx(He,{})]}):null})},so=memo(Yn,(e,t)=>e.className===t.className&&ke(e.node,t.node));so.displayName="MarkdownCode";var ao=memo(ht,(e,t)=>e.className===t.className&&ke(e.node,t.node));ao.displayName="MarkdownImg";var io=memo(({children:e,node:t,...o})=>{let s=(Array.isArray(e)?e:[e]).filter(r=>r!=null&&r!=="");if(s.length===1&&isValidElement(s[0])){let r=s[0].props.node,i=r==null?void 0:r.tagName;if(i==="img")return jsx(Fragment,{children:e});if(i==="code"&&"data-block"in s[0].props)return jsx(Fragment,{children:e})}return jsx("p",{...o,children:e})},(e,t)=>N(e,t));io.displayName="MarkdownParagraph";var lo={ol:je,li:At,ul:jt,hr:zt,strong:qt,a:_t,h1:Zt,h2:Wt,h3:$t,h4:Ft,h5:Ut,h6:Xt,table:Jt,thead:Kt,tbody:Gt,tr:Yt,th:Qt,td:eo,blockquote:to,code:so,img:ao,pre:({children:e})=>isValidElement(e)?cloneElement(e,{"data-block":"true"}):e,sup:oo,sub:no,p:io,section:ro};var Qn=/^[ \t]{0,3}(`{3,}|~{3,})/,er=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,ze=e=>{let t=e.split(`
10
+ `),o=null,n=0;for(let s of t){let r=Qn.exec(s);if(o===null){if(r){let i=r[1];o=i[0],n=i.length;}}else if(r){let i=r[1],c=i[0],a=i.length;c===o&&a>=n&&(o=null,n=0);}}return o!==null},co=e=>{let t=e.split(`
11
+ `);for(let o of t){let n=o.trim();if(n.length>0&&n.includes("|")&&er.test(n))return true}return false};var mo=()=>e=>{visit(e,"html",(t,o,n)=>{!n||typeof o!="number"||(n.children[o]={type:"text",value:t.value});});};var uo=[],fo={allowDangerousHtml:true},Ce=new WeakMap,_e=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let o=this.keyCache.get(t);if(o)return o;let n=t.rehypePlugins,s=t.remarkPlugins,r=t.remarkRehypeOptions;if(!(n||s||r)){let d="default";return this.keyCache.set(t,d),d}let i=d=>{if(!d||d.length===0)return "";let p="";for(let g=0;g<d.length;g+=1){let b=d[g];if(g>0&&(p+=","),Array.isArray(b)){let[h,u]=b;if(typeof h=="function"){let C=Ce.get(h);C||(C=h.name,Ce.set(h,C)),p+=C;}else p+=String(h);p+=":",p+=JSON.stringify(u);}else if(typeof b=="function"){let h=Ce.get(b);h||(h=b.name,Ce.set(b,h)),p+=h;}else p+=String(b);}return p},c=i(n),a=i(s),l=r?JSON.stringify(r):"",m=`${a}::${c}::${l}`;return this.keyCache.set(t,m),m}get(t){let o=this.generateCacheKey(t),n=this.cache.get(o);return n&&(this.cache.delete(o),this.cache.set(o,n)),n}set(t,o){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let s=this.cache.keys().next().value;s&&this.cache.delete(s);}this.cache.set(n,o);}clear(){this.cache.clear();}},go=new _e,Ze=e=>{let t=dr(e),o=e.children||"";return br(t.runSync(t.parse(o),o),e)},dr=e=>{let t=go.get(e);if(t)return t;let o=pr(e);return go.set(e,o),o},mr=e=>e.some(t=>Array.isArray(t)?t[0]===po:t===po),pr=e=>{let t=e.rehypePlugins||uo,o=e.remarkPlugins||uo,n=mr(t)?o:[...o,mo],s=e.remarkRehypeOptions?{...fo,...e.remarkRehypeOptions}:fo;return unified().use(ar).use(n).use(ir,s).use(t)},bo=e=>e,ur=(e,t,o,n)=>{o?e.children.splice(t,1):e.children[t]={type:"text",value:n};},fr=(e,t)=>{var o;for(let n in urlAttributes)if(Object.hasOwn(urlAttributes,n)&&Object.hasOwn(e.properties,n)){let s=e.properties[n],r=urlAttributes[n];(r===null||r.includes(e.tagName))&&(e.properties[n]=(o=t(String(s||""),n,e))!=null?o:void 0);}},gr=(e,t,o,n,s,r)=>{let i=false;return n?i=!n.includes(e.tagName):s&&(i=s.includes(e.tagName)),!i&&r&&typeof t=="number"&&(i=!r(e,t,o)),i},br=(e,t)=>{let{allowElement:o,allowedElements:n,disallowedElements:s,skipHtml:r,unwrapDisallowed:i,urlTransform:c}=t;if(o||n||s||r||c){let l=c||bo;visit(e,(m,d,p)=>{if(m.type==="raw"&&p&&typeof d=="number")return ur(p,d,r,m.value),d;if(m.type==="element"&&(fr(m,l),gr(m,d,p,n,s,o)&&p&&typeof d=="number"))return i&&m.children?p.children.splice(d,1,...m.children):p.children.splice(d,1),d});}return toJsxRuntime(e,{Fragment:Fragment,components:t.components,ignoreInvalidStyle:true,jsx:jsx,jsxs:jsxs,passKeys:true,passNode:true})};var yr=/\[\^[\w-]{1,200}\](?!:)/,wr=/\[\^[\w-]{1,200}\]:/;var kr=/<(\w+)[\s>]/,Cr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ho=new Map,yo=new Map,vr=e=>{let t=e.toLowerCase(),o=ho.get(t);if(o)return o;let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return ho.set(t,n),n},xr=e=>{let t=e.toLowerCase(),o=yo.get(t);if(o)return o;let n=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return yo.set(t,n),n},wo=(e,t)=>{if(Cr.has(t.toLowerCase()))return 0;let o=e.match(vr(t));if(!o)return 0;let n=0;for(let s of o)s.trimEnd().endsWith("/>")||(n+=1);return n},ko=(e,t)=>{let o=e.match(xr(t));return o?o.length:0},Pr=e=>{let t=0;for(let o=0;o<e.length-1;o+=1)e[o]==="$"&&e[o+1]==="$"&&(t+=1,o+=1);return t},We=e=>{let t=yr.test(e),o=wr.test(e);if(t||o)return [e];let n=Lexer.lex(e,{gfm:true}),s=[],r=[],i=false;for(let c of n){let a=c.raw,l=s.length;if(r.length>0){s[l-1]+=a;let m=r.at(-1),d=wo(a,m),p=ko(a,m);for(let g=0;g<d;g+=1)r.push(m);for(let g=0;g<p;g+=1)r.length>0&&r.at(-1)===m&&r.pop();continue}if(c.type==="html"&&c.block){let m=a.match(kr);if(m){let d=m[1],p=wo(a,d),g=ko(a,d);p>g&&r.push(d);}}if(l>0&&!i){let m=s[l-1];if(Pr(m)%2===1){s[l-1]=m+a;continue}}s.push(a),c.type!=="space"&&(i=c.type==="code");}return s};var Co=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let s=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(s,(r,i,c,a)=>{let l=c.replace(/\n\n/g,`
12
+ <!---->
13
+ `);return i+l+a});}return o};var Br=/^[ \t]*<[\w!/?-]/,Dr=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Or=e=>typeof e!="string"||e.length===0||!Br.test(e)?e:e.replace(Dr,"$1"),xo,Po,ve={...defaultSchema,protocols:{...defaultSchema.protocols,href:[...(Po=(xo=defaultSchema.protocols)==null?void 0:xo.href)!=null?Po:[],"tel"]}},Fe={raw:po,sanitize:[To,ve],harden:[harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},Vr={gfm:[Er,{}]},vo=Object.values(Fe),Ar=Object.values(Vr),jr={block:" \u258B",circle:" \u25CF"},zr={shikiTheme:["github-light","github-dark"],controls:true,isAnimating:false,mode:"streaming",mermaid:void 0,linkSafety:{enabled:true}},R=createContext(zr),No=memo(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:o,index:n,isIncomplete:s,...r})=>{let i=typeof e=="string"&&o?Or(e):e;return jsx(Re.Provider,{value:s,children:jsx(Ze,{...r,children:i})})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete)return false;if(e.components!==t.components){let o=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(o.length!==n.length||o.some(s=>{var r,i;return ((r=e.components)==null?void 0:r[s])!==((i=t.components)==null?void 0:i[s])}))return false}return !(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});No.displayName="Block";var qr=["github-light","github-dark"],_r=memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:o=true,normalizeHtmlIndentation:n=false,components:s,rehypePlugins:r=vo,remarkPlugins:i=Ar,className:c,shikiTheme:a=qr,mermaid:l,controls:m=true,isAnimating:d=false,animated:p,BlockComponent:g=No,parseMarkdownIntoBlocksFn:b=We,caret:h,plugins:u,remend:C,linkSafety:k={enabled:true},allowedTags:w,...T})=>{let H=useId(),[S,B]=useTransition(),O=useMemo(()=>w?Object.keys(w):[],[w]),E=useMemo(()=>{if(typeof e!="string")return "";let x=t==="streaming"&&o?Hr(e,C):e;return O.length>0&&(x=Co(x,O)),x},[e,t,o,C,O]),I=useMemo(()=>b(E),[E,b]),[z,v]=useState(I);useEffect(()=>{t==="streaming"?B(()=>{v(I);}):v(I);},[I,t]);let L=t==="streaming"?z:I,ce=useMemo(()=>L.map((x,V)=>`${H}-${V}`),[L.length,H]),Pe=useMemo(()=>p?p===true?Q():Q(p):null,[p]),Ue=useMemo(()=>{var x,V;return {shikiTheme:(V=(x=u==null?void 0:u.code)==null?void 0:x.getThemes())!=null?V:a,controls:m,isAnimating:d,mode:t,mermaid:l,linkSafety:k}},[a,m,d,t,l,k,u==null?void 0:u.code]),Xe=useMemo(()=>({...lo,...s}),[s]),Je=useMemo(()=>{let x=[];return u!=null&&u.cjk&&(x=[...x,...u.cjk.remarkPluginsBefore]),x=[...x,...i],u!=null&&u.cjk&&(x=[...x,...u.cjk.remarkPluginsAfter]),u!=null&&u.math&&(x=[...x,u.math.remarkPlugin]),x},[i,u==null?void 0:u.math,u==null?void 0:u.cjk]),Ke=useMemo(()=>{var V;let x=r;if(w&&Object.keys(w).length>0&&r===vo){let Te={...ve,tagNames:[...(V=ve.tagNames)!=null?V:[],...Object.keys(w)],attributes:{...ve.attributes,...w}};x=[Fe.raw,[To,Te],Fe.harden];}return u!=null&&u.math&&(x=[...x,u.math.rehypePlugin]),Pe&&d&&(x=[...x,Pe.rehypePlugin]),x},[r,u==null?void 0:u.math,Pe,d,w]),Me=useMemo(()=>{if(!d||L.length===0)return false;let x=L.at(-1);return ze(x)||co(x)},[d,L]),Eo=useMemo(()=>h&&d&&!Me?{"--streamdown-caret":`"${jr[h]}"`}:void 0,[h,d,Me]);return t==="static"?jsx(pe.Provider,{value:u!=null?u:null,children:jsx(R.Provider,{value:Ue,children:jsx("div",{className:f("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",c),children:jsx(Ze,{components:Xe,rehypePlugins:Ke,remarkPlugins:Je,...T,children:E})})})}):jsx(pe.Provider,{value:u!=null?u:null,children:jsx(R.Provider,{value:Ue,children:jsxs("div",{className:f("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",h&&!Me?"*:last:after:inline *:last:after:align-baseline *:last:after:content-[var(--streamdown-caret)]":null,c),style:Eo,children:[L.length===0&&h&&d&&jsx("span",{}),L.map((x,V)=>{let Te=V===L.length-1,Ho=d&&Te&&ze(x);return jsx(g,{components:Xe,content:x,index:V,isIncomplete:Ho,rehypePlugins:Ke,remarkPlugins:Je,shouldNormalizeHtmlIndentation:n,shouldParseIncompleteMarkdown:o,...T},ce[V])})]})})})},(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.normalizeHtmlIndentation===t.normalizeHtmlIndentation);_r.displayName="Streamdown";var So=({children:e,className:t,minZoom:o=.5,maxZoom:n=3,zoomStep:s=.1,showControls:r=true,initialZoom:i=1,fullscreen:c=false})=>{let a=useRef(null),l=useRef(null),[m,d]=useState(i),[p,g]=useState({x:0,y:0}),[b,h]=useState(false),[u,C]=useState({x:0,y:0}),[k,w]=useState({x:0,y:0}),T=useCallback(v=>{d(L=>Math.max(o,Math.min(n,L+v)));},[o,n]),H=useCallback(()=>{T(s);},[T,s]),S=useCallback(()=>{T(-s);},[T,s]),B=useCallback(()=>{d(i),g({x:0,y:0});},[i]),O=useCallback(v=>{v.preventDefault();let L=v.deltaY>0?-s:s;T(L);},[T,s]),E=useCallback(v=>{if(v.button!==0||v.isPrimary===false)return;h(true),C({x:v.clientX,y:v.clientY}),w(p);let L=v.currentTarget;L instanceof HTMLElement&&L.setPointerCapture(v.pointerId);},[p]),I=useCallback(v=>{if(!b)return;v.preventDefault();let L=v.clientX-u.x,ce=v.clientY-u.y;g({x:k.x+L,y:k.y+ce});},[b,u,k]),z=useCallback(v=>{h(false);let L=v.currentTarget;L instanceof HTMLElement&&L.releasePointerCapture(v.pointerId);},[]);return useEffect(()=>{let v=a.current;if(v)return v.addEventListener("wheel",O,{passive:false}),()=>{v.removeEventListener("wheel",O);}},[O]),useEffect(()=>{let v=l.current;if(v&&b)return document.body.style.userSelect="none",v.addEventListener("pointermove",I,{passive:false}),v.addEventListener("pointerup",z),v.addEventListener("pointercancel",z),()=>{document.body.style.userSelect="",v.removeEventListener("pointermove",I),v.removeEventListener("pointerup",z),v.removeEventListener("pointercancel",z);}},[b,I,z]),jsxs("div",{className:f("relative flex flex-col",c?"h-full w-full":"min-h-28 w-full",t),ref:a,style:{cursor:b?"grabbing":"grab"},children:[r?jsxs("div",{className:f("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",c?"bottom-4 left-4":"bottom-2 left-2"),children:[jsx("button",{className:"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:m>=n,onClick:H,title:"Zoom in",type:"button",children:jsx(lt,{size:16})}),jsx("button",{className:"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:m<=o,onClick:S,title:"Zoom out",type:"button",children:jsx(ct,{size:16})}),jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:B,title:"Reset zoom and pan",type:"button",children:jsx(it,{size:16})})]}):null,jsx("div",{className:f("flex-1 origin-center transition-transform duration-150 ease-out",c?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:E,ref:l,role:"application",style:{transform:`translate(${p.x}px, ${p.y}px) scale(${m})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var Nt=({chart:e,className:t,config:o,fullscreen:n=false,showControls:s=true})=>{let[r,i]=useState(null),[c,a]=useState(false),[l,m]=useState(""),[d,p]=useState(""),[g,b]=useState(0),{mermaid:h}=useContext(R),u=G(),C=h==null?void 0:h.errorComponent,{shouldRender:k,containerRef:w}=Ge({immediate:n});if(useEffect(()=>{if(!k)return;if(!u){i("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{i(null),a(!0);let S=u.getMermaid(o),B=e.split("").reduce((I,z)=>(I<<5)-I+z.charCodeAt(0)|0,0),O=`mermaid-${Math.abs(B)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:E}=await S.render(O,e);m(E),p(E);}catch(S){if(!(d||l)){let B=S instanceof Error?S.message:"Failed to render Mermaid chart";i(B);}}finally{a(false);}})();},[e,o,g,k,u]),!(k||l||d))return jsx("div",{className:f("my-4 min-h-[200px]",t),ref:w});if(c&&!l&&!d)return jsx("div",{className:f("my-4 flex justify-center p-4",t),ref:w,children:jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(r&&!l&&!d){let H=()=>b(S=>S+1);return C?jsx("div",{ref:w,children:jsx(C,{chart:e,error:r,retry:H})}):jsxs("div",{className:f("rounded-md bg-red-50 p-4",t),ref:w,children:[jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",r]}),jsxs("details",{className:"mt-2",children:[jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let T=l||d;return jsx("div",{className:f("size-full",t),"data-streamdown":"mermaid",ref:w,children:jsx(So,{className:f(n?"size-full overflow-hidden":"overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:s,zoomStep:.1,children:jsx("div",{"aria-label":"Mermaid chart",className:f("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:T},role:"img"})})})};export{Q as a,Ie as b,Qe as c,Ks as d,Nt as e,bo as f,We as g,Or as h,Fe as i,Vr as j,R as k,No as l,_r as m};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import {k,d,c}from'./chunk-RLXIAIE6.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var L=({code:s,language:t,raw:e,className:n,...d$1})=>{let{shikiTheme:l}=useContext(k),o=d(),[m,i]=useState(e);return useEffect(()=>{if(!o){i(e);return}let g=o.highlight({code:s,language:t,themes:l},p=>{i(p);});g&&i(g);},[s,t,l,o,e]),jsx(c,{className:n,language:t,result:m,...d$1})};export{L as HighlightedCodeBlockBody};
package/dist/index.d.ts CHANGED
@@ -5,42 +5,67 @@ import { MermaidConfig } from 'mermaid';
5
5
  import { RemendOptions } from 'remend';
6
6
  import { BundledLanguage, BundledTheme } from 'shiki';
7
7
  export { BundledLanguage, BundledTheme } from 'shiki';
8
- import { PluggableList, Pluggable } from 'unified';
9
- import { Element } from 'hast';
8
+ import { Pluggable, PluggableList } from 'unified';
9
+ import { Element, Parents } from 'hast';
10
10
  import { Options as Options$1 } from 'remark-rehype';
11
11
 
12
+ interface AnimatePlugin {
13
+ name: "animate";
14
+ rehypePlugin: Pluggable;
15
+ type: "animate";
16
+ }
17
+ interface AnimateOptions {
18
+ animation?: "fadeIn" | "blurIn" | "slideUp" | (string & {});
19
+ duration?: number;
20
+ easing?: string;
21
+ sep?: "word" | "char";
22
+ }
23
+ declare function createAnimatePlugin(options?: AnimateOptions): AnimatePlugin;
24
+
12
25
  interface ExtraProps {
13
26
  node?: Element | undefined;
14
27
  }
28
+ type AllowElement = (element: Readonly<Element>, index: number, parent: Readonly<Parents> | undefined) => boolean | null | undefined;
29
+ type UrlTransform = (url: string, key: string, node: Readonly<Element>) => string | null | undefined;
15
30
  type Components = {
16
31
  [Key in keyof JSX.IntrinsicElements]?: ComponentType<JSX.IntrinsicElements[Key] & ExtraProps> | keyof JSX.IntrinsicElements;
32
+ } & {
33
+ [key: string]: ComponentType<Record<string, unknown> & ExtraProps> | keyof JSX.IntrinsicElements | undefined;
17
34
  };
18
35
  interface Options {
36
+ allowElement?: AllowElement;
37
+ allowedElements?: readonly string[];
19
38
  children?: string;
20
39
  components?: Components;
40
+ disallowedElements?: readonly string[];
21
41
  rehypePlugins?: PluggableList;
22
42
  remarkPlugins?: PluggableList;
23
43
  remarkRehypeOptions?: Readonly<Options$1>;
44
+ skipHtml?: boolean;
45
+ unwrapDisallowed?: boolean;
46
+ urlTransform?: UrlTransform;
24
47
  }
48
+ declare const defaultUrlTransform: UrlTransform;
25
49
 
26
50
  /**
27
51
  * A single token in a highlighted line
28
52
  */
29
53
  interface HighlightToken {
30
- content: string;
31
- color?: string;
32
54
  bgColor?: string;
33
- htmlStyle?: Record<string, string>;
55
+ color?: string;
56
+ content: string;
34
57
  htmlAttrs?: Record<string, string>;
58
+ htmlStyle?: Record<string, string>;
35
59
  offset?: number;
36
60
  }
37
61
  /**
38
62
  * Result from code highlighting (compatible with shiki's TokensResult)
39
63
  */
40
64
  interface HighlightResult {
41
- tokens: HighlightToken[][];
42
- fg?: string;
43
65
  bg?: string;
66
+ fg?: string;
67
+ rootStyle?: string | false;
68
+ tokens: HighlightToken[][];
44
69
  }
45
70
  /**
46
71
  * Options for highlighting code
@@ -54,26 +79,26 @@ interface HighlightOptions {
54
79
  * Plugin for code syntax highlighting (Shiki)
55
80
  */
56
81
  interface CodeHighlighterPlugin {
57
- name: "shiki";
58
- type: "code-highlighter";
82
+ /**
83
+ * Get list of supported languages
84
+ */
85
+ getSupportedLanguages: () => BundledLanguage[];
86
+ /**
87
+ * Get the configured themes
88
+ */
89
+ getThemes: () => [BundledTheme, BundledTheme];
59
90
  /**
60
91
  * Highlight code and return tokens
61
92
  * Returns null if highlighting not ready yet (async loading)
62
93
  * Use callback for async result
63
94
  */
64
95
  highlight: (options: HighlightOptions, callback?: (result: HighlightResult) => void) => HighlightResult | null;
96
+ name: "shiki";
65
97
  /**
66
98
  * Check if language is supported
67
99
  */
68
100
  supportsLanguage: (language: BundledLanguage) => boolean;
69
- /**
70
- * Get list of supported languages
71
- */
72
- getSupportedLanguages: () => BundledLanguage[];
73
- /**
74
- * Get the configured themes
75
- */
76
- getThemes: () => [BundledTheme, BundledTheme];
101
+ type: "code-highlighter";
77
102
  }
78
103
  /**
79
104
  * Mermaid instance interface
@@ -88,70 +113,90 @@ interface MermaidInstance {
88
113
  * Plugin for diagram rendering (Mermaid)
89
114
  */
90
115
  interface DiagramPlugin {
91
- name: "mermaid";
92
- type: "diagram";
93
- /**
94
- * Language identifier for code blocks
95
- */
96
- language: string;
97
116
  /**
98
117
  * Get the mermaid instance (initialized with optional config)
99
118
  */
100
119
  getMermaid: (config?: MermaidConfig) => MermaidInstance;
120
+ /**
121
+ * Language identifier for code blocks
122
+ */
123
+ language: string;
124
+ name: "mermaid";
125
+ type: "diagram";
101
126
  }
102
127
  /**
103
128
  * Plugin for math rendering (KaTeX)
104
129
  */
105
130
  interface MathPlugin {
106
- name: "katex";
107
- type: "math";
108
131
  /**
109
- * Get remark plugin for parsing math syntax
132
+ * Get CSS styles for math rendering (injected into head)
110
133
  */
111
- remarkPlugin: Pluggable;
134
+ getStyles?: () => string;
135
+ name: "katex";
112
136
  /**
113
137
  * Get rehype plugin for rendering math
114
138
  */
115
139
  rehypePlugin: Pluggable;
116
140
  /**
117
- * Get CSS styles for math rendering (injected into head)
141
+ * Get remark plugin for parsing math syntax
118
142
  */
119
- getStyles?: () => string;
143
+ remarkPlugin: Pluggable;
144
+ type: "math";
120
145
  }
121
146
  /**
122
147
  * Plugin for CJK text handling
123
148
  */
124
149
  interface CjkPlugin {
125
150
  name: "cjk";
126
- type: "cjk";
127
151
  /**
128
- * Remark plugins that must run BEFORE remarkGfm
129
- * (e.g., remark-cjk-friendly which modifies emphasis handling)
152
+ * @deprecated Use remarkPluginsBefore and remarkPluginsAfter instead
153
+ * All remark plugins (for backwards compatibility)
130
154
  */
131
- remarkPluginsBefore: Pluggable[];
155
+ remarkPlugins: Pluggable[];
132
156
  /**
133
157
  * Remark plugins that must run AFTER remarkGfm
134
158
  * (e.g., autolink boundary splitting, strikethrough enhancements)
135
159
  */
136
160
  remarkPluginsAfter: Pluggable[];
137
161
  /**
138
- * @deprecated Use remarkPluginsBefore and remarkPluginsAfter instead
139
- * All remark plugins (for backwards compatibility)
162
+ * Remark plugins that must run BEFORE remarkGfm
163
+ * (e.g., remark-cjk-friendly which modifies emphasis handling)
140
164
  */
141
- remarkPlugins: Pluggable[];
165
+ remarkPluginsBefore: Pluggable[];
166
+ type: "cjk";
142
167
  }
143
168
  /**
144
169
  * Plugin configuration passed to Streamdown
145
170
  */
146
171
  interface PluginConfig {
172
+ cjk?: CjkPlugin;
147
173
  code?: CodeHighlighterPlugin;
148
- mermaid?: DiagramPlugin;
149
174
  math?: MathPlugin;
150
- cjk?: CjkPlugin;
175
+ mermaid?: DiagramPlugin;
151
176
  }
152
177
 
178
+ /**
179
+ * Hook to check if the current block has an incomplete (unclosed) code fence.
180
+ *
181
+ * Returns `true` when the code fence in this block is still being streamed.
182
+ * Useful for deferring expensive renders (syntax highlighting, Mermaid diagrams)
183
+ * until the code block is complete.
184
+ */
185
+ declare const useIsCodeFenceIncomplete: () => boolean;
186
+
153
187
  declare const parseMarkdownIntoBlocks: (markdown: string) => string[];
154
188
 
189
+ /**
190
+ * Normalizes indentation in HTML blocks to prevent Markdown parsers from
191
+ * treating indented HTML tags as code blocks (4+ spaces = code in Markdown).
192
+ *
193
+ * Useful when rendering AI-generated HTML content with nested tags that
194
+ * are indented for readability.
195
+ *
196
+ * @param content - The raw HTML/Markdown string to normalize
197
+ * @returns The normalized string with reduced indentation before HTML tags
198
+ */
199
+ declare const normalizeHtmlIndentation: (content: string) => string;
155
200
  type ControlsConfig = boolean | {
156
201
  table?: boolean;
157
202
  code?: boolean;
@@ -163,10 +208,10 @@ type ControlsConfig = boolean | {
163
208
  };
164
209
  };
165
210
  interface LinkSafetyModalProps {
166
- url: string;
167
211
  isOpen: boolean;
168
212
  onClose: () => void;
169
213
  onConfirm: () => void;
214
+ url: string;
170
215
  }
171
216
  interface LinkSafetyConfig {
172
217
  enabled: boolean;
@@ -174,28 +219,34 @@ interface LinkSafetyConfig {
174
219
  renderModal?: (props: LinkSafetyModalProps) => React.ReactNode;
175
220
  }
176
221
  interface MermaidErrorComponentProps {
177
- error: string;
178
222
  chart: string;
223
+ error: string;
179
224
  retry: () => void;
180
225
  }
181
226
  interface MermaidOptions {
182
227
  config?: MermaidConfig;
183
228
  errorComponent?: React.ComponentType<MermaidErrorComponentProps>;
184
229
  }
230
+ type AllowedTags = Record<string, string[]>;
185
231
  type StreamdownProps = Options & {
186
232
  mode?: "static" | "streaming";
187
233
  BlockComponent?: React.ComponentType<BlockProps>;
188
234
  parseMarkdownIntoBlocksFn?: (markdown: string) => string[];
189
235
  parseIncompleteMarkdown?: boolean;
236
+ /** Normalize HTML block indentation to prevent 4+ spaces being treated as code blocks. @default false */
237
+ normalizeHtmlIndentation?: boolean;
190
238
  className?: string;
191
239
  shikiTheme?: [BundledTheme, BundledTheme];
192
240
  mermaid?: MermaidOptions;
193
241
  controls?: ControlsConfig;
194
242
  isAnimating?: boolean;
243
+ animated?: boolean | AnimateOptions;
195
244
  caret?: keyof typeof carets;
196
245
  plugins?: PluginConfig;
197
246
  remend?: RemendOptions;
198
247
  linkSafety?: LinkSafetyConfig;
248
+ /** Custom tags to allow through sanitization with their permitted attributes */
249
+ allowedTags?: AllowedTags;
199
250
  };
200
251
  declare const defaultRehypePlugins: Record<string, Pluggable>;
201
252
  declare const defaultRemarkPlugins: Record<string, Pluggable>;
@@ -204,20 +255,23 @@ declare const carets: {
204
255
  circle: string;
205
256
  };
206
257
  interface StreamdownContextType {
207
- shikiTheme: [BundledTheme, BundledTheme];
208
258
  controls: ControlsConfig;
209
259
  isAnimating: boolean;
210
- mode: "static" | "streaming";
211
- mermaid?: MermaidOptions;
212
260
  linkSafety?: LinkSafetyConfig;
261
+ mermaid?: MermaidOptions;
262
+ mode: "static" | "streaming";
263
+ shikiTheme: [BundledTheme, BundledTheme];
213
264
  }
214
265
  declare const StreamdownContext: react.Context<StreamdownContextType>;
215
266
  type BlockProps = Options & {
216
267
  content: string;
217
268
  shouldParseIncompleteMarkdown: boolean;
269
+ shouldNormalizeHtmlIndentation: boolean;
218
270
  index: number;
271
+ /** Whether this block is incomplete (still being streamed) */
272
+ isIncomplete: boolean;
219
273
  };
220
- declare const Block: react.MemoExoticComponent<({ content, shouldParseIncompleteMarkdown: _, index: __, ...props }: BlockProps) => react_jsx_runtime.JSX.Element>;
221
- declare const Streamdown: react.MemoExoticComponent<({ children, mode, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, controls, isAnimating, BlockComponent, parseMarkdownIntoBlocksFn, caret, plugins, remend: remendOptions, linkSafety, ...props }: StreamdownProps) => react_jsx_runtime.JSX.Element>;
274
+ declare const Block: react.MemoExoticComponent<({ content, shouldParseIncompleteMarkdown: _, shouldNormalizeHtmlIndentation, index: __, isIncomplete, ...props }: BlockProps) => react_jsx_runtime.JSX.Element>;
275
+ declare const Streamdown: react.MemoExoticComponent<({ children, mode, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, normalizeHtmlIndentation: shouldNormalizeHtmlIndentation, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, controls, isAnimating, animated, BlockComponent, parseMarkdownIntoBlocksFn, caret, plugins, remend: remendOptions, linkSafety, allowedTags, ...props }: StreamdownProps) => react_jsx_runtime.JSX.Element>;
222
276
 
223
- export { Block, type CjkPlugin, type CodeHighlighterPlugin, type ControlsConfig, type DiagramPlugin, type HighlightOptions, type LinkSafetyConfig, type LinkSafetyModalProps, type MathPlugin, type MermaidErrorComponentProps, type MermaidOptions, type PluginConfig, Streamdown, StreamdownContext, type StreamdownContextType, type StreamdownProps, defaultRehypePlugins, defaultRemarkPlugins, parseMarkdownIntoBlocks };
277
+ export { type AllowElement, type AllowedTags, type AnimateOptions, Block, type BlockProps, type CjkPlugin, type CodeHighlighterPlugin, type Components, type ControlsConfig, type DiagramPlugin, type ExtraProps, type HighlightOptions, type LinkSafetyConfig, type LinkSafetyModalProps, type MathPlugin, type MermaidErrorComponentProps, type MermaidOptions, type PluginConfig, Streamdown, StreamdownContext, type StreamdownContextType, type StreamdownProps, type UrlTransform, createAnimatePlugin, defaultRehypePlugins, defaultRemarkPlugins, defaultUrlTransform, normalizeHtmlIndentation, parseMarkdownIntoBlocks, useIsCodeFenceIncomplete };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{i as Block,j as Streamdown,h as StreamdownContext,f as defaultRehypePlugins,g as defaultRemarkPlugins,e as parseMarkdownIntoBlocks}from'./chunk-5FQGJX7Z.js';
2
+ export{l as Block,m as Streamdown,k as StreamdownContext,a as createAnimatePlugin,i as defaultRehypePlugins,j as defaultRemarkPlugins,f as defaultUrlTransform,h as normalizeHtmlIndentation,g as parseMarkdownIntoBlocks,b as useIsCodeFenceIncomplete}from'./chunk-RLXIAIE6.js';
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export{e as Mermaid}from'./chunk-RLXIAIE6.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamdown",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -8,12 +8,13 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.cjs"
13
- }
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./styles.css": "./styles.css"
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
+ "styles.css",
17
18
  "README.md"
18
19
  ],
19
20
  "homepage": "https://streamdown.ai",
@@ -26,32 +27,36 @@
26
27
  "license": "Apache-2.0",
27
28
  "description": "A drop-in replacement for react-markdown, designed for AI-powered streaming.",
28
29
  "devDependencies": {
29
- "shiki": "^3.19.0",
30
30
  "@testing-library/jest-dom": "^6.9.1",
31
31
  "@testing-library/react": "^16.3.0",
32
32
  "@types/hast": "^3.0.4",
33
33
  "@types/react": "^19.2.7",
34
34
  "@types/react-dom": "^19.2.3",
35
+ "react-dom": "^19.2.3",
35
36
  "@vitejs/plugin-react": "^5.1.2",
36
37
  "@vitest/coverage-v8": "^4.0.15",
37
38
  "jsdom": "^27.3.0",
38
39
  "mermaid": "^11.12.2",
39
40
  "react-markdown": "^10.1.0",
41
+ "rehype-parse": "^9.0.1",
42
+ "rehype-stringify": "^10.0.1",
43
+ "shiki": "^3.19.0",
40
44
  "tsup": "^8.5.1",
41
45
  "vitest": "^4.0.15",
42
- "@streamdown/cjk": "1.0.1",
43
- "@streamdown/math": "1.0.1",
44
- "@streamdown/mermaid": "1.0.1"
46
+ "@streamdown/cjk": "1.0.2",
47
+ "@streamdown/mermaid": "1.0.2",
48
+ "@streamdown/math": "1.0.2"
45
49
  },
46
50
  "peerDependencies": {
47
- "react": "^18.0.0 || ^19.0.0"
51
+ "react": "^18.0.0 || ^19.0.0",
52
+ "react-dom": "^18.0.0 || ^19.0.0"
48
53
  },
49
54
  "dependencies": {
50
55
  "clsx": "^2.1.1",
51
56
  "hast-util-to-jsx-runtime": "^2.3.6",
52
57
  "html-url-attributes": "^3.0.1",
53
58
  "marked": "^17.0.1",
54
- "rehype-harden": "^1.1.7",
59
+ "rehype-harden": "^1.1.8",
55
60
  "rehype-raw": "^7.0.0",
56
61
  "rehype-sanitize": "^6.0.0",
57
62
  "remark-gfm": "^4.0.1",
@@ -60,7 +65,8 @@
60
65
  "tailwind-merge": "^3.4.0",
61
66
  "unified": "^11.0.5",
62
67
  "unist-util-visit": "^5.0.0",
63
- "remend": "1.1.0"
68
+ "unist-util-visit-parents": "^6.0.0",
69
+ "remend": "1.2.1"
64
70
  },
65
71
  "scripts": {
66
72
  "build": "tsup",
package/styles.css ADDED
@@ -0,0 +1,35 @@
1
+ @keyframes sd-fadeIn {
2
+ from {
3
+ opacity: 0;
4
+ }
5
+ to {
6
+ opacity: 1;
7
+ }
8
+ }
9
+
10
+ @keyframes sd-blurIn {
11
+ from {
12
+ opacity: 0;
13
+ filter: blur(4px);
14
+ }
15
+ to {
16
+ opacity: 1;
17
+ filter: blur(0);
18
+ }
19
+ }
20
+
21
+ @keyframes sd-slideUp {
22
+ from {
23
+ opacity: 0;
24
+ transform: translateY(4px);
25
+ }
26
+ to {
27
+ opacity: 1;
28
+ transform: translateY(0);
29
+ }
30
+ }
31
+
32
+ [data-sd-animate] {
33
+ animation: var(--sd-animation, sd-fadeIn) var(--sd-duration, 150ms)
34
+ var(--sd-easing, ease) both;
35
+ }
@@ -1,10 +0,0 @@
1
- "use client";
2
- import {createContext,lazy,memo,useContext,isValidElement,useId,useTransition,useMemo,useState,useEffect,useCallback,Suspense,useRef}from'react';import {harden}from'rehype-harden';import pn from'rehype-raw';import un from'rehype-sanitize';import fn from'remark-gfm';import bn from'remend';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {toJsxRuntime}from'hast-util-to-jsx-runtime';import Jo from'remark-parse';import Fo from'remark-rehype';import {unified}from'unified';import {Lexer}from'marked';var Yt=300,Qt="300px",eo=500;function Ve(e={}){let{immediate:t=false,debounceDelay:o=Yt,rootMargin:n=Qt,idleTimeout:d=eo}=e,[s,m]=useState(false),i=useRef(null),r=useRef(null),l=useRef(null),c=useMemo(()=>f=>{let a=Date.now();return window.setTimeout(()=>{f({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-a))});},1)},[]),u=useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(f,a)=>window.requestIdleCallback(f,a):c,[c]),p=useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?f=>window.cancelIdleCallback(f):f=>{clearTimeout(f);},[]);return useEffect(()=>{if(t){m(true);return}let f=i.current;if(!f)return;r.current&&(clearTimeout(r.current),r.current=null),l.current&&(p(l.current),l.current=null);let a=()=>{r.current&&(clearTimeout(r.current),r.current=null),l.current&&(p(l.current),l.current=null);},h=M=>{l.current=u(P=>{P.timeRemaining()>0||P.didTimeout?(m(true),M.disconnect()):l.current=u(()=>{m(true),M.disconnect();},{timeout:d/2});},{timeout:d});},y=M=>{a(),r.current=window.setTimeout(()=>{var L,D;let P=M.takeRecords();(P.length===0||(D=(L=P.at(-1))==null?void 0:L.isIntersecting)!=null&&D)&&h(M);},o);},k=(M,P)=>{M.isIntersecting?y(P):a();},C=new IntersectionObserver(M=>{for(let P of M)k(P,C);},{rootMargin:n,threshold:0});return C.observe(f),()=>{r.current&&clearTimeout(r.current),l.current&&p(l.current),C.disconnect();}},[t,o,n,d,p,u]),{shouldRender:s,containerRef:i}}var J=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),F=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),z=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),Be=e=>jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),je=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),Oe=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),re=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),ve=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),Ae=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})}),qe=e=>jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children: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"})});var b=(...e)=>twMerge(clsx(e)),B=(e,t,o)=>{let n=typeof t=="string"?new Blob([t],{type:o}):t,d=URL.createObjectURL(n),s=document.createElement("a");s.href=d,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(d);};var ao=createContext({code:""}),se=()=>useContext(ao);var Ce=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:d,code:s,...m})=>{let[i,r]=useState(false),l=useRef(0),{code:c}=se(),{isAnimating:u}=useContext(N),p=s!=null?s:c,f=async()=>{var h;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(p),r(!0),e==null||e(),l.current=window.setTimeout(()=>r(!1),o));}catch(y){t==null||t(y);}};useEffect(()=>()=>{window.clearTimeout(l.current);},[]);let a=i?J:F;return jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),"data-streamdown":"code-block-copy-button",disabled:u,onClick:f,title:"Copy Code",type:"button",...m,children:n!=null?n:jsx(a,{size:14})})};var $e={"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",\u6587\u8A00:"wy"},We=({onDownload:e,onError:t,language:o,children:n,className:d,code:s,...m})=>{let{code:i}=se(),{isAnimating:r}=useContext(N),l=s!=null?s:i,u=`file.${o&&o in $e?$e[o]:"txt"}`,p="text/plain",f=()=>{try{B(u,l,p),e==null||e();}catch(a){t==null||t(a);}};return jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),"data-streamdown":"code-block-download-button",disabled:r,onClick:f,title:"Download file",type:"button",...m,children:n!=null?n:jsx(z,{size:14})})};var Pe=()=>jsxs("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[jsx("div",{className:"h-[46px] w-full bg-muted/80"}),jsx("div",{className:"flex w-full items-center justify-center p-4",children:jsx(Be,{className:"size-4 animate-spin"})})]});var fo=/\.[^/.]+$/,Xe=({node:e,className:t,src:o,alt:n,...d})=>{let s=async()=>{if(o)try{let i=await(await fetch(o)).blob(),l=new URL(o,window.location.origin).pathname.split("/").pop()||"",c=l.split(".").pop(),u=l.includes(".")&&c!==void 0&&c.length<=4,p="";if(u)p=l;else {let f=i.type,a="png";f.includes("jpeg")||f.includes("jpg")?a="jpg":f.includes("png")?a="png":f.includes("svg")?a="svg":f.includes("gif")?a="gif":f.includes("webp")&&(a="webp"),p=`${(n||l||"image").replace(fo,"")}.${a}`;}B(p,i,i.type);}catch(m){window.open(o,"_blank");}};return o?jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[jsx("img",{alt:n,className:b("max-w-full rounded-lg",t),"data-streamdown":"image",src:o,...d}),jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),jsx("button",{className:b("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:s,title:"Download image",type:"button",children:jsx(z,{size:14})})]}):null};var Q=0,yo=()=>{Q+=1,Q===1&&(document.body.style.overflow="hidden");},wo=()=>{Q=Math.max(0,Q-1),Q===0&&(document.body.style.overflow="");},Fe=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let[d,s]=useState(false),m=useCallback(async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3);}catch(r){}},[e]),i=useCallback(()=>{n(),o();},[n,o]);return useEffect(()=>{if(t){yo();let r=l=>{l.key==="Escape"&&o();};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r),wo();}}},[t,o]),t?jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:o,onKeyDown:r=>{r.key==="Escape"&&o();},role:"button",tabIndex:0,children:jsxs("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:r=>r.stopPropagation(),onKeyDown:r=>r.stopPropagation(),role:"presentation",children:[jsx("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:o,title:"Close",type:"button",children:jsx(re,{size:16})}),jsxs("div",{className:"flex flex-col gap-2",children:[jsxs("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[jsx(ve,{size:20}),jsx("span",{children:"Open external link?"})]}),jsx("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),jsx("div",{className:b("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{className:"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:m,type:"button",children:d?jsxs(Fragment,{children:[jsx(J,{size:14}),jsx("span",{children:"Copied"})]}):jsxs(Fragment,{children:[jsx(F,{size:14}),jsx("span",{children:"Copy link"})]})}),jsxs("button",{className:"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:i,type:"button",children:[jsx(ve,{size:14}),jsx("span",{children:"Open link"})]})]})]})}):null};var ie=createContext(null),Ue=()=>useContext(ie),cr=()=>{var t;let e=Ue();return (t=e==null?void 0:e.code)!=null?t:null},U=()=>{var t;let e=Ue();return (t=e==null?void 0:e.mermaid)!=null?t:null};var Ke=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((d,s)=>{let m="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let r=document.createElement("canvas"),l=i.width*o,c=i.height*o;r.width=l,r.height=c;let u=r.getContext("2d");if(!u){s(new Error("Failed to create 2D canvas context for PNG export"));return}u.drawImage(i,0,0,l,c),r.toBlob(p=>{if(!p){s(new Error("Failed to create PNG blob"));return}d(p);},"image/png");},i.onerror=()=>s(new Error("Failed to load SVG image")),i.src=m;})};var Ye=({chart:e,children:t,className:o,onDownload:n,config:d,onError:s})=>{let[m,i]=useState(false),r=useRef(null),{isAnimating:l}=useContext(N),c=U(),u=async p=>{try{if(p==="mmd"){B("diagram.mmd",e,"text/plain"),i(!1),n==null||n(p);return}if(!c){s==null||s(new Error("Mermaid plugin not available"));return}let f=c.getMermaid(d),a=e.split("").reduce((k,C)=>(k<<5)-k+C.charCodeAt(0)|0,0),h=`mermaid-${Math.abs(a)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:y}=await f.render(h,e);if(!y){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}if(p==="svg"){B("diagram.svg",y,"image/svg+xml"),i(!1),n==null||n(p);return}if(p==="png"){let k=await Ke(y);B("diagram.png",k,"image/png"),n==null||n(p),i(!1);return}}catch(f){s==null||s(f);}};return useEffect(()=>{let p=f=>{let a=f.composedPath();r.current&&!a.includes(r.current)&&i(false);};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[]),jsxs("div",{className:"relative",ref:r,children:[jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:l,onClick:()=>i(!m),title:"Download diagram",type:"button",children:t!=null?t:jsx(z,{size:14})}),m?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})};var te=0,Lo=()=>{te+=1,te===1&&(document.body.style.overflow="hidden");},So=()=>{te=Math.max(0,te-1),te===0&&(document.body.style.overflow="");},ot=({chart:e,config:t,onFullscreen:o,onExit:n,className:d,...s})=>{let[m,i]=useState(false),{isAnimating:r,controls:l}=useContext(N),c=(()=>{if(typeof l=="boolean")return l;let p=l.mermaid;return p===false?false:p===true||p===void 0?true:p.panZoom!==false})(),u=()=>{i(!m);};return useEffect(()=>{if(m){Lo();let p=f=>{f.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),So();}}},[m]),useEffect(()=>{m?o==null||o():n&&n();},[m,o,n]),jsxs(Fragment,{children:[jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),disabled:r,onClick:u,title:"View fullscreen",type:"button",...s,children:jsx(je,{size:14})}),m?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:u,onKeyDown:p=>{p.key==="Escape"&&u();},role:"button",tabIndex:0,children:[jsx("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:u,title:"Exit fullscreen",type:"button",children:jsx(re,{size:20})}),jsx("div",{className:"flex size-full items-center justify-center p-4",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:jsx(tt,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:true,showControls:c})})]}):null]})};var le=e=>{var s,m;let t=[],o=[],n=e.querySelectorAll("thead th");for(let i of n)t.push(((s=i.textContent)==null?void 0:s.trim())||"");let d=e.querySelectorAll("tbody tr");for(let i of d){let r=[],l=i.querySelectorAll("td");for(let c of l)r.push(((m=c.textContent)==null?void 0:m.trim())||"");o.push(r);}return {headers:t,rows:o}},ce=e=>{let{headers:t,rows:o}=e,n=i=>{let r=false,l=false;for(let c of i){if(c==='"'){r=true,l=true;break}(c===","||c===`
3
- `)&&(r=true);}return r?l?`"${i.replace(/"/g,'""')}"`:`"${i}"`:i},d=t.length>0?o.length+1:o.length,s=new Array(d),m=0;t.length>0&&(s[m]=t.map(n).join(","),m+=1);for(let i of o)s[m]=i.map(n).join(","),m+=1;return s.join(`
4
- `)},nt=e=>{let{headers:t,rows:o}=e,n=i=>{let r=false;for(let c of i)if(c===" "||c===`
5
- `||c==="\r"){r=true;break}if(!r)return i;let l=[];for(let c of i)c===" "?l.push("\\t"):c===`
6
- `?l.push("\\n"):c==="\r"?l.push("\\r"):l.push(c);return l.join("")},d=t.length>0?o.length+1:o.length,s=new Array(d),m=0;t.length>0&&(s[m]=t.map(n).join(" "),m+=1);for(let i of o)s[m]=i.map(n).join(" "),m+=1;return s.join(`
7
- `)},Me=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):o.push(n);return o.join("")},rt=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),d=0,s=t.map(i=>Me(i));n[d]=`| ${s.join(" | ")} |`,d+=1;let m=new Array(t.length);for(let i=0;i<t.length;i+=1)m[i]="---";n[d]=`| ${m.join(" | ")} |`,d+=1;for(let i of o)if(i.length<t.length){let r=new Array(t.length);for(let l=0;l<t.length;l+=1)r[l]=l<i.length?Me(i[l]):"";n[d]=`| ${r.join(" | ")} |`,d+=1;}else {let r=i.map(l=>Me(l));n[d]=`| ${r.join(" | ")} |`,d+=1;}return n.join(`
8
- `)};var lt=({children:e,className:t,onCopy:o,onError:n,timeout:d=2e3})=>{let[s,m]=useState(false),[i,r]=useState(false),l=useRef(null),c=useRef(0),{isAnimating:u}=useContext(N),p=async a=>{var h,y;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.write)){n==null||n(new Error("Clipboard API not available"));return}try{let k=(y=l.current)==null?void 0:y.closest('[data-streamdown="table-wrapper"]'),C=k==null?void 0:k.querySelector("table");if(!C){n==null||n(new Error("Table not found"));return}let M=le(C),P=a==="csv"?ce(M):nt(M),E=new ClipboardItem({"text/plain":new Blob([P],{type:"text/plain"}),"text/html":new Blob([C.outerHTML],{type:"text/html"})});await navigator.clipboard.write([E]),r(!0),m(!1),o==null||o(a),c.current=window.setTimeout(()=>r(!1),d);}catch(k){n==null||n(k);}};useEffect(()=>{let a=h=>{let y=h.composedPath();l.current&&!y.includes(l.current)&&m(false);};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a),window.clearTimeout(c.current);}},[]);let f=i?J:F;return jsxs("div",{className:"relative",ref:l,children:[jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>m(!s),title:"Copy table",type:"button",children:e!=null?e:jsx(f,{size:14})}),s?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})};var dt=({children:e,className:t,onDownload:o,onError:n})=>{let[d,s]=useState(false),m=useRef(null),{isAnimating:i}=useContext(N),r=l=>{var c;try{let u=(c=m.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),p=u==null?void 0:u.querySelector("table");if(!p){n==null||n(new Error("Table not found"));return}let f=le(p),a=l==="csv"?ce(f):rt(f);B(`table.${l==="csv"?"csv":"md"}`,a,l==="csv"?"text/csv":"text/markdown"),s(!1),o==null||o(l);}catch(u){n==null||n(u);}};return useEffect(()=>{let l=c=>{let u=c.composedPath();m.current&&!u.includes(m.current)&&s(false);};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l);}},[]),jsxs("div",{className:"relative",ref:m,children:[jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>s(!d),title:"Download table",type:"button",children:e!=null?e:jsx(z,{size:14})}),d?jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>r("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>r("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})};var pt=({children:e,className:t,showControls:o,...n})=>jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[o?jsxs("div",{className:"flex items-center justify-end gap-1",children:[jsx(lt,{}),jsx(dt,{})]}):null,jsx("div",{className:"overflow-x-auto",children:jsx("table",{className:b("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]});var Oo=lazy(()=>import('./code-block-37QAKDTI.js').then(e=>({default:e.CodeBlock}))),Ao=lazy(()=>import('./mermaid-4DMBBIKO.js').then(e=>({default:e.Mermaid}))),qo=/language-([^\s]+)/;function ge(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,d=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(d==null?void 0:d.line)===(s==null?void 0:s.line)&&(d==null?void 0:d.column)===(s==null?void 0:s.column)}function T(e,t){return e.className===t.className&&ge(e.node,t.node)}var Ne=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ue=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},Se=memo(({children:e,className:t,node:o,...n})=>jsx("ol",{className:b("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>T(e,t));Se.displayName="MarkdownOl";var bt=memo(({children:e,className:t,node:o,...n})=>jsx("li",{className:b("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&ge(e.node,t.node));bt.displayName="MarkdownLi";var gt=memo(({children:e,className:t,node:o,...n})=>jsx("ul",{className:b("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>T(e,t));gt.displayName="MarkdownUl";var ht=memo(({className:e,node:t,...o})=>jsx("hr",{className:b("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o}),(e,t)=>T(e,t));ht.displayName="MarkdownHr";var yt=memo(({children:e,className:t,node:o,...n})=>jsx("span",{className:b("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>T(e,t));yt.displayName="MarkdownStrong";var zo=({children:e,className:t,href:o,node:n,...d})=>{let{linkSafety:s}=useContext(N),[m,i]=useState(false),r=o==="streamdown:incomplete-link",l=useCallback(async f=>{if(!(!(s!=null&&s.enabled&&o)||r)){if(f.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[s,o,r]),c=useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),u=useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:m,onClose:u,onConfirm:c};return s!=null&&s.enabled&&o?jsxs(Fragment,{children:[jsx("button",{className:b("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":r,"data-streamdown":"link",onClick:l,type:"button",children:e}),s.renderModal?s.renderModal(p):jsx(Fe,{...p})]}):jsx("a",{className:b("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":r,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...d,children:e})},wt=memo(zo,(e,t)=>T(e,t)&&e.href===t.href);wt.displayName="MarkdownA";var kt=memo(({children:e,className:t,node:o,...n})=>jsx("h1",{className:b("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>T(e,t));kt.displayName="MarkdownH1";var vt=memo(({children:e,className:t,node:o,...n})=>jsx("h2",{className:b("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>T(e,t));vt.displayName="MarkdownH2";var Ct=memo(({children:e,className:t,node:o,...n})=>jsx("h3",{className:b("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>T(e,t));Ct.displayName="MarkdownH3";var xt=memo(({children:e,className:t,node:o,...n})=>jsx("h4",{className:b("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>T(e,t));xt.displayName="MarkdownH4";var Pt=memo(({children:e,className:t,node:o,...n})=>jsx("h5",{className:b("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>T(e,t));Pt.displayName="MarkdownH5";var Mt=memo(({children:e,className:t,node:o,...n})=>jsx("h6",{className:b("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>T(e,t));Mt.displayName="MarkdownH6";var Tt=memo(({children:e,className:t,node:o,...n})=>{let{controls:d}=useContext(N),s=Ne(d,"table");return jsx(pt,{className:t,showControls:s,...n,children:e})},(e,t)=>T(e,t));Tt.displayName="MarkdownTable";var Nt=memo(({children:e,className:t,node:o,...n})=>jsx("thead",{className:b("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>T(e,t));Nt.displayName="MarkdownThead";var Lt=memo(({children:e,className:t,node:o,...n})=>jsx("tbody",{className:b("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>T(e,t));Lt.displayName="MarkdownTbody";var St=memo(({children:e,className:t,node:o,...n})=>jsx("tr",{className:b("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>T(e,t));St.displayName="MarkdownTr";var Rt=memo(({children:e,className:t,node:o,...n})=>jsx("th",{className:b("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>T(e,t));Rt.displayName="MarkdownTh";var It=memo(({children:e,className:t,node:o,...n})=>jsx("td",{className:b("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>T(e,t));It.displayName="MarkdownTd";var Ht=memo(({children:e,className:t,node:o,...n})=>jsx("blockquote",{className:b("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>T(e,t));Ht.displayName="MarkdownBlockquote";var Et=memo(({children:e,className:t,node:o,...n})=>jsx("sup",{className:b("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>T(e,t));Et.displayName="MarkdownSup";var Dt=memo(({children:e,className:t,node:o,...n})=>jsx("sub",{className:b("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>T(e,t));Dt.displayName="MarkdownSub";var Vt=memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=r=>{var p,f;if(!isValidElement(r))return false;let l=Array.isArray(r.props.children)?r.props.children:[r.props.children],c=false,u=false;for(let a of l)if(a){if(typeof a=="string")a.trim()!==""&&(c=true);else if(isValidElement(a))if(((p=a.props)==null?void 0:p["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(a.props.children)?a.props.children:[a.props.children];for(let y of h){if(typeof y=="string"&&y.trim()!==""){c=true;break}if(isValidElement(y)&&((f=y.props)==null?void 0:f["data-footnote-backref"])===void 0){c=true;break}}}}return u&&!c},m=Array.isArray(e)?e.map(r=>{if(!isValidElement(r))return r;if(r.type===Se){let c=(Array.isArray(r.props.children)?r.props.children:[r.props.children]).filter(u=>!s(u));return c.length===0?null:{...r,props:{...r.props,children:c}}}return r}):e;return (Array.isArray(m)?m.some(r=>r!==null):m!==null)?jsx("section",{className:t,...n,children:m}):null}return jsx("section",{className:t,...n,children:e})},(e,t)=>T(e,t));Vt.displayName="MarkdownSection";var $o=({node:e,className:t,children:o,...n})=>{var p,f,a;let d=((p=e==null?void 0:e.position)==null?void 0:p.start.line)===((f=e==null?void 0:e.position)==null?void 0:f.end.line),{mermaid:s,controls:m}=useContext(N),i=U();if(d)return jsx("code",{className:b("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let r=t==null?void 0:t.match(qo),l=(a=r==null?void 0:r.at(1))!=null?a:"",c="";if(isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?c=o.props.children:typeof o=="string"&&(c=o),l==="mermaid"&&i){let h=Ne(m,"mermaid"),y=ue(m,"download"),k=ue(m,"copy"),C=ue(m,"fullscreen"),M=ue(m,"panZoom"),P=h&&(y||k||C);return jsx(Suspense,{fallback:jsx(Pe,{}),children:jsxs("div",{className:b("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[P?jsxs("div",{className:"flex items-center justify-end gap-2",children:[y?jsx(Ye,{chart:c,config:s==null?void 0:s.config}):null,k?jsx(Ce,{code:c}):null,C?jsx(ot,{chart:c,config:s==null?void 0:s.config}):null]}):null,jsx(Ao,{chart:c,config:s==null?void 0:s.config,showControls:M})]})})}let u=Ne(m,"code");return jsx(Suspense,{fallback:jsx(Pe,{}),children:jsx(Oo,{className:b("overflow-x-auto border-border border-t",t),code:c,language:l,children:u?jsxs(Fragment,{children:[jsx(We,{code:c,language:l}),jsx(Ce,{})]}):null})})},Bt=memo($o,(e,t)=>e.className===t.className&&ge(e.node,t.node));Bt.displayName="MarkdownCode";var jt=memo(Xe,(e,t)=>e.className===t.className&&ge(e.node,t.node));jt.displayName="MarkdownImg";var Ot=memo(({children:e,className:t,node:o,...n})=>{var m,i;let s=(Array.isArray(e)?e:[e]).filter(r=>r!=null&&r!=="");if(s.length===1&&isValidElement(s[0])){let r=s[0].props.node,l=r==null?void 0:r.tagName;if(l==="img")return jsx(Fragment,{children:e});if(l==="code"&&((m=r==null?void 0:r.position)==null?void 0:m.start.line)!==((i=r==null?void 0:r.position)==null?void 0:i.end.line))return jsx(Fragment,{children:e})}return jsx("p",{className:t,...n,children:e})},(e,t)=>T(e,t));Ot.displayName="MarkdownParagraph";var At={ol:Se,li:bt,ul:gt,hr:ht,strong:yt,a:wt,h1:kt,h2:vt,h3:Ct,h4:xt,h5:Pt,h6:Mt,table:Tt,thead:Nt,tbody:Lt,tr:St,th:Rt,td:It,blockquote:Ht,code:Bt,img:jt,pre:({children:e})=>e,sup:Et,sub:Dt,p:Ot,section:Vt};var qt=[],zt={allowDangerousHtml:true},he=new WeakMap,Re=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let o=this.keyCache.get(t);if(o)return o;let n=t.rehypePlugins,d=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||d||s)){let u="default";return this.keyCache.set(t,u),u}let m=u=>{if(!u||u.length===0)return "";let p="";for(let f=0;f<u.length;f+=1){let a=u[f];if(f>0&&(p+=","),Array.isArray(a)){let[h,y]=a;if(typeof h=="function"){let k=he.get(h);k||(k=h.name,he.set(h,k)),p+=k;}else p+=String(h);p+=":",p+=JSON.stringify(y);}else if(typeof a=="function"){let h=he.get(a);h||(h=a.name,he.set(a,h)),p+=h;}else p+=String(a);}return p},i=m(n),r=m(d),l=s?JSON.stringify(s):"",c=`${r}::${i}::${l}`;return this.keyCache.set(t,c),c}get(t){let o=this.generateCacheKey(t),n=this.cache.get(o);return n&&(this.cache.delete(o),this.cache.set(o,n)),n}set(t,o){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let d=this.cache.keys().next().value;d&&this.cache.delete(d);}this.cache.set(n,o);}clear(){this.cache.clear();}},$t=new Re,Ie=e=>{let t=Ko(e),o=e.children||"";return Yo(t.runSync(t.parse(o),o),e)},Ko=e=>{let t=$t.get(e);if(t)return t;let o=Go(e);return $t.set(e,o),o},Go=e=>{let t=e.rehypePlugins||qt,o=e.remarkPlugins||qt,n=e.remarkRehypeOptions?{...zt,...e.remarkRehypeOptions}:zt;return unified().use(Jo).use(o).use(Fo,n).use(t)},Yo=(e,t)=>toJsxRuntime(e,{Fragment:Fragment,components:t.components,ignoreInvalidStyle:true,jsx:jsx,jsxs:jsxs,passKeys:true,passNode:true});var en=/\[\^[^\]\s]{1,200}\](?!:)/,tn=/\[\^[^\]\s]{1,200}\]:/,on=/<\/(\w+)>/,nn=/<(\w+)[\s>]/,He=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
9
- `||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},rn=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
10
- `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},Ee=e=>{let t=0;for(let o=0;o<e.length-1;o+=1)e[o]==="$"&&e[o+1]==="$"&&(t+=1,o+=1);return t},De=e=>{let t=en.test(e),o=tn.test(e);if(t||o)return [e];let n=Lexer.lex(e,{gfm:true}),d=[],s=[];for(let m of n){let i=m.raw,r=d.length;if(s.length>0){if(d[r-1]+=i,m.type==="html"){let c=i.match(on);if(c){let u=c[1];s.at(-1)===u&&s.pop();}}continue}if(m.type==="html"&&m.block){let c=i.match(nn);if(c){let u=c[1];i.includes(`</${u}>`)||s.push(u);}}if(i.trim()==="$$"&&r>0){let c=d[r-1],u=He(c),p=Ee(c);if(u&&p%2===1){d[r-1]=c+i;continue}}if(r>0&&rn(i)){let c=d[r-1],u=He(c),p=Ee(c),f=Ee(i);if(u&&p%2===1&&!He(i)&&f===1){d[r-1]=c+i;continue}}d.push(i);}return d};var gn={raw:pn,sanitize:[un,{}],harden:[harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},hn={gfm:[fn,{}]},yn=Object.values(gn),wn=Object.values(hn),kn={block:" \u258B",circle:" \u25CF"},vn={shikiTheme:["github-light","github-dark"],controls:true,isAnimating:false,mode:"streaming",mermaid:void 0,linkSafety:{enabled:true}},N=createContext(vn),Wt=memo(({content:e,shouldParseIncompleteMarkdown:t,index:o,...n})=>jsx(Ie,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return false;if(e.components!==t.components){let o=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(o.length!==n.length||o.some(d=>{var s,m;return ((s=e.components)==null?void 0:s[d])!==((m=t.components)==null?void 0:m[d])}))return false}return !(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Wt.displayName="Block";var Cn=["github-light","github-dark"],xn=memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:o=true,components:n,rehypePlugins:d=yn,remarkPlugins:s=wn,className:m,shikiTheme:i=Cn,mermaid:r,controls:l=true,isAnimating:c=false,BlockComponent:u=Wt,parseMarkdownIntoBlocksFn:p=De,caret:f,plugins:a,remend:h,linkSafety:y={enabled:true},...k})=>{let C=useId(),[M,P]=useTransition(),E=useMemo(()=>typeof e!="string"?"":t==="streaming"&&o?bn(e,h):e,[e,t,o,h]),L=useMemo(()=>p(E),[E,p]),[D,A]=useState(L);useEffect(()=>{t==="streaming"?P(()=>{A(L);}):A(L);},[L,t]);let j=t==="streaming"?D:L,q=useMemo(()=>j.map((S,W)=>`${C}-${W}`),[j.length,C]),V=useMemo(()=>{var S,W;return {shikiTheme:(W=(S=a==null?void 0:a.code)==null?void 0:S.getThemes())!=null?W:i,controls:l,isAnimating:c,mode:t,mermaid:r,linkSafety:y}},[i,l,c,t,r,y,a==null?void 0:a.code]),w=useMemo(()=>({...At,...n}),[n]),R=useMemo(()=>{let S=[];return a!=null&&a.cjk&&(S=[...S,...a.cjk.remarkPluginsBefore]),S=[...S,...s],a!=null&&a.cjk&&(S=[...S,...a.cjk.remarkPluginsAfter]),a!=null&&a.math&&(S=[...S,a.math.remarkPlugin]),S},[s,a==null?void 0:a.math,a==null?void 0:a.cjk]),Y=useMemo(()=>a!=null&&a.math?[...d,a.math.rehypePlugin]:d,[d,a==null?void 0:a.math]),Ut=useMemo(()=>f&&c?{"--streamdown-caret":`"${kn[f]}"`}:void 0,[f,c]);return t==="static"?jsx(ie.Provider,{value:a!=null?a:null,children:jsx(N.Provider,{value:V,children:jsx("div",{className:b("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",m),children:jsx(Ie,{components:w,rehypePlugins:Y,remarkPlugins:R,...k,children:e})})})}):jsx(ie.Provider,{value:a!=null?a:null,children:jsx(N.Provider,{value:V,children:jsxs("div",{className:b("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",f?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,m),style:Ut,children:[j.length===0&&f&&c&&jsx("span",{}),j.map((S,W)=>jsx(u,{components:w,content:S,index:W,rehypePlugins:Y,remarkPlugins:R,shouldParseIncompleteMarkdown:o,...k},q[W]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);xn.displayName="Streamdown";var Ft=({children:e,className:t,minZoom:o=.5,maxZoom:n=3,zoomStep:d=.1,showControls:s=true,initialZoom:m=1,fullscreen:i=false})=>{let r=useRef(null),l=useRef(null),[c,u]=useState(m),[p,f]=useState({x:0,y:0}),[a,h]=useState(false),[y,k]=useState({x:0,y:0}),[C,M]=useState({x:0,y:0}),P=useCallback(w=>{u(R=>Math.max(o,Math.min(n,R+w)));},[o,n]),E=useCallback(()=>{P(d);},[P,d]),L=useCallback(()=>{P(-d);},[P,d]),D=useCallback(()=>{u(m),f({x:0,y:0});},[m]),A=useCallback(w=>{w.preventDefault();let R=w.deltaY>0?-d:d;P(R);},[P,d]),j=useCallback(w=>{if(w.button!==0||w.isPrimary===false)return;h(true),k({x:w.clientX,y:w.clientY}),M(p);let R=w.currentTarget;R instanceof HTMLElement&&R.setPointerCapture(w.pointerId);},[p]),q=useCallback(w=>{if(!a)return;w.preventDefault();let R=w.clientX-y.x,Y=w.clientY-y.y;f({x:C.x+R,y:C.y+Y});},[a,y,C]),V=useCallback(w=>{h(false);let R=w.currentTarget;R instanceof HTMLElement&&R.releasePointerCapture(w.pointerId);},[]);return useEffect(()=>{let w=r.current;if(w)return w.addEventListener("wheel",A,{passive:false}),()=>{w.removeEventListener("wheel",A);}},[A]),useEffect(()=>{let w=l.current;if(w&&a)return document.body.style.userSelect="none",w.addEventListener("pointermove",q,{passive:false}),w.addEventListener("pointerup",V),w.addEventListener("pointercancel",V),()=>{document.body.style.userSelect="",w.removeEventListener("pointermove",q),w.removeEventListener("pointerup",V),w.removeEventListener("pointercancel",V);}},[a,q,V]),jsxs("div",{className:b("relative flex flex-col",i?"h-full w-full":"min-h-28 w-full",t),ref:r,style:{cursor:a?"grabbing":"grab"},children:[s?jsxs("div",{className:b("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",i?"bottom-4 left-4":"bottom-2 left-2"),children:[jsx("button",{className:"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:c>=n,onClick:E,title:"Zoom in",type:"button",children:jsx(Ae,{size:16})}),jsx("button",{className:"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:c<=o,onClick:L,title:"Zoom out",type:"button",children:jsx(qe,{size:16})}),jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:D,title:"Reset zoom and pan",type:"button",children:jsx(Oe,{size:16})})]}):null,jsx("div",{className:b("flex-1 origin-center transition-transform duration-150 ease-out",i?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:j,ref:l,role:"application",style:{transform:`translate(${p.x}px, ${p.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var tt=({chart:e,className:t,config:o,fullscreen:n=false,showControls:d=true})=>{let[s,m]=useState(null),[i,r]=useState(false),[l,c]=useState(""),[u,p]=useState(""),[f,a]=useState(0),{mermaid:h}=useContext(N),y=U(),k=h==null?void 0:h.errorComponent,{shouldRender:C,containerRef:M}=Ve({immediate:n});if(useEffect(()=>{if(!C)return;if(!y){m("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{m(null),r(!0);let L=y.getMermaid(o),D=e.split("").reduce((q,V)=>(q<<5)-q+V.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(D)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:j}=await L.render(A,e);c(j),p(j);}catch(L){if(!(u||l)){let D=L instanceof Error?L.message:"Failed to render Mermaid chart";m(D);}}finally{r(false);}})();},[e,o,f,C,y]),!(C||l||u))return jsx("div",{className:b("my-4 min-h-[200px]",t),ref:M});if(i&&!l&&!u)return jsx("div",{className:b("my-4 flex justify-center p-4",t),ref:M,children:jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!l&&!u){let E=()=>a(L=>L+1);return k?jsx("div",{ref:M,children:jsx(k,{chart:e,error:s,retry:E})}):jsxs("div",{className:b("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:M,children:[jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),jsxs("details",{className:"mt-2",children:[jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let P=l||u;return jsx("div",{className:b("size-full",t),"data-streamdown":"mermaid",ref:M,children:jsx(Ft,{className:b(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:d,zoomStep:.1,children:jsx("div",{"aria-label":"Mermaid chart",className:b("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:P},role:"img"})})})};export{b as a,ao as b,cr as c,tt as d,De as e,gn as f,hn as g,N as h,Wt as i,xn as j};
@@ -1,10 +0,0 @@
1
- "use client";
2
- 'use strict';var react=require('react'),rehypeHarden=require('rehype-harden'),pn=require('rehype-raw'),un=require('rehype-sanitize'),fn=require('remark-gfm'),bn=require('remend'),jsxRuntime=require('react/jsx-runtime'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),hastUtilToJsxRuntime=require('hast-util-to-jsx-runtime'),Jo=require('remark-parse'),Fo=require('remark-rehype'),unified=require('unified'),marked=require('marked');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var pn__default=/*#__PURE__*/_interopDefault(pn);var un__default=/*#__PURE__*/_interopDefault(un);var fn__default=/*#__PURE__*/_interopDefault(fn);var bn__default=/*#__PURE__*/_interopDefault(bn);var Jo__default=/*#__PURE__*/_interopDefault(Jo);var Fo__default=/*#__PURE__*/_interopDefault(Fo);var Yt=300,Qt="300px",eo=500;function Ve(e={}){let{immediate:t=false,debounceDelay:o=Yt,rootMargin:n=Qt,idleTimeout:d=eo}=e,[s,m]=react.useState(false),i=react.useRef(null),r=react.useRef(null),l=react.useRef(null),c=react.useMemo(()=>f=>{let a=Date.now();return window.setTimeout(()=>{f({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-a))});},1)},[]),u=react.useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(f,a)=>window.requestIdleCallback(f,a):c,[c]),p=react.useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?f=>window.cancelIdleCallback(f):f=>{clearTimeout(f);},[]);return react.useEffect(()=>{if(t){m(true);return}let f=i.current;if(!f)return;r.current&&(clearTimeout(r.current),r.current=null),l.current&&(p(l.current),l.current=null);let a=()=>{r.current&&(clearTimeout(r.current),r.current=null),l.current&&(p(l.current),l.current=null);},h=M=>{l.current=u(P=>{P.timeRemaining()>0||P.didTimeout?(m(true),M.disconnect()):l.current=u(()=>{m(true),M.disconnect();},{timeout:d/2});},{timeout:d});},y=M=>{a(),r.current=window.setTimeout(()=>{var L,D;let P=M.takeRecords();(P.length===0||(D=(L=P.at(-1))==null?void 0:L.isIntersecting)!=null&&D)&&h(M);},o);},k=(M,P)=>{M.isIntersecting?y(P):a();},C=new IntersectionObserver(M=>{for(let P of M)k(P,C);},{rootMargin:n,threshold:0});return C.observe(f),()=>{r.current&&clearTimeout(r.current),l.current&&p(l.current),C.disconnect();}},[t,o,n,d,p,u]),{shouldRender:s,containerRef:i}}var J=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),F=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),z=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),Be=e=>jsxRuntime.jsxs("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:[jsxRuntime.jsx("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),je=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),Oe=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),re=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),ve=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),Ae=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})}),qe=e=>jsxRuntime.jsx("svg",{color:"currentColor",height:16,strokeLinejoin:"round",viewBox:"0 0 16 16",width:16,...e,children:jsxRuntime.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"})});var b=(...e)=>tailwindMerge.twMerge(clsx.clsx(e)),B=(e,t,o)=>{let n=typeof t=="string"?new Blob([t],{type:o}):t,d=URL.createObjectURL(n),s=document.createElement("a");s.href=d,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(d);};var ao=react.createContext({code:""}),se=()=>react.useContext(ao);var Ce=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:d,code:s,...m})=>{let[i,r]=react.useState(false),l=react.useRef(0),{code:c}=se(),{isAnimating:u}=react.useContext(N),p=s!=null?s:c,f=async()=>{var h;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(p),r(!0),e==null||e(),l.current=window.setTimeout(()=>r(!1),o));}catch(y){t==null||t(y);}};react.useEffect(()=>()=>{window.clearTimeout(l.current);},[]);let a=i?J:F;return jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),"data-streamdown":"code-block-copy-button",disabled:u,onClick:f,title:"Copy Code",type:"button",...m,children:n!=null?n:jsxRuntime.jsx(a,{size:14})})};var $e={"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",\u6587\u8A00:"wy"},We=({onDownload:e,onError:t,language:o,children:n,className:d,code:s,...m})=>{let{code:i}=se(),{isAnimating:r}=react.useContext(N),l=s!=null?s:i,u=`file.${o&&o in $e?$e[o]:"txt"}`,p="text/plain",f=()=>{try{B(u,l,p),e==null||e();}catch(a){t==null||t(a);}};return jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),"data-streamdown":"code-block-download-button",disabled:r,onClick:f,title:"Download file",type:"button",...m,children:n!=null?n:jsxRuntime.jsx(z,{size:14})})};var Pe=()=>jsxRuntime.jsxs("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[jsxRuntime.jsx("div",{className:"h-[46px] w-full bg-muted/80"}),jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center p-4",children:jsxRuntime.jsx(Be,{className:"size-4 animate-spin"})})]});var fo=/\.[^/.]+$/,Xe=({node:e,className:t,src:o,alt:n,...d})=>{let s=async()=>{if(o)try{let i=await(await fetch(o)).blob(),l=new URL(o,window.location.origin).pathname.split("/").pop()||"",c=l.split(".").pop(),u=l.includes(".")&&c!==void 0&&c.length<=4,p="";if(u)p=l;else {let f=i.type,a="png";f.includes("jpeg")||f.includes("jpg")?a="jpg":f.includes("png")?a="png":f.includes("svg")?a="svg":f.includes("gif")?a="gif":f.includes("webp")&&(a="webp"),p=`${(n||l||"image").replace(fo,"")}.${a}`;}B(p,i,i.type);}catch(m){window.open(o,"_blank");}};return o?jsxRuntime.jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[jsxRuntime.jsx("img",{alt:n,className:b("max-w-full rounded-lg",t),"data-streamdown":"image",src:o,...d}),jsxRuntime.jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),jsxRuntime.jsx("button",{className:b("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:s,title:"Download image",type:"button",children:jsxRuntime.jsx(z,{size:14})})]}):null};var Q=0,yo=()=>{Q+=1,Q===1&&(document.body.style.overflow="hidden");},wo=()=>{Q=Math.max(0,Q-1),Q===0&&(document.body.style.overflow="");},Fe=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let[d,s]=react.useState(false),m=react.useCallback(async()=>{try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),2e3);}catch(r){}},[e]),i=react.useCallback(()=>{n(),o();},[n,o]);return react.useEffect(()=>{if(t){yo();let r=l=>{l.key==="Escape"&&o();};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r),wo();}}},[t,o]),t?jsxRuntime.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm","data-streamdown":"link-safety-modal",onClick:o,onKeyDown:r=>{r.key==="Escape"&&o();},role:"button",tabIndex:0,children:jsxRuntime.jsxs("div",{className:"relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg",onClick:r=>r.stopPropagation(),onKeyDown:r=>r.stopPropagation(),role:"presentation",children:[jsxRuntime.jsx("button",{className:"absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:o,title:"Close",type:"button",children:jsxRuntime.jsx(re,{size:16})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 font-semibold text-lg",children:[jsxRuntime.jsx(ve,{size:20}),jsxRuntime.jsx("span",{children:"Open external link?"})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm",children:"You're about to visit an external website."})]}),jsxRuntime.jsx("div",{className:b("break-all rounded-md bg-muted p-3 font-mono text-sm",e.length>100&&"max-h-32 overflow-y-auto"),children:e}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx("button",{className:"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:m,type:"button",children:d?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(J,{size:14}),jsxRuntime.jsx("span",{children:"Copied"})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(F,{size:14}),jsxRuntime.jsx("span",{children:"Copy link"})]})}),jsxRuntime.jsxs("button",{className:"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:i,type:"button",children:[jsxRuntime.jsx(ve,{size:14}),jsxRuntime.jsx("span",{children:"Open link"})]})]})]})}):null};var ie=react.createContext(null),Ue=()=>react.useContext(ie),cr=()=>{var t;let e=Ue();return (t=e==null?void 0:e.code)!=null?t:null},U=()=>{var t;let e=Ue();return (t=e==null?void 0:e.mermaid)!=null?t:null};var Ke=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((d,s)=>{let m="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let r=document.createElement("canvas"),l=i.width*o,c=i.height*o;r.width=l,r.height=c;let u=r.getContext("2d");if(!u){s(new Error("Failed to create 2D canvas context for PNG export"));return}u.drawImage(i,0,0,l,c),r.toBlob(p=>{if(!p){s(new Error("Failed to create PNG blob"));return}d(p);},"image/png");},i.onerror=()=>s(new Error("Failed to load SVG image")),i.src=m;})};var Ye=({chart:e,children:t,className:o,onDownload:n,config:d,onError:s})=>{let[m,i]=react.useState(false),r=react.useRef(null),{isAnimating:l}=react.useContext(N),c=U(),u=async p=>{try{if(p==="mmd"){B("diagram.mmd",e,"text/plain"),i(!1),n==null||n(p);return}if(!c){s==null||s(new Error("Mermaid plugin not available"));return}let f=c.getMermaid(d),a=e.split("").reduce((k,C)=>(k<<5)-k+C.charCodeAt(0)|0,0),h=`mermaid-${Math.abs(a)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:y}=await f.render(h,e);if(!y){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}if(p==="svg"){B("diagram.svg",y,"image/svg+xml"),i(!1),n==null||n(p);return}if(p==="png"){let k=await Ke(y);B("diagram.png",k,"image/png"),n==null||n(p),i(!1);return}}catch(f){s==null||s(f);}};return react.useEffect(()=>{let p=f=>{let a=f.composedPath();r.current&&!a.includes(r.current)&&i(false);};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[]),jsxRuntime.jsxs("div",{className:"relative",ref:r,children:[jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:l,onClick:()=>i(!m),title:"Download diagram",type:"button",children:t!=null?t:jsxRuntime.jsx(z,{size:14})}),m?jsxRuntime.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]}):null]})};var te=0,Lo=()=>{te+=1,te===1&&(document.body.style.overflow="hidden");},So=()=>{te=Math.max(0,te-1),te===0&&(document.body.style.overflow="");},ot=({chart:e,config:t,onFullscreen:o,onExit:n,className:d,...s})=>{let[m,i]=react.useState(false),{isAnimating:r,controls:l}=react.useContext(N),c=(()=>{if(typeof l=="boolean")return l;let p=l.mermaid;return p===false?false:p===true||p===void 0?true:p.panZoom!==false})(),u=()=>{i(!m);};return react.useEffect(()=>{if(m){Lo();let p=f=>{f.key==="Escape"&&i(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),So();}}},[m]),react.useEffect(()=>{m?o==null||o():n&&n();},[m,o,n]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",d),disabled:r,onClick:u,title:"View fullscreen",type:"button",...s,children:jsxRuntime.jsx(je,{size:14})}),m?jsxRuntime.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:u,onKeyDown:p=>{p.key==="Escape"&&u();},role:"button",tabIndex:0,children:[jsxRuntime.jsx("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:u,title:"Exit fullscreen",type:"button",children:jsxRuntime.jsx(re,{size:20})}),jsxRuntime.jsx("div",{className:"flex size-full items-center justify-center p-4",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:jsxRuntime.jsx(tt,{chart:e,className:"size-full [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:true,showControls:c})})]}):null]})};var le=e=>{var s,m;let t=[],o=[],n=e.querySelectorAll("thead th");for(let i of n)t.push(((s=i.textContent)==null?void 0:s.trim())||"");let d=e.querySelectorAll("tbody tr");for(let i of d){let r=[],l=i.querySelectorAll("td");for(let c of l)r.push(((m=c.textContent)==null?void 0:m.trim())||"");o.push(r);}return {headers:t,rows:o}},ce=e=>{let{headers:t,rows:o}=e,n=i=>{let r=false,l=false;for(let c of i){if(c==='"'){r=true,l=true;break}(c===","||c===`
3
- `)&&(r=true);}return r?l?`"${i.replace(/"/g,'""')}"`:`"${i}"`:i},d=t.length>0?o.length+1:o.length,s=new Array(d),m=0;t.length>0&&(s[m]=t.map(n).join(","),m+=1);for(let i of o)s[m]=i.map(n).join(","),m+=1;return s.join(`
4
- `)},nt=e=>{let{headers:t,rows:o}=e,n=i=>{let r=false;for(let c of i)if(c===" "||c===`
5
- `||c==="\r"){r=true;break}if(!r)return i;let l=[];for(let c of i)c===" "?l.push("\\t"):c===`
6
- `?l.push("\\n"):c==="\r"?l.push("\\r"):l.push(c);return l.join("")},d=t.length>0?o.length+1:o.length,s=new Array(d),m=0;t.length>0&&(s[m]=t.map(n).join(" "),m+=1);for(let i of o)s[m]=i.map(n).join(" "),m+=1;return s.join(`
7
- `)},Me=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):o.push(n);return o.join("")},rt=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),d=0,s=t.map(i=>Me(i));n[d]=`| ${s.join(" | ")} |`,d+=1;let m=new Array(t.length);for(let i=0;i<t.length;i+=1)m[i]="---";n[d]=`| ${m.join(" | ")} |`,d+=1;for(let i of o)if(i.length<t.length){let r=new Array(t.length);for(let l=0;l<t.length;l+=1)r[l]=l<i.length?Me(i[l]):"";n[d]=`| ${r.join(" | ")} |`,d+=1;}else {let r=i.map(l=>Me(l));n[d]=`| ${r.join(" | ")} |`,d+=1;}return n.join(`
8
- `)};var lt=({children:e,className:t,onCopy:o,onError:n,timeout:d=2e3})=>{let[s,m]=react.useState(false),[i,r]=react.useState(false),l=react.useRef(null),c=react.useRef(0),{isAnimating:u}=react.useContext(N),p=async a=>{var h,y;if(typeof window=="undefined"||!((h=navigator==null?void 0:navigator.clipboard)!=null&&h.write)){n==null||n(new Error("Clipboard API not available"));return}try{let k=(y=l.current)==null?void 0:y.closest('[data-streamdown="table-wrapper"]'),C=k==null?void 0:k.querySelector("table");if(!C){n==null||n(new Error("Table not found"));return}let M=le(C),P=a==="csv"?ce(M):nt(M),E=new ClipboardItem({"text/plain":new Blob([P],{type:"text/plain"}),"text/html":new Blob([C.outerHTML],{type:"text/html"})});await navigator.clipboard.write([E]),r(!0),m(!1),o==null||o(a),c.current=window.setTimeout(()=>r(!1),d);}catch(k){n==null||n(k);}};react.useEffect(()=>{let a=h=>{let y=h.composedPath();l.current&&!y.includes(l.current)&&m(false);};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a),window.clearTimeout(c.current);}},[]);let f=i?J:F;return jsxRuntime.jsxs("div",{className:"relative",ref:l,children:[jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>m(!s),title:"Copy table",type:"button",children:e!=null?e:jsxRuntime.jsx(f,{size:14})}),s?jsxRuntime.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>p("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})};var dt=({children:e,className:t,onDownload:o,onError:n})=>{let[d,s]=react.useState(false),m=react.useRef(null),{isAnimating:i}=react.useContext(N),r=l=>{var c;try{let u=(c=m.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),p=u==null?void 0:u.querySelector("table");if(!p){n==null||n(new Error("Table not found"));return}let f=le(p),a=l==="csv"?ce(f):rt(f);B(`table.${l==="csv"?"csv":"md"}`,a,l==="csv"?"text/csv":"text/markdown"),s(!1),o==null||o(l);}catch(u){n==null||n(u);}};return react.useEffect(()=>{let l=c=>{let u=c.composedPath();m.current&&!u.includes(m.current)&&s(false);};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l);}},[]),jsxRuntime.jsxs("div",{className:"relative",ref:m,children:[jsxRuntime.jsx("button",{className:b("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>s(!d),title:"Download table",type:"button",children:e!=null?e:jsxRuntime.jsx(z,{size:14})}),d?jsxRuntime.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>r("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),jsxRuntime.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>r("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})};var pt=({children:e,className:t,showControls:o,...n})=>jsxRuntime.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[o?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-1",children:[jsxRuntime.jsx(lt,{}),jsxRuntime.jsx(dt,{})]}):null,jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsx("table",{className:b("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]});var Oo=react.lazy(()=>import('./code-block-XWNGTFRY.cjs').then(e=>({default:e.CodeBlock}))),Ao=react.lazy(()=>import('./mermaid-UQ57JT4G.cjs').then(e=>({default:e.Mermaid}))),qo=/language-([^\s]+)/;function ge(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return true;if(!(e!=null&&e.position&&(t!=null&&t.position)))return false;let o=e.position.start,n=t.position.start,d=e.position.end,s=t.position.end;return (o==null?void 0:o.line)===(n==null?void 0:n.line)&&(o==null?void 0:o.column)===(n==null?void 0:n.column)&&(d==null?void 0:d.line)===(s==null?void 0:s.line)&&(d==null?void 0:d.column)===(s==null?void 0:s.column)}function T(e,t){return e.className===t.className&&ge(e.node,t.node)}var Ne=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ue=(e,t)=>{if(typeof e=="boolean")return e;let o=e.mermaid;return o===false?false:o===true||o===void 0?true:o[t]!==false},Se=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("ol",{className:b("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>T(e,t));Se.displayName="MarkdownOl";var bt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("li",{className:b("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&ge(e.node,t.node));bt.displayName="MarkdownLi";var gt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("ul",{className:b("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>T(e,t));gt.displayName="MarkdownUl";var ht=react.memo(({className:e,node:t,...o})=>jsxRuntime.jsx("hr",{className:b("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o}),(e,t)=>T(e,t));ht.displayName="MarkdownHr";var yt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("span",{className:b("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>T(e,t));yt.displayName="MarkdownStrong";var zo=({children:e,className:t,href:o,node:n,...d})=>{let{linkSafety:s}=react.useContext(N),[m,i]=react.useState(false),r=o==="streamdown:incomplete-link",l=react.useCallback(async f=>{if(!(!(s!=null&&s.enabled&&o)||r)){if(f.preventDefault(),s.onLinkCheck&&await s.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[s,o,r]),c=react.useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),u=react.useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:m,onClose:u,onConfirm:c};return s!=null&&s.enabled&&o?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("button",{className:b("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":r,"data-streamdown":"link",onClick:l,type:"button",children:e}),s.renderModal?s.renderModal(p):jsxRuntime.jsx(Fe,{...p})]}):jsxRuntime.jsx("a",{className:b("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":r,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...d,children:e})},wt=react.memo(zo,(e,t)=>T(e,t)&&e.href===t.href);wt.displayName="MarkdownA";var kt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h1",{className:b("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>T(e,t));kt.displayName="MarkdownH1";var vt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h2",{className:b("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>T(e,t));vt.displayName="MarkdownH2";var Ct=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h3",{className:b("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>T(e,t));Ct.displayName="MarkdownH3";var xt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h4",{className:b("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>T(e,t));xt.displayName="MarkdownH4";var Pt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h5",{className:b("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>T(e,t));Pt.displayName="MarkdownH5";var Mt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("h6",{className:b("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>T(e,t));Mt.displayName="MarkdownH6";var Tt=react.memo(({children:e,className:t,node:o,...n})=>{let{controls:d}=react.useContext(N),s=Ne(d,"table");return jsxRuntime.jsx(pt,{className:t,showControls:s,...n,children:e})},(e,t)=>T(e,t));Tt.displayName="MarkdownTable";var Nt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("thead",{className:b("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>T(e,t));Nt.displayName="MarkdownThead";var Lt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("tbody",{className:b("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>T(e,t));Lt.displayName="MarkdownTbody";var St=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("tr",{className:b("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>T(e,t));St.displayName="MarkdownTr";var Rt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("th",{className:b("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>T(e,t));Rt.displayName="MarkdownTh";var It=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("td",{className:b("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>T(e,t));It.displayName="MarkdownTd";var Ht=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("blockquote",{className:b("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>T(e,t));Ht.displayName="MarkdownBlockquote";var Et=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("sup",{className:b("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>T(e,t));Et.displayName="MarkdownSup";var Dt=react.memo(({children:e,className:t,node:o,...n})=>jsxRuntime.jsx("sub",{className:b("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>T(e,t));Dt.displayName="MarkdownSub";var Vt=react.memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=r=>{var p,f;if(!react.isValidElement(r))return false;let l=Array.isArray(r.props.children)?r.props.children:[r.props.children],c=false,u=false;for(let a of l)if(a){if(typeof a=="string")a.trim()!==""&&(c=true);else if(react.isValidElement(a))if(((p=a.props)==null?void 0:p["data-footnote-backref"])!==void 0)u=true;else {let h=Array.isArray(a.props.children)?a.props.children:[a.props.children];for(let y of h){if(typeof y=="string"&&y.trim()!==""){c=true;break}if(react.isValidElement(y)&&((f=y.props)==null?void 0:f["data-footnote-backref"])===void 0){c=true;break}}}}return u&&!c},m=Array.isArray(e)?e.map(r=>{if(!react.isValidElement(r))return r;if(r.type===Se){let c=(Array.isArray(r.props.children)?r.props.children:[r.props.children]).filter(u=>!s(u));return c.length===0?null:{...r,props:{...r.props,children:c}}}return r}):e;return (Array.isArray(m)?m.some(r=>r!==null):m!==null)?jsxRuntime.jsx("section",{className:t,...n,children:m}):null}return jsxRuntime.jsx("section",{className:t,...n,children:e})},(e,t)=>T(e,t));Vt.displayName="MarkdownSection";var $o=({node:e,className:t,children:o,...n})=>{var p,f,a;let d=((p=e==null?void 0:e.position)==null?void 0:p.start.line)===((f=e==null?void 0:e.position)==null?void 0:f.end.line),{mermaid:s,controls:m}=react.useContext(N),i=U();if(d)return jsxRuntime.jsx("code",{className:b("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let r=t==null?void 0:t.match(qo),l=(a=r==null?void 0:r.at(1))!=null?a:"",c="";if(react.isValidElement(o)&&o.props&&typeof o.props=="object"&&"children"in o.props&&typeof o.props.children=="string"?c=o.props.children:typeof o=="string"&&(c=o),l==="mermaid"&&i){let h=Ne(m,"mermaid"),y=ue(m,"download"),k=ue(m,"copy"),C=ue(m,"fullscreen"),M=ue(m,"panZoom"),P=h&&(y||k||C);return jsxRuntime.jsx(react.Suspense,{fallback:jsxRuntime.jsx(Pe,{}),children:jsxRuntime.jsxs("div",{className:b("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[P?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-2",children:[y?jsxRuntime.jsx(Ye,{chart:c,config:s==null?void 0:s.config}):null,k?jsxRuntime.jsx(Ce,{code:c}):null,C?jsxRuntime.jsx(ot,{chart:c,config:s==null?void 0:s.config}):null]}):null,jsxRuntime.jsx(Ao,{chart:c,config:s==null?void 0:s.config,showControls:M})]})})}let u=Ne(m,"code");return jsxRuntime.jsx(react.Suspense,{fallback:jsxRuntime.jsx(Pe,{}),children:jsxRuntime.jsx(Oo,{className:b("overflow-x-auto border-border border-t",t),code:c,language:l,children:u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(We,{code:c,language:l}),jsxRuntime.jsx(Ce,{})]}):null})})},Bt=react.memo($o,(e,t)=>e.className===t.className&&ge(e.node,t.node));Bt.displayName="MarkdownCode";var jt=react.memo(Xe,(e,t)=>e.className===t.className&&ge(e.node,t.node));jt.displayName="MarkdownImg";var Ot=react.memo(({children:e,className:t,node:o,...n})=>{var m,i;let s=(Array.isArray(e)?e:[e]).filter(r=>r!=null&&r!=="");if(s.length===1&&react.isValidElement(s[0])){let r=s[0].props.node,l=r==null?void 0:r.tagName;if(l==="img")return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e});if(l==="code"&&((m=r==null?void 0:r.position)==null?void 0:m.start.line)!==((i=r==null?void 0:r.position)==null?void 0:i.end.line))return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}return jsxRuntime.jsx("p",{className:t,...n,children:e})},(e,t)=>T(e,t));Ot.displayName="MarkdownParagraph";var At={ol:Se,li:bt,ul:gt,hr:ht,strong:yt,a:wt,h1:kt,h2:vt,h3:Ct,h4:xt,h5:Pt,h6:Mt,table:Tt,thead:Nt,tbody:Lt,tr:St,th:Rt,td:It,blockquote:Ht,code:Bt,img:jt,pre:({children:e})=>e,sup:Et,sub:Dt,p:Ot,section:Vt};var qt=[],zt={allowDangerousHtml:true},he=new WeakMap,Re=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let o=this.keyCache.get(t);if(o)return o;let n=t.rehypePlugins,d=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||d||s)){let u="default";return this.keyCache.set(t,u),u}let m=u=>{if(!u||u.length===0)return "";let p="";for(let f=0;f<u.length;f+=1){let a=u[f];if(f>0&&(p+=","),Array.isArray(a)){let[h,y]=a;if(typeof h=="function"){let k=he.get(h);k||(k=h.name,he.set(h,k)),p+=k;}else p+=String(h);p+=":",p+=JSON.stringify(y);}else if(typeof a=="function"){let h=he.get(a);h||(h=a.name,he.set(a,h)),p+=h;}else p+=String(a);}return p},i=m(n),r=m(d),l=s?JSON.stringify(s):"",c=`${r}::${i}::${l}`;return this.keyCache.set(t,c),c}get(t){let o=this.generateCacheKey(t),n=this.cache.get(o);return n&&(this.cache.delete(o),this.cache.set(o,n)),n}set(t,o){let n=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let d=this.cache.keys().next().value;d&&this.cache.delete(d);}this.cache.set(n,o);}clear(){this.cache.clear();}},$t=new Re,Ie=e=>{let t=Ko(e),o=e.children||"";return Yo(t.runSync(t.parse(o),o),e)},Ko=e=>{let t=$t.get(e);if(t)return t;let o=Go(e);return $t.set(e,o),o},Go=e=>{let t=e.rehypePlugins||qt,o=e.remarkPlugins||qt,n=e.remarkRehypeOptions?{...zt,...e.remarkRehypeOptions}:zt;return unified.unified().use(Jo__default.default).use(o).use(Fo__default.default,n).use(t)},Yo=(e,t)=>hastUtilToJsxRuntime.toJsxRuntime(e,{Fragment:jsxRuntime.Fragment,components:t.components,ignoreInvalidStyle:true,jsx:jsxRuntime.jsx,jsxs:jsxRuntime.jsxs,passKeys:true,passNode:true});var en=/\[\^[^\]\s]{1,200}\](?!:)/,tn=/\[\^[^\]\s]{1,200}\]:/,on=/<\/(\w+)>/,nn=/<(\w+)[\s>]/,He=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
9
- `||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},rn=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
10
- `||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},Ee=e=>{let t=0;for(let o=0;o<e.length-1;o+=1)e[o]==="$"&&e[o+1]==="$"&&(t+=1,o+=1);return t},De=e=>{let t=en.test(e),o=tn.test(e);if(t||o)return [e];let n=marked.Lexer.lex(e,{gfm:true}),d=[],s=[];for(let m of n){let i=m.raw,r=d.length;if(s.length>0){if(d[r-1]+=i,m.type==="html"){let c=i.match(on);if(c){let u=c[1];s.at(-1)===u&&s.pop();}}continue}if(m.type==="html"&&m.block){let c=i.match(nn);if(c){let u=c[1];i.includes(`</${u}>`)||s.push(u);}}if(i.trim()==="$$"&&r>0){let c=d[r-1],u=He(c),p=Ee(c);if(u&&p%2===1){d[r-1]=c+i;continue}}if(r>0&&rn(i)){let c=d[r-1],u=He(c),p=Ee(c),f=Ee(i);if(u&&p%2===1&&!He(i)&&f===1){d[r-1]=c+i;continue}}d.push(i);}return d};var gn={raw:pn__default.default,sanitize:[un__default.default,{}],harden:[rehypeHarden.harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},hn={gfm:[fn__default.default,{}]},yn=Object.values(gn),wn=Object.values(hn),kn={block:" \u258B",circle:" \u25CF"},vn={shikiTheme:["github-light","github-dark"],controls:true,isAnimating:false,mode:"streaming",mermaid:void 0,linkSafety:{enabled:true}},N=react.createContext(vn),Wt=react.memo(({content:e,shouldParseIncompleteMarkdown:t,index:o,...n})=>jsxRuntime.jsx(Ie,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return false;if(e.components!==t.components){let o=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(o.length!==n.length||o.some(d=>{var s,m;return ((s=e.components)==null?void 0:s[d])!==((m=t.components)==null?void 0:m[d])}))return false}return !(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Wt.displayName="Block";var Cn=["github-light","github-dark"],xn=react.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:o=true,components:n,rehypePlugins:d=yn,remarkPlugins:s=wn,className:m,shikiTheme:i=Cn,mermaid:r,controls:l=true,isAnimating:c=false,BlockComponent:u=Wt,parseMarkdownIntoBlocksFn:p=De,caret:f,plugins:a,remend:h,linkSafety:y={enabled:true},...k})=>{let C=react.useId(),[M,P]=react.useTransition(),E=react.useMemo(()=>typeof e!="string"?"":t==="streaming"&&o?bn__default.default(e,h):e,[e,t,o,h]),L=react.useMemo(()=>p(E),[E,p]),[D,A]=react.useState(L);react.useEffect(()=>{t==="streaming"?P(()=>{A(L);}):A(L);},[L,t]);let j=t==="streaming"?D:L,q=react.useMemo(()=>j.map((S,W)=>`${C}-${W}`),[j.length,C]),V=react.useMemo(()=>{var S,W;return {shikiTheme:(W=(S=a==null?void 0:a.code)==null?void 0:S.getThemes())!=null?W:i,controls:l,isAnimating:c,mode:t,mermaid:r,linkSafety:y}},[i,l,c,t,r,y,a==null?void 0:a.code]),w=react.useMemo(()=>({...At,...n}),[n]),R=react.useMemo(()=>{let S=[];return a!=null&&a.cjk&&(S=[...S,...a.cjk.remarkPluginsBefore]),S=[...S,...s],a!=null&&a.cjk&&(S=[...S,...a.cjk.remarkPluginsAfter]),a!=null&&a.math&&(S=[...S,a.math.remarkPlugin]),S},[s,a==null?void 0:a.math,a==null?void 0:a.cjk]),Y=react.useMemo(()=>a!=null&&a.math?[...d,a.math.rehypePlugin]:d,[d,a==null?void 0:a.math]),Ut=react.useMemo(()=>f&&c?{"--streamdown-caret":`"${kn[f]}"`}:void 0,[f,c]);return t==="static"?jsxRuntime.jsx(ie.Provider,{value:a!=null?a:null,children:jsxRuntime.jsx(N.Provider,{value:V,children:jsxRuntime.jsx("div",{className:b("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",m),children:jsxRuntime.jsx(Ie,{components:w,rehypePlugins:Y,remarkPlugins:R,...k,children:e})})})}):jsxRuntime.jsx(ie.Provider,{value:a!=null?a:null,children:jsxRuntime.jsx(N.Provider,{value:V,children:jsxRuntime.jsxs("div",{className:b("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",f?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,m),style:Ut,children:[j.length===0&&f&&c&&jsxRuntime.jsx("span",{}),j.map((S,W)=>jsxRuntime.jsx(u,{components:w,content:S,index:W,rehypePlugins:Y,remarkPlugins:R,shouldParseIncompleteMarkdown:o,...k},q[W]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);xn.displayName="Streamdown";var Ft=({children:e,className:t,minZoom:o=.5,maxZoom:n=3,zoomStep:d=.1,showControls:s=true,initialZoom:m=1,fullscreen:i=false})=>{let r=react.useRef(null),l=react.useRef(null),[c,u]=react.useState(m),[p,f]=react.useState({x:0,y:0}),[a,h]=react.useState(false),[y,k]=react.useState({x:0,y:0}),[C,M]=react.useState({x:0,y:0}),P=react.useCallback(w=>{u(R=>Math.max(o,Math.min(n,R+w)));},[o,n]),E=react.useCallback(()=>{P(d);},[P,d]),L=react.useCallback(()=>{P(-d);},[P,d]),D=react.useCallback(()=>{u(m),f({x:0,y:0});},[m]),A=react.useCallback(w=>{w.preventDefault();let R=w.deltaY>0?-d:d;P(R);},[P,d]),j=react.useCallback(w=>{if(w.button!==0||w.isPrimary===false)return;h(true),k({x:w.clientX,y:w.clientY}),M(p);let R=w.currentTarget;R instanceof HTMLElement&&R.setPointerCapture(w.pointerId);},[p]),q=react.useCallback(w=>{if(!a)return;w.preventDefault();let R=w.clientX-y.x,Y=w.clientY-y.y;f({x:C.x+R,y:C.y+Y});},[a,y,C]),V=react.useCallback(w=>{h(false);let R=w.currentTarget;R instanceof HTMLElement&&R.releasePointerCapture(w.pointerId);},[]);return react.useEffect(()=>{let w=r.current;if(w)return w.addEventListener("wheel",A,{passive:false}),()=>{w.removeEventListener("wheel",A);}},[A]),react.useEffect(()=>{let w=l.current;if(w&&a)return document.body.style.userSelect="none",w.addEventListener("pointermove",q,{passive:false}),w.addEventListener("pointerup",V),w.addEventListener("pointercancel",V),()=>{document.body.style.userSelect="",w.removeEventListener("pointermove",q),w.removeEventListener("pointerup",V),w.removeEventListener("pointercancel",V);}},[a,q,V]),jsxRuntime.jsxs("div",{className:b("relative flex flex-col",i?"h-full w-full":"min-h-28 w-full",t),ref:r,style:{cursor:a?"grabbing":"grab"},children:[s?jsxRuntime.jsxs("div",{className:b("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",i?"bottom-4 left-4":"bottom-2 left-2"),children:[jsxRuntime.jsx("button",{className:"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:c>=n,onClick:E,title:"Zoom in",type:"button",children:jsxRuntime.jsx(Ae,{size:16})}),jsxRuntime.jsx("button",{className:"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:c<=o,onClick:L,title:"Zoom out",type:"button",children:jsxRuntime.jsx(qe,{size:16})}),jsxRuntime.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:D,title:"Reset zoom and pan",type:"button",children:jsxRuntime.jsx(Oe,{size:16})})]}):null,jsxRuntime.jsx("div",{className:b("flex-1 origin-center transition-transform duration-150 ease-out",i?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:j,ref:l,role:"application",style:{transform:`translate(${p.x}px, ${p.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var tt=({chart:e,className:t,config:o,fullscreen:n=false,showControls:d=true})=>{let[s,m]=react.useState(null),[i,r]=react.useState(false),[l,c]=react.useState(""),[u,p]=react.useState(""),[f,a]=react.useState(0),{mermaid:h}=react.useContext(N),y=U(),k=h==null?void 0:h.errorComponent,{shouldRender:C,containerRef:M}=Ve({immediate:n});if(react.useEffect(()=>{if(!C)return;if(!y){m("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{m(null),r(!0);let L=y.getMermaid(o),D=e.split("").reduce((q,V)=>(q<<5)-q+V.charCodeAt(0)|0,0),A=`mermaid-${Math.abs(D)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:j}=await L.render(A,e);c(j),p(j);}catch(L){if(!(u||l)){let D=L instanceof Error?L.message:"Failed to render Mermaid chart";m(D);}}finally{r(false);}})();},[e,o,f,C,y]),!(C||l||u))return jsxRuntime.jsx("div",{className:b("my-4 min-h-[200px]",t),ref:M});if(i&&!l&&!u)return jsxRuntime.jsx("div",{className:b("my-4 flex justify-center p-4",t),ref:M,children:jsxRuntime.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[jsxRuntime.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),jsxRuntime.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(s&&!l&&!u){let E=()=>a(L=>L+1);return k?jsxRuntime.jsx("div",{ref:M,children:jsxRuntime.jsx(k,{chart:e,error:s,retry:E})}):jsxRuntime.jsxs("div",{className:b("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:M,children:[jsxRuntime.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",s]}),jsxRuntime.jsxs("details",{className:"mt-2",children:[jsxRuntime.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),jsxRuntime.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let P=l||u;return jsxRuntime.jsx("div",{className:b("size-full",t),"data-streamdown":"mermaid",ref:M,children:jsxRuntime.jsx(Ft,{className:b(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:d,zoomStep:.1,children:jsxRuntime.jsx("div",{"aria-label":"Mermaid chart",className:b("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:P},role:"img"})})})};exports.a=b;exports.b=ao;exports.c=cr;exports.d=tt;exports.e=De;exports.f=gn;exports.g=hn;exports.h=N;exports.i=Wt;exports.j=xn;
@@ -1,3 +0,0 @@
1
- "use client";
2
- import {a,h as h$1,c,b}from'./chunk-5FQGJX7Z.js';import {memo,useMemo,useContext,useState,useEffect}from'react';import {jsx,jsxs}from'react/jsx-runtime';var H=a("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"),k=memo(({children:o,result:e,language:s,className:a$1,...p})=>{let d=useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]);return jsx("pre",{className:a(a$1,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":s,"data-streamdown":"code-block-body",style:d,...p,children:jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:e.tokens.map((l,r)=>jsx("span",{className:H,children:l.map((t,n)=>jsx("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:t.color,backgroundColor:t.bgColor,...t.htmlStyle},...t.htmlAttrs,children:t.content},n))},r))})})},(o,e)=>o.result===e.result&&o.language===e.language&&o.className===e.className);var C=({className:o,language:e,style:s,...a$1})=>jsx("div",{className:a("my-4 w-full overflow-hidden rounded-xl border border-border",o),"data-language":e,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...s},...a$1});var h=({language:o,children:e})=>jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":o,"data-streamdown":"code-block-header",children:[jsx("span",{className:"ml-1 font-mono lowercase",children:o}),jsx("div",{className:"flex items-center gap-2",children:e})]});var W=({code:o,language:e,className:s,children:a,...p})=>{let{shikiTheme:d}=useContext(h$1),l=c(),r=useMemo(()=>({bg:"transparent",fg:"inherit",tokens:o.split(`
3
- `).map(c=>[{content:c,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[o]),[t,n]=useState(r);return useEffect(()=>{if(!l){n(r);return}let c=l.highlight({code:o,language:e,themes:d},B=>{n(B);});if(c){n(c);return}n(r);},[o,e,d,l,r]),jsx(b.Provider,{value:{code:o},children:jsxs(C,{language:e,children:[jsx(h,{language:e,children:a}),jsx(k,{className:s,language:e,result:t,...p})]})})};export{W as CodeBlock};
@@ -1,3 +0,0 @@
1
- "use client";
2
- 'use strict';var chunkQX4TVXVA_cjs=require('./chunk-QX4TVXVA.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var H=chunkQX4TVXVA_cjs.a("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"),k=react.memo(({children:o,result:e,language:s,className:a,...p})=>{let d=react.useMemo(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]);return jsxRuntime.jsx("pre",{className:chunkQX4TVXVA_cjs.a(a,"p-4 text-sm dark:bg-(--shiki-dark-bg)!"),"data-language":s,"data-streamdown":"code-block-body",style:d,...p,children:jsxRuntime.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:e.tokens.map((l,r)=>jsxRuntime.jsx("span",{className:H,children:l.map((t,n)=>jsxRuntime.jsx("span",{className:"dark:bg-(--shiki-dark-bg)! dark:text-(--shiki-dark)!",style:{color:t.color,backgroundColor:t.bgColor,...t.htmlStyle},...t.htmlAttrs,children:t.content},n))},r))})})},(o,e)=>o.result===e.result&&o.language===e.language&&o.className===e.className);var C=({className:o,language:e,style:s,...a})=>jsxRuntime.jsx("div",{className:chunkQX4TVXVA_cjs.a("my-4 w-full overflow-hidden rounded-xl border border-border",o),"data-language":e,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...s},...a});var h=({language:o,children:e})=>jsxRuntime.jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":o,"data-streamdown":"code-block-header",children:[jsxRuntime.jsx("span",{className:"ml-1 font-mono lowercase",children:o}),jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:e})]});var W=({code:o,language:e,className:s,children:a,...p})=>{let{shikiTheme:d}=react.useContext(chunkQX4TVXVA_cjs.h),l=chunkQX4TVXVA_cjs.c(),r=react.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:o.split(`
3
- `).map(c=>[{content:c,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[o]),[t,n]=react.useState(r);return react.useEffect(()=>{if(!l){n(r);return}let c=l.highlight({code:o,language:e,themes:d},B=>{n(B);});if(c){n(c);return}n(r);},[o,e,d,l,r]),jsxRuntime.jsx(chunkQX4TVXVA_cjs.b.Provider,{value:{code:o},children:jsxRuntime.jsxs(C,{language:e,children:[jsxRuntime.jsx(h,{language:e,children:a}),jsxRuntime.jsx(k,{className:s,language:e,result:t,...p})]})})};exports.CodeBlock=W;
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- "use client";
2
- 'use strict';var chunkQX4TVXVA_cjs=require('./chunk-QX4TVXVA.cjs');Object.defineProperty(exports,"Block",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.i}});Object.defineProperty(exports,"Streamdown",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.j}});Object.defineProperty(exports,"StreamdownContext",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.h}});Object.defineProperty(exports,"defaultRehypePlugins",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.f}});Object.defineProperty(exports,"defaultRemarkPlugins",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.g}});Object.defineProperty(exports,"parseMarkdownIntoBlocks",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.e}});
package/dist/index.d.cts DELETED
@@ -1,223 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import { JSX, ComponentType } from 'react';
4
- import { MermaidConfig } from 'mermaid';
5
- import { RemendOptions } from 'remend';
6
- import { BundledLanguage, BundledTheme } from 'shiki';
7
- export { BundledLanguage, BundledTheme } from 'shiki';
8
- import { PluggableList, Pluggable } from 'unified';
9
- import { Element } from 'hast';
10
- import { Options as Options$1 } from 'remark-rehype';
11
-
12
- interface ExtraProps {
13
- node?: Element | undefined;
14
- }
15
- type Components = {
16
- [Key in keyof JSX.IntrinsicElements]?: ComponentType<JSX.IntrinsicElements[Key] & ExtraProps> | keyof JSX.IntrinsicElements;
17
- };
18
- interface Options {
19
- children?: string;
20
- components?: Components;
21
- rehypePlugins?: PluggableList;
22
- remarkPlugins?: PluggableList;
23
- remarkRehypeOptions?: Readonly<Options$1>;
24
- }
25
-
26
- /**
27
- * A single token in a highlighted line
28
- */
29
- interface HighlightToken {
30
- content: string;
31
- color?: string;
32
- bgColor?: string;
33
- htmlStyle?: Record<string, string>;
34
- htmlAttrs?: Record<string, string>;
35
- offset?: number;
36
- }
37
- /**
38
- * Result from code highlighting (compatible with shiki's TokensResult)
39
- */
40
- interface HighlightResult {
41
- tokens: HighlightToken[][];
42
- fg?: string;
43
- bg?: string;
44
- }
45
- /**
46
- * Options for highlighting code
47
- */
48
- interface HighlightOptions {
49
- code: string;
50
- language: BundledLanguage;
51
- themes: [string, string];
52
- }
53
- /**
54
- * Plugin for code syntax highlighting (Shiki)
55
- */
56
- interface CodeHighlighterPlugin {
57
- name: "shiki";
58
- type: "code-highlighter";
59
- /**
60
- * Highlight code and return tokens
61
- * Returns null if highlighting not ready yet (async loading)
62
- * Use callback for async result
63
- */
64
- highlight: (options: HighlightOptions, callback?: (result: HighlightResult) => void) => HighlightResult | null;
65
- /**
66
- * Check if language is supported
67
- */
68
- supportsLanguage: (language: BundledLanguage) => boolean;
69
- /**
70
- * Get list of supported languages
71
- */
72
- getSupportedLanguages: () => BundledLanguage[];
73
- /**
74
- * Get the configured themes
75
- */
76
- getThemes: () => [BundledTheme, BundledTheme];
77
- }
78
- /**
79
- * Mermaid instance interface
80
- */
81
- interface MermaidInstance {
82
- initialize: (config: MermaidConfig) => void;
83
- render: (id: string, source: string) => Promise<{
84
- svg: string;
85
- }>;
86
- }
87
- /**
88
- * Plugin for diagram rendering (Mermaid)
89
- */
90
- interface DiagramPlugin {
91
- name: "mermaid";
92
- type: "diagram";
93
- /**
94
- * Language identifier for code blocks
95
- */
96
- language: string;
97
- /**
98
- * Get the mermaid instance (initialized with optional config)
99
- */
100
- getMermaid: (config?: MermaidConfig) => MermaidInstance;
101
- }
102
- /**
103
- * Plugin for math rendering (KaTeX)
104
- */
105
- interface MathPlugin {
106
- name: "katex";
107
- type: "math";
108
- /**
109
- * Get remark plugin for parsing math syntax
110
- */
111
- remarkPlugin: Pluggable;
112
- /**
113
- * Get rehype plugin for rendering math
114
- */
115
- rehypePlugin: Pluggable;
116
- /**
117
- * Get CSS styles for math rendering (injected into head)
118
- */
119
- getStyles?: () => string;
120
- }
121
- /**
122
- * Plugin for CJK text handling
123
- */
124
- interface CjkPlugin {
125
- name: "cjk";
126
- type: "cjk";
127
- /**
128
- * Remark plugins that must run BEFORE remarkGfm
129
- * (e.g., remark-cjk-friendly which modifies emphasis handling)
130
- */
131
- remarkPluginsBefore: Pluggable[];
132
- /**
133
- * Remark plugins that must run AFTER remarkGfm
134
- * (e.g., autolink boundary splitting, strikethrough enhancements)
135
- */
136
- remarkPluginsAfter: Pluggable[];
137
- /**
138
- * @deprecated Use remarkPluginsBefore and remarkPluginsAfter instead
139
- * All remark plugins (for backwards compatibility)
140
- */
141
- remarkPlugins: Pluggable[];
142
- }
143
- /**
144
- * Plugin configuration passed to Streamdown
145
- */
146
- interface PluginConfig {
147
- code?: CodeHighlighterPlugin;
148
- mermaid?: DiagramPlugin;
149
- math?: MathPlugin;
150
- cjk?: CjkPlugin;
151
- }
152
-
153
- declare const parseMarkdownIntoBlocks: (markdown: string) => string[];
154
-
155
- type ControlsConfig = boolean | {
156
- table?: boolean;
157
- code?: boolean;
158
- mermaid?: boolean | {
159
- download?: boolean;
160
- copy?: boolean;
161
- fullscreen?: boolean;
162
- panZoom?: boolean;
163
- };
164
- };
165
- interface LinkSafetyModalProps {
166
- url: string;
167
- isOpen: boolean;
168
- onClose: () => void;
169
- onConfirm: () => void;
170
- }
171
- interface LinkSafetyConfig {
172
- enabled: boolean;
173
- onLinkCheck?: (url: string) => Promise<boolean> | boolean;
174
- renderModal?: (props: LinkSafetyModalProps) => React.ReactNode;
175
- }
176
- interface MermaidErrorComponentProps {
177
- error: string;
178
- chart: string;
179
- retry: () => void;
180
- }
181
- interface MermaidOptions {
182
- config?: MermaidConfig;
183
- errorComponent?: React.ComponentType<MermaidErrorComponentProps>;
184
- }
185
- type StreamdownProps = Options & {
186
- mode?: "static" | "streaming";
187
- BlockComponent?: React.ComponentType<BlockProps>;
188
- parseMarkdownIntoBlocksFn?: (markdown: string) => string[];
189
- parseIncompleteMarkdown?: boolean;
190
- className?: string;
191
- shikiTheme?: [BundledTheme, BundledTheme];
192
- mermaid?: MermaidOptions;
193
- controls?: ControlsConfig;
194
- isAnimating?: boolean;
195
- caret?: keyof typeof carets;
196
- plugins?: PluginConfig;
197
- remend?: RemendOptions;
198
- linkSafety?: LinkSafetyConfig;
199
- };
200
- declare const defaultRehypePlugins: Record<string, Pluggable>;
201
- declare const defaultRemarkPlugins: Record<string, Pluggable>;
202
- declare const carets: {
203
- block: string;
204
- circle: string;
205
- };
206
- interface StreamdownContextType {
207
- shikiTheme: [BundledTheme, BundledTheme];
208
- controls: ControlsConfig;
209
- isAnimating: boolean;
210
- mode: "static" | "streaming";
211
- mermaid?: MermaidOptions;
212
- linkSafety?: LinkSafetyConfig;
213
- }
214
- declare const StreamdownContext: react.Context<StreamdownContextType>;
215
- type BlockProps = Options & {
216
- content: string;
217
- shouldParseIncompleteMarkdown: boolean;
218
- index: number;
219
- };
220
- declare const Block: react.MemoExoticComponent<({ content, shouldParseIncompleteMarkdown: _, index: __, ...props }: BlockProps) => react_jsx_runtime.JSX.Element>;
221
- declare const Streamdown: react.MemoExoticComponent<({ children, mode, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, controls, isAnimating, BlockComponent, parseMarkdownIntoBlocksFn, caret, plugins, remend: remendOptions, linkSafety, ...props }: StreamdownProps) => react_jsx_runtime.JSX.Element>;
222
-
223
- export { Block, type CjkPlugin, type CodeHighlighterPlugin, type ControlsConfig, type DiagramPlugin, type HighlightOptions, type LinkSafetyConfig, type LinkSafetyModalProps, type MathPlugin, type MermaidErrorComponentProps, type MermaidOptions, type PluginConfig, Streamdown, StreamdownContext, type StreamdownContextType, type StreamdownProps, defaultRehypePlugins, defaultRemarkPlugins, parseMarkdownIntoBlocks };
@@ -1,2 +0,0 @@
1
- "use client";
2
- export{d as Mermaid}from'./chunk-5FQGJX7Z.js';
@@ -1,2 +0,0 @@
1
- "use client";
2
- 'use strict';var chunkQX4TVXVA_cjs=require('./chunk-QX4TVXVA.cjs');Object.defineProperty(exports,"Mermaid",{enumerable:true,get:function(){return chunkQX4TVXVA_cjs.d}});