@lofcz/streamdown 2.14.1 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/block-KAMYR4TF.js +3 -0
  2. package/dist/chunk-BSY33EDM.js +51 -0
  3. package/dist/chunk-GKDS2YGT.js +2 -0
  4. package/dist/highlighted-body-M2KTRTZG.js +2 -0
  5. package/dist/index.d.ts +8 -4
  6. package/dist/index.js +1 -1
  7. package/dist/lib/controls.d.ts +2 -2
  8. package/dist/lib/diagram/adapter.d.ts +11 -0
  9. package/dist/lib/diagram/block.d.ts +10 -0
  10. package/dist/lib/diagram/context.d.ts +2 -0
  11. package/dist/lib/diagram/controls.d.ts +4 -0
  12. package/dist/lib/diagram/download-button.d.ts +15 -0
  13. package/dist/lib/diagram/fullscreen-button.d.ts +23 -0
  14. package/dist/lib/diagram/index.d.ts +13 -0
  15. package/dist/lib/diagram/labels.d.ts +6 -0
  16. package/dist/lib/diagram/options.d.ts +1 -0
  17. package/dist/lib/mermaid/download-button.d.ts +1 -1
  18. package/dist/lib/mermaid/fullscreen-button.d.ts +1 -1
  19. package/dist/lib/mermaid/index.d.ts +3 -3
  20. package/dist/lib/plantuml/download-button.d.ts +1 -1
  21. package/dist/lib/plantuml/fullscreen-button.d.ts +1 -1
  22. package/dist/lib/plantuml/index.d.ts +3 -3
  23. package/dist/lib/plugin-context.d.ts +18 -1
  24. package/dist/lib/plugin-types.d.ts +96 -1
  25. package/dist/lib/preprocess-custom-tags.d.ts +5 -0
  26. package/dist/lib/smiles/compact.d.ts +8 -0
  27. package/dist/lib/smiles/notation-toggle.d.ts +6 -0
  28. package/dist/lib/streamdown-context.d.ts +39 -19
  29. package/dist/lib/tailwind-classes.d.ts +1 -1
  30. package/dist/lib/tailwind-classes.js +1 -1
  31. package/dist/lib/translations-context.d.ts +23 -0
  32. package/dist/openscad-VI3FNOEN.js +2 -0
  33. package/dist/{viewer-A5T7PMUM.js → viewer-SB7OV4V7.js} +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunk-EMUDB4GM.js +0 -2
  36. package/dist/chunk-FYGB27SX.js +0 -50
  37. package/dist/highlighted-body-PPVGTFLS.js +0 -2
  38. package/dist/mermaid-HNKQSOWL.js +0 -2
  39. package/dist/openscad-6N3MT4TE.js +0 -2
  40. package/dist/plantuml-GGYHKHKF.js +0 -2
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import {r,k,m,j,l,p,q as q$1,s,c,u}from'./chunk-BSY33EDM.js';import {f,i,d}from'./chunk-GKDS2YGT.js';import {useContext,useState,useRef,useEffect,useCallback,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';var Je=/\s+/;function Ne(e){var n;return ((n=e.trim().split(Je,1).at(0))!=null?n:"").includes(">")}function Pe(e){if(!e||typeof e!="object"||!("compactDrawing"in e))return;let t=e.compactDrawing;return typeof t=="boolean"?t:void 0}function Ee(e,t){return {...typeof e=="object"&&e!==null?e:{},compactDrawing:t}}var Te=({compact:e,onToggle:t})=>{let n=f(),s=i(),{isAnimating:a}=useContext(r),i$1=e?s.smilesShowStructures:s.smilesShowCompact;return jsx("button",{"aria-label":i$1,"aria-pressed":e,className:n("cursor-pointer px-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",e&&"text-foreground"),disabled:a,onClick:t,title:i$1,type:"button",children:jsx("span",{className:n("font-mono text-[10px] leading-none"),children:"CH\u2083"})})};var q=e=>e>0?e:null,tt=(e,t)=>{if(e.endsWith("px"))return q(Number.parseFloat(e));if(e.endsWith("rem")){let n=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||"16");return q(Number.parseFloat(e)*n)}if(e.endsWith("em")){let n=Number.parseFloat(getComputedStyle(t).fontSize||"16");return q(Number.parseFloat(e)*n)}if(e.endsWith("vh"))return q(Number.parseFloat(e)/100*window.innerHeight);if(e.endsWith("%")){let n=t.parentElement;return n&&n.clientHeight>0?q(Number.parseFloat(e)/100*n.clientHeight):null}return null},ge=(e,t)=>{let n=t.trim().toLowerCase();return !n||n==="none"||n==="auto"?null:tt(n,e)},nt=/^min\(\s*([^,]+)\s*,\s*([^)]+)\s*\)$/i,ot=(e,t)=>{let n=ge(e,t);if(n!=null)return n;let s=t.trim().match(nt);if(!s)return null;let a=ge(e,s[1].trim()),i=ge(e,s[2].trim());return a==null||i==null?null:Math.min(a,i)},rt=(e,t,n)=>{let s=t.clientWidth;if(!(s>0))return null;if(n){let m=t.clientHeight;if(!(m>0))return null;let p=Math.min(s/e.width,m/e.height,1);return !(p>0)||Number.isNaN(p)?null:{fitZoom:p,viewportHeight:null}}let a=Math.min(s/e.width,1);if(!(a>0)||Number.isNaN(a))return null;let i=e.height*a,l=null,u=t;for(;u&&l==null;){let m=getComputedStyle(u);l=ot(u,m.maxHeight),u=u.parentElement;}let o=l!=null?Math.min(i,l):i,r=Math.min(a,o/e.height,1);return !(r>0)||Number.isNaN(r)?null:{fitZoom:r,viewportHeight:o}},Re=({children:e,className:t,contentSize:n,fitKey:s,minZoom:a=.5,maxZoom:i$1=3,zoomStep:l=.1,showControls:u=true,initialZoom:o=1,isAutoFit:r=false,fullscreen:m=false})=>{let{RotateCcwIcon:p,ZoomInIcon:x,ZoomOutIcon:d}=j(),v=f(),h=i(),S=useRef(null),f$1=useRef(null),D=useRef(false),[w,N]=useState(o),[R,C]=useState(a),[b,g]=useState(o),[P,k]=useState({x:0,y:0}),[M,Z]=useState(false),[F,le]=useState({x:0,y:0}),[G,te]=useState({x:0,y:0}),[K,_]=useState(null),U=useCallback(c=>{let y=S.current;if(!y)return;let Y=rt(c,y,m);if(!Y)return;let{fitZoom:ce,viewportHeight:qe}=Y;_(qe),N(ce),C(Math.min(a,ce)),D.current||(g(ce),k({x:0,y:0}));},[m,a]),z=useCallback(c=>{g(y=>Math.max(R,Math.min(i$1,y+c))),D.current=true;},[R,i$1]),Xe=useCallback(()=>{z(l);},[z,l]),Ke=useCallback(()=>{z(-l);},[z,l]),Ue=useCallback(()=>{g(w),k({x:0,y:0}),D.current=false;},[w]),me=useCallback(c=>{c.preventDefault();let y=c.deltaY>0?-l:l;z(y);},[z,l]),je=useCallback(c=>{if(c.button!==0||c.isPrimary===false)return;Z(true),D.current=true,le({x:c.clientX,y:c.clientY}),te(P);let y=c.currentTarget;y instanceof HTMLElement&&y.setPointerCapture(c.pointerId);},[P]),ue=useCallback(c=>{if(!M)return;c.preventDefault();let y=c.clientX-F.x,Y=c.clientY-F.y;k({x:G.x+y,y:G.y+Y});},[M,F,G]),j$1=useCallback(c=>{Z(false);let y=c.currentTarget;y instanceof HTMLElement&&y.releasePointerCapture(c.pointerId);},[]);useEffect(()=>{C(a),r||(N(o),g(o),_(null));},[o,r,a]),useLayoutEffect(()=>{if(!(r&&n))return;U(n);let c=S.current;if(!c||typeof ResizeObserver=="undefined")return;let y=new ResizeObserver(()=>{U(n);});return y.observe(c),()=>{y.disconnect();}},[U,n,r]),useEffect(()=>{r&&(D.current=false);},[s,r]),useEffect(()=>{let c=S.current;if(c)return c.addEventListener("wheel",me,{passive:false}),()=>{c.removeEventListener("wheel",me);}},[me]),useEffect(()=>{let c=f$1.current;if(c&&M)return document.body.style.userSelect="none",c.addEventListener("pointermove",ue,{passive:false}),c.addEventListener("pointerup",j$1),c.addEventListener("pointercancel",j$1),()=>{document.body.style.userSelect="",c.removeEventListener("pointermove",ue),c.removeEventListener("pointerup",j$1),c.removeEventListener("pointercancel",j$1);}},[M,ue,j$1]);let Ye=!m&&r&&K!=null?{height:K}:void 0;return jsxs("div",{className:v("relative flex flex-col",m?"h-full w-full":"min-h-28 w-full",t),ref:S,style:{cursor:M?"grabbing":"grab",...Ye},children:[u?jsxs("div",{className:v("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",m?"bottom-4 left-4":"bottom-2 left-2"),children:[jsx("button",{"aria-label":h.zoomIn,className:v("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:b>=i$1,onClick:Xe,title:h.zoomIn,type:"button",children:jsx(x,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":h.zoomOut,className:v("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:b<=R,onClick:Ke,title:h.zoomOut,type:"button",children:jsx(d,{"aria-hidden":"true",size:16})}),jsx("button",{"aria-label":h.resetView,className:v("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),onClick:Ue,title:h.resetView,type:"button",children:jsx(p,{"aria-hidden":"true",size:16})})]}):null,jsx("div",{className:v("flex h-full w-full flex-1 origin-center items-center justify-center transition-transform duration-150 ease-out"),onPointerDown:je,ref:f$1,role:"application",style:{transform:`translate(${P.x}px, ${P.y}px) scale(${b})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})};var st=/(<svg\b)/,Fe=/<svg\b[^>]*>/i,at=/\bviewBox=(['"])(.*?)\1/i,it=/\swidth=(['"]).*?\1/gi,lt=/\sheight=(['"]).*?\1/gi,Me=/\sstyle=(['"])(.*?)\1/i,_e=/^<svg/i,mt=/^width\s*:/i,ut=/^height\s*:/i,ct=/^max-width\s*:/i,dt=/[\s,]+/,gt=e=>!e.includes("xlink:")||e.includes("xmlns:xlink")?e:e.replace(st,'$1 xmlns:xlink="http://www.w3.org/1999/xlink"'),Ie=e=>{if(typeof DOMParser=="undefined"||typeof XMLSerializer=="undefined")return e;let n=new DOMParser().parseFromString(e,"text/html").querySelector("svg");return n?new XMLSerializer().serializeToString(n):e},pe=e=>{let t=e.match(Fe);if(!t)return null;let s=t[0].match(at),a=s==null?void 0:s[2];if(!a)return null;let i=a.trim().split(dt).map(o=>Number.parseFloat(o));if(i.length<4||i.slice(0,4).some(Number.isNaN))return null;let l=i[2],u=i[3];return l>0&&u>0?{height:u,width:l}:null},ze=e=>{let t=e.match(Fe);if(!t)return e;try{let n=t[0],s=pe(e);if(!s)return e;let{width:a,height:i}=s,l=n.replace(it,"").replace(lt,""),u=l.match(Me),o=`width:${a}px;height:${i}px;max-width:none;`;if(u){let r=u[1],p=u[2].split(";").map(d=>d.trim()).filter(Boolean).filter(d=>!(mt.test(d)||ut.test(d)||ct.test(d))).join(";"),x=`${o}${p?`${p};`:""}`;l=l.replace(Me,` style=${r}${x}${r}`);}else l=l.replace(_e,`<svg style="${o}"`);return l=l.replace(_e,`<svg width="${a}" height="${i}"`),e.replace(n,l)}catch(n){return e}},He=(e,t)=>{var s;let n=(s=void 0)!=null?s:5;return new Promise((a,i)=>{let l=gt(e),u="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(l))),o=new Image;o.crossOrigin="anonymous",o.onload=()=>{let r=document.createElement("canvas"),m=o.width*n,p=o.height*n;r.width=m,r.height=p;let x=r.getContext("2d");if(!x){i(new Error("Failed to create 2D canvas context for PNG export"));return}x.drawImage(o,0,0,m,p),r.toBlob(d=>{if(!d){i(new Error("Failed to create PNG blob"));return}a(d);},"image/png");},o.onerror=()=>i(new Error("Failed to load SVG image")),o.src=u;})};var re=(e,t)=>{var n;return t==="mermaid"?e.mermaid:t==="plantuml"?e.plantuml:t==="vega"?e.vega:t==="smiles"?e.smiles:(n=e.diagrams)==null?void 0:n[t]};var pt={chart:"diagramChart",error:"diagramErrorLabel",missing:"diagramPluginMissing",failed:"diagramRenderFailed"},ft={mermaid:{chart:"mermaidChart",error:"mermaidErrorLabel",missing:"mermaidPluginMissing",failed:"mermaidRenderFailed"},plantuml:{chart:"plantumlChart",error:"plantumlErrorLabel",missing:"plantumlPluginMissing",failed:"plantumlRenderFailed"},vega:{chart:"vegaChart",error:"vegaErrorLabel",missing:"vegaPluginMissing",failed:"vegaRenderFailed"},smiles:{chart:"smilesChart",error:"smilesErrorLabel",missing:"smilesPluginMissing",failed:"smilesRenderFailed"}},bt={mermaid:"mermaidFormatMmd",plantuml:"plantumlFormatPuml",vega:"vegaFormatJson",smiles:"smilesFormatSmi"},ht={mermaid:"downloadDiagramAsMmd",plantuml:"downloadDiagramAsPuml",vega:"downloadDiagramAsJson",smiles:"downloadDiagramAsSmi"},J=(e,t,n)=>{var a;let s=(a=ft[t])!=null?a:pt;return e[s[n]]},Oe=(e,t,n)=>{let s=bt[t];return s?e[s]:n.toUpperCase()||e.diagramFormatSource},fe=(e,t)=>{let n=ht[t];return n?e[n]:e.downloadDiagramAsSource},Ae=e=>e==="mermaid"?"Mermaid plugin not available":e==="plantuml"?"PlantUML plugin not available":e==="vega"?"Vega plugin not available":e==="smiles"?"SMILES plugin not available":"Diagram plugin not available";var se=(e,t)=>e===void 0&&t===void 0?void 0:{...typeof e=="object"&&e!==null?e:{},language:t};var xt=new Set(["vega","smiles"]),ae=({chart:e,className:t,config:n,fallbackName:s,fullscreen:a=false,language:i$1,plugin:l,showControls:u$1=true})=>{var G,te;let o=f(),r$1=i(),m=(te=(G=l==null?void 0:l.name)!=null?G:s)!=null?te:"diagram",[p,x]=useState(null),[d,v]=useState(false),[h,S]=useState(""),[f$1,D]=useState(null),[w,N]=useState(""),[R,C]=useState(0),b=useContext(r),g=re(b,m),P=g==null?void 0:g.errorComponent,k=c(),M=xt.has(m),{shouldRender:Z,containerRef:F}=u({immediate:a});if(useEffect(()=>{if(!Z||M&&k)return;if(!l){x(J(r$1,m,"missing"));return}(async()=>{try{x(null),v(!0);let{svg:_}=await l.render(e,se(n,i$1)),U=pe(_),z=a?_:ze(_);S(z),D(U),N(z);}catch(_){w||h||x(_ instanceof Error?_.message:J(r$1,m,"failed"));}finally{v(false);}})();},[e,n,i$1,R,Z,l,k,M]),!(Z||h||w))return jsx("div",{className:o("my-4 min-h-[200px]",t),ref:F});if(M&&k&&!h&&!w)return jsx("div",{className:o("my-4 flex justify-center p-4",t),ref:F,children:jsxs("div",{className:o("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:o("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:o("text-sm"),children:r$1.diagramWriting})]})});if(d&&!h&&!w)return jsx("div",{className:o("my-4 flex justify-center p-4",t),ref:F,children:jsxs("div",{className:o("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:o("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:o("text-sm"),children:r$1.diagramLoading})]})});if(p&&!h&&!w){let K=()=>C(_=>_+1);return P?jsx("div",{ref:F,children:jsx(P,{chart:e,error:p,retry:K})}):jsxs("div",{className:o("rounded-md bg-red-50 p-4",t),ref:F,children:[jsxs("p",{className:o("font-mono text-red-700 text-sm"),children:[J(r$1,m,"error"),": ",p]}),jsxs("details",{className:o("mt-2"),children:[jsx("summary",{className:o("cursor-pointer text-red-600 text-xs"),children:r$1.showCode}),jsx("pre",{className:o("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:e})]})]})}let le=h||w;return jsx("div",{className:o(a?"size-full":"max-h-[min(70vh,40rem)] w-full",t),"data-streamdown":m,ref:F,children:jsx(Re,{className:o(a?"size-full overflow-hidden":"max-h-[min(70vh,40rem)] overflow-hidden",t),contentSize:f$1,fitKey:e,fullscreen:a,isAutoFit:true,maxZoom:3,minZoom:.1,showControls:u$1,zoomStep:.1,children:jsx("div",{"aria-label":J(r$1,m,"chart"),className:o("flex justify-center",a?"size-full items-center":null),dangerouslySetInnerHTML:{__html:le},role:"img"})})})};var Be=(e,t)=>{var n;return typeof e=="boolean"?e:t!=="diagrams"&&t in e?e[t]:(n=e.diagrams)==null?void 0:n[t]},Ve=(e,t)=>typeof e=="boolean"?e:Be(e,t)!==false,O=(e,t,n)=>{if(typeof e=="boolean")return e;let s=Be(e,t);return s===false?false:s===true||s===void 0?true:typeof s=="object"&&s!==null?s[n]!==false:true};var ie=({chart:e,children:t,className:n,config:s,language:a,name:i$1,onDownload:l$1,onError:u,plugin:o,sourceExtension:r$1})=>{var b;let m=f(),[p,x]=useState(false),d$1=useRef(null),{isAnimating:v,controls:h}=useContext(r),S=j(),f$1=i(),D=(b=r$1!=null?r$1:o==null?void 0:o.sourceExtension)!=null?b:"txt",w=l(h,i$1,"diagram"),N=g=>{x(false),l$1==null||l$1(g);},R=async g=>{if(!o){u==null||u(new Error(Ae(i$1)));return}let{svg:P}=await o.render(e,se(s,a));if(!P){u==null||u(new Error("SVG not found. Please wait for the diagram to render."));return}let k=Ie(P);if(g==="svg"){d(`${w}.svg`,k,"image/svg+xml"),N(g);return}let M=await He(k);d(`${w}.png`,M,"image/png"),N(g);},C=async g=>{try{if(g==="source"){d(`${w}.${D}`,e,"text/plain"),N(g);return}await R(g);}catch(P){u==null||u(P);}};return useEffect(()=>{let g=P=>{let k=P.composedPath();d$1.current&&!k.includes(d$1.current)&&x(false);};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[]),jsxs("div",{className:m("relative"),ref:d$1,children:[jsx("button",{"aria-label":f$1.downloadDiagram,className:m("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:v,onClick:()=>x(!p),title:f$1.downloadDiagram,type:"button",children:t!=null?t:jsx(S.DownloadIcon,{"aria-hidden":"true",size:14})}),p?jsxs("div",{className:m("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$1.downloadDiagramAsSvg,className:m("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>C("svg"),title:f$1.downloadDiagramAsSvg,type:"button",children:f$1.mermaidFormatSvg}),jsx("button",{"aria-label":f$1.downloadDiagramAsPng,className:m("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>C("png"),title:f$1.downloadDiagramAsPng,type:"button",children:f$1.mermaidFormatPng}),jsx("button",{"aria-label":fe(f$1,i$1),className:m("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>C("source"),title:fe(f$1,i$1),type:"button",children:Oe(f$1,i$1,D)})]}):null]})};var Ge=({DiagramComponent:e,chart:t,className:n,config:s$1,language:a,name:i$1,onExit:l,onFullscreen:u,plugin:o,sourceExtension:r$1,...m})=>{let{Maximize2Icon:p$1,XIcon:x}=j(),d=f(),[v,h]=useState(false),{isAnimating:S,controls:f$1,portal:D}=useContext(r),w=i(),N=O(f$1,i$1,"panZoom"),R=O(f$1,i$1,"download"),C=()=>{h(!v);};return useEffect(()=>{if(v){p();let b=g=>{g.key==="Escape"&&h(false);};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),q$1();}}},[v]),useEffect(()=>{v?u==null||u():l&&l();},[v,u,l]),jsxs(Fragment,{children:[jsx("button",{className:d("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:S,onClick:C,title:w.viewFullscreen,type:"button",...m,"aria-label":w.viewFullscreen,children:jsx(p$1,{"aria-hidden":"true",size:14})}),v?createPortal(jsxs("div",{"aria-label":w.viewFullscreen,"aria-modal":"true",className:d("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),"data-streamdown":`${i$1}-fullscreen`,onClick:C,onKeyDown:b=>{b.key==="Escape"&&C();},role:"dialog",children:[jsxs("div",{className:d("absolute top-4 right-4 z-10 flex items-center gap-1"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:[R?jsx(ie,{chart:t,config:s$1,language:a,name:i$1,plugin:o,sourceExtension:r$1}):null,jsx("button",{"aria-label":w.exitFullscreen,className:d("rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:C,title:w.exitFullscreen,type:"button",children:jsx(x,{"aria-hidden":"true",size:20})})]}),jsx("div",{className:d("flex size-full items-center justify-center p-4"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:e?jsx(e,{chart:t,className:d("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:s$1,fullscreen:true,language:a,showControls:N}):jsx(ae,{chart:t,className:d("size-full [&_svg]:h-auto [&_svg]:w-auto"),config:s$1,fallbackName:i$1,fullscreen:true,language:a,plugin:o,showControls:N})})]}),s(D)):null]})};var Kn=({className:e,code:t,isBlockIncomplete:n,language:s,plugin:a})=>{var g;let i$1=f(),l=i(),u=useContext(r),{controls:o}=u,r$1=a.name,m$1=re(u,r$1),p=r$1==="smiles",x=Pe(m$1==null?void 0:m$1.config),[d,v]=useState({code:t}),h=d.code===t?d.override:void 0,S=(g=h!=null?h:x)!=null?g:Ne(t),f$1=p?Ee(m$1==null?void 0:m$1.config,S):m$1==null?void 0:m$1.config,D=O(o,r$1,"download"),w=O(o,r$1,"copy"),N=O(o,r$1,"fullscreen"),R=O(o,r$1,"panZoom"),C=p&&O(o,r$1,"compact"),b=Ve(o,r$1)&&(D||w||N||C);return jsxs("div",{className:i$1("group relative 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-streamdown":`${r$1}-block`,children:[jsx("div",{className:i$1("flex h-8 items-center text-muted-foreground text-xs"),children:jsx("span",{className:i$1("ml-1 font-mono lowercase"),children:s})}),b?jsx("div",{className:i$1("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),children:jsxs("div",{className:i$1("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":`${r$1}-block-actions`,children:[C?jsx(Te,{compact:S,onToggle:()=>v({code:t,override:!S})}):null,D?jsx(ie,{chart:t,config:f$1,language:s,name:r$1,plugin:a,sourceExtension:a.sourceExtension}):null,w?jsx(k,{code:t,label:l.copyDiagram,...m(o,r$1)}):null,N?jsx(Ge,{chart:t,config:f$1,language:s,name:r$1,plugin:a,sourceExtension:a.sourceExtension}):null]})}):null,jsx("div",{className:i$1("overflow-hidden rounded-md border border-border bg-background"),children:jsx(ae,{chart:t,config:f$1,fallbackName:r$1,language:s,plugin:a,showControls:R})})]})};
3
+ export{Kn as DiagramCodeBlock};
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import {a,f,b,i,c,g,h,e,d}from'./chunk-GKDS2YGT.js';import {createContext,memo,useContext,useMemo,lazy,isValidElement,useLayoutEffect,useId,useRef,useEffect,useDeferredValue,useState,createElement,useCallback,Suspense,cloneElement}from'react';import {harden}from'rehype-harden';import fo from'rehype-raw';import cs,{defaultSchema}from'rehype-sanitize';import fc from'remark-gfm';import gc from'remend';import {visitParents,SKIP as SKIP$1}from'unist-util-visit-parents';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 Na from'remark-parse';import Aa from'remark-rehype';import {unified}from'unified';import {visit,SKIP}from'unist-util-visit';import {toText}from'hast-util-to-text';import {Lexer}from'marked';var hs=300,ys="300px",Cs=500;function En(e={}){let{immediate:t=false,debounceDelay:n=hs,rootMargin:o=ys,idleTimeout:r=Cs}=e,[s,a]=useState(false),l=useRef(null),i=useRef(null),c=useRef(null),d=useMemo(()=>g=>{let p=Date.now();return window.setTimeout(()=>{g({didTimeout:false,timeRemaining:()=>Math.max(0,50-(Date.now()-p))});},1)},[]),m=useMemo(()=>typeof window!="undefined"&&window.requestIdleCallback?(g,p)=>window.requestIdleCallback(g,p):d,[d]),u=useMemo(()=>typeof window!="undefined"&&window.cancelIdleCallback?g=>window.cancelIdleCallback(g):g=>{clearTimeout(g);},[]);return useEffect(()=>{if(t){a(true);return}let g=l.current;if(!g)return;i.current&&(clearTimeout(i.current),i.current=null),c.current&&(u(c.current),c.current=null);let p=()=>{i.current&&(clearTimeout(i.current),i.current=null),c.current&&(u(c.current),c.current=null);},h=x=>{c.current=m(v=>{v.timeRemaining()>0||v.didTimeout?(a(true),x.disconnect()):c.current=m(()=>{a(true),x.disconnect();},{timeout:r/2});},{timeout:r});},f=x=>{p(),i.current=window.setTimeout(()=>{var L,H;let v=x.takeRecords();(v.length===0||(H=(L=v.at(-1))==null?void 0:L.isIntersecting)!=null&&H)&&h(x);},n);},b=(x,v)=>{x.isIntersecting?f(v):p();},y=new IntersectionObserver(x=>{for(let v of x)b(v,y);},{rootMargin:o,threshold:0});return y.observe(g),()=>{i.current&&clearTimeout(i.current),c.current&&u(c.current),y.disconnect();}},[t,n,o,r,u,m]),{shouldRender:s,containerRef:l}}var xs=320,ws=4,Ln=()=>typeof performance=="undefined"?Date.now():performance.now();function Ht(e){var s,a;let t=(s=e==null?void 0:e.now)!=null?s:Ln,n=(a=e==null?void 0:e.maxBacklogMs)!=null?a:xs,o=0,r=0;return {now:t,beginPass(l){r=Math.min(Math.max(o,l),l+n);},mark(){return r},rewind(l){r=l;},take(l,i,c){if(l<=0)return {baseDelay:0,step:Math.max(0,i)};let d=Math.max(0,i),m=d===0?0:Math.min(d,ws),u=Math.max(r,c),g=c+n,p=u+Math.max(0,l-1)*d,h=d;if(p>g&&l>1)if(u<g){let b=g-u;h=Math.max(m,b/(l-1));}else h=m;let f=Math.max(0,Math.round(u-c));return r=u+l*h,{baseDelay:f,step:h}},commitPass(){o=r;}}}function ks(){return {current:0}}var Mn=/\s/,Bt=/^\s+$/,vs=new Set(["pre","svg","math","annotation"]),Ps=new Set(["svg","math","annotation"]),Ot=new Set(["img","hr"]),Ss=new Set(["ul","ol","li"]),xe=e=>typeof e=="object"&&e!==null&&"type"in e&&e.type==="element",Vt=(e,t)=>{let n=t?Ps:vs;return e.some(o=>xe(o)&&n.has(o.tagName))},Ts=e=>{for(let t=e.length-1;t>=0;t-=1){let n=e[t];if(xe(n)&&n.tagName==="li")return n}},Es=(e,t,n,o)=>{(e.properties)!=null||(e.properties={}),e.properties["data-sd-animate-marker"]=true,e.properties.style=`--sd-marker-duration:${t}ms;--sd-marker-delay:${n}ms;--sd-marker-easing:${o}`;},Nn=e=>{for(let t of e.children)if(xe(t)){if(t.tagName==="input")return t;if(Ss.has(t.tagName))continue;let n=Nn(t);if(n)return n}},An=(e,t,n,o)=>{(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:${n}ms;--sd-easing:${t.easing};--sd-delay:${o}ms`;},Rs=(e,t,n,o)=>{let r=Nn(e);r&&An(r,t,n,o);},Dn=e=>{var t;for(let n=e.length-1;n>=0;n-=1){let o=e[n];if(xe(o)){if((t=o.properties)!=null&&t["data-sd-animated"])break;o.properties={...o.properties,"data-sd-animated":true};}}},On=e=>{let t=[],n="",o=false;for(let r of e){let s=Mn.test(r);if(s!==o&&n){if(s){n+=r,o=true;continue}t.push(n),n="";}n+=r,o=s;}return n&&t.push(n),t},Hn=e=>{let t=[],n="";for(let o of e)Mn.test(o)?t.length>0&&!Bt.test(t.at(-1))?t[t.length-1]+=o:n+=o:(n&&(t.push(n),n=""),t.push(o));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},Is=(e,t,n,o,r,s)=>{let a=`--sd-animation:sd-${t};--sd-duration:${r?0:n}ms;--sd-easing:${o}`;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}]}},Ls=(e,t,n,o)=>{let r=0,s=0;return visitParents(e,a=>a.type==="text"||xe(a)&&Ot.has(a.tagName),(a,l)=>{if(Vt(l,n.animateCodeBlocks))return SKIP$1;if(xe(a)&&Ot.has(a.tagName)){o>0&&s<o||(r+=1),s+=1;return}let i=a.value;if(!i.trim()){s+=i.length;return}let c=t.sep==="char"?Hn(i):On(i);for(let d of c){let m=s;s+=d.length,!Bt.test(d)&&(o>0&&m<o||(r+=1));}}),r},Ms=(e,t,n,o,r,s)=>{if(Vt(t,o.animateCodeBlocks))return;let a=o.prevContentLength,l=r.count;r.count+=1;let i=a>0&&l<a,c=i?0:s.baseDelay+r.newIndex++*s.step;An(e,n,i?0:n.duration,c),Dn(t);},Ns=(e,t,n,o,r,s)=>{var b;let a=t.at(-1);if(!(a&&"children"in a))return;if(Vt(t,o.animateCodeBlocks))return SKIP$1;let l=a,i=l.children.indexOf(e);if(i===-1)return;let c=e.value;if(!c.trim()){r.count+=c.length;return}let d=n.sep==="char"?Hn(c):On(c),m=o.prevContentLength,u=false,g=Ts(t),p=!!(g&&!((b=g.properties)!=null&&b["data-sd-animate-marker"])),h=false,f=d.map(y=>{let x=r.count;if(r.count+=y.length,Bt.test(y))return {type:"text",value:y};let v=m>0&&x<m,S=v?0:s.baseDelay+r.newIndex++*s.step;if(g&&p&&!h){let L=v?0:n.duration;Es(g,L,S,n.easing),Rs(g,n,L,S),h=true;}return u=true,Is(y,n.animation,n.duration,n.easing,v,S)});return u&&Dn(t),l.children.splice(i,1,...f),i+f.length},As=0;function ut(e){var s,a,l,i,c;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:(l=e==null?void 0:e.easing)!=null?l:"ease",sep:(i=e==null?void 0:e.sep)!=null?i:"word",stagger:(c=e==null?void 0:e.stagger)!=null?c:40,timeline:e==null?void 0:e.timeline},n={animateCodeBlocks:false,committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},o=As++,r=()=>d=>{var h;let m={count:0,newIndex:0};n.prevContentLength=n.committedCharCount;let u=t.timeline,g=(h=u==null?void 0:u.now())!=null?h:Ln();u&&(n.pendingMark===null?n.pendingMark=u.mark():u.rewind(n.pendingMark));let p=u?u.take(Ls(d,t,n,n.prevContentLength),t.stagger,g):{baseDelay:0,step:t.stagger};visitParents(d,f=>f.type==="text"||xe(f)&&Ot.has(f.tagName),(f,b)=>{if(f.type==="text")return Ns(f,b,t,n,m,p);Ms(f,b,t,n,m,p);}),n.lastRenderCharCount=m.count,n.prevContentLength=0;};return Object.defineProperty(r,"name",{value:`rehypeAnimate$${o}`}),{name:"animate",type:"animate",rehypePlugin:r,setAnimateCodeBlocks(d){n.animateCodeBlocks=d;},setPrevContentLength(d){n.committedCharCount=d,n.prevContentLength=d;},getLastRenderCharCount(){return n.lastRenderCharCount},commit(){n.committedCharCount=n.lastRenderCharCount,n.pendingMark=null;}}}ut();var _t=createContext(false),_e=()=>useContext(_t);function Bn(e){let t=[],n=[],o=0;return r=>{let s=new Map;for(let i=0;i<t.length;i+=1){let c=t[i],d=n[i];c!==void 0&&d!==void 0&&!s.has(c)&&s.set(c,d);}let a=new Set,l=r.map((i,c)=>{let d=t[c],m=n[c];if(d!==void 0&&m!==void 0&&!a.has(m)&&(d===i||i.startsWith(d)))return a.add(m),m;let u=s.get(i);if(u!==void 0&&!a.has(u))return a.add(u),u;let g=`${e}-${o}`;return o+=1,a.add(g),g});return t=r,n=l,l}}var je=({scrollRef:e,ref:t,...n})=>jsx("div",{ref:e,...n});var _s=8,js=e=>e.scrollHeight-e.scrollTop-e.clientHeight<_s,Fn=e=>{var n,o;let t=(o=(n=e.touches[0])!=null?n:e.changedTouches[0])!=null?o:null;return typeof(t==null?void 0:t.clientY)=="number"?t.clientY:null},pt=({enabled:e,isAnimating:t,content:n})=>{let[o,r]=useState(null),s=useRef(true),a=useRef(0),l=useCallback(c=>{r(d=>d===c?d:c);},[]),i=useCallback(c=>{t&&s.current&&(c.scrollTo({top:c.scrollHeight,behavior:"instant"}),a.current=c.scrollTop);},[t]);return useEffect(()=>{t||(s.current=true);},[t]),useEffect(()=>{if(!(e&&o))return;a.current=o.scrollTop;let c=()=>{s.current=false;},d=f=>{f.deltaY<0&&c();},m=null,u=f=>{m=Fn(f);},g=f=>{if(m===null)return;let b=Fn(f);if(b===null)return;let y=b-m;Math.abs(y)<=3||(y>0&&c(),m=b);},p=()=>{m=null;},h=()=>{let f=o.scrollTop<a.current;if(a.current=o.scrollTop,f){c();return}js(o)&&(s.current=true);};return o.addEventListener("wheel",d,{capture:true,passive:true}),o.addEventListener("touchstart",u,{passive:true}),o.addEventListener("touchmove",g,{passive:true}),o.addEventListener("touchend",p,{passive:true}),o.addEventListener("touchcancel",p,{passive:true}),o.addEventListener("scroll",h,{passive:true}),()=>{o.removeEventListener("wheel",d,{capture:true}),o.removeEventListener("touchstart",u),o.removeEventListener("touchmove",g),o.removeEventListener("touchend",p),o.removeEventListener("touchcancel",p),o.removeEventListener("scroll",h);}},[e,o]),useLayoutEffect(()=>{if(!(e&&o)||(i(o),typeof ResizeObserver=="undefined"))return;let c=new ResizeObserver(()=>{i(o);});c.observe(o);for(let d of o.children)c.observe(d);return ()=>{c.disconnect();}},[n,o,e,i]),l};var zs=a("block"),Ws=a("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),qs=e=>{let t={};for(let n of e.split(";")){let o=n.indexOf(":");if(o>0){let r=n.slice(0,o).trim(),s=n.slice(o+1).trim();r&&s&&(t[r]=s);}}return t},$n=memo(({children:e,result:t,language:n,className:o,maxHeight:r,startLine:s,lineNumbers:a=true,...l})=>{let i=f(),{isAnimating:c,scrollable:d}=useContext(T),m=d!=null?d:je,u=b(r),g=pt({content:t,enabled:!!u,isAnimating:c}),p=useMemo(()=>i(Ws),[i]),h=useMemo(()=>i(zs),[i]),f$1=useMemo(()=>{let b={};return t.bg&&(b["--sdm-bg"]=t.bg),t.fg&&(b["--sdm-fg"]=t.fg),t.rootStyle&&Object.assign(b,qs(t.rootStyle)),b},[t.bg,t.fg,t.rootStyle]);return jsx(m,{className:i(o,u?"overflow-x-auto overflow-y-auto":"overflow-x-auto","rounded-md border border-border bg-background p-4 text-sm"),"data-language":n,"data-streamdown":"code-block-body",scrollRef:g,style:u?{maxHeight:u}:void 0,...l,children:jsx("pre",{className:i(o,"bg-[var(--sdm-bg,inherit)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]"),style:f$1,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?p:h,children:b.length===0||b.length===1&&b[0].content===""?`
3
+ `:b.map((x,v)=>{let S={},L=!!x.bgColor;if(x.color&&(S["--sdm-c"]=x.color),x.bgColor&&(S["--sdm-tbg"]=x.bgColor),x.htmlStyle)for(let[H,I]of Object.entries(x.htmlStyle))H==="color"?S["--sdm-c"]=I:H==="background-color"?(S["--sdm-tbg"]=I,L=true):S[H]=I;return jsx("span",{className:i("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",L&&"bg-[var(--sdm-tbg)]",L&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:S,...x.htmlAttrs,children:x.content},v)})},y))})})})});var Ft=({className:e,language:t,style:n,isIncomplete:o,...r})=>{let s=f();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":o||void 0,"data-language":t,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...n},...r})};var $t=createContext({code:""}),ft=()=>useContext($t);var zt=({language:e})=>{let t=f();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 Ys=e=>{let t=e.length;for(;t>0&&e[t-1]===`
4
+ `;)t--;return e.slice(0,t)},Qs=lazy(()=>import('./highlighted-body-M2KTRTZG.js').then(e=>({default:e.HighlightedCodeBlockBody}))),Wt=({code:e,language:t,className:n,children:o,isIncomplete:r=false,startLine:s,lineNumbers:a,...l})=>{let i=f(),{codeBlockMaxHeight:c}=useContext(T),d=useMemo(()=>Ys(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($t.Provider,{value:{code:e},children:jsxs(Ft,{dir:"ltr",isIncomplete:r,language:t,children:[jsx(zt,{language:t}),o?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:o})}):null,jsx(Suspense,{fallback:jsx($n,{className:n,language:t,lineNumbers:a,maxHeight:c,result:m,startLine:s,...l}),children:jsx(Qs,{className:n,code:d,language:t,lineNumbers:a,maxHeight:c,raw:m,startLine:s,...l})})]})})};var qn=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"})}),Kn=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"})}),Un=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"})}),Zn=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"})]}),Xn=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"})}),Jn=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"})}),Gn=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"})}),Yn=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"})}),Qn=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"})}),eo=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 $e={CheckIcon:qn,CopyIcon:Kn,DownloadIcon:Un,ExternalLinkIcon:Yn,Loader2Icon:Zn,Maximize2Icon:Xn,RotateCcwIcon:Jn,XIcon:Gn,ZoomInIcon:Qn,ZoomOutIcon:eo},no=createContext($e),ra=(e,t)=>{if(e===t)return true;if(!(e&&t))return e===t;let n=Object.keys(e),o=Object.keys(t);return n.length!==o.length?false:n.every(r=>e[r]===t[r])},qt=({icons:e,children:t})=>{let n=useRef(e),o=useRef(e?{...$e,...e}:$e);ra(n.current,e)||(n.current=e,o.current=e?{...$e,...e}:$e);let r=o.current;return jsx(no.Provider,{value:r,children:t})},B=()=>useContext(no);var gt=({onCopy:e,onError:t,timeout:n=2e3,children:o,className:r,code:s,label:a,...l})=>{let i$1=f(),[c,d]=useState(false),m=useRef(0),{code:u}=ft(),{isAnimating:g}=useContext(T),p=i(),h=s!=null?s:u,f$1=a!=null?a:p.copyCode,b=async()=>{var v;if(typeof window=="undefined"||!((v=navigator==null?void 0:navigator.clipboard)!=null&&v.writeText)){t==null||t(new Error("Clipboard API not available"));return}try{c||(await navigator.clipboard.writeText(h),d(!0),e==null||e(),m.current=window.setTimeout(()=>d(!1),n));}catch(S){t==null||t(S);}};useEffect(()=>()=>{window.clearTimeout(m.current);},[]);let y=B(),x=c?y.CheckIcon:y.CopyIcon;return jsxs(Fragment,{children:[jsx("button",{"aria-label":f$1,className:i$1("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:g,onClick:b,title:f$1,type:"button",...l,children:o!=null?o:jsx(x,{"aria-hidden":"true",size:14})}),c&&jsx("output",{"aria-live":"polite",className:"sr-only",children:p.copied})]})};var bt=e=>typeof e=="object"&&e!==null,oo=(e,t)=>{var n;if(typeof e!="boolean")return t!=="diagrams"&&t in e?e[t]:(n=e.diagrams)==null?void 0:n[t]},ke=(e,t,n)=>{if(typeof e=="boolean")return n;let o=oo(e,t);if(!bt(o))return n;let r=o.download;return !bt(r)||typeof r.filename!="string"?n:r.filename||n};function ze(e,t){if(typeof e=="boolean")return {};let n=oo(e,t);if(!bt(n))return {};let o=n.copy;return bt(o)?{onCopy:typeof o.onCopy=="function"?o.onCopy:void 0,onError:typeof o.onError=="function"?o.onError:void 0}:{}}var ro={"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",smiles:"smi",smi:"smi",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",vega:"vg.json","vega-lite":"vl.json",vegalite:"vl.json",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",\u6587\u8A00:"wy"},Ut=({onDownload:e,onError:t,language:n,children:o,className:r,code:s,...a})=>{let l=f(),{code:i$1}=ft(),{isAnimating:c,controls:d$1}=useContext(T),m=i(),u=B(),g=s!=null?s:i$1,p=n&&n in ro?ro[n]:"txt",h=`${ke(d$1,"code","file")}.${p}`,f$1="text/plain",b=()=>{try{d(h,g,f$1),e==null||e();}catch(y){t==null||t(y);}};return jsx("button",{"aria-label":m.downloadFile,className:l("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:c,onClick:b,title:m.downloadFile,type:"button",...a,children:o!=null?o:jsx(u.DownloadIcon,{size:14})})};var We=()=>{let{Loader2Icon:e}=B(),t=f();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 qe=0,ce=()=>{qe+=1,qe===1&&(document.body.style.overflow="hidden");},de=()=>{qe=Math.max(0,qe-1),qe===0&&(document.body.style.overflow="");};var ga=["github-light","github-dark"],ba={enabled:true},ha={codeBlockMaxHeight:400,shikiTheme:ga,controls:true,isAnimating:false,lineNumbers:true,listStyle:"hierarchical",mode:"streaming",mermaid:void 0,openscad:void 0,plantuml:void 0,smiles:void 0,vega:void 0,diagrams:void 0,linkSafety:ba,portal:void 0,tableMaxHeight:300},T=createContext(ha);var wa=/\.[^/.]+$/,io=(e,t)=>{if(typeof e=="boolean")return e;let n=e.image;return n===false?false:n===true||n===void 0?true:n[t]!==false},lo=({node:e,className:t,src:n,alt:o,onLoad:r,onError:s,onClick:a,...l})=>{let{DownloadIcon:i$1,XIcon:c}=B(),d$1=f(),m=useRef(null),[u,g]=useState(false),[p,h]=useState(false),[f$1,b]=useState(false),{controls:y}=useContext(T),x=i(),v=io(y,"download"),S=io(y,"fullscreen"),L=l.width!=null||l.height!=null,H=v&&(u||L)&&!p,I=p&&!L,V=S&&!!n&&!p&&u;useEffect(()=>{let R=m.current;if(R!=null&&R.complete){let M=R.naturalWidth>0;g(M),h(!M);}},[]),useEffect(()=>{if(!f$1)return;ce();let R=M=>{M.key==="Escape"&&b(false);};return document.addEventListener("keydown",R),()=>{document.removeEventListener("keydown",R),de();}},[f$1]);let Z=useCallback(R=>{g(true),h(false),r==null||r(R);},[r]),X=useCallback(R=>{g(false),h(true),s==null||s(R);},[s]),P=useCallback(()=>{V&&b(true);},[V]),J=useCallback(()=>{b(false);},[]),ue=useCallback(R=>{a==null||a(R),!R.defaultPrevented&&P();},[a,P]),pe=async R=>{if(R.stopPropagation(),!!n)try{let _=await(await fetch(n)).blob(),K=new URL(n,window.location.origin).pathname.split("/").pop()||"",Be=K.split(".").pop(),at=K.includes(".")&&Be!==void 0&&Be.length<=4,Ee="";if(at)Ee=K;else {let ne=_.type,oe="png";ne.includes("jpeg")||ne.includes("jpg")?oe="jpg":ne.includes("png")?oe="png":ne.includes("svg")?oe="svg":ne.includes("gif")?oe="gif":ne.includes("webp")&&(oe="webp"),Ee=`${(o||K||"image").replace(wa,"")}.${oe}`;}d(Ee,_,_.type);}catch(M){window.open(n,"_blank");}};return n?n==="streamdown:incomplete-image"?jsx("div",{className:d$1("group relative my-4 inline-block"),"data-incomplete":"true","data-streamdown":"image-wrapper",children:jsx("div",{className:d$1("h-24 w-48 animate-pulse rounded-lg bg-muted"),"data-streamdown":"image-placeholder"})}):jsxs(Fragment,{children:[jsxs("div",{className:d$1("group/image not-prose relative my-2 block max-w-full"),"data-streamdown":"image-wrapper",children:[jsx("img",{alt:o,className:d$1("m-0 block h-auto max-w-full rounded-lg",V&&"cursor-zoom-in",I&&"hidden",t),"data-streamdown":"image",onClick:ue,onError:X,onLoad:Z,ref:m,src:n,...l}),I&&jsx("span",{className:d$1("text-muted-foreground text-xs italic"),"data-streamdown":"image-fallback",children:x.imageNotAvailable}),H&&jsx("button",{"aria-label":x.downloadImage,className:d$1("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:pe,title:x.downloadImage,type:"button",children:jsx(i$1,{size:14})})]}),f$1?createPortal(jsxs("div",{className:d$1("fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"),"data-streamdown":"image-lightbox",onClick:J,onKeyDown:R=>{R.key==="Escape"&&J();},role:"button",tabIndex:0,children:[jsx("button",{"aria-label":x.exitFullscreen,className:d$1("absolute top-4 right-4 z-10 rounded-md p-2 text-white/80 transition-colors hover:bg-white/10 hover:text-white"),onClick:J,title:x.exitFullscreen,type:"button",children:jsx(c,{size:20})}),jsx("div",{onClick:R=>R.stopPropagation(),onKeyDown:R=>R.stopPropagation(),role:"presentation",children:jsx("img",{alt:o,className:d$1("max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)] object-contain"),"data-streamdown":"image-lightbox-img",src:n})})]}),document.body):null]}):null};var Me=e=>{let t=typeof e=="function"?e():e;return t!=null?t:document.body};var uo=({url:e,isOpen:t,onClose:n,onConfirm:o})=>{let{CheckIcon:r,CopyIcon:s,ExternalLinkIcon:a,XIcon:l}=B(),i$1=f(),[c,d]=useState(false),m=i(),{portal:u}=useContext(T),g=useCallback(async()=>{try{await navigator.clipboard.writeText(e),d(!0),setTimeout(()=>d(!1),2e3);}catch(f){}},[e]),p=useCallback(()=>{o(),n();},[o,n]);if(useEffect(()=>{if(t){ce();let f=b=>{b.key==="Escape"&&n();};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f),de();}}},[t,n]),!t||typeof document=="undefined")return null;let h=jsx("div",{className:i$1("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),"data-streamdown":"link-safety-modal",onClick:n,onKeyDown:f=>{f.key==="Escape"&&n();},role:"button",tabIndex:0,children:jsxs("div",{className:i$1("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),onClick:f=>f.stopPropagation(),onKeyDown:f=>f.stopPropagation(),role:"presentation",children:[jsx("button",{"aria-label":m.close,className:i$1("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:n,title:m.close,type:"button",children:jsx(l,{size:16})}),jsxs("div",{className:i$1("flex flex-col gap-2"),children:[jsxs("div",{className:i$1("flex items-center gap-2 font-semibold text-lg"),children:[jsx(a,{size:20}),jsx("span",{children:m.openExternalLink})]}),jsx("p",{className:i$1("text-muted-foreground text-sm"),children:m.externalLinkWarning})]}),jsx("div",{className:i$1("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$1("flex gap-2"),children:[jsx("button",{className:i$1("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:g,type:"button",children:c?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$1("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),onClick:p,type:"button",children:[jsx(a,{size:14}),jsx("span",{children:m.openLink})]})]})]})});return createPortal(h,Me(u))};var po=()=>e=>{visit(e,"html",(n,o,r)=>{!r||typeof o!="number"||(r.children[o]={type:"text",value:n.value});});};var go=[],bo={allowDangerousHtml:true},ht=new WeakMap,Yt=class{constructor(){this.cache=new Map;this.keyCache=new WeakMap;this.maxSize=100;}generateCacheKey(t){let n=this.keyCache.get(t);if(n)return n;let o=t.rehypePlugins,r=t.remarkPlugins,s=t.remarkRehypeOptions;if(!(o||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 g=0;g<m.length;g+=1){let p=m[g];if(g>0&&(u+=","),Array.isArray(p)){let[h,f]=p;if(typeof h=="function"){let b=ht.get(h);b||(b=h.name,ht.set(h,b)),u+=b;}else u+=String(h);u+=":",u+=JSON.stringify(f);}else if(typeof p=="function"){let h=ht.get(p);h||(h=p.name,ht.set(p,h)),u+=h;}else u+=String(p);}return u},l=a(o),i=a(r),c=s?JSON.stringify(s):"",d=`${i}::${l}::${c}`;return this.keyCache.set(t,d),d}get(t){let n=this.generateCacheKey(t),o=this.cache.get(n);return o&&(this.cache.delete(n),this.cache.set(n,o)),o}set(t,n){let o=this.generateCacheKey(t);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r);}this.cache.set(o,n);}clear(){this.cache.clear();}},ho=new Yt,Ue=e=>{let t=Ha(e),n=e.children||"",o=t.runSync(t.parse(n),n);return $a(o,e)},Ha=e=>{let t=ho.get(e);if(t)return t;let n=Va(e);return ho.set(e,n),n},Ba=e=>e.some(t=>Array.isArray(t)?t[0]===fo:t===fo),Va=e=>{let t=e.rehypePlugins||go,n=e.remarkPlugins||go,o=Ba(t)?n:[...n,po],r=e.remarkRehypeOptions?{...bo,...e.remarkRehypeOptions}:bo;return unified().use(Na).use(o).use(Aa,r).use(t)},yo=e=>e,_a=(e,t,n,o)=>{n?e.children.splice(t,1):e.children[t]={type:"text",value:o};},ja=(e,t)=>{var n;for(let o in urlAttributes)if(Object.hasOwn(urlAttributes,o)&&Object.hasOwn(e.properties,o)){let r=e.properties[o],s=urlAttributes[o];(s===null||s.includes(e.tagName))&&(e.properties[o]=(n=t(String(r||""),o,e))!=null?n:void 0);}},Fa=(e,t,n,o,r,s)=>{let a=false;return o?a=!o.includes(e.tagName):r&&(a=r.includes(e.tagName)),!a&&s&&typeof t=="number"&&(a=!s(e,t,n)),a},$a=(e,t)=>{let{allowElement:n,allowedElements:o,disallowedElements:r,skipHtml:s,unwrapDisallowed:a,urlTransform:l}=t;if(n||o||r||s||l){let c=l||yo;visit(e,(d,m,u)=>{if(d.type==="raw"&&u&&typeof m=="number")return _a(u,m,s,d.value),m;if(d.type==="element"&&(ja(d,c),Fa(d,m,u,o,r,n)&&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 Co=/[(){}[\]]/,za=/[\s;]/,Wa=/^[\w-]+$/,qa=/:::[\w-]+\s*$/,Ka=/^[/\\]/,Ua=/[/\\]$/,Za=/("[^"]*")/,Xa=[["((","))"],["))","(("],["{{","}}"],["[","]"],["(",")"],[")","("]],Ze=e=>`"${e.replace(/"/g,"#quot;")}"`,Ja=e=>e.length>=2&&e.startsWith('"')&&e.endsWith('"'),Ga=e=>{var o,r,s,a;let t=e.split(`
6
+ `),n=0;if(((o=t[n])==null?void 0:o.trim())==="---"){for(n+=1;n<t.length&&((r=t[n])==null?void 0:r.trim())!=="---";)n+=1;n+=1;}for(;n<t.length;){let l=(a=(s=t[n])==null?void 0:s.trim())!=null?a:"";if(l&&!l.startsWith("%%")){let i=l.split(za,1)[0];return i==="mindmap"?"mindmap":i==="flowchart"||i==="graph"?"flowchart":null}n+=1;}return null},Ya=e=>{for(let[t,n]of Xa){let o=e.indexOf(t);if(o===-1||!e.endsWith(n))continue;let r=e.slice(0,o);if(r&&!Wa.test(r))continue;let s=e.slice(o+t.length,e.length-n.length);if(!(s.includes(n)&&n!==t))return {id:r,open:t,close:n,inner:s}}return null},Qa=e=>{let t=e.length-e.trimStart().length,n=e.slice(0,t),o=e.trim();if(!o||o.startsWith("%%")||o.startsWith("::icon"))return e;let r=Ya(o);if(r)return !Ja(r.inner)&&(Co.test(r.inner)||r.inner.includes('"'))?`${n}${r.id}${r.open}${Ze(r.inner)}${r.close}`:e;if(Co.test(o)){let s=o.replace(qa,"").trimEnd();return `${n}[${Ze(s)}]`}return e},ei=e=>{let t=e.split(`
7
+ `),n=false;return t.map(o=>n?Qa(o):(o.trim()&&(n=true),o)).join(`
8
+ `)},ti=e=>e.startsWith("(")&&e.endsWith(")")||Ka.test(e)||Ua.test(e),Qt=(e,t)=>e.split(Za).map((n,o)=>o%2===0?t(n):n).join(""),ni=e=>{if(e.trim().startsWith("%%"))return e;let t=Qt(e,n=>n.replace(/\[([^[\]"]*[(){}][^[\]"]*)\]/g,(o,r)=>ti(r)?o:`[${Ze(r)}]`));return t=Qt(t,n=>n.replace(/\{([^{}"]*[()[\]][^{}"]*)\}/g,(o,r)=>`{${Ze(r)}}`)),t=Qt(t,n=>n.replace(/\|([^|"]*[(){}[\]][^|"]*)\|/g,(o,r)=>`|${Ze(r)}|`)),t},oi=e=>e.split(`
9
+ `).map(ni).join(`
10
+ `),xo=e=>{let t=Ga(e);if(!t)return null;let n=t==="mindmap"?ei(e):oi(e);return n===e?null:n};var ri=()=>{if(typeof document=="undefined")return false;let e=document.documentElement;return e.classList.contains("dark")||e.dataset.theme==="dark"||e.dataset.colorMode==="dark"},si=(e,t)=>Array.isArray(t)?t.includes(e):t===e,ai=e=>"getMermaid"in e&&typeof e.getMermaid=="function",ii=e=>"getPlantUml"in e&&typeof e.getPlantUml=="function",li=e=>"getVega"in e&&typeof e.getVega=="function",ci=e=>"getSmiles"in e&&typeof e.getSmiles=="function";var di=e=>{let t=e.split("").reduce((n,o)=>(n<<5)-n+o.charCodeAt(0)|0,0);return `mermaid-${Math.abs(t)}-${Date.now()}-${Math.random().toString(36).slice(2,9)}`},mi=async(e,t,n)=>{try{return await e.render(t,n)}catch(o){let r=xo(n);if(!r)throw o;try{return await e.render(`${t}-autofix`,r)}catch(s){throw o}}},ui=e=>{var t,n;return ai(e)?{name:e.name,type:"diagram",language:e.language,sourceExtension:"mmd",render:async(o,r)=>{let s=e.getMermaid(r);return await mi(s,di(o),o)}}:ii(e)?{name:e.name,type:"diagram",language:e.language,sourceExtension:"puml",render:async(o,r)=>{var l;let s=r,a=(l=s==null?void 0:s.dark)!=null?l:ri();return await e.getPlantUml(s).render(o,{...s,dark:a})}}:li(e)?{name:e.name,type:"diagram",language:e.language,sourceExtension:(t=e.sourceExtension)!=null?t:"json",render:(o,r)=>e.getVega(r).render(o,r)}:ci(e)?{name:e.name,type:"diagram",language:e.language,sourceExtension:(n=e.sourceExtension)!=null?n:"smi",render:(o,r)=>e.getSmiles(r).render(o,r)}:e},wo=e=>{var n;if(!e)return [];let t=[];return e.mermaid&&t.push(e.mermaid),e.plantuml&&t.push(e.plantuml),e.vega&&t.push(e.vega),e.smiles&&t.push(e.smiles),[...t,...(n=e.diagrams)!=null?n:[]].map(ui)},ko=(e,t)=>{var n;return (n=e.find(o=>si(t,o.language)))!=null?n:null};var yt=createContext(null),Ct=()=>useContext(yt),Mm=()=>{var t;let e=Ct();return (t=e==null?void 0:e.code)!=null?t:null};var bi=()=>{let e=Ct();return useMemo(()=>wo(e),[e])},vo=e=>{let t=bi();return ko(t,e)},Ne=()=>{var t;let e=Ct();return (t=e==null?void 0:e.openscad)!=null?t:null};var Po=e=>{var n;let t=Ct();return t!=null&&t.renderers&&e&&(n=t.renderers.find(o=>Array.isArray(o.language)?o.language.includes(e):o.language===e))!=null?n:null};var To={"3mf":"model/3mf",stl:"model/stl"},xt=({children:e,className:t,code:n,config:o,onDownload:r,onError:s})=>{let a=f(),[l,i$1]=useState(false),[c,d$1]=useState(false),m=useRef(null),{controls:u,isAnimating:g}=useContext(T),p=B(),h=Ne(),f$1=i(),b=ke(u,"openscad","model"),y=async x=>{try{if(x==="scad"){d(`${b}.scad`,n,"text/plain"),i$1(!1),r==null||r(x);return}if(!h){s==null||s(new Error("OpenSCAD plugin not available"));return}d$1(!0);let v=h.getOpenScad(o),{data:S}=await v.render(n,{...o,format:x}),L=S.buffer.slice(S.byteOffset,S.byteOffset+S.byteLength);d(`${b}.${x}`,new Blob([L],{type:To[x]}),To[x]),r==null||r(x),i$1(!1);}catch(v){s==null||s(v);}finally{d$1(false);}};return useEffect(()=>{let x=v=>{let S=v.composedPath();m.current&&!S.includes(m.current)&&i$1(false);};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x);}},[]),jsxs("div",{className:a("relative"),ref:m,children:[jsx("button",{"aria-label":f$1.downloadModel,className:a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:g||c,onClick:()=>i$1(!l),title:f$1.downloadModel,type:"button",children:e!=null?e:jsx(p.DownloadIcon,{"aria-hidden":"true",size:14})}),l?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$1.downloadModelAsScad,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>y("scad"),title:f$1.downloadModelAsScad,type:"button",children:f$1.openscadFormatScad}),jsx("button",{"aria-label":f$1.downloadModelAsStl,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>y("stl"),title:f$1.downloadModelAsStl,type:"button",children:f$1.openscadFormatStl}),jsx("button",{"aria-label":f$1.downloadModelAs3mf,className:a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>y("3mf"),title:f$1.downloadModelAs3mf,type:"button",children:f$1.openscadFormat3mf})]}):null]})};var Lo=({code:e,config:t,onFullscreen:n,onExit:o,className:r,...s})=>{let{Maximize2Icon:a,XIcon:l}=B(),i$1=f(),[c,d]=useState(false),{isAnimating:m,controls:u,portal:g}=useContext(T),p=i(),h=(()=>{if(typeof u=="boolean")return u;let b=u.openscad;return b===false?false:b===true||b===void 0?true:b.download!==false})(),f$1=()=>{d(!c);};return useEffect(()=>{if(c){ce();let b=y=>{y.key==="Escape"&&d(false);};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),de();}}},[c]),useEffect(()=>{c?n==null||n():o&&o();},[c,n,o]),jsxs(Fragment,{children:[jsx("button",{className:i$1("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",r),disabled:m,onClick:f$1,title:p.viewFullscreen,type:"button",...s,"aria-label":p.viewFullscreen,children:jsx(a,{"aria-hidden":"true",size:14})}),c?createPortal(jsxs("div",{"aria-label":p.viewFullscreen,"aria-modal":"true",className:i$1("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),"data-streamdown":"openscad-fullscreen",onClick:f$1,onKeyDown:b=>{b.key==="Escape"&&f$1();},role:"dialog",children:[jsxs("div",{className:i$1("absolute top-4 right-4 z-10 flex items-center gap-1"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:[h?jsx(xt,{code:e,config:t}):null,jsx("button",{"aria-label":p.exitFullscreen,className:i$1("rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:f$1,title:p.exitFullscreen,type:"button",children:jsx(l,{"aria-hidden":"true",size:20})})]}),jsx("div",{className:i$1("flex size-full items-center justify-center p-4"),onClick:b=>b.stopPropagation(),onKeyDown:b=>b.stopPropagation(),role:"presentation",children:jsx(Io,{className:i$1("size-full"),code:e,config:t,fullscreen:true})})]}),Me(g)):null]})};var tn=e=>e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(tn).join(""):isValidElement(e)?tn(e.props.children):"",Mo=(e,t,n)=>n!=null?n:(t?toText(t):tn(e)).replace(/\s+/g," ").trim()||void 0;function nn(e){var n;if(e.nodeType===Node.TEXT_NODE)return (n=e.textContent)!=null?n:"";if(e.nodeType!==Node.ELEMENT_NODE)return "";let t=e;return t.tagName==="BR"?`
11
+ `:Array.from(t.childNodes).map(nn).join("")}var Ae=e=>{let t=[],n=[],o=e.querySelectorAll("thead th");for(let s of o)t.push(nn(s).trim());let r=e.querySelectorAll("tbody tr");for(let s of r){let a=[],l=s.querySelectorAll("td");for(let i of l)a.push(nn(i).trim());n.push(a);}return {headers:t,rows:n}},Je=e=>{var n;if(typeof e!="object")return ",";let t=e.table;return typeof t!="object"?",":(n=t.csvSeparator)!=null?n:","},Se=(e,t=",")=>{let n;t==="auto"?Intl.NumberFormat().format(1.1).includes(",")?n=";":n=",":n=t;let{headers:o,rows:r}=e,s=c=>{let d=false;for(let m of c)if(m===n||m==='"'||m===`
12
+ `||m==="\r"){d=true;break}return d?`"${c.replace(/"/g,'""')}"`:c},a=o.length>0?r.length+1:r.length,l=new Array(a),i=0;o.length>0&&(l[i]=o.map(s).join(n),i+=1);for(let c of r)l[i]=c.map(s).join(n),i+=1;return l.join(`
13
+ `)},on=e=>{let{headers:t,rows:n}=e,o=l=>{let i=false;for(let d of l)if(d===" "||d===`
14
+ `||d==="\r"){i=true;break}if(!i)return l;let c=[];for(let d of l)d===" "?c.push("\\t"):d===`
15
+ `?c.push("\\n"):d==="\r"?c.push("\\r"):c.push(d);return c.join("")},r=t.length>0?n.length+1:n.length,s=new Array(r),a=0;t.length>0&&(s[a]=t.map(o).join(" "),a+=1);for(let l of n)s[a]=l.map(o).join(" "),a+=1;return s.join(`
16
+ `)},wt=e=>{let t=false;for(let o of e)if(o==="\\"||o==="|"||o===`
17
+ `){t=true;break}if(!t)return e;let n=[];for(let o of e)o==="\\"?n.push("\\\\"):o==="|"?n.push("\\|"):o===`
18
+ `?n.push("<br>"):n.push(o);return n.join("")},De=e=>{let{headers:t,rows:n}=e;if(t.length===0)return "";let o=new Array(n.length+2),r=0,s=t.map(l=>wt(l));o[r]=`| ${s.join(" | ")} |`,r+=1;let a=new Array(t.length);for(let l=0;l<t.length;l+=1)a[l]="---";o[r]=`| ${a.join(" | ")} |`,r+=1;for(let l of n)if(l.length<t.length){let i=new Array(t.length);for(let c=0;c<t.length;c+=1)i[c]=c<l.length?wt(l[c]):"";o[r]=`| ${i.join(" | ")} |`,r+=1;}else {let i=l.map(c=>wt(c));o[r]=`| ${i.join(" | ")} |`,r+=1;}return o.join(`
19
+ `)};var Ye=({children:e,className:t,onCopy:n,onError:o,timeout:r=2e3})=>{let s=f(),[a,l]=useState(false),[i$1,c]=useState(false),d=useRef(null),m=useRef(0),{isAnimating:u,controls:g}=useContext(T),p=i(),h=Je(g),f$1=ze(g,"table"),b=n!=null?n:f$1.onCopy,y=o!=null?o:f$1.onError,x=async L=>{var H,I;if(typeof window=="undefined"||!((H=navigator==null?void 0:navigator.clipboard)!=null&&H.write)){y==null||y(new Error("Clipboard API not available"));return}try{let V=(I=d.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),Z=V==null?void 0:V.querySelector("table");if(!Z){y==null||y(new Error("Table not found"));return}let X=Ae(Z),P="";L==="csv"?P=Se(X,h):L==="tsv"?P=on(X):P=De(X);let J=new ClipboardItem({"text/plain":new Blob([P],{type:"text/plain"}),"text/html":new Blob([Z.outerHTML],{type:"text/html"})});await navigator.clipboard.write([J]),c(!0),l(!1),b==null||b(L),m.current=window.setTimeout(()=>c(!1),r);}catch(V){y==null||y(V);}};useEffect(()=>{let L=H=>{let I=H.composedPath();d.current&&!I.includes(d.current)&&l(false);};return document.addEventListener("mousedown",L),()=>{document.removeEventListener("mousedown",L),window.clearTimeout(m.current);}},[]);let v=B(),S=i$1?v.CheckIcon:v.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:()=>l(!a),title:p.copyTable,type:"button",children:e!=null?e:jsx(S,{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:()=>x("md"),title:p.copyTableAsMarkdown,type:"button",children:p.tableFormatMarkdown}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>x("csv"),title:p.copyTableAsCsv,type:"button",children:p.tableFormatCsv}),jsx("button",{className:s("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>x("tsv"),title:p.copyTableAsTsv,type:"button",children:p.tableFormatTsv})]}):null]})};var Mi=({children:e,className:t,onDownload:n,onError:o,format:r="csv",filename:s})=>{let a=f(),{isAnimating:l,controls:i$1}=useContext(T),c=i(),d$1=B(),m=Je(i$1),u=g=>{try{let h=g.currentTarget.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),f=h==null?void 0:h.querySelector("table");if(!f){o==null||o(new Error("Table not found"));return}let b=Ae(f),y="",x="",v="";switch(r){case "csv":y=Se(b,m),x="text/csv",v="csv";break;case "markdown":y=De(b),x="text/markdown",v="md";break;default:y=Se(b,m),x="text/csv",v="csv";}d(`${s||ke(i$1,"table","table")}.${v}`,y,x),n==null||n();}catch(p){o==null||o(p);}};return jsx("button",{"aria-label":r==="csv"?c.downloadTableAsCsv:c.downloadTableAsMarkdown,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:r==="csv"?c.downloadTableAsCsv:c.downloadTableAsMarkdown,type:"button",children:e!=null?e:jsx(d$1.DownloadIcon,{size:14})})},Qe=({children:e,className:t,onDownload:n,onError:o})=>{let r=f(),[s,a]=useState(false),l=useRef(null),{isAnimating:i$1,controls:c}=useContext(T),d$1=i(),m=B(),u=Je(c),g=p=>{var h;try{let f=(h=l.current)==null?void 0:h.closest('[data-streamdown="table-wrapper"], [data-streamdown="table-fullscreen"]'),b=f==null?void 0:f.querySelector("table");if(!b){o==null||o(new Error("Table not found"));return}let y=Ae(b),x=p==="csv"?Se(y,u):De(y),v=p==="csv"?"csv":"md",S=`${ke(c,"table","table")}.${v}`;d(S,x,p==="csv"?"text/csv":"text/markdown"),a(!1),n==null||n(p);}catch(f){o==null||o(f);}};return useEffect(()=>{let p=h=>{let f=h.composedPath();l.current&&!f.includes(l.current)&&a(false);};return document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[]),jsxs("div",{className:r("relative"),ref:l,children:[jsx("button",{"aria-label":d$1.downloadTable,className:r("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:i$1,onClick:()=>a(!s),title:d$1.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",{"aria-label":d$1.downloadTableAsCsv,className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("csv"),title:d$1.downloadTableAsCsv,type:"button",children:d$1.tableFormatCsv}),jsx("button",{"aria-label":d$1.downloadTableAsMarkdown,className:r("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),onClick:()=>g("markdown"),title:d$1.downloadTableAsMarkdown,type:"button",children:d$1.tableFormatMarkdown})]}):null]})};var Bo=({children:e,className:t,showCopy:n=true,showDownload:o=true})=>{let{Maximize2Icon:r,XIcon:s}=B(),a=f(),[l,i$1]=useState(false),{isAnimating:c,portal:d}=useContext(T),m=i(),u=()=>{i$1(true);},g=()=>{i$1(false);};return useEffect(()=>{if(l){ce();let p=h=>{h.key==="Escape"&&i$1(false);};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p),de();}}},[l]),jsxs(Fragment,{children:[jsx("button",{"aria-label":m.viewFullscreen,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:m.viewFullscreen,type:"button",children:jsx(r,{size:14})}),l?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:g,onKeyDown:p=>{p.key==="Escape"&&g();},role:"dialog",children:jsxs("div",{className:a("flex h-full flex-col"),onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),role:"presentation",children:[jsxs("div",{className:a("flex items-center justify-end gap-1 p-4"),children:[n?jsx(Ye,{}):null,o?jsx(Qe,{}):null,jsx("button",{"aria-label":m.exitFullscreen,className:a("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),onClick:g,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})})]})}),Me(d)):null]})};var _o=({children:e,className:t,maxHeight:n,showControls:o,showCopy:r=true,showDownload:s=true,showFullscreen:a=true,...l})=>{let i=f(),{isAnimating:c,scrollable:d}=useContext(T),m=d!=null?d:je,u=b(n),g=pt({content:e,enabled:!!u,isAnimating:c}),p=o&&r,h=o&&s,f$1=o&&a,b$1=p||h||f$1;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$1?jsxs("div",{className:i("flex items-center justify-end gap-1"),children:[p?jsx(Ye,{}):null,h?jsx(Qe,{}):null,f$1?jsx(Bo,{showCopy:p,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:g,style:u?{maxHeight:u}:void 0,children:jsx("table",{className:i("w-full table-fixed divide-y divide-border",t),"data-streamdown":"table",...l,children:e})})]})};var Fi=/startLine=(\d+)/,$i=/\bnoLineNumbers\b/,zi=lazy(()=>import('./block-KAMYR4TF.js').then(e=>({default:e.DiagramCodeBlock}))),Wi=lazy(()=>import('./openscad-VI3FNOEN.js').then(e=>({default:e.OpenScad}))),qi=/language-([^\s]+)/,ee=e=>e.props,Ki="node";function D(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return false;let o=e,r=t;for(let s of n)if(s!==Ki&&!Object.is(o[s],r[s]))return false;return true}function Ui(e,t){var n,o;return ((n=e==null?void 0:e.properties)==null?void 0:n.metastring)===((o=t==null?void 0:t.properties)==null?void 0:o.metastring)}function Zi(e){if(typeof e=="string")return e;if(isValidElement(e)){let t=ee(e).children;if(typeof t=="string")return t}}var Xi=(e,t)=>Array.isArray(t)?t.includes(e):t===e,Ji=(e,t)=>!!(t&&Xi(e,t.language)),dn=(e,t)=>typeof e=="boolean"?e:e[t]!==false,ln=(e,t)=>{if(typeof e=="boolean")return e;let n=e.table;return n===false?false:n===true||n===void 0?true:n[t]!==false},jo=(e,t)=>{if(typeof e=="boolean")return e;let n=e.code;return n===false?false:n===true||n===void 0?true:n[t]!==false},cn=(e,t)=>{if(typeof e=="boolean")return e;let n=e.openscad;return n===false?false:n===true||n===void 0?true:n[t]!==false},tt=createContext({depth:0,ulDepth:0,isUnordered:false}),Gi={flat:["list-disc"],hierarchical:["list-disc","list-[circle]","list-[square]"]},mn=memo(({children:e,className:t,node:n,...o})=>{let r=f(),{depth:s,ulDepth:a}=useContext(tt),l=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",...o,children:jsx(tt.Provider,{value:l,children:e})})},(e,t)=>D(e,t));mn.displayName="MarkdownOl";var qo=memo(({children:e,className:t,node:n,...o})=>{var h;let r=f(),{depth:s,ulDepth:a,isUnordered:l}=useContext(tt),{listStyle:i}=useContext(T),c=Gi[i],d=l&&a>0?c[(a-1)%c.length]:void 0,m=Array.isArray(e)?e.filter(f=>f!==`
20
+ `&&f!==""):[e],u=m[0],g=isValidElement(u)?(h=ee(u).node)==null?void 0:h.tagName:void 0,p=m.length===1&&isValidElement(u)&&(u.type==="p"||g==="p")?ee(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",...o,children:p}):jsx("li",{className:r("py-1 [&>p]:inline",d,t),"data-depth":s>0?s-1:0,"data-streamdown":"list-item",...o,children:p})},(e,t)=>D(e,t));qo.displayName="MarkdownLi";var Ko=memo(({children:e,className:t,node:n,...o})=>{let r=f(),{depth:s,ulDepth:a}=useContext(tt),l=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",...o,children:jsx(tt.Provider,{value:l,children:e})})},(e,t)=>D(e,t));Ko.displayName="MarkdownUl";var Uo=memo(({className:e,node:t,...n})=>{let o=f();return jsx("hr",{className:o("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n})},(e,t)=>D(e,t));Uo.displayName="MarkdownHr";var Zo=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("span",{className:r("font-semibold",t),"data-streamdown":"strong",...o,children:e})},(e,t)=>D(e,t));Zo.displayName="MarkdownStrong";var Yi=({children:e,className:t,href:n,node:o,...r})=>{let s=f(),{linkSafety:a}=useContext(T),[l,i]=useState(false),c=n==="streamdown:incomplete-link",d=useCallback(async p=>{if(!(!(a!=null&&a.enabled&&n)||c)){if(p.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(n)){window.open(n,"_blank","noreferrer");return}i(true);}},[a,n,c]),m=useCallback(()=>{n&&window.open(n,"_blank","noreferrer");},[n]),u=useCallback(()=>{i(false);},[]),g={url:n!=null?n:"",isOpen:l,onClose:u,onConfirm:m};return a!=null&&a.enabled&&n?jsxs(Fragment,{children:[jsx("button",{className:s("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",onClick:d,type:"button",children:e}),a.renderModal?a.renderModal(g):jsx(uo,{...g})]}):jsx("a",{className:s("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":c,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...r,children:e})},Xo=memo(Yi,(e,t)=>D(e,t));Xo.displayName="MarkdownA";var Jo=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h1",{className:r("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...o,children:e})},(e,t)=>D(e,t));Jo.displayName="MarkdownH1";var Go=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h2",{className:r("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...o,children:e})},(e,t)=>D(e,t));Go.displayName="MarkdownH2";var Yo=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h3",{className:r("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...o,children:e})},(e,t)=>D(e,t));Yo.displayName="MarkdownH3";var Qo=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h4",{className:r("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...o,children:e})},(e,t)=>D(e,t));Qo.displayName="MarkdownH4";var er=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h5",{className:r("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...o,children:e})},(e,t)=>D(e,t));er.displayName="MarkdownH5";var tr=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("h6",{className:r("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...o,children:e})},(e,t)=>D(e,t));tr.displayName="MarkdownH6";var nr=memo(({children:e,className:t,node:n,...o})=>{let{controls:r,tableMaxHeight:s}=useContext(T),a=dn(r,"table"),l=ln(r,"copy"),i=ln(r,"download"),c=ln(r,"fullscreen");return jsx(_o,{className:t,maxHeight:s,showControls:a,showCopy:l,showDownload:i,showFullscreen:c,...o,children:e})},(e,t)=>D(e,t));nr.displayName="MarkdownTable";var or=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("thead",{className:r("bg-muted/80",t),"data-streamdown":"table-header",...o,children:e})},(e,t)=>D(e,t));or.displayName="MarkdownThead";var rr=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("tbody",{className:r("divide-y divide-border",t),"data-streamdown":"table-body",...o,children:e})},(e,t)=>D(e,t));rr.displayName="MarkdownTbody";var sr=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("tr",{className:r("border-border",t),"data-streamdown":"table-row",...o,children:e})},(e,t)=>D(e,t));sr.displayName="MarkdownTr";var ar=memo(({children:e,className:t,node:n,title:o,...r})=>{let s=f(),a=Mo(e,n,o);return jsx("th",{className:s("min-w-0 overflow-hidden px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,title:a,children:jsx("span",{className:s("wrap-anywhere line-clamp-2"),children:e})})},(e,t)=>D(e,t));ar.displayName="MarkdownTh";var ir=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("td",{className:r("wrap-anywhere min-w-0 px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...o,children:e})},(e,t)=>D(e,t));ir.displayName="MarkdownTd";var lr=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("blockquote",{className:r("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...o,children:e})},(e,t)=>D(e,t));lr.displayName="MarkdownBlockquote";var cr=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("sup",{className:r("text-sm",t),"data-streamdown":"superscript",...o,children:e})},(e,t)=>D(e,t));cr.displayName="MarkdownSup";var Qi=()=>({}),el=e=>{try{let t=atob(e),n=Uint8Array.from(t,o=>o.charCodeAt(0));return new TextDecoder().decode(n)}catch(t){return ""}},dr=memo(({children:e,className:t,node:n,...o})=>{let r=f(),{calloutIcon:s,calloutStyle:a,components:l,remarkPlugins:i,rehypePlugins:c}=useContext(T),d=o,m=d["data-callout-title"],u=d["data-callout-color"],g=d["data-callout-icon"],p=d["data-callout-body"],h=p?el(p):"",f$1=(a!=null?a:Qi)(u),b=g&&s?s(g):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:f$1,...o,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:l,rehypePlugins:c,remarkPlugins:i,children:h}):null]})},(e,t)=>D(e,t));dr.displayName="MarkdownCallout";var Fo={"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"},mr=memo(({children:e,className:t,node:n,...o})=>{let r=f(),s=t==null?void 0:t.includes("markdown-alert");if(t==null?void 0:t.includes("sdm-callout"))return jsx(dr,{className:t,node:n,...o,children:e});if(s){let l=Object.keys(Fo).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",l?Fo[l]:null,t),...o,children:e})}return jsx("div",{className:r(t),...o,children:e})},(e,t)=>D(e,t));mr.displayName="MarkdownDiv";var ur=memo(({children:e,className:t,node:n,...o})=>{let r=f();return jsx("sub",{className:r("text-sm",t),"data-streamdown":"subscript",...o,children:e})},(e,t)=>D(e,t));ur.displayName="MarkdownSub";var pr=memo(({children:e,className:t,node:n,...o})=>{if("data-footnotes"in o){let s=i=>{if(!isValidElement(i))return false;let c=ee(i).children,d=Array.isArray(c)?c:[c],m=false,u=false;for(let g of d)if(g){if(typeof g=="string")g.trim()!==""&&(m=true);else if(isValidElement(g))if(ee(g)["data-footnote-backref"]!==void 0)u=true;else {let p=ee(g).children,h=Array.isArray(p)?p:[p];for(let f of h){if(typeof f=="string"&&f.trim()!==""){m=true;break}if(isValidElement(f)&&ee(f)["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===mn){let c=ee(i).children,m=(Array.isArray(c)?c:[c]).filter(u=>!s(u));return m.length===0?null:{...i,props:{...ee(i),children:m}}}return i}):e;return (Array.isArray(a)?a.some(i=>i!==null):a!==null)?jsx("section",{className:t,...o,children:a}):null}return jsx("section",{className:t,...o,children:e})},(e,t)=>D(e,t));pr.displayName="MarkdownSection";var tl=({node:e,className:t,children:n,...o})=>{var ue,pe,Te;let r=f(),s=!("data-block"in o),a=useContext(T),{openscad:l,controls:i$1,lineNumbers:c}=a,d=t==null?void 0:t.match(qi),m=(ue=d==null?void 0:d.at(1))!=null?ue:"",u=vo(m),g=Ne(),p=_e(),h=i(),f$1=Po(m);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",...o,children:n});let b=(pe=e==null?void 0:e.properties)==null?void 0:pe.metastring,y=typeof b=="string"?b:void 0,x=y==null?void 0:y.match(Fi),v=x?Number.parseInt(x[1],10):void 0,S=v!==void 0&&v>=1?v:void 0,H=!(y?$i.test(y):false)&&c!==false,I=(Te=Zi(n))!=null?Te:"";if(f$1){let R=f$1.component;return jsx(Suspense,{fallback:jsx(We,{}),children:jsx(R,{code:I,isIncomplete:p,language:m,meta:y})})}if(u)return jsx(Suspense,{fallback:jsx(We,{}),children:jsx(zi,{className:t,code:I,isBlockIncomplete:p,language:m,plugin:u})});if(Ji(m,g)){let R=dn(i$1,"openscad"),M=cn(i$1,"download"),_=cn(i$1,"copy"),le=cn(i$1,"fullscreen"),K=R&&(M||_||le);return jsx(Suspense,{fallback:jsx(We,{}),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":p||void 0,"data-streamdown":"openscad-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:m})}),K?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":"openscad-block-actions",children:[M?jsx(xt,{code:I,config:l==null?void 0:l.config}):null,_?jsx(gt,{code:I,label:h.copyModel,...ze(i$1,"openscad")}):null,le?jsx(Lo,{code:I,config:l==null?void 0:l.config}):null]})}):null,jsx("div",{className:r("rounded-md border border-border bg-background"),children:jsx(Wi,{code:I,config:l==null?void 0:l.config})})]})})}let V=dn(i$1,"code"),Z=jo(i$1,"download"),X=jo(i$1,"copy"),{"data-block":P,...J}=o;return jsx(Wt,{className:t,code:I,isIncomplete:p,language:m,lineNumbers:H,startLine:S,...J,children:V?jsxs(Fragment,{children:[Z?jsx(Ut,{code:I,language:m}):null,X?jsx(gt,{...ze(i$1,"code")}):null]}):null})},fr=memo(tl,(e,t)=>D(e,t)&&Ui(e.node,t.node));fr.displayName="MarkdownCode";var gr=memo(lo,(e,t)=>D(e,t));gr.displayName="MarkdownImg";var $o={caution:"alertCaution",important:"alertImportant",note:"alertNote",tip:"alertTip",warning:"alertWarning"},br=memo(({children:e,className:t,node:n,...o})=>{let r=f(),s=i(),a=o["data-alert-type"],l=a&&a in $o?$o[a]:void 0,i$1=l?s[l]:void 0,c=e;return i$1&&(c=[...(Array.isArray(e)?e:[e]).filter(u=>!(typeof u=="string"&&u.trim().length>0)),i$1]),jsx("p",{className:r("mb-1 flex items-center gap-2 font-semibold [&>svg]:inline-block",t),...o,children:c})},(e,t)=>D(e,t));br.displayName="MarkdownAlertTitle";var hr=memo(({children:e,className:t,node:n,...o})=>{if(t!=null&&t.includes("markdown-alert-title"))return jsx(br,{className:t,node:n,...o,children:e});let s=(Array.isArray(e)?e:[e]).filter(a=>a!=null&&a!=="");if(s.length===1&&isValidElement(s[0])){let a=ee(s[0]).node,l=a==null?void 0:a.tagName;if(l==="img")return jsx(Fragment,{children:e});if(l==="code"&&"data-block"in s[0].props)return jsx(Fragment,{children:e})}return jsx("p",{className:t,...o,children:e})},(e,t)=>D(e,t));hr.displayName="MarkdownParagraph";var yr={ol:mn,li:qo,ul:Ko,hr:Uo,strong:Zo,a:Xo,h1:Jo,h2:Go,h3:Yo,h4:Qo,h5:er,h6:tr,table:nr,thead:or,tbody:rr,tr:sr,th:ar,td:ir,blockquote:lr,code:fr,div:mr,img:gr,pre:({children:e})=>isValidElement(e)?cloneElement(e,{"data-block":"true"}):e,sup:cr,sub:ur,p:hr,section:pr};var nl=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ol=/\p{L}/u;function nt(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,"").replace(/^#{1,6}\s+/gm,"").replace(/(\*{1,3}|_{1,3})/g,"").replace(/`[^`]*`/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[\s>*\-+\d.]+/gm,""),n,o=0,r=0;for(let s of t){if(nl.test(s)){n!=null||(n="rtl"),r+=1;continue}ol.test(s)&&(n!=null||(n="ltr"),o+=1);}return r>o?"rtl":o>r?"ltr":n!=null?n:"ltr"}var rl=/^[ \t]{0,3}(`{3,}|~{3,})/;var Cr=e=>{let t=e.split(`
21
+ `),n=null,o=0;for(let r of t){let s=rl.exec(r);if(n===null){if(s){let a=s[1];n=a[0],o=a.length;}}else if(s){let a=s[1],l=a[0],i=a.length;l===n&&i>=o&&(n=null,o=0);}}return n!==null};var al=/\[\^[\w-]{1,200}\](?!:)/,il=/\[\^[\w-]{1,200}\]:/,ll=/<([A-Za-z][\w:-]*)[\s>/]/,cl=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),xr=new Map,wr=new Map,Pr=e=>{let t=e.toLowerCase(),n=xr.get(t);if(n)return n;let o=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi");return xr.set(t,o),o},dl=e=>{let t=e.toLowerCase(),n=wr.get(t);if(n)return n;let o=new RegExp(`</${t}(?=[\\s>])[^>]*>`,"gi");return wr.set(t,o),o},kr=(e,t)=>{if(cl.has(t.toLowerCase()))return 0;let n=e.match(Pr(t));if(!n)return 0;let o=0;for(let r of n)r.trimEnd().endsWith("/>")||(o+=1);return o},vr=(e,t)=>{let n=e.match(dl(t));return n?n.length:0},ml=(e,t)=>{let n=e.match(Pr(t));return !!n&&n.every(o=>o.trimEnd().endsWith("/>"))},ul=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]==="$"&&e[n+1]==="$"&&(t+=1,n+=1);return t},Sr=e=>al.test(e)||il.test(e),pl=/\r\n|\r/g,fl=e=>new Lexer({gfm:true}).blockTokens(e),gl=`
22
+
23
+ `,bl=e=>{var t;for(let n=e.length-3;n>=0;n-=1)if((t=e.at(n))!=null&&t.endsWith(gl))return n+1;return 0},hl=e=>` ${e}`.slice(1),un=(e,t)=>({source:e,blocks:t(e),verifiedCount:0,verifiedLength:0}),yl=(e,t,n)=>{var l,i,c,d;let o=bl(e.blocks);if(o===0)return null;let r=(l=e.verifiedCount)!=null?l:0,s=(i=e.verifiedLength)!=null?i:0;if(r>o){r=o,s=0;for(let m=0;m<r;m+=1)s+=(d=(c=e.blocks.at(m))==null?void 0:c.length)!=null?d:0;}for(;r<o;){let m=e.blocks.at(r);if(m===void 0||!t.startsWith(m,s))return null;s+=m.length,r+=1;}let a=n(t.slice(s)).map(hl);return {source:t,blocks:e.blocks.slice(0,o).concat(a),verifiedCount:r,verifiedLength:s}},ot=e=>{if(Sr(e))return [e];let t=e.includes("\r")?e.replace(pl,`
24
+ `):e,n=fl(t),o=[],r=[],s=false;for(let a of n){let l=a.raw,i=o.length;if(r.length>0){o[i-1]+=l;let c=r.at(-1),d=kr(l,c),m=vr(l,c);for(let u=0;u<d;u+=1)r.push(c);for(let u=0;u<m;u+=1)r.length>0&&r.at(-1)===c&&r.pop();continue}if(a.type==="html"&&a.block){let c=l.match(ll);if(c){let d=c[1],m=kr(l,d),u=vr(l,d);m>u&&!ml(l,d)&&r.push(d);}}if(a.type==="space"&&i>0){o[i-1]+=l;continue}if(i>0&&!s){let c=o[i-1];if(ul(c)%2===1){o[i-1]=c+l;continue}}o.push(l),a.type!=="space"&&(s=a.type==="code");}return o},pn=(e,t,n=ot)=>{var o;return t!=null&&t.source&&e.startsWith(t.source)?e===t.source?t:n===ot&&Sr(e)?un(e,n):(o=yl(t,e,n))!=null?o:un(e,n):un(e,n)};var Cl=/^ {0,3}(`{3,}|~{3,})/,xl=/^\n[ \t]*\n/,Er=(e,t,n)=>{let o=t;for(;o<n&&e[o]==="`";)o+=1;return o},wl=(e,t,n,o)=>{let r=t;for(;r<n;){let s=e[r];if(s==="`"){let a=Er(e,r,n);if(a-r===o)return r;r=a;continue}if(s===`
25
+ `&&xl.test(e.slice(r,r+64)))return -1;r+=1;}return -1},Tr=(e,t,n,o)=>{let r=t;for(;r<n;){if(e[r]!=="`"){r+=1;continue}let s=Er(e,r,n),a=s-r,l=wl(e,s,n,a);if(l===-1){r=s;continue}o.push([r,l+a]),r=l+a;}},kl=e=>{let t=[],n=e.length,o=null,r=0,s=0;for(;s<n;){let a=e.indexOf(`
26
+ `,s),l=a===-1?n:a,i=e.slice(s,l),c=Cl.exec(i);if(o){let d=c==null?void 0:c[1];d&&d[0]===o.char&&d.length>=o.length&&i.slice(c[0].length).trim()===""&&(t.push([o.start,l]),o=null,r=l);}else if(c){let d=c[1],m=i.slice(c[0].length);d[0]==="`"&&m.includes("`")||(Tr(e,r,s,t),o={char:d[0],length:d.length,start:s});}s=l+1;}return o?t.push([o.start,n]):Tr(e,r,n,t),t},vl=(e,t)=>{let n=0,o=e.length-1;for(;n<=o;){let r=Math.floor((n+o)/2),[s,a]=e[r];if(t<s)o=r-1;else if(t>=a)n=r+1;else return true}return false},vt=e=>{let t=null;return n=>(t===null&&(t=kl(e)),vl(t,n))},Rr=(e,t,n)=>{let o=vt(e);return e.replace(t,(r,...s)=>{let a=s.findIndex(i=>typeof i=="number"),l=s[a];return o(l)?r:n(r,...s.slice(0,a))})},Pt=(e,t,n)=>{let o=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi"),r=new RegExp(`</${t}\\s*>`,"gi"),s=vt(e),a="",l=0,i=o.exec(e);for(;i;){if(s(i.index)){i=o.exec(e);continue}let c=i.index+i[0].length;r.lastIndex=c;let d=r.exec(e);for(;d&&s(d.index);)d=r.exec(e);if(!d)break;a+=e.slice(l,i.index)+n(i[0],e.slice(c,d.index),d[0]),l=d.index+d[0].length,o.lastIndex=l,i=o.exec(e);}return l===0?e:a+e.slice(l)};var Pl=/^\n*/,Sl=/\n*$/,fn=/\n\n/g,Tl=(e,t,n)=>{if(!t.includes(`
27
+ `))return e+t+n;let r=t.replace(fn,`
28
+ <!---->
29
+ `).replace(Pl,`
30
+
31
+ `).replace(Sl,`
32
+
33
+ `);return `${e}${r}${n}
34
+
35
+ `},El=(e,t)=>{let n=new RegExp(`<${t}(?=[\\s>/])[^>]*>`,"gi"),o=new RegExp(`</${t}\\s*>`,"gi"),r=vt(e),s=c=>{o.lastIndex=c;let d=o.exec(e);for(;d&&r(d.index);)d=o.exec(e);return d!==null},a="",l=0,i=n.exec(e);for(;i;){let c=i[0],d=i.index+c.length;if(r(i.index)){i=n.exec(e);continue}if(s(d)){i=n.exec(e);continue}let m=e.slice(d);if(a+=e.slice(l,i.index),m.length===0){a+=c,l=d,i=n.exec(e);continue}if(m.startsWith(`
36
+
37
+ `)){let p=m.slice(2).replace(fn,`
38
+ <!---->
39
+ `);a+=`${c}
40
+
41
+ ${p}`,l=e.length;break}if(!m.startsWith(`
42
+ `)){a+=c,l=d,i=n.exec(e);continue}let u=m.slice(1);if(u.trim().length===0){a+=c,l=d,i=n.exec(e);continue}let g=u.replace(fn,`
43
+ <!---->
44
+ `);a+=`${c}
45
+
46
+ ${g}`,l=e.length;break}return l===0?e:a+e.slice(l)},gn=(e,t)=>{if(!t.length)return e;let n=e;for(let o of t){let r=new RegExp(`<${o}(?=[\\s>/])((?:"[^"]*"|'[^']*'|[^"'>])*)\\/>`,"gi");n=Rr(n,r,(s,a)=>`<${o}${a}></${o}>`);}return n},Ir=(e,t)=>{if(!t.length)return e;let n=gn(e,t);for(let o of t)n=Pt(n,o,Tl),n=El(n,o);return n};var Rl=/([\\`*_~[\]|])/g,Il=e=>e.replace(Rl,"\\$1"),Lr=(e,t)=>{if(!t.length)return e;let n=e;for(let o of t)n=Pt(n,o,(r,s,a)=>{let l=Il(s).replace(/\n\n/g,"&#10;&#10;");return r+l+a});return n};var Ml=new Set(["blockquote","dd","dt","figcaption","h1","h2","h3","h4","h5","h6","li","p","td","th"]),Mr=new Set(["code","kbd","pre","samp","var"]);function Nr(e){return e.children.map(t=>t.type==="text"?t.value:t.type==="element"&&!Mr.has(t.tagName)?Nr(t):"").join("")}function Ar(){return e=>{visit(e,"element",t=>{if(Mr.has(t.tagName)){(t.properties)!=null||(t.properties={}),t.properties.dir="ltr";return}Ml.has(t.tagName)&&((t.properties)!=null||(t.properties={}),typeof t.properties.dir!="string"&&(t.properties.dir=nt(Nr(t))));});}}var Dr=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(o=>o.toLowerCase()));visit(t,"element",o=>{var s;if(!n.has(o.tagName.toLowerCase()))return;let r=o.children.filter(a=>a.type==="element").map(a=>{var l;return {tag:a.tagName,props:(l=a.properties)!=null?l:{},text:toText(a).trim()}});o.properties=(s=o.properties)!=null?s:{},o.properties["data-content"]=JSON.stringify(r),o.children=[];});};var Or=e=>e.type==="text"?e.value:"children"in e&&Array.isArray(e.children)?e.children.map(Or).join(""):"",Hr=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(o=>o.toLowerCase()));visit(t,"element",o=>{if(n.has(o.tagName.toLowerCase())){let r=Or(o);o.children=r?[{type:"text",value:r}]:[];}});};var _l=e=>e.children.every(t=>t.type==="text"||t.type==="comment"),jl=e=>e.children.map(t=>t.type==="text"?t.value:"").join(""),Fl=e=>{let t=unified().use(Na).use(Aa,{allowDangerousHtml:true}),n=t.parse(e);return t.runSync(n).children},Br=(e,t=[])=>n=>{if(!e||e.length===0)return;let o=new Set(e.map(s=>s.toLowerCase())),r=new Set((t!=null?t:[]).map(s=>s.toLowerCase()));visit(n,"element",s=>{let a=s.tagName.toLowerCase();if(!o.has(a)||r.has(a)||!_l(s))return;let l=jl(s);if(!l.includes(`
47
+ `))return;let i=Fl(l);s.children=i;});};var Vr=()=>e=>{visit(e,"code",t=>{var n,o;t.meta&&(t.data=(n=t.data)!=null?n:{},t.data.hProperties={...(o=t.data.hProperties)!=null?o:{},metastring:t.meta});});};var _r=/^>>>[ \t]?(.*)$/,zl=/^<<<\s*$/,Wl=/^>+\s*$/,ql=/^<+\s*$/,Kl=/^\s*(?:\((?<iconParen>[a-z0-9-]+)\)|\{(?<iconBrace>[a-z0-9-]+)\}(?=\s*\[))?\s*(?:\[(?<title>[^\]]*)\])?\s*(?:\{(?<color>[^}]*)\})?\s*$/i,Ul=/^(?:#[0-9a-f]{3,8}|[a-z]+)$/i,Zl=/^[a-z0-9-]+$/,Xl=e=>{let t=Kl.exec(e);if(!(t!=null&&t.groups))return {};let{iconParen:n,iconBrace:o,title:r,color:s}=t.groups,a=n!=null?n:o;return {icon:a&&Zl.test(a)?a:void 0,title:r!==void 0&&r.length>0?r:void 0,color:s&&Ul.test(s)?s:void 0}},bn=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Jl=e=>{let t=new TextEncoder().encode(e),n="";for(let o of t)n+=String.fromCharCode(o);return btoa(n)},Gl=(e,t)=>{var c;let n=_r.exec(e[t]),o=(c=n==null?void 0:n[1])!=null?c:"",r=Xl(o),s=[],a=t+1;for(;a<e.length;a+=1){let d=e[a];if(zl.test(d)){a+=1;break}if(Wl.test(d)||ql.test(d)){a+=1;break}s.push(d);}let l=s.join(`
48
+ `).trim();return {replacement:`<div ${['class="sdm-callout"',r.title!==void 0?`data-callout-title="${bn(r.title)}"`:"",r.color!==void 0?`data-callout-color="${bn(r.color)}"`:"",r.icon!==void 0?`data-callout-icon="${bn(r.icon)}"`:"",`data-callout-body="${Jl(l)}"`].filter(Boolean).join(" ")}></div>`,next:a}},jr=e=>{if(!e.includes(">>>"))return e;let t=e.split(`
49
+ `),n=[],o=0,r=false;for(;o<t.length;)if(_r.test(t[o])){let s=Gl(t,o);n.push(s.replacement),o=s.next,r=true;}else n.push(t[o]),o+=1;return r?n.join(`
50
+ `):e},Fr=()=>()=>{};var Ql=/^([a-zA-Z][a-zA-Z\d+\-.]*:)/,ec=e=>new Set(e.map(t=>t.trim().toLowerCase()).filter(t=>t.length>0).map(t=>t.endsWith(":")?t:`${t}:`));function tc(e,t){if(e.children.length!==1)return false;let[n]=e.children;if(n.type!=="text")return false;let o=Ql.exec(e.url);if(!o)return false;let r=o[1].toLowerCase();return t.has(r)?r==="mailto:"?e.url===`mailto:${n.value}`:e.url===n.value||e.url===`${r}//${n.value}`:false}var $r=(e=[])=>{let t=ec(e);return n=>{t.size!==0&&visit(n,"link",(o,r,s)=>{if(!(!s||r===void 0)&&tc(o,t))return s.children.splice(r,1,...o.children),r});}};var rc={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"}]}},sc=/^\[!(note|tip|important|warning|caution)\][ \t]*(?:\n|$)/i,zr=e=>{if(e.type==="text")return e.value;let t=e.children;if(!t)return "";let n="";for(let o of t)n+=zr(o);return n},ac=e=>{let t=e.iconPaths.map(n=>`<path d="${n.d}"${n.fillRule?` fill-rule="${n.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}}}},ic=e=>{var m,u;let t=e.children[0];if(!t||t.type!=="paragraph")return;let n=t.children[0];if(!n||n.type!=="text")return;let o=zr(n).trimStart(),r=o.match(sc);if(!r)return;let s=rc[r[1].toUpperCase()],a=o.slice(r[0].length),l=t.children.slice(1);if(a.trim().length===0&&l.length===0&&e.children.length===1)return;let i=[ac(s)],c=[];a.length>0&&c.push({type:"text",value:a});let d=l;return ((m=d[0])==null?void 0:m.type)==="break"&&(d=d.slice(1)),c.push(...d),c.length>0&&c.some(g=>g.type!=="text"||g.value.trim().length>0)&&i.push({type:"paragraph",children:c}),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},Wr=()=>e=>{visit(e,"blockquote",ic);};var bc=/^[ \t]*<[\w!/?-]/,hc=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,yc=e=>typeof e!="string"||e.length===0||!bc.test(e)?e:e.replace(hc,"$1"),Zr,Xr,Jr,Gr,Yr,Qr,es,ts,ns,os,rs,ss,as,St={...defaultSchema,clobberPrefix:"",protocols:{...defaultSchema.protocols,href:[...(Xr=(Zr=defaultSchema.protocols)==null?void 0:Zr.href)!=null?Xr:[],"tel","streamdown"],src:[...(Gr=(Jr=defaultSchema.protocols)==null?void 0:Jr.src)!=null?Gr:[],"streamdown"]},attributes:{...defaultSchema.attributes,code:["metastring",["className",/^(language-.+|math-display|math-inline)$/]],div:[...(Qr=(Yr=defaultSchema.attributes)==null?void 0:Yr.div)!=null?Qr:[],["className",/^(markdown-alert|markdown-alert-(note|tip|important|warning|caution)|sdm-callout)$/],"dataCalloutTitle","dataCalloutColor","dataCalloutIcon","dataCalloutBody"],p:[...(ts=(es=defaultSchema.attributes)==null?void 0:es.p)!=null?ts:[],["className",/^markdown-alert-title$/],"dataAlertType"],svg:[...(os=(ns=defaultSchema.attributes)==null?void 0:ns.svg)!=null?os:[],"className","viewBox","width","height","fill","ariaHidden"],path:[...(ss=(rs=defaultSchema.attributes)==null?void 0:rs.path)!=null?ss:[],"d","fillRule"]},tagNames:[...(as=defaultSchema.tagNames)!=null?as:[],"svg","path"]},hn={raw:fo,sanitize:[cs,St],harden:[harden,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:true}]},Cc={gfm:[fc,{}],githubAlerts:Wr,containerAlerts:Fr,codeMeta:Vr},Kr=Object.values(hn),xc=Object.values(Cc),Ur=new WeakMap;function wc(e){var r;let t=Ur.get(e);if(t)return t;let n={...St,tagNames:[...(r=St.tagNames)!=null?r:[],...Object.keys(e)],attributes:{...St.attributes,...e}},o=[hn.raw,[cs,n],hn.harden];return Ur.set(e,o),o}var kc={block:" \u258B",circle:" \u25CF"},vc=["github-light","github-dark"],Pc={enabled:true},ds=memo(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:o,isIncomplete:r,dir:s,animatePlugin:a,...l})=>{useLayoutEffect(()=>{a==null||a.commit();}),a==null||a.setAnimateCodeBlocks(r);let i=typeof e=="string"&&n?yc(e):e,c=jsx(Ue,{...l,children:i});return jsx(_t.Provider,{value:r,children:s?jsx("div",{dir:s,style:{display:"contents"},children:c}):c})},(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 n=Object.keys(e.components||{}),o=Object.keys(t.components||{});if(n.length!==o.length||n.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)});ds.displayName="Block";var Sc=memo(({children:e$1,mode:t="streaming",dir:n,parseIncompleteMarkdown:o=true,normalizeHtmlIndentation:r=false,components:s,rehypePlugins:a=Kr,remarkPlugins:l=xc,className:i,shikiTheme:c$1,mermaid:d,openscad:m,plantuml:u,smiles:g$1,vega:p,diagrams:h$1,codeBlockMaxHeight:f=400,controls:b=true,isAnimating:y=false,scrollable:x,tableMaxHeight:v=300,animated:S,BlockComponent:L=ds,parseMarkdownIntoBlocksFn:H=ot,caret:I,listStyle:V="hierarchical",calloutIcon:Z,calloutStyle:X,plugins:P,remend:J,linkSafety:ue=Pc,portal:pe,lineNumbers:Te=true,allowedTags:R,literalTagContent:M,dataOnlyTags:_,disableAutolinkProtocols:le,translations:K,icons:Be,prefix:at,onAnimationStart:Ee,onAnimationEnd:ne,...oe})=>{let yn=useId(),it=useMemo(()=>c(at),[at]),Cn=useRef(null),fe=useRef(Ee),lt=useRef(ne);fe.current=Ee,lt.current=ne,useEffect(()=>{var E,$,j;if(t==="static")return;let C=Cn.current;if(Cn.current=y,C===null){y&&((E=fe.current)==null||E.call(fe));return}y&&!C?($=fe.current)==null||$.call(fe):!y&&C&&((j=lt.current)==null||j.call(lt));},[y,t]);let Re=useMemo(()=>R?Object.keys(R):[],[R]),Ie=useMemo(()=>{if(!(_!=null&&_.length||M!=null&&M.length))return Re;let C=new Set([..._!=null?_:[],...M!=null?M:[]].map(E=>E.toLowerCase()));return Re.filter(E=>!C.has(E.toLowerCase()))},[Re,_,M]),xn=useRef(null),Tt=useMemo(()=>{if(typeof e$1!="string")return "";let C=e$1;return M&&M.length>0&&(C=Lr(C,M)),Re.length>0&&(C=gn(C,Re)),Ie.length>0&&(C=Ir(C,Ie)),C=jr(C),C},[Re,e$1,Ie,M]),G=useMemo(()=>{let C=t==="streaming"?xn.current:null,E=pn(Tt,C,H);if(xn.current=t==="streaming"?E:null,!(t==="streaming"&&o)||E.blocks.length===0)return E.blocks;let $=E.blocks.length-1,j=E.blocks[$],re=gc(j,J);if(re===j)return E.blocks;let Ce=E.blocks.slice();return Ce[$]=re,Ce},[Tt,H,t,o,J]),Le=useMemo(()=>S===true?"true":S?JSON.stringify(S):"",[S]),U=useRef(null),Ve=useRef([]),ge=useRef([]),wn=useRef(null),Et=useRef("");if(Le){if(Et.current!==Le){Et.current=Le;let C=Le!=="true"?S.maxBacklogMs:void 0;U.current=Ht({maxBacklogMs:C}),Ve.current=[],ge.current=[];}else U.current||(U.current=Ht());y&&U.current&&U.current.beginPass(U.current.now());}else U.current=null,Ve.current=[],ge.current=[],Et.current="";useLayoutEffect(()=>{var C;y&&((C=U.current)==null||C.commitPass());});let be=useDeferredValue(G),he=useMemo(()=>{if(t!=="streaming"||U.current||be===G||be.length===0)return G;let C=be.length,E=G.length;if(E===0)return be;if(C!==E)return G;for(let j=0;j<C-1;j+=1)if(be[j]!==G[j])return G;let $=be.slice();return $[C-1]=G[E-1],$},[G,be,t]),Rt=useMemo(()=>n==="auto"?he.map(nt):void 0,[he,n]),[kn]=useState(()=>Bn(yn)),ms=useMemo(()=>kn(he),[he,kn]),us=useMemo(()=>K?JSON.stringify(K):"",[K]),vn=useMemo(()=>({...g,...K}),[us]),ct=useMemo(()=>{let{inlineCode:C,...E}=s!=null?s:{},$={...yr,...E};if(C){let j=$.code;$.code=re=>"data-block"in re?j?createElement(j,re):null:createElement(C,re);}return $},[s]),dt=useMemo(()=>{let C=[];return P!=null&&P.cjk&&(C=[...C,...P.cjk.remarkPluginsBefore]),C=[...C,...l],le&&le.length>0&&(C=[...C,[$r,le]]),P!=null&&P.cjk&&(C=[...C,...P.cjk.remarkPluginsAfter]),P!=null&&P.math&&(C=[...C,P.math.remarkPlugin]),C},[l,P==null?void 0:P.math,P==null?void 0:P.cjk,le]),ye=useMemo(()=>{let C=a;return R&&Object.keys(R).length>0&&a===Kr&&(C=wc(R)),Ie.length>0&&(C=[...C,[Br,Ie,M!=null?M:[]]]),M&&M.length>0&&(C=[...C,[Hr,M]]),_&&_.length>0&&(C=[...C,[Dr,_]]),P!=null&&P.math&&(C=[...C,P.math.rehypePlugin]),n==="auto"&&t==="static"&&(C=[...C,Ar]),C},[a,P==null?void 0:P.math,R,Ie,M,_,n,t]),Pn=useMemo(()=>{var C,E;return {calloutIcon:Z,calloutStyle:X,codeBlockMaxHeight:f,shikiTheme:(E=c$1!=null?c$1:(C=P==null?void 0:P.code)==null?void 0:C.getThemes())!=null?E:vc,controls:b,isAnimating:y,lineNumbers:Te,listStyle:V,mode:t,mermaid:d,openscad:m,plantuml:u,smiles:g$1,vega:p,diagrams:h$1,linkSafety:ue,portal:pe,scrollable:x,tableMaxHeight:v,components:ct,remarkPlugins:dt,rehypePlugins:ye}},[Z,X,f,c$1,b,y,Te,V,t,d,m,u,g$1,p,h$1,ue,pe,x,P==null?void 0:P.code,v,ct,dt,ye]),ps=useMemo(()=>I&&y?{"--streamdown-caret":`"${kc[I]}"`}:void 0,[I,y]),fs=C=>{let E=null;if(U.current&&y){if(!Ve.current[C]){let j=Le&&Le!=="true"?S:{},{maxBacklogMs:re,...Ce}=j;Ve.current[C]=ut({...Ce,timeline:U.current});}E=Ve.current[C];}wn.current!==ye&&(ge.current=[],wn.current=ye),E&&!ge.current[C]&&(ge.current[C]=[...ye,E.rehypePlugin]);let $=E&&ge.current[C]?ge.current[C]:ye;return {blockAnimatePlugin:E,blockRehypePlugins:$}};return t==="static"?jsx(h.Provider,{value:vn,children:jsx(yt.Provider,{value:P!=null?P:null,children:jsx(T.Provider,{value:Pn,children:jsx(qt,{icons:Be,children:jsx(e.Provider,{value:it,children:jsx("div",{className:it("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",i),dir:n==="auto"?void 0:n,children:jsx(Ue,{components:ct,rehypePlugins:ye,remarkPlugins:dt,...oe,children:Tt})})})})})})}):jsx(h.Provider,{value:vn,children:jsx(yt.Provider,{value:P!=null?P:null,children:jsx(T.Provider,{value:Pn,children:jsx(qt,{icons:Be,children:jsx(e.Provider,{value:it,children:jsxs("div",{className:it("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",I?"[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]":null,i),"data-streamdown":"container",style:ps,children:[he.length===0&&I&&y&&jsx("span",{}),he.map((C,E)=>{var Sn;let $=E===he.length-1,j=y&&$&&Cr(C),{blockAnimatePlugin:re,blockRehypePlugins:Ce}=fs(E);return jsx(L,{animatePlugin:re,components:ct,content:C,dir:(Sn=Rt==null?void 0:Rt[E])!=null?Sn:n!=="auto"?n:void 0,index:E,isIncomplete:j,rehypePlugins:Ce,remarkPlugins:dt,shouldNormalizeHtmlIndentation:r,shouldParseIncompleteMarkdown:o,...oe},ms[E])})]})})})})})})},(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&&e.disableAutolinkProtocols===t.disableAutolinkProtocols&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);Sc.displayName="Streamdown";var Mc=lazy(()=>import('./viewer-SB7OV4V7.js').then(e=>({default:e.OpenScadViewer}))),Io=({className:e,code:t,config:n,fullscreen:o=false})=>{let r=f(),s=i(),[a,l]=useState(null),[i$1,c]=useState(false),[d,m]=useState(null),[u,g]=useState(null),[p,h]=useState(0),{openscad:f$1}=useContext(T),b=Ne(),y=f$1==null?void 0:f$1.errorComponent,x=_e(),{shouldRender:v,containerRef:S}=En({immediate:o});if(useEffect(()=>{if(!v||x)return;if(!b){l(s.openscadPluginMissing);return}(async()=>{try{l(null),c(!0);let V=await b.getOpenScad(n).render(t,n);m(V),g(V);}catch(I){if(!(u||d)){let V=I instanceof Error?I.message:s.openscadRenderFailed;l(V);}}finally{c(false);}})();},[t,n,p,v,x,b,s]),!(v||d||u))return jsx("div",{className:r("my-4 min-h-[200px]",e),ref:S});if(x&&!d&&!u)return jsx("div",{className:r("my-4 flex justify-center p-4",e),ref:S,children:jsxs("div",{className:r("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:r("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:r("text-sm"),children:s.openscadWriting})]})});if(i$1&&!d&&!u)return jsx("div",{className:r("my-4 flex justify-center p-4",e),ref:S,children:jsxs("div",{className:r("flex items-center space-x-2 text-muted-foreground"),children:[jsx("div",{className:r("h-4 w-4 animate-spin rounded-full border-current border-b-2")}),jsx("span",{className:r("text-sm"),children:s.openscadLoading})]})});if(a&&!d&&!u){let H=()=>h(I=>I+1);return y?jsx("div",{ref:S,children:jsx(y,{code:t,error:a,retry:H})}):jsxs("div",{className:r("rounded-md bg-red-50 p-4",e),ref:S,children:[jsxs("p",{className:r("font-mono text-red-700 text-sm"),children:[s.openscadErrorLabel,": ",a]}),jsxs("details",{className:r("mt-2"),children:[jsx("summary",{className:r("cursor-pointer text-red-600 text-xs"),children:s.showCode}),jsx("pre",{className:r("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),children:t})]})]})}let L=d!=null?d:u;return jsx("div",{className:r("size-full",e),"data-streamdown":"openscad",ref:S,children:jsx(Suspense,{fallback:jsx("div",{className:r("flex h-full items-center justify-center"),children:jsx("div",{className:r("h-4 w-4 animate-spin rounded-full border-current border-b-2 text-muted-foreground")})}),children:L?jsx(Mc,{className:e,data:L.data,format:L.format,fullscreen:o}):null})})};
51
+ export{De as A,Ye as B,Mi as C,Qe as D,nt as E,ot as F,pn as G,yc as H,hn as I,Cc as J,ds as K,Sc as L,ks as a,ut as b,_e as c,je as d,$n as e,Ft as f,zt as g,Mm as h,Wt as i,B as j,gt as k,ke as l,ze as m,Ut as n,We as o,ce as p,de as q,T as r,Me as s,yo as t,En as u,Io as v,Ae as w,Se as x,on as y,wt as z};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {createContext,useContext}from'react';var t=(...a)=>twMerge(clsx(a)),M=a=>{if(a!==void 0)return typeof a=="number"?!Number.isFinite(a)||a<=0?void 0:`${a}px`:a},g=(a,n)=>{if(!a||!n)return n;let o=`${a}:`;return n.split(/\s+/).filter(Boolean).map(r=>r.startsWith(o)?r:`${a}:${r}`).join(" ")},v=a=>a?(...n)=>g(a,twMerge(clsx(n))):t,D=(a,n,o)=>{let r=typeof n=="string"&&o.startsWith("text/csv")?"\uFEFF":"",d=typeof n=="string"?new Blob([r+n],{type:o}):n,i=URL.createObjectURL(d),e=document.createElement("a");e.href=i,e.download=a,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(i);};var u=createContext(t),A=()=>useContext(u);var C={alertNote:"Note",alertTip:"Tip",alertImportant:"Important",alertWarning:"Warning",alertCaution:"Caution",copyCode:"Copy Code",copyDiagram:"Copy diagram",copyModel:"Copy model",downloadFile:"Download file",mermaidChart:"Mermaid chart",downloadDiagram:"Download diagram",downloadDiagramAsSvg:"Download diagram as SVG",downloadDiagramAsPng:"Download diagram as PNG",downloadDiagramAsMmd:"Download diagram as MMD",downloadDiagramAsPuml:"Download diagram as PlantUML",downloadDiagramAsSmi:"Download diagram as SMILES",downloadDiagramAsJson:"Download diagram as JSON",downloadDiagramAsSource:"Download diagram source",viewFullscreen:"View fullscreen",exitFullscreen:"Exit fullscreen",mermaidFormatSvg:"SVG",mermaidFormatPng:"PNG",mermaidFormatMmd:"MMD",diagramChart:"Diagram",diagramErrorLabel:"Diagram Error",diagramFormatSource:"Source",diagramLoading:"Loading diagram...",diagramWriting:"Waiting for the diagram...",diagramPluginMissing:"Diagram plugin not available. Please add a matching diagram plugin to enable rendering.",diagramRenderFailed:"Failed to render diagram",showCode:"Show Code",mermaidErrorLabel:"Mermaid Error",mermaidPluginMissing:"Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.",mermaidRenderFailed:"Failed to render Mermaid chart",plantumlChart:"PlantUML chart",plantumlErrorLabel:"PlantUML Error",plantumlPluginMissing:"PlantUML plugin not available. Please add the plantuml plugin to enable diagram rendering.",plantumlRenderFailed:"Failed to render PlantUML chart",openscadErrorLabel:"OpenSCAD Error",openscadModel:"OpenSCAD model",openscadLoading:"Loading OpenSCAD engine and rendering model...",openscadPluginMissing:"OpenSCAD plugin not available. Please add the openscad plugin to enable model rendering.",openscadRenderFailed:"Failed to render model",openscadWriting:"Waiting for the model code...",downloadModel:"Download model",downloadModelAsScad:"Download model as SCAD",downloadModelAsStl:"Download model as STL",downloadModelAs3mf:"Download model as 3MF",openscadFormatScad:"SCAD",openscadFormatStl:"STL",openscadFormat3mf:"3MF",plantumlFormatSvg:"SVG",plantumlFormatPng:"PNG",plantumlFormatPuml:"PUML",smilesChart:"Chemical structure",smilesErrorLabel:"SMILES Error",smilesPluginMissing:"SMILES plugin not available. Please add the smiles plugin to enable chemical structure rendering.",smilesRenderFailed:"Failed to render SMILES structure",smilesFormatSmi:"SMI",smilesShowCompact:"Show compact notation",smilesShowStructures:"Show structures",vegaChart:"Vega chart",vegaErrorLabel:"Vega Error",vegaPluginMissing:"Vega plugin not available. Please add the vega plugin to enable chart rendering.",vegaRenderFailed:"Failed to render Vega chart",vegaFormatSvg:"SVG",vegaFormatPng:"PNG",vegaFormatJson:"JSON",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"},F=createContext(C),T=()=>useContext(F);export{t as a,M as b,v as c,D as d,u as e,A as f,C as g,F as h,T as i};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import {r,h,e}from'./chunk-BSY33EDM.js';import'./chunk-GKDS2YGT.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(r),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 OpenScadOptions, type PlantUmlOptions, type PortalTarget, type ScrollableComponent } from "./lib/streamdown-context";
7
+ import { type CalloutIconResolver, type CalloutStyleResolver, type ControlsConfig, type DiagramOptions, type LinkSafetyConfig, type ListStylePreset, type MermaidOptions, type OpenScadOptions, type PlantUmlOptions, type PortalTarget, type ScrollableComponent, type SmilesOptions, type VegaOptions } 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";
@@ -21,9 +21,9 @@ export type { AllowElement, Components, ExtraProps, UrlTransform, } from "./lib/
21
21
  export { defaultUrlTransform } from "./lib/markdown";
22
22
  export type { IncrementalParseState } from "./lib/parse-blocks";
23
23
  export { parseMarkdownIntoBlocks, parseMarkdownIntoBlocksIncremental, } from "./lib/parse-blocks";
24
- export type { BundledLanguage, BundledTheme, CjkPlugin, CodeHighlighterPlugin, CustomRenderer, CustomRendererProps, DiagramPlugin, HighlightOptions, MathPlugin, PlantUmlConfig, PlantUmlInstance, PlantUmlPlugin, PluginConfig, ThemeInput, ThemeRegistrationAny, } from "./lib/plugin-types";
24
+ export type { BundledLanguage, BundledTheme, CjkPlugin, CodeHighlighterPlugin, CustomRenderer, CustomRendererProps, DiagramPlugin, HighlightOptions, MathPlugin, PlantUmlConfig, PlantUmlInstance, PlantUmlPlugin, PluginConfig, SmilesConfig, SmilesInstance, SmilesPlugin, SvgDiagramPlugin, ThemeInput, ThemeRegistrationAny, VegaConfig, VegaInstance, VegaPlugin, } from "./lib/plugin-types";
25
25
  export { DefaultScrollable } from "./lib/scrollable";
26
- export type { CalloutIconResolver, CalloutStyleResolver, ControlsConfig, CopyControlConfig, DownloadControlConfig, LinkSafetyConfig, LinkSafetyModalProps, MermaidErrorComponentProps, MermaidOptions, OpenScadErrorComponentProps, OpenScadOptions, PlantUmlErrorComponentProps, PlantUmlOptions, PortalTarget, ScrollableComponent, ScrollableProps, StreamdownContextType, TableCopyFormat, } from "./lib/streamdown-context";
26
+ export type { CalloutIconResolver, CalloutStyleResolver, ControlsConfig, CopyControlConfig, DiagramErrorComponentProps, DiagramOptions, DownloadControlConfig, LinkSafetyConfig, LinkSafetyModalProps, MermaidErrorComponentProps, MermaidOptions, OpenScadErrorComponentProps, OpenScadOptions, PlantUmlErrorComponentProps, PlantUmlOptions, PortalTarget, ScrollableComponent, ScrollableProps, SmilesErrorComponentProps, SmilesOptions, StreamdownContextType, TableCopyFormat, VegaErrorComponentProps, VegaOptions, } 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";
@@ -64,6 +64,10 @@ export type StreamdownProps = Options & {
64
64
  mermaid?: MermaidOptions;
65
65
  openscad?: OpenScadOptions;
66
66
  plantuml?: PlantUmlOptions;
67
+ smiles?: SmilesOptions;
68
+ vega?: VegaOptions;
69
+ /** Per-engine options for extra SVG diagrams registered via `plugins.diagrams`. */
70
+ diagrams?: Record<string, DiagramOptions>;
67
71
  codeBlockMaxHeight?: number | string;
68
72
  controls?: ControlsConfig;
69
73
  isAnimating?: boolean;
@@ -181,4 +185,4 @@ export type BlockProps = Options & {
181
185
  animatePlugin?: AnimatePlugin | null;
182
186
  };
183
187
  export declare const Block: import("react").MemoExoticComponent<({ content, shouldParseIncompleteMarkdown: _, shouldNormalizeHtmlIndentation, index: __, isIncomplete, dir, animatePlugin: animatePluginProp, ...props }: BlockProps) => import("react/jsx-runtime").JSX.Element>;
184
- export declare const Streamdown: import("react").MemoExoticComponent<({ children, mode, dir, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, normalizeHtmlIndentation: shouldNormalizeHtmlIndentation, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, openscad, plantuml, codeBlockMaxHeight, controls, isAnimating, scrollable, tableMaxHeight, animated, BlockComponent, parseMarkdownIntoBlocksFn, caret, listStyle, calloutIcon, calloutStyle, plugins, remend: remendOptions, linkSafety, portal, lineNumbers, allowedTags, literalTagContent, dataOnlyTags, disableAutolinkProtocols, translations, icons: iconOverrides, prefix, onAnimationStart, onAnimationEnd, ...props }: StreamdownProps) => import("react/jsx-runtime").JSX.Element>;
188
+ export declare const Streamdown: import("react").MemoExoticComponent<({ children, mode, dir, parseIncompleteMarkdown: shouldParseIncompleteMarkdown, normalizeHtmlIndentation: shouldNormalizeHtmlIndentation, components, rehypePlugins, remarkPlugins, className, shikiTheme, mermaid, openscad, plantuml, smiles, vega, diagrams, codeBlockMaxHeight, controls, isAnimating, scrollable, tableMaxHeight, animated, BlockComponent, parseMarkdownIntoBlocksFn, caret, listStyle, calloutIcon, calloutStyle, plugins, remend: remendOptions, linkSafety, portal, lineNumbers, allowedTags, literalTagContent, dataOnlyTags, disableAutolinkProtocols, 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{F as Block,i as CodeBlock,f as CodeBlockContainer,j as CodeBlockCopyButton,k as CodeBlockDownloadButton,g as CodeBlockHeader,l as CodeBlockSkeleton,d as DefaultScrollable,G as Streamdown,m as StreamdownContext,w as TableCopyDropdown,x as TableDownloadButton,y as TableDownloadDropdown,a as createAnimateCursor,b as createAnimatePlugin,D as defaultRehypePlugins,E as defaultRemarkPlugins,n as defaultUrlTransform,z as detectTextDirection,u as escapeMarkdownTableCell,r as extractTableDataFromElement,C as normalizeHtmlIndentation,A as parseMarkdownIntoBlocks,B as parseMarkdownIntoBlocksIncremental,s as tableDataToCSV,v as tableDataToMarkdown,t as tableDataToTSV,c as useIsCodeFenceIncomplete}from'./chunk-FYGB27SX.js';export{g as defaultTranslations,i as useTranslations}from'./chunk-EMUDB4GM.js';
2
+ export{K as Block,i as CodeBlock,f as CodeBlockContainer,k as CodeBlockCopyButton,n as CodeBlockDownloadButton,g as CodeBlockHeader,o as CodeBlockSkeleton,d as DefaultScrollable,L as Streamdown,r as StreamdownContext,B as TableCopyDropdown,C as TableDownloadButton,D as TableDownloadDropdown,a as createAnimateCursor,b as createAnimatePlugin,I as defaultRehypePlugins,J as defaultRemarkPlugins,t as defaultUrlTransform,E as detectTextDirection,z as escapeMarkdownTableCell,w as extractTableDataFromElement,H as normalizeHtmlIndentation,F as parseMarkdownIntoBlocks,G as parseMarkdownIntoBlocksIncremental,x as tableDataToCSV,A as tableDataToMarkdown,y as tableDataToTSV,c as useIsCodeFenceIncomplete}from'./chunk-BSY33EDM.js';export{g as defaultTranslations,i as useTranslations}from'./chunk-GKDS2YGT.js';
@@ -7,7 +7,7 @@ interface TableCopyCallbacks {
7
7
  onCopy?: (format: TableCopyFormat) => void;
8
8
  onError?: (error: Error) => void;
9
9
  }
10
- export declare const getDownloadFilename: (config: ControlsConfig, type: "code" | "table" | "mermaid" | "plantuml" | "openscad", fallback: string) => string;
10
+ export declare const getDownloadFilename: (config: ControlsConfig, type: string, fallback: string) => string;
11
11
  export declare function getCopyCallbacks(config: ControlsConfig, type: "table"): TableCopyCallbacks;
12
- export declare function getCopyCallbacks(config: ControlsConfig, type: "code" | "mermaid" | "plantuml" | "openscad"): CodeCopyCallbacks;
12
+ export declare function getCopyCallbacks(config: ControlsConfig, type: string): CodeCopyCallbacks;
13
13
  export {};
@@ -0,0 +1,11 @@
1
+ import type { DiagramPlugin, PlantUmlPlugin, PluginConfig, SmilesPlugin, SvgDiagramPlugin, VegaPlugin } from "../plugin-types";
2
+ export type NamedDiagramPlugin = DiagramPlugin | PlantUmlPlugin | VegaPlugin | SmilesPlugin | SvgDiagramPlugin;
3
+ export declare const matchesPluginLanguage: (language: string, pluginLanguage: string | readonly string[]) => boolean;
4
+ export declare const isMermaidPlugin: (plugin: NamedDiagramPlugin) => plugin is DiagramPlugin;
5
+ export declare const isPlantUmlPlugin: (plugin: NamedDiagramPlugin) => plugin is PlantUmlPlugin;
6
+ export declare const isVegaPlugin: (plugin: NamedDiagramPlugin) => plugin is VegaPlugin;
7
+ export declare const isSmilesPlugin: (plugin: NamedDiagramPlugin) => plugin is SmilesPlugin;
8
+ export declare const isSvgDiagramPlugin: (plugin: NamedDiagramPlugin) => plugin is SvgDiagramPlugin;
9
+ export declare const toSvgDiagramPlugin: (plugin: NamedDiagramPlugin) => SvgDiagramPlugin;
10
+ export declare const collectDiagramPlugins: (config: PluginConfig | null) => SvgDiagramPlugin[];
11
+ export declare const findDiagramPlugin: (plugins: SvgDiagramPlugin[], language: string) => SvgDiagramPlugin | null;
@@ -0,0 +1,10 @@
1
+ import type { SvgDiagramPlugin } from "../plugin-types";
2
+ interface DiagramCodeBlockProps {
3
+ className?: string;
4
+ code: string;
5
+ isBlockIncomplete?: boolean;
6
+ language: string;
7
+ plugin: SvgDiagramPlugin;
8
+ }
9
+ export declare const DiagramCodeBlock: ({ className, code, isBlockIncomplete, language, plugin, }: DiagramCodeBlockProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { DiagramOptions, StreamdownContextType } from "../streamdown-context";
2
+ export declare const getDiagramOptions: (context: StreamdownContextType, name: string) => DiagramOptions | undefined;
@@ -0,0 +1,4 @@
1
+ import type { ControlsConfig } from "../streamdown-context";
2
+ export type DiagramControlType = "download" | "copy" | "compact" | "fullscreen" | "panZoom";
3
+ export declare const shouldShowDiagramControls: (config: ControlsConfig, name: string) => boolean;
4
+ export declare const shouldShowDiagramControl: (config: ControlsConfig, name: string, controlType: DiagramControlType) => boolean;
@@ -0,0 +1,15 @@
1
+ import type { SvgDiagramPlugin } from "../plugin-types";
2
+ interface DiagramDownloadDropdownProps {
3
+ chart: string;
4
+ children?: React.ReactNode;
5
+ className?: string;
6
+ config?: unknown;
7
+ language?: string;
8
+ name: string;
9
+ onDownload?: (format: "png" | "source" | "svg") => void;
10
+ onError?: (error: Error) => void;
11
+ plugin: SvgDiagramPlugin | null;
12
+ sourceExtension?: string;
13
+ }
14
+ export declare const DiagramDownloadDropdown: ({ chart, children, className, config, language, name, onDownload, onError, plugin, sourceExtension, }: DiagramDownloadDropdownProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,23 @@
1
+ import { type ComponentProps, type ComponentType } from "react";
2
+ import type { SvgDiagramPlugin } from "../plugin-types";
3
+ interface DiagramViewProps {
4
+ chart: string;
5
+ className?: string;
6
+ config?: unknown;
7
+ fullscreen?: boolean;
8
+ language?: string;
9
+ showControls?: boolean;
10
+ }
11
+ type DiagramFullscreenButtonProps = ComponentProps<"button"> & {
12
+ DiagramComponent?: ComponentType<DiagramViewProps>;
13
+ chart: string;
14
+ config?: unknown;
15
+ language?: string;
16
+ name: string;
17
+ onExit?: () => void;
18
+ onFullscreen?: () => void;
19
+ plugin: SvgDiagramPlugin | null;
20
+ sourceExtension?: string;
21
+ };
22
+ export declare const DiagramFullscreenButton: ({ DiagramComponent, chart, className, config, language, name, onExit, onFullscreen, plugin, sourceExtension, ...props }: DiagramFullscreenButtonProps) => import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { SvgDiagramPlugin } from "../plugin-types";
2
+ interface DiagramProps {
3
+ chart: string;
4
+ className?: string;
5
+ config?: unknown;
6
+ fallbackName?: string;
7
+ fullscreen?: boolean;
8
+ language?: string;
9
+ plugin: SvgDiagramPlugin | null;
10
+ showControls?: boolean;
11
+ }
12
+ export declare const Diagram: ({ chart, className, config, fallbackName, fullscreen, language, plugin, showControls, }: DiagramProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { StreamdownTranslations } from "../translations-context";
2
+ export type DiagramLabelKind = "chart" | "error" | "missing" | "failed";
3
+ export declare const diagramLabel: (t: StreamdownTranslations, name: string, kind: DiagramLabelKind) => string;
4
+ export declare const diagramSourceFormatLabel: (t: StreamdownTranslations, name: string, sourceExtension: string) => string;
5
+ export declare const diagramSourceDownloadLabel: (t: StreamdownTranslations, name: string) => string;
6
+ export declare const diagramPluginMissingMessage: (name: string) => string;
@@ -0,0 +1 @@
1
+ export declare const buildDiagramRenderOptions: (config: unknown, language?: string) => unknown;
@@ -7,5 +7,5 @@ interface MermaidDownloadDropdownProps {
7
7
  onDownload?: (format: "mmd" | "png" | "svg") => void;
8
8
  onError?: (error: Error) => void;
9
9
  }
10
- export declare const MermaidDownloadDropdown: ({ chart, children, className, onDownload, config, onError, }: MermaidDownloadDropdownProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const MermaidDownloadDropdown: ({ onDownload, ...props }: MermaidDownloadDropdownProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -1,4 +1,4 @@
1
- import { type ComponentProps } from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { MermaidConfig } from "../plugin-types";
3
3
  type MermaidFullscreenButtonProps = ComponentProps<"button"> & {
4
4
  chart: string;
@@ -1,10 +1,10 @@
1
- import type { MermaidConfig } from "../plugin-types";
2
1
  interface MermaidProps {
3
2
  chart: string;
4
3
  className?: string;
5
- config?: MermaidConfig;
4
+ config?: unknown;
6
5
  fullscreen?: boolean;
6
+ language?: string;
7
7
  showControls?: boolean;
8
8
  }
9
- export declare const Mermaid: ({ chart, className, config, fullscreen, showControls, }: MermaidProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Mermaid: ({ chart, className, config, fullscreen, language, showControls, }: MermaidProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -7,5 +7,5 @@ interface PlantUmlDownloadDropdownProps {
7
7
  onDownload?: (format: "puml" | "png" | "svg") => void;
8
8
  onError?: (error: Error) => void;
9
9
  }
10
- export declare const PlantUmlDownloadDropdown: ({ chart, children, className, onDownload, config, onError, }: PlantUmlDownloadDropdownProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const PlantUmlDownloadDropdown: ({ onDownload, ...props }: PlantUmlDownloadDropdownProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -1,4 +1,4 @@
1
- import { type ComponentProps } from "react";
1
+ import type { ComponentProps } from "react";
2
2
  import type { PlantUmlConfig } from "../plugin-types";
3
3
  type PlantUmlFullscreenButtonProps = ComponentProps<"button"> & {
4
4
  chart: string;