db-studio 1.2.13 → 1.2.15
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/core-dist/assets/{_baseUniq-B_K25dSy.js → _baseUniq-Ba6cdS3v.js} +1 -1
- package/dist/core-dist/assets/_queryId-CtxjgPTw.js +1 -0
- package/dist/core-dist/assets/{_table-BpdGy20G.js → _table-QVQOem0H.js} +1 -1
- package/dist/core-dist/assets/{arc-CM-cekU0.js → arc-D8UcRNMa.js} +1 -1
- package/dist/core-dist/assets/{architectureDiagram-VXUJARFQ-BCmD-Gj_.js → architectureDiagram-VXUJARFQ-qETUbLAF.js} +1 -1
- package/dist/core-dist/assets/{blockDiagram-VD42YOAC-DeY844Kv.js → blockDiagram-VD42YOAC-Key67jhL.js} +1 -1
- package/dist/core-dist/assets/{c4Diagram-YG6GDRKO-gX9j2-0Z.js → c4Diagram-YG6GDRKO-SLYVYNN5.js} +1 -1
- package/dist/core-dist/assets/channel-DXRfMgFO.js +1 -0
- package/dist/core-dist/assets/{chunk-4BX2VUAB-C6PIA6wq.js → chunk-4BX2VUAB-BHKffaup.js} +1 -1
- package/dist/core-dist/assets/{chunk-55IACEB6-a0l2Crfx.js → chunk-55IACEB6-Bp2-xSpt.js} +1 -1
- package/dist/core-dist/assets/{chunk-B4BG7PRW-CypUhkY3.js → chunk-B4BG7PRW-9F7cesSu.js} +1 -1
- package/dist/core-dist/assets/{chunk-DI55MBZ5-pM3ud_GL.js → chunk-DI55MBZ5-BJ4N1m8m.js} +1 -1
- package/dist/core-dist/assets/{chunk-FMBD7UC4-BtON21Ec.js → chunk-FMBD7UC4-CXjDDSki.js} +1 -1
- package/dist/core-dist/assets/{chunk-QN33PNHL-NNHAc9s8.js → chunk-QN33PNHL-D_22Snnm.js} +1 -1
- package/dist/core-dist/assets/{chunk-QZHKN3VN-CYogV3aS.js → chunk-QZHKN3VN-BI_2bsiS.js} +1 -1
- package/dist/core-dist/assets/{chunk-TZMSLE5B-DCoUoEZE.js → chunk-TZMSLE5B-cH4y8DMD.js} +1 -1
- package/dist/core-dist/assets/classDiagram-2ON5EDUG-DetPPK8G.js +1 -0
- package/dist/core-dist/assets/classDiagram-v2-WZHVMYZB-DetPPK8G.js +1 -0
- package/dist/core-dist/assets/clone-ZzK9qmZ8.js +1 -0
- package/dist/core-dist/assets/{code-block-IT6T5CEO-Ceng2fM2.js → code-block-IT6T5CEO-BjXa4xsL.js} +1 -1
- package/dist/core-dist/assets/{cose-bilkent-S5V4N54A-DqXTIalc.js → cose-bilkent-S5V4N54A-C6X32Xza.js} +1 -1
- package/dist/core-dist/assets/{cssMode-_s0s6jbb.js → cssMode-COyIeO5D.js} +1 -1
- package/dist/core-dist/assets/{dagre-6UL2VRFP-CLN6NsN5.js → dagre-6UL2VRFP-BQJjQlXe.js} +1 -1
- package/dist/core-dist/assets/{diagram-PSM6KHXK-ByycaI76.js → diagram-PSM6KHXK-B_lyGamX.js} +1 -1
- package/dist/core-dist/assets/{diagram-QEK2KX5R-BoH7syf_.js → diagram-QEK2KX5R-BXKMeskZ.js} +1 -1
- package/dist/core-dist/assets/{diagram-S2PKOQOG-BqUHyr8W.js → diagram-S2PKOQOG-DRgMDaOe.js} +1 -1
- package/dist/core-dist/assets/{erDiagram-Q2GNP2WA-CkGXgXvC.js → erDiagram-Q2GNP2WA-BO-W5nUt.js} +1 -1
- package/dist/core-dist/assets/{flowDiagram-NV44I4VS-DgOYOnAl.js → flowDiagram-NV44I4VS-Dz2q0_YK.js} +1 -1
- package/dist/core-dist/assets/{format-cell-value-KjkoG7hD.js → format-cell-value-X8lEs2y8.js} +1 -1
- package/dist/core-dist/assets/{freemarker2-CNZbXDjD.js → freemarker2-gdEdc-lB.js} +1 -1
- package/dist/core-dist/assets/{ganttDiagram-JELNMOA3-DRLDy2OX.js → ganttDiagram-JELNMOA3-B543Dp2T.js} +1 -1
- package/dist/core-dist/assets/{gitGraphDiagram-NY62KEGX-Bcm5bNVl.js → gitGraphDiagram-NY62KEGX-aRaFIgsI.js} +1 -1
- package/dist/core-dist/assets/{graph-BX6qryEG.js → graph-CTgOz0UF.js} +1 -1
- package/dist/core-dist/assets/{handlebars-DmLaz1e0.js → handlebars-BBHQDTvc.js} +1 -1
- package/dist/core-dist/assets/{html-BFgVUJOE.js → html-BHSCOa4F.js} +1 -1
- package/dist/core-dist/assets/{htmlMode-D5h1Vspx.js → htmlMode-CkiHtpA8.js} +1 -1
- package/dist/core-dist/assets/{index-Cz5UT4Mg.js → index-BTMIybLt.js} +1 -1
- package/dist/core-dist/assets/{index-DF9CAmXt.js → index-BTOfnwiY.js} +1 -1
- package/dist/core-dist/assets/{index-CnZ1kqmX.js → index-Be72I791.js} +52 -52
- package/dist/core-dist/assets/{index-BdWRYMFI.js → index-Rq-jgZaW.js} +1 -1
- package/dist/core-dist/assets/index-_iOa5gQT.js +1 -0
- package/dist/core-dist/assets/{indexes-8IGGD4eh.js → indexes-CZKaBB3n.js} +1 -1
- package/dist/core-dist/assets/{infoDiagram-WHAUD3N6-BtU1uKqv.js → infoDiagram-WHAUD3N6-BxhzEtc1.js} +1 -1
- package/dist/core-dist/assets/{javascript-D-Y2jtao.js → javascript-DkfOhMgX.js} +1 -1
- package/dist/core-dist/assets/{journeyDiagram-XKPGCS4Q-oDLycO4E.js → journeyDiagram-XKPGCS4Q-0eaJMAvF.js} +1 -1
- package/dist/core-dist/assets/{jsonMode-D0CjljtE.js → jsonMode-DZ1izBRp.js} +1 -1
- package/dist/core-dist/assets/{kanban-definition-3W4ZIXB7-DIfa4j4L.js → kanban-definition-3W4ZIXB7-C5OX0ahP.js} +1 -1
- package/dist/core-dist/assets/{layout-CeVIy2Vr.js → layout-CsSbCnq2.js} +1 -1
- package/dist/core-dist/assets/{linear-b4Urttzh.js → linear-D7wMV6wy.js} +1 -1
- package/dist/core-dist/assets/{liquid-DshRxbC8.js → liquid-CSiyAE27.js} +1 -1
- package/dist/core-dist/assets/{logs-CpUgu3HF.js → logs-CorclGry.js} +1 -1
- package/dist/core-dist/assets/{lspLanguageFeatures-QdnlfeMg.js → lspLanguageFeatures-DfqpxEKm.js} +1 -1
- package/dist/core-dist/assets/{mdx-DDV0dHdJ.js → mdx-uX3cu8xR.js} +1 -1
- package/dist/core-dist/assets/{mermaid-VLURNSYL-l6Ov7ssW.js → mermaid-VLURNSYL-Dsp_Uc89.js} +4 -4
- package/dist/core-dist/assets/{mermaid.core-BfxuFUZC.js → mermaid.core-CqgD0fud.js} +5 -5
- package/dist/core-dist/assets/{min-CFxwdQq0.js → min-i41Gt2X5.js} +1 -1
- package/dist/core-dist/assets/{mindmap-definition-VGOIOE7T-CipFHRae.js → mindmap-definition-VGOIOE7T-DjevekBL.js} +1 -1
- package/dist/core-dist/assets/{pieDiagram-ADFJNKIX-BUiWlVgQ.js → pieDiagram-ADFJNKIX-CPtZmRfi.js} +1 -1
- package/dist/core-dist/assets/{python-PS988bn3.js → python-B9JzkkTC.js} +1 -1
- package/dist/core-dist/assets/{quadrantDiagram-AYHSOK5B-C_TyzYH5.js → quadrantDiagram-AYHSOK5B-S4R-vVvp.js} +1 -1
- package/dist/core-dist/assets/{queries.store-C0c7hpRl.js → queries.store-B1nG_ISF.js} +1 -1
- package/dist/core-dist/assets/{razor-DwHq5O0V.js → razor-CzwuFYGp.js} +1 -1
- package/dist/core-dist/assets/{requirementDiagram-UZGBJVZJ-BVMFXDeK.js → requirementDiagram-UZGBJVZJ-DLD6w2sA.js} +1 -1
- package/dist/core-dist/assets/{runner-tab-C3c2d6Aw.js → runner-tab-DPb19JM8.js} +3 -3
- package/dist/core-dist/assets/{sankeyDiagram-TZEHDZUN-C3bvRR0p.js → sankeyDiagram-TZEHDZUN-BbQCHwbF.js} +1 -1
- package/dist/core-dist/assets/{schema-BV8gahQJ.js → schema-BD130Lxx.js} +1 -1
- package/dist/core-dist/assets/{sequenceDiagram-WL72ISMW-3uaEP9A9.js → sequenceDiagram-WL72ISMW-DJmT-TV8.js} +1 -1
- package/dist/core-dist/assets/{spinner-CqDbUqU4.js → spinner-ChqXfynD.js} +1 -1
- package/dist/core-dist/assets/{stateDiagram-FKZM4ZOC-yAiNIUHs.js → stateDiagram-FKZM4ZOC-CA3Y31oP.js} +1 -1
- package/dist/core-dist/assets/stateDiagram-v2-4FDKWEC3-C9Mi7uYs.js +1 -0
- package/dist/core-dist/assets/{timeline-definition-IT6M3QCI-Bzobs3Yi.js → timeline-definition-IT6M3QCI-CZ6VgbGA.js} +1 -1
- package/dist/core-dist/assets/{treemap-KMMF4GRG-Dl0T757g.js → treemap-KMMF4GRG-CGReTPVL.js} +1 -1
- package/dist/core-dist/assets/{tsMode-Byuiqukj.js → tsMode-CIVrOdYR.js} +1 -1
- package/dist/core-dist/assets/{typescript-B08nec4G.js → typescript-C-mVzuNT.js} +1 -1
- package/dist/core-dist/assets/{visualizer-BHvXt3Ng.js → visualizer-CFH9tiUM.js} +1 -1
- package/dist/core-dist/assets/{xml-CvXv2bc8.js → xml-B32PQaiV.js} +1 -1
- package/dist/core-dist/assets/{xychartDiagram-PRI3JC2R-CnlrCSYS.js → xychartDiagram-PRI3JC2R-BP0zg957.js} +1 -1
- package/dist/core-dist/assets/{yaml-BMIQXL0J.js → yaml-i7-mo1Cv.js} +1 -1
- package/dist/core-dist/index.html +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/core-dist/assets/_queryId-BKz8FUI1.js +0 -1
- package/dist/core-dist/assets/channel-C8qB82xE.js +0 -1
- package/dist/core-dist/assets/classDiagram-2ON5EDUG-BtPJeqYQ.js +0 -1
- package/dist/core-dist/assets/classDiagram-v2-WZHVMYZB-BtPJeqYQ.js +0 -1
- package/dist/core-dist/assets/clone--nCRoznC.js +0 -1
- package/dist/core-dist/assets/index-DdmhUnZE.js +0 -1
- package/dist/core-dist/assets/stateDiagram-v2-4FDKWEC3-BRP3xAkf.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-
|
|
2
|
-
import{aL as q3,r as k,e as du,j as b,b as El,u as $3,P as na,h as lr,i as Y3,g as vl,K as G3,aM as Kf,N as W3,aN as X3,O as K3,m as Q3,U as Z3,V as J3,Q as Qf,W as e6,X as t6,aO as n6,aP as Zf,J as r6,aQ as i6,aR as a6,aS as s6,aT as o6,aU as u6,aV as l6,aW as c6,aX as h6,aY as d6,aZ as f6,a_ as m6,a$ as p6,b0 as g6,b1 as b6,b2 as y6,c as br,M as Dt,o as ge,S as Ge,b3 as x6,b4 as T6,Y as Jf,_ as Ss,b5 as E6,b6 as v6,b7 as A6,b8 as k6,b9 as w6,ba as S6,bb as C6,bc as e1,al as Cs,am as ra,ad as t1,ao as N6,bd as I6,be as n1,aD as Ns,aK as Is,ag as ji,bf as r1,ar as or,a6 as i1,a7 as a1,a8 as s1,a9 as o1,aa as ja,ab as on,bg as u1,bh as _6,ak as l1,bi as D6,bj as M6,bk as R6,bl as L6}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-CqgD0fud.js","assets/index-Be72I791.js","assets/index-C1hGVAGZ.css","assets/code-block-IT6T5CEO-BjXa4xsL.js","assets/queries.store-B1nG_ISF.js","assets/index-BTOfnwiY.js","assets/spinner-ChqXfynD.js","assets/katex-DvXFAOB1.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aL as q3,r as k,e as du,j as b,b as El,u as $3,P as na,h as lr,i as Y3,g as vl,K as G3,aM as Kf,N as W3,aN as X3,O as K3,m as Q3,U as Z3,V as J3,Q as Qf,W as e6,X as t6,aO as n6,aP as Zf,J as r6,aQ as i6,aR as a6,aS as s6,aT as o6,aU as u6,aV as l6,aW as c6,aX as h6,aY as d6,aZ as f6,a_ as m6,a$ as p6,b0 as g6,b1 as b6,b2 as y6,c as br,M as Dt,o as ge,S as Ge,b3 as x6,b4 as T6,Y as Jf,_ as Ss,b5 as E6,b6 as v6,b7 as A6,b8 as k6,b9 as w6,ba as S6,bb as C6,bc as e1,al as Cs,am as ra,ad as t1,ao as N6,bd as I6,be as n1,aD as Ns,aK as Is,ag as ji,bf as r1,ar as or,a6 as i1,a7 as a1,a8 as s1,a9 as o1,aa as ja,ab as on,bg as u1,bh as _6,ak as l1,bi as D6,bj as M6,bk as R6,bl as L6}from"./index-Be72I791.js";import{C as P6,u as _s}from"./queries.store-B1nG_ISF.js";import{S as c1,g as O6,K as Vi,I as h1,D as fu,a as mu,b as pu,c as gu,d as bu,e as yu,f as F6,R as B6}from"./index-BTOfnwiY.js";import{a as Qa,b as Za,c as Ja,u as Ds,S as z6}from"./spinner-ChqXfynD.js";function d1(e){return q3({select:t=>t.location})}var Ms="Collapsible",[H6]=El(Ms),[U6,Al]=H6(Ms),f1=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[u,l]=du({prop:r,defaultProp:i??!1,onChange:s,caller:Ms});return b.jsx(U6,{scope:n,disabled:a,contentId:$3(),open:u,onOpenToggle:k.useCallback(()=>l(c=>!c),[l]),children:b.jsx(na.div,{"data-state":wl(u),"data-disabled":a?"":void 0,...o,ref:t})})});f1.displayName=Ms;var m1="CollapsibleTrigger",p1=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=Al(m1,n);return b.jsx(na.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":wl(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:lr(e.onClick,i.onOpenToggle)})});p1.displayName=m1;var kl="CollapsibleContent",g1=k.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Al(kl,e.__scopeCollapsible);return b.jsx(Y3,{present:n||i.open,children:({present:a})=>b.jsx(j6,{...r,ref:t,present:a})})});g1.displayName=kl;var j6=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=Al(kl,n),[o,u]=k.useState(r),l=k.useRef(null),c=vl(t,l),h=k.useRef(0),d=h.current,m=k.useRef(0),y=m.current,T=s.open||o,w=k.useRef(T),A=k.useRef(void 0);return k.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),G3(()=>{const E=l.current;if(E){A.current=A.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const S=E.getBoundingClientRect();h.current=S.height,m.current=S.width,w.current||(E.style.transitionDuration=A.current.transitionDuration,E.style.animationName=A.current.animationName),u(r)}},[s.open,r]),b.jsx(na.div,{"data-state":wl(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!T,...a,ref:c,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:T&&i})});function wl(e){return e?"open":"closed"}var V6=f1,b1="AlertDialog",[q6]=El(b1,[Kf]),Nn=Kf(),y1=e=>{const{__scopeAlertDialog:t,...n}=e,r=Nn(t);return b.jsx(W3,{...r,...n,modal:!0})};y1.displayName=b1;var $6="AlertDialogTrigger",Y6=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Nn(n);return b.jsx(n6,{...i,...r,ref:t})});Y6.displayName=$6;var G6="AlertDialogPortal",x1=e=>{const{__scopeAlertDialog:t,...n}=e,r=Nn(t);return b.jsx(e6,{...r,...n})};x1.displayName=G6;var W6="AlertDialogOverlay",T1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Nn(n);return b.jsx(t6,{...i,...r,ref:t})});T1.displayName=W6;var Fr="AlertDialogContent",[X6,K6]=q6(Fr),Q6=Q3("AlertDialogContent"),E1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...i}=e,a=Nn(n),s=k.useRef(null),o=vl(t,s),u=k.useRef(null);return b.jsx(X3,{contentName:Fr,titleName:v1,docsSlug:"alert-dialog",children:b.jsx(X6,{scope:n,cancelRef:u,children:b.jsxs(K3,{role:"alertdialog",...a,...i,ref:o,onOpenAutoFocus:lr(i.onOpenAutoFocus,l=>{l.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[b.jsx(Q6,{children:r}),b.jsx(J6,{contentRef:s})]})})})});E1.displayName=Fr;var v1="AlertDialogTitle",A1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Nn(n);return b.jsx(Z3,{...i,...r,ref:t})});A1.displayName=v1;var k1="AlertDialogDescription",w1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Nn(n);return b.jsx(J3,{...i,...r,ref:t})});w1.displayName=k1;var Z6="AlertDialogAction",S1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Nn(n);return b.jsx(Qf,{...i,...r,ref:t})});S1.displayName=Z6;var C1="AlertDialogCancel",N1=k.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=K6(C1,n),a=Nn(n),s=vl(t,i);return b.jsx(Qf,{...a,...r,ref:s})});N1.displayName=C1;var J6=({contentRef:e})=>{const t=`\`${Fr}\` requires a description for the component to be accessible for screen reader users.
|
|
3
3
|
|
|
4
4
|
You can add a description to the \`${Fr}\` by passing a \`${k1}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
5
5
|
|
|
@@ -373,13 +373,13 @@ ${e}</tr>
|
|
|
373
373
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
374
374
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Zt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Pf(e);if(i===null)return r;e=i;let a='<a href="'+e+'"';return t&&(a+=' title="'+Zt(t)+'"'),a+=">"+r+"</a>",a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Pf(e);if(i===null)return Zt(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${Zt(t)}"`),a+=">",a}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Zt(e.text)}},nc=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Wt=class xl{options;renderer;textRenderer;constructor(t){this.options=t||Ar,this.options.renderer=this.options.renderer||new ws,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new nc}static parse(t,n){return new xl(n).parse(t)}static parseInline(t,n){return new xl(n).parseInline(t)}parse(t,n=!0){let r="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let o=a,u=this.options.extensions.renderers[o.type].call({parser:this},o);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){r+=u||"";continue}}let s=a;switch(s.type){case"space":{r+=this.renderer.space(s);continue}case"hr":{r+=this.renderer.hr(s);continue}case"heading":{r+=this.renderer.heading(s);continue}case"code":{r+=this.renderer.code(s);continue}case"table":{r+=this.renderer.table(s);continue}case"blockquote":{r+=this.renderer.blockquote(s);continue}case"list":{r+=this.renderer.list(s);continue}case"html":{r+=this.renderer.html(s);continue}case"def":{r+=this.renderer.def(s);continue}case"paragraph":{r+=this.renderer.paragraph(s);continue}case"text":{let o=s,u=this.renderer.text(o);for(;i+1<t.length&&t[i+1].type==="text";)o=t[++i],u+=`
|
|
375
375
|
`+this.renderer.text(o);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return r}parseInline(t,n=this.renderer){let r="";for(let i=0;i<t.length;i++){let a=t[i];if(this.options.extensions?.renderers?.[a.type]){let o=this.options.extensions.renderers[a.type].call({parser:this},a);if(o!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=o||"";continue}}let s=a;switch(s.type){case"escape":{r+=n.text(s);break}case"html":{r+=n.html(s);break}case"link":{r+=n.link(s);break}case"image":{r+=n.image(s);break}case"strong":{r+=n.strong(s);break}case"em":{r+=n.em(s);break}case"codespan":{r+=n.codespan(s);break}case"br":{r+=n.br(s);break}case"del":{r+=n.del(s);break}case"text":{r+=n.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return r}},wi=class{options;block;constructor(e){this.options=e||Ar}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?Ot.lex:Ot.lexInline}provideParser(){return this.block?Wt.parse:Wt.parseInline}},dL=class{defaults=W0();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Wt;Renderer=ws;TextRenderer=nc;Lexer=Ot;Tokenizer=ks;Hooks=wi;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{let i=r;for(let a of i.header)n=n.concat(this.walkTokens(a.tokens,t));for(let a of i.rows)for(let s of a)n=n.concat(this.walkTokens(s.tokens,t));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(a=>{let s=i[a].flat(1/0);n=n.concat(this.walkTokens(s,t))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let a=t.renderers[i.name];a?t.renderers[i.name]=function(...s){let o=i.renderer.apply(this,s);return o===!1&&(o=a.apply(this,s)),o}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let a=t[i.level];a?a.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new ws(this.defaults);for(let a in n.renderer){if(!(a in i))throw new Error(`renderer '${a}' does not exist`);if(["options","parser"].includes(a))continue;let s=a,o=n.renderer[s],u=i[s];i[s]=(...l)=>{let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new ks(this.defaults);for(let a in n.tokenizer){if(!(a in i))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;let s=a,o=n.tokenizer[s],u=i[s];i[s]=(...l)=>{let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new wi;for(let a in n.hooks){if(!(a in i))throw new Error(`hook '${a}' does not exist`);if(["options","block"].includes(a))continue;let s=a,o=n.hooks[s],u=i[s];wi.passThroughHooks.has(a)?i[s]=l=>{if(this.defaults.async&&wi.passThroughHooksRespectAsync.has(a))return(async()=>{let h=await o.call(i,l);return u.call(i,h)})();let c=o.call(i,l);return u.call(i,c)}:i[s]=(...l)=>{if(this.defaults.async)return(async()=>{let h=await o.apply(i,l);return h===!1&&(h=await u.apply(i,l)),h})();let c=o.apply(i,l);return c===!1&&(c=u.apply(i,l)),c}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,a=n.walkTokens;r.walkTokens=function(s){let o=[];return o.push(a.call(this,s)),i&&(o=o.concat(i.call(this,s))),o}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ot.lex(e,t??this.defaults)}parser(e,t){return Wt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let s=i.hooks?await i.hooks.preprocess(t):t,o=await(i.hooks?await i.hooks.provideLexer():e?Ot.lex:Ot.lexInline)(s,i),u=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(u,i.walkTokens));let l=await(i.hooks?await i.hooks.provideParser():e?Wt.parse:Wt.parseInline)(u,i);return i.hooks?await i.hooks.postprocess(l):l})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let s=(i.hooks?i.hooks.provideLexer():e?Ot.lex:Ot.lexInline)(t,i);i.hooks&&(s=i.hooks.processAllTokens(s)),i.walkTokens&&this.walkTokens(s,i.walkTokens);let o=(i.hooks?i.hooks.provideParser():e?Wt.parse:Wt.parseInline)(s,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(s){return a(s)}}}onError(e,t){return n=>{if(n.message+=`
|
|
376
|
-
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},gr=new dL;function _e(e,t){return gr.parse(e,t)}_e.options=_e.setOptions=function(e){return gr.setOptions(e),_e.defaults=gr.defaults,Hg(_e.defaults),_e};_e.getDefaults=W0;_e.defaults=Ar;_e.use=function(...e){return gr.use(...e),_e.defaults=gr.defaults,Hg(_e.defaults),_e};_e.walkTokens=function(e,t){return gr.walkTokens(e,t)};_e.parseInline=gr.parseInline;_e.Parser=Wt;_e.parser=Wt.parse;_e.Renderer=ws;_e.TextRenderer=nc;_e.Lexer=Ot;_e.lexer=Ot.lex;_e.Tokenizer=ks;_e.Hooks=wi;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Wt.parse;Ot.lex;var Ee=(...e)=>E6(v6(e)),jr=(e,t,n)=>{let r=typeof t=="string"?new Blob([t],{type:n}):t,i=URL.createObjectURL(r),a=document.createElement("a");a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},fL=k.createContext({code:""}),Qg=()=>k.useContext(fL),Bf=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...s})=>{let[o,u]=k.useState(!1),l=k.useRef(0),{code:c}=Qg(),{isAnimating:h}=k.useContext(Kt),d=a??c,m=async()=>{var T;if(typeof window>"u"||!((T=navigator?.clipboard)!=null&&T.writeText)){t?.(new Error("Clipboard API not available"));return}try{o||(await navigator.clipboard.writeText(d),u(!0),e?.(),l.current=window.setTimeout(()=>u(!1),n))}catch(w){t?.(w)}};k.useEffect(()=>()=>{window.clearTimeout(l.current)},[]);let y=o?Ng:Ig;return b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-copy-button",disabled:h,onClick:m,title:"Copy Code",type:"button",...s,children:r??b.jsx(y,{size:14})})},zf={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",文言:"wy"},mL=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...s})=>{let{code:o}=Qg(),{isAnimating:u}=k.useContext(Kt),l=a??o,c=`file.${n&&n in zf?zf[n]:"txt"}`,h="text/plain",d=()=>{try{jr(c,l,h),e?.()}catch(m){t?.(m)}};return b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-download-button",disabled:u,onClick:d,title:"Download file",type:"button",...s,children:r??b.jsx(eo,{size:14})})},Hf=()=>b.jsxs("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[b.jsx("div",{className:"h-[46px] w-full bg-muted/80"}),b.jsx("div",{className:"flex w-full items-center justify-center p-4",children:b.jsx(oD,{className:"size-4 animate-spin"})})]}),pL=/\.[^/.]+$/,gL=({node:e,className:t,src:n,alt:r,...i})=>{let a=async()=>{if(n)try{let s=await(await fetch(n)).blob(),o=new URL(n,window.location.origin).pathname.split("/").pop()||"",u=o.split(".").pop(),l=o.includes(".")&&u!==void 0&&u.length<=4,c="";if(l)c=o;else{let h=s.type,d="png";h.includes("jpeg")||h.includes("jpg")?d="jpg":h.includes("png")?d="png":h.includes("svg")?d="svg":h.includes("gif")?d="gif":h.includes("webp")&&(d="webp"),c=`${(r||o||"image").replace(pL,"")}.${d}`}jr(c,s,s.type)}catch(s){console.error("Failed to download image:",s)}};return n?b.jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[b.jsx("img",{alt:r,className:Ee("max-w-full rounded-lg",t),"data-streamdown":"image",src:n,...i}),b.jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),b.jsx("button",{className:Ee("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:a,title:"Download image",type:"button",children:b.jsx(eo,{size:14})})]}):null},Zg=async e=>{let t={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0,...e},n=(await Ss(async()=>{const{default:r}=await import("./mermaid.core-BfxuFUZC.js").then(i=>i.bA);return{default:r}},__vite__mapDeps([0,1,2]))).default;return n.initialize(t),n},bL=(e,t)=>{var n;let r=(n=void 0)!=null?n:5;return new Promise((i,a)=>{let s="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),o=new Image;o.crossOrigin="anonymous",o.onload=()=>{let u=document.createElement("canvas"),l=o.width*r,c=o.height*r;u.width=l,u.height=c;let h=u.getContext("2d");if(!h){a(new Error("Failed to create 2D canvas context for PNG export"));return}h.drawImage(o,0,0,l,c),u.toBlob(d=>{if(!d){a(new Error("Failed to create PNG blob"));return}i(d)},"image/png")},o.onerror=()=>a(new Error("Failed to load SVG image")),o.src=s})},yL=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let[s,o]=k.useState(!1),u=k.useRef(null),{isAnimating:l}=k.useContext(Kt),c=async h=>{try{if(h==="mmd"){jr("diagram.mmd",e,"text/plain"),o(!1),r?.(h);return}let d=await Zg(i),m=e.split("").reduce((w,A)=>(w<<5)-w+A.charCodeAt(0)|0,0),y=`mermaid-${Math.abs(m)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:T}=await d.render(y,e);if(!T){a?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(h==="svg"){jr("diagram.svg",T,"image/svg+xml"),o(!1),r?.(h);return}if(h==="png"){let w=await bL(T);jr("diagram.png",w,"image/png"),r?.(h),o(!1);return}}catch(d){a?.(d)}};return k.useEffect(()=>{let h=d=>{u.current&&!u.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[]),b.jsxs("div",{className:"relative",ref:u,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:l,onClick:()=>o(!s),title:"Download diagram",type:"button",children:t??b.jsx(eo,{size:14})}),s&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]})]})},Ui=0,xL=()=>{Ui+=1,Ui===1&&(document.body.style.overflow="hidden")},TL=()=>{Ui=Math.max(0,Ui-1),Ui===0&&(document.body.style.overflow="")},EL=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let[s,o]=k.useState(!1),{isAnimating:u,controls:l}=k.useContext(Kt),c=(()=>{if(typeof l=="boolean")return l;let d=l.mermaid;return d===!1?!1:d===!0||d===void 0?!0:d.panZoom!==!1})(),h=()=>{o(!s)};return k.useEffect(()=>{if(s){xL();let d=m=>{m.key==="Escape"&&o(!1)};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),TL()}}},[s]),k.useEffect(()=>{s?n?.():r&&r()},[s,n,r]),b.jsxs(b.Fragment,{children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),disabled:u,onClick:h,title:"View fullscreen",type:"button",...a,children:b.jsx(lD,{size:14})}),s&&b.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:h,onKeyDown:d=>{d.key==="Escape"&&h()},role:"button",tabIndex:0,children:[b.jsx("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:h,title:"Exit fullscreen",type:"button",children:b.jsx(fD,{size:20})}),b.jsx("div",{className:"flex h-full w-full items-center justify-center p-4",onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),role:"presentation",children:b.jsx(C3,{chart:e,className:"h-full w-full [&>div]:h-full [&>div]:overflow-hidden [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:!0,showControls:c})})]})]})},Jg=e=>{var t,n;let r=[],i=[],a=e.querySelectorAll("thead th");for(let o of a)r.push(((t=o.textContent)==null?void 0:t.trim())||"");let s=e.querySelectorAll("tbody tr");for(let o of s){let u=[],l=o.querySelectorAll("td");for(let c of l)u.push(((n=c.textContent)==null?void 0:n.trim())||"");i.push(u)}return{headers:r,rows:i}},e3=e=>{let{headers:t,rows:n}=e,r=o=>{let u=!1,l=!1;for(let c=0;c<o.length;c+=1){let h=o[c];if(h==='"'){u=!0,l=!0;break}(h===","||h===`
|
|
376
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},gr=new dL;function _e(e,t){return gr.parse(e,t)}_e.options=_e.setOptions=function(e){return gr.setOptions(e),_e.defaults=gr.defaults,Hg(_e.defaults),_e};_e.getDefaults=W0;_e.defaults=Ar;_e.use=function(...e){return gr.use(...e),_e.defaults=gr.defaults,Hg(_e.defaults),_e};_e.walkTokens=function(e,t){return gr.walkTokens(e,t)};_e.parseInline=gr.parseInline;_e.Parser=Wt;_e.parser=Wt.parse;_e.Renderer=ws;_e.TextRenderer=nc;_e.Lexer=Ot;_e.lexer=Ot.lex;_e.Tokenizer=ks;_e.Hooks=wi;_e.parse=_e;_e.options;_e.setOptions;_e.use;_e.walkTokens;_e.parseInline;Wt.parse;Ot.lex;var Ee=(...e)=>E6(v6(e)),jr=(e,t,n)=>{let r=typeof t=="string"?new Blob([t],{type:n}):t,i=URL.createObjectURL(r),a=document.createElement("a");a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},fL=k.createContext({code:""}),Qg=()=>k.useContext(fL),Bf=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...s})=>{let[o,u]=k.useState(!1),l=k.useRef(0),{code:c}=Qg(),{isAnimating:h}=k.useContext(Kt),d=a??c,m=async()=>{var T;if(typeof window>"u"||!((T=navigator?.clipboard)!=null&&T.writeText)){t?.(new Error("Clipboard API not available"));return}try{o||(await navigator.clipboard.writeText(d),u(!0),e?.(),l.current=window.setTimeout(()=>u(!1),n))}catch(w){t?.(w)}};k.useEffect(()=>()=>{window.clearTimeout(l.current)},[]);let y=o?Ng:Ig;return b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-copy-button",disabled:h,onClick:m,title:"Copy Code",type:"button",...s,children:r??b.jsx(y,{size:14})})},zf={"1c":"1c","1c-query":"1cq",abap:"abap","actionscript-3":"as",ada:"ada",adoc:"adoc","angular-html":"html","angular-ts":"ts",apache:"conf",apex:"cls",apl:"apl",applescript:"applescript",ara:"ara",asciidoc:"adoc",asm:"asm",astro:"astro",awk:"awk",ballerina:"bal",bash:"sh",bat:"bat",batch:"bat",be:"be",beancount:"beancount",berry:"berry",bibtex:"bib",bicep:"bicep",blade:"blade.php",bsl:"bsl",c:"c","c#":"cs","c++":"cpp",cadence:"cdc",cairo:"cairo",cdc:"cdc",clarity:"clar",clj:"clj",clojure:"clj","closure-templates":"soy",cmake:"cmake",cmd:"cmd",cobol:"cob",codeowners:"CODEOWNERS",codeql:"ql",coffee:"coffee",coffeescript:"coffee","common-lisp":"lisp",console:"sh",coq:"v",cpp:"cpp",cql:"cql",crystal:"cr",cs:"cs",csharp:"cs",css:"css",csv:"csv",cue:"cue",cypher:"cql",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",docker:"dockerfile",dockerfile:"dockerfile",dotenv:"env","dream-maker":"dm",edge:"edge",elisp:"el",elixir:"ex",elm:"elm","emacs-lisp":"el",erb:"erb",erl:"erl",erlang:"erl",f:"f","f#":"fs",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"f90",f95:"f95",fennel:"fnl",fish:"fish",fluent:"ftl",for:"for","fortran-fixed-form":"f","fortran-free-form":"f90",fs:"fs",fsharp:"fs",fsl:"fsl",ftl:"ftl",gdresource:"tres",gdscript:"gd",gdshader:"gdshader",genie:"gs",gherkin:"feature","git-commit":"gitcommit","git-rebase":"gitrebase",gjs:"js",gleam:"gleam","glimmer-js":"js","glimmer-ts":"ts",glsl:"glsl",gnuplot:"plt",go:"go",gql:"gql",graphql:"graphql",groovy:"groovy",gts:"gts",hack:"hack",haml:"haml",handlebars:"hbs",haskell:"hs",haxe:"hx",hbs:"hbs",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",hs:"hs",html:"html","html-derivative":"html",http:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",jade:"jade",java:"java",javascript:"js",jinja:"jinja",jison:"jison",jl:"jl",js:"js",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",julia:"jl",kotlin:"kt",kql:"kql",kt:"kt",kts:"kts",kusto:"kql",latex:"tex",lean:"lean",lean4:"lean",less:"less",liquid:"liquid",lisp:"lisp",lit:"lit",llvm:"ll",log:"log",logo:"logo",lua:"lua",luau:"luau",make:"mak",makefile:"mak",markdown:"md",marko:"marko",matlab:"m",md:"md",mdc:"mdc",mdx:"mdx",mediawiki:"wiki",mermaid:"mmd",mips:"s",mipsasm:"s",mmd:"mmd",mojo:"mojo",move:"move",nar:"nar",narrat:"narrat",nextflow:"nf",nf:"nf",nginx:"conf",nim:"nim",nix:"nix",nu:"nu",nushell:"nu",objc:"m","objective-c":"m","objective-cpp":"mm",ocaml:"ml",pascal:"pas",perl:"pl",perl6:"p6",php:"php",plsql:"pls",po:"po",polar:"polar",postcss:"pcss",pot:"pot",potx:"potx",powerquery:"pq",powershell:"ps1",prisma:"prisma",prolog:"pl",properties:"properties",proto:"proto",protobuf:"proto",ps:"ps",ps1:"ps1",pug:"pug",puppet:"pp",purescript:"purs",py:"py",python:"py",ql:"ql",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",racket:"rkt",raku:"raku",razor:"cshtml",rb:"rb",reg:"reg",regex:"regex",regexp:"regexp",rel:"rel",riscv:"s",rs:"rs",rst:"rst",ruby:"rb",rust:"rs",sas:"sas",sass:"sass",scala:"scala",scheme:"scm",scss:"scss",sdbl:"sdbl",sh:"sh",shader:"shader",shaderlab:"shader",shell:"sh",shellscript:"sh",shellsession:"sh",smalltalk:"st",solidity:"sol",soy:"soy",sparql:"rq",spl:"spl",splunk:"spl",sql:"sql","ssh-config":"config",stata:"do",styl:"styl",stylus:"styl",svelte:"svelte",swift:"swift","system-verilog":"sv",systemd:"service",talon:"talon",talonscript:"talon",tasl:"tasl",tcl:"tcl",templ:"templ",terraform:"tf",tex:"tex",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"ts","ts-tags":"ts",tsp:"tsp",tsv:"tsv",tsx:"tsx",turtle:"ttl",twig:"twig",typ:"typ",typescript:"ts",typespec:"tsp",typst:"typ",v:"v",vala:"vala",vb:"vb",verilog:"v",vhdl:"vhdl",vim:"vim",viml:"vim",vimscript:"vim",vue:"vue","vue-html":"html","vue-vine":"vine",vy:"vy",vyper:"vy",wasm:"wasm",wenyan:"wy",wgsl:"wgsl",wiki:"wiki",wikitext:"wiki",wit:"wit",wl:"wl",wolfram:"wl",xml:"xml",xsl:"xsl",yaml:"yaml",yml:"yml",zenscript:"zs",zig:"zig",zsh:"zsh",文言:"wy"},mL=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...s})=>{let{code:o}=Qg(),{isAnimating:u}=k.useContext(Kt),l=a??o,c=`file.${n&&n in zf?zf[n]:"txt"}`,h="text/plain",d=()=>{try{jr(c,l,h),e?.()}catch(m){t?.(m)}};return b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),"data-streamdown":"code-block-download-button",disabled:u,onClick:d,title:"Download file",type:"button",...s,children:r??b.jsx(eo,{size:14})})},Hf=()=>b.jsxs("div",{className:"w-full divide-y divide-border overflow-hidden rounded-xl border border-border",children:[b.jsx("div",{className:"h-[46px] w-full bg-muted/80"}),b.jsx("div",{className:"flex w-full items-center justify-center p-4",children:b.jsx(oD,{className:"size-4 animate-spin"})})]}),pL=/\.[^/.]+$/,gL=({node:e,className:t,src:n,alt:r,...i})=>{let a=async()=>{if(n)try{let s=await(await fetch(n)).blob(),o=new URL(n,window.location.origin).pathname.split("/").pop()||"",u=o.split(".").pop(),l=o.includes(".")&&u!==void 0&&u.length<=4,c="";if(l)c=o;else{let h=s.type,d="png";h.includes("jpeg")||h.includes("jpg")?d="jpg":h.includes("png")?d="png":h.includes("svg")?d="svg":h.includes("gif")?d="gif":h.includes("webp")&&(d="webp"),c=`${(r||o||"image").replace(pL,"")}.${d}`}jr(c,s,s.type)}catch(s){console.error("Failed to download image:",s)}};return n?b.jsxs("div",{className:"group relative my-4 inline-block","data-streamdown":"image-wrapper",children:[b.jsx("img",{alt:r,className:Ee("max-w-full rounded-lg",t),"data-streamdown":"image",src:n,...i}),b.jsx("div",{className:"pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block"}),b.jsx("button",{className:Ee("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background","opacity-0 group-hover:opacity-100"),onClick:a,title:"Download image",type:"button",children:b.jsx(eo,{size:14})})]}):null},Zg=async e=>{let t={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0,...e},n=(await Ss(async()=>{const{default:r}=await import("./mermaid.core-CqgD0fud.js").then(i=>i.bA);return{default:r}},__vite__mapDeps([0,1,2]))).default;return n.initialize(t),n},bL=(e,t)=>{var n;let r=(n=void 0)!=null?n:5;return new Promise((i,a)=>{let s="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(e))),o=new Image;o.crossOrigin="anonymous",o.onload=()=>{let u=document.createElement("canvas"),l=o.width*r,c=o.height*r;u.width=l,u.height=c;let h=u.getContext("2d");if(!h){a(new Error("Failed to create 2D canvas context for PNG export"));return}h.drawImage(o,0,0,l,c),u.toBlob(d=>{if(!d){a(new Error("Failed to create PNG blob"));return}i(d)},"image/png")},o.onerror=()=>a(new Error("Failed to load SVG image")),o.src=s})},yL=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let[s,o]=k.useState(!1),u=k.useRef(null),{isAnimating:l}=k.useContext(Kt),c=async h=>{try{if(h==="mmd"){jr("diagram.mmd",e,"text/plain"),o(!1),r?.(h);return}let d=await Zg(i),m=e.split("").reduce((w,A)=>(w<<5)-w+A.charCodeAt(0)|0,0),y=`mermaid-${Math.abs(m)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:T}=await d.render(y,e);if(!T){a?.(new Error("SVG not found. Please wait for the diagram to render."));return}if(h==="svg"){jr("diagram.svg",T,"image/svg+xml"),o(!1),r?.(h);return}if(h==="png"){let w=await bL(T);jr("diagram.png",w,"image/png"),r?.(h),o(!1);return}}catch(d){a?.(d)}};return k.useEffect(()=>{let h=d=>{u.current&&!u.current.contains(d.target)&&o(!1)};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[]),b.jsxs("div",{className:"relative",ref:u,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",n),disabled:l,onClick:()=>o(!s),title:"Download diagram",type:"button",children:t??b.jsx(eo,{size:14})}),s&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("svg"),title:"Download diagram as SVG",type:"button",children:"SVG"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("png"),title:"Download diagram as PNG",type:"button",children:"PNG"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>c("mmd"),title:"Download diagram as MMD",type:"button",children:"MMD"})]})]})},Ui=0,xL=()=>{Ui+=1,Ui===1&&(document.body.style.overflow="hidden")},TL=()=>{Ui=Math.max(0,Ui-1),Ui===0&&(document.body.style.overflow="")},EL=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let[s,o]=k.useState(!1),{isAnimating:u,controls:l}=k.useContext(Kt),c=(()=>{if(typeof l=="boolean")return l;let d=l.mermaid;return d===!1?!1:d===!0||d===void 0?!0:d.panZoom!==!1})(),h=()=>{o(!s)};return k.useEffect(()=>{if(s){xL();let d=m=>{m.key==="Escape"&&o(!1)};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),TL()}}},[s]),k.useEffect(()=>{s?n?.():r&&r()},[s,n,r]),b.jsxs(b.Fragment,{children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",i),disabled:u,onClick:h,title:"View fullscreen",type:"button",...a,children:b.jsx(lD,{size:14})}),s&&b.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:h,onKeyDown:d=>{d.key==="Escape"&&h()},role:"button",tabIndex:0,children:[b.jsx("button",{className:"absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground",onClick:h,title:"Exit fullscreen",type:"button",children:b.jsx(fD,{size:20})}),b.jsx("div",{className:"flex h-full w-full items-center justify-center p-4",onClick:d=>d.stopPropagation(),onKeyDown:d=>d.stopPropagation(),role:"presentation",children:b.jsx(C3,{chart:e,className:"h-full w-full [&>div]:h-full [&>div]:overflow-hidden [&_svg]:h-auto [&_svg]:w-auto",config:t,fullscreen:!0,showControls:c})})]})]})},Jg=e=>{var t,n;let r=[],i=[],a=e.querySelectorAll("thead th");for(let o of a)r.push(((t=o.textContent)==null?void 0:t.trim())||"");let s=e.querySelectorAll("tbody tr");for(let o of s){let u=[],l=o.querySelectorAll("td");for(let c of l)u.push(((n=c.textContent)==null?void 0:n.trim())||"");i.push(u)}return{headers:r,rows:i}},e3=e=>{let{headers:t,rows:n}=e,r=o=>{let u=!1,l=!1;for(let c=0;c<o.length;c+=1){let h=o[c];if(h==='"'){u=!0,l=!0;break}(h===","||h===`
|
|
377
377
|
`)&&(u=!0)}return u?l?`"${o.replace(/"/g,'""')}"`:`"${o}"`:o},i=t.length>0?n.length+1:n.length,a=new Array(i),s=0;t.length>0&&(a[s]=t.map(r).join(","),s+=1);for(let o of n)a[s]=o.map(r).join(","),s+=1;return a.join(`
|
|
378
378
|
`)},vL=e=>{let{headers:t,rows:n}=e,r=o=>{let u=!1;for(let c=0;c<o.length;c+=1){let h=o[c];if(h===" "||h===`
|
|
379
379
|
`||h==="\r"){u=!0;break}}if(!u)return o;let l=[];for(let c=0;c<o.length;c+=1){let h=o[c];h===" "?l.push("\\t"):h===`
|
|
380
380
|
`?l.push("\\n"):h==="\r"?l.push("\\r"):l.push(h)}return l.join("")},i=t.length>0?n.length+1:n.length,a=new Array(i),s=0;t.length>0&&(a[s]=t.map(r).join(" "),s+=1);for(let o of n)a[s]=o.map(r).join(" "),s+=1;return a.join(`
|
|
381
381
|
`)},uu=e=>{let t=!1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i==="\\"||i==="|"){t=!0;break}}if(!t)return e;let n=[];for(let r=0;r<e.length;r+=1){let i=e[r];i==="\\"?n.push("\\\\"):i==="|"?n.push("\\|"):n.push(i)}return n.join("")},AL=e=>{let{headers:t,rows:n}=e;if(t.length===0)return"";let r=new Array(n.length+2),i=0,a=t.map(o=>uu(o));r[i]=`| ${a.join(" | ")} |`,i+=1;let s=new Array(t.length);for(let o=0;o<t.length;o+=1)s[o]="---";r[i]=`| ${s.join(" | ")} |`,i+=1;for(let o of n)if(o.length<t.length){let u=new Array(t.length);for(let l=0;l<t.length;l+=1)u[l]=l<o.length?uu(o[l]):"";r[i]=`| ${u.join(" | ")} |`,i+=1}else{let u=o.map(l=>uu(l));r[i]=`| ${u.join(" | ")} |`,i+=1}return r.join(`
|
|
382
|
-
`)},kL=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[a,s]=k.useState(!1),[o,u]=k.useState(!1),l=k.useRef(null),c=k.useRef(0),{isAnimating:h}=k.useContext(Kt),d=async y=>{var T,w;if(typeof window>"u"||!((T=navigator?.clipboard)!=null&&T.write)){r?.(new Error("Clipboard API not available"));return}try{let A=(w=l.current)==null?void 0:w.closest('[data-streamdown="table-wrapper"]'),E=A?.querySelector("table");if(!E){r?.(new Error("Table not found"));return}let S=Jg(E),O=y==="csv"?e3(S):vL(S),P=new ClipboardItem({"text/plain":new Blob([O],{type:"text/plain"}),"text/html":new Blob([E.outerHTML],{type:"text/html"})});await navigator.clipboard.write([P]),u(!0),s(!1),n?.(y),c.current=window.setTimeout(()=>u(!1),i)}catch(A){r?.(A)}};k.useEffect(()=>{let y=T=>{l.current&&!l.current.contains(T.target)&&s(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y),window.clearTimeout(c.current)}},[]);let m=o?Ng:Ig;return b.jsxs("div",{className:"relative",ref:l,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:h,onClick:()=>s(!a),title:"Copy table",type:"button",children:e??b.jsx(m,{size:14})}),a&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]})]})},wL=({children:e,className:t,onDownload:n,onError:r})=>{let[i,a]=k.useState(!1),s=k.useRef(null),{isAnimating:o}=k.useContext(Kt),u=l=>{var c;try{let h=(c=s.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),d=h?.querySelector("table");if(!d){r?.(new Error("Table not found"));return}let m=Jg(d),y=l==="csv"?e3(m):AL(m);jr(`table.${l==="csv"?"csv":"md"}`,y,l==="csv"?"text/csv":"text/markdown"),a(!1),n?.(l)}catch(h){r?.(h)}};return k.useEffect(()=>{let l=c=>{s.current&&!s.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]),b.jsxs("div",{className:"relative",ref:s,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:o,onClick:()=>a(!i),title:"Download table",type:"button",children:e??b.jsx(eo,{size:14})}),i&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]})]})},SL=({children:e,className:t,showControls:n,...r})=>b.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n&&b.jsxs("div",{className:"flex items-center justify-end gap-1",children:[b.jsx(kL,{}),b.jsx(wL,{})]}),b.jsx("div",{className:"overflow-x-auto",children:b.jsx("table",{className:Ee("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),CL=k.lazy(()=>Ss(()=>import("./code-block-IT6T5CEO-Ceng2fM2.js"),__vite__mapDeps([3,1,2,4,5,6])).then(e=>({default:e.CodeBlock}))),NL=k.lazy(()=>Ss(()=>Promise.resolve().then(()=>GP),void 0).then(e=>({default:e.Mermaid}))),IL=/language-([^\s]+)/;function ro(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 n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function $e(e,t){return e.className===t.className&&ro(e.node,t.node)}var Tl=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,za=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},rc=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("ol",{className:Ee("list-inside list-decimal whitespace-normal",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>$e(e,t));rc.displayName="MarkdownOl";var t3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("li",{className:Ee("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&ro(e.node,t.node));t3.displayName="MarkdownLi";var n3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("ul",{className:Ee("list-inside list-disc whitespace-normal",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>$e(e,t));n3.displayName="MarkdownUl";var r3=k.memo(({className:e,node:t,...n})=>b.jsx("hr",{className:Ee("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>$e(e,t));r3.displayName="MarkdownHr";var i3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("span",{className:Ee("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>$e(e,t));i3.displayName="MarkdownStrong";var a3=k.memo(({children:e,className:t,href:n,node:r,...i})=>{let a=n==="streamdown:incomplete-link";return b.jsx("a",{className:Ee("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":a,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},(e,t)=>$e(e,t)&&e.href===t.href);a3.displayName="MarkdownA";var s3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h1",{className:Ee("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>$e(e,t));s3.displayName="MarkdownH1";var o3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h2",{className:Ee("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>$e(e,t));o3.displayName="MarkdownH2";var u3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h3",{className:Ee("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>$e(e,t));u3.displayName="MarkdownH3";var l3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h4",{className:Ee("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>$e(e,t));l3.displayName="MarkdownH4";var c3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h5",{className:Ee("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>$e(e,t));c3.displayName="MarkdownH5";var h3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h6",{className:Ee("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>$e(e,t));h3.displayName="MarkdownH6";var d3=k.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=k.useContext(Kt),a=Tl(i,"table");return b.jsx(SL,{className:t,"data-streamdown":"table-wrapper",showControls:a,...r,children:e})},(e,t)=>$e(e,t));d3.displayName="MarkdownTable";var f3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("thead",{className:Ee("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>$e(e,t));f3.displayName="MarkdownThead";var m3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("tbody",{className:Ee("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>$e(e,t));m3.displayName="MarkdownTbody";var p3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("tr",{className:Ee("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>$e(e,t));p3.displayName="MarkdownTr";var g3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("th",{className:Ee("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>$e(e,t));g3.displayName="MarkdownTh";var b3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("td",{className:Ee("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>$e(e,t));b3.displayName="MarkdownTd";var y3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("blockquote",{className:Ee("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>$e(e,t));y3.displayName="MarkdownBlockquote";var x3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("sup",{className:Ee("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>$e(e,t));x3.displayName="MarkdownSup";var T3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("sub",{className:Ee("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>$e(e,t));T3.displayName="MarkdownSub";var E3=k.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=s=>{var o,u;if(!k.isValidElement(s))return!1;let l=Array.isArray(s.props.children)?s.props.children:[s.props.children],c=!1,h=!1;for(let d of l)if(d){if(typeof d=="string")d.trim()!==""&&(c=!0);else if(k.isValidElement(d))if(((o=d.props)==null?void 0:o["data-footnote-backref"])!==void 0)h=!0;else{let m=Array.isArray(d.props.children)?d.props.children:[d.props.children];for(let y of m){if(typeof y=="string"&&y.trim()!==""){c=!0;break}if(k.isValidElement(y)&&((u=y.props)==null?void 0:u["data-footnote-backref"])===void 0){c=!0;break}}}}return h&&!c},a=Array.isArray(e)?e.map(s=>{if(!k.isValidElement(s))return s;if(s.type===rc){let o=(Array.isArray(s.props.children)?s.props.children:[s.props.children]).filter(u=>!i(u));return o.length===0?null:{...s,props:{...s.props,children:o}}}return s}):e;return(Array.isArray(a)?a.some(s=>s!==null):a!==null)?b.jsx("section",{className:t,...r,children:a}):null}return b.jsx("section",{className:t,...r,children:e})},(e,t)=>$e(e,t));E3.displayName="MarkdownSection";var _L=({node:e,className:t,children:n,...r})=>{var i,a,s;let o=((i=e?.position)==null?void 0:i.start.line)===((a=e?.position)==null?void 0:a.end.line),{mermaid:u,controls:l}=k.useContext(Kt);if(o)return b.jsx("code",{className:Ee("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(IL),h=(s=c?.at(1))!=null?s:"",d="";if(k.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?d=n.props.children:typeof n=="string"&&(d=n),h==="mermaid"){let y=Tl(l,"mermaid"),T=za(l,"download"),w=za(l,"copy"),A=za(l,"fullscreen"),E=za(l,"panZoom");return b.jsx(k.Suspense,{fallback:b.jsx(Hf,{}),children:b.jsxs("div",{className:Ee("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[y&&(T||w||A)&&b.jsxs("div",{className:"flex items-center justify-end gap-2",children:[T&&b.jsx(yL,{chart:d,config:u?.config}),w&&b.jsx(Bf,{code:d}),A&&b.jsx(EL,{chart:d,config:u?.config})]}),b.jsx(NL,{chart:d,config:u?.config,showControls:E})]})})}let m=Tl(l,"code");return b.jsx(k.Suspense,{fallback:b.jsx(Hf,{}),children:b.jsx(CL,{className:Ee("overflow-x-auto border-border border-t",t),code:d,language:h,children:m&&b.jsxs(b.Fragment,{children:[b.jsx(mL,{code:d,language:h}),b.jsx(Bf,{})]})})})},v3=k.memo(_L,(e,t)=>e.className===t.className&&ro(e.node,t.node));v3.displayName="MarkdownCode";var A3=k.memo(gL,(e,t)=>e.className===t.className&&ro(e.node,t.node));A3.displayName="MarkdownImg";var k3=k.memo(({children:e,className:t,node:n,...r})=>{var i;let a=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");return a.length===1&&k.isValidElement(a[0])&&((i=a[0].props.node)==null?void 0:i.tagName)==="img"?b.jsx(b.Fragment,{children:e}):b.jsx("p",{className:t,...r,children:e})},(e,t)=>$e(e,t));k3.displayName="MarkdownParagraph";var DL={ol:rc,li:t3,ul:n3,hr:r3,strong:i3,a:a3,h1:s3,h2:o3,h3:u3,h4:l3,h5:c3,h6:h3,table:d3,thead:f3,tbody:m3,tr:p3,th:g3,td:b3,blockquote:y3,code:v3,img:A3,pre:({children:e})=>e,sup:x3,sub:T3,p:k3,section:E3},Uf=[],jf={allowDangerousHtml:!0},Ha=new WeakMap,ML=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let c="default";return this.keyCache.set(e,c),c}let a=c=>{if(!c||c.length===0)return"";let h="";for(let d=0;d<c.length;d+=1){let m=c[d];if(d>0&&(h+=","),Array.isArray(m)){let[y,T]=m;if(typeof y=="function"){let w=Ha.get(y);w||(w=y.name,Ha.set(y,w)),h+=w}else h+=String(y);h+=":",h+=JSON.stringify(T)}else if(typeof m=="function"){let y=Ha.get(m);y||(y=m.name,Ha.set(m,y)),h+=y}else h+=String(m)}return h},s=a(n),o=a(r),u=i?JSON.stringify(i):"",l=`${o}::${s}::${u}`;return this.keyCache.set(e,l),l}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},Vf=new ML,w3=e=>{let t=RL(e),n=e.children||"";return PL(t.runSync(t.parse(n),n),e)},RL=e=>{let t=Vf.get(e);if(t)return t;let n=LL(e);return Vf.set(e,n),n},LL=e=>{let t=e.rehypePlugins||Uf,n=e.remarkPlugins||Uf,r=e.remarkRehypeOptions?{...jf,...e.remarkRehypeOptions}:jf;return SR().use(wM).use(n).use(oR,r).use(t)},PL=(e,t)=>RD(e,{Fragment:b.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0}),OL=/\[\^[^\]\s]{1,200}\](?!:)/,FL=/\[\^[^\]\s]{1,200}\]:/,BL=/<\/(\w+)>/,zL=/<(\w+)[\s>]/,lu=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
382
|
+
`)},kL=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[a,s]=k.useState(!1),[o,u]=k.useState(!1),l=k.useRef(null),c=k.useRef(0),{isAnimating:h}=k.useContext(Kt),d=async y=>{var T,w;if(typeof window>"u"||!((T=navigator?.clipboard)!=null&&T.write)){r?.(new Error("Clipboard API not available"));return}try{let A=(w=l.current)==null?void 0:w.closest('[data-streamdown="table-wrapper"]'),E=A?.querySelector("table");if(!E){r?.(new Error("Table not found"));return}let S=Jg(E),O=y==="csv"?e3(S):vL(S),P=new ClipboardItem({"text/plain":new Blob([O],{type:"text/plain"}),"text/html":new Blob([E.outerHTML],{type:"text/html"})});await navigator.clipboard.write([P]),u(!0),s(!1),n?.(y),c.current=window.setTimeout(()=>u(!1),i)}catch(A){r?.(A)}};k.useEffect(()=>{let y=T=>{l.current&&!l.current.contains(T.target)&&s(!1)};return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y),window.clearTimeout(c.current)}},[]);let m=o?Ng:Ig;return b.jsxs("div",{className:"relative",ref:l,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:h,onClick:()=>s(!a),title:"Copy table",type:"button",children:e??b.jsx(m,{size:14})}),a&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("csv"),title:"Copy table as CSV",type:"button",children:"CSV"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>d("tsv"),title:"Copy table as TSV",type:"button",children:"TSV"})]})]})},wL=({children:e,className:t,onDownload:n,onError:r})=>{let[i,a]=k.useState(!1),s=k.useRef(null),{isAnimating:o}=k.useContext(Kt),u=l=>{var c;try{let h=(c=s.current)==null?void 0:c.closest('[data-streamdown="table-wrapper"]'),d=h?.querySelector("table");if(!d){r?.(new Error("Table not found"));return}let m=Jg(d),y=l==="csv"?e3(m):AL(m);jr(`table.${l==="csv"?"csv":"md"}`,y,l==="csv"?"text/csv":"text/markdown"),a(!1),n?.(l)}catch(h){r?.(h)}};return k.useEffect(()=>{let l=c=>{s.current&&!s.current.contains(c.target)&&a(!1)};return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[]),b.jsxs("div",{className:"relative",ref:s,children:[b.jsx("button",{className:Ee("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",t),disabled:o,onClick:()=>a(!i),title:"Download table",type:"button",children:e??b.jsx(eo,{size:14})}),i&&b.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg",children:[b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("csv"),title:"Download table as CSV",type:"button",children:"CSV"}),b.jsx("button",{className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40",onClick:()=>u("markdown"),title:"Download table as Markdown",type:"button",children:"Markdown"})]})]})},SL=({children:e,className:t,showControls:n,...r})=>b.jsxs("div",{className:"my-4 flex flex-col space-y-2","data-streamdown":"table-wrapper",children:[n&&b.jsxs("div",{className:"flex items-center justify-end gap-1",children:[b.jsx(kL,{}),b.jsx(wL,{})]}),b.jsx("div",{className:"overflow-x-auto",children:b.jsx("table",{className:Ee("w-full border-collapse border border-border",t),"data-streamdown":"table",...r,children:e})})]}),CL=k.lazy(()=>Ss(()=>import("./code-block-IT6T5CEO-BjXa4xsL.js"),__vite__mapDeps([3,1,2,4,5,6])).then(e=>({default:e.CodeBlock}))),NL=k.lazy(()=>Ss(()=>Promise.resolve().then(()=>GP),void 0).then(e=>({default:e.Mermaid}))),IL=/language-([^\s]+)/;function ro(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 n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function $e(e,t){return e.className===t.className&&ro(e.node,t.node)}var Tl=(e,t)=>typeof e=="boolean"?e:e[t]!==!1,za=(e,t)=>{if(typeof e=="boolean")return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},rc=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("ol",{className:Ee("list-inside list-decimal whitespace-normal",t),"data-streamdown":"ordered-list",...r,children:e}),(e,t)=>$e(e,t));rc.displayName="MarkdownOl";var t3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("li",{className:Ee("py-1 [&>p]:inline",t),"data-streamdown":"list-item",...r,children:e}),(e,t)=>e.className===t.className&&ro(e.node,t.node));t3.displayName="MarkdownLi";var n3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("ul",{className:Ee("list-inside list-disc whitespace-normal",t),"data-streamdown":"unordered-list",...r,children:e}),(e,t)=>$e(e,t));n3.displayName="MarkdownUl";var r3=k.memo(({className:e,node:t,...n})=>b.jsx("hr",{className:Ee("my-6 border-border",e),"data-streamdown":"horizontal-rule",...n}),(e,t)=>$e(e,t));r3.displayName="MarkdownHr";var i3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("span",{className:Ee("font-semibold",t),"data-streamdown":"strong",...r,children:e}),(e,t)=>$e(e,t));i3.displayName="MarkdownStrong";var a3=k.memo(({children:e,className:t,href:n,node:r,...i})=>{let a=n==="streamdown:incomplete-link";return b.jsx("a",{className:Ee("wrap-anywhere font-medium text-primary underline",t),"data-incomplete":a,"data-streamdown":"link",href:n,rel:"noreferrer",target:"_blank",...i,children:e})},(e,t)=>$e(e,t)&&e.href===t.href);a3.displayName="MarkdownA";var s3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h1",{className:Ee("mt-6 mb-2 font-semibold text-3xl",t),"data-streamdown":"heading-1",...r,children:e}),(e,t)=>$e(e,t));s3.displayName="MarkdownH1";var o3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h2",{className:Ee("mt-6 mb-2 font-semibold text-2xl",t),"data-streamdown":"heading-2",...r,children:e}),(e,t)=>$e(e,t));o3.displayName="MarkdownH2";var u3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h3",{className:Ee("mt-6 mb-2 font-semibold text-xl",t),"data-streamdown":"heading-3",...r,children:e}),(e,t)=>$e(e,t));u3.displayName="MarkdownH3";var l3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h4",{className:Ee("mt-6 mb-2 font-semibold text-lg",t),"data-streamdown":"heading-4",...r,children:e}),(e,t)=>$e(e,t));l3.displayName="MarkdownH4";var c3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h5",{className:Ee("mt-6 mb-2 font-semibold text-base",t),"data-streamdown":"heading-5",...r,children:e}),(e,t)=>$e(e,t));c3.displayName="MarkdownH5";var h3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("h6",{className:Ee("mt-6 mb-2 font-semibold text-sm",t),"data-streamdown":"heading-6",...r,children:e}),(e,t)=>$e(e,t));h3.displayName="MarkdownH6";var d3=k.memo(({children:e,className:t,node:n,...r})=>{let{controls:i}=k.useContext(Kt),a=Tl(i,"table");return b.jsx(SL,{className:t,"data-streamdown":"table-wrapper",showControls:a,...r,children:e})},(e,t)=>$e(e,t));d3.displayName="MarkdownTable";var f3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("thead",{className:Ee("bg-muted/80",t),"data-streamdown":"table-header",...r,children:e}),(e,t)=>$e(e,t));f3.displayName="MarkdownThead";var m3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("tbody",{className:Ee("divide-y divide-border bg-muted/40",t),"data-streamdown":"table-body",...r,children:e}),(e,t)=>$e(e,t));m3.displayName="MarkdownTbody";var p3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("tr",{className:Ee("border-border border-b",t),"data-streamdown":"table-row",...r,children:e}),(e,t)=>$e(e,t));p3.displayName="MarkdownTr";var g3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("th",{className:Ee("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm",t),"data-streamdown":"table-header-cell",...r,children:e}),(e,t)=>$e(e,t));g3.displayName="MarkdownTh";var b3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("td",{className:Ee("px-4 py-2 text-sm",t),"data-streamdown":"table-cell",...r,children:e}),(e,t)=>$e(e,t));b3.displayName="MarkdownTd";var y3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("blockquote",{className:Ee("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic",t),"data-streamdown":"blockquote",...r,children:e}),(e,t)=>$e(e,t));y3.displayName="MarkdownBlockquote";var x3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("sup",{className:Ee("text-sm",t),"data-streamdown":"superscript",...r,children:e}),(e,t)=>$e(e,t));x3.displayName="MarkdownSup";var T3=k.memo(({children:e,className:t,node:n,...r})=>b.jsx("sub",{className:Ee("text-sm",t),"data-streamdown":"subscript",...r,children:e}),(e,t)=>$e(e,t));T3.displayName="MarkdownSub";var E3=k.memo(({children:e,className:t,node:n,...r})=>{if("data-footnotes"in r){let i=s=>{var o,u;if(!k.isValidElement(s))return!1;let l=Array.isArray(s.props.children)?s.props.children:[s.props.children],c=!1,h=!1;for(let d of l)if(d){if(typeof d=="string")d.trim()!==""&&(c=!0);else if(k.isValidElement(d))if(((o=d.props)==null?void 0:o["data-footnote-backref"])!==void 0)h=!0;else{let m=Array.isArray(d.props.children)?d.props.children:[d.props.children];for(let y of m){if(typeof y=="string"&&y.trim()!==""){c=!0;break}if(k.isValidElement(y)&&((u=y.props)==null?void 0:u["data-footnote-backref"])===void 0){c=!0;break}}}}return h&&!c},a=Array.isArray(e)?e.map(s=>{if(!k.isValidElement(s))return s;if(s.type===rc){let o=(Array.isArray(s.props.children)?s.props.children:[s.props.children]).filter(u=>!i(u));return o.length===0?null:{...s,props:{...s.props,children:o}}}return s}):e;return(Array.isArray(a)?a.some(s=>s!==null):a!==null)?b.jsx("section",{className:t,...r,children:a}):null}return b.jsx("section",{className:t,...r,children:e})},(e,t)=>$e(e,t));E3.displayName="MarkdownSection";var _L=({node:e,className:t,children:n,...r})=>{var i,a,s;let o=((i=e?.position)==null?void 0:i.start.line)===((a=e?.position)==null?void 0:a.end.line),{mermaid:u,controls:l}=k.useContext(Kt);if(o)return b.jsx("code",{className:Ee("rounded bg-muted px-1.5 py-0.5 font-mono text-sm",t),"data-streamdown":"inline-code",...r,children:n});let c=t?.match(IL),h=(s=c?.at(1))!=null?s:"",d="";if(k.isValidElement(n)&&n.props&&typeof n.props=="object"&&"children"in n.props&&typeof n.props.children=="string"?d=n.props.children:typeof n=="string"&&(d=n),h==="mermaid"){let y=Tl(l,"mermaid"),T=za(l,"download"),w=za(l,"copy"),A=za(l,"fullscreen"),E=za(l,"panZoom");return b.jsx(k.Suspense,{fallback:b.jsx(Hf,{}),children:b.jsxs("div",{className:Ee("group relative my-4 h-auto rounded-xl border p-4",t),"data-streamdown":"mermaid-block",children:[y&&(T||w||A)&&b.jsxs("div",{className:"flex items-center justify-end gap-2",children:[T&&b.jsx(yL,{chart:d,config:u?.config}),w&&b.jsx(Bf,{code:d}),A&&b.jsx(EL,{chart:d,config:u?.config})]}),b.jsx(NL,{chart:d,config:u?.config,showControls:E})]})})}let m=Tl(l,"code");return b.jsx(k.Suspense,{fallback:b.jsx(Hf,{}),children:b.jsx(CL,{className:Ee("overflow-x-auto border-border border-t",t),code:d,language:h,children:m&&b.jsxs(b.Fragment,{children:[b.jsx(mL,{code:d,language:h}),b.jsx(Bf,{})]})})})},v3=k.memo(_L,(e,t)=>e.className===t.className&&ro(e.node,t.node));v3.displayName="MarkdownCode";var A3=k.memo(gL,(e,t)=>e.className===t.className&&ro(e.node,t.node));A3.displayName="MarkdownImg";var k3=k.memo(({children:e,className:t,node:n,...r})=>{var i;let a=(Array.isArray(e)?e:[e]).filter(s=>s!=null&&s!=="");return a.length===1&&k.isValidElement(a[0])&&((i=a[0].props.node)==null?void 0:i.tagName)==="img"?b.jsx(b.Fragment,{children:e}):b.jsx("p",{className:t,...r,children:e})},(e,t)=>$e(e,t));k3.displayName="MarkdownParagraph";var DL={ol:rc,li:t3,ul:n3,hr:r3,strong:i3,a:a3,h1:s3,h2:o3,h3:u3,h4:l3,h5:c3,h6:h3,table:d3,thead:f3,tbody:m3,tr:p3,th:g3,td:b3,blockquote:y3,code:v3,img:A3,pre:({children:e})=>e,sup:x3,sub:T3,p:k3,section:E3},Uf=[],jf={allowDangerousHtml:!0},Ha=new WeakMap,ML=class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let c="default";return this.keyCache.set(e,c),c}let a=c=>{if(!c||c.length===0)return"";let h="";for(let d=0;d<c.length;d+=1){let m=c[d];if(d>0&&(h+=","),Array.isArray(m)){let[y,T]=m;if(typeof y=="function"){let w=Ha.get(y);w||(w=y.name,Ha.set(y,w)),h+=w}else h+=String(y);h+=":",h+=JSON.stringify(T)}else if(typeof m=="function"){let y=Ha.get(m);y||(y=m.name,Ha.set(m,y)),h+=y}else h+=String(m)}return h},s=a(n),o=a(r),u=i?JSON.stringify(i):"",l=`${o}::${s}::${u}`;return this.keyCache.set(e,l),l}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;r&&this.cache.delete(r)}this.cache.set(n,t)}clear(){this.cache.clear()}},Vf=new ML,w3=e=>{let t=RL(e),n=e.children||"";return PL(t.runSync(t.parse(n),n),e)},RL=e=>{let t=Vf.get(e);if(t)return t;let n=LL(e);return Vf.set(e,n),n},LL=e=>{let t=e.rehypePlugins||Uf,n=e.remarkPlugins||Uf,r=e.remarkRehypeOptions?{...jf,...e.remarkRehypeOptions}:jf;return SR().use(wM).use(n).use(oR,r).use(t)},PL=(e,t)=>RD(e,{Fragment:b.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:b.jsx,jsxs:b.jsxs,passKeys:!0,passNode:!0}),OL=/\[\^[^\]\s]{1,200}\](?!:)/,FL=/\[\^[^\]\s]{1,200}\]:/,BL=/<\/(\w+)>/,zL=/<(\w+)[\s>]/,lu=e=>{let t=0;for(;t<e.length&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
383
383
|
`||e[t]==="\r");)t+=1;return t+1<e.length&&e[t]==="$"&&e[t+1]==="$"},HL=e=>{let t=e.length-1;for(;t>=0&&(e[t]===" "||e[t]===" "||e[t]===`
|
|
384
384
|
`||e[t]==="\r");)t-=1;return t>=1&&e[t]==="$"&&e[t-1]==="$"},cu=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},UL=e=>{let t=OL.test(e),n=FL.test(e);if(t||n)return[e];let r=Ot.lex(e,{gfm:!0}),i=[],a=[];for(let s of r){let o=s.raw,u=i.length;if(a.length>0){if(i[u-1]+=o,s.type==="html"){let l=o.match(BL);if(l){let c=l[1];a.at(-1)===c&&a.pop()}}continue}if(s.type==="html"&&s.block){let l=o.match(zL);if(l){let c=l[1];o.includes(`</${c}>`)||a.push(c)}}if(o.trim()==="$$"&&u>0){let l=i[u-1],c=lu(l),h=cu(l);if(c&&h%2===1){i[u-1]=l+o;continue}}if(u>0&&HL(o)){let l=i[u-1],c=lu(l),h=cu(l),d=cu(o);if(c&&h%2===1&&!lu(o)&&d===1){i[u-1]=l+o;continue}}i.push(o)}return i},jL={raw:Uw,katex:[nl,{errorColor:"var(--color-muted-foreground)"}],sanitize:[Qw,{}],harden:[JT,{allowedImagePrefixes:["*"],allowedLinkPrefixes:["*"],allowedProtocols:["*"],defaultOrigin:void 0,allowDataImages:!0}]},VL={gfm:[n_,{}],math:[hl,{singleDollarTextMath:!1}],cjkFriendly:[kS,{}],cjkFriendlyGfmStrikethrough:[SS,{}]},qL=Object.values(jL),$L=Object.values(VL),YL={shikiTheme:["github-light","github-dark"],controls:!0,isAnimating:!1,mode:"streaming",mermaid:void 0},Kt=k.createContext(YL),S3=k.memo(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=k.useMemo(()=>typeof e=="string"&&t?Q_(e.trim()):e,[e,t]);return b.jsx(w3,{...n,children:r})},(e,t)=>{if(e.content!==t.content||e.shouldParseIncompleteMarkdown!==t.shouldParseIncompleteMarkdown||e.index!==t.index)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(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)});S3.displayName="Block";var GL=["github-light","github-dark"],ic=k.memo(({children:e,mode:t="streaming",parseIncompleteMarkdown:n=!0,components:r,rehypePlugins:i=qL,remarkPlugins:a=$L,className:s,shikiTheme:o=GL,mermaid:u,controls:l=!0,isAnimating:c=!1,BlockComponent:h=S3,parseMarkdownIntoBlocksFn:d=UL,...m})=>{let y=k.useId(),[T,w]=k.useTransition(),[A,E]=k.useState([]),S=k.useMemo(()=>d(typeof e=="string"?e:""),[e,d]);k.useEffect(()=>{t==="streaming"?w(()=>{E(S)}):E(S)},[S,t]);let O=t==="streaming"?A:S,P=k.useMemo(()=>O.map((q,Y)=>`${y}-${Y}`),[O.length,y]),D=k.useMemo(()=>({shikiTheme:o,controls:l,isAnimating:c,mode:t,mermaid:u}),[o,l,c,t,u]),U=k.useMemo(()=>({...DL,...r}),[r]);return k.useEffect(()=>{if(!(Array.isArray(i)&&i.some(V=>Array.isArray(V)?V[0]===nl:V===nl)))return;let q=!1;if(Array.isArray(a)){let V=a.find(ue=>Array.isArray(ue)?ue[0]===hl:ue===hl);V&&Array.isArray(V)&&V[1]&&(q=V[1].singleDollarTextMath===!0)}let Y=typeof e=="string"?e:"",B=Y.includes("$$"),G=q&&(/[^$]\$[^$]/.test(Y)||/^\$[^$]/.test(Y)||/[^$]\$$/.test(Y));(B||G)&&Ss(()=>Promise.resolve({}),__vite__mapDeps([7]))},[i,a,e]),t==="static"?b.jsx(Kt.Provider,{value:D,children:b.jsx("div",{className:Ee("space-y-4 whitespace-normal",s),children:b.jsx(w3,{components:U,rehypePlugins:i,remarkPlugins:a,...m,children:e})})}):b.jsx(Kt.Provider,{value:D,children:b.jsx("div",{className:Ee("space-y-4 whitespace-normal",s),children:O.map((q,Y)=>b.jsx(h,{components:U,content:q,index:Y,rehypePlugins:i,remarkPlugins:a,shouldParseIncompleteMarkdown:n,...m},P[Y]))})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.mode===t.mode);ic.displayName="Streamdown";var WL=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:s=1,fullscreen:o=!1})=>{let u=k.useRef(null),l=k.useRef(null),[c,h]=k.useState(s),[d,m]=k.useState({x:0,y:0}),[y,T]=k.useState(!1),[w,A]=k.useState({x:0,y:0}),[E,S]=k.useState({x:0,y:0}),O=k.useCallback(V=>{h(ue=>Math.max(n,Math.min(r,ue+V)))},[n,r]),P=k.useCallback(()=>{O(i)},[O,i]),D=k.useCallback(()=>{O(-i)},[O,i]),U=k.useCallback(()=>{h(s),m({x:0,y:0})},[s]),q=k.useCallback(V=>{V.preventDefault();let ue=V.deltaY>0?-i:i;O(ue)},[O,i]),Y=k.useCallback(V=>{if(V.button!==0||V.isPrimary===!1)return;T(!0),A({x:V.clientX,y:V.clientY}),S(d);let ue=V.currentTarget;ue instanceof HTMLElement&&ue.setPointerCapture(V.pointerId)},[d]),B=k.useCallback(V=>{if(!y)return;V.preventDefault();let ue=V.clientX-w.x,ie=V.clientY-w.y;m({x:E.x+ue,y:E.y+ie})},[y,w,E]),G=k.useCallback(V=>{T(!1);let ue=V.currentTarget;ue instanceof HTMLElement&&ue.releasePointerCapture(V.pointerId)},[]);return k.useEffect(()=>{let V=u.current;if(V)return V.addEventListener("wheel",q,{passive:!1}),()=>{V.removeEventListener("wheel",q)}},[q]),k.useEffect(()=>{let V=l.current;if(V&&y)return document.body.style.userSelect="none",V.addEventListener("pointermove",B,{passive:!1}),V.addEventListener("pointerup",G),V.addEventListener("pointercancel",G),()=>{document.body.style.userSelect="",V.removeEventListener("pointermove",B),V.removeEventListener("pointerup",G),V.removeEventListener("pointercancel",G)}},[y,B,G]),b.jsxs("div",{className:Ee("relative",o?"h-full w-full":"w-full",t),ref:u,style:{cursor:y?"grabbing":"grab"},children:[a&&b.jsxs("div",{className:Ee("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/90 p-1 shadow-sm backdrop-blur-sm",o?"bottom-4 left-4":"bottom-2 left-2"),children:[b.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c>=r,onClick:P,title:"Zoom in",type:"button",children:b.jsx(pD,{size:16})}),b.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",disabled:c<=n,onClick:D,title:"Zoom out",type:"button",children:b.jsx(bD,{size:16})}),b.jsx("button",{className:"flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",onClick:U,title:"Reset zoom and pan",type:"button",children:b.jsx(hD,{size:16})})]}),b.jsx("div",{className:Ee("origin-center transition-transform duration-150 ease-out",o&&"flex w-full items-center justify-center"),onPointerDown:Y,ref:l,role:"application",style:{transform:`translate(${d.x}px, ${d.y}px) scale(${c})`,transformOrigin:"center center",touchAction:"none",willChange:"transform"},children:e})]})},C3=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let[a,s]=k.useState(null),[o,u]=k.useState(!0),[l,c]=k.useState(""),[h,d]=k.useState(""),[m,y]=k.useState(0),{mermaid:T}=k.useContext(Kt),w=T?.errorComponent;if(k.useEffect(()=>{(async()=>{try{s(null),u(!0);let E=await Zg(n),S=e.split("").reduce((D,U)=>(D<<5)-D+U.charCodeAt(0)|0,0),O=`mermaid-${Math.abs(S)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:P}=await E.render(O,e);c(P),d(P)}catch(E){if(!(h||l)){let S=E instanceof Error?E.message:"Failed to render Mermaid chart";s(S)}}finally{u(!1)}})()},[e,n,m]),o&&!l&&!h)return b.jsx("div",{className:Ee("my-4 flex justify-center p-4",t),children:b.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[b.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-current border-b-2"}),b.jsx("span",{className:"text-sm",children:"Loading diagram..."})]})});if(a&&!l&&!h){let E=()=>y(S=>S+1);return w?b.jsx(w,{chart:e,error:a,retry:E}):b.jsxs("div",{className:Ee("rounded-lg border border-red-200 bg-red-50 p-4",t),children:[b.jsxs("p",{className:"font-mono text-red-700 text-sm",children:["Mermaid Error: ",a]}),b.jsxs("details",{className:"mt-2",children:[b.jsx("summary",{className:"cursor-pointer text-red-600 text-xs",children:"Show Code"}),b.jsx("pre",{className:"mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs",children:e})]})]})}let A=l||h;return b.jsx(WL,{className:Ee(r?"h-full w-full overflow-hidden":"my-4 overflow-hidden",t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:b.jsx("div",{"aria-label":"Mermaid chart",className:Ee("flex justify-center",r&&"h-full w-full items-center"),dangerouslySetInnerHTML:{__html:A},role:"img"})})};const qf=({className:e,from:t,...n})=>b.jsx("div",{className:ge("group flex w-full max-w-[95%] flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",e),...n}),$f=({children:e,className:t,...n})=>b.jsx("div",{className:ge("is-user:dark flex w-fit max-w-full min-w-0 flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",t),...n,children:e}),N3=k.createContext(null),XL=()=>{const e=k.useContext(N3);if(!e)throw new Error("MessageBranch components must be used within MessageBranch");return e},Yf=({defaultBranch:e=0,onBranchChange:t,className:n,...r})=>{const[i,a]=k.useState(e),[s,o]=k.useState([]),u=d=>{a(d),t?.(d)},l=()=>{const d=i>0?i-1:s.length-1;u(d)},c=()=>{const d=i<s.length-1?i+1:0;u(d)},h={currentBranch:i,totalBranches:s.length,goToPrevious:l,goToNext:c,branches:s,setBranches:o};return b.jsx(N3.Provider,{value:h,children:b.jsx("div",{className:ge("grid w-full gap-2 [&>div]:pb-0",n),...r})})},Gf=({children:e,...t})=>{const{currentBranch:n,setBranches:r,branches:i}=XL(),a=Array.isArray(e)?e:[e];return k.useEffect(()=>{i.length!==a.length&&r(a)},[a,i,r]),a.map((s,o)=>b.jsx("div",{className:ge("grid gap-2 overflow-hidden [&>div]:pb-0",o===n?"block":"hidden"),...t,children:s},s.key))},I3=k.memo(({className:e,...t})=>b.jsx(ic,{className:ge("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);I3.displayName="MessageResponse";const KL="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let QL=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=KL[n[e]&63];return t};const ZL=k.createContext(null),JL=k.createContext(null),_3=()=>k.useContext(ZL),eP=()=>k.useContext(JL),D3=k.createContext(null),tP=()=>{const e=eP(),t=k.useContext(D3),n=e??t;if(!n)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return n},nP=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:i,maxFiles:a,maxFileSize:s,onError:o,onSubmit:u,children:l,...c})=>{const h=_3(),d=!!h,m=k.useRef(null),y=k.useRef(null),[T,w]=k.useState([]),A=d?h.attachments.files:T,E=k.useRef(A);E.current=A;const S=k.useCallback(()=>{m.current?.click()},[]),O=k.useCallback(ne=>!t||t.trim()===""?!0:t.split(",").map(de=>de.trim()).filter(Boolean).some(de=>{if(de.endsWith("/*")){const _=de.slice(0,-1);return ne.type.startsWith(_)}return ne.type===de}),[t]),P=k.useCallback(ne=>{const he=Array.from(ne),de=he.filter(ce=>O(ce));if(he.length&&de.length===0){o?.({code:"accept",message:"No files match the accepted types."});return}const _=ce=>s?ce.size<=s:!0,be=de.filter(_);if(de.length>0&&be.length===0){o?.({code:"max_file_size",message:"All files exceed the maximum size."});return}w(ce=>{const L=typeof a=="number"?Math.max(0,a-ce.length):void 0,nt=typeof L=="number"?be.slice(0,L):be;typeof L=="number"&&be.length>L&&o?.({code:"max_files",message:"Too many files. Some were not added."});const rt=[];for(const Fe of nt)rt.push({id:QL(),type:"file",url:URL.createObjectURL(Fe),mediaType:Fe.type,filename:Fe.name});return ce.concat(rt)})},[O,a,s,o]),D=k.useCallback(ne=>w(he=>{const de=he.find(_=>_.id===ne);return de?.url&&URL.revokeObjectURL(de.url),he.filter(_=>_.id!==ne)}),[]),U=k.useCallback(()=>w(ne=>{for(const he of ne)he.url&&URL.revokeObjectURL(he.url);return[]}),[]),q=d?h.attachments.add:P,Y=d?h.attachments.remove:D,B=d?h.attachments.clear:U,G=d?h.attachments.openFileDialog:S;k.useEffect(()=>{d&&h.__registerFileInput(m,()=>m.current?.click())},[d,h]),k.useEffect(()=>{i&&m.current&&A.length===0&&(m.current.value="")},[A,i]),k.useEffect(()=>{const ne=y.current;if(!ne||r)return;const he=_=>{_.dataTransfer?.types?.includes("Files")&&_.preventDefault()},de=_=>{_.dataTransfer?.types?.includes("Files")&&_.preventDefault(),_.dataTransfer?.files&&_.dataTransfer.files.length>0&&q(_.dataTransfer.files)};return ne.addEventListener("dragover",he),ne.addEventListener("drop",de),()=>{ne.removeEventListener("dragover",he),ne.removeEventListener("drop",de)}},[q,r]),k.useEffect(()=>{if(!r)return;const ne=de=>{de.dataTransfer?.types?.includes("Files")&&de.preventDefault()},he=de=>{de.dataTransfer?.types?.includes("Files")&&de.preventDefault(),de.dataTransfer?.files&&de.dataTransfer.files.length>0&&q(de.dataTransfer.files)};return document.addEventListener("dragover",ne),document.addEventListener("drop",he),()=>{document.removeEventListener("dragover",ne),document.removeEventListener("drop",he)}},[q,r]),k.useEffect(()=>()=>{if(!d)for(const ne of E.current)ne.url&&URL.revokeObjectURL(ne.url)},[d]);const V=ne=>{ne.currentTarget.files&&q(ne.currentTarget.files),ne.currentTarget.value=""},ue=async ne=>{try{const de=await(await fetch(ne)).blob();return new Promise(_=>{const be=new FileReader;be.onloadend=()=>_(be.result),be.onerror=()=>_(null),be.readAsDataURL(de)})}catch{return null}},ie=k.useMemo(()=>({files:A.map(ne=>({...ne,id:ne.id})),add:q,remove:Y,clear:B,openFileDialog:G,fileInputRef:m}),[A,q,Y,B,G]),ee=ne=>{ne.preventDefault();const he=ne.currentTarget,de=d?h.textInput.value:new FormData(he).get("message")||"";d||he.reset(),Promise.all(A.map(async({id:_,...be})=>{if(be.url?.startsWith("blob:")){const ce=await ue(be.url);return{...be,url:ce??be.url}}return be})).then(_=>{try{const be=u({text:de,files:_},ne);be instanceof Promise?be.then(()=>{B(),d&&h.textInput.clear()}).catch(()=>{}):(B(),d&&h.textInput.clear())}catch{}}).catch(()=>{})},ye=b.jsxs(b.Fragment,{children:[b.jsx("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:n,onChange:V,ref:m,title:"Upload files",type:"file"}),b.jsx("form",{className:ge("w-full",e),onSubmit:ee,ref:y,...c,children:b.jsx(A6,{className:"overflow-hidden",children:l})})]});return d?ye:b.jsx(D3.Provider,{value:ie,children:ye})},rP=({className:e,...t})=>b.jsx("div",{className:ge("contents",e),...t}),iP=({onChange:e,className:t,placeholder:n="What would you like to know?",...r})=>{const i=_3(),a=tP(),[s,o]=k.useState(!1),u=h=>{if(h.key==="Enter"){if(s||h.nativeEvent.isComposing||h.shiftKey)return;h.preventDefault();const d=h.currentTarget.form;if(d?.querySelector('button[type="submit"]')?.disabled)return;d?.requestSubmit()}if(h.key==="Backspace"&&h.currentTarget.value===""&&a.files.length>0){h.preventDefault();const d=a.files.at(-1);d&&a.remove(d.id)}},l=h=>{const d=h.clipboardData?.items;if(!d)return;const m=[];for(const y of d)if(y.kind==="file"){const T=y.getAsFile();T&&m.push(T)}m.length>0&&(h.preventDefault(),a.add(m))},c=i?{value:i.textInput.value,onChange:h=>{i.textInput.setInput(h.currentTarget.value),e?.(h)}}:{onChange:e};return b.jsx(k6,{className:ge("field-sizing-content max-h-48 min-h-16",t),name:"message",onCompositionEnd:()=>o(!1),onCompositionStart:()=>o(!0),onKeyDown:u,onPaste:l,placeholder:n,...r,...c})},aP=({className:e,...t})=>b.jsx(w6,{align:"block-end",className:ge("justify-between justify-end gap-1",e),...t}),sP=({className:e,variant:t="default",size:n="icon-sm",status:r,children:i,...a})=>{let s=b.jsx(P6,{className:"size-4"});return r==="submitted"?s=b.jsx(X5,{className:"size-4 animate-spin"}):r==="streaming"?s=b.jsx(J5,{className:"size-4"}):r==="error"&&(s=b.jsx(C6,{className:"size-4"})),b.jsx(S6,{"aria-label":"Submit",className:ge(e),size:n,type:"submit",variant:t,...a,children:i??s})};function oP({...e}){return b.jsx(V6,{"data-slot":"collapsible",...e})}function uP({...e}){return b.jsx(p1,{"data-slot":"collapsible-trigger",...e})}function lP({...e}){return b.jsx(g1,{"data-slot":"collapsible-content",...e})}const cP=({children:e,as:t="p",className:n,duration:r=2,spread:i=2})=>{const a=Cp.create(t),s=k.useMemo(()=>(e?.length??0)*i,[e,i]);return b.jsx(a,{animate:{backgroundPosition:"0% center"},className:ge("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",n),initial:{backgroundPosition:"100% center"},style:{"--spread":`${s}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"linear"},children:e})},hP=k.memo(cP),M3=k.createContext(null),dP=()=>{const e=k.useContext(M3);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},fP=1e3,mP=1e3,R3=k.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:s,...o})=>{const[u,l]=du({prop:n,defaultProp:r,onChange:i}),[c,h]=du({prop:a,defaultProp:void 0}),[d,m]=k.useState(!1),[y,T]=k.useState(null);k.useEffect(()=>{t?y===null&&T(Date.now()):y!==null&&(h(Math.ceil((Date.now()-y)/mP)),T(null))},[t,y,h]),k.useEffect(()=>{if(r&&!t&&u&&!d){const A=setTimeout(()=>{l(!1),m(!0)},fP);return()=>clearTimeout(A)}},[t,u,r,l,d]);const w=A=>{l(A)};return b.jsx(M3.Provider,{value:{isStreaming:t,isOpen:u,setIsOpen:l,duration:c},children:b.jsx(oP,{className:ge("not-prose mb-4",e),onOpenChange:w,open:u,...o,children:s})})}),pP=(e,t)=>e||t===0?b.jsx(hP,{duration:1,children:"Thinking..."}):t===void 0?b.jsx("p",{children:"Thought for a few seconds"}):b.jsxs("p",{children:["Thought for ",t," seconds"]}),L3=k.memo(({className:e,children:t,getThinkingMessage:n=pP,...r})=>{const{isStreaming:i,isOpen:a,duration:s}=dP();return b.jsx(uP,{className:ge("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??b.jsxs(b.Fragment,{children:[b.jsx(q5,{className:"size-4"}),n(i,s),b.jsx(e1,{className:ge("size-4 transition-transform",a?"rotate-180":"rotate-0")})]})})}),P3=k.memo(({className:e,children:t,...n})=>b.jsx(lP,{className:ge("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:b.jsx(ic,{...n,children:t})}));R3.displayName="Reasoning";L3.displayName="ReasoningTrigger";P3.displayName="ReasoningContent";const gP=({className:e,children:t,...n})=>b.jsxs(c1,{className:"w-full overflow-x-auto whitespace-nowrap",...n,children:[b.jsx("div",{className:ge("flex w-max flex-nowrap items-center gap-2",e),children:t}),b.jsx(O6,{className:"hidden",orientation:"horizontal"})]}),bP=({suggestion:e,onClick:t,className:n,variant:r="outline",size:i="sm",children:a,...s})=>{const o=()=>{t?.(e)};return b.jsx(Ge,{className:ge("cursor-pointer rounded-full px-4",n),onClick:o,size:i,type:"button",variant:r,...s,children:a||e})},yP=()=>{const{data:e,isLoading:t,error:n,refetch:r}=Cs({queryKey:["rate-limit"],queryFn:async()=>{const i=await fetch(`${ra.PROXY_URL}/chat/limit`);if(!i.ok)throw new Error("Failed to fetch rate limit");const a=await i.json();return console.log("useRateLimit data:",a),a}});return{rateLimit:e,isLoadingRateLimit:t,errorRateLimit:n,refetchRateLimit:r}},xP=()=>{const{rateLimit:e,refetchRateLimit:t}=yP(),[n,r]=k.useState(""),{isSheetOpen:i,closeSheet:a,openSheet:s}=t1(),{messages:o,sendMessage:u,isLoading:l,clear:c,stop:h}=Wb({connection:Gb(`${ra.BASE_URL}/chat`),onError:S=>console.error("Error:",S.message),onResponse:S=>console.log("Response:",S),onFinish:S=>{console.log("Finish:",S),t()}}),d=S=>{const O=!!S.text,P=!!S.files?.length;!(O||P)||l||(u(S.text),r(""))},m=()=>{c(),r("")},y=S=>{u(S),r("")},T=()=>{h(),r("")},w=l?"streaming":"ready",E=((S,O)=>S?"bg-blue-500":e?O===0?"bg-red-500":O<=5?"bg-yellow-500":"bg-emerald-500":"bg-zinc-500")(l,e?.remaining??0);return b.jsxs(b.Fragment,{children:[b.jsxs(Qa,{children:[b.jsx(Za,{asChild:!0,children:b.jsxs(Ge,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-zinc-800 rounded-none h-full w-12 relative",onClick:()=>s("ai-assistant"),children:[b.jsx(mb,{className:"size-5"}),b.jsx("span",{className:ge("absolute top-2 right-2 h-2 w-2 rounded-full ring-2 ring-background",l?"animate-pulse":"",E)})]})}),b.jsx(Ja,{side:"bottom",className:"text-xs",children:l?b.jsx("p",{children:"Generating response..."}):e?b.jsxs("p",{children:[e.remaining,"/",e.limit," messages remaining"]}):b.jsx("p",{children:"AI Assistant"})})]}),b.jsx(N6,{title:"AI Assistant",cta:b.jsxs("div",{className:"flex items-center gap-2",children:[e&&b.jsxs(Qa,{children:[b.jsx(Za,{asChild:!0,children:b.jsxs("span",{className:"text-xs px-2 py-1 cursor-default text-muted-foreground",children:[e.remaining,"/",e.limit]})}),b.jsx(Ja,{side:"bottom",children:b.jsxs("p",{children:[e.remaining," messages remaining"]})})]}),b.jsxs(Ge,{type:"button",variant:"outline",size:"lg",onClick:m,disabled:l,children:[b.jsx(Q5,{className:"h-4 w-4 mr-1"}),"New Chat"]})]}),closeButton:!1,open:i("ai-assistant"),size:"max-w-2xl!",contentClassName:"p-0 flex flex-col h-[calc(100vh-4rem)] flex-1",onOpenChange:S=>{S||a("ai-assistant")},children:b.jsxs("div",{className:"relative flex size-full flex-col divide-y overflow-hidden",children:[b.jsxs(t7,{children:[b.jsx(n7,{children:o.length===0?b.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:b.jsxs("div",{className:"text-center space-y-2",children:[b.jsx("p",{className:"text-lg font-medium",children:"Start a new conversation"}),b.jsx("p",{className:"text-sm",children:"Ask me anything to get started"})]})}):b.jsxs(b.Fragment,{children:[o.map(S=>{const O=S.parts.filter(U=>U.type==="thinking"),P=S.parts.filter(U=>U.type==="text").map(U=>U.content).join(""),D=O.length>0;return b.jsx(Yf,{defaultBranch:0,children:b.jsx(Gf,{children:b.jsx(qf,{from:S.role==="user"?"user":"assistant",children:b.jsxs("div",{children:[D&&S.role==="assistant"&&b.jsxs(R3,{duration:0,children:[b.jsx(L3,{}),b.jsx(P3,{children:O.map(U=>U.content).join(`
|
|
385
385
|
`)})]}),b.jsx($f,{children:b.jsx(I3,{children:P})})]})})})},S.id)}),l&&b.jsx(Yf,{defaultBranch:0,children:b.jsx(Gf,{children:b.jsx(qf,{from:"assistant",children:b.jsx($f,{children:b.jsx(YT,{children:"Thinking..."})})})})})]})}),b.jsx(r7,{})]}),b.jsxs("div",{className:"grid shrink-0 gap-4 pt-3",children:[o.length===0&&b.jsx(gP,{className:"px-4",children:Ab.map(S=>b.jsx(bP,{onClick:()=>y(S),suggestion:S,size:"lg",children:S},S))}),b.jsx("div",{className:"w-full px-4 pb-4",children:b.jsxs(nP,{globalDrop:!0,multiple:!0,onSubmit:d,children:[b.jsx(rP,{children:b.jsx(iP,{onChange:S=>r(S.target.value),value:n,placeholder:"Type a message..."})}),b.jsx(aP,{children:b.jsx(sP,{className:"h-8!",status:w,onClick:l?T:void 0,disabled:e&&e.remaining===0})})]})})]})]})})]})},TP=()=>{const{pathname:e}=d1(),t=e.split("/")[1]||"table";return b.jsx("div",{className:"flex h-full items-center",children:I6.map(n=>b.jsx(n1,{to:`/${n}`,className:"h-full flex items-center",children:b.jsx(Ge,{variant:"ghost",className:ge("flex-1 px-4 border-l-0 border-y-0 border-r border-zinc-800 h-full rounded-none",t===n?"bg-zinc-900 text-white":"text-zinc-400"),children:n})},n))})},EP=()=>{const{sidebar:{isOpen:e,isPinned:t},setSidebarOpen:n,setSidebarPinned:r}=Ns(),i=()=>{n(!e),r(!t)};return b.jsx(Ge,{variant:"ghost",onClick:i,className:"h-full aspect-square border-l-0 border-y-0 border-r border-zinc-800 rounded-none",children:e?b.jsx(yb,{className:"size-5"}):b.jsx(ub,{className:"size-5"})})},vP=()=>b.jsxs("div",{className:"border-b border-zinc-800 w-full flex items-center justify-between bg-black h-12",children:[b.jsxs("div",{className:"flex items-center h-full",children:[b.jsx(EP,{}),b.jsx(TP,{})]}),b.jsxs("div",{className:"flex items-center h-full",children:[b.jsx(xP,{}),b.jsxs(Qa,{children:[b.jsx(Za,{asChild:!0,children:b.jsx(Ge,{variant:"ghost",className:"border-r-0 border-y-0 border-l border-zinc-800 rounded-none h-full w-12",asChild:!0,children:b.jsx("a",{href:kb.SITE_GITHUB_LINK,target:"_blank",rel:"noopener noreferrer",children:b.jsx(tb,{className:"size-5"})})})}),b.jsx(Ja,{children:b.jsx("p",{children:"View on GitHub"})})]})]})]});function AP({...e}){return b.jsx(e5,{"data-slot":"alert-dialog",...e})}function kP({...e}){return b.jsx(t5,{"data-slot":"alert-dialog-portal",...e})}function wP({className:e,...t}){return b.jsx(n5,{"data-slot":"alert-dialog-overlay",className:ge("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",e),...t})}function SP({className:e,size:t="default",...n}){return b.jsxs(kP,{children:[b.jsx(wP,{}),b.jsx(r5,{"data-slot":"alert-dialog-content","data-size":t,className:ge("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function CP({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-header",className:ge("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function NP({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-footer",className:ge("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function IP({className:e,...t}){return b.jsx(s5,{"data-slot":"alert-dialog-title",className:ge("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function _P({className:e,...t}){return b.jsx(o5,{"data-slot":"alert-dialog-description",className:ge("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function DP({className:e,variant:t="default",size:n="default",...r}){return b.jsx(Ge,{variant:t,size:n,asChild:!0,children:b.jsx(i5,{"data-slot":"alert-dialog-action",className:ge(e),...r})})}function MP({className:e,variant:t="outline",size:n="default",...r}){return b.jsx(Ge,{variant:t,size:n,asChild:!0,children:b.jsx(a5,{"data-slot":"alert-dialog-cancel",className:ge(e),...r})})}function O3({...e}){return b.jsx(D5,{"data-slot":"context-menu",...e})}function F3({className:e,...t}){return b.jsx(M5,{"data-slot":"context-menu-trigger",className:ge("select-none",e),...t})}function B3({className:e,...t}){return b.jsx(R5,{children:b.jsx(L5,{"data-slot":"context-menu-content",className:ge("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto",e),...t})})}function zn({className:e,inset:t,variant:n="default",...r}){return b.jsx(P5,{"data-slot":"context-menu-item","data-inset":t,"data-variant":n,className:ge("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function Wf({className:e,...t}){return b.jsx(O5,{"data-slot":"context-menu-separator",className:ge("bg-border/50 -mx-1 my-1 h-px",e),...t})}const hu=({folderId:e,isExpanded:t,onToggle:n,count:r,name:i,showContextMenu:a=!1})=>{const s=Is(),{deleteFolder:o,getQueriesByFolder:u,addQuery:l,updateFolder:c}=_s(),[h,d]=k.useState(!1),[m,y]=k.useState(""),[T,w]=k.useState(!1),A=k.useCallback(()=>{if(e){if(u(e).length>0){w(!0);return}o(e)}},[o,e,u]),E=k.useCallback(()=>{e&&(o(e),w(!1))},[o,e]),S=k.useCallback(()=>{const D=l(void 0,e);s({to:"/runner/$queryId",params:{queryId:D}})},[l,e,s]),O=k.useCallback(()=>{y(i),d(!0)},[i]),P=k.useCallback(()=>{e&&m.trim()&&(c(e,{name:m.trim()}),d(!1),y(""))},[e,m,c]);return b.jsxs(b.Fragment,{children:[a?b.jsxs(O3,{children:[b.jsx(F3,{asChild:!0,children:b.jsxs("button",{type:"button",onClick:n,className:ge("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-zinc-800/50 hover:text-zinc-100 focus:outline-none focus:bg-zinc-800/50","text-zinc-400 items-center"),children:[b.jsx(oc,{className:ge("size-4 transition-transform duration-200",t?"rotate-90":"")}),b.jsx("span",{className:"flex-1",children:i}),b.jsx(Vi,{children:r})]})}),b.jsxs(B3,{children:[b.jsxs(zn,{onClick:S,children:[b.jsx(Cl,{className:"size-4"}),"Add a new query"]}),b.jsxs(zn,{onClick:O,children:[b.jsx(H1,{className:"size-4"}),"Rename folder"]}),b.jsxs(zn,{onClick:A,children:[b.jsx(h1,{className:"size-4"}),"Delete folder"]})]})]}):b.jsxs("button",{type:"button",onClick:n,className:ge("w-full flex gap-2 px-4 py-2 text-sm transition-colors text-left","hover:bg-zinc-800/50 hover:text-zinc-100 focus:outline-none focus:bg-zinc-800/50","text-zinc-400 items-center"),children:[b.jsx(oc,{className:ge("size-4 transition-transform duration-200",t?"rotate-90":"")}),b.jsx("span",{className:"flex-1",children:i}),b.jsx(Vi,{children:r})]}),b.jsx(fu,{open:h,onOpenChange:d,children:b.jsxs(mu,{children:[b.jsxs(pu,{children:[b.jsx(gu,{children:"Rename Folder"}),b.jsx(bu,{children:"Enter a new name for this folder."})]}),b.jsx(ji,{value:m,onChange:D=>y(D.target.value),placeholder:"Folder name",onKeyDown:D=>{D.key==="Enter"&&P()},autoFocus:!0}),b.jsxs(yu,{children:[b.jsx(Ge,{variant:"outline",onClick:()=>{d(!1),y("")},children:"Cancel"}),b.jsx(Ge,{onClick:P,disabled:!m.trim(),children:"Rename"})]})]})}),b.jsx(AP,{open:T,onOpenChange:w,children:b.jsxs(SP,{children:[b.jsxs(CP,{children:[b.jsx(IP,{children:"Delete Folder"}),b.jsxs(_P,{children:["This folder contains ",r," ",r===1?"query":"queries",". Deleting this folder will also delete all queries inside it. This action cannot be undone."]})]}),b.jsxs(NP,{children:[b.jsx(MP,{children:"Cancel"}),b.jsx(DP,{onClick:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Folder"})]})]})})]})},Ua=({id:e,tableName:t,isNested:n=!1,showContextMenu:r=!0})=>{const i=Is(),{deleteQuery:a,addQuery:s,getQuery:o,toggleFavorite:u,updateQuery:l,moveQuery:c,folders:h,addFolder:d}=_s(),{queryId:m}=r1({strict:!1}),y=m===e,T=o(e),w=T?.isFavorite??!1,[A,E]=k.useState(!1),[S,O]=k.useState(""),[P,D]=k.useState(!1),[U,q]=k.useState(void 0),[Y,B]=k.useState(!1),[G,V]=k.useState(""),ue=k.useCallback(()=>{i({to:"/runner/$queryId",params:{queryId:e}})},[i,e]),ie=k.useCallback(()=>{a(e),m===e&&i({to:"/runner"}),or.success("Query deleted successfully")},[a,e,i,m]),ee=k.useCallback(()=>{const ce=o(e),L=s(`${ce?.name} (Copy)`);i({to:"/runner/$queryId",params:{queryId:L}}),or.success("Query duplicated successfully")},[s,o,i,e]),ye=k.useCallback(()=>{u(e),or.success("Query favorited successfully")},[u,e]),ne=k.useCallback(()=>{O(T?.name??""),E(!0)},[T?.name]),he=k.useCallback(()=>{S.trim()&&(l(e,{name:S.trim()}),E(!1),O(""),or.success("Query renamed successfully"))},[e,S,l]),de=k.useCallback(()=>{q(T?.folderId),B(!1),V(""),D(!0)},[T?.folderId]),_=k.useCallback(ce=>{ce==="__create_new__"?(B(!0),q(void 0)):(B(!1),q(ce==="__none__"?void 0:ce))},[]),be=k.useCallback(()=>{if(Y&&G.trim()){const ce=Math.random().toString(36).substring(2,15);d({id:ce,name:G.trim(),isExpanded:!0,isFavorite:!1}),c(e,ce),or.success("Query moved to new folder successfully")}else Y||(c(e,U),or.success("Query moved to selected folder successfully"));D(!1),B(!1),V(""),q(void 0)},[Y,G,U,e,d,c]);return b.jsxs("li",{className:"relative",children:[r?b.jsxs(O3,{children:[b.jsx(F3,{asChild:!0,children:b.jsxs("button",{type:"button",onClick:ue,className:ge("w-full flex gap-2 py-2 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",y?"text-zinc-100 bg-accent/10":"text-zinc-400",n?"px-4 pl-12":"px-4"),children:[y&&b.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),b.jsx("span",{className:"flex-1",children:t})]})}),b.jsxs(B3,{children:[b.jsxs(zn,{onClick:ne,children:[b.jsx(H1,{className:"size-4"}),"Rename query"]}),b.jsxs(zn,{onClick:ee,children:[b.jsx(rb,{className:"size-4"}),"Duplicate query"]}),b.jsxs(zn,{onClick:ye,children:[w?b.jsx(vb,{className:"size-4"}):b.jsx(gb,{className:"size-4"}),w?"Remove from favorites":"Add to favorites"]}),b.jsx(Wf,{}),b.jsxs(zn,{onClick:de,children:[b.jsx(sb,{className:"size-4"}),"Move to folder"]}),b.jsx(Wf,{}),b.jsxs(zn,{onClick:ie,children:[b.jsx(h1,{className:"size-4"}),"Delete query"]})]})]}):b.jsxs("button",{type:"button",onClick:ue,className:ge("w-full flex gap-2 py-2 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",y?"text-zinc-100 bg-accent/10":"text-zinc-400",n?"px-4 pl-12":"px-4"),children:[y&&b.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),b.jsx("span",{className:"flex-1",children:t})]}),b.jsx(fu,{open:A,onOpenChange:E,children:b.jsxs(mu,{children:[b.jsxs(pu,{children:[b.jsx(gu,{children:"Rename Query"}),b.jsx(bu,{children:"Enter a new name for this query."})]}),b.jsx(ji,{value:S,onChange:ce=>O(ce.target.value),placeholder:"Query name",onKeyDown:ce=>{ce.key==="Enter"&&he()},autoFocus:!0}),b.jsxs(yu,{children:[b.jsx(Ge,{variant:"outline",onClick:()=>{E(!1),O("")},children:"Cancel"}),b.jsx(Ge,{onClick:he,disabled:!S.trim(),children:"Rename"})]})]})}),b.jsx(fu,{open:P,onOpenChange:ce=>{D(ce),ce||(B(!1),V(""),q(void 0))},children:b.jsxs(mu,{children:[b.jsxs(pu,{children:[b.jsx(gu,{children:"Move to Folder"}),b.jsx(bu,{children:"Select a folder to move this query to."})]}),b.jsx("div",{className:"space-y-4",children:Y?b.jsx(ji,{value:G,onChange:ce=>V(ce.target.value),placeholder:"Folder name",onKeyDown:ce=>{ce.key==="Enter"&&G.trim()&&be(),ce.key==="Escape"&&(B(!1),V(""))},autoFocus:!0}):b.jsxs(i1,{value:U??"__none__",onValueChange:_,children:[b.jsx(a1,{className:"w-full",children:b.jsx(s1,{placeholder:"Select a folder"})}),b.jsxs(o1,{children:[b.jsx(ja,{value:"__none__",children:"No folder"}),h.map(ce=>b.jsx(ja,{value:ce.id,children:ce.name},ce.id)),b.jsx(ja,{value:"__create_new__",children:b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(z1,{className:"size-4"}),"Create a new folder"]})})]})]})}),b.jsxs(yu,{children:[b.jsx(Ge,{variant:"outline",onClick:()=>{D(!1),B(!1),V(""),q(void 0)},children:"Cancel"}),b.jsx(Ge,{onClick:be,disabled:Y&&!G.trim(),children:Y?"Create & Move":"Move"})]})]})})]})},RP=()=>{const[e]=Ds(on.SIDEBAR_SEARCH,{defaultValue:""}),{folders:t,queries:n,getFavoriteQueries:r,getQueriesByFolder:i,toggleFolder:a}=_s(),[s,o]=k.useState(!0),[u,l]=k.useState(!0),c=n.filter(y=>!y.isFavorite).length,h=r(),d=h.length,m=n.filter(y=>!y.folderId&&!y.isFavorite);if(e){const y=n.filter(T=>T.name.toLowerCase().includes(e.toLowerCase()));return y.length===0?b.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:"No queries found matching"}):b.jsx("div",{className:"flex-1 overflow-y-auto",children:y.map(T=>b.jsx(Ua,{id:T.id,tableName:T.name},T.id))})}return b.jsxs("div",{className:"flex-1 overflow-y-auto",children:[b.jsx(hu,{name:"Favorites",isExpanded:s,onToggle:()=>o(!s),count:d}),s&&h.map(y=>b.jsx(Ua,{id:y.id,tableName:y.name},y.id)),b.jsx(wb,{className:"bg-zinc-800"}),b.jsx(hu,{name:"Queries",isExpanded:u,onToggle:()=>l(!u),count:c}),u&&b.jsxs(b.Fragment,{children:[t.map(y=>{const T=i(y.id),w=T.length;return b.jsxs("div",{children:[b.jsx(hu,{folderId:y.id,name:y.name,isExpanded:y.isExpanded,onToggle:()=>a(y.id),count:w,showContextMenu:!0}),y.isExpanded&&T.map(A=>b.jsx(Ua,{id:A.id,tableName:A.name,isNested:!0,showContextMenu:!0},A.id))]},y.id)}),m.map(y=>b.jsx(Ua,{id:y.id,tableName:y.name,showContextMenu:!0},y.id))]})]})},LP=()=>{const{addQuery:e,addFolder:t}=_s(),n=Is(),r=k.useRef(null),[i,a]=Ds(on.SIDEBAR_SEARCH,{defaultValue:""}),s=l=>{a(l.target.value)},o=()=>{const l=e();n({to:"/runner/$queryId",params:{queryId:l}})},u=()=>{const l=Math.random().toString(36).substring(2,15);t({id:l,name:"New Folder",isExpanded:!0,isFavorite:!1})};return b.jsxs("div",{className:"p-3 space-y-2 border-b border-zinc-800",children:[b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(Ge,{className:"flex-1 justify-start h-8",onClick:o,children:[b.jsx(Cl,{className:"size-4"}),"Add Query"]}),b.jsxs(Ge,{className:"flex-1 justify-start h-8",onClick:u,children:[b.jsx(z1,{className:"size-4"}),"Add Folder"]})]}),b.jsxs("div",{className:"relative",children:[b.jsx(u1,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),b.jsx(ji,{ref:r,placeholder:"Search queries",value:i??"",onChange:s,className:"rounded-sm h-8 pl-8 pr-8"}),b.jsx(Vi,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]})]})},PP=()=>b.jsxs(b.Fragment,{children:[b.jsx(LP,{}),b.jsx(RP,{})]}),OP=({tableName:e,rowCount:t})=>{const r=r1({strict:!1}).table;return b.jsx("li",{className:"relative",children:b.jsxs(n1,{to:"/table/$table",params:{table:e},className:ge("w-full flex gap-0.5 px-4 py-1.5 text-sm transition-colors text-left","hover:text-zinc-100 focus:outline-none focus:bg-accent/10 focus:text-zinc-100 justify-start items-center",r===e?"text-white bg-zinc-800/50":"text-zinc-400"),children:[r===e&&b.jsx("span",{className:"absolute left-0 top-0 bottom-0 w-1 bg-accent"}),b.jsx("span",{className:"flex-1",children:e}),b.jsx(Vi,{children:t})]})})},FP=()=>{const[e]=Ds(on.SIDEBAR_SEARCH,{defaultValue:""}),{tablesList:t=[],isLoadingTablesList:n,errorTablesList:r}=_6(),i=t?.filter(a=>a.tableName.toLowerCase().includes(e.toLowerCase()));return n?b.jsx("div",{className:"flex-1 h-full overflow-y-auto pb-3 flex items-center justify-center",children:b.jsx(z6,{size:"size-6"})}):r?b.jsxs("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:["Error: ",r.message]}):b.jsx("div",{className:"flex-1 overflow-y-auto pb-3",children:i&&i.length>0?b.jsx("ul",{children:i?.map(a=>b.jsx(OP,{tableName:a.tableName,rowCount:a.rowCount},a.tableName))}):e?b.jsx("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables found matching"}):b.jsx("div",{className:"flex-1 overflow-y-auto pb-3 h-full flex items-center justify-center",children:"No tables available"})})},BP=()=>{const e=k.useRef(null),[t,n]=Ds(on.SIDEBAR_SEARCH,{defaultValue:""}),{openSheet:r}=t1();return F6("/",i=>{i.preventDefault(),e.current&&e.current.focus()},{preventDefault:!0}),b.jsxs("div",{className:"p-3 space-y-2",children:[b.jsxs(Ge,{className:"w-full justify-start h-8",onClick:()=>r("add-table"),children:[b.jsx(Cl,{className:"size-4"}),"Add Table"]}),b.jsxs("div",{className:"relative",children:[b.jsx(u1,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),b.jsx(ji,{ref:e,placeholder:"Search tables",value:t??"",onChange:i=>n(i.target.value.trim()),className:"rounded-sm h-8 pl-8 pr-8"}),b.jsx(Vi,{className:"absolute right-2 top-1/2 -translate-y-1/2 text-xs",children:"/"})]})]})},Xf=()=>b.jsxs(b.Fragment,{children:[b.jsx(BP,{}),b.jsx(c1,{className:"flex-1 overflow-y-auto pb-3 block h-full w-full",children:b.jsx(FP,{})})]}),zP=()=>{const{data:e,isLoading:t,error:n,refetch:r,isRefetching:i}=Cs({queryKey:[on.CACHE_KEYS.DATABASES_LIST],queryFn:async()=>{const a=await fetch(`${ra.BASE_URL}/databases`),s=await a.json();if(!a.ok)throw new Error("Failed to fetch databases list");return console.log("useDatabasesList data",s),s},staleTime:3e5});return{databases:e,isLoadingDatabases:t,databasesError:n,refetchDatabases:r,isRefetchingDatabases:i}},HP=()=>{const{selectedDatabase:e,setSelectedDatabase:t}=l1(),{data:n,isLoading:r,error:i}=Cs({queryKey:[on.CACHE_KEYS.CURRENT_DATABASE],queryFn:async()=>{const a=await fetch(`${ra.BASE_URL}/databases/current`);if(!a.ok)throw new Error("Failed to fetch current database");return a.json()},staleTime:1e3*60*5});return k.useEffect(()=>{n&&(console.log("useCurrentDatabase data",n),n.database&&!e&&!r&&t(n.database))},[n,e,r,t]),{currentDatabase:n,isLoadingCurrentDatabase:r,currentDatabaseError:i}},UP=()=>{const{data:e,isLoading:t,error:n}=Cs({queryKey:[on.CACHE_KEYS.DATABASE_CONNECTION_INFO],queryFn:async()=>{const r=await fetch(`${ra.BASE_URL}/databases/connection`);if(!r.ok)throw new Error("Failed to fetch database connection info");return r.json()},staleTime:3e5});return{connectionInfo:e,isLoadingConnectionInfo:t,connectionInfoError:n}};function jP(){const{databases:e,isLoadingDatabases:t,refetchDatabases:n,isRefetchingDatabases:r}=zP(),{currentDatabase:i,isLoadingCurrentDatabase:a}=HP(),{connectionInfo:s,isLoadingConnectionInfo:o}=UP(),{selectedDatabase:u,setSelectedDatabase:l}=l1(),c=Is(),[h,d]=k.useState(!1);k.useEffect(()=>{i?.database&&!u&&!a&&l(i.database)},[i,u,l,a]);const m=T=>{l(T),c({to:"/table",search:{}})},y=async()=>{await n(),or.success("Databases refreshed")};return b.jsx("div",{className:"mt-auto border-t bg-background",children:b.jsxs("div",{className:"p-4 space-y-2",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(G5,{className:"h-4 w-4 text-muted-foreground"}),b.jsx("span",{className:"text-sm font-medium",children:"Database"})]}),b.jsxs(Qa,{children:[b.jsx(Za,{asChild:!0,children:b.jsx(Ge,{variant:"ghost",size:"icon",className:"h-6 w-6 hover:bg-accent",onClick:y,disabled:t||r,children:b.jsx(B6,{className:ge("h-3.5 w-3.5",t||r&&"animate-spin")})})}),b.jsx(Ja,{children:"Refresh databases"})]})]}),b.jsxs(i1,{value:u||"",onValueChange:m,children:[b.jsx(a1,{className:"h-9 text-xs font-mono w-full",disabled:t||r,children:b.jsx(s1,{placeholder:"Select database..."})}),b.jsx(o1,{children:e?.map(T=>b.jsx(ja,{value:T.name,className:"font-mono text-xs",children:T.name},T.name))})]})]}),b.jsxs("div",{className:"space-y-2",children:[b.jsxs(Ge,{variant:"ghost",className:"w-full hover:bg-accent flex items-center justify-between",onClick:()=>d(!h),disabled:o||r,children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsxs("div",{className:"relative flex h-2 w-2",children:[b.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),b.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})}),b.jsx("span",{className:"text-xs font-medium text-green-600",children:"Connected"})]}),b.jsx(e1,{className:ge("size-3 text-muted-foreground transition-transform",h&&"rotate-180")})]}),h&&s&&b.jsxs("div",{className:"space-y-1.5 px-2 py-2 rounded-md bg-muted/30",children:[b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:"Host"}),b.jsxs("span",{className:"text-xs font-mono text-foreground",children:[s.host,":",s.port]})]}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:"User"}),b.jsx("span",{className:"text-xs font-mono text-foreground",children:s.user})]}),b.jsxs("div",{className:"flex justify-between items-center",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:"Databases"}),b.jsx("span",{className:"text-xs font-mono font-medium text-foreground",children:e?.length||0})]})]})]})]})})}const VP=()=>{const{sidebar:{isPinned:e},toggleSidebarPinned:t}=Ns();return b.jsx("div",{className:"flex items-center justify-between h-9 border-b border-zinc-800",children:b.jsx(Ge,{variant:"ghost",size:"lg",onClick:t,className:"size-9 flex items-center justify-center transition hover:bg-transparent! focus-visible:ring-0 focus-visible:ring-offset-0",title:e?"Unpin sidebar":"Pin sidebar",children:e?b.jsx(Tb,{className:"size-4"}):b.jsx(hb,{className:"size-4"})})})},qP=({children:e})=>{const{sidebar:{width:t,isOpen:n,isPinned:r},setSidebarWidth:i,setSidebarOpen:a}=Ns(),s=k.useRef(!1),o=k.useRef(0),u=k.useRef(0),l=k.useRef(null),c=k.useRef(null),h=k.useCallback(E=>{s.current&&requestAnimationFrame(()=>{const S=E.clientX-o.current,O=u.current+S;i(O)})},[i]),d=k.useCallback(()=>{s.current=!1,document.body.style.cursor="",document.body.style.userSelect="";const E=document.getElementById("resize-overlay");E&&E.remove()},[]),m=k.useCallback(E=>{E.preventDefault(),s.current=!0,o.current=E.clientX,u.current=t,document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=document.createElement("div");S.id="resize-overlay",S.style.cssText="position:fixed;inset:0;z-index:9999;cursor:col-resize;",document.body.appendChild(S)},[t]),y=k.useCallback(()=>{r||a(!0)},[r,a]),T=k.useCallback(()=>{r||a(!1)},[r,a]),w=k.useCallback(E=>{r||n||s.current||(E.clientX<=on.HOVER_ZONE?(l.current&&clearTimeout(l.current),l.current=window.setTimeout(()=>{a(!0)},on.HOVER_DELAY)):E.clientX>on.HOVER_ZONE+50&&l.current&&clearTimeout(l.current))},[r,n,a]),A=E=>{r||a(E)};return k.useEffect(()=>(document.addEventListener("mousemove",h),document.addEventListener("mouseup",d),document.addEventListener("mousemove",w),()=>{document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",d),document.removeEventListener("mousemove",w),l.current&&clearTimeout(l.current)}),[h,d,w]),k.useEffect(()=>{const E=c.current;if(E)return E.addEventListener("mouseenter",y),E.addEventListener("mouseleave",T),()=>{E.removeEventListener("mouseenter",y),E.removeEventListener("mouseleave",T)}},[y,T]),b.jsxs(D6,{open:n,onOpenChange:A,modal:!1,children:[b.jsx(M6,{className:"sr-only",children:"Open Sidebar"}),b.jsx(R6,{ref:c,side:"left",showCloseButton:!1,isPinned:r,className:ge("bg-black border-r border-zinc-800 p-0","transition-transform duration-300 ease-out"),style:{width:`${t}px`},onOpenAutoFocus:E=>E.preventDefault(),children:b.jsxs("div",{className:"relative h-full flex flex-col",children:[e,b.jsx("div",{role:"button",tabIndex:0,onMouseDown:m,className:ge("absolute top-0 right-0 w-2 h-full cursor-col-resize z-50","hover:bg-blue-500/50 transition-colors group"),title:"Drag to resize",children:b.jsx("div",{className:"absolute right-0 top-1/2 -translate-y-1/2 w-2 h-12 bg-blue-500 opacity-0 group-hover:opacity-100 transition-opacity rounded-full"})})]})})]})},$P=()=>{const{pathname:e}=d1(),t=e.split("/")[1],n=k.useMemo(()=>{switch(console.log(t),t){case"":case"table":return b.jsx(Xf,{});case"runner":return b.jsx(PP,{});default:return b.jsx(Xf,{})}},[t]);return b.jsxs(qP,{children:[b.jsx(VP,{}),n,b.jsx(jP,{})]})};function YP(){const{sidebar:{isPinned:e,width:t}}=Ns();return b.jsxs("div",{className:"bg-zinc-950 w-dvw flex h-dvh max-h-dvh overflow-hidden relative",children:[b.jsx($P,{}),b.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden ",style:{marginLeft:e?`${t}px`:"0"},children:[b.jsx(vP,{}),b.jsx(L6,{})]})]})}const eO=Object.freeze(Object.defineProperty({__proto__:null,component:YP},Symbol.toStringTag,{value:"Module"})),GP=Object.freeze(Object.defineProperty({__proto__:null,Mermaid:C3},Symbol.toStringTag,{value:"Module"}));export{Kt as C,fL as D,eO as _,Op as a,Fp as b,Gd as c,Jv as d,JP as e,Bs as f,ca as h,_e as k,Kn as s,Ee as u,vD as w,e4 as z};
|