@waniwani/sdk 0.4.2 → 0.4.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/index.js +6 -6
- package/dist/chat/index.js.map +1 -1
- package/dist/{chunk-HVAT4SNH.js → chunk-5JBHQYU5.js} +2 -2
- package/dist/chunk-5JBHQYU5.js.map +1 -0
- package/dist/{code-block-37QAKDTI-M2QCKVTI.js → code-block-37QAKDTI-IIYKFI5S.js} +2 -2
- package/dist/mcp/index.d.ts +5 -24
- package/dist/mcp/index.js +4 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/mermaid-4DMBBIKO-PAA57QRQ.js +3 -0
- package/package.json +1 -1
- package/dist/chunk-HVAT4SNH.js.map +0 -1
- package/dist/mermaid-4DMBBIKO-NR6M3PLG.js +0 -3
- /package/dist/{code-block-37QAKDTI-M2QCKVTI.js.map → code-block-37QAKDTI-IIYKFI5S.js.map} +0 -0
- /package/dist/{mermaid-4DMBBIKO-NR6M3PLG.js.map → mermaid-4DMBBIKO-PAA57QRQ.js.map} +0 -0
|
@@ -110,7 +110,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error
|
|
|
110
110
|
`||d==="\r"){o=!0;break}if(!o)return u;let c=[];for(let d of u)d===" "?c.push("\\t"):d===`
|
|
111
111
|
`?c.push("\\n"):d==="\r"?c.push("\\r"):c.push(d);return c.join("")},i=t.length>0?r.length+1:r.length,a=new Array(i),s=0;t.length>0&&(a[s]=t.map(n).join(" "),s+=1);for(let u of r)a[s]=u.map(n).join(" "),s+=1;return a.join(`
|
|
112
112
|
`)},uo=e=>{let t=!1;for(let n of e)if(n==="\\"||n==="|"){t=!0;break}if(!t)return e;let r=[];for(let n of e)n==="\\"?r.push("\\\\"):n==="|"?r.push("\\|"):r.push(n);return r.join("")},kx=e=>{let{headers:t,rows:r}=e;if(t.length===0)return"";let n=new Array(r.length+2),i=0,a=t.map(u=>uo(u));n[i]=`| ${a.join(" | ")} |`,i+=1;let s=new Array(t.length);for(let u=0;u<t.length;u+=1)s[u]="---";n[i]=`| ${s.join(" | ")} |`,i+=1;for(let u of r)if(u.length<t.length){let o=new Array(t.length);for(let c=0;c<t.length;c+=1)o[c]=c<u.length?uo(u[c]):"";n[i]=`| ${o.join(" | ")} |`,i+=1}else{let o=u.map(c=>uo(c));n[i]=`| ${o.join(" | ")} |`,i+=1}return n.join(`
|
|
113
|
-
`)},Ax=({children:e,className:t,onCopy:r,onError:n,timeout:i=2e3})=>{let[a,s]=ye(!1),[u,o]=ye(!1),c=bt(null),d=bt(0),{isAnimating:f}=Ze(Ke),h=async g=>{var k,I;if(typeof window>"u"||!((k=navigator?.clipboard)!=null&&k.write)){n?.(new Error("Clipboard API not available"));return}try{let y=(I=c.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"]'),D=y?.querySelector("table");if(!D){n?.(new Error("Table not found"));return}let L=_f(D),B=g==="csv"?Cf(L):xx(L),z=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([D.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),s(!1),r?.(g),d.current=window.setTimeout(()=>o(!1),i)}catch(y){n?.(y)}};Xe(()=>{let g=k=>{let I=k.composedPath();c.current&&!I.includes(c.current)&&s(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g),window.clearTimeout(d.current)}},[]);let p=u?mo:go;return oe("div",{className:"relative",ref:c,children:[_("button",{className:K("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:f,onClick:()=>s(!a),title:"Copy table",type:"button",children:e??_(p,{size:14})}),a?oe("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>h("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>h("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},yx=({children:e,className:t,onDownload:r,onError:n})=>{let[i,a]=ye(!1),s=bt(null),{isAnimating:u}=Ze(Ke),o=c=>{var d;try{let f=(d=s.current)==null?void 0:d.closest('[data-streamdown="table-wrapper"]'),h=f?.querySelector("table");if(!h){n?.(new Error("Table not found"));return}let p=_f(h),g=c==="csv"?Cf(p):kx(p);wr(`table.${c==="csv"?"csv":"md"}`,g,c==="csv"?"text/csv":"text/markdown"),a(!1),r?.(c)}catch(f){n?.(f)}};return Xe(()=>{let c=d=>{let f=d.composedPath();s.current&&!f.includes(s.current)&&a(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),oe("div",{className:"relative",ref:s,children:[_("button",{className:K("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>a(!i),title:"Download table",type:"button",children:e??_(Bi,{size:14})}),i?oe("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},_x=({children:e,className:t,showControls:r,...n})=>oe("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[r?oe("div",{className:"flex items-center justify-end gap-1",children:[_(Ax,{}),_(yx,{})]}):null,_("div",{className:"overflow-x-auto",children:_("table",{className:K("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]}),Cx=xf(()=>import("./code-block-37QAKDTI-M2QCKVTI.js").then(e=>({default:e.CodeBlock}))),Sx=xf(()=>import("./mermaid-4DMBBIKO-NR6M3PLG.js").then(e=>({default:e.Mermaid}))),Ix=/language-([^\s]+)/;function Fi(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let r=e.position.start,n=t.position.start,i=e.position.end,a=t.position.end;return r?.line===n?.line&&r?.column===n?.column&&i?.line===a?.line&&i?.column===a?.column}function Te(e,t){return e.className===t.className&&Fi(e.node,t.node)}var ho=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,Mi=(e,t)=>{if(typeof e=="boolean")return e;let r=e.mermaid;return r===!1?!1:r===!0||r===void 0?!0:r[t]!==!1},Eo=he(({children:e,className:t,node:r,...n})=>_("ol",{className:K("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>Te(e,t));Eo.displayName="MarkdownOl";var Sf=he(({children:e,className:t,node:r,...n})=>_("li",{className:K("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&Fi(e.node,t.node));Sf.displayName="MarkdownLi";var If=he(({children:e,className:t,node:r,...n})=>_("ul",{className:K("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>Te(e,t));If.displayName="MarkdownUl";var Nf=he(({className:e,node:t,...r})=>_("hr",{className:K("my-6 border-border",e),"data-streamdown":"horizontal-rule",...r}),(e,t)=>Te(e,t));Nf.displayName="MarkdownHr";var wf=he(({children:e,className:t,node:r,...n})=>_("span",{className:K("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>Te(e,t));wf.displayName="MarkdownStrong";var Nx=({children:e,className:t,href:r,node:n,...i})=>{let{linkSafety:a}=Ze(Ke),[s,u]=ye(!1),o=r==="streamdown:incomplete-link",c=je(async p=>{if(!(!(a!=null&&a.enabled&&r)||o)){if(p.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(r)){window.open(r,"_blank","noreferrer");return}u(!0)}},[a,r,o]),d=je(()=>{r&&window.open(r,"_blank","noreferrer")},[r]),f=je(()=>{u(!1)},[]),h={url:r??"",isOpen:s,onClose:f,onConfirm:d};return a!=null&&a.enabled&&r?oe(Vt,{children:[_("button",{className:K("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),a.renderModal?a.renderModal(h):_(px,{...h})]}):_("a",{className:K("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:r,rel:"noreferrer",target:"_blank",...i,children:e})},Lf=he(Nx,(e,t)=>Te(e,t)&&e.href===t.href);Lf.displayName="MarkdownA";var Rf=he(({children:e,className:t,node:r,...n})=>_("h1",{className:K("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>Te(e,t));Rf.displayName="MarkdownH1";var Df=he(({children:e,className:t,node:r,...n})=>_("h2",{className:K("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>Te(e,t));Df.displayName="MarkdownH2";var Of=he(({children:e,className:t,node:r,...n})=>_("h3",{className:K("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>Te(e,t));Of.displayName="MarkdownH3";var Pf=he(({children:e,className:t,node:r,...n})=>_("h4",{className:K("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>Te(e,t));Pf.displayName="MarkdownH4";var Mf=he(({children:e,className:t,node:r,...n})=>_("h5",{className:K("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>Te(e,t));Mf.displayName="MarkdownH5";var vf=he(({children:e,className:t,node:r,...n})=>_("h6",{className:K("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>Te(e,t));vf.displayName="MarkdownH6";var Bf=he(({children:e,className:t,node:r,...n})=>{let{controls:i}=Ze(Ke),a=ho(i,"table");return _(_x,{className:t,showControls:a,...n,children:e})},(e,t)=>Te(e,t));Bf.displayName="MarkdownTable";var Ff=he(({children:e,className:t,node:r,...n})=>_("thead",{className:K("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>Te(e,t));Ff.displayName="MarkdownThead";var Hf=he(({children:e,className:t,node:r,...n})=>_("tbody",{className:K("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>Te(e,t));Hf.displayName="MarkdownTbody";var Uf=he(({children:e,className:t,node:r,...n})=>_("tr",{className:K("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>Te(e,t));Uf.displayName="MarkdownTr";var zf=he(({children:e,className:t,node:r,...n})=>_("th",{className:K("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>Te(e,t));zf.displayName="MarkdownTh";var qf=he(({children:e,className:t,node:r,...n})=>_("td",{className:K("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>Te(e,t));qf.displayName="MarkdownTd";var Vf=he(({children:e,className:t,node:r,...n})=>_("blockquote",{className:K("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>Te(e,t));Vf.displayName="MarkdownBlockquote";var Yf=he(({children:e,className:t,node:r,...n})=>_("sup",{className:K("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>Te(e,t));Yf.displayName="MarkdownSup";var jf=he(({children:e,className:t,node:r,...n})=>_("sub",{className:K("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>Te(e,t));jf.displayName="MarkdownSub";var Gf=he(({children:e,className:t,node:r,...n})=>{if("data-footnotes"in n){let i=s=>{var u,o;if(!Nr(s))return!1;let c=Array.isArray(s.props.children)?s.props.children:[s.props.children],d=!1,f=!1;for(let h of c)if(h){if(typeof h=="string")h.trim()!==""&&(d=!0);else if(Nr(h))if(((u=h.props)==null?void 0:u["data-footnote-backref"])!==void 0)f=!0;else{let p=Array.isArray(h.props.children)?h.props.children:[h.props.children];for(let g of p){if(typeof g=="string"&&g.trim()!==""){d=!0;break}if(Nr(g)&&((o=g.props)==null?void 0:o["data-footnote-backref"])===void 0){d=!0;break}}}}return f&&!d},a=Array.isArray(e)?e.map(s=>{if(!Nr(s))return s;if(s.type===Eo){let u=(Array.isArray(s.props.children)?s.props.children:[s.props.children]).filter(o=>!i(o));return u.length===0?null:{...s,props:{...s.props,children:u}}}return s}):e;return(Array.isArray(a)?a.some(s=>s!==null):a!==null)?_("section",{className:t,...n,children:a}):null}return _("section",{className:t,...n,children:e})},(e,t)=>Te(e,t));Gf.displayName="MarkdownSection";var wx=({node:e,className:t,children:r,...n})=>{var i,a,s;let u=((i=e?.position)==null?void 0:i.start.line)===((a=e?.position)==null?void 0:a.end.line),{mermaid:o,controls:c}=Ze(Ke),d=bo();if(u)return _("code",{className:K("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:r});let f=t?.match(Ix),h=(s=f?.at(1))!=null?s:"",p="";if(Nr(r)&&r.props&&typeof r.props=="object"&&"children"in r.props&&typeof r.props.children=="string"?p=r.props.children:typeof r=="string"&&(p=r),h==="mermaid"&&d){let k=ho(c,"mermaid"),I=Mi(c,"download"),y=Mi(c,"copy"),D=Mi(c,"fullscreen"),L=Mi(c,"panZoom"),B=k&&(I||y||D);return _(ff,{fallback:_(gf,{}),children:oe("div",{className:K("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[B?oe("div",{className:"flex items-center justify-end gap-2",children:[I?_(gx,{chart:p,config:o?.config}):null,y?_(pf,{code:p}):null,D?_(Tx,{chart:p,config:o?.config}):null]}):null,_(Sx,{chart:p,config:o?.config,showControls:L})]})})}let g=ho(c,"code");return _(ff,{fallback:_(gf,{}),children:_(Cx,{className:K("overflow-x-auto border-border border-t",t),code:p,language:h,children:g?oe(Vt,{children:[_(lx,{code:p,language:h}),_(pf,{})]}):null})})},Wf=he(wx,(e,t)=>e.className===t.className&&Fi(e.node,t.node));Wf.displayName="MarkdownCode";var $f=he(dx,(e,t)=>e.className===t.className&&Fi(e.node,t.node));$f.displayName="MarkdownImg";var Qf=he(({children:e,className:t,node:r,...n})=>{var i,a;let s=(Array.isArray(e)?e:[e]).filter(u=>u!=null&&u!=="");if(s.length===1&&Nr(s[0])){let u=s[0].props.node,o=u?.tagName;if(o==="img")return _(Vt,{children:e});if(o==="code"&&((i=u?.position)==null?void 0:i.start.line)!==((a=u?.position)==null?void 0:a.end.line))return _(Vt,{children:e})}return _("p",{className:t,...n,children:e})},(e,t)=>Te(e,t));Qf.displayName="MarkdownParagraph";var Lx={ol:Eo,li:Sf,ul:If,hr:Nf,strong:wf,a:Lf,h1:Rf,h2:Df,h3:Of,h4:Pf,h5:Mf,h6:vf,table:Bf,thead:Ff,tbody:Hf,tr:Uf,th:zf,td:qf,blockquote:Vf,code:Wf,img:$f,pre:({children:e})=>e,sup:Yf,sub:jf,p:Qf,section:Gf},bf=[],Ef={allowDangerousHtml:!0},vi=new WeakMap,Rx=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let r=e.rehypePlugins,n=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(r||n||i)){let d="default";return this.keyCache.set(e,d),d}let a=d=>{if(!d||d.length===0)return"";let f="";for(let h=0;h<d.length;h+=1){let p=d[h];if(h>0&&(f+=","),Array.isArray(p)){let[g,k]=p;if(typeof g=="function"){let I=vi.get(g);I||(I=g.name,vi.set(g,I)),f+=I}else f+=String(g);f+=":",f+=JSON.stringify(k)}else if(typeof p=="function"){let g=vi.get(p);g||(g=p.name,vi.set(p,g)),f+=g}else f+=String(p)}return f},s=a(r),u=a(n),o=i?JSON.stringify(i):"",c=`${u}::${s}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),r=this.cache.get(t);return r&&(this.cache.delete(t),this.cache.set(t,r)),r}set(e,t){let r=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(r,t)}clear(){this.cache.clear()}},Tf=new Rx,Xf=e=>{let t=Dx(e),r=e.children||"";return Px(t.runSync(t.parse(r),r),e)},Dx=e=>{let t=Tf.get(e);if(t)return t;let r=Ox(e);return Tf.set(e,r),r},Ox=e=>{let t=e.rehypePlugins||bf,r=e.remarkPlugins||bf,n=e.remarkRehypeOptions?{...Ef,...e.remarkRehypeOptions}:Ef;return Qs().use(xi).use(r).use(_i,n).use(t)},Px=(e,t)=>Rs(e,{Fragment:Vt,components:t.components,ignoreInvalidStyle:!0,jsx:_,jsxs:oe,passKeys:!0,passNode:!0}),Mx=/\[\^[^\]\s]{1,200}\](?!:)/,vx=/\[\^[^\]\s]{1,200}\]:/,Bx=/<\/(\w+)>/,Fx=/<(\w+)[\s>]/,lo=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
113
|
+
`)},Ax=({children:e,className:t,onCopy:r,onError:n,timeout:i=2e3})=>{let[a,s]=ye(!1),[u,o]=ye(!1),c=bt(null),d=bt(0),{isAnimating:f}=Ze(Ke),h=async g=>{var k,I;if(typeof window>"u"||!((k=navigator?.clipboard)!=null&&k.write)){n?.(new Error("Clipboard API not available"));return}try{let y=(I=c.current)==null?void 0:I.closest('[data-streamdown="table-wrapper"]'),D=y?.querySelector("table");if(!D){n?.(new Error("Table not found"));return}let L=_f(D),B=g==="csv"?Cf(L):xx(L),z=new ClipboardItem({"text/plain":new Blob([B],{type:"text/plain"}),"text/html":new Blob([D.outerHTML],{type:"text/html"})});await navigator.clipboard.write([z]),o(!0),s(!1),r?.(g),d.current=window.setTimeout(()=>o(!1),i)}catch(y){n?.(y)}};Xe(()=>{let g=k=>{let I=k.composedPath();c.current&&!I.includes(c.current)&&s(!1)};return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g),window.clearTimeout(d.current)}},[]);let p=u?mo:go;return oe("div",{className:"relative",ref:c,children:[_("button",{className:K("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:f,onClick:()=>s(!a),title:"Copy table",type:"button",children:e??_(p,{size:14})}),a?oe("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>h("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>h("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]}):null]})},yx=({children:e,className:t,onDownload:r,onError:n})=>{let[i,a]=ye(!1),s=bt(null),{isAnimating:u}=Ze(Ke),o=c=>{var d;try{let f=(d=s.current)==null?void 0:d.closest('[data-streamdown="table-wrapper"]'),h=f?.querySelector("table");if(!h){n?.(new Error("Table not found"));return}let p=_f(h),g=c==="csv"?Cf(p):kx(p);wr(`table.${c==="csv"?"csv":"md"}`,g,c==="csv"?"text/csv":"text/markdown"),a(!1),r?.(c)}catch(f){n?.(f)}};return Xe(()=>{let c=d=>{let f=d.composedPath();s.current&&!f.includes(s.current)&&a(!1)};return document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[]),oe("div",{className:"relative",ref:s,children:[_("button",{className:K("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:u,onClick:()=>a(!i),title:"Download table",type:"button",children:e??_(Bi,{size:14})}),i?oe("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),_("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>o("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]}):null]})},_x=({children:e,className:t,showControls:r,...n})=>oe("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[r?oe("div",{className:"flex items-center justify-end gap-1",children:[_(Ax,{}),_(yx,{})]}):null,_("div",{className:"overflow-x-auto",children:_("table",{className:K("w-full border-collapse border border-border",t),"data-streamdown":"table",...n,children:e})})]}),Cx=xf(()=>import("./code-block-37QAKDTI-IIYKFI5S.js").then(e=>({default:e.CodeBlock}))),Sx=xf(()=>import("./mermaid-4DMBBIKO-PAA57QRQ.js").then(e=>({default:e.Mermaid}))),Ix=/language-([^\s]+)/;function Fi(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let r=e.position.start,n=t.position.start,i=e.position.end,a=t.position.end;return r?.line===n?.line&&r?.column===n?.column&&i?.line===a?.line&&i?.column===a?.column}function Te(e,t){return e.className===t.className&&Fi(e.node,t.node)}var ho=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,Mi=(e,t)=>{if(typeof e=="boolean")return e;let r=e.mermaid;return r===!1?!1:r===!0||r===void 0?!0:r[t]!==!1},Eo=he(({children:e,className:t,node:r,...n})=>_("ol",{className:K("list-inside list-decimal whitespace-normal [li_&]:pl-6",t),"data-streamdown":"ordered-list",...n,children:e}),(e,t)=>Te(e,t));Eo.displayName="MarkdownOl";var Sf=he(({children:e,className:t,node:r,...n})=>_("li",{className:K("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...n,children:e}),(e,t)=>e.className===t.className&&Fi(e.node,t.node));Sf.displayName="MarkdownLi";var If=he(({children:e,className:t,node:r,...n})=>_("ul",{className:K("list-inside list-disc whitespace-normal [li_&]:pl-6",t),"data-streamdown":"unordered-list",...n,children:e}),(e,t)=>Te(e,t));If.displayName="MarkdownUl";var Nf=he(({className:e,node:t,...r})=>_("hr",{className:K("my-6 border-border",e),"data-streamdown":"horizontal-rule",...r}),(e,t)=>Te(e,t));Nf.displayName="MarkdownHr";var wf=he(({children:e,className:t,node:r,...n})=>_("span",{className:K("font-semibold",t),"data-streamdown":"strong",...n,children:e}),(e,t)=>Te(e,t));wf.displayName="MarkdownStrong";var Nx=({children:e,className:t,href:r,node:n,...i})=>{let{linkSafety:a}=Ze(Ke),[s,u]=ye(!1),o=r==="streamdown:incomplete-link",c=je(async p=>{if(!(!(a!=null&&a.enabled&&r)||o)){if(p.preventDefault(),a.onLinkCheck&&await a.onLinkCheck(r)){window.open(r,"_blank","noreferrer");return}u(!0)}},[a,r,o]),d=je(()=>{r&&window.open(r,"_blank","noreferrer")},[r]),f=je(()=>{u(!1)},[]),h={url:r??"",isOpen:s,onClose:f,onConfirm:d};return a!=null&&a.enabled&&r?oe(Vt,{children:[_("button",{className:K("wrap-anywhere appearance-none text-left font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",onClick:c,type:"button",children:e}),a.renderModal?a.renderModal(h):_(px,{...h})]}):_("a",{className:K("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":o,"data-streamdown":"link",href:r,rel:"noreferrer",target:"_blank",...i,children:e})},Lf=he(Nx,(e,t)=>Te(e,t)&&e.href===t.href);Lf.displayName="MarkdownA";var Rf=he(({children:e,className:t,node:r,...n})=>_("h1",{className:K("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...n,children:e}),(e,t)=>Te(e,t));Rf.displayName="MarkdownH1";var Df=he(({children:e,className:t,node:r,...n})=>_("h2",{className:K("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...n,children:e}),(e,t)=>Te(e,t));Df.displayName="MarkdownH2";var Of=he(({children:e,className:t,node:r,...n})=>_("h3",{className:K("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...n,children:e}),(e,t)=>Te(e,t));Of.displayName="MarkdownH3";var Pf=he(({children:e,className:t,node:r,...n})=>_("h4",{className:K("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...n,children:e}),(e,t)=>Te(e,t));Pf.displayName="MarkdownH4";var Mf=he(({children:e,className:t,node:r,...n})=>_("h5",{className:K("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...n,children:e}),(e,t)=>Te(e,t));Mf.displayName="MarkdownH5";var vf=he(({children:e,className:t,node:r,...n})=>_("h6",{className:K("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...n,children:e}),(e,t)=>Te(e,t));vf.displayName="MarkdownH6";var Bf=he(({children:e,className:t,node:r,...n})=>{let{controls:i}=Ze(Ke),a=ho(i,"table");return _(_x,{className:t,showControls:a,...n,children:e})},(e,t)=>Te(e,t));Bf.displayName="MarkdownTable";var Ff=he(({children:e,className:t,node:r,...n})=>_("thead",{className:K("bg-muted/80",t),"data-streamdown":"table-header",...n,children:e}),(e,t)=>Te(e,t));Ff.displayName="MarkdownThead";var Hf=he(({children:e,className:t,node:r,...n})=>_("tbody",{className:K("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...n,children:e}),(e,t)=>Te(e,t));Hf.displayName="MarkdownTbody";var Uf=he(({children:e,className:t,node:r,...n})=>_("tr",{className:K("border-border border-b",t),"data-streamdown":"table-row",...n,children:e}),(e,t)=>Te(e,t));Uf.displayName="MarkdownTr";var zf=he(({children:e,className:t,node:r,...n})=>_("th",{className:K("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...n,children:e}),(e,t)=>Te(e,t));zf.displayName="MarkdownTh";var qf=he(({children:e,className:t,node:r,...n})=>_("td",{className:K("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...n,children:e}),(e,t)=>Te(e,t));qf.displayName="MarkdownTd";var Vf=he(({children:e,className:t,node:r,...n})=>_("blockquote",{className:K("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...n,children:e}),(e,t)=>Te(e,t));Vf.displayName="MarkdownBlockquote";var Yf=he(({children:e,className:t,node:r,...n})=>_("sup",{className:K("text-sm",t),"data-streamdown":"superscript",...n,children:e}),(e,t)=>Te(e,t));Yf.displayName="MarkdownSup";var jf=he(({children:e,className:t,node:r,...n})=>_("sub",{className:K("text-sm",t),"data-streamdown":"subscript",...n,children:e}),(e,t)=>Te(e,t));jf.displayName="MarkdownSub";var Gf=he(({children:e,className:t,node:r,...n})=>{if("data-footnotes"in n){let i=s=>{var u,o;if(!Nr(s))return!1;let c=Array.isArray(s.props.children)?s.props.children:[s.props.children],d=!1,f=!1;for(let h of c)if(h){if(typeof h=="string")h.trim()!==""&&(d=!0);else if(Nr(h))if(((u=h.props)==null?void 0:u["data-footnote-backref"])!==void 0)f=!0;else{let p=Array.isArray(h.props.children)?h.props.children:[h.props.children];for(let g of p){if(typeof g=="string"&&g.trim()!==""){d=!0;break}if(Nr(g)&&((o=g.props)==null?void 0:o["data-footnote-backref"])===void 0){d=!0;break}}}}return f&&!d},a=Array.isArray(e)?e.map(s=>{if(!Nr(s))return s;if(s.type===Eo){let u=(Array.isArray(s.props.children)?s.props.children:[s.props.children]).filter(o=>!i(o));return u.length===0?null:{...s,props:{...s.props,children:u}}}return s}):e;return(Array.isArray(a)?a.some(s=>s!==null):a!==null)?_("section",{className:t,...n,children:a}):null}return _("section",{className:t,...n,children:e})},(e,t)=>Te(e,t));Gf.displayName="MarkdownSection";var wx=({node:e,className:t,children:r,...n})=>{var i,a,s;let u=((i=e?.position)==null?void 0:i.start.line)===((a=e?.position)==null?void 0:a.end.line),{mermaid:o,controls:c}=Ze(Ke),d=bo();if(u)return _("code",{className:K("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...n,children:r});let f=t?.match(Ix),h=(s=f?.at(1))!=null?s:"",p="";if(Nr(r)&&r.props&&typeof r.props=="object"&&"children"in r.props&&typeof r.props.children=="string"?p=r.props.children:typeof r=="string"&&(p=r),h==="mermaid"&&d){let k=ho(c,"mermaid"),I=Mi(c,"download"),y=Mi(c,"copy"),D=Mi(c,"fullscreen"),L=Mi(c,"panZoom"),B=k&&(I||y||D);return _(ff,{fallback:_(gf,{}),children:oe("div",{className:K("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[B?oe("div",{className:"flex items-center justify-end gap-2",children:[I?_(gx,{chart:p,config:o?.config}):null,y?_(pf,{code:p}):null,D?_(Tx,{chart:p,config:o?.config}):null]}):null,_(Sx,{chart:p,config:o?.config,showControls:L})]})})}let g=ho(c,"code");return _(ff,{fallback:_(gf,{}),children:_(Cx,{className:K("overflow-x-auto border-border border-t",t),code:p,language:h,children:g?oe(Vt,{children:[_(lx,{code:p,language:h}),_(pf,{})]}):null})})},Wf=he(wx,(e,t)=>e.className===t.className&&Fi(e.node,t.node));Wf.displayName="MarkdownCode";var $f=he(dx,(e,t)=>e.className===t.className&&Fi(e.node,t.node));$f.displayName="MarkdownImg";var Qf=he(({children:e,className:t,node:r,...n})=>{var i,a;let s=(Array.isArray(e)?e:[e]).filter(u=>u!=null&&u!=="");if(s.length===1&&Nr(s[0])){let u=s[0].props.node,o=u?.tagName;if(o==="img")return _(Vt,{children:e});if(o==="code"&&((i=u?.position)==null?void 0:i.start.line)!==((a=u?.position)==null?void 0:a.end.line))return _(Vt,{children:e})}return _("p",{className:t,...n,children:e})},(e,t)=>Te(e,t));Qf.displayName="MarkdownParagraph";var Lx={ol:Eo,li:Sf,ul:If,hr:Nf,strong:wf,a:Lf,h1:Rf,h2:Df,h3:Of,h4:Pf,h5:Mf,h6:vf,table:Bf,thead:Ff,tbody:Hf,tr:Uf,th:zf,td:qf,blockquote:Vf,code:Wf,img:$f,pre:({children:e})=>e,sup:Yf,sub:jf,p:Qf,section:Gf},bf=[],Ef={allowDangerousHtml:!0},vi=new WeakMap,Rx=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let r=e.rehypePlugins,n=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(r||n||i)){let d="default";return this.keyCache.set(e,d),d}let a=d=>{if(!d||d.length===0)return"";let f="";for(let h=0;h<d.length;h+=1){let p=d[h];if(h>0&&(f+=","),Array.isArray(p)){let[g,k]=p;if(typeof g=="function"){let I=vi.get(g);I||(I=g.name,vi.set(g,I)),f+=I}else f+=String(g);f+=":",f+=JSON.stringify(k)}else if(typeof p=="function"){let g=vi.get(p);g||(g=p.name,vi.set(p,g)),f+=g}else f+=String(p)}return f},s=a(r),u=a(n),o=i?JSON.stringify(i):"",c=`${u}::${s}::${o}`;return this.keyCache.set(e,c),c}get(e){let t=this.generateCacheKey(e),r=this.cache.get(t);return r&&(this.cache.delete(t),this.cache.set(t,r)),r}set(e,t){let r=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let n=this.cache.keys().next().value;n&&this.cache.delete(n)}this.cache.set(r,t)}clear(){this.cache.clear()}},Tf=new Rx,Xf=e=>{let t=Dx(e),r=e.children||"";return Px(t.runSync(t.parse(r),r),e)},Dx=e=>{let t=Tf.get(e);if(t)return t;let r=Ox(e);return Tf.set(e,r),r},Ox=e=>{let t=e.rehypePlugins||bf,r=e.remarkPlugins||bf,n=e.remarkRehypeOptions?{...Ef,...e.remarkRehypeOptions}:Ef;return Qs().use(xi).use(r).use(_i,n).use(t)},Px=(e,t)=>Rs(e,{Fragment:Vt,components:t.components,ignoreInvalidStyle:!0,jsx:_,jsxs:oe,passKeys:!0,passNode:!0}),Mx=/\[\^[^\]\s]{1,200}\](?!:)/,vx=/\[\^[^\]\s]{1,200}\]:/,Bx=/<\/(\w+)>/,Fx=/<(\w+)[\s>]/,lo=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
114
114
|
`||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},Hx=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
115
115
|
`||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},co=e=>{let t=0;for(let r=0;r<e.length-1;r+=1)e[r]==="$"&&e[r+1]==="$"&&(t+=1,r+=1);return t},Ux=e=>{let t=Mx.test(e),r=vx.test(e);if(t||r)return[e];let n=Ye.lex(e,{gfm:!0}),i=[],a=[];for(let s of n){let u=s.raw,o=i.length;if(a.length>0){if(i[o-1]+=u,s.type==="html"){let c=u.match(Bx);if(c){let d=c[1];a.at(-1)===d&&a.pop()}}continue}if(s.type==="html"&&s.block){let c=u.match(Fx);if(c){let d=c[1];u.includes(`</${d}>`)||a.push(d)}}if(u.trim()==="$$"&&o>0){let c=i[o-1],d=lo(c),f=co(c);if(d&&f%2===1){i[o-1]=c+u;continue}}if(o>0&&Hx(u)){let c=i[o-1],d=lo(c),f=co(c),h=co(u);if(d&&f%2===1&&!lo(u)&&h===1){i[o-1]=c+u;continue}}i.push(u)}return i},zx={raw:$n,sanitize:[Qn,{}],harden:[wo,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},qx={gfm:[di,{}]},Vx=Object.values(zx),Yx=Object.values(qx),jx={block:" \u258B",circle:" \u25CF"},Gx={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0,linkSafety:{enabled:!0}},Ke=po(Gx),Kf=he(({content:e,shouldParseIncompleteMarkdown:t,index:r,...n})=>_(Xf,{...n,children:e}),(e,t)=>{if(e.content!==t.content||e.index!==t.index)return!1;if(e.components!==t.components){let r=Object.keys(e.components||{}),n=Object.keys(t.components||{});if(r.length!==n.length||r.some(i=>{var a,s;return((a=e.components)==null?void 0:a[i])!==((s=t.components)==null?void 0:s[i])}))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});Kf.displayName="Block";var Wx=["github-light","github-dark"],$x=he(({children:e,mode:t="streaming",parseIncompleteMarkdown:r=!0,components:n,rehypePlugins:i=Vx,remarkPlugins:a=Yx,className:s,shikiTheme:u=Wx,mermaid:o,controls:c=!0,isAnimating:d=!1,BlockComponent:f=Kf,parseMarkdownIntoBlocksFn:h=Ux,caret:p,plugins:g,remend:k,linkSafety:I={enabled:!0},...y})=>{let D=K2(),[L,B]=Z2(),z=lt(()=>typeof e!="string"?"":t==="streaming"&&r?rc(e,k):e,[e,t,r,k]),N=lt(()=>h(z),[z,h]),[Z,v]=ye(N);Xe(()=>{t==="streaming"?B(()=>{v(N)}):v(N)},[N,t]);let W=t==="streaming"?Z:N,C=lt(()=>W.map((X,ie)=>`${D}-${ie}`),[W.length,D]),ue=lt(()=>{var X,ie;return{shikiTheme:(ie=(X=g?.code)==null?void 0:X.getThemes())!=null?ie:u,controls:c,isAnimating:d,mode:t,mermaid:o,linkSafety:I}},[u,c,d,t,o,I,g?.code]),U=lt(()=>({...Lx,...n}),[n]),F=lt(()=>{let X=[];return g!=null&&g.cjk&&(X=[...X,...g.cjk.remarkPluginsBefore]),X=[...X,...a],g!=null&&g.cjk&&(X=[...X,...g.cjk.remarkPluginsAfter]),g!=null&&g.math&&(X=[...X,g.math.remarkPlugin]),X},[a,g?.math,g?.cjk]),$=lt(()=>g!=null&&g.math?[...i,g.math.rehypePlugin]:i,[i,g?.math]),Q=lt(()=>p&&d?{"--streamdown-caret":`"${jx[p]}"`}:void 0,[p,d]);return t==="static"?_(fo.Provider,{value:g??null,children:_(Ke.Provider,{value:ue,children:_("div",{className:K("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",s),children:_(Xf,{components:U,rehypePlugins:$,remarkPlugins:F,...y,children:e})})})}):_(fo.Provider,{value:g??null,children:_(Ke.Provider,{value:ue,children:oe("div",{className:K("space-y-4 whitespace-normal *:first:mt-0 *:last:mb-0",p?"*:last:after:inline *:last:after:align-baseline *:last:after:content-(--streamdown-caret)":null,s),style:Q,children:[W.length===0&&p&&d&&_("span",{}),W.map((X,ie)=>_(f,{components:U,content:X,index:ie,rehypePlugins:$,remarkPlugins:F,shouldParseIncompleteMarkdown:r,...y},C[ie]))]})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety);$x.displayName="Streamdown";var Qx=({children:e,className:t,minZoom:r=.5,maxZoom:n=3,zoomStep:i=.1,showControls:a=!0,initialZoom:s=1,fullscreen:u=!1})=>{let o=bt(null),c=bt(null),[d,f]=ye(s),[h,p]=ye({x:0,y:0}),[g,k]=ye(!1),[I,y]=ye({x:0,y:0}),[D,L]=ye({x:0,y:0}),B=je(U=>{f(F=>Math.max(r,Math.min(n,F+U)))},[r,n]),z=je(()=>{B(i)},[B,i]),N=je(()=>{B(-i)},[B,i]),Z=je(()=>{f(s),p({x:0,y:0})},[s]),v=je(U=>{U.preventDefault();let F=U.deltaY>0?-i:i;B(F)},[B,i]),W=je(U=>{if(U.button!==0||U.isPrimary===!1)return;k(!0),y({x:U.clientX,y:U.clientY}),L(h);let F=U.currentTarget;F instanceof HTMLElement&&F.setPointerCapture(U.pointerId)},[h]),C=je(U=>{if(!g)return;U.preventDefault();let F=U.clientX-I.x,$=U.clientY-I.y;p({x:D.x+F,y:D.y+$})},[g,I,D]),ue=je(U=>{k(!1);let F=U.currentTarget;F instanceof HTMLElement&&F.releasePointerCapture(U.pointerId)},[]);return Xe(()=>{let U=o.current;if(U)return U.addEventListener("wheel",v,{passive:!1}),()=>{U.removeEventListener("wheel",v)}},[v]),Xe(()=>{let U=c.current;if(U&&g)return document.body.style.userSelect="none",U.addEventListener("pointermove",C,{passive:!1}),U.addEventListener("pointerup",ue),U.addEventListener("pointercancel",ue),()=>{document.body.style.userSelect="",U.removeEventListener("pointermove",C),U.removeEventListener("pointerup",ue),U.removeEventListener("pointercancel",ue)}},[g,C,ue]),oe("div",{className:K("relative flex flex-col",u?"h-full w-full":"min-h-28 w-full",t),ref:o,style:{cursor:g?"grabbing":"grab"},children:[a?oe("div",{className:K("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",u?"bottom-4 left-4":"bottom-2 left-2"),children:[_("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d>=n,onClick:z,title:"Zoom in",type:"button",children:_(sx,{size:16})}),_("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:d<=r,onClick:N,title:"Zoom out",type:"button",children:_(ox,{size:16})}),_("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:Z,title:"Reset zoom and pan",type:"button",children:_(ax,{size:16})})]}):null,_("div",{className:K("flex-1 origin-center transition-transform duration-150 ease-out",u?"flex h-full w-full items-center justify-center":"flex w-full items-center justify-center"),onPointerDown:W,ref:c,role:"application",style:{transform:`translate(${h.x}px, ${h.y}px) scale(${d})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},Xx=({chart:e,className:t,config:r,fullscreen:n=!1,showControls:i=!0})=>{let[a,s]=ye(null),[u,o]=ye(!1),[c,d]=ye(""),[f,h]=ye(""),[p,g]=ye(0),{mermaid:k}=Ze(Ke),I=bo(),y=k?.errorComponent,{shouldRender:D,containerRef:L}=rx({immediate:n});if(Xe(()=>{if(D){if(!I){s("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");return}(async()=>{try{s(null),o(!0);let z=I.getMermaid(r),N=e.split("").reduce((W,C)=>(W<<5)-W+C.charCodeAt(0)|0,0),Z=`mermaid-${Math.abs(N)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:v}=await z.render(Z,e);d(v),h(v)}catch(z){if(!(f||c)){let N=z instanceof Error?z.message:"Failed to render Mermaid chart";s(N)}}finally{o(!1)}})()}},[e,r,p,D,I]),!(D||c||f))return _("div",{className:K("my-4 min-h-[200px]",t),ref:L});if(u&&!c&&!f)return _("div",{className:K("my-4 flex justify-center p-4",t),ref:L,children:oe("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[_("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),_("span",{className:"text-sm",children:"Loading diagram..."})]})});if(a&&!c&&!f)return y?_("div",{ref:L,children:_(y,{chart:e,error:a,retry:()=>g(N=>N+1)})}):oe("div",{className:K("rounded-lg border border-red-200 bg-red-50 p-4",t),ref:L,children:[oe("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",a]}),oe("details",{className:"mt-2",children:[_("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),_("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]});let B=c||f;return _("div",{className:K("size-full",t),"data-streamdown":"mermaid",ref:L,children:_(Qx,{className:K(n?"size-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:n,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:_("div",{"aria-label":"Mermaid chart",className:K("flex justify-center",n?"size-full items-center":null),dangerouslySetInnerHTML:{__html:B},role:"img"})})})};export{ic as a,yN as b,re as c,xe as d,Me as e,Ft as f,rt as g,$o as h,yt as i,_t as j,$e as k,Nn as l,_a as m,Cn as n,Sn as o,Ss as p,K as q,ux as r,pR as s,Ke as t,$x as u,Xx as v};
|
|
116
|
-
//# sourceMappingURL=chunk-
|
|
116
|
+
//# sourceMappingURL=chunk-5JBHQYU5.js.map
|