@lofcz/streamdown 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import {createContext,memo,useContext,useMemo,lazy,isValidElement,useLayoutEffect,useId,useRef,useEffect,useDeferredValue,cloneElement,createElement,useState,useCallback,Suspense}from'react';import {harden}from'rehype-harden';import nn from'rehype-raw';import Wr,{defaultSchema}from'rehype-sanitize';import kl from'remark-gfm';import Tl from'remend';import {visitParents,SKIP as SKIP$1}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 ka from'remark-parse';import Ta from'remark-rehype';import {unified}from'unified';import {visit,SKIP}from'unist-util-visit';import {Lexer}from'marked';import {toText}from'hast-util-to-text';var ns=300,rs="300px",ss=500;function ho(e={}){let{immediate:t=false,debounceDelay:o=ns,rootMargin:n=rs,idleTimeout:r=ss}=e,[s,a]=useState(false),c=useRef(null),i=useRef(null),l=useRef(null),d=useMemo(()=>p=>{let f=Date.now();return window.setTimeout(()=>{p({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-f))});},1)},[]),m=useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(p,f)=>window.requestIdleCallback(p,f):d,[d]),u=useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?p=>window.cancelIdleCallback(p):p=>{clearTimeout(p);},[]);return useEffect(()=>{if(t){a(true);return}let p=c.current;if(!p)return;i.current&&(clearTimeout(i.current),i.current=null),l.current&&(u(l.current),l.current=null);let f=()=>{i.current&&(clearTimeout(i.current),i.current=null),l.current&&(u(l.current),l.current=null);},h=x=>{l.current=m(P=>{P.timeRemaining()>0||P.didTimeout?(a(true),x.disconnect()):l.current=m(()=>{a(true),x.disconnect();},{timeout:r/2});},{timeout:r});},g=x=>{f(),i.current=window.setTimeout(()=>{var M,C;let P=x.takeRecords();(P.length===0||(C=(M=P.at(-1))==null?void 0:M.isIntersecting)!=null&&C)&&h(x);},o);},b=(x,P)=>{x.isIntersecting?g(P):f();},y=new IntersectionObserver(x=>{for(let P of x)b(P,y);},{rootMargin:n,threshold:0});return y.observe(p),()=>{i.current&&clearTimeout(i.current),l.current&&u(l.current),y.disconnect();}},[t,o,n,r,u,m]),{shouldRender:s,containerRef:c}}var as=320,is=4,Co=()=>typeof performance=="undefined"?Date.now():performance.now();function Nt(e){var s,a;let t=(s=e==null?void 0:e.now)!=null?s:Co,o=(a=e==null?void 0:e.maxBacklogMs)!=null?a:as,n=0,r=0;return {now:t,beginPass(c){r=Math.min(Math.max(n,c),c+o);},mark(){return r},rewind(c){r=c;},take(c,i,l){if(c<=0)return {baseDelay:0,step:Math.max(0,i)};let d=Math.max(0,i),m=d===0?0:Math.min(d,is),u=Math.max(r,l),p=l+o,f=u+Math.max(0,c-1)*d,h=d;if(f>p&&c>1)if(u<p){let b=p-u;h=Math.max(m,b/(c-1));}else h=m;let g=Math.max(0,Math.round(u-l));return r=u+c*h,{baseDelay:g,step:h}},commitPass(){n=r;}}}function ls(){return {current:0}}var wo=/\s/,At=/^\s+$/,cs=new Set(["pre","svg","math","annotation"]),ds=new Set(["svg","math","annotation"]),Lt=new Set(["img","hr"]),ms=new Set(["ul","ol","li"]),Se=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Dt=(e,t)=>{let o=t?ds:cs;return e.some(n=>Se(n)&&o.has(n.tagName))},us=e=>{for(let t=e.length-1;t>=0;t-=1){let o=e[t];if(Se(o)&&o.tagName==="li")return o}},ps=(e,t,o,n)=>{(e.properties)!=null||(e.properties={}),e.properties["data-sd-animate-marker"]=true,e.properties.style=`--sd-marker-duration:${t}ms;--sd-marker-delay:${o}ms;--sd-marker-easing:${n}`;},xo=e=>{for(let t of e.children)if(Se(t)){if(t.tagName==="input")return t;if(ms.has(t.tagName))continue;let o=xo(t);if(o)return o}},vo=(e,t,o,n)=>{(e.properties)!=null||(e.properties={}),e.properties["data-sd-animate"]=true;let r=typeof e.properties.style=="string"?`${e.properties.style};`:"";e.properties.style=`${r}--sd-animation:sd-${t.animation};--sd-duration:${o}ms;--sd-easing:${t.easing};--sd-delay:${n}ms`;},fs=(e,t,o,n)=>{let r=xo(e);r&&vo(r,t,o,n);},ko=e=>{var t;for(let o=e.length-1;o>=0;o-=1){let n=e[o];if(Se(n)){if((t=n.properties)!=null&&t["data-sd-animated"])break;n.properties={...n.properties,"data-sd-animated":true};}}},To=e=>{let t=[],o="",n=false;for(let r of e){let s=wo.test(r);if(s!==n&&o){if(s){o+=r,n=true;continue}t.push(o),o="";}o+=r,n=s;}return o&&t.push(o),t},Po=e=>{let t=[],o="";for(let n of e)wo.test(n)?t.length>0&&!At.test(t.at(-1))?t[t.length-1]+=n:o+=n:(o&&(t.push(o),o=""),t.push(n));return o&&(t.length>0?t[t.length-1]+=o:t.push(o)),t},gs=(e,t,o,n,r,s)=>{let a=`--sd-animation:sd-${t};--sd-duration:${r?0:o}ms;--sd-easing:${n}`;return s&&(a+=`;--sd-delay:${Math.round(s)}ms`),{type:"element",tagName:"span",properties:{"data-sd-animate":true,style:a},children:[{type:"text",value:e}]}},hs=(e,t,o,n)=>{let r=0,s=0;return visitParents(e,a=>a.type==="text"||Se(a)&&Lt.has(a.tagName),(a,c)=>{if(Dt(c,o.animateCodeBlocks))return SKIP$1;if(Se(a)&&Lt.has(a.tagName)){n>0&&s<n||(r+=1),s+=1;return}let i=a.value;if(!i.trim()){s+=i.length;return}let l=t.sep==="char"?Po(i):To(i);for(let d of l){let m=s;s+=d.length,!At.test(d)&&(n>0&&m<n||(r+=1));}}),r},bs=(e,t,o,n,r,s)=>{if(Dt(t,n.animateCodeBlocks))return;let a=n.prevContentLength,c=r.count;r.count+=1;let i=a>0&&c<a,l=i?0:s.baseDelay+r.newIndex++*s.step;vo(e,o,i?0:o.duration,l),ko(t);},ys=(e,t,o,n,r,s)=>{var b;let a=t.at(-1);if(!(a&&"children"in a))return;if(Dt(t,n.animateCodeBlocks))return SKIP$1;let c=a,i=c.children.indexOf(e);if(i===-1)return;let l=e.value;if(!l.trim()){r.count+=l.length;return}let d=o.sep==="char"?Po(l):To(l),m=n.prevContentLength,u=false,p=us(t),f=!!(p&&!((b=p.properties)!=null&&b["data-sd-animate-marker"])),h=false,g=d.map(y=>{let x=r.count;if(r.count+=y.length,At.test(y))return {type:"text",value:y};let P=m>0&&x<m,S=P?0:s.baseDelay+r.newIndex++*s.step;if(p&&f&&!h){let M=P?0:o.duration;ps(p,M,S,o.easing),fs(p,o,M,S),h=true;}return u=true,gs(y,o.animation,o.duration,o.easing,P,S)});return u&&ko(t),c.children.splice(i,1,...g),i+g.length},Cs=0;function ct(e){var s,a,c,i,l;let t={animation:(s=e==null?void 0:e.animation)!=null?s:"fadeIn",duration:(a=e==null?void 0:e.duration)!=null?a:150,easing:(c=e==null?void 0:e.easing)!=null?c:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word",stagger:(l=e==null?void 0:e.stagger)!=null?l:40,timeline:e==null?void 0:e.timeline},o={animateCodeBlocks:false,committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},n=Cs++,r=()=>d=>{var h;let m={count:0,newIndex:0};o.prevContentLength=o.committedCharCount;let u=t.timeline,p=(h=u==null?void 0:u.now())!=null?h:Co();u&&(o.pendingMark===null?o.pendingMark=u.mark():u.rewind(o.pendingMark));let f=u?u.take(hs(d,t,o,o.prevContentLength),t.stagger,p):{baseDelay:0,step:t.stagger};visitParents(d,g=>g.type==="text"||Se(g)&&Lt.has(g.tagName),(g,b)=>{if(g.type==="text")return ys(g,b,t,o,m,f);bs(g,b,t,o,m,f);}),o.lastRenderCharCount=m.count,o.prevContentLength=0;};return Object.defineProperty(r,"name",{value:`rehypeAnimate$${n}`}),{name:"animate",type:"animate",rehypePlugin:r,setAnimateCodeBlocks(d){o.animateCodeBlocks=d;},setPrevContentLength(d){o.committedCharCount=d,o.prevContentLength=d;},getLastRenderCharCount(){return o.lastRenderCharCount},commit(){o.committedCharCount=o.lastRenderCharCount,o.pendingMark=null;}}}ct();var Ht=createContext(false),Bt=()=>useContext(Ht);var He=(...e)=>twMerge(clsx(e)),dt=e=>{if(e!==void 0)return typeof e=="number"?!Number.isFinite(e)||e<=0?void 0:`${e}px`:e},vs=(e,t)=>{if(!e||!t)return t;let o=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(o)?n:`${e}:${n}`).join(" ")},Io=e=>e?(...t)=>vs(e,twMerge(clsx(t))):He,oe=(e,t,o)=>{let n=typeof t=="string"&&o.startsWith("text/csv")?"\uFEFF":"",r=typeof t=="string"?new Blob([n+t],{type:o}):t,s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s);};var mt=createContext(He),v=()=>useContext(mt);var qe=({scrollRef:e,ref:t,...o})=>jsx("div",{ref:e,...o});var Is=8,Es=e=>e.scrollHeight-e.scrollTop-e.clientHeight<Is,No=e=>{var o,n;let t=(n=(o=e.touches[0])!=null?o:e.changedTouches[0])!=null?n:null;return typeof(t==null?void 0:t.clientY)=="number"?t.clientY:null},ut=({enabled:e,isAnimating:t,content:o})=>{let[n,r]=useState(null),s=useRef(true),a=useRef(0),c=useCallback(l=>{r(d=>d===l?d:l);},[]),i=useCallback(l=>{t&&s.current&&(l.scrollTo({top:l.scrollHeight,behavior:"instant"}),a.current=l.scrollTop);},[t]);return useEffect(()=>{t||(s.current=true);},[t]),useEffect(()=>{if(!(e&&n))return;a.current=n.scrollTop;let l=()=>{s.current=false;},d=g=>{g.deltaY<0&&l();},m=null,u=g=>{m=No(g);},p=g=>{if(m===null)return;let b=No(g);if(b===null)return;let y=b-m;Math.abs(y)<=3||(y>0&&l(),m=b);},f=()=>{m=null;},h=()=>{let g=n.scrollTop<a.current;if(a.current=n.scrollTop,g){l();return}Es(n)&&(s.current=true);};return n.addEventListener("wheel",d,{capture:true,passive:true}),n.addEventListener("touchstart",u,{passive:true}),n.addEventListener("touchmove",p,{passive:true}),n.addEventListener("touchend",f,{passive:true}),n.addEventListener("touchcancel",f,{passive:true}),n.addEventListener("scroll",h,{passive:true}),()=>{n.removeEventListener("wheel",d,{capture:true}),n.removeEventListener("touchstart",u),n.removeEventListener("touchmove",p),n.removeEventListener("touchend",f),n.removeEventListener("touchcancel",f),n.removeEventListener("scroll",h);}},[e,n]),useLayoutEffect(()=>{if(!(e&&n)||(i(n),typeof ResizeObserver=="undefined"))return;let l=new ResizeObserver(()=>{i(n);});l.observe(n);for(let d of n.children)l.observe(d);return ()=>{l.disconnect();}},[o,n,e,i]),c};var Ns=He("block"),As=He("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"),Ds=e=>{let t={};for(let o of e.split(";")){let n=o.indexOf(":");if(n>0){let r=o.slice(0,n).trim(),s=o.slice(n+1).trim();r&&s&&(t[r]=s);}}return t},Ao=memo(({children:e,result:t,language:o,className:n,maxHeight:r,startLine:s,lineNumbers:a=true,...c})=>{let i=v(),{isAnimating:l,scrollable:d}=useContext(E),m=d!=null?d:qe,u=dt(r),p=ut({content:t,enabled:!!u,isAnimating:l}),f=useMemo(()=>i(As),[i]),h=useMemo(()=>i(Ns),[i]),g=useMemo(()=>{let b={};return t.bg&&(b["--sdm-bg"]=t.bg),t.fg&&(b["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(b,Ds(t.rootStyle)),b},[t.bg,t.fg,t.rootStyle]);return jsx(m,{className:i(n,u?"overflow-x-auto overflow-y-auto":"overflow-x-auto","rounded-md border border-border bg-background p-4 text-sm"),"data-language":o,"data-streamdown":"code-block-body",scrollRef:p,style:u?{maxHeight:u}:void 0,...c,children:jsx("pre",{className:i(n,"bg-[var(--sdm-bg,inherit)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]"),style:g,children:jsx("code",{className:a?i("[counter-increment:line_0] [counter-reset:line]"):void 0,style:a&&s&&s>1?{counterReset:`line ${s-1}`}:void 0,children:t.tokens.map((b,y)=>jsx("span",{className:a?f:h,children:b.length===0||b.length===1&&b[0].content===""?`
3
+ `:b.map((x,P)=>{let S={},M=!!x.bgColor;if(x.color&&(S["--sdm-c"]=x.color),x.bgColor&&(S["--sdm-tbg"]=x.bgColor),x.htmlStyle)for(let[C,D]of Object.entries(x.htmlStyle))C==="color"?S["--sdm-c"]=D:C==="background-color"?(S["--sdm-tbg"]=D,M=true):S[C]=D;return jsx("span",{className:i("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",M&&"bg-[var(--sdm-tbg)]",M&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:S,...x.htmlAttrs,children:x.content},P)})},y))})})})});var _t=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=v();return jsx("div",{className:s("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},...r})};var Vt=createContext({code:""}),pt=()=>useContext(Vt);var $t=({language:e})=>{let t=v();return jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var Fs=e=>{let t=e.length;for(;t>0&&e[t-1]===`
4
+ `;)t--;return e.slice(0,t)},js=lazy(()=>import('./highlighted-body-IRX6SH3P.js').then(e=>({default:e.HighlightedCodeBlockBody}))),Ft=({code:e,language:t,className:o,children:n,isIncomplete:r=false,startLine:s,lineNumbers:a,...c})=>{let i=v(),{codeBlockMaxHeight:l}=useContext(E),d=useMemo(()=>Fs(e),[e]),m=useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
5
+ `).map(u=>[{content:u,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]);return jsx(Vt.Provider,{value:{code:e},children:jsxs(_t,{dir:"ltr",isIncomplete:r,language:t,children:[jsx($t,{language:t}),n?jsx("div",{className:i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:jsx("div",{className:i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,jsx(Suspense,{fallback:jsx(Ao,{className:o,language:t,lineNumbers:a,maxHeight:l,result:m,startLine:s,...c}),children:jsx(js,{className:o,code:d,language:t,lineNumbers:a,maxHeight:l,raw:m,startLine:s,...c})})]})})};var Bo=e=>jsx("svg",{"aria-hidden":"true",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"})}),Oo=e=>jsx("svg",{"aria-hidden":"true",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"})}),_o=e=>jsx("svg",{"aria-hidden":"true",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"})}),Vo=e=>jsxs("svg",{"aria-hidden":"true",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"})]}),$o=e=>jsx("svg",{"aria-hidden":"true",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"})}),Fo=e=>jsx("svg",{"aria-hidden":"true",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"})}),jo=e=>jsx("svg",{"aria-hidden":"true",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"})}),zo=e=>jsx("svg",{"aria-hidden":"true",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"})}),Wo=e=>jsx("svg",{"aria-hidden":"true",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"})}),qo=e=>jsx("svg",{"aria-hidden":"true",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 Ke={CheckIcon:Bo,CopyIcon:Oo,DownloadIcon:_o,ExternalLinkIcon:zo,Loader2Icon:Vo,Maximize2Icon:$o,RotateCcwIcon:Fo,XIcon:jo,ZoomInIcon:Wo,ZoomOutIcon:qo},Ko=createContext(Ke),Ks=(e,t)=>{if(e===t)return true;if(!(e&&t))return e===t;let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?false:o.every(r=>e[r]===t[r])},jt=({icons:e,children:t})=>{let o=useRef(e),n=useRef(e?{...Ke,...e}:Ke);Ks(o.current,e)||(o.current=e,n.current=e?{...Ke,...e}:Ke);let r=n.current;return jsx(Ko.Provider,{value:r,children:t})},O=()=>useContext(Ko);var ft={alertNote:"Note",alertTip:"Tip",alertImportant:"Important",alertWarning:"Warning",alertCaution:"Caution",copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",zoomIn:"Zoom in",zoomOut:"Zoom out",resetView:"Reset zoom and pan",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},gt=createContext(ft),_=()=>useContext(gt);var ht=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:r,code:s,...a})=>{let c=v(),[i,l]=useState(false),d=useRef(0),{code:m}=pt(),{isAnimating:u}=useContext(E),p=_(),f=s!=null?s:m,h=async()=>{var y;if(typeof window=="undefined"||!((y=navigator==null?void 0:navigator.clipboard)!=null&&y.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(f),l(!0),e==null||e(),d.current=window.setTimeout(()=>l(!1),o));}catch(x){t==null||t(x);}};useEffect(()=>()=>{window.clearTimeout(d.current);},[]);let g=O(),b=i?g.CheckIcon:g.CopyIcon;return jsxs(Fragment,{children:[jsx("button",{"aria-label":p.copyCode,className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:u,onClick:h,title:p.copyCode,type:"button",...a,children:n!=null?n:jsx(b,{"aria-hidden":"true",size:14})}),i&&jsx("output",{"aria-live":"polite",className:"sr-only",children:p.copied})]})};var Ie=(e,t,o)=>{if(typeof e=="boolean")return o;let n=e[t];if(typeof n!="object")return o;let r=n.download;return typeof r!="object"?o:r.filename||o};var Go={"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"},Wt=({onDownload:e,onError:t,language:o,children:n,className:r,code:s,...a})=>{let c=v(),{code:i}=pt(),{isAnimating:l,controls:d}=useContext(E),m=_(),u=O(),p=s!=null?s:i,f=o&&o in Go?Go[o]:"txt",h=`${Ie(d,"code","file")}.${f}`,g="text/plain",b=()=>{try{oe(h,p,g),e==null||e();}catch(y){t==null||t(y);}};return jsx("button",{"aria-label":m.downloadFile,className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:l,onClick:b,title:m.downloadFile,type:"button",...a,children:n!=null?n:jsx(u.DownloadIcon,{size:14})})};var bt=()=>{let{Loader2Icon:e}=O(),t=v();return jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:jsx(e,{className:t("size-4 animate-spin")})})]})};var Ge=0,he=()=>{Ge+=1,Ge===1&&(document.body.style.overflow="hidden");},be=()=>{Ge=Math.max(0,Ge-1),Ge===0&&(document.body.style.overflow="");};var aa=["github-light","github-dark"],ia={enabled:true},la={codeBlockMaxHeight:400,shikiTheme:aa,controls:true,isAnimating:false,lineNumbers:true,listStyle:"hierarchical",mode:"streaming",mermaid:void 0,linkSafety:ia,portal:void 0,tableMaxHeight:300},E=createContext(la);var ua=/\.[^/.]+$/,Jo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.image;return o===false?false:o===true||o===void 0?true:o[t]!==false},Yo=({node:e,className:t,src:o,alt:n,onLoad:r,onError:s,onClick:a,...c})=>{let{DownloadIcon:i,XIcon:l}=O(),d=v(),m=useRef(null),[u,p]=useState(false),[f,h]=useState(false),[g,b]=useState(false),{controls:y}=useContext(E),x=_(),P=Jo(y,"download"),S=Jo(y,"fullscreen"),M=c.width!=null||c.height!=null,C=P&&(u||M)&&!f,D=f&&!M,B=S&&!!o&&!f&&u;useEffect(()=>{let R=m.current;if(R!=null&&R.complete){let z=R.naturalWidth>0;p(z),h(!z);}},[]),useEffect(()=>{if(!g)return;he();let R=z=>{z.key==="Escape"&&b(false);};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R),be();}},[g]);let j=useCallback(R=>{p(true),h(false),r==null||r(R);},[r]),Y=useCallback(R=>{p(false),h(true),s==null||s(R);},[s]),F=useCallback(()=>{B&&b(true);},[B]),H=useCallback(()=>{b(false);},[]),V=useCallback(R=>{a==null||a(R),!R.defaultPrevented&&F();},[a,F]),U=async R=>{if(R.stopPropagation(),!!o)try{let re=await(await fetch(o)).blob(),le=new URL(o,window.location.origin).pathname.split("/").pop()||"",ee=le.split(".").pop(),Ae=le.includes(".")&&ee!==void 0&&ee.length<=4,X="";if(Ae)X=le;else {let W=re.type,T="png";W.includes("jpeg")||W.includes("jpg")?T="jpg":W.includes("png")?T="png":W.includes("svg")?T="svg":W.includes("gif")?T="gif":W.includes("webp")&&(T="webp"),X=`${(n||le||"image").replace(ua,"")}.${T}`;}oe(X,re,re.type);}catch(z){window.open(o,"_blank");}};return o?o==="streamdown:incomplete-image"?jsx("div",{className:d("group relative my-4 inline-block"),"data-incomplete":"true","data-streamdown":"image-wrapper",children:jsx("div",{className:d("h-24 w-48 animate-pulse rounded-lg bg-muted"),"data-streamdown":"image-placeholder"})}):jsxs(Fragment,{children:[jsxs("div",{className:d("group/image not-prose relative my-2 block max-w-full"),"data-streamdown":"image-wrapper",children:[jsx("img",{alt:n,className:d("m-0 block h-auto max-w-full rounded-lg",B&&"cursor-zoom-in",D&&"hidden",t),"data-streamdown":"image",onClick:V,onError:Y,onLoad:j,ref:m,src:o,...c}),D&&jsx("span",{className:d("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:x.imageNotAvailable}),C&&jsx("button",{className:d("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 focus-visible:opacity-100 group-hover/image:opacity-100"),onClick:U,title:x.downloadImage,type:"button",children:jsx(i,{size:14})})]}),g?createPortal(jsxs("div",{className:d("fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"),"data-streamdown":"image-lightbox",onClick:H,onKeyDown:R=>{R.key==="Escape"&&H();},role:"button",tabIndex:0,children:[jsx("button",{className:d("absolute top-4 right-4 z-10 rounded-md p-2 text-white/80 transition-colors hover:bg-white/10 hover:text-white"),onClick:H,title:x.exitFullscreen,type:"button",children:jsx(l,{size:20})}),jsx("div",{onClick:R=>R.stopPropagation(),onKeyDown:R=>R.stopPropagation(),role:"presentation",children:jsx("img",{alt:n,className:d("max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] object-contain"),"data-streamdown":"image-lightbox-img",src:o})})]}),document.body):null]}):null};var Be=e=>{let t=typeof e=="function"?e():e;return t!=null?t:document.body};var tn=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let{CheckIcon:r,CopyIcon:s,ExternalLinkIcon:a,XIcon:c}=O(),i=v(),[l,d]=useState(false),m=_(),{portal:u}=useContext(E),p=useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3);}catch(g){}},[e]),f=useCallback(()=>{n(),o();},[n,o]);if(useEffect(()=>{if(t){he();let g=b=>{b.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),be();}}},[t,o]),!t||typeof document=="undefined")return null;let h=jsx("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:o,onKeyDown:g=>{g.key==="Escape"&&o();},role:"button",tabIndex:0,children:jsxs("div",{className:i("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),role:"presentation",children:[jsx("button",{className:i("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:o,title:m.close,type:"button",children:jsx(c,{size:16})}),jsxs("div",{className:i("flex flex-col gap-2"),children:[jsxs("div",{className:i("flex items-center gap-2 font-semibold text-lg"),children:[jsx(a,{size:20}),jsx("span",{children:m.openExternalLink})]}),jsx("p",{className:i("text-muted-foreground text-sm"),children:m.externalLinkWarning})]}),jsx("div",{className:i("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:i("flex gap-2"),children:[jsx("button",{className:i("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:p,type:"button",children:l?jsxs(Fragment,{children:[jsx(r,{size:14}),jsx("span",{children:m.copied})]}):jsxs(Fragment,{children:[jsx(s,{size:14}),jsx("span",{children:m.copyLink})]})}),jsxs("button",{className:i("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:f,type:"button",children:[jsx(a,{size:14}),jsx("span",{children:m.openLink})]})]})]})});return createPortal(h,Be(u))};var on=()=>e=>{visit(e,"html",(o,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:o.value});});};var rn=[],sn={allowDangerousHtml:true},yt=new WeakMap,Xt=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,r=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||r||s)){let m="default";return this.keyCache.set(t,m),m}let a=m=>{if(!m||m.length===0)return "";let u="";for(let p=0;p<m.length;p+=1){let f=m[p];if(p>0&&(u+=","),Array.isArray(f)){let[h,g]=f;if(typeof h=="function"){let b=yt.get(h);b||(b=h.name,yt.set(h,b)),u+=b;}else u+=String(h);u+=":",u+=JSON.stringify(g);}else if(typeof f=="function"){let h=yt.get(f);h||(h=f.name,yt.set(f,h)),u+=h;}else u+=String(f);}return u},c=a(n),i=a(r),l=s?JSON.stringify(s):"",d=`${i}::${c}::${l}`;return this.keyCache.set(t,d),d}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 r=this.cache.keys().next().value;r&&this.cache.delete(r);}this.cache.set(n,o);}clear(){this.cache.clear();}},an=new Xt,Ue=e=>{let t=Ma(e),o=e.children||"",n=t.runSync(t.parse(o),o);return Aa(n,e)},Ma=e=>{let t=an.get(e);if(t)return t;let o=Ea(e);return an.set(e,o),o},Ia=e=>e.some(t=>Array.isArray(t)?t[0]===nn:t===nn),Ea=e=>{let t=e.rehypePlugins||rn,o=e.remarkPlugins||rn,n=Ia(t)?o:[...o,on],r=e.remarkRehypeOptions?{...sn,...e.remarkRehypeOptions}:sn;return unified().use(ka).use(n).use(Ta,r).use(t)},ln=e=>e,Ra=(e,t,o,n)=>{o?e.children.splice(t,1):e.children[t]={type:"text",value:n};},La=(e,t)=>{var o;for(let n in urlAttributes)if(Object.hasOwn(urlAttributes,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],s=urlAttributes[n];(s===null||s.includes(e.tagName))&&(e.properties[n]=(o=t(String(r||""),n,e))!=null?o:void 0);}},Na=(e,t,o,n,r,s)=>{let a=false;return n?a=!n.includes(e.tagName):r&&(a=r.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,o)),a},Aa=(e,t)=>{let{allowElement:o,allowedElements:n,disallowedElements:r,skipHtml:s,unwrapDisallowed:a,urlTransform:c}=t;if(o||n||r||s||c){let l=c||ln;visit(e,(d,m,u)=>{if(d.type==="raw"&&u&&typeof m=="number")return Ra(u,m,s,d.value),m;if(d.type==="element"&&(La(d,l),Na(d,m,u,n,r,o)&&u&&typeof m=="number"))return a&&d.children?u.children.splice(m,1,...d.children):u.children.splice(m,1),m});}return toJsxRuntime(e,{Fragment:Fragment,components:t.components,ignoreInvalidStyle:true,jsx:jsx,jsxs:jsxs,passKeys:true,passNode:true})};var Ct=createContext(null),Ut=()=>useContext(Ct),om=()=>{var t;let e=Ut();return (t=e==null?void 0:e.code)!=null?t:null},Oe=()=>{var t;let e=Ut();return (t=e==null?void 0:e.mermaid)!=null?t:null};var cn=e=>{var o;let t=Ut();return t!=null&&t.renderers&&e&&(o=t.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?o:null};var Ba=/(<svg\b)/,un=/<svg\b[^>]*>/i,Oa=/\bviewBox=(['"])(.*?)\1/i,_a=/\swidth=(['"]).*?\1/i,Va=/\sheight=(['"]).*?\1/i,dn=/\sstyle=(['"])(.*?)\1/i,mn=/^<svg/i,$a=/^width\s*:/i,Fa=/^height\s*:/i,ja=/^max-width\s*:/i,za=/[\s,]+/,Wa=e=>!e.includes("xlink:")||e.includes("xmlns:xlink")?e:e.replace(Ba,'$1 xmlns:xlink="http://www.w3.org/1999/xlink"'),pn=e=>{if(typeof DOMParser=="undefined"||typeof XMLSerializer=="undefined")return e;let o=new DOMParser().parseFromString(e,"text/html").querySelector("svg");return o?new XMLSerializer().serializeToString(o):e},Jt=e=>{let t=e.match(un);if(!t)return null;let n=t[0].match(Oa),r=n==null?void 0:n[2];if(!r)return null;let s=r.trim().split(za).map(i=>Number.parseFloat(i));if(s.length<4||s.slice(0,4).some(Number.isNaN))return null;let a=s[2],c=s[3];return a>0&&c>0?{height:c,width:a}:null},fn=e=>{let t=e.match(un);if(!t)return e;try{let o=t[0],n=Jt(e);if(!n)return e;let{width:r,height:s}=n,a=o.replace(_a,"").replace(Va,""),c=a.match(dn),i=`width:${r}px;height:${s}px;max-width:none;`;if(c){let l=c[1],m=c[2].split(";").map(p=>p.trim()).filter(Boolean).filter(p=>!($a.test(p)||Fa.test(p)||ja.test(p))).join(";"),u=`${i}${m?`${m};`:""}`;a=a.replace(dn,` style=${l}${u}${l}`);}else a=a.replace(mn,`<svg style="${i}"`);return a=a.replace(mn,`<svg width="${r}" height="${s}"`),e.replace(o,a)}catch(o){return e}},gn=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((r,s)=>{let a=Wa(e),c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let l=document.createElement("canvas"),d=i.width*o,m=i.height*o;l.width=d,l.height=m;let u=l.getContext("2d");if(!u){s(new Error("Failed to create 2D canvas context for PNG export"));return}u.drawImage(i,0,0,d,m),l.toBlob(p=>{if(!p){s(new Error("Failed to create PNG blob"));return}r(p);},"image/png");},i.onerror=()=>s(new Error("Failed to load SVG image")),i.src=c;})};var wt=({chart:e,children:t,className:o,onDownload:n,config:r,onError:s})=>{let a=v(),[c,i]=useState(false),l=useRef(null),{isAnimating:d,controls:m}=useContext(E),u=O(),p=Oe(),f=_(),h=Ie(m,"mermaid","diagram"),g=async b=>{try{if(b==="mmd"){let C=`${h}.mmd`;oe(C,e,"text/plain"),i(!1),n==null||n(b);return}if(!p){s==null||s(new Error("Mermaid plugin not available"));return}let y=p.getMermaid(r),x=e.split("").reduce((C,D)=>(C<<5)-C+D.charCodeAt(0)|0,0),P=`mermaid-${Math.abs(x)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:S}=await y.render(P,e);if(!S){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}let M=pn(S);if(b==="svg"){let C=`${h}.svg`;oe(C,M,"image/svg+xml"),i(!1),n==null||n(b);return}if(b==="png"){let C=await gn(M);oe(`${h}.png`,C,"image/png"),n==null||n(b),i(!1);return}}catch(y){s==null||s(y);}};return useEffect(()=>{let b=y=>{let x=y.composedPath();l.current&&!x.includes(l.current)&&i(false);};return document.addEventListener("mousedown",b),()=>{document.removeEventListener("mousedown",b);}},[]),jsxs("div",{className:a("relative"),ref:l,children:[jsx("button",{"aria-label":f.downloadDiagram,className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:d,onClick:()=>i(!c),title:f.downloadDiagram,type:"button",children:t!=null?t:jsx(u.DownloadIcon,{"aria-hidden":"true",size:14})}),c?jsxs("div",{className:a("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",{"aria-label":f.downloadDiagramAsSvg,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("svg"),title:f.downloadDiagramAsSvg,type:"button",children:f.mermaidFormatSvg}),jsx("button",{"aria-label":f.downloadDiagramAsPng,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("png"),title:f.downloadDiagramAsPng,type:"button",children:f.mermaidFormatPng}),jsx("button",{"aria-label":f.downloadDiagramAsMmd,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("mmd"),title:f.downloadDiagramAsMmd,type:"button",children:f.mermaidFormatMmd})]}):null]})};var Cn=({chart:e,config:t,onFullscreen:o,onExit:n,className:r,...s})=>{let{Maximize2Icon:a,XIcon:c}=O(),i=v(),[l,d]=useState(false),{isAnimating:m,controls:u,portal:p}=useContext(E),f=_(),h=(()=>{if(typeof u=="boolean")return u;let y=u.mermaid;return y===false?false:y===true||y===void 0?true:y.panZoom!==false})(),g=(()=>{if(typeof u=="boolean")return u;let y=u.mermaid;return y===false?false:y===true||y===void 0?true:y.download!==false})(),b=()=>{d(!l);};return useEffect(()=>{if(l){he();let y=x=>{x.key==="Escape"&&d(false);};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y),be();}}},[l]),useEffect(()=>{l?o==null||o():n&&n();},[l,o,n]),jsxs(Fragment,{children:[jsx("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:m,onClick:b,title:f.viewFullscreen,type:"button",...s,"aria-label":f.viewFullscreen,children:jsx(a,{"aria-hidden":"true",size:14})}),l?createPortal(jsxs("div",{"aria-label":f.viewFullscreen,"aria-modal":"true",className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),"data-streamdown":"mermaid-fullscreen",onClick:b,onKeyDown:y=>{y.key==="Escape"&&b();},role:"dialog",children:[jsxs("div",{className:i("absolute top-4 right-4 z-10 flex items-center gap-1"),onClick:y=>y.stopPropagation(),onKeyDown:y=>y.stopPropagation(),role:"presentation",children:[g?jsx(wt,{chart:e,config:t}):null,jsx("button",{"aria-label":f.exitFullscreen,className:i("rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:b,title:f.exitFullscreen,type:"button",children:jsx(c,{"aria-hidden":"true",size:20})})]}),jsx("div",{className:i("flex size-full items-center justify-center p-4"),onClick:y=>y.stopPropagation(),onKeyDown:y=>y.stopPropagation(),role:"presentation",children:jsx(yn,{chart:e,className:i("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:true,showControls:h})})]}),Be(p)):null]})};function Qt(e){var o;if(e.nodeType===Node.TEXT_NODE)return (o=e.textContent)!=null?o:"";if(e.nodeType!==Node.ELEMENT_NODE)return "";let t=e;return t.tagName==="BR"?`
6
+ `:Array.from(t.childNodes).map(Qt).join("")}var _e=e=>{let t=[],o=[],n=e.querySelectorAll("thead th");for(let s of n)t.push(Qt(s).trim());let r=e.querySelectorAll("tbody tr");for(let s of r){let a=[],c=s.querySelectorAll("td");for(let i of c)a.push(Qt(i).trim());o.push(a);}return {headers:t,rows:o}},Ye=e=>{var o;if(typeof e!="object")return ",";let t=e.table;return typeof t!="object"?",":(o=t.csvSeparator)!=null?o:","},Le=(e,t=",")=>{let o;t==="auto"?Intl.NumberFormat().format(1.1).includes(",")?o=";":o=",":o=t;let{headers:n,rows:r}=e,s=l=>{let d=false;for(let m of l)if(m===o||m==='"'||m===`
7
+ `||m==="\r"){d=true;break}return d?`"${l.replace(/"/g,'""')}"`:l},a=n.length>0?r.length+1:r.length,c=new Array(a),i=0;n.length>0&&(c[i]=n.map(s).join(o),i+=1);for(let l of r)c[i]=l.map(s).join(o),i+=1;return c.join(`
8
+ `)},eo=e=>{let{headers:t,rows:o}=e,n=c=>{let i=false;for(let d of c)if(d===" "||d===`
9
+ `||d==="\r"){i=true;break}if(!i)return c;let l=[];for(let d of c)d===" "?l.push("\\t"):d===`
10
+ `?l.push("\\n"):d==="\r"?l.push("\\r"):l.push(d);return l.join("")},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(" "),a+=1);for(let c of o)s[a]=c.map(n).join(" "),a+=1;return s.join(`
11
+ `)},xt=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"||n===`
12
+ `){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):n===`
13
+ `?o.push("<br>"):o.push(n);return o.join("")},Ve=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),r=0,s=t.map(c=>xt(c));n[r]=`| ${s.join(" | ")} |`,r+=1;let a=new Array(t.length);for(let c=0;c<t.length;c+=1)a[c]="---";n[r]=`| ${a.join(" | ")} |`,r+=1;for(let c of o)if(c.length<t.length){let i=new Array(t.length);for(let l=0;l<t.length;l+=1)i[l]=l<c.length?xt(c[l]):"";n[r]=`| ${i.join(" | ")} |`,r+=1;}else {let i=c.map(l=>xt(l));n[r]=`| ${i.join(" | ")} |`,r+=1;}return n.join(`
14
+ `)};var et=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=v(),[a,c]=useState(false),[i,l]=useState(false),d=useRef(null),m=useRef(0),{isAnimating:u,controls:p}=useContext(E),f=_(),h=Ye(p),g=async x=>{var P,S;if(typeof window=="undefined"||!((P=navigator==null?void 0:navigator.clipboard)!=null&&P.write)){n==null||n(new Error("Clipboard API not available"));return}try{let M=(S=d.current)==null?void 0:S.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),C=M==null?void 0:M.querySelector("table");if(!C){n==null||n(new Error("Table not found"));return}let D=_e(C),B="";x==="csv"?B=Le(D,h):x==="tsv"?B=eo(D):B=Ve(D);let j=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([C.outerHTML],{type:"text/html"})});await navigator.clipboard.write([j]),l(!0),c(!1),o==null||o(x),m.current=window.setTimeout(()=>l(!1),r);}catch(M){n==null||n(M);}};useEffect(()=>{let x=P=>{let S=P.composedPath();d.current&&!S.includes(d.current)&&c(false);};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x),window.clearTimeout(m.current);}},[]);let b=O(),y=i?b.CheckIcon:b.CopyIcon;return jsxs("div",{className:s("relative"),ref:d,children:[jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>c(!a),title:f.copyTable,type:"button",children:e!=null?e:jsx(y,{height:14,width:14})}),a?jsxs("div",{className:s("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("md"),title:f.copyTableAsMarkdown,type:"button",children:f.tableFormatMarkdown}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:f.copyTableAsCsv,type:"button",children:f.tableFormatCsv}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("tsv"),title:f.copyTableAsTsv,type:"button",children:f.tableFormatTsv})]}):null]})};var ri=({children:e,className:t,onDownload:o,onError:n,format:r="csv",filename:s})=>{let a=v(),{isAnimating:c,controls:i}=useContext(E),l=_(),d=O(),m=Ye(i),u=p=>{try{let h=p.currentTarget.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),g=h==null?void 0:h.querySelector("table");if(!g){n==null||n(new Error("Table not found"));return}let b=_e(g),y="",x="",P="";switch(r){case "csv":y=Le(b,m),x="text/csv",P="csv";break;case "markdown":y=Ve(b),x="text/markdown",P="md";break;default:y=Le(b,m),x="text/csv",P="csv";}oe(`${s||Ie(i,"table","table")}.${P}`,y,x),o==null||o();}catch(f){n==null||n(f);}};return jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:u,title:r==="csv"?l.downloadTableAsCsv:l.downloadTableAsMarkdown,type:"button",children:e!=null?e:jsx(d.DownloadIcon,{size:14})})},tt=({children:e,className:t,onDownload:o,onError:n})=>{let r=v(),[s,a]=useState(false),c=useRef(null),{isAnimating:i,controls:l}=useContext(E),d=_(),m=O(),u=Ye(l),p=f=>{var h;try{let g=(h=c.current)==null?void 0:h.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),b=g==null?void 0:g.querySelector("table");if(!b){n==null||n(new Error("Table not found"));return}let y=_e(b),x=f==="csv"?Le(y,u):Ve(y),P=f==="csv"?"csv":"md",S=`${Ie(l,"table","table")}.${P}`;oe(S,x,f==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(f);}catch(g){n==null||n(g);}};return useEffect(()=>{let f=h=>{let g=h.composedPath();c.current&&!g.includes(c.current)&&a(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[]),jsxs("div",{className:r("relative"),ref:c,children:[jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:d.downloadTable,type:"button",children:e!=null?e:jsx(m.DownloadIcon,{size:14})}),s?jsxs("div",{className:r("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>p("csv"),title:d.downloadTableAsCsv,type:"button",children:d.tableFormatCsv}),jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>p("markdown"),title:d.downloadTableAsMarkdown,type:"button",children:d.tableFormatMarkdown})]}):null]})};var Pn=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=O(),a=v(),[c,i]=useState(false),{isAnimating:l,portal:d}=useContext(E),m=_(),u=()=>{i(true);},p=()=>{i(false);};return useEffect(()=>{if(c){he();let f=h=>{h.key==="Escape"&&i(false);};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f),be();}}},[c]),jsxs(Fragment,{children:[jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:l,onClick:u,title:m.viewFullscreen,type:"button",children:jsx(r,{size:14})}),c?createPortal(jsx("div",{"aria-label":m.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:p,onKeyDown:f=>{f.key==="Escape"&&p();},role:"dialog",children:jsxs("div",{className:a("flex h-full flex-col"),onClick:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),role:"presentation",children:[jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?jsx(et,{}):null,n?jsx(tt,{}):null,jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:p,title:m.exitFullscreen,type:"button",children:jsx(s,{size:20})})]}),jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:jsx("table",{className:a("w-full table-fixed border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),Be(d)):null]})};var Mn=({children:e,className:t,maxHeight:o,showControls:n,showCopy:r=true,showDownload:s=true,showFullscreen:a=true,...c})=>{let i=v(),{isAnimating:l,scrollable:d}=useContext(E),m=d!=null?d:qe,u=dt(o),p=ut({content:e,enabled:!!u,isAnimating:l}),f=n&&r,h=n&&s,g=n&&a,b=f||h||g;return jsxs("div",{className:i("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[b?jsxs("div",{className:i("flex items-center justify-end gap-1"),children:[f?jsx(et,{}):null,h?jsx(tt,{}):null,g?jsx(Pn,{showCopy:f,showDownload:h,children:e}):null]}):null,jsx(m,{className:i("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),scrollRef:p,style:u?{maxHeight:u}:void 0,children:jsx("table",{className:i("w-full min-w-max table-fixed divide-y divide-border",t),"data-streamdown":"table",...c,children:e})})]})};var gi=/startLine=(\d+)/,hi=/\bnoLineNumbers\b/,bi=lazy(()=>import('./mermaid-GL7FDD4I.js').then(e=>({default:e.Mermaid}))),yi=/language-([^\s]+)/,ie=e=>e.props,Ci="node";function A(e,t){let o=Object.keys(e);if(o.length!==Object.keys(t).length)return false;let n=e,r=t;for(let s of o)if(s!==Ci&&!Object.is(n[s],r[s]))return false;return true}function wi(e,t){var o,n;return ((o=e==null?void 0:e.properties)==null?void 0:o.metastring)===((n=t==null?void 0:t.properties)==null?void 0:n.metastring)}function xi(e){if(typeof e=="string")return e;if(isValidElement(e)){let t=ie(e).children;if(typeof t=="string")return t}}var ro=(e,t)=>typeof e=="boolean"?e:e[t]!==false,no=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},En=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},vt=(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},nt=createContext({depth:0,ulDepth:0,isUnordered:false}),vi={flat:["list-disc"],hierarchical:["list-disc","list-[circle]","list-[square]"]},so=memo(({children:e,className:t,node:o,...n})=>{let r=v(),{depth:s,ulDepth:a}=useContext(nt),c=useMemo(()=>({depth:s+1,ulDepth:a,isUnordered:false}),[s,a]);return jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-depth":s,"data-streamdown":"ordered-list",...n,children:jsx(nt.Provider,{value:c,children:e})})},(e,t)=>A(e,t));so.displayName="MarkdownOl";var An=memo(({children:e,className:t,node:o,...n})=>{var h;let r=v(),{depth:s,ulDepth:a,isUnordered:c}=useContext(nt),{listStyle:i}=useContext(E),l=vi[i],d=c&&a>0?l[(a-1)%l.length]:void 0,m=Array.isArray(e)?e.filter(g=>g!==`
15
+ `&&g!==""):[e],u=m[0],p=isValidElement(u)?(h=ie(u).node)==null?void 0:h.tagName:void 0,f=m.length===1&&isValidElement(u)&&(u.type==="p"||p==="p")?ie(u).children:e;return t!=null&&t.includes("task-list-item")?jsx("li",{className:r("my-1 flex list-none items-center gap-2 [&>input]:m-0 [&>p]:inline",t),"data-depth":s>0?s-1:0,"data-streamdown":"list-item",...n,children:f}):jsx("li",{className:r("py-1 [&>p]:inline",d,t),"data-depth":s>0?s-1:0,"data-streamdown":"list-item",...n,children:f})},(e,t)=>A(e,t));An.displayName="MarkdownLi";var Dn=memo(({children:e,className:t,node:o,...n})=>{let r=v(),{depth:s,ulDepth:a}=useContext(nt),c=useMemo(()=>({depth:s+1,ulDepth:a+1,isUnordered:true}),[s,a]);return jsx("ul",{className:r("list-inside whitespace-normal [li_&]:pl-6",t),"data-depth":s,"data-streamdown":"unordered-list",...n,children:jsx(nt.Provider,{value:c,children:e})})},(e,t)=>A(e,t));Dn.displayName="MarkdownUl";var Hn=memo(({className:e,node:t,...o})=>{let n=v();return jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>A(e,t));Hn.displayName="MarkdownHr";var Bn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>A(e,t));Bn.displayName="MarkdownStrong";var ki=({children:e,className:t,href:o,node:n,...r})=>{let s=v(),{linkSafety:a}=useContext(E),[c,i]=useState(false),l=o==="streamdown:incomplete-link",d=useCallback(async f=>{if(!(!(a!=null&&a.enabled&&o)||l)){if(f.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,l]),m=useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),u=useCallback(()=>{i(false);},[]),p={url:o!=null?o:"",isOpen:c,onClose:u,onConfirm:m};return a!=null&&a.enabled&&o?jsxs(Fragment,{children:[jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(p):jsx(tn,{...p})]}):jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},On=memo(ki,(e,t)=>A(e,t));On.displayName="MarkdownA";var _n=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>A(e,t));_n.displayName="MarkdownH1";var Vn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>A(e,t));Vn.displayName="MarkdownH2";var $n=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>A(e,t));$n.displayName="MarkdownH3";var Fn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>A(e,t));Fn.displayName="MarkdownH4";var jn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>A(e,t));jn.displayName="MarkdownH5";var zn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>A(e,t));zn.displayName="MarkdownH6";var Wn=memo(({children:e,className:t,node:o,...n})=>{let{controls:r,tableMaxHeight:s}=useContext(E),a=ro(r,"table"),c=no(r,"copy"),i=no(r,"download"),l=no(r,"fullscreen");return jsx(Mn,{className:t,maxHeight:s,showControls:a,showCopy:c,showDownload:i,showFullscreen:l,...n,children:e})},(e,t)=>A(e,t));Wn.displayName="MarkdownTable";var qn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>A(e,t));qn.displayName="MarkdownThead";var Zn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>A(e,t));Zn.displayName="MarkdownTbody";var Kn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>A(e,t));Kn.displayName="MarkdownTr";var Gn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>A(e,t));Gn.displayName="MarkdownTh";var Xn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>A(e,t));Xn.displayName="MarkdownTd";var Un=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>A(e,t));Un.displayName="MarkdownBlockquote";var Jn=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>A(e,t));Jn.displayName="MarkdownSup";var Ti=()=>({}),Pi=e=>{try{let t=atob(e),o=Uint8Array.from(t,n=>n.charCodeAt(0));return new TextDecoder().decode(o)}catch(t){return ""}},Yn=memo(({children:e,className:t,node:o,...n})=>{let r=v(),{calloutIcon:s,calloutStyle:a,components:c,remarkPlugins:i,rehypePlugins:l}=useContext(E),d=n,m=d["data-callout-title"],u=d["data-callout-color"],p=d["data-callout-icon"],f=d["data-callout-body"],h=f?Pi(f):"",g=(a!=null?a:Ti)(u),b=p&&s?s(p):null;return jsxs("div",{className:r("my-4 rounded-md border-l-4 px-4 py-3 [&>p:last-child]:mb-0",t),"data-streamdown":"callout",style:g,...n,children:[m!==void 0?jsxs("p",{className:"mb-1 flex items-center gap-2 font-semibold [&>svg]:inline-block",children:[b,m]}):null,h.trim().length>0?jsx(Ue,{components:c,rehypePlugins:l,remarkPlugins:i,children:h}):null]})},(e,t)=>A(e,t));Yn.displayName="MarkdownCallout";var Rn={"markdown-alert-note":"border-l-blue-500 bg-blue-500/5 [&_.markdown-alert-title]:text-blue-600 dark:[&_.markdown-alert-title]:text-blue-400","markdown-alert-tip":"border-l-green-600 bg-green-600/5 [&_.markdown-alert-title]:text-green-700 dark:[&_.markdown-alert-title]:text-green-400","markdown-alert-important":"border-l-purple-600 bg-purple-600/5 [&_.markdown-alert-title]:text-purple-700 dark:[&_.markdown-alert-title]:text-purple-400","markdown-alert-warning":"border-l-amber-600 bg-amber-600/5 [&_.markdown-alert-title]:text-amber-700 dark:[&_.markdown-alert-title]:text-amber-400","markdown-alert-caution":"border-l-red-600 bg-red-600/5 [&_.markdown-alert-title]:text-red-700 dark:[&_.markdown-alert-title]:text-red-400"},Qn=memo(({children:e,className:t,node:o,...n})=>{let r=v(),s=t==null?void 0:t.includes("markdown-alert");if(t==null?void 0:t.includes("sdm-callout"))return jsx(Yn,{className:t,node:o,...n,children:e});if(s){let c=Object.keys(Rn).find(i=>t==null?void 0:t.includes(i));return jsx("div",{className:r("my-4 rounded-r-md border-muted-foreground/30 border-l-4 bg-muted/40 px-4 py-3 [&>p:last-child]:mb-0",c?Rn[c]:null,t),...n,children:e})}return jsx("div",{className:r(t),...n,children:e})},(e,t)=>A(e,t));Qn.displayName="MarkdownDiv";var er=memo(({children:e,className:t,node:o,...n})=>{let r=v();return jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>A(e,t));er.displayName="MarkdownSub";var tr=memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{if(!isValidElement(i))return false;let l=ie(i).children,d=Array.isArray(l)?l:[l],m=false,u=false;for(let p of d)if(p){if(typeof p=="string")p.trim()!==""&&(m=true);else if(isValidElement(p))if(ie(p)["data-footnote-backref"]!==void 0)u=true;else {let f=ie(p).children,h=Array.isArray(f)?f:[f];for(let g of h){if(typeof g=="string"&&g.trim()!==""){m=true;break}if(isValidElement(g)&&ie(g)["data-footnote-backref"]===void 0){m=true;break}}}}return u&&!m},a=Array.isArray(e)?e.map(i=>{if(!isValidElement(i))return i;if(i.type===so){let l=ie(i).children,m=(Array.isArray(l)?l:[l]).filter(u=>!s(u));return m.length===0?null:{...i,props:{...ie(i),children:m}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?jsx("section",{className:t,...n,children:a}):null}return jsx("section",{className:t,...n,children:e})},(e,t)=>A(e,t));tr.displayName="MarkdownSection";var Si=({node:e,className:t,children:o,...n})=>{var Y,F,H;let r=v(),s=!("data-block"in n),{mermaid:a,controls:c,lineNumbers:i}=useContext(E),l=Oe(),d=Bt(),m=t==null?void 0:t.match(yi),u=(Y=m==null?void 0:m.at(1))!=null?Y:"",p=cn(u);if(s)return jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let f=(F=e==null?void 0:e.properties)==null?void 0:F.metastring,h=typeof f=="string"?f:void 0,g=h==null?void 0:h.match(gi),b=g?Number.parseInt(g[1],10):void 0,y=b!==void 0&&b>=1?b:void 0,P=!(h?hi.test(h):false)&&i!==false,S=(H=xi(o))!=null?H:"";if(p){let V=p.component;return jsx(Suspense,{fallback:jsx(bt,{}),children:jsx(V,{code:S,isIncomplete:d,language:u,meta:h})})}if(u==="mermaid"&&l){let V=ro(c,"mermaid"),U=vt(c,"download"),Q=vt(c,"copy"),R=vt(c,"fullscreen"),z=vt(c,"panZoom"),re=V&&(U||Q||R);return jsx(Suspense,{fallback:jsx(bt,{}),children:jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-incomplete":d||void 0,"data-streamdown":"mermaid-block",children:[jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),re?jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:jsxs("div",{className:r("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:[U?jsx(wt,{chart:S,config:a==null?void 0:a.config}):null,Q?jsx(ht,{code:S}):null,R?jsx(Cn,{chart:S,config:a==null?void 0:a.config}):null]})}):null,jsx("div",{className:r("rounded-md border border-border bg-background"),children:jsx(bi,{chart:S,config:a==null?void 0:a.config,showControls:z})})]})})}let M=ro(c,"code"),C=En(c,"download"),D=En(c,"copy"),{"data-block":B,...j}=n;return jsx(Ft,{className:t,code:S,isIncomplete:d,language:u,lineNumbers:P,startLine:y,...j,children:M?jsxs(Fragment,{children:[C?jsx(Wt,{code:S,language:u}):null,D?jsx(ht,{}):null]}):null})},or=memo(Si,(e,t)=>A(e,t)&&wi(e.node,t.node));or.displayName="MarkdownCode";var nr=memo(Yo,(e,t)=>A(e,t));nr.displayName="MarkdownImg";var Ln={caution:"alertCaution",important:"alertImportant",note:"alertNote",tip:"alertTip",warning:"alertWarning"},rr=memo(({children:e,className:t,node:o,...n})=>{let r=v(),s=_(),a=n["data-alert-type"],c=a&&a in Ln?Ln[a]:void 0,i=c?s[c]:void 0,l=e;return i&&(l=[...(Array.isArray(e)?e:[e]).filter(u=>!(typeof u=="string"&&u.trim().length>0)),i]),jsx("p",{className:r("mb-1 flex items-center gap-2 font-semibold [&>svg]:inline-block",t),...n,children:l})},(e,t)=>A(e,t));rr.displayName="MarkdownAlertTitle";var sr=memo(({children:e,className:t,node:o,...n})=>{if(t!=null&&t.includes("markdown-alert-title"))return jsx(rr,{className:t,node:o,...n,children:e});let s=(Array.isArray(e)?e:[e]).filter(a=>a!=null&&a!=="");if(s.length===1&&isValidElement(s[0])){let a=ie(s[0]).node,c=a==null?void 0:a.tagName;if(c==="img")return jsx(Fragment,{children:e});if(c==="code"&&"data-block"in s[0].props)return jsx(Fragment,{children:e})}return jsx("p",{className:t,...n,children:e})},(e,t)=>A(e,t));sr.displayName="MarkdownParagraph";var ar={ol:so,li:An,ul:Dn,hr:Hn,strong:Bn,a:On,h1:_n,h2:Vn,h3:$n,h4:Fn,h5:jn,h6:zn,table:Wn,thead:qn,tbody:Zn,tr:Kn,th:Gn,td:Xn,blockquote:Un,code:or,div:Qn,img:nr,pre:({children:e})=>isValidElement(e)?cloneElement(e,{"data-block":"true"}):e,sup:Jn,sub:er,p:sr,section:tr};var Mi=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Ii=/\p{L}/u;function rt(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,"").replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,""),o,n=0,r=0;for(let s of t){if(Mi.test(s)){o!=null||(o="rtl"),r+=1;continue}Ii.test(s)&&(o!=null||(o="ltr"),n+=1);}return r>n?"rtl":n>r?"ltr":o!=null?o:"ltr"}var Ei=/^[ \t]{0,3}(`{3,}|~{3,})/;var ir=e=>{let t=e.split(`
16
+ `),o=null,n=0;for(let r of t){let s=Ei.exec(r);if(o===null){if(s){let a=s[1];o=a[0],n=a.length;}}else if(s){let a=s[1],c=a[0],i=a.length;c===o&&i>=n&&(o=null,n=0);}}return o!==null};var Li=/\[\^[\w-]{1,200}\](?!:)/,Ni=/\[\^[\w-]{1,200}\]:/,Ai=/<([A-Za-z][\w:-]*)[\s>/]/,Di=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),lr=new Map,cr=new Map,ur=e=>{let t=e.toLowerCase(),o=lr.get(t);if(o)return o;let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return lr.set(t,n),n},Hi=e=>{let t=e.toLowerCase(),o=cr.get(t);if(o)return o;let n=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return cr.set(t,n),n},dr=(e,t)=>{if(Di.has(t.toLowerCase()))return 0;let o=e.match(ur(t));if(!o)return 0;let n=0;for(let r of o)r.trimEnd().endsWith("/>")||(n+=1);return n},mr=(e,t)=>{let o=e.match(Hi(t));return o?o.length:0},Bi=(e,t)=>{let o=e.match(ur(t));return !!o&&o.every(n=>n.trimEnd().endsWith("/>"))},Oi=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},Tt=e=>{let t=Li.test(e),o=Ni.test(e);if(t||o)return [e];let n=Lexer.lex(e,{gfm:true}),r=[],s=[],a=false;for(let c of n){let i=c.raw,l=r.length;if(s.length>0){r[l-1]+=i;let d=s.at(-1),m=dr(i,d),u=mr(i,d);for(let p=0;p<m;p+=1)s.push(d);for(let p=0;p<u;p+=1)s.length>0&&s.at(-1)===d&&s.pop();continue}if(c.type==="html"&&c.block){let d=i.match(Ai);if(d){let m=d[1],u=dr(i,m),p=mr(i,m);u>p&&!Bi(i,m)&&s.push(m);}}if(l>0&&!a){let d=r[l-1];if(Oi(d)%2===1){r[l-1]=d+i;continue}}r.push(i),c.type!=="space"&&(a=c.type==="code");}return r},ao=(e,t,o=Tt)=>{if(!(t!=null&&t.source&&e.startsWith(t.source)))return {source:e,blocks:o(e)};if(e===t.source)return t;if(t.blocks.length<=1)return {source:e,blocks:o(e)};let n=t.blocks.slice(0,-1),r=0;for(let i of n)r+=i.length;let s=e.slice(0,r);if(n.join("")!==s)return {source:e,blocks:o(e)};let a=e.slice(r),c=o(a);return {source:e,blocks:[...n,...c]}};var _i=/^\n*/,Vi=/\n*$/,io=/\n\n/g,$i=(e,t,o)=>{if(!t.includes(`
17
+ `))return e+t+o;let r=t.replace(io,`
18
+ <!---->
19
+ `).replace(_i,`
20
+
21
+ `).replace(Vi,`
22
+
23
+ `);return `${e}${r}${o}
24
+
25
+ `},Fi=(e,t)=>{let o=new RegExp(`<(${t})(?=[\\s>/])([^>]*)>`,"gi"),n="",r=0,s=o.exec(e);for(;s;){let a=s[0],c=s[1],i=s.index+a.length,l=e.slice(i);if(new RegExp(`</${c}\\s*>`,"i").test(l)){s=o.exec(e);continue}if(n+=e.slice(r,s.index),l.length===0){n+=a,r=i,s=o.exec(e);continue}if(l.startsWith(`
26
+
27
+ `)){let p=l.slice(2).replace(io,`
28
+ <!---->
29
+ `);n+=`${a}
30
+
31
+ ${p}`,r=e.length;break}if(!l.startsWith(`
32
+ `)){n+=a,r=i,s=o.exec(e);continue}let m=l.slice(1);if(m.trim().length===0){n+=a,r=i,s=o.exec(e);continue}let u=m.replace(io,`
33
+ <!---->
34
+ `);n+=`${a}
35
+
36
+ ${u}`,r=e.length;break}return r===0?e:n+e.slice(r)},pr=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`<${n}(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^"'>])*)\\/>`,"gi");o=o.replace(r,(s,a)=>`<${n}${a}></${n}>`);}for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,c,i)=>$i(a,c,i)),o=Fi(o,n);}return o};var ji=/([\\`*_~[\]|])/g,zi=e=>e.replace(ji,"\\$1"),fr=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,c,i)=>{let l=zi(c).replace(/\n\n/g,"&#10;&#10;");return a+l+i});}return o};var qi=new Set(["blockquote","dd","dt","figcaption","h1","h2","h3","h4","h5","h6","li","p","td","th"]),gr=new Set(["code","kbd","pre","samp","var"]);function hr(e){return e.children.map(t=>t.type==="text"?t.value:t.type==="element"&&!gr.has(t.tagName)?hr(t):"").join("")}function br(){return e=>{visit(e,"element",t=>{if(gr.has(t.tagName)){(t.properties)!=null||(t.properties={}),t.properties.dir="ltr";return}qi.has(t.tagName)&&((t.properties)!=null||(t.properties={}),typeof t.properties.dir!="string"&&(t.properties.dir=rt(hr(t))));});}}var yr=e=>t=>{if(!e||e.length===0)return;let o=new Set(e.map(n=>n.toLowerCase()));visit(t,"element",n=>{var s;if(!o.has(n.tagName.toLowerCase()))return;let r=n.children.filter(a=>a.type==="element").map(a=>{var c;return {tag:a.tagName,props:(c=a.properties)!=null?c:{},text:toText(a).trim()}});n.properties=(s=n.properties)!=null?s:{},n.properties["data-content"]=JSON.stringify(r),n.children=[];});};var Cr=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Cr).join(""):"",wr=e=>t=>{if(!e||e.length===0)return;let o=new Set(e.map(n=>n.toLowerCase()));visit(t,"element",n=>{if(o.has(n.tagName.toLowerCase())){let r=Cr(n);n.children=r?[{type:"text",value:r}]:[];}});};var Qi=e=>e.children.every(t=>t.type==="text"||t.type==="comment"),el=e=>e.children.map(t=>t.type==="text"?t.value:"").join(""),tl=e=>{let t=unified().use(ka).use(Ta,{allowDangerousHtml:true}),o=t.parse(e);return t.runSync(o).children},xr=(e,t=[])=>o=>{if(!e||e.length===0)return;let n=new Set(e.map(s=>s.toLowerCase())),r=new Set((t!=null?t:[]).map(s=>s.toLowerCase()));visit(o,"element",s=>{let a=s.tagName.toLowerCase();if(!n.has(a)||r.has(a)||!Qi(s))return;let c=el(s);if(!c.includes(`
37
+ `))return;let i=tl(c);s.children=i;});};var vr=()=>e=>{visit(e,"code",t=>{var o,n;t.meta&&(t.data=(o=t.data)!=null?o:{},t.data.hProperties={...(n=t.data.hProperties)!=null?n:{},metastring:t.meta});});};var kr=/^>>>[ \t]?(.*)$/,nl=/^<<<\s*$/,rl=/^>+\s*$/,sl=/^<+\s*$/,al=/^\s*(?:\((?<iconParen>[a-z0-9-]+)\)|\{(?<iconBrace>[a-z0-9-]+)\}(?=\s*\[))?\s*(?:\[(?<title>[^\]]*)\])?\s*(?:\{(?<color>[^}]*)\})?\s*$/i,il=/^(?:#[0-9a-f]{3,8}|[a-z]+)$/i,ll=/^[a-z0-9-]+$/,cl=e=>{let t=al.exec(e);if(!(t!=null&&t.groups))return {};let{iconParen:o,iconBrace:n,title:r,color:s}=t.groups,a=o!=null?o:n;return {icon:a&&ll.test(a)?a:void 0,title:r!==void 0&&r.length>0?r:void 0,color:s&&il.test(s)?s:void 0}},lo=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),dl=e=>{let t=new TextEncoder().encode(e),o="";for(let n of t)o+=String.fromCharCode(n);return btoa(o)},ml=(e,t)=>{var l;let o=kr.exec(e[t]),n=(l=o==null?void 0:o[1])!=null?l:"",r=cl(n),s=[],a=t+1;for(;a<e.length;a+=1){let d=e[a];if(nl.test(d)){a+=1;break}if(rl.test(d)||sl.test(d)){a+=1;break}s.push(d);}let c=s.join(`
38
+ `).trim();return {replacement:`<div ${['class="sdm-callout"',r.title!==void 0?`data-callout-title="${lo(r.title)}"`:"",r.color!==void 0?`data-callout-color="${lo(r.color)}"`:"",r.icon!==void 0?`data-callout-icon="${lo(r.icon)}"`:"",`data-callout-body="${dl(c)}"`].filter(Boolean).join(" ")}></div>`,next:a}},Tr=e=>{if(!e.includes(">>>"))return e;let t=e.split(`
39
+ `),o=[],n=0,r=false;for(;n<t.length;)if(kr.test(t[n])){let s=ml(t,n);o.push(s.replacement),n=s.next,r=true;}else o.push(t[n]),n+=1;return r?o.join(`
40
+ `):e},Pr=()=>()=>{};var fl={NOTE:{icon:"info",kind:"note",title:"Note",iconPaths:[{d:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"}]},TIP:{icon:"light-bulb",kind:"tip",title:"Tip",iconPaths:[{d:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"}]},IMPORTANT:{icon:"report",kind:"important",title:"Important",iconPaths:[{d:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}]},WARNING:{icon:"alert",kind:"warning",title:"Warning",iconPaths:[{d:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",fillRule:"evenodd"}]},CAUTION:{icon:"stop",kind:"caution",title:"Caution",iconPaths:[{d:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25a.749.749 0 0 1-.53.22H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"}]}},gl=/^\[!(note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i,Sr=e=>{if(e.type==="text")return e.value;let t=e.children;if(!t)return "";let o="";for(let n of t)o+=Sr(n);return o},hl=e=>{let t=e.iconPaths.map(o=>`<path d="${o.d}"${o.fillRule?` fill-rule="${o.fillRule}"`:""}></path>`).join("");return {type:"paragraph",children:[{type:"html",value:`<svg class="octicon octicon-${e.icon}" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true">${t}</svg>`},{type:"text",value:e.title}],data:{hName:"p",hProperties:{className:["markdown-alert-title"],"data-alert-type":e.kind}}}},bl=e=>{var m,u;let t=e.children[0];if(!t||t.type!=="paragraph")return;let o=t.children[0];if(!o||o.type!=="text")return;let n=Sr(o).trimStart(),r=n.match(gl);if(!r)return;let s=fl[r[1].toUpperCase()],a=n.slice(r[0].length),c=t.children.slice(1);if(a.trim().length===0&&c.length===0&&e.children.length===1)return;let i=[hl(s)],l=[];a.length>0&&l.push({type:"text",value:a});let d=c;return ((m=d[0])==null?void 0:m.type)==="break"&&(d=d.slice(1)),l.push(...d),l.length>0&&l.some(p=>p.type!=="text"||p.value.trim().length>0)&&i.push({type:"paragraph",children:l}),i.push(...e.children.slice(1)),e.data=(u=e.data)!=null?u:{},e.data.hName="div",e.data.hProperties={className:["markdown-alert",`markdown-alert-${s.kind}`]},e.children=i,SKIP},Mr=()=>e=>{visit(e,"blockquote",bl);};var Pl=/^[ \t]*<[\w!/?-]/,Sl=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Ml=e=>typeof e!="string"||e.length===0||!Pl.test(e)?e:e.replace(Sl,"$1"),Lr,Nr,Ar,Dr,Hr,Br,Or,_r,Vr,$r,Fr,Pt={...defaultSchema,clobberPrefix:"",protocols:{...defaultSchema.protocols,href:[...(Nr=(Lr=defaultSchema.protocols)==null?void 0:Lr.href)!=null?Nr:[],"tel","streamdown"]},attributes:{...defaultSchema.attributes,code:["metastring",["className",/^(language-.+|math-display|math-inline)$/]],div:[...(Dr=(Ar=defaultSchema.attributes)==null?void 0:Ar.div)!=null?Dr:[],["className",/^(markdown-alert|markdown-alert-(note|tip|important|warning|caution)|sdm-callout)$/],"dataCalloutTitle","dataCalloutColor","dataCalloutIcon","dataCalloutBody"],p:[...(Br=(Hr=defaultSchema.attributes)==null?void 0:Hr.p)!=null?Br:[],["className",/^markdown-alert-title$/],"dataAlertType"],svg:[...(_r=(Or=defaultSchema.attributes)==null?void 0:Or.svg)!=null?_r:[],"className","viewBox","width","height","fill","ariaHidden"],path:[...($r=(Vr=defaultSchema.attributes)==null?void 0:Vr.path)!=null?$r:[],"d","fillRule"]},tagNames:[...(Fr=defaultSchema.tagNames)!=null?Fr:[],"svg","path"]},co={raw:nn,sanitize:[Wr,Pt],harden:[harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},Il={gfm:[kl,{}],githubAlerts:Mr,containerAlerts:Pr,codeMeta:vr},Er=Object.values(co),El=Object.values(Il),Rr=new WeakMap;function Rl(e){var r;let t=Rr.get(e);if(t)return t;let o={...Pt,tagNames:[...(r=Pt.tagNames)!=null?r:[],...Object.keys(e)],attributes:{...Pt.attributes,...e}},n=[co.raw,[Wr,o],co.harden];return Rr.set(e,n),n}var Ll={block:" \u258B",circle:" \u25CF"},Nl=["github-light","github-dark"],Al={enabled:true},qr=memo(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:o,index:n,isIncomplete:r,dir:s,animatePlugin:a,...c})=>{useLayoutEffect(()=>{a==null||a.commit();}),a==null||a.setAnimateCodeBlocks(r);let i=typeof e=="string"&&o?Ml(e):e,l=jsx(Ue,{...c,children:i});return jsx(Ht.Provider,{value:r,children:s?jsx("div",{dir:s,style:{display:"contents"},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return false;if(e.components!==t.components){let o=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(o.length!==n.length||o.some(r=>{var s,a;return ((s=e.components)==null?void 0:s[r])!==((a=t.components)==null?void 0:a[r])}))return false}return !(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins||!!e.animatePlugin!=!!t.animatePlugin)});qr.displayName="Block";var Dl=memo(({children:e,mode:t="streaming",dir:o,parseIncompleteMarkdown:n=true,normalizeHtmlIndentation:r=false,components:s,rehypePlugins:a=Er,remarkPlugins:c=El,className:i,shikiTheme:l,mermaid:d,codeBlockMaxHeight:m=400,controls:u=true,isAnimating:p=false,scrollable:f,tableMaxHeight:h=300,animated:g,BlockComponent:b=qr,parseMarkdownIntoBlocksFn:y=Tt,caret:x,listStyle:P="hierarchical",calloutIcon:S,calloutStyle:M,plugins:C,remend:D,linkSafety:B=Al,portal:j,lineNumbers:Y=true,allowedTags:F,literalTagContent:H,dataOnlyTags:V,translations:U,icons:Q,prefix:R,onAnimationStart:z,onAnimationEnd:re,...ze})=>{let le=useId(),ee=useMemo(()=>Io(R),[R]),Ae=useRef(null),X=useRef(z),W=useRef(re);X.current=z,W.current=re,useEffect(()=>{var I,K,q;if(t==="static")return;let w=Ae.current;if(Ae.current=p,w===null){p&&((I=X.current)==null||I.call(X));return}p&&!w?(K=X.current)==null||K.call(X):!p&&w&&((q=W.current)==null||q.call(W));},[p,t]);let T=useMemo(()=>F?Object.keys(F):[],[F]),$=useMemo(()=>{if(!(V!=null&&V.length))return T;let w=new Set(V.map(I=>I.toLowerCase()));return T.filter(I=>!w.has(I.toLowerCase()))},[T,V]),ge=useRef(null),ce=useMemo(()=>{if(typeof e!="string")return "";let w=e;return H&&H.length>0&&(w=fr(w,H)),$.length>0&&(w=pr(w,$)),w=Tr(w),w},[e,$,H]),se=useMemo(()=>{let w=t==="streaming"?ge.current:null,I=ao(ce,w,y);if(ge.current=t==="streaming"?I:null,!(t==="streaming"&&n)||I.blocks.length===0)return I.blocks;let K=I.blocks.length-1,q=I.blocks[K],de=Tl(q,D);if(de===q)return I.blocks;let Pe=I.blocks.slice();return Pe[K]=de,Pe},[ce,y,t,n,D]),De=useMemo(()=>g===true?"true":g?JSON.stringify(g):"",[g]),te=useRef(null),We=useRef([]),xe=useRef([]),uo=useRef(null),Mt=useRef("");if(De){if(Mt.current!==De){Mt.current=De;let w=De!=="true"?g.maxBacklogMs:void 0;te.current=Nt({maxBacklogMs:w}),We.current=[],xe.current=[];}else te.current||(te.current=Nt());p&&te.current&&te.current.beginPass(te.current.now());}else te.current=null,We.current=[],xe.current=[],Mt.current="";useLayoutEffect(()=>{var w;p&&((w=te.current)==null||w.commitPass());});let ve=useDeferredValue(se),ke=useMemo(()=>{if(t!=="streaming"||te.current||ve===se||ve.length===0)return se;let w=ve.length,I=se.length;if(I===0)return ve;if(w!==I)return se;for(let q=0;q<w-1;q+=1)if(ve[q]!==se[q])return se;let K=ve.slice();return K[w-1]=se[I-1],K},[se,ve,t]),It=useMemo(()=>o==="auto"?ke.map(rt):void 0,[ke,o]),Jr=useMemo(()=>ke.map((w,I)=>`${le}-${I}`),[ke.length,le]),Yr=useMemo(()=>U?JSON.stringify(U):"",[U]),po=useMemo(()=>({...ft,...U}),[Yr]),it=useMemo(()=>{let{inlineCode:w,...I}=s!=null?s:{},K={...ar,...I};if(w){let q=K.code;K.code=de=>"data-block"in de?q?createElement(q,de):null:createElement(w,de);}return K},[s]),lt=useMemo(()=>{let w=[];return C!=null&&C.cjk&&(w=[...w,...C.cjk.remarkPluginsBefore]),w=[...w,...c],C!=null&&C.cjk&&(w=[...w,...C.cjk.remarkPluginsAfter]),C!=null&&C.math&&(w=[...w,C.math.remarkPlugin]),w},[c,C==null?void 0:C.math,C==null?void 0:C.cjk]),Te=useMemo(()=>{let w=a;return F&&Object.keys(F).length>0&&a===Er&&(w=Rl(F)),$.length>0&&(w=[...w,[xr,$,H!=null?H:[]]]),H&&H.length>0&&(w=[...w,[wr,H]]),V&&V.length>0&&(w=[...w,[yr,V]]),C!=null&&C.math&&(w=[...w,C.math.rehypePlugin]),o==="auto"&&t==="static"&&(w=[...w,br]),w},[a,C==null?void 0:C.math,F,$,H,V,o,t]),fo=useMemo(()=>{var w,I;return {calloutIcon:S,calloutStyle:M,codeBlockMaxHeight:m,shikiTheme:(I=l!=null?l:(w=C==null?void 0:C.code)==null?void 0:w.getThemes())!=null?I:Nl,controls:u,isAnimating:p,lineNumbers:Y,listStyle:P,mode:t,mermaid:d,linkSafety:B,portal:j,scrollable:f,tableMaxHeight:h,components:it,remarkPlugins:lt,rehypePlugins:Te}},[S,M,m,l,u,p,Y,P,t,d,B,j,f,C==null?void 0:C.code,h,it,lt,Te]),Qr=useMemo(()=>x&&p?{"--streamdown-caret":`"${Ll[x]}"`}:void 0,[x,p]),es=w=>{let I=null;if(te.current&&p){if(!We.current[w]){let q=De&&De!=="true"?g:{},{maxBacklogMs:de,...Pe}=q;We.current[w]=ct({...Pe,timeline:te.current});}I=We.current[w];}uo.current!==Te&&(xe.current=[],uo.current=Te),I&&!xe.current[w]&&(xe.current[w]=[...Te,I.rehypePlugin]);let K=I&&xe.current[w]?xe.current[w]:Te;return {blockAnimatePlugin:I,blockRehypePlugins:K}};return t==="static"?jsx(gt.Provider,{value:po,children:jsx(Ct.Provider,{value:C!=null?C:null,children:jsx(E.Provider,{value:fo,children:jsx(jt,{icons:Q,children:jsx(mt.Provider,{value:ee,children:jsx("div",{className:ee("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",i),dir:o==="auto"?void 0:o,children:jsx(Ue,{components:it,rehypePlugins:Te,remarkPlugins:lt,...ze,children:ce})})})})})})}):jsx(gt.Provider,{value:po,children:jsx(Ct.Provider,{value:C!=null?C:null,children:jsx(E.Provider,{value:fo,children:jsx(jt,{icons:Q,children:jsx(mt.Provider,{value:ee,children:jsxs("div",{className:ee("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",x?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,i),"data-streamdown":"container",style:Qr,children:[ke.length===0&&x&&p&&jsx("span",{}),ke.map((w,I)=>{var go;let K=I===ke.length-1,q=p&&K&&ir(w),{blockAnimatePlugin:de,blockRehypePlugins:Pe}=es(I);return jsx(b,{animatePlugin:de,components:it,content:w,dir:(go=It==null?void 0:It[I])!=null?go:o!=="auto"?o:void 0,index:I,isIncomplete:q,rehypePlugins:Pe,remarkPlugins:lt,shouldNormalizeHtmlIndentation:r,shouldParseIncompleteMarkdown:n,...ze},Jr[I])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.calloutIcon===t.calloutIcon&&e.calloutStyle===t.calloutStyle&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&e.dataOnlyTags===t.dataOnlyTags&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);Dl.displayName="Streamdown";var Zr=/[(){}[\]]/,Bl=/[\s;]/,Ol=/^[\w-]+$/,_l=/:::[\w-]+\s*$/,Vl=/^[/\\]/,$l=/[/\\]$/,Fl=/("[^"]*")/,jl=[["((","))"],["))","(("],["{{","}}"],["[","]"],["(",")"],[")","("]],st=e=>`"${e.replace(/"/g,"#quot;")}"`,zl=e=>e.length>=2&&e.startsWith('"')&&e.endsWith('"'),Wl=e=>{var n,r,s,a;let t=e.split(`
41
+ `),o=0;if(((n=t[o])==null?void 0:n.trim())==="---"){for(o+=1;o<t.length&&((r=t[o])==null?void 0:r.trim())!=="---";)o+=1;o+=1;}for(;o<t.length;){let c=(a=(s=t[o])==null?void 0:s.trim())!=null?a:"";if(c&&!c.startsWith("%%")){let i=c.split(Bl,1)[0];return i==="mindmap"?"mindmap":i==="flowchart"||i==="graph"?"flowchart":null}o+=1;}return null},ql=e=>{for(let[t,o]of jl){let n=e.indexOf(t);if(n===-1||!e.endsWith(o))continue;let r=e.slice(0,n);if(r&&!Ol.test(r))continue;let s=e.slice(n+t.length,e.length-o.length);if(!(s.includes(o)&&o!==t))return {id:r,open:t,close:o,inner:s}}return null},Zl=e=>{let t=e.length-e.trimStart().length,o=e.slice(0,t),n=e.trim();if(!n||n.startsWith("%%")||n.startsWith("::icon"))return e;let r=ql(n);if(r)return !zl(r.inner)&&(Zr.test(r.inner)||r.inner.includes('"'))?`${o}${r.id}${r.open}${st(r.inner)}${r.close}`:e;if(Zr.test(n)){let s=n.replace(_l,"").trimEnd();return `${o}[${st(s)}]`}return e},Kl=e=>{let t=e.split(`
42
+ `),o=false;return t.map(n=>o?Zl(n):(n.trim()&&(o=true),n)).join(`
43
+ `)},Gl=e=>e.startsWith("(")&&e.endsWith(")")||Vl.test(e)||$l.test(e),mo=(e,t)=>e.split(Fl).map((o,n)=>n%2===0?t(o):o).join(""),Xl=e=>{if(e.trim().startsWith("%%"))return e;let t=mo(e,o=>o.replace(/\[([^[\]"]*[(){}][^[\]"]*)\]/g,(n,r)=>Gl(r)?n:`[${st(r)}]`));return t=mo(t,o=>o.replace(/\{([^{}"]*[()[\]][^{}"]*)\}/g,(n,r)=>`{${st(r)}}`)),t=mo(t,o=>o.replace(/\|([^|"]*[(){}[\]][^|"]*)\|/g,(n,r)=>`|${st(r)}|`)),t},Ul=e=>e.split(`
44
+ `).map(Xl).join(`
45
+ `),Kr=e=>{let t=Wl(e);if(!t)return null;let o=t==="mindmap"?Kl(e):Ul(e);return o===e?null:o};var Ur=({children:e,className:t,contentSize:o,fitKey:n,minZoom:r=.5,maxZoom:s=3,zoomStep:a=.1,showControls:c=true,initialZoom:i=1,isAutoFit:l=false,fullscreen:d=false})=>{let{RotateCcwIcon:m,ZoomInIcon:u,ZoomOutIcon:p}=O(),f=v(),h=_(),g=useRef(null),b=useRef(null),[y,x]=useState(i),[P,S]=useState(r),[M,C]=useState(i),[D,B]=useState({x:0,y:0}),[j,Y]=useState(false),[F,H]=useState(false),[V,U]=useState({x:0,y:0}),[Q,R]=useState({x:0,y:0}),z=useCallback(T=>{C($=>Math.max(P,Math.min(s,$+T))),H(true);},[P,s]),re=useCallback(()=>{z(a);},[z,a]),ze=useCallback(()=>{z(-a);},[z,a]),le=useCallback(()=>{C(y),B({x:0,y:0}),H(false);},[y]),ee=useCallback(T=>{T.preventDefault();let $=T.deltaY>0?-a:a;z($);},[z,a]),Ae=useCallback(T=>{if(T.button!==0||T.isPrimary===false)return;Y(true),H(true),U({x:T.clientX,y:T.clientY}),R(D);let $=T.currentTarget;$ instanceof HTMLElement&&$.setPointerCapture(T.pointerId);},[D]),X=useCallback(T=>{if(!j)return;T.preventDefault();let $=T.clientX-V.x,ge=T.clientY-V.y;B({x:Q.x+$,y:Q.y+ge});},[j,V,Q]),W=useCallback(T=>{Y(false);let $=T.currentTarget;$ instanceof HTMLElement&&$.releasePointerCapture(T.pointerId);},[]);return useEffect(()=>{S(r),l||(x(i),C(i));},[i,l,r]),useEffect(()=>{if(!(l&&o))return;let T=g.current;if(!T)return;let $=T.clientWidth,ge=T.clientHeight;if(!($>0&&ge>0))return;let ce=Math.min($/o.width,ge/o.height,1);!(ce>0)||Number.isNaN(ce)||(x(ce),S(Math.min(r,ce)),F||(C(ce),B({x:0,y:0})));},[o,F,l,r]),useEffect(()=>{l&&H(false);},[l]),useEffect(()=>{let T=g.current;if(T)return T.addEventListener("wheel",ee,{passive:false}),()=>{T.removeEventListener("wheel",ee);}},[ee]),useEffect(()=>{let T=b.current;if(T&&j)return document.body.style.userSelect="none",T.addEventListener("pointermove",X,{passive:false}),T.addEventListener("pointerup",W),T.addEventListener("pointercancel",W),()=>{document.body.style.userSelect="",T.removeEventListener("pointermove",X),T.removeEventListener("pointerup",W),T.removeEventListener("pointercancel",W);}},[j,X,W]),jsxs("div",{className:f("relative flex flex-col",d?"h-full w-full":"min-h-28 w-full",t),ref:g,style:{cursor:j?"grabbing":"grab"},children:[c?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",d?"bottom-4 left-4":"bottom-2 left-2"),children:[jsx("button",{"aria-label":h.zoomIn,className:f("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>=s,onClick:re,title:h.zoomIn,type:"button",children:jsx(u,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":h.zoomOut,className:f("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<=P,onClick:ze,title:h.zoomOut,type:"button",children:jsx(p,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":h.resetView,className:f("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:le,title:h.resetView,type:"button",children:jsx(m,{"aria-hidden":"true",size:16})})]}):null,jsx("div",{className:f("flex-1 origin-center transition-transform duration-150 ease-out",d?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:Ae,ref:b,role:"application",style:{transform:`translate(${D.x}px, ${D.y}px) scale(${M})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var Ql=async(e,t,o)=>{try{return await e.render(t,o)}catch(n){let r=Kr(o);if(!r)throw n;try{return await e.render(`${t}-autofix`,r)}catch(s){throw n}}},yn=({chart:e,className:t,config:o,fullscreen:n=false,showControls:r=true})=>{let s=v(),[a,c]=useState(null),[i,l]=useState(false),[d,m]=useState(""),[u,p]=useState(null),[f,h]=useState(""),[g,b]=useState(0),{mermaid:y}=useContext(E),x=Oe(),P=y==null?void 0:y.errorComponent,{shouldRender:S,containerRef:M}=ho({immediate:n});if(useEffect(()=>{if(!S)return;if(!x){c("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{c(null),l(!0);let B=x.getMermaid(o),j=e.split("").reduce((U,Q)=>(U<<5)-U+Q.charCodeAt(0)|0,0),Y=`mermaid-${Math.abs(j)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:F}=await Ql(B,Y,e),H=Jt(F),V=n?F:fn(F);m(V),p(H),h(V);}catch(B){if(!(f||d)){let j=B instanceof Error?B.message:"Failed to render Mermaid chart";c(j);}}finally{l(false);}})();},[e,o,g,S,x]),!(S||d||f))return jsx("div",{className:s("my-4 min-h-[200px]",t),ref:M});if(i&&!d&&!f)return jsx("div",{className:s("my-4 flex justify-center p-4",t),ref:M,children:jsxs("div",{className:s("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:s("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:s("text-sm"),children:"Loading diagram..."})]})});if(a&&!d&&!f){let D=()=>b(B=>B+1);return P?jsx("div",{ref:M,children:jsx(P,{chart:e,error:a,retry:D})}):jsxs("div",{className:s("rounded-md bg-red-50 p-4",t),ref:M,children:[jsxs("p",{className:s("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",a]}),jsxs("details",{className:s("mt-2"),children:[jsx("summary",{className:s("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),jsx("pre",{className:s("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let C=d||f;return jsx("div",{className:s("size-full",t),"data-streamdown":"mermaid",ref:M,children:jsx(Ur,{className:s(n?"size-full overflow-hidden":"overflow-hidden",t),contentSize:u,fitKey:e,fullscreen:n,isAutoFit:true,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:jsx("div",{"aria-label":"Mermaid chart",className:s("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:C},role:"img"})})})};export{ao as A,Ml as B,co as C,Il as D,qr as E,Dl as F,ls as a,ct as b,Bt as c,qe as d,Ao as e,_t as f,$t as g,om as h,Ft as i,ft as j,ht as k,Wt as l,bt as m,E as n,ln as o,yn as p,_e as q,Le as r,eo as s,xt as t,Ve as u,et as v,ri as w,tt as x,rt as y,Tt as z};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import {n,h,e}from'./chunk-K5F2GTRN.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var x=({code:s,language:e$1,maxHeight:h$1,raw:t,className:m,startLine:d,lineNumbers:a,...c})=>{let{shikiTheme:l}=useContext(n),i=h(),[p,o]=useState(t);return useEffect(()=>{if(!i){o(t);return}let g=i.highlight({code:s,language:e$1,themes:l},H=>{o(H);});g&&o(g);},[s,e$1,l,i,t]),jsx(e,{className:m,language:e$1,lineNumbers:a,maxHeight:h$1,result:p,startLine:d,...c})};export{x as HighlightedCodeBlockBody};
2
+ import {n,h,e}from'./chunk-PJ2AJRJ3.js';import {useContext,useState,useEffect}from'react';import {jsx}from'react/jsx-runtime';var x=({code:s,language:e$1,maxHeight:h$1,raw:t,className:m,startLine:d,lineNumbers:a,...c})=>{let{shikiTheme:l}=useContext(n),i=h(),[p,o]=useState(t);return useEffect(()=>{if(!i){o(t);return}let g=i.highlight({code:s,language:e$1,themes:l},H=>{o(H);});g&&o(g);},[s,e$1,l,i,t]),jsx(e,{className:m,language:e$1,lineNumbers:a,maxHeight:h$1,result:p,startLine:d,...c})};export{x as HighlightedCodeBlockBody};
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { type AnimateOptions, type AnimatePlugin } from "./lib/animate";
4
4
  import { type IconMap } from "./lib/icon-context";
5
5
  import { type Options } from "./lib/markdown";
6
6
  import type { PluginConfig, ThemeInput } from "./lib/plugin-types";
7
- import { type CalloutIconResolver, type CalloutStyleResolver, type ControlsConfig, type LinkSafetyConfig, type ListStylePreset, type MermaidOptions, type ScrollableComponent } from "./lib/streamdown-context";
7
+ import { type CalloutIconResolver, type CalloutStyleResolver, type ControlsConfig, type LinkSafetyConfig, type ListStylePreset, type MermaidOptions, type PortalTarget, type ScrollableComponent } from "./lib/streamdown-context";
8
8
  import { type StreamdownTranslations } from "./lib/translations-context";
9
9
  export type { AnimateOptions } from "./lib/animate";
10
10
  export { createAnimateCursor, createAnimatePlugin } from "./lib/animate";
@@ -23,7 +23,7 @@ export type { IncrementalParseState } from "./lib/parse-blocks";
23
23
  export { parseMarkdownIntoBlocks, parseMarkdownIntoBlocksIncremental, } from "./lib/parse-blocks";
24
24
  export type { BundledLanguage, BundledTheme, CjkPlugin, CodeHighlighterPlugin, CustomRenderer, CustomRendererProps, DiagramPlugin, HighlightOptions, MathPlugin, PluginConfig, ThemeInput, ThemeRegistrationAny, } from "./lib/plugin-types";
25
25
  export { DefaultScrollable } from "./lib/scrollable";
26
- export type { CalloutIconResolver, CalloutStyleResolver, ControlsConfig, DownloadControlConfig, LinkSafetyConfig, LinkSafetyModalProps, MermaidErrorComponentProps, MermaidOptions, ScrollableComponent, ScrollableProps, StreamdownContextType, } from "./lib/streamdown-context";
26
+ export type { CalloutIconResolver, CalloutStyleResolver, ControlsConfig, DownloadControlConfig, LinkSafetyConfig, LinkSafetyModalProps, MermaidErrorComponentProps, MermaidOptions, PortalTarget, ScrollableComponent, ScrollableProps, StreamdownContextType, } from "./lib/streamdown-context";
27
27
  export { StreamdownContext } from "./lib/streamdown-context";
28
28
  export { TableCopyDropdown, type TableCopyDropdownProps, } from "./lib/table/copy-dropdown";
29
29
  export { TableDownloadButton, type TableDownloadButtonProps, TableDownloadDropdown, type TableDownloadDropdownProps, } from "./lib/table/download-dropdown";
@@ -79,6 +79,11 @@ export type StreamdownProps = Options & {
79
79
  plugins?: PluginConfig;
80
80
  remend?: RemendOptions;
81
81
  linkSafety?: LinkSafetyConfig;
82
+ /**
83
+ * DOM node for Streamdown overlays, or a function returning one.
84
+ * Defaults to `document.body`.
85
+ */
86
+ portal?: PortalTarget;
82
87
  /** Custom tags to allow through sanitization with their permitted attributes */
83
88
  allowedTags?: AllowedTags;
84
89
  /**
@@ -158,4 +163,4 @@ export type BlockProps = Options & {
158
163
  animatePlugin?: AnimatePlugin | null;
159
164
  };
160
165
  export declare const Block: import("react").MemoExoticComponent<({ content, shouldParseIncompleteMarkdown: _, shouldNormalizeHtmlIndentation, index: __, isIncomplete, dir, animatePlugin: animatePluginProp, ...props }: BlockProps) => import("react/jsx-runtime").JSX.Element>;
161
- export declare const Streamdown: import("react").MemoExoticComponent<({ children, mode, dir, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, normalizeHtmlIndentation: shouldNormalizeHtmlIndentation, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, codeBlockMaxHeight, controls, isAnimating, scrollable, tableMaxHeight, animated, BlockComponent, parseMarkdownIntoBlocksFn, caret, listStyle, calloutIcon, calloutStyle, plugins, remend: remendOptions, linkSafety, lineNumbers, allowedTags, literalTagContent, dataOnlyTags, translations, icons: iconOverrides, prefix, onAnimationStart, onAnimationEnd, ...props }: StreamdownProps) => import("react/jsx-runtime").JSX.Element>;
166
+ export declare const Streamdown: import("react").MemoExoticComponent<({ children, mode, dir, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, normalizeHtmlIndentation: shouldNormalizeHtmlIndentation, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, codeBlockMaxHeight, controls, isAnimating, scrollable, tableMaxHeight, animated, BlockComponent, parseMarkdownIntoBlocksFn, caret, listStyle, calloutIcon, calloutStyle, plugins, remend: remendOptions, linkSafety, portal, lineNumbers, allowedTags, literalTagContent, dataOnlyTags, translations, icons: iconOverrides, prefix, onAnimationStart, onAnimationEnd, ...props }: StreamdownProps) => import("react/jsx-runtime").JSX.Element>;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{E as Block,i as CodeBlock,f as CodeBlockContainer,k as CodeBlockCopyButton,l as CodeBlockDownloadButton,g as CodeBlockHeader,m as CodeBlockSkeleton,d as DefaultScrollable,F as Streamdown,n as StreamdownContext,v as TableCopyDropdown,w as TableDownloadButton,x as TableDownloadDropdown,a as createAnimateCursor,b as createAnimatePlugin,C as defaultRehypePlugins,D as defaultRemarkPlugins,j as defaultTranslations,o as defaultUrlTransform,y as detectTextDirection,t as escapeMarkdownTableCell,q as extractTableDataFromElement,B as normalizeHtmlIndentation,z as parseMarkdownIntoBlocks,A as parseMarkdownIntoBlocksIncremental,r as tableDataToCSV,u as tableDataToMarkdown,s as tableDataToTSV,c as useIsCodeFenceIncomplete}from'./chunk-K5F2GTRN.js';
2
+ export{E as Block,i as CodeBlock,f as CodeBlockContainer,k as CodeBlockCopyButton,l as CodeBlockDownloadButton,g as CodeBlockHeader,m as CodeBlockSkeleton,d as DefaultScrollable,F as Streamdown,n as StreamdownContext,v as TableCopyDropdown,w as TableDownloadButton,x as TableDownloadDropdown,a as createAnimateCursor,b as createAnimatePlugin,C as defaultRehypePlugins,D as defaultRemarkPlugins,j as defaultTranslations,o as defaultUrlTransform,y as detectTextDirection,t as escapeMarkdownTableCell,q as extractTableDataFromElement,B as normalizeHtmlIndentation,z as parseMarkdownIntoBlocks,A as parseMarkdownIntoBlocksIncremental,r as tableDataToCSV,u as tableDataToMarkdown,s as tableDataToTSV,c as useIsCodeFenceIncomplete}from'./chunk-PJ2AJRJ3.js';
@@ -0,0 +1,2 @@
1
+ import type { PortalTarget } from "./streamdown-context";
2
+ export declare const resolvePortalTarget: (portal: PortalTarget | undefined) => HTMLElement;
@@ -82,6 +82,8 @@ export type ScrollableProps = ComponentProps<"div"> & {
82
82
  * without DOM observers or per-element wiring.
83
83
  */
84
84
  export type ScrollableComponent = ComponentType<ScrollableProps>;
85
+ /** DOM node for Streamdown overlays, or a function returning one. Defaults to `document.body`. */
86
+ export type PortalTarget = HTMLElement | null | (() => HTMLElement | null);
85
87
  export interface StreamdownContextType {
86
88
  /** Icon resolver for custom callouts (`>>> (icon)[Title]{color}`). */
87
89
  calloutIcon?: CalloutIconResolver;
@@ -100,6 +102,8 @@ export interface StreamdownContextType {
100
102
  listStyle: ListStylePreset;
101
103
  mermaid?: MermaidOptions;
102
104
  mode: "static" | "streaming";
105
+ /** Overlay portal target for fullscreen and the built-in link safety modal. */
106
+ portal?: PortalTarget;
103
107
  rehypePlugins?: PluggableList;
104
108
  remarkPlugins?: PluggableList;
105
109
  /** Component used for horizontal-scroll regions (code body, table). @default plain div */
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export{p as Mermaid}from'./chunk-PJ2AJRJ3.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/streamdown",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -52,8 +52,8 @@
52
52
  "typescript": "^7.0.2",
53
53
  "vitest": "^4.1.10",
54
54
  "@streamdown/cjk": "npm:@lofcz/streamdown-cjk@1.0.3",
55
- "@streamdown/mermaid": "npm:@lofcz/streamdown-mermaid@1.0.2",
56
- "@streamdown/math": "npm:@lofcz/streamdown-math@1.0.3"
55
+ "@streamdown/math": "npm:@lofcz/streamdown-math@1.0.3",
56
+ "@streamdown/mermaid": "npm:@lofcz/streamdown-mermaid@1.0.2"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": "^18.0.0 || ^19.0.0",
@@ -1,45 +0,0 @@
1
- "use client";
2
- import {createContext,memo,useContext,useMemo,lazy,isValidElement,useLayoutEffect,useId,useRef,useEffect,useDeferredValue,cloneElement,createElement,useState,useCallback,Suspense}from'react';import {harden}from'rehype-harden';import tn from'rehype-raw';import jr,{defaultSchema}from'rehype-sanitize';import wl from'remark-gfm';import xl from'remend';import {visitParents,SKIP as SKIP$1}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 wa from'remark-parse';import xa from'remark-rehype';import {unified}from'unified';import {visit,SKIP}from'unist-util-visit';import {Lexer}from'marked';import {toText}from'hast-util-to-text';var ts=300,os="300px",ns=500;function fo(e={}){let{immediate:t=false,debounceDelay:o=ts,rootMargin:n=os,idleTimeout:r=ns}=e,[s,a]=useState(false),c=useRef(null),i=useRef(null),l=useRef(null),d=useMemo(()=>m=>{let f=Date.now();return window.setTimeout(()=>{m({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-f))});},1)},[]),u=useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(m,f)=>window.requestIdleCallback(m,f):d,[d]),p=useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?m=>window.cancelIdleCallback(m):m=>{clearTimeout(m);},[]);return useEffect(()=>{if(t){a(true);return}let m=c.current;if(!m)return;i.current&&(clearTimeout(i.current),i.current=null),l.current&&(p(l.current),l.current=null);let f=()=>{i.current&&(clearTimeout(i.current),i.current=null),l.current&&(p(l.current),l.current=null);},g=x=>{l.current=u(P=>{P.timeRemaining()>0||P.didTimeout?(a(true),x.disconnect()):l.current=u(()=>{a(true),x.disconnect();},{timeout:r/2});},{timeout:r});},b=x=>{f(),i.current=window.setTimeout(()=>{var M,y;let P=x.takeRecords();(P.length===0||(y=(M=P.at(-1))==null?void 0:M.isIntersecting)!=null&&y)&&g(x);},o);},h=(x,P)=>{x.isIntersecting?b(P):f();},k=new IntersectionObserver(x=>{for(let P of x)h(P,k);},{rootMargin:n,threshold:0});return k.observe(m),()=>{i.current&&clearTimeout(i.current),l.current&&p(l.current),k.disconnect();}},[t,o,n,r,p,u]),{shouldRender:s,containerRef:c}}var rs=320,ss=4,bo=()=>typeof performance=="undefined"?Date.now():performance.now();function Rt(e){var s,a;let t=(s=e==null?void 0:e.now)!=null?s:bo,o=(a=e==null?void 0:e.maxBacklogMs)!=null?a:rs,n=0,r=0;return {now:t,beginPass(c){r=Math.min(Math.max(n,c),c+o);},mark(){return r},rewind(c){r=c;},take(c,i,l){if(c<=0)return {baseDelay:0,step:Math.max(0,i)};let d=Math.max(0,i),u=d===0?0:Math.min(d,ss),p=Math.max(r,l),m=l+o,f=p+Math.max(0,c-1)*d,g=d;if(f>m&&c>1)if(p<m){let h=m-p;g=Math.max(u,h/(c-1));}else g=u;let b=Math.max(0,Math.round(p-l));return r=p+c*g,{baseDelay:b,step:g}},commitPass(){n=r;}}}function as(){return {current:0}}var yo=/\s/,Lt=/^\s+$/,is=new Set(["pre","svg","math","annotation"]),ls=new Set(["svg","math","annotation"]),Et=new Set(["img","hr"]),cs=new Set(["ul","ol","li"]),Se=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Nt=(e,t)=>{let o=t?ls:is;return e.some(n=>Se(n)&&o.has(n.tagName))},ds=e=>{for(let t=e.length-1;t>=0;t-=1){let o=e[t];if(Se(o)&&o.tagName==="li")return o}},ms=(e,t,o,n)=>{(e.properties)!=null||(e.properties={}),e.properties["data-sd-animate-marker"]=true,e.properties.style=`--sd-marker-duration:${t}ms;--sd-marker-delay:${o}ms;--sd-marker-easing:${n}`;},Co=e=>{for(let t of e.children)if(Se(t)){if(t.tagName==="input")return t;if(cs.has(t.tagName))continue;let o=Co(t);if(o)return o}},wo=(e,t,o,n)=>{(e.properties)!=null||(e.properties={}),e.properties["data-sd-animate"]=true;let r=typeof e.properties.style=="string"?`${e.properties.style};`:"";e.properties.style=`${r}--sd-animation:sd-${t.animation};--sd-duration:${o}ms;--sd-easing:${t.easing};--sd-delay:${n}ms`;},us=(e,t,o,n)=>{let r=Co(e);r&&wo(r,t,o,n);},xo=e=>{var t;for(let o=e.length-1;o>=0;o-=1){let n=e[o];if(Se(n)){if((t=n.properties)!=null&&t["data-sd-animated"])break;n.properties={...n.properties,"data-sd-animated":true};}}},vo=e=>{let t=[],o="",n=false;for(let r of e){let s=yo.test(r);if(s!==n&&o){if(s){o+=r,n=true;continue}t.push(o),o="";}o+=r,n=s;}return o&&t.push(o),t},ko=e=>{let t=[],o="";for(let n of e)yo.test(n)?t.length>0&&!Lt.test(t.at(-1))?t[t.length-1]+=n:o+=n:(o&&(t.push(o),o=""),t.push(n));return o&&(t.length>0?t[t.length-1]+=o:t.push(o)),t},ps=(e,t,o,n,r,s)=>{let a=`--sd-animation:sd-${t};--sd-duration:${r?0:o}ms;--sd-easing:${n}`;return s&&(a+=`;--sd-delay:${Math.round(s)}ms`),{type:"element",tagName:"span",properties:{"data-sd-animate":true,style:a},children:[{type:"text",value:e}]}},fs=(e,t,o,n)=>{let r=0,s=0;return visitParents(e,a=>a.type==="text"||Se(a)&&Et.has(a.tagName),(a,c)=>{if(Nt(c,o.animateCodeBlocks))return SKIP$1;if(Se(a)&&Et.has(a.tagName)){n>0&&s<n||(r+=1),s+=1;return}let i=a.value;if(!i.trim()){s+=i.length;return}let l=t.sep==="char"?ko(i):vo(i);for(let d of l){let u=s;s+=d.length,!Lt.test(d)&&(n>0&&u<n||(r+=1));}}),r},gs=(e,t,o,n,r,s)=>{if(Nt(t,n.animateCodeBlocks))return;let a=n.prevContentLength,c=r.count;r.count+=1;let i=a>0&&c<a,l=i?0:s.baseDelay+r.newIndex++*s.step;wo(e,o,i?0:o.duration,l),xo(t);},hs=(e,t,o,n,r,s)=>{var h;let a=t.at(-1);if(!(a&&"children"in a))return;if(Nt(t,n.animateCodeBlocks))return SKIP$1;let c=a,i=c.children.indexOf(e);if(i===-1)return;let l=e.value;if(!l.trim()){r.count+=l.length;return}let d=o.sep==="char"?ko(l):vo(l),u=n.prevContentLength,p=false,m=ds(t),f=!!(m&&!((h=m.properties)!=null&&h["data-sd-animate-marker"])),g=false,b=d.map(k=>{let x=r.count;if(r.count+=k.length,Lt.test(k))return {type:"text",value:k};let P=u>0&&x<u,S=P?0:s.baseDelay+r.newIndex++*s.step;if(m&&f&&!g){let M=P?0:o.duration;ms(m,M,S,o.easing),us(m,o,M,S),g=true;}return p=true,ps(k,o.animation,o.duration,o.easing,P,S)});return p&&xo(t),c.children.splice(i,1,...b),i+b.length},bs=0;function it(e){var s,a,c,i,l;let t={animation:(s=e==null?void 0:e.animation)!=null?s:"fadeIn",duration:(a=e==null?void 0:e.duration)!=null?a:150,easing:(c=e==null?void 0:e.easing)!=null?c:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word",stagger:(l=e==null?void 0:e.stagger)!=null?l:40,timeline:e==null?void 0:e.timeline},o={animateCodeBlocks:false,committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},n=bs++,r=()=>d=>{var g;let u={count:0,newIndex:0};o.prevContentLength=o.committedCharCount;let p=t.timeline,m=(g=p==null?void 0:p.now())!=null?g:bo();p&&(o.pendingMark===null?o.pendingMark=p.mark():p.rewind(o.pendingMark));let f=p?p.take(fs(d,t,o,o.prevContentLength),t.stagger,m):{baseDelay:0,step:t.stagger};visitParents(d,b=>b.type==="text"||Se(b)&&Et.has(b.tagName),(b,h)=>{if(b.type==="text")return hs(b,h,t,o,u,f);gs(b,h,t,o,u,f);}),o.lastRenderCharCount=u.count,o.prevContentLength=0;};return Object.defineProperty(r,"name",{value:`rehypeAnimate$${n}`}),{name:"animate",type:"animate",rehypePlugin:r,setAnimateCodeBlocks(d){o.animateCodeBlocks=d;},setPrevContentLength(d){o.committedCharCount=d,o.prevContentLength=d;},getLastRenderCharCount(){return o.lastRenderCharCount},commit(){o.committedCharCount=o.lastRenderCharCount,o.pendingMark=null;}}}it();var At=createContext(false),Dt=()=>useContext(At);var De=(...e)=>twMerge(clsx(e)),lt=e=>{if(e!==void 0)return typeof e=="number"?!Number.isFinite(e)||e<=0?void 0:`${e}px`:e},ws=(e,t)=>{if(!e||!t)return t;let o=`${e}:`;return t.split(/\s+/).filter(Boolean).map(n=>n.startsWith(o)?n:`${e}:${n}`).join(" ")},So=e=>e?(...t)=>ws(e,twMerge(clsx(t))):De,re=(e,t,o)=>{let n=typeof t=="string"&&o.startsWith("text/csv")?"\uFEFF":"",r=typeof t=="string"?new Blob([n+t],{type:o}):t,s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s);};var ct=createContext(De),w=()=>useContext(ct);var ze=({scrollRef:e,ref:t,...o})=>jsx("div",{ref:e,...o});var Ss=8,Ms=e=>e.scrollHeight-e.scrollTop-e.clientHeight<Ss,Ro=e=>{var o,n;let t=(n=(o=e.touches[0])!=null?o:e.changedTouches[0])!=null?n:null;return typeof(t==null?void 0:t.clientY)=="number"?t.clientY:null},dt=({enabled:e,isAnimating:t,content:o})=>{let[n,r]=useState(null),s=useRef(true),a=useRef(0),c=useCallback(l=>{r(d=>d===l?d:l);},[]),i=useCallback(l=>{t&&s.current&&(l.scrollTo({top:l.scrollHeight,behavior:"instant"}),a.current=l.scrollTop);},[t]);return useEffect(()=>{t||(s.current=true);},[t]),useEffect(()=>{if(!(e&&n))return;a.current=n.scrollTop;let l=()=>{s.current=false;},d=b=>{b.deltaY<0&&l();},u=null,p=b=>{u=Ro(b);},m=b=>{if(u===null)return;let h=Ro(b);if(h===null)return;let k=h-u;Math.abs(k)<=3||(k>0&&l(),u=h);},f=()=>{u=null;},g=()=>{let b=n.scrollTop<a.current;if(a.current=n.scrollTop,b){l();return}Ms(n)&&(s.current=true);};return n.addEventListener("wheel",d,{capture:true,passive:true}),n.addEventListener("touchstart",p,{passive:true}),n.addEventListener("touchmove",m,{passive:true}),n.addEventListener("touchend",f,{passive:true}),n.addEventListener("touchcancel",f,{passive:true}),n.addEventListener("scroll",g,{passive:true}),()=>{n.removeEventListener("wheel",d,{capture:true}),n.removeEventListener("touchstart",p),n.removeEventListener("touchmove",m),n.removeEventListener("touchend",f),n.removeEventListener("touchcancel",f),n.removeEventListener("scroll",g);}},[e,n]),useLayoutEffect(()=>{if(!(e&&n)||(i(n),typeof ResizeObserver=="undefined"))return;let l=new ResizeObserver(()=>{i(n);});l.observe(n);for(let d of n.children)l.observe(d);return ()=>{l.disconnect();}},[o,n,e,i]),c};var Rs=De("block"),Ls=De("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"),Ns=e=>{let t={};for(let o of e.split(";")){let n=o.indexOf(":");if(n>0){let r=o.slice(0,n).trim(),s=o.slice(n+1).trim();r&&s&&(t[r]=s);}}return t},Lo=memo(({children:e,result:t,language:o,className:n,maxHeight:r,startLine:s,lineNumbers:a=true,...c})=>{let i=w(),{isAnimating:l,scrollable:d}=useContext(E),u=d!=null?d:ze,p=lt(r),m=dt({content:t,enabled:!!p,isAnimating:l}),f=useMemo(()=>i(Ls),[i]),g=useMemo(()=>i(Rs),[i]),b=useMemo(()=>{let h={};return t.bg&&(h["--sdm-bg"]=t.bg),t.fg&&(h["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(h,Ns(t.rootStyle)),h},[t.bg,t.fg,t.rootStyle]);return jsx(u,{className:i(n,p?"overflow-x-auto overflow-y-auto":"overflow-x-auto","rounded-md border border-border bg-background p-4 text-sm"),"data-language":o,"data-streamdown":"code-block-body",scrollRef:m,style:p?{maxHeight:p}:void 0,...c,children:jsx("pre",{className:i(n,"bg-[var(--sdm-bg,inherit)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]"),style:b,children:jsx("code",{className:a?i("[counter-increment:line_0] [counter-reset:line]"):void 0,style:a&&s&&s>1?{counterReset:`line ${s-1}`}:void 0,children:t.tokens.map((h,k)=>jsx("span",{className:a?f:g,children:h.length===0||h.length===1&&h[0].content===""?`
3
- `:h.map((x,P)=>{let S={},M=!!x.bgColor;if(x.color&&(S["--sdm-c"]=x.color),x.bgColor&&(S["--sdm-tbg"]=x.bgColor),x.htmlStyle)for(let[y,D]of Object.entries(x.htmlStyle))y==="color"?S["--sdm-c"]=D:y==="background-color"?(S["--sdm-tbg"]=D,M=true):S[y]=D;return jsx("span",{className:i("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",M&&"bg-[var(--sdm-tbg)]",M&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:S,...x.htmlAttrs,children:x.content},P)})},k))})})})});var Bt=({className:e,language:t,style:o,isIncomplete:n,...r})=>{let s=w();return jsx("div",{className:s("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},...r})};var Ot=createContext({code:""}),mt=()=>useContext(Ot);var _t=({language:e})=>{let t=w();return jsx("div",{className:t("flex h-8 items-center text-muted-foreground text-xs"),"data-language":e,"data-streamdown":"code-block-header",children:jsx("span",{className:t("ml-1 font-mono lowercase"),children:e})})};var Vs=e=>{let t=e.length;for(;t>0&&e[t-1]===`
4
- `;)t--;return e.slice(0,t)},$s=lazy(()=>import('./highlighted-body-TV57K3HQ.js').then(e=>({default:e.HighlightedCodeBlockBody}))),Vt=({code:e,language:t,className:o,children:n,isIncomplete:r=false,startLine:s,lineNumbers:a,...c})=>{let i=w(),{codeBlockMaxHeight:l}=useContext(E),d=useMemo(()=>Vs(e),[e]),u=useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
5
- `).map(p=>[{content:p,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]);return jsx(Ot.Provider,{value:{code:e},children:jsxs(Bt,{dir:"ltr",isIncomplete:r,language:t,children:[jsx(_t,{language:t}),n?jsx("div",{className:i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:jsx("div",{className:i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),"data-streamdown":"code-block-actions",children:n})}):null,jsx(Suspense,{fallback:jsx(Lo,{className:o,language:t,lineNumbers:a,maxHeight:l,result:u,startLine:s,...c}),children:jsx($s,{className:o,code:d,language:t,lineNumbers:a,maxHeight:l,raw:u,startLine:s,...c})})]})})};var Do=e=>jsx("svg",{"aria-hidden":"true",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"})}),Ho=e=>jsx("svg",{"aria-hidden":"true",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"})}),Bo=e=>jsx("svg",{"aria-hidden":"true",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"})}),Oo=e=>jsxs("svg",{"aria-hidden":"true",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"})]}),_o=e=>jsx("svg",{"aria-hidden":"true",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"})}),Vo=e=>jsx("svg",{"aria-hidden":"true",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"})}),$o=e=>jsx("svg",{"aria-hidden":"true",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"})}),Fo=e=>jsx("svg",{"aria-hidden":"true",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"})}),jo=e=>jsx("svg",{"aria-hidden":"true",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"})}),zo=e=>jsx("svg",{"aria-hidden":"true",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 qe={CheckIcon:Do,CopyIcon:Ho,DownloadIcon:Bo,ExternalLinkIcon:Fo,Loader2Icon:Oo,Maximize2Icon:_o,RotateCcwIcon:Vo,XIcon:$o,ZoomInIcon:jo,ZoomOutIcon:zo},qo=createContext(qe),qs=(e,t)=>{if(e===t)return true;if(!(e&&t))return e===t;let o=Object.keys(e),n=Object.keys(t);return o.length!==n.length?false:o.every(r=>e[r]===t[r])},$t=({icons:e,children:t})=>{let o=useRef(e),n=useRef(e?{...qe,...e}:qe);qs(o.current,e)||(o.current=e,n.current=e?{...qe,...e}:qe);let r=n.current;return jsx(qo.Provider,{value:r,children:t})},_=()=>useContext(qo);var ut={alertNote:"Note",alertTip:"Tip",alertImportant:"Important",alertWarning:"Warning",alertCaution:"Caution",copyCode:"Copy Code",downloadFile:"Download file",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",zoomIn:"Zoom in",zoomOut:"Zoom out",resetView:"Reset zoom and pan",copyTable:"Copy table",copyTableAsMarkdown:"Copy table as Markdown",copyTableAsCsv:"Copy table as CSV",copyTableAsTsv:"Copy table as TSV",downloadTable:"Download table",downloadTableAsCsv:"Download table as CSV",downloadTableAsMarkdown:"Download table as Markdown",tableFormatMarkdown:"Markdown",tableFormatCsv:"CSV",tableFormatTsv:"TSV",imageNotAvailable:"Image not available",downloadImage:"Download image",openExternalLink:"Open external link?",externalLinkWarning:"You're about to visit an external website.",close:"Close",copyLink:"Copy link",copied:"Copied",openLink:"Open link"},pt=createContext(ut),V=()=>useContext(pt);var ft=({onCopy:e,onError:t,timeout:o=2e3,children:n,className:r,code:s,...a})=>{let c=w(),[i,l]=useState(false),d=useRef(0),{code:u}=mt(),{isAnimating:p}=useContext(E),m=V(),f=s!=null?s:u,g=async()=>{var k;if(typeof window=="undefined"||!((k=navigator==null?void 0:navigator.clipboard)!=null&&k.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{i||(await navigator.clipboard.writeText(f),l(!0),e==null||e(),d.current=window.setTimeout(()=>l(!1),o));}catch(x){t==null||t(x);}};useEffect(()=>()=>{window.clearTimeout(d.current);},[]);let b=_(),h=i?b.CheckIcon:b.CopyIcon;return jsxs(Fragment,{children:[jsx("button",{"aria-label":m.copyCode,className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-copy-button",disabled:p,onClick:g,title:m.copyCode,type:"button",...a,children:n!=null?n:jsx(h,{"aria-hidden":"true",size:14})}),i&&jsx("output",{"aria-live":"polite",className:"sr-only",children:m.copied})]})};var Ie=(e,t,o)=>{if(typeof e=="boolean")return o;let n=e[t];if(typeof n!="object")return o;let r=n.download;return typeof r!="object"?o:r.filename||o};var Zo={"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"},jt=({onDownload:e,onError:t,language:o,children:n,className:r,code:s,...a})=>{let c=w(),{code:i}=mt(),{isAnimating:l,controls:d}=useContext(E),u=V(),p=_(),m=s!=null?s:i,f=o&&o in Zo?Zo[o]:"txt",g=`${Ie(d,"code","file")}.${f}`,b="text/plain",h=()=>{try{re(g,m,b),e==null||e();}catch(k){t==null||t(k);}};return jsx("button",{"aria-label":u.downloadFile,className:c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),"data-streamdown":"code-block-download-button",disabled:l,onClick:h,title:u.downloadFile,type:"button",...a,children:n!=null?n:jsx(p.DownloadIcon,{size:14})})};var gt=()=>{let{Loader2Icon:e}=_(),t=w();return jsxs("div",{className:t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),children:[jsx("div",{className:t("h-[46px] w-full bg-muted/80")}),jsx("div",{className:t("flex w-full items-center justify-center p-4"),children:jsx(e,{className:t("size-4 animate-spin")})})]})};var Ze=0,he=()=>{Ze+=1,Ze===1&&(document.body.style.overflow="hidden");},be=()=>{Ze=Math.max(0,Ze-1),Ze===0&&(document.body.style.overflow="");};var ra=["github-light","github-dark"],sa={enabled:true},aa={codeBlockMaxHeight:400,shikiTheme:ra,controls:true,isAnimating:false,lineNumbers:true,listStyle:"hierarchical",mode:"streaming",mermaid:void 0,linkSafety:sa,tableMaxHeight:300},E=createContext(aa);var da=/\.[^/.]+$/,Xo=(e,t)=>{if(typeof e=="boolean")return e;let o=e.image;return o===false?false:o===true||o===void 0?true:o[t]!==false},Uo=({node:e,className:t,src:o,alt:n,onLoad:r,onError:s,onClick:a,...c})=>{let{DownloadIcon:i,XIcon:l}=_(),d=w(),u=useRef(null),[p,m]=useState(false),[f,g]=useState(false),[b,h]=useState(false),{controls:k}=useContext(E),x=V(),P=Xo(k,"download"),S=Xo(k,"fullscreen"),M=c.width!=null||c.height!=null,y=P&&(p||M)&&!f,D=f&&!M,B=S&&!!o&&!f&&p;useEffect(()=>{let R=u.current;if(R!=null&&R.complete){let F=R.naturalWidth>0;m(F),g(!F);}},[]),useEffect(()=>{if(!b)return;he();let R=F=>{F.key==="Escape"&&h(false);};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R),be();}},[b]);let $=useCallback(R=>{m(true),g(false),r==null||r(R);},[r]),z=useCallback(R=>{m(false),g(true),s==null||s(R);},[s]),H=useCallback(()=>{B&&h(true);},[B]),O=useCallback(()=>{h(false);},[]),W=useCallback(R=>{a==null||a(R),!R.defaultPrevented&&H();},[a,H]),Y=async R=>{if(R.stopPropagation(),!!o)try{let ae=await(await fetch(o)).blob(),te=new URL(o,window.location.origin).pathname.split("/").pop()||"",ce=te.split(".").pop(),oe=te.includes(".")&&ce!==void 0&&ce.length<=4,ee="";if(oe)ee=te;else {let K=ae.type,T="png";K.includes("jpeg")||K.includes("jpg")?T="jpg":K.includes("png")?T="png":K.includes("svg")?T="svg":K.includes("gif")?T="gif":K.includes("webp")&&(T="webp"),ee=`${(n||te||"image").replace(da,"")}.${T}`;}re(ee,ae,ae.type);}catch(F){window.open(o,"_blank");}};return o?o==="streamdown:incomplete-image"?jsx("div",{className:d("group relative my-4 inline-block"),"data-incomplete":"true","data-streamdown":"image-wrapper",children:jsx("div",{className:d("h-24 w-48 animate-pulse rounded-lg bg-muted"),"data-streamdown":"image-placeholder"})}):jsxs(Fragment,{children:[jsxs("div",{className:d("group/image not-prose relative my-2 block max-w-full"),"data-streamdown":"image-wrapper",children:[jsx("img",{alt:n,className:d("m-0 block h-auto max-w-full rounded-lg",B&&"cursor-zoom-in",D&&"hidden",t),"data-streamdown":"image",onClick:W,onError:z,onLoad:$,ref:u,src:o,...c}),D&&jsx("span",{className:d("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:x.imageNotAvailable}),y&&jsx("button",{className:d("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 focus-visible:opacity-100 group-hover/image:opacity-100"),onClick:Y,title:x.downloadImage,type:"button",children:jsx(i,{size:14})})]}),b?createPortal(jsxs("div",{className:d("fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"),"data-streamdown":"image-lightbox",onClick:O,onKeyDown:R=>{R.key==="Escape"&&O();},role:"button",tabIndex:0,children:[jsx("button",{className:d("absolute top-4 right-4 z-10 rounded-md p-2 text-white/80 transition-colors hover:bg-white/10 hover:text-white"),onClick:O,title:x.exitFullscreen,type:"button",children:jsx(l,{size:20})}),jsx("div",{onClick:R=>R.stopPropagation(),onKeyDown:R=>R.stopPropagation(),role:"presentation",children:jsx("img",{alt:n,className:d("max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] object-contain"),"data-streamdown":"image-lightbox-img",src:o})})]}),document.body):null]}):null};var Qo=({url:e,isOpen:t,onClose:o,onConfirm:n})=>{let{CheckIcon:r,CopyIcon:s,ExternalLinkIcon:a,XIcon:c}=_(),i=w(),[l,d]=useState(false),u=V(),p=useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3);}catch(g){}},[e]),m=useCallback(()=>{n(),o();},[n,o]);if(useEffect(()=>{if(t){he();let g=b=>{b.key==="Escape"&&o();};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),be();}}},[t,o]),!t||typeof document=="undefined")return null;let f=jsx("div",{className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:o,onKeyDown:g=>{g.key==="Escape"&&o();},role:"button",tabIndex:0,children:jsxs("div",{className:i("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:g=>g.stopPropagation(),onKeyDown:g=>g.stopPropagation(),role:"presentation",children:[jsx("button",{className:i("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:o,title:u.close,type:"button",children:jsx(c,{size:16})}),jsxs("div",{className:i("flex flex-col gap-2"),children:[jsxs("div",{className:i("flex items-center gap-2 font-semibold text-lg"),children:[jsx(a,{size:20}),jsx("span",{children:u.openExternalLink})]}),jsx("p",{className:i("text-muted-foreground text-sm"),children:u.externalLinkWarning})]}),jsx("div",{className:i("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:i("flex gap-2"),children:[jsx("button",{className:i("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:p,type:"button",children:l?jsxs(Fragment,{children:[jsx(r,{size:14}),jsx("span",{children:u.copied})]}):jsxs(Fragment,{children:[jsx(s,{size:14}),jsx("span",{children:u.copyLink})]})}),jsxs("button",{className:i("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:m,type:"button",children:[jsx(a,{size:14}),jsx("span",{children:u.openLink})]})]})]})});return createPortal(f,document.body)};var en=()=>e=>{visit(e,"html",(o,n,r)=>{!r||typeof n!="number"||(r.children[n]={type:"text",value:o.value});});};var on=[],nn={allowDangerousHtml:true},ht=new WeakMap,Kt=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,r=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(n||r||s)){let u="default";return this.keyCache.set(t,u),u}let a=u=>{if(!u||u.length===0)return "";let p="";for(let m=0;m<u.length;m+=1){let f=u[m];if(m>0&&(p+=","),Array.isArray(f)){let[g,b]=f;if(typeof g=="function"){let h=ht.get(g);h||(h=g.name,ht.set(g,h)),p+=h;}else p+=String(g);p+=":",p+=JSON.stringify(b);}else if(typeof f=="function"){let g=ht.get(f);g||(g=f.name,ht.set(f,g)),p+=g;}else p+=String(f);}return p},c=a(n),i=a(r),l=s?JSON.stringify(s):"",d=`${i}::${c}::${l}`;return this.keyCache.set(t,d),d}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 r=this.cache.keys().next().value;r&&this.cache.delete(r);}this.cache.set(n,o);}clear(){this.cache.clear();}},rn=new Kt,Ge=e=>{let t=Ta(e),o=e.children||"",n=t.runSync(t.parse(o),o);return Ra(n,e)},Ta=e=>{let t=rn.get(e);if(t)return t;let o=Sa(e);return rn.set(e,o),o},Pa=e=>e.some(t=>Array.isArray(t)?t[0]===tn:t===tn),Sa=e=>{let t=e.rehypePlugins||on,o=e.remarkPlugins||on,n=Pa(t)?o:[...o,en],r=e.remarkRehypeOptions?{...nn,...e.remarkRehypeOptions}:nn;return unified().use(wa).use(n).use(xa,r).use(t)},sn=e=>e,Ma=(e,t,o,n)=>{o?e.children.splice(t,1):e.children[t]={type:"text",value:n};},Ia=(e,t)=>{var o;for(let n in urlAttributes)if(Object.hasOwn(urlAttributes,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],s=urlAttributes[n];(s===null||s.includes(e.tagName))&&(e.properties[n]=(o=t(String(r||""),n,e))!=null?o:void 0);}},Ea=(e,t,o,n,r,s)=>{let a=false;return n?a=!n.includes(e.tagName):r&&(a=r.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,o)),a},Ra=(e,t)=>{let{allowElement:o,allowedElements:n,disallowedElements:r,skipHtml:s,unwrapDisallowed:a,urlTransform:c}=t;if(o||n||r||s||c){let l=c||sn;visit(e,(d,u,p)=>{if(d.type==="raw"&&p&&typeof u=="number")return Ma(p,u,s,d.value),u;if(d.type==="element"&&(Ia(d,l),Ea(d,u,p,n,r,o)&&p&&typeof u=="number"))return a&&d.children?p.children.splice(u,1,...d.children):p.children.splice(u,1),u});}return toJsxRuntime(e,{Fragment:Fragment,components:t.components,ignoreInvalidStyle:true,jsx:jsx,jsxs:jsxs,passKeys:true,passNode:true})};var bt=createContext(null),Gt=()=>useContext(bt),Ud=()=>{var t;let e=Gt();return (t=e==null?void 0:e.code)!=null?t:null},He=()=>{var t;let e=Gt();return (t=e==null?void 0:e.mermaid)!=null?t:null};var an=e=>{var o;let t=Gt();return t!=null&&t.renderers&&e&&(o=t.renderers.find(n=>Array.isArray(n.language)?n.language.includes(e):n.language===e))!=null?o:null};var Aa=/(<svg\b)/,dn=/<svg\b[^>]*>/i,Da=/\bviewBox=(['"])(.*?)\1/i,Ha=/\swidth=(['"]).*?\1/i,Ba=/\sheight=(['"]).*?\1/i,ln=/\sstyle=(['"])(.*?)\1/i,cn=/^<svg/i,Oa=/^width\s*:/i,_a=/^height\s*:/i,Va=/^max-width\s*:/i,$a=/[\s,]+/,Fa=e=>!e.includes("xlink:")||e.includes("xmlns:xlink")?e:e.replace(Aa,'$1 xmlns:xlink="http://www.w3.org/1999/xlink"'),mn=e=>{if(typeof DOMParser=="undefined"||typeof XMLSerializer=="undefined")return e;let o=new DOMParser().parseFromString(e,"text/html").querySelector("svg");return o?new XMLSerializer().serializeToString(o):e},Xt=e=>{let t=e.match(dn);if(!t)return null;let n=t[0].match(Da),r=n==null?void 0:n[2];if(!r)return null;let s=r.trim().split($a).map(i=>Number.parseFloat(i));if(s.length<4||s.slice(0,4).some(Number.isNaN))return null;let a=s[2],c=s[3];return a>0&&c>0?{height:c,width:a}:null},un=e=>{let t=e.match(dn);if(!t)return e;try{let o=t[0],n=Xt(e);if(!n)return e;let{width:r,height:s}=n,a=o.replace(Ha,"").replace(Ba,""),c=a.match(ln),i=`width:${r}px;height:${s}px;max-width:none;`;if(c){let l=c[1],u=c[2].split(";").map(m=>m.trim()).filter(Boolean).filter(m=>!(Oa.test(m)||_a.test(m)||Va.test(m))).join(";"),p=`${i}${u?`${u};`:""}`;a=a.replace(ln,` style=${l}${p}${l}`);}else a=a.replace(cn,`<svg style="${i}"`);return a=a.replace(cn,`<svg width="${r}" height="${s}"`),e.replace(o,a)}catch(o){return e}},pn=(e,t)=>{var n;let o=(n=void 0)!=null?n:5;return new Promise((r,s)=>{let a=Fa(e),c="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a))),i=new Image;i.crossOrigin="anonymous",i.onload=()=>{let l=document.createElement("canvas"),d=i.width*o,u=i.height*o;l.width=d,l.height=u;let p=l.getContext("2d");if(!p){s(new Error("Failed to create 2D canvas context for PNG export"));return}p.drawImage(i,0,0,d,u),l.toBlob(m=>{if(!m){s(new Error("Failed to create PNG blob"));return}r(m);},"image/png");},i.onerror=()=>s(new Error("Failed to load SVG image")),i.src=c;})};var yt=({chart:e,children:t,className:o,onDownload:n,config:r,onError:s})=>{let a=w(),[c,i]=useState(false),l=useRef(null),{isAnimating:d,controls:u}=useContext(E),p=_(),m=He(),f=V(),g=Ie(u,"mermaid","diagram"),b=async h=>{try{if(h==="mmd"){let y=`${g}.mmd`;re(y,e,"text/plain"),i(!1),n==null||n(h);return}if(!m){s==null||s(new Error("Mermaid plugin not available"));return}let k=m.getMermaid(r),x=e.split("").reduce((y,D)=>(y<<5)-y+D.charCodeAt(0)|0,0),P=`mermaid-${Math.abs(x)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:S}=await k.render(P,e);if(!S){s==null||s(new Error("SVG not found. Please wait for the diagram to render."));return}let M=mn(S);if(h==="svg"){let y=`${g}.svg`;re(y,M,"image/svg+xml"),i(!1),n==null||n(h);return}if(h==="png"){let y=await pn(M);re(`${g}.png`,y,"image/png"),n==null||n(h),i(!1);return}}catch(k){s==null||s(k);}};return useEffect(()=>{let h=k=>{let x=k.composedPath();l.current&&!x.includes(l.current)&&i(false);};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h);}},[]),jsxs("div",{className:a("relative"),ref:l,children:[jsx("button",{"aria-label":f.downloadDiagram,className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",o),disabled:d,onClick:()=>i(!c),title:f.downloadDiagram,type:"button",children:t!=null?t:jsx(p.DownloadIcon,{"aria-hidden":"true",size:14})}),c?jsxs("div",{className:a("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",{"aria-label":f.downloadDiagramAsSvg,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("svg"),title:f.downloadDiagramAsSvg,type:"button",children:f.mermaidFormatSvg}),jsx("button",{"aria-label":f.downloadDiagramAsPng,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("png"),title:f.downloadDiagramAsPng,type:"button",children:f.mermaidFormatPng}),jsx("button",{"aria-label":f.downloadDiagramAsMmd,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("mmd"),title:f.downloadDiagramAsMmd,type:"button",children:f.mermaidFormatMmd})]}):null]})};var bn=({chart:e,config:t,onFullscreen:o,onExit:n,className:r,...s})=>{let{Maximize2Icon:a,XIcon:c}=_(),i=w(),[l,d]=useState(false),{isAnimating:u,controls:p}=useContext(E),m=V(),f=(()=>{if(typeof p=="boolean")return p;let h=p.mermaid;return h===false?false:h===true||h===void 0?true:h.panZoom!==false})(),g=(()=>{if(typeof p=="boolean")return p;let h=p.mermaid;return h===false?false:h===true||h===void 0?true:h.download!==false})(),b=()=>{d(!l);};return useEffect(()=>{if(l){he();let h=k=>{k.key==="Escape"&&d(false);};return document.addEventListener("keydown",h),()=>{document.removeEventListener("keydown",h),be();}}},[l]),useEffect(()=>{l?o==null||o():n&&n();},[l,o,n]),jsxs(Fragment,{children:[jsx("button",{className:i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:u,onClick:b,title:m.viewFullscreen,type:"button",...s,"aria-label":m.viewFullscreen,children:jsx(a,{"aria-hidden":"true",size:14})}),l?createPortal(jsxs("div",{"aria-label":m.viewFullscreen,"aria-modal":"true",className:i("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),"data-streamdown":"mermaid-fullscreen",onClick:b,onKeyDown:h=>{h.key==="Escape"&&b();},role:"dialog",children:[jsxs("div",{className:i("absolute top-4 right-4 z-10 flex items-center gap-1"),onClick:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),role:"presentation",children:[g?jsx(yt,{chart:e,config:t}):null,jsx("button",{"aria-label":m.exitFullscreen,className:i("rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:b,title:m.exitFullscreen,type:"button",children:jsx(c,{"aria-hidden":"true",size:20})})]}),jsx("div",{className:i("flex size-full items-center justify-center p-4"),onClick:h=>h.stopPropagation(),onKeyDown:h=>h.stopPropagation(),role:"presentation",children:jsx(hn,{chart:e,className:i("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:t,fullscreen:true,showControls:f})})]}),document.body):null]})};function Jt(e){var o;if(e.nodeType===Node.TEXT_NODE)return (o=e.textContent)!=null?o:"";if(e.nodeType!==Node.ELEMENT_NODE)return "";let t=e;return t.tagName==="BR"?`
6
- `:Array.from(t.childNodes).map(Jt).join("")}var Be=e=>{let t=[],o=[],n=e.querySelectorAll("thead th");for(let s of n)t.push(Jt(s).trim());let r=e.querySelectorAll("tbody tr");for(let s of r){let a=[],c=s.querySelectorAll("td");for(let i of c)a.push(Jt(i).trim());o.push(a);}return {headers:t,rows:o}},Ue=e=>{var o;if(typeof e!="object")return ",";let t=e.table;return typeof t!="object"?",":(o=t.csvSeparator)!=null?o:","},Le=(e,t=",")=>{let o;t==="auto"?Intl.NumberFormat().format(1.1).includes(",")?o=";":o=",":o=t;let{headers:n,rows:r}=e,s=l=>{let d=false;for(let u of l)if(u===o||u==='"'||u===`
7
- `||u==="\r"){d=true;break}return d?`"${l.replace(/"/g,'""')}"`:l},a=n.length>0?r.length+1:r.length,c=new Array(a),i=0;n.length>0&&(c[i]=n.map(s).join(o),i+=1);for(let l of r)c[i]=l.map(s).join(o),i+=1;return c.join(`
8
- `)},Yt=e=>{let{headers:t,rows:o}=e,n=c=>{let i=false;for(let d of c)if(d===" "||d===`
9
- `||d==="\r"){i=true;break}if(!i)return c;let l=[];for(let d of c)d===" "?l.push("\\t"):d===`
10
- `?l.push("\\n"):d==="\r"?l.push("\\r"):l.push(d);return l.join("")},r=t.length>0?o.length+1:o.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(n).join(" "),a+=1);for(let c of o)s[a]=c.map(n).join(" "),a+=1;return s.join(`
11
- `)},Ct=e=>{let t=false;for(let n of e)if(n==="\\"||n==="|"||n===`
12
- `){t=true;break}if(!t)return e;let o=[];for(let n of e)n==="\\"?o.push("\\\\"):n==="|"?o.push("\\|"):n===`
13
- `?o.push("<br>"):o.push(n);return o.join("")},Oe=e=>{let{headers:t,rows:o}=e;if(t.length===0)return "";let n=new Array(o.length+2),r=0,s=t.map(c=>Ct(c));n[r]=`| ${s.join(" | ")} |`,r+=1;let a=new Array(t.length);for(let c=0;c<t.length;c+=1)a[c]="---";n[r]=`| ${a.join(" | ")} |`,r+=1;for(let c of o)if(c.length<t.length){let i=new Array(t.length);for(let l=0;l<t.length;l+=1)i[l]=l<c.length?Ct(c[l]):"";n[r]=`| ${i.join(" | ")} |`,r+=1;}else {let i=c.map(l=>Ct(l));n[r]=`| ${i.join(" | ")} |`,r+=1;}return n.join(`
14
- `)};var Ye=({children:e,className:t,onCopy:o,onError:n,timeout:r=2e3})=>{let s=w(),[a,c]=useState(false),[i,l]=useState(false),d=useRef(null),u=useRef(0),{isAnimating:p,controls:m}=useContext(E),f=V(),g=Ue(m),b=async x=>{var P,S;if(typeof window=="undefined"||!((P=navigator==null?void 0:navigator.clipboard)!=null&&P.write)){n==null||n(new Error("Clipboard API not available"));return}try{let M=(S=d.current)==null?void 0:S.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),y=M==null?void 0:M.querySelector("table");if(!y){n==null||n(new Error("Table not found"));return}let D=Be(y),B="";x==="csv"?B=Le(D,g):x==="tsv"?B=Yt(D):B=Oe(D);let $=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([y.outerHTML],{type:"text/html"})});await navigator.clipboard.write([$]),l(!0),c(!1),o==null||o(x),u.current=window.setTimeout(()=>l(!1),r);}catch(M){n==null||n(M);}};useEffect(()=>{let x=P=>{let S=P.composedPath();d.current&&!S.includes(d.current)&&c(false);};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x),window.clearTimeout(u.current);}},[]);let h=_(),k=i?h.CheckIcon:h.CopyIcon;return jsxs("div",{className:s("relative"),ref:d,children:[jsx("button",{className:s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:p,onClick:()=>c(!a),title:f.copyTable,type:"button",children:e!=null?e:jsx(k,{height:14,width:14})}),a?jsxs("div",{className:s("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("md"),title:f.copyTableAsMarkdown,type:"button",children:f.tableFormatMarkdown}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("csv"),title:f.copyTableAsCsv,type:"button",children:f.tableFormatCsv}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>b("tsv"),title:f.copyTableAsTsv,type:"button",children:f.tableFormatTsv})]}):null]})};var ti=({children:e,className:t,onDownload:o,onError:n,format:r="csv",filename:s})=>{let a=w(),{isAnimating:c,controls:i}=useContext(E),l=V(),d=_(),u=Ue(i),p=m=>{try{let g=m.currentTarget.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),b=g==null?void 0:g.querySelector("table");if(!b){n==null||n(new Error("Table not found"));return}let h=Be(b),k="",x="",P="";switch(r){case "csv":k=Le(h,u),x="text/csv",P="csv";break;case "markdown":k=Oe(h),x="text/markdown",P="md";break;default:k=Le(h,u),x="text/csv",P="csv";}re(`${s||Ie(i,"table","table")}.${P}`,k,x),o==null||o();}catch(f){n==null||n(f);}};return jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:c,onClick:p,title:r==="csv"?l.downloadTableAsCsv:l.downloadTableAsMarkdown,type:"button",children:e!=null?e:jsx(d.DownloadIcon,{size:14})})},Qe=({children:e,className:t,onDownload:o,onError:n})=>{let r=w(),[s,a]=useState(false),c=useRef(null),{isAnimating:i,controls:l}=useContext(E),d=V(),u=_(),p=Ue(l),m=f=>{var g;try{let b=(g=c.current)==null?void 0:g.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),h=b==null?void 0:b.querySelector("table");if(!h){n==null||n(new Error("Table not found"));return}let k=Be(h),x=f==="csv"?Le(k,p):Oe(k),P=f==="csv"?"csv":"md",S=`${Ie(l,"table","table")}.${P}`;re(S,x,f==="csv"?"text/csv":"text/markdown"),a(!1),o==null||o(f);}catch(b){n==null||n(b);}};return useEffect(()=>{let f=g=>{let b=g.composedPath();c.current&&!b.includes(c.current)&&a(false);};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[]),jsxs("div",{className:r("relative"),ref:c,children:[jsx("button",{className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i,onClick:()=>a(!s),title:d.downloadTable,type:"button",children:e!=null?e:jsx(u.DownloadIcon,{size:14})}),s?jsxs("div",{className:r("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),children:[jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>m("csv"),title:d.downloadTableAsCsv,type:"button",children:d.tableFormatCsv}),jsx("button",{className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>m("markdown"),title:d.downloadTableAsMarkdown,type:"button",children:d.tableFormatMarkdown})]}):null]})};var kn=({children:e,className:t,showCopy:o=true,showDownload:n=true})=>{let{Maximize2Icon:r,XIcon:s}=_(),a=w(),[c,i]=useState(false),{isAnimating:l}=useContext(E),d=V(),u=()=>{i(true);},p=()=>{i(false);};return useEffect(()=>{if(c){he();let m=f=>{f.key==="Escape"&&i(false);};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),be();}}},[c]),jsxs(Fragment,{children:[jsx("button",{className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:l,onClick:u,title:d.viewFullscreen,type:"button",children:jsx(r,{size:14})}),c?createPortal(jsx("div",{"aria-label":d.viewFullscreen,"aria-modal":"true",className:a("fixed inset-0 z-50 flex flex-col bg-background"),"data-streamdown":"table-fullscreen",onClick:p,onKeyDown:m=>{m.key==="Escape"&&p();},role:"dialog",children:jsxs("div",{className:a("flex h-full flex-col"),onClick:m=>m.stopPropagation(),onKeyDown:m=>m.stopPropagation(),role:"presentation",children:[jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[o?jsx(Ye,{}):null,n?jsx(Qe,{}):null,jsx("button",{className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:p,title:d.exitFullscreen,type:"button",children:jsx(s,{size:20})})]}),jsx("div",{className:a("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),children:jsx("table",{className:a("w-full table-fixed border-collapse border border-border"),"data-streamdown":"table",children:e})})]})}),document.body):null]})};var Pn=({children:e,className:t,maxHeight:o,showControls:n,showCopy:r=true,showDownload:s=true,showFullscreen:a=true,...c})=>{let i=w(),{isAnimating:l,scrollable:d}=useContext(E),u=d!=null?d:ze,p=lt(o),m=dt({content:e,enabled:!!p,isAnimating:l}),f=n&&r,g=n&&s,b=n&&a,h=f||g||b;return jsxs("div",{className:i("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),"data-streamdown":"table-wrapper",children:[h?jsxs("div",{className:i("flex items-center justify-end gap-1"),children:[f?jsx(Ye,{}):null,g?jsx(Qe,{}):null,b?jsx(kn,{showCopy:f,showDownload:g,children:e}):null]}):null,jsx(u,{className:i("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),scrollRef:m,style:p?{maxHeight:p}:void 0,children:jsx("table",{className:i("w-full min-w-max table-fixed divide-y divide-border",t),"data-streamdown":"table",...c,children:e})})]})};var ui=/startLine=(\d+)/,pi=/\bnoLineNumbers\b/,fi=lazy(()=>import('./mermaid-63FZT5UZ.js').then(e=>({default:e.Mermaid}))),gi=/language-([^\s]+)/,le=e=>e.props,hi="node";function A(e,t){let o=Object.keys(e);if(o.length!==Object.keys(t).length)return false;let n=e,r=t;for(let s of o)if(s!==hi&&!Object.is(n[s],r[s]))return false;return true}function bi(e,t){var o,n;return ((o=e==null?void 0:e.properties)==null?void 0:o.metastring)===((n=t==null?void 0:t.properties)==null?void 0:n.metastring)}function yi(e){if(typeof e=="string")return e;if(isValidElement(e)){let t=le(e).children;if(typeof t=="string")return t}}var oo=(e,t)=>typeof e=="boolean"?e:e[t]!==false,to=(e,t)=>{if(typeof e=="boolean")return e;let o=e.table;return o===false?false:o===true||o===void 0?true:o[t]!==false},Mn=(e,t)=>{if(typeof e=="boolean")return e;let o=e.code;return o===false?false:o===true||o===void 0?true:o[t]!==false},wt=(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},tt=createContext({depth:0,ulDepth:0,isUnordered:false}),Ci={flat:["list-disc"],hierarchical:["list-disc","list-[circle]","list-[square]"]},no=memo(({children:e,className:t,node:o,...n})=>{let r=w(),{depth:s,ulDepth:a}=useContext(tt),c=useMemo(()=>({depth:s+1,ulDepth:a,isUnordered:false}),[s,a]);return jsx("ol",{className:r("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-depth":s,"data-streamdown":"ordered-list",...n,children:jsx(tt.Provider,{value:c,children:e})})},(e,t)=>A(e,t));no.displayName="MarkdownOl";var Ln=memo(({children:e,className:t,node:o,...n})=>{var g;let r=w(),{depth:s,ulDepth:a,isUnordered:c}=useContext(tt),{listStyle:i}=useContext(E),l=Ci[i],d=c&&a>0?l[(a-1)%l.length]:void 0,u=Array.isArray(e)?e.filter(b=>b!==`
15
- `&&b!==""):[e],p=u[0],m=isValidElement(p)?(g=le(p).node)==null?void 0:g.tagName:void 0,f=u.length===1&&isValidElement(p)&&(p.type==="p"||m==="p")?le(p).children:e;return t!=null&&t.includes("task-list-item")?jsx("li",{className:r("my-1 flex list-none items-center gap-2 [&>input]:m-0 [&>p]:inline",t),"data-depth":s>0?s-1:0,"data-streamdown":"list-item",...n,children:f}):jsx("li",{className:r("py-1 [&>p]:inline",d,t),"data-depth":s>0?s-1:0,"data-streamdown":"list-item",...n,children:f})},(e,t)=>A(e,t));Ln.displayName="MarkdownLi";var Nn=memo(({children:e,className:t,node:o,...n})=>{let r=w(),{depth:s,ulDepth:a}=useContext(tt),c=useMemo(()=>({depth:s+1,ulDepth:a+1,isUnordered:true}),[s,a]);return jsx("ul",{className:r("list-inside whitespace-normal [li_&]:pl-6",t),"data-depth":s,"data-streamdown":"unordered-list",...n,children:jsx(tt.Provider,{value:c,children:e})})},(e,t)=>A(e,t));Nn.displayName="MarkdownUl";var An=memo(({className:e,node:t,...o})=>{let n=w();return jsx("hr",{className:n("my-6 border-border",e),"data-streamdown":"horizontal-rule",...o})},(e,t)=>A(e,t));An.displayName="MarkdownHr";var Dn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...n,children:e})},(e,t)=>A(e,t));Dn.displayName="MarkdownStrong";var wi=({children:e,className:t,href:o,node:n,...r})=>{let s=w(),{linkSafety:a}=useContext(E),[c,i]=useState(false),l=o==="streamdown:incomplete-link",d=useCallback(async f=>{if(!(!(a!=null&&a.enabled&&o)||l)){if(f.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(o)){window.open(o,"_blank","noreferrer");return}i(true);}},[a,o,l]),u=useCallback(()=>{o&&window.open(o,"_blank","noreferrer");},[o]),p=useCallback(()=>{i(false);},[]),m={url:o!=null?o:"",isOpen:c,onClose:p,onConfirm:u};return a!=null&&a.enabled&&o?jsxs(Fragment,{children:[jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(m):jsx(Qo,{...m})]}):jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":l,"data-streamdown":"link",href:o,rel:"noreferrer",target:"_blank",...r,children:e})},Hn=memo(wi,(e,t)=>A(e,t));Hn.displayName="MarkdownA";var Bn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e})},(e,t)=>A(e,t));Bn.displayName="MarkdownH1";var On=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e})},(e,t)=>A(e,t));On.displayName="MarkdownH2";var _n=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e})},(e,t)=>A(e,t));_n.displayName="MarkdownH3";var Vn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e})},(e,t)=>A(e,t));Vn.displayName="MarkdownH4";var $n=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e})},(e,t)=>A(e,t));$n.displayName="MarkdownH5";var Fn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e})},(e,t)=>A(e,t));Fn.displayName="MarkdownH6";var jn=memo(({children:e,className:t,node:o,...n})=>{let{controls:r,tableMaxHeight:s}=useContext(E),a=oo(r,"table"),c=to(r,"copy"),i=to(r,"download"),l=to(r,"fullscreen");return jsx(Pn,{className:t,maxHeight:s,showControls:a,showCopy:c,showDownload:i,showFullscreen:l,...n,children:e})},(e,t)=>A(e,t));jn.displayName="MarkdownTable";var zn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e})},(e,t)=>A(e,t));zn.displayName="MarkdownThead";var Wn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...n,children:e})},(e,t)=>A(e,t));Wn.displayName="MarkdownTbody";var qn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...n,children:e})},(e,t)=>A(e,t));qn.displayName="MarkdownTr";var Zn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("th",{className:r("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e})},(e,t)=>A(e,t));Zn.displayName="MarkdownTh";var Kn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("td",{className:r("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e})},(e,t)=>A(e,t));Kn.displayName="MarkdownTd";var Gn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e})},(e,t)=>A(e,t));Gn.displayName="MarkdownBlockquote";var Xn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...n,children:e})},(e,t)=>A(e,t));Xn.displayName="MarkdownSup";var xi=()=>({}),vi=e=>{try{let t=atob(e),o=Uint8Array.from(t,n=>n.charCodeAt(0));return new TextDecoder().decode(o)}catch(t){return ""}},Un=memo(({children:e,className:t,node:o,...n})=>{let r=w(),{calloutIcon:s,calloutStyle:a,components:c,remarkPlugins:i,rehypePlugins:l}=useContext(E),d=n,u=d["data-callout-title"],p=d["data-callout-color"],m=d["data-callout-icon"],f=d["data-callout-body"],g=f?vi(f):"",b=(a!=null?a:xi)(p),h=m&&s?s(m):null;return jsxs("div",{className:r("my-4 rounded-md border-l-4 px-4 py-3 [&>p:last-child]:mb-0",t),"data-streamdown":"callout",style:b,...n,children:[u!==void 0?jsxs("p",{className:"mb-1 flex items-center gap-2 font-semibold [&>svg]:inline-block",children:[h,u]}):null,g.trim().length>0?jsx(Ge,{components:c,rehypePlugins:l,remarkPlugins:i,children:g}):null]})},(e,t)=>A(e,t));Un.displayName="MarkdownCallout";var In={"markdown-alert-note":"border-l-blue-500 bg-blue-500/5 [&_.markdown-alert-title]:text-blue-600 dark:[&_.markdown-alert-title]:text-blue-400","markdown-alert-tip":"border-l-green-600 bg-green-600/5 [&_.markdown-alert-title]:text-green-700 dark:[&_.markdown-alert-title]:text-green-400","markdown-alert-important":"border-l-purple-600 bg-purple-600/5 [&_.markdown-alert-title]:text-purple-700 dark:[&_.markdown-alert-title]:text-purple-400","markdown-alert-warning":"border-l-amber-600 bg-amber-600/5 [&_.markdown-alert-title]:text-amber-700 dark:[&_.markdown-alert-title]:text-amber-400","markdown-alert-caution":"border-l-red-600 bg-red-600/5 [&_.markdown-alert-title]:text-red-700 dark:[&_.markdown-alert-title]:text-red-400"},Jn=memo(({children:e,className:t,node:o,...n})=>{let r=w(),s=t==null?void 0:t.includes("markdown-alert");if(t==null?void 0:t.includes("sdm-callout"))return jsx(Un,{className:t,node:o,...n,children:e});if(s){let c=Object.keys(In).find(i=>t==null?void 0:t.includes(i));return jsx("div",{className:r("my-4 rounded-r-md border-muted-foreground/30 border-l-4 bg-muted/40 px-4 py-3 [&>p:last-child]:mb-0",c?In[c]:null,t),...n,children:e})}return jsx("div",{className:r(t),...n,children:e})},(e,t)=>A(e,t));Jn.displayName="MarkdownDiv";var Yn=memo(({children:e,className:t,node:o,...n})=>{let r=w();return jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...n,children:e})},(e,t)=>A(e,t));Yn.displayName="MarkdownSub";var Qn=memo(({children:e,className:t,node:o,...n})=>{if("data-footnotes"in n){let s=i=>{if(!isValidElement(i))return false;let l=le(i).children,d=Array.isArray(l)?l:[l],u=false,p=false;for(let m of d)if(m){if(typeof m=="string")m.trim()!==""&&(u=true);else if(isValidElement(m))if(le(m)["data-footnote-backref"]!==void 0)p=true;else {let f=le(m).children,g=Array.isArray(f)?f:[f];for(let b of g){if(typeof b=="string"&&b.trim()!==""){u=true;break}if(isValidElement(b)&&le(b)["data-footnote-backref"]===void 0){u=true;break}}}}return p&&!u},a=Array.isArray(e)?e.map(i=>{if(!isValidElement(i))return i;if(i.type===no){let l=le(i).children,u=(Array.isArray(l)?l:[l]).filter(p=>!s(p));return u.length===0?null:{...i,props:{...le(i),children:u}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?jsx("section",{className:t,...n,children:a}):null}return jsx("section",{className:t,...n,children:e})},(e,t)=>A(e,t));Qn.displayName="MarkdownSection";var ki=({node:e,className:t,children:o,...n})=>{var z,H,O;let r=w(),s=!("data-block"in n),{mermaid:a,controls:c,lineNumbers:i}=useContext(E),l=He(),d=Dt(),u=t==null?void 0:t.match(gi),p=(z=u==null?void 0:u.at(1))!=null?z:"",m=an(p);if(s)return jsx("code",{className:r("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:o});let f=(H=e==null?void 0:e.properties)==null?void 0:H.metastring,g=typeof f=="string"?f:void 0,b=g==null?void 0:g.match(ui),h=b?Number.parseInt(b[1],10):void 0,k=h!==void 0&&h>=1?h:void 0,P=!(g?pi.test(g):false)&&i!==false,S=(O=yi(o))!=null?O:"";if(m){let W=m.component;return jsx(Suspense,{fallback:jsx(gt,{}),children:jsx(W,{code:S,isIncomplete:d,language:p,meta:g})})}if(p==="mermaid"&&l){let W=oo(c,"mermaid"),Y=wt(c,"download"),Q=wt(c,"copy"),R=wt(c,"fullscreen"),F=wt(c,"panZoom"),ae=W&&(Y||Q||R);return jsx(Suspense,{fallback:jsx(gt,{}),children:jsxs("div",{className:r("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2",t),"data-incomplete":d||void 0,"data-streamdown":"mermaid-block",children:[jsx("div",{className:r("flex h-8 items-center text-muted-foreground text-xs"),children:jsx("span",{className:r("ml-1 font-mono lowercase"),children:"mermaid"})}),ae?jsx("div",{className:r("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:jsxs("div",{className:r("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:[Y?jsx(yt,{chart:S,config:a==null?void 0:a.config}):null,Q?jsx(ft,{code:S}):null,R?jsx(bn,{chart:S,config:a==null?void 0:a.config}):null]})}):null,jsx("div",{className:r("rounded-md border border-border bg-background"),children:jsx(fi,{chart:S,config:a==null?void 0:a.config,showControls:F})})]})})}let M=oo(c,"code"),y=Mn(c,"download"),D=Mn(c,"copy"),{"data-block":B,...$}=n;return jsx(Vt,{className:t,code:S,isIncomplete:d,language:p,lineNumbers:P,startLine:k,...$,children:M?jsxs(Fragment,{children:[y?jsx(jt,{code:S,language:p}):null,D?jsx(ft,{}):null]}):null})},er=memo(ki,(e,t)=>A(e,t)&&bi(e.node,t.node));er.displayName="MarkdownCode";var tr=memo(Uo,(e,t)=>A(e,t));tr.displayName="MarkdownImg";var En={caution:"alertCaution",important:"alertImportant",note:"alertNote",tip:"alertTip",warning:"alertWarning"},or=memo(({children:e,className:t,node:o,...n})=>{let r=w(),s=V(),a=n["data-alert-type"],c=a&&a in En?En[a]:void 0,i=c?s[c]:void 0,l=e;return i&&(l=[...(Array.isArray(e)?e:[e]).filter(p=>!(typeof p=="string"&&p.trim().length>0)),i]),jsx("p",{className:r("mb-1 flex items-center gap-2 font-semibold [&>svg]:inline-block",t),...n,children:l})},(e,t)=>A(e,t));or.displayName="MarkdownAlertTitle";var nr=memo(({children:e,className:t,node:o,...n})=>{if(t!=null&&t.includes("markdown-alert-title"))return jsx(or,{className:t,node:o,...n,children:e});let s=(Array.isArray(e)?e:[e]).filter(a=>a!=null&&a!=="");if(s.length===1&&isValidElement(s[0])){let a=le(s[0]).node,c=a==null?void 0:a.tagName;if(c==="img")return jsx(Fragment,{children:e});if(c==="code"&&"data-block"in s[0].props)return jsx(Fragment,{children:e})}return jsx("p",{className:t,...n,children:e})},(e,t)=>A(e,t));nr.displayName="MarkdownParagraph";var rr={ol:no,li:Ln,ul:Nn,hr:An,strong:Dn,a:Hn,h1:Bn,h2:On,h3:_n,h4:Vn,h5:$n,h6:Fn,table:jn,thead:zn,tbody:Wn,tr:qn,th:Zn,td:Kn,blockquote:Gn,code:er,div:Jn,img:tr,pre:({children:e})=>isValidElement(e)?cloneElement(e,{"data-block":"true"}):e,sup:Xn,sub:Yn,p:nr,section:Qn};var Ti=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,Pi=/\p{L}/u;function ot(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,"").replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,""),o,n=0,r=0;for(let s of t){if(Ti.test(s)){o!=null||(o="rtl"),r+=1;continue}Pi.test(s)&&(o!=null||(o="ltr"),n+=1);}return r>n?"rtl":n>r?"ltr":o!=null?o:"ltr"}var Si=/^[ \t]{0,3}(`{3,}|~{3,})/;var sr=e=>{let t=e.split(`
16
- `),o=null,n=0;for(let r of t){let s=Si.exec(r);if(o===null){if(s){let a=s[1];o=a[0],n=a.length;}}else if(s){let a=s[1],c=a[0],i=a.length;c===o&&i>=n&&(o=null,n=0);}}return o!==null};var Ii=/\[\^[\w-]{1,200}\](?!:)/,Ei=/\[\^[\w-]{1,200}\]:/,Ri=/<([A-Za-z][\w:-]*)[\s>/]/,Li=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ar=new Map,ir=new Map,dr=e=>{let t=e.toLowerCase(),o=ar.get(t);if(o)return o;let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return ar.set(t,n),n},Ni=e=>{let t=e.toLowerCase(),o=ir.get(t);if(o)return o;let n=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return ir.set(t,n),n},lr=(e,t)=>{if(Li.has(t.toLowerCase()))return 0;let o=e.match(dr(t));if(!o)return 0;let n=0;for(let r of o)r.trimEnd().endsWith("/>")||(n+=1);return n},cr=(e,t)=>{let o=e.match(Ni(t));return o?o.length:0},Ai=(e,t)=>{let o=e.match(dr(t));return !!o&&o.every(n=>n.trimEnd().endsWith("/>"))},Di=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},vt=e=>{let t=Ii.test(e),o=Ei.test(e);if(t||o)return [e];let n=Lexer.lex(e,{gfm:true}),r=[],s=[],a=false;for(let c of n){let i=c.raw,l=r.length;if(s.length>0){r[l-1]+=i;let d=s.at(-1),u=lr(i,d),p=cr(i,d);for(let m=0;m<u;m+=1)s.push(d);for(let m=0;m<p;m+=1)s.length>0&&s.at(-1)===d&&s.pop();continue}if(c.type==="html"&&c.block){let d=i.match(Ri);if(d){let u=d[1],p=lr(i,u),m=cr(i,u);p>m&&!Ai(i,u)&&s.push(u);}}if(l>0&&!a){let d=r[l-1];if(Di(d)%2===1){r[l-1]=d+i;continue}}r.push(i),c.type!=="space"&&(a=c.type==="code");}return r},ro=(e,t,o=vt)=>{if(!(t!=null&&t.source&&e.startsWith(t.source)))return {source:e,blocks:o(e)};if(e===t.source)return t;if(t.blocks.length<=1)return {source:e,blocks:o(e)};let n=t.blocks.slice(0,-1),r=0;for(let i of n)r+=i.length;let s=e.slice(0,r);if(n.join("")!==s)return {source:e,blocks:o(e)};let a=e.slice(r),c=o(a);return {source:e,blocks:[...n,...c]}};var Hi=/^\n*/,Bi=/\n*$/,so=/\n\n/g,Oi=(e,t,o)=>{if(!t.includes(`
17
- `))return e+t+o;let r=t.replace(so,`
18
- <!---->
19
- `).replace(Hi,`
20
-
21
- `).replace(Bi,`
22
-
23
- `);return `${e}${r}${o}
24
-
25
- `},_i=(e,t)=>{let o=new RegExp(`<(${t})(?=[\\s>/])([^>]*)>`,"gi"),n="",r=0,s=o.exec(e);for(;s;){let a=s[0],c=s[1],i=s.index+a.length,l=e.slice(i);if(new RegExp(`</${c}\\s*>`,"i").test(l)){s=o.exec(e);continue}if(n+=e.slice(r,s.index),l.length===0){n+=a,r=i,s=o.exec(e);continue}if(l.startsWith(`
26
-
27
- `)){let m=l.slice(2).replace(so,`
28
- <!---->
29
- `);n+=`${a}
30
-
31
- ${m}`,r=e.length;break}if(!l.startsWith(`
32
- `)){n+=a,r=i,s=o.exec(e);continue}let u=l.slice(1);if(u.trim().length===0){n+=a,r=i,s=o.exec(e);continue}let p=u.replace(so,`
33
- <!---->
34
- `);n+=`${a}
35
-
36
- ${p}`,r=e.length;break}return r===0?e:n+e.slice(r)},mr=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`<${n}(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^"'>])*)\\/>`,"gi");o=o.replace(r,(s,a)=>`<${n}${a}></${n}>`);}for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,c,i)=>Oi(a,c,i)),o=_i(o,n);}return o};var Vi=/([\\`*_~[\]|])/g,$i=e=>e.replace(Vi,"\\$1"),ur=(e,t)=>{if(!t.length)return e;let o=e;for(let n of t){let r=new RegExp(`(<${n}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${n}\\s*>)`,"gi");o=o.replace(r,(s,a,c,i)=>{let l=$i(c).replace(/\n\n/g,"&#10;&#10;");return a+l+i});}return o};var ji=new Set(["blockquote","dd","dt","figcaption","h1","h2","h3","h4","h5","h6","li","p","td","th"]),pr=new Set(["code","kbd","pre","samp","var"]);function fr(e){return e.children.map(t=>t.type==="text"?t.value:t.type==="element"&&!pr.has(t.tagName)?fr(t):"").join("")}function gr(){return e=>{visit(e,"element",t=>{if(pr.has(t.tagName)){(t.properties)!=null||(t.properties={}),t.properties.dir="ltr";return}ji.has(t.tagName)&&((t.properties)!=null||(t.properties={}),typeof t.properties.dir!="string"&&(t.properties.dir=ot(fr(t))));});}}var hr=e=>t=>{if(!e||e.length===0)return;let o=new Set(e.map(n=>n.toLowerCase()));visit(t,"element",n=>{var s;if(!o.has(n.tagName.toLowerCase()))return;let r=n.children.filter(a=>a.type==="element").map(a=>{var c;return {tag:a.tagName,props:(c=a.properties)!=null?c:{},text:toText(a).trim()}});n.properties=(s=n.properties)!=null?s:{},n.properties["data-content"]=JSON.stringify(r),n.children=[];});};var br=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(br).join(""):"",yr=e=>t=>{if(!e||e.length===0)return;let o=new Set(e.map(n=>n.toLowerCase()));visit(t,"element",n=>{if(o.has(n.tagName.toLowerCase())){let r=br(n);n.children=r?[{type:"text",value:r}]:[];}});};var Ui=e=>e.children.every(t=>t.type==="text"||t.type==="comment"),Ji=e=>e.children.map(t=>t.type==="text"?t.value:"").join(""),Yi=e=>{let t=unified().use(wa).use(xa,{allowDangerousHtml:true}),o=t.parse(e);return t.runSync(o).children},Cr=(e,t=[])=>o=>{if(!e||e.length===0)return;let n=new Set(e.map(s=>s.toLowerCase())),r=new Set((t!=null?t:[]).map(s=>s.toLowerCase()));visit(o,"element",s=>{let a=s.tagName.toLowerCase();if(!n.has(a)||r.has(a)||!Ui(s))return;let c=Ji(s);if(!c.includes(`
37
- `))return;let i=Yi(c);s.children=i;});};var wr=()=>e=>{visit(e,"code",t=>{var o,n;t.meta&&(t.data=(o=t.data)!=null?o:{},t.data.hProperties={...(n=t.data.hProperties)!=null?n:{},metastring:t.meta});});};var xr=/^>>>[ \t]?(.*)$/,el=/^<<<\s*$/,tl=/^>+\s*$/,ol=/^<+\s*$/,nl=/^\s*(?:\((?<iconParen>[a-z0-9-]+)\)|\{(?<iconBrace>[a-z0-9-]+)\}(?=\s*\[))?\s*(?:\[(?<title>[^\]]*)\])?\s*(?:\{(?<color>[^}]*)\})?\s*$/i,rl=/^(?:#[0-9a-f]{3,8}|[a-z]+)$/i,sl=/^[a-z0-9-]+$/,al=e=>{let t=nl.exec(e);if(!(t!=null&&t.groups))return {};let{iconParen:o,iconBrace:n,title:r,color:s}=t.groups,a=o!=null?o:n;return {icon:a&&sl.test(a)?a:void 0,title:r!==void 0&&r.length>0?r:void 0,color:s&&rl.test(s)?s:void 0}},ao=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),il=e=>{let t=new TextEncoder().encode(e),o="";for(let n of t)o+=String.fromCharCode(n);return btoa(o)},ll=(e,t)=>{var l;let o=xr.exec(e[t]),n=(l=o==null?void 0:o[1])!=null?l:"",r=al(n),s=[],a=t+1;for(;a<e.length;a+=1){let d=e[a];if(el.test(d)){a+=1;break}if(tl.test(d)||ol.test(d)){a+=1;break}s.push(d);}let c=s.join(`
38
- `).trim();return {replacement:`<div ${['class="sdm-callout"',r.title!==void 0?`data-callout-title="${ao(r.title)}"`:"",r.color!==void 0?`data-callout-color="${ao(r.color)}"`:"",r.icon!==void 0?`data-callout-icon="${ao(r.icon)}"`:"",`data-callout-body="${il(c)}"`].filter(Boolean).join(" ")}></div>`,next:a}},vr=e=>{if(!e.includes(">>>"))return e;let t=e.split(`
39
- `),o=[],n=0,r=false;for(;n<t.length;)if(xr.test(t[n])){let s=ll(t,n);o.push(s.replacement),n=s.next,r=true;}else o.push(t[n]),n+=1;return r?o.join(`
40
- `):e},kr=()=>()=>{};var ml={NOTE:{icon:"info",kind:"note",title:"Note",iconPaths:[{d:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"}]},TIP:{icon:"light-bulb",kind:"tip",title:"Tip",iconPaths:[{d:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z"}]},IMPORTANT:{icon:"report",kind:"important",title:"Important",iconPaths:[{d:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}]},WARNING:{icon:"alert",kind:"warning",title:"Warning",iconPaths:[{d:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",fillRule:"evenodd"}]},CAUTION:{icon:"stop",kind:"caution",title:"Caution",iconPaths:[{d:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25a.749.749 0 0 1-.53.22H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"}]}},ul=/^\[!(note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i,Tr=e=>{if(e.type==="text")return e.value;let t=e.children;if(!t)return "";let o="";for(let n of t)o+=Tr(n);return o},pl=e=>{let t=e.iconPaths.map(o=>`<path d="${o.d}"${o.fillRule?` fill-rule="${o.fillRule}"`:""}></path>`).join("");return {type:"paragraph",children:[{type:"html",value:`<svg class="octicon octicon-${e.icon}" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true">${t}</svg>`},{type:"text",value:e.title}],data:{hName:"p",hProperties:{className:["markdown-alert-title"],"data-alert-type":e.kind}}}},fl=e=>{var u,p;let t=e.children[0];if(!t||t.type!=="paragraph")return;let o=t.children[0];if(!o||o.type!=="text")return;let n=Tr(o).trimStart(),r=n.match(ul);if(!r)return;let s=ml[r[1].toUpperCase()],a=n.slice(r[0].length),c=t.children.slice(1);if(a.trim().length===0&&c.length===0&&e.children.length===1)return;let i=[pl(s)],l=[];a.length>0&&l.push({type:"text",value:a});let d=c;return ((u=d[0])==null?void 0:u.type)==="break"&&(d=d.slice(1)),l.push(...d),l.length>0&&l.some(m=>m.type!=="text"||m.value.trim().length>0)&&i.push({type:"paragraph",children:l}),i.push(...e.children.slice(1)),e.data=(p=e.data)!=null?p:{},e.data.hName="div",e.data.hProperties={className:["markdown-alert",`markdown-alert-${s.kind}`]},e.children=i,SKIP},Pr=()=>e=>{visit(e,"blockquote",fl);};var vl=/^[ \t]*<[\w!/?-]/,kl=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Tl=e=>typeof e!="string"||e.length===0||!vl.test(e)?e:e.replace(kl,"$1"),Er,Rr,Lr,Nr,Ar,Dr,Hr,Br,Or,_r,Vr,kt={...defaultSchema,clobberPrefix:"",protocols:{...defaultSchema.protocols,href:[...(Rr=(Er=defaultSchema.protocols)==null?void 0:Er.href)!=null?Rr:[],"tel","streamdown"]},attributes:{...defaultSchema.attributes,code:["metastring",["className",/^(language-.+|math-display|math-inline)$/]],div:[...(Nr=(Lr=defaultSchema.attributes)==null?void 0:Lr.div)!=null?Nr:[],["className",/^(markdown-alert|markdown-alert-(note|tip|important|warning|caution)|sdm-callout)$/],"dataCalloutTitle","dataCalloutColor","dataCalloutIcon","dataCalloutBody"],p:[...(Dr=(Ar=defaultSchema.attributes)==null?void 0:Ar.p)!=null?Dr:[],["className",/^markdown-alert-title$/],"dataAlertType"],svg:[...(Br=(Hr=defaultSchema.attributes)==null?void 0:Hr.svg)!=null?Br:[],"className","viewBox","width","height","fill","ariaHidden"],path:[...(_r=(Or=defaultSchema.attributes)==null?void 0:Or.path)!=null?_r:[],"d","fillRule"]},tagNames:[...(Vr=defaultSchema.tagNames)!=null?Vr:[],"svg","path"]},io={raw:tn,sanitize:[jr,kt],harden:[harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},Pl={gfm:[wl,{}],githubAlerts:Pr,containerAlerts:kr,codeMeta:wr},Mr=Object.values(io),Sl=Object.values(Pl),Ir=new WeakMap;function Ml(e){var r;let t=Ir.get(e);if(t)return t;let o={...kt,tagNames:[...(r=kt.tagNames)!=null?r:[],...Object.keys(e)],attributes:{...kt.attributes,...e}},n=[io.raw,[jr,o],io.harden];return Ir.set(e,n),n}var Il={block:" \u258B",circle:" \u25CF"},El=["github-light","github-dark"],Rl={enabled:true},zr=memo(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:o,index:n,isIncomplete:r,dir:s,animatePlugin:a,...c})=>{useLayoutEffect(()=>{a==null||a.commit();}),a==null||a.setAnimateCodeBlocks(r);let i=typeof e=="string"&&o?Tl(e):e,l=jsx(Ge,{...c,children:i});return jsx(At.Provider,{value:r,children:s?jsx("div",{dir:s,style:{display:"contents"},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return false;if(e.components!==t.components){let o=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(o.length!==n.length||o.some(r=>{var s,a;return ((s=e.components)==null?void 0:s[r])!==((a=t.components)==null?void 0:a[r])}))return false}return !(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins||!!e.animatePlugin!=!!t.animatePlugin)});zr.displayName="Block";var Ll=memo(({children:e,mode:t="streaming",dir:o,parseIncompleteMarkdown:n=true,normalizeHtmlIndentation:r=false,components:s,rehypePlugins:a=Mr,remarkPlugins:c=Sl,className:i,shikiTheme:l,mermaid:d,codeBlockMaxHeight:u=400,controls:p=true,isAnimating:m=false,scrollable:f,tableMaxHeight:g=300,animated:b,BlockComponent:h=zr,parseMarkdownIntoBlocksFn:k=vt,caret:x,listStyle:P="hierarchical",calloutIcon:S,calloutStyle:M,plugins:y,remend:D,linkSafety:B=Rl,lineNumbers:$=true,allowedTags:z,literalTagContent:H,dataOnlyTags:O,translations:W,icons:Y,prefix:Q,onAnimationStart:R,onAnimationEnd:F,...ae})=>{let Fe=useId(),te=useMemo(()=>So(Q),[Q]),ce=useRef(null),oe=useRef(R),ee=useRef(F);oe.current=R,ee.current=F,useEffect(()=>{var I,X,q;if(t==="static")return;let C=ce.current;if(ce.current=m,C===null){m&&((I=oe.current)==null||I.call(oe));return}m&&!C?(X=oe.current)==null||X.call(oe):!m&&C&&((q=ee.current)==null||q.call(ee));},[m,t]);let K=useMemo(()=>z?Object.keys(z):[],[z]),T=useMemo(()=>{if(!(O!=null&&O.length))return K;let C=new Set(O.map(I=>I.toLowerCase()));return K.filter(I=>!C.has(I.toLowerCase()))},[K,O]),j=useRef(null),de=useMemo(()=>{if(typeof e!="string")return "";let C=e;return H&&H.length>0&&(C=ur(C,H)),T.length>0&&(C=mr(C,T)),C=vr(C),C},[e,T,H]),G=useMemo(()=>{let C=t==="streaming"?j.current:null,I=ro(de,C,k);if(j.current=t==="streaming"?I:null,!(t==="streaming"&&n)||I.blocks.length===0)return I.blocks;let X=I.blocks.length-1,q=I.blocks[X],me=xl(q,D);if(me===q)return I.blocks;let Pe=I.blocks.slice();return Pe[X]=me,Pe},[de,k,t,n,D]),Ae=useMemo(()=>b===true?"true":b?JSON.stringify(b):"",[b]),ne=useRef(null),je=useRef([]),xe=useRef([]),co=useRef(null),Pt=useRef("");if(Ae){if(Pt.current!==Ae){Pt.current=Ae;let C=Ae!=="true"?b.maxBacklogMs:void 0;ne.current=Rt({maxBacklogMs:C}),je.current=[],xe.current=[];}else ne.current||(ne.current=Rt());m&&ne.current&&ne.current.beginPass(ne.current.now());}else ne.current=null,je.current=[],xe.current=[],Pt.current="";useLayoutEffect(()=>{var C;m&&((C=ne.current)==null||C.commitPass());});let ve=useDeferredValue(G),ke=useMemo(()=>{if(t!=="streaming"||ne.current||ve===G||ve.length===0)return G;let C=ve.length,I=G.length;if(I===0)return ve;if(C!==I)return G;for(let q=0;q<C-1;q+=1)if(ve[q]!==G[q])return G;let X=ve.slice();return X[C-1]=G[I-1],X},[G,ve,t]),St=useMemo(()=>o==="auto"?ke.map(ot):void 0,[ke,o]),Xr=useMemo(()=>ke.map((C,I)=>`${Fe}-${I}`),[ke.length,Fe]),Ur=useMemo(()=>W?JSON.stringify(W):"",[W]),mo=useMemo(()=>({...ut,...W}),[Ur]),st=useMemo(()=>{let{inlineCode:C,...I}=s!=null?s:{},X={...rr,...I};if(C){let q=X.code;X.code=me=>"data-block"in me?q?createElement(q,me):null:createElement(C,me);}return X},[s]),at=useMemo(()=>{let C=[];return y!=null&&y.cjk&&(C=[...C,...y.cjk.remarkPluginsBefore]),C=[...C,...c],y!=null&&y.cjk&&(C=[...C,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(C=[...C,y.math.remarkPlugin]),C},[c,y==null?void 0:y.math,y==null?void 0:y.cjk]),Te=useMemo(()=>{let C=a;return z&&Object.keys(z).length>0&&a===Mr&&(C=Ml(z)),T.length>0&&(C=[...C,[Cr,T,H!=null?H:[]]]),H&&H.length>0&&(C=[...C,[yr,H]]),O&&O.length>0&&(C=[...C,[hr,O]]),y!=null&&y.math&&(C=[...C,y.math.rehypePlugin]),o==="auto"&&t==="static"&&(C=[...C,gr]),C},[a,y==null?void 0:y.math,z,T,H,O,o,t]),uo=useMemo(()=>{var C,I;return {calloutIcon:S,calloutStyle:M,codeBlockMaxHeight:u,shikiTheme:(I=l!=null?l:(C=y==null?void 0:y.code)==null?void 0:C.getThemes())!=null?I:El,controls:p,isAnimating:m,lineNumbers:$,listStyle:P,mode:t,mermaid:d,linkSafety:B,scrollable:f,tableMaxHeight:g,components:st,remarkPlugins:at,rehypePlugins:Te}},[S,M,u,l,p,m,$,P,t,d,B,f,y==null?void 0:y.code,g,st,at,Te]),Jr=useMemo(()=>x&&m?{"--streamdown-caret":`"${Il[x]}"`}:void 0,[x,m]),Yr=C=>{let I=null;if(ne.current&&m){if(!je.current[C]){let q=Ae&&Ae!=="true"?b:{},{maxBacklogMs:me,...Pe}=q;je.current[C]=it({...Pe,timeline:ne.current});}I=je.current[C];}co.current!==Te&&(xe.current=[],co.current=Te),I&&!xe.current[C]&&(xe.current[C]=[...Te,I.rehypePlugin]);let X=I&&xe.current[C]?xe.current[C]:Te;return {blockAnimatePlugin:I,blockRehypePlugins:X}};return t==="static"?jsx(pt.Provider,{value:mo,children:jsx(bt.Provider,{value:y!=null?y:null,children:jsx(E.Provider,{value:uo,children:jsx($t,{icons:Y,children:jsx(ct.Provider,{value:te,children:jsx("div",{className:te("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",i),dir:o==="auto"?void 0:o,children:jsx(Ge,{components:st,rehypePlugins:Te,remarkPlugins:at,...ae,children:de})})})})})})}):jsx(pt.Provider,{value:mo,children:jsx(bt.Provider,{value:y!=null?y:null,children:jsx(E.Provider,{value:uo,children:jsx($t,{icons:Y,children:jsx(ct.Provider,{value:te,children:jsxs("div",{className:te("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",x?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,i),"data-streamdown":"container",style:Jr,children:[ke.length===0&&x&&m&&jsx("span",{}),ke.map((C,I)=>{var po;let X=I===ke.length-1,q=m&&X&&sr(C),{blockAnimatePlugin:me,blockRehypePlugins:Pe}=Yr(I);return jsx(h,{animatePlugin:me,components:st,content:C,dir:(po=St==null?void 0:St[I])!=null?po:o!=="auto"?o:void 0,index:I,isIncomplete:q,rehypePlugins:Pe,remarkPlugins:at,shouldNormalizeHtmlIndentation:r,shouldParseIncompleteMarkdown:n,...ae},Xr[I])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.calloutIcon===t.calloutIcon&&e.calloutStyle===t.calloutStyle&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&e.dataOnlyTags===t.dataOnlyTags&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);Ll.displayName="Streamdown";var Wr=/[(){}[\]]/,Al=/[\s;]/,Dl=/^[\w-]+$/,Hl=/:::[\w-]+\s*$/,Bl=/^[/\\]/,Ol=/[/\\]$/,_l=/("[^"]*")/,Vl=[["((","))"],["))","(("],["{{","}}"],["[","]"],["(",")"],[")","("]],nt=e=>`"${e.replace(/"/g,"#quot;")}"`,$l=e=>e.length>=2&&e.startsWith('"')&&e.endsWith('"'),Fl=e=>{var n,r,s,a;let t=e.split(`
41
- `),o=0;if(((n=t[o])==null?void 0:n.trim())==="---"){for(o+=1;o<t.length&&((r=t[o])==null?void 0:r.trim())!=="---";)o+=1;o+=1;}for(;o<t.length;){let c=(a=(s=t[o])==null?void 0:s.trim())!=null?a:"";if(c&&!c.startsWith("%%")){let i=c.split(Al,1)[0];return i==="mindmap"?"mindmap":i==="flowchart"||i==="graph"?"flowchart":null}o+=1;}return null},jl=e=>{for(let[t,o]of Vl){let n=e.indexOf(t);if(n===-1||!e.endsWith(o))continue;let r=e.slice(0,n);if(r&&!Dl.test(r))continue;let s=e.slice(n+t.length,e.length-o.length);if(!(s.includes(o)&&o!==t))return {id:r,open:t,close:o,inner:s}}return null},zl=e=>{let t=e.length-e.trimStart().length,o=e.slice(0,t),n=e.trim();if(!n||n.startsWith("%%")||n.startsWith("::icon"))return e;let r=jl(n);if(r)return !$l(r.inner)&&(Wr.test(r.inner)||r.inner.includes('"'))?`${o}${r.id}${r.open}${nt(r.inner)}${r.close}`:e;if(Wr.test(n)){let s=n.replace(Hl,"").trimEnd();return `${o}[${nt(s)}]`}return e},Wl=e=>{let t=e.split(`
42
- `),o=false;return t.map(n=>o?zl(n):(n.trim()&&(o=true),n)).join(`
43
- `)},ql=e=>e.startsWith("(")&&e.endsWith(")")||Bl.test(e)||Ol.test(e),lo=(e,t)=>e.split(_l).map((o,n)=>n%2===0?t(o):o).join(""),Zl=e=>{if(e.trim().startsWith("%%"))return e;let t=lo(e,o=>o.replace(/\[([^[\]"]*[(){}][^[\]"]*)\]/g,(n,r)=>ql(r)?n:`[${nt(r)}]`));return t=lo(t,o=>o.replace(/\{([^{}"]*[()[\]][^{}"]*)\}/g,(n,r)=>`{${nt(r)}}`)),t=lo(t,o=>o.replace(/\|([^|"]*[(){}[\]][^|"]*)\|/g,(n,r)=>`|${nt(r)}|`)),t},Kl=e=>e.split(`
44
- `).map(Zl).join(`
45
- `),qr=e=>{let t=Fl(e);if(!t)return null;let o=t==="mindmap"?Wl(e):Kl(e);return o===e?null:o};var Gr=({children:e,className:t,contentSize:o,fitKey:n,minZoom:r=.5,maxZoom:s=3,zoomStep:a=.1,showControls:c=true,initialZoom:i=1,isAutoFit:l=false,fullscreen:d=false})=>{let{RotateCcwIcon:u,ZoomInIcon:p,ZoomOutIcon:m}=_(),f=w(),g=V(),b=useRef(null),h=useRef(null),[k,x]=useState(i),[P,S]=useState(r),[M,y]=useState(i),[D,B]=useState({x:0,y:0}),[$,z]=useState(false),[H,O]=useState(false),[W,Y]=useState({x:0,y:0}),[Q,R]=useState({x:0,y:0}),F=useCallback(T=>{y(j=>Math.max(P,Math.min(s,j+T))),O(true);},[P,s]),ae=useCallback(()=>{F(a);},[F,a]),Fe=useCallback(()=>{F(-a);},[F,a]),te=useCallback(()=>{y(k),B({x:0,y:0}),O(false);},[k]),ce=useCallback(T=>{T.preventDefault();let j=T.deltaY>0?-a:a;F(j);},[F,a]),oe=useCallback(T=>{if(T.button!==0||T.isPrimary===false)return;z(true),O(true),Y({x:T.clientX,y:T.clientY}),R(D);let j=T.currentTarget;j instanceof HTMLElement&&j.setPointerCapture(T.pointerId);},[D]),ee=useCallback(T=>{if(!$)return;T.preventDefault();let j=T.clientX-W.x,de=T.clientY-W.y;B({x:Q.x+j,y:Q.y+de});},[$,W,Q]),K=useCallback(T=>{z(false);let j=T.currentTarget;j instanceof HTMLElement&&j.releasePointerCapture(T.pointerId);},[]);return useEffect(()=>{S(r),l||(x(i),y(i));},[i,l,r]),useEffect(()=>{if(!(l&&o))return;let T=b.current;if(!T)return;let j=T.clientWidth,de=T.clientHeight;if(!(j>0&&de>0))return;let G=Math.min(j/o.width,de/o.height,1);!(G>0)||Number.isNaN(G)||(x(G),S(Math.min(r,G)),H||(y(G),B({x:0,y:0})));},[o,H,l,r]),useEffect(()=>{l&&O(false);},[l]),useEffect(()=>{let T=b.current;if(T)return T.addEventListener("wheel",ce,{passive:false}),()=>{T.removeEventListener("wheel",ce);}},[ce]),useEffect(()=>{let T=h.current;if(T&&$)return document.body.style.userSelect="none",T.addEventListener("pointermove",ee,{passive:false}),T.addEventListener("pointerup",K),T.addEventListener("pointercancel",K),()=>{document.body.style.userSelect="",T.removeEventListener("pointermove",ee),T.removeEventListener("pointerup",K),T.removeEventListener("pointercancel",K);}},[$,ee,K]),jsxs("div",{className:f("relative flex flex-col",d?"h-full w-full":"min-h-28 w-full",t),ref:b,style:{cursor:$?"grabbing":"grab"},children:[c?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",d?"bottom-4 left-4":"bottom-2 left-2"),children:[jsx("button",{"aria-label":g.zoomIn,className:f("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>=s,onClick:ae,title:g.zoomIn,type:"button",children:jsx(p,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":g.zoomOut,className:f("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<=P,onClick:Fe,title:g.zoomOut,type:"button",children:jsx(m,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":g.resetView,className:f("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:te,title:g.resetView,type:"button",children:jsx(u,{"aria-hidden":"true",size:16})})]}):null,jsx("div",{className:f("flex-1 origin-center transition-transform duration-150 ease-out",d?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:oe,ref:h,role:"application",style:{transform:`translate(${D.x}px, ${D.y}px) scale(${M})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var Ul=async(e,t,o)=>{try{return await e.render(t,o)}catch(n){let r=qr(o);if(!r)throw n;try{return await e.render(`${t}-autofix`,r)}catch(s){throw n}}},hn=({chart:e,className:t,config:o,fullscreen:n=false,showControls:r=true})=>{let s=w(),[a,c]=useState(null),[i,l]=useState(false),[d,u]=useState(""),[p,m]=useState(null),[f,g]=useState(""),[b,h]=useState(0),{mermaid:k}=useContext(E),x=He(),P=k==null?void 0:k.errorComponent,{shouldRender:S,containerRef:M}=fo({immediate:n});if(useEffect(()=>{if(!S)return;if(!x){c("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{c(null),l(!0);let B=x.getMermaid(o),$=e.split("").reduce((Y,Q)=>(Y<<5)-Y+Q.charCodeAt(0)|0,0),z=`mermaid-${Math.abs($)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:H}=await Ul(B,z,e),O=Xt(H),W=n?H:un(H);u(W),m(O),g(W);}catch(B){if(!(f||d)){let $=B instanceof Error?B.message:"Failed to render Mermaid chart";c($);}}finally{l(false);}})();},[e,o,b,S,x]),!(S||d||f))return jsx("div",{className:s("my-4 min-h-[200px]",t),ref:M});if(i&&!d&&!f)return jsx("div",{className:s("my-4 flex justify-center p-4",t),ref:M,children:jsxs("div",{className:s("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:s("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:s("text-sm"),children:"Loading diagram..."})]})});if(a&&!d&&!f){let D=()=>h(B=>B+1);return P?jsx("div",{ref:M,children:jsx(P,{chart:e,error:a,retry:D})}):jsxs("div",{className:s("rounded-md bg-red-50 p-4",t),ref:M,children:[jsxs("p",{className:s("font-mono text-red-700 text-sm"),children:["Mermaid Error: ",a]}),jsxs("details",{className:s("mt-2"),children:[jsx("summary",{className:s("cursor-pointer text-red-600 text-xs"),children:"Show Code"}),jsx("pre",{className:s("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let y=d||f;return jsx("div",{className:s("size-full",t),"data-streamdown":"mermaid",ref:M,children:jsx(Gr,{className:s(n?"size-full overflow-hidden":"overflow-hidden",t),contentSize:p,fitKey:e,fullscreen:n,isAutoFit:true,maxZoom:3,minZoom:.5,showControls:r,zoomStep:.1,children:jsx("div",{"aria-label":"Mermaid chart",className:s("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:y},role:"img"})})})};export{ro as A,Tl as B,io as C,Pl as D,zr as E,Ll as F,as as a,it as b,Dt as c,ze as d,Lo as e,Bt as f,_t as g,Ud as h,Vt as i,ut as j,ft as k,jt as l,gt as m,E as n,sn as o,hn as p,Be as q,Le as r,Yt as s,Ct as t,Oe as u,Ye as v,ti as w,Qe as x,ot as y,vt as z};
@@ -1,2 +0,0 @@
1
- "use client";
2
- export{p as Mermaid}from'./chunk-K5F2GTRN.js';