@decocms/mesh 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/client/assets/{AlertCircle-CDFxkn8P.js → AlertCircle-CAH7G7Fc.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-Ciuxq7Q-.js → ArrowLeft-DYJU0sRd.js} +1 -1
  3. package/dist/client/assets/{Calendar-Ck02Gl_h.js → Calendar-Ba37VUfB.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-293zKGHe.js → ChevronDown-BtaAznAf.js} +1 -1
  5. package/dist/client/assets/{Clock-hKESOc1Y.js → Clock-BYv8XFdU.js} +1 -1
  6. package/dist/client/assets/{Copy01-Cfsho8qu.js → Copy01-DZzyV7nE.js} +1 -1
  7. package/dist/client/assets/{CpuChip02-DMyGj-Z2.js → CpuChip02-SXr5nJdo.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-Dn7odh4O.js → DotsVertical-BJS2t7Tg.js} +1 -1
  9. package/dist/client/assets/{File06-Cdqoedhj.js → File06-NpiRHtR-.js} +1 -1
  10. package/dist/client/assets/{GitBranch01-nLLHsj1c.js → GitBranch01-iTqlzLTs.js} +1 -1
  11. package/dist/client/assets/{Inbox01-Cwh_U6Yy.js → Inbox01-BHWd6y2Z.js} +1 -1
  12. package/dist/client/assets/{InfoCircle-BXqyuDnq.js → InfoCircle-D6Oa5jFj.js} +1 -1
  13. package/dist/client/assets/{Key01-BhexYLb5.js → Key01-BYLHyZyj.js} +1 -1
  14. package/dist/client/assets/{LinkExternal01-I-KzAQEJ.js → LinkExternal01-CQv3krcN.js} +1 -1
  15. package/dist/client/assets/{Loading01-lzLKWums.js → Loading01-DdJTgVpp.js} +1 -1
  16. package/dist/client/assets/Lock01-CVeVWkZB.js +1 -0
  17. package/dist/client/assets/{Plus-Bl6yi8F8.js → Plus-DF_8yoMD.js} +1 -1
  18. package/dist/client/assets/{SearchMd-3Wd2TwbA.js → SearchMd-DDy8E2Sf.js} +1 -1
  19. package/dist/client/assets/{Terminal-DTrkBKv1.js → Terminal-CyVXhceX.js} +1 -1
  20. package/dist/client/assets/{Trash01-DtytfnvM.js → Trash01-3l-2SGXg.js} +1 -1
  21. package/dist/client/assets/{Upload01-DTjjOdhq.js → Upload01-BY1Megy0.js} +1 -1
  22. package/dist/client/assets/{X-Cp1i89ho.js → X-EkD3fVWA.js} +1 -1
  23. package/dist/client/assets/{XClose-BjXVNdsc.js → XClose-BQyXK7EC.js} +1 -1
  24. package/dist/client/assets/{alert-dialog-T6AiZUB1.js → alert-dialog-TgVzKfkb.js} +1 -1
  25. package/dist/client/assets/{auth-BYQ5JBPH.js → auth-CPnNaHvV.js} +1 -1
  26. package/dist/client/assets/{auth-catchall-ChAxJq9F.js → auth-catchall-LOKV6UAh.js} +1 -1
  27. package/dist/client/assets/{avatar-Cca1j58d.js → avatar-DSEJrCNe.js} +1 -1
  28. package/dist/client/assets/{badge-8HAdXiIR.js → badge-B1dobCRY.js} +1 -1
  29. package/dist/client/assets/{button--R5o0wL7.js → button-Cu7Gpj_2.js} +1 -1
  30. package/dist/client/assets/{card-DV2_nXad.js → card-BMKHMTDj.js} +1 -1
  31. package/dist/client/assets/{checkbox-BVd2RslL.js → checkbox-DbkRP74v.js} +1 -1
  32. package/dist/client/assets/{collection-detail-TIy-lzkt.js → collection-detail-ngjte1c4.js} +1 -1
  33. package/dist/client/assets/{collection-display-button-BDu-CjA3.js → collection-display-button-CfJOFOy4.js} +1 -1
  34. package/dist/client/assets/{collection-header-DUMmszqZ.js → collection-header-6vROlIaL.js} +1 -1
  35. package/dist/client/assets/{collection-page-CCqyH-ni.js → collection-page-DPG4FVyY.js} +1 -1
  36. package/dist/client/assets/{collection-search-BLREvhln.js → collection-search-Dt3csPYy.js} +1 -1
  37. package/dist/client/assets/{collection-table-wrapper-CIOycu1I.js → collection-table-wrapper-B3zYvq_F.js} +1 -1
  38. package/dist/client/assets/{connection-card-CdAxVoxf.js → connection-card-CjOjxUED.js} +1 -1
  39. package/dist/client/assets/{connection-detail-N74ve95g.js → connection-detail-BTYUiiKA.js} +1 -1
  40. package/dist/client/assets/{connections-eAJCThFh.js → connections-C46XykEA.js} +1 -1
  41. package/dist/client/assets/{core-9I4ovOKa.js → core-BFzlzP8F.js} +1 -1
  42. package/dist/client/assets/{create-organization-dialog-DqGippHf.js → create-organization-dialog-CdptfMRb.js} +1 -1
  43. package/dist/client/assets/{dialog-DlJAicu4.js → dialog-CC7Romxu.js} +1 -1
  44. package/dist/client/assets/{dropdown-menu-CvIw74N_.js → dropdown-menu-De2MFXzP.js} +1 -1
  45. package/dist/client/assets/{env-vars-editor-L1OkJ6Xo.js → env-vars-editor-DKJqlIK-.js} +1 -1
  46. package/dist/client/assets/{error-boundary-BP-NCqAa.js → error-boundary-BlfwOQWs.js} +1 -1
  47. package/dist/client/assets/{extract-connection-data-DgR0N8lP.js → extract-connection-data-D7ePP-S9.js} +1 -1
  48. package/dist/client/assets/{form-B7S8d6pb.js → form-C9aG8a9_.js} +1 -1
  49. package/dist/client/assets/{formatDistanceToNow-4WRkEQoq.js → formatDistanceToNow-7bwQqEEJ.js} +1 -1
  50. package/dist/client/assets/{gateway-detail-DYsvJWds.js → gateway-detail-D1TGQ1-a.js} +1 -1
  51. package/dist/client/assets/{gateways-CqMlHfC3.js → gateways-CicECNcG.js} +1 -1
  52. package/dist/client/assets/{home-JebOEFno.js → home-6S0sFGwA.js} +1 -1
  53. package/dist/client/assets/{index-BCPBzRgp.js → index-BC4DFDP4.js} +1 -1
  54. package/dist/client/assets/{index-DlHvrb4b.js → index-BEpExDaW.js} +1 -1
  55. package/dist/client/assets/{index-OjgkLDRY.js → index-CqA7I8ME.js} +16 -16
  56. package/dist/client/assets/{index-DOAaveYz.js → index-rXoeRhPD.js} +1 -1
  57. package/dist/client/assets/{input-DkUxKlvC.js → input-DHGUS5vj.js} +1 -1
  58. package/dist/client/assets/json-DY5VamDr.js +1 -0
  59. package/dist/client/assets/{json-syntax-highlighter-B0pbrw7c.js → json-syntax-highlighter-Dykx_AFd.js} +2 -2
  60. package/dist/client/assets/{layout-BD1H2Fd4.js → layout-zE8Dp2X0.js} +1 -1
  61. package/dist/client/assets/{lazy-highlighter-Bm3luqqx.js → lazy-highlighter-CioqVtm3.js} +1 -1
  62. package/dist/client/assets/{localstorage-keys-BKdNuRRM.js → localstorage-keys-DECG1iSi.js} +1 -1
  63. package/dist/client/assets/{login-D-FrmPs7.js → login-Cx3k8N36.js} +1 -1
  64. package/dist/client/assets/{mcp-oauth-B-4OryyC.js → mcp-oauth-tlLalwei.js} +1 -1
  65. package/dist/client/assets/members-Bng4JPo_.js +3 -0
  66. package/dist/client/assets/{monitoring-Dp4gwq3v.js → monitoring-gTR9Celr.js} +1 -1
  67. package/dist/client/assets/{oauth-callback-q9nbBMZr.js → oauth-callback-DWHntj-c.js} +1 -1
  68. package/dist/client/assets/{page-DZEEXJGv.js → page-BNqzvH_D.js} +1 -1
  69. package/dist/client/assets/{popover-DtFzalb2.js → popover-DqxbH01z.js} +1 -1
  70. package/dist/client/assets/prism-light-YTNk6MZn.js +1 -0
  71. package/dist/client/assets/{resizable-DvxvrPoQ.js → resizable-1LBVjTrf.js} +4 -4
  72. package/dist/client/assets/{resource-tabs-zQhHBAXR.js → resource-tabs-CeU00pMP.js} +1 -1
  73. package/dist/client/assets/{select-BbFQz4Zb.js → select-Dg5JPxAc.js} +1 -1
  74. package/dist/client/assets/{settings-BNNbDOAc.js → settings-Bpm9SXP6.js} +1 -1
  75. package/dist/client/assets/shell-layout-hhV4DGMT.js +17 -0
  76. package/dist/client/assets/{spinner-D3PlZpfm.js → spinner-CyJuCfoJ.js} +1 -1
  77. package/dist/client/assets/store-DrnwLSGT.js +1 -0
  78. package/dist/client/assets/{store-app-detail-Ctq33yyn.js → store-app-detail-CFp562AP.js} +1 -1
  79. package/dist/client/assets/{switch-C7AQYM7p.js → switch-C28m6eWV.js} +1 -1
  80. package/dist/client/assets/{tools-list-BBjhQzX1.js → tools-list-NuJ6i7mN.js} +1 -1
  81. package/dist/client/assets/{tooltip-BNR213_s.js → tooltip-BGO9FrAb.js} +1 -1
  82. package/dist/client/assets/{types-B5imdZUc.js → types-B38t86fr.js} +1 -1
  83. package/dist/client/assets/{use-binding-BA2o2u6B.js → use-binding-BSrLFa69.js} +1 -1
  84. package/dist/client/assets/{use-connection-Bva8lo0T.js → use-connection-CRNsw_EM.js} +1 -1
  85. package/dist/client/assets/{use-connection-resources-D14aG9RS.js → use-connection-resources-CuRCIUIA.js} +1 -1
  86. package/dist/client/assets/{use-gateway-BR-Csw6g.js → use-gateway-BDLgsIti.js} +1 -1
  87. package/dist/client/assets/{use-list-state-BlFIS1BS.js → use-list-state-Bu3fDY_D.js} +1 -1
  88. package/dist/client/assets/{use-mcp-DEd-0oIU.js → use-mcp-C6M7GJsU.js} +1 -1
  89. package/dist/client/assets/{use-members-2m2D77cz.js → use-members-BjVwiFSf.js} +1 -1
  90. package/dist/client/assets/{use-mobile--3nyeV_n.js → use-mobile-DWX_zGvO.js} +1 -1
  91. package/dist/client/assets/{use-organization-settings-CRu5FU7t.js → use-organization-settings-BjHeWH30.js} +1 -1
  92. package/dist/client/assets/{use-tool-call-BaqpTLjb.js → use-tool-call-hxvro7CP.js} +1 -1
  93. package/dist/client/assets/useQuery-DYX0Erl2.js +1 -0
  94. package/dist/client/assets/{view-mode-toggle-RcIHDc_9.js → view-mode-toggle-CwRfmI4H.js} +1 -1
  95. package/dist/client/assets/well-known-mcp-DX3tGGx0.js +1 -0
  96. package/dist/client/index.html +1 -1
  97. package/dist/server/cli.js +146 -146
  98. package/dist/server/migrate.js +92 -92
  99. package/dist/server/server.js +125 -125
  100. package/package.json +1 -1
  101. package/dist/client/assets/json-BhSdWvUi.js +0 -1
  102. package/dist/client/assets/members-B2Y9n1Dt.js +0 -3
  103. package/dist/client/assets/prism-light-f9F39inZ.js +0 -1
  104. package/dist/client/assets/shell-layout-bzzPOV5-.js +0 -17
  105. package/dist/client/assets/store-CFY_7skC.js +0 -1
  106. package/dist/client/assets/useQuery-CJBdsmlt.js +0 -1
  107. package/dist/client/assets/well-known-mcp-DgDkk-rH.js +0 -1
@@ -1,11 +1,11 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-Bm3luqqx.js","assets/index-OjgkLDRY.js","assets/index-FEm5nfEy.css","assets/core-9I4ovOKa.js","assets/json-BESjz4hO.js"])))=>i.map(i=>d[i]);
2
- import{r as D,c as X,e as oo,K as Qe,q as Na,aF as Dd,aG as Pd,aH as Xe,w as W,aI as jr,aJ as lo,aK as Md,aL as Bd,aM as Fd,Y as Ye,X as rr,W as hr,v as ke,aN as ne,aO as It,aP as Hd,aQ as Ne,a0 as Ud,aj as wa,j as g,aR as An,a3 as co,ax as zd,g as jd,t as vr,am as $d}from"./index-OjgkLDRY.js";import{E as Yd,u as qd}from"./use-binding-BA2o2u6B.js";import{u as Cn,i as Xt,c as fo,b as ho,T as po}from"./tooltip-BNR213_s.js";import{u as Vt,c as se,B as Mt}from"./button--R5o0wL7.js";import{j as Vd,c as Wd}from"./dropdown-menu-CvIw74N_.js";import{T as Gd}from"./dialog-DlJAicu4.js";import{i as Ra}from"./CpuChip02-DMyGj-Z2.js";import{i as mo}from"./SearchMd-3Wd2TwbA.js";import{I as go,b as Qd,U as Xd,e as Zd,c as Kd,u as Jd}from"./use-connection-Bva8lo0T.js";import{b as ef,a as tf,c as nf,S as rf,n as af}from"./select-BbFQz4Zb.js";import{u as sf}from"./use-mobile--3nyeV_n.js";import{u as uf}from"./use-gateway-BR-Csw6g.js";import{t as Eo}from"./ChevronDown-293zKGHe.js";import{a as ni}from"./Copy01-Cfsho8qu.js";import{i as of}from"./AlertCircle-CDFxkn8P.js";import{i as lf}from"./Terminal-DTrkBKv1.js";import{C as cf}from"./connection-card-CdAxVoxf.js";import{n as df}from"./LinkExternal01-I-KzAQEJ.js";import{S as ff}from"./spinner-D3PlZpfm.js";import{i as hf}from"./File06-Cdqoedhj.js";import{i as pf}from"./InfoCircle-BXqyuDnq.js";const bo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));bo.displayName="Coins01";const To=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));To.displayName="CurrencyDollar";const xo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M12 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm7-14a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"}));xo.displayName="DotsGrid";const _o=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));_o.displayName="Image01";const yo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));yo.displayName="Lightbulb01";const Ao=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Ao.displayName="LogOut04";const Co=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Co.displayName="MessageChatSquare";const ri=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));ri.displayName="Stars01";const ko=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));ko.displayName="Stop";const So=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));So.displayName="Target04";var ir;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),s={};for(const u of a)s[u]=i[u];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ir||(ir={}));var ms;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ms||(ms={}));ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ir.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class $r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let u=r,o=0;for(;o<s.path.length;){const l=s.path[o];o===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(n(s))):u[l]=u[l]||{_errors:[]},u=u[l],o++}}};return i(this),r}static assert(e){if(!(e instanceof $r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ir.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}$r.create=t=>new $r(t);var gs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(gs||(gs={}));var ae;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ae||(ae={}));function Zt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function mf(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Zt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let Si;function ii(){return Si||(Si=mf("keyval-store","keyval")),Si}function La(t,e=ii()){return e("readonly",n=>Zt(n.get(t)))}function Wn(t,e,n=ii()){return n("readwrite",r=>(r.put(e,t),Zt(r.transaction)))}function Io(t,e=ii()){return e("readwrite",n=>(n.delete(t),Zt(n.transaction)))}function gf(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Zt(t.transaction)}function No(t=ii()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Zt(e.getAllKeys()),Zt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>gf(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Ef(t,e){const n=`${t}:threads:${e}`;return await La(n)??null}async function bf(t){const e=`${t}:threads:`;return(await No()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function Tf(t,e){const n=`${t}:messages:`;return No().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function vy(){const t=X.c(12),{locator:e}=Cn();let n;t[0]!==e?(n=Qe.threads(e),t[0]=e,t[1]=n):n=t[1];let r;t[2]!==e?(r=()=>bf(e),t[2]=e,t[3]=r):r=t[3];let i;t[4]!==n||t[5]!==r?(i={queryKey:n,queryFn:r,staleTime:3e4},t[4]=n,t[5]=r,t[6]=i):i=t[6];const{data:a,refetch:s}=Na(i);let u;t[7]!==a?(u=a??[],t[7]=a,t[8]=u):u=t[8];let o;return t[9]!==s||t[10]!==u?(o={threads:u,refetch:s},t[9]=s,t[10]=u,t[11]=o):o=t[11],o}function xf(t){const e=X.c(11),{locator:n}=Cn();let r;e[0]!==n||e[1]!==t?(r=Qe.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>Tf(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Na(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function _f(){const t=X.c(28),{locator:e}=Cn(),n=oo();let r;t[0]!==e?(r=async A=>{const b=`${e}:threads:${A.id}`;return await Wn(b,A),A},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=()=>{n.invalidateQueries({queryKey:Qe.threads(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=Vt(a);let u;t[8]!==e?(u=async A=>{const{id:b,updates:S}=A,E=`${e}:threads:${b}`,w=await La(E);if(!w)throw new Error(`Thread ${b} not found`);const R={...w,...S};return await Wn(E,R),R},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=A=>{n.invalidateQueries({queryKey:Qe.threads(e)}),n.invalidateQueries({queryKey:Qe.thread(e,A.id)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Vt(l);let d;t[16]!==e?(d=async A=>{const b=`${e}:threads:${A}`;return await Io(b),A},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:Qe.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=Vt(h);let x;return t[24]!==m||t[25]!==s||t[26]!==f?(x={insert:s,update:f,delete:m},t[24]=m,t[25]=s,t[26]=f,t[27]=x):x=t[27],x}function yf(){const t=X.c(37),{locator:e}=Cn(),n=oo();let r;t[0]!==e?(r=async w=>{const R=`${e}:messages:${w.id}`;return await Wn(R,w),w},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=w=>{const R=w.metadata?.thread_id||w.threadId;R&&n.invalidateQueries({queryKey:Qe.threadMessages(e,R)}),n.invalidateQueries({queryKey:Qe.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=Vt(a);let u;t[8]!==e?(u=async w=>(await Promise.all(w.map(R=>{const C=`${e}:messages:${R.id}`;return Wn(C,R)})),w),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=w=>{const R=new Set;for(const C of w){const O=C.metadata?.thread_id||C.threadId;O&&R.add(O)}for(const C of R)n.invalidateQueries({queryKey:Qe.threadMessages(e,C)});n.invalidateQueries({queryKey:Qe.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Vt(l);let d;t[16]!==e?(d=async w=>{const{id:R,updates:C}=w,O=`${e}:messages:${R}`,M=await La(O);if(!M)throw new Error(`Message ${R} not found`);const z={...M,...C};return await Wn(O,z),z},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=w=>{const R=w.metadata?.thread_id||w.threadId;R&&n.invalidateQueries({queryKey:Qe.threadMessages(e,R)}),n.invalidateQueries({queryKey:Qe.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=Vt(h);let x;t[24]!==e?(x=async w=>{const R=`${e}:messages:${w}`;return await Io(R),w},t[24]=e,t[25]=x):x=t[25];let A;t[26]!==e||t[27]!==n?(A=()=>{n.invalidateQueries({queryKey:Qe.messages(e)})},t[26]=e,t[27]=n,t[28]=A):A=t[28];let b;t[29]!==A||t[30]!==x?(b={mutationFn:x,onSuccess:A},t[29]=A,t[30]=x,t[31]=b):b=t[31];const S=Vt(b);let E;return t[32]!==S||t[33]!==s||t[34]!==f||t[35]!==m?(E={insert:s,insertMany:f,update:m,delete:S},t[32]=S,t[33]=s,t[34]=f,t[35]=m,t[36]=E):E=t[36],E}async function Af(t){const e=`/mcp/gateway/${t}`,n={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const r=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!r.ok)return[];if((await r.json()).error)return[];const a=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!a.ok)return[];const s=await a.json();return s.error?[]:s.result?.prompts||[]}catch{return[]}}function Dy(t){const e=X.c(7);let n;e[0]!==t?(n=Qe.gatewayPrompts(t),e[0]=t,e[1]=n):n=e[1];let r;e[2]!==t?(r=()=>Af(t),e[2]=t,e[3]=r):r=e[3];let i;return e[4]!==n||e[5]!==r?(i={queryKey:n,queryFn:r,staleTime:6e4,retry:!1},e[4]=n,e[5]=r,e[6]=i):i=e[6],Na(i)}var wo="vercel.ai.error",Cf=Symbol.for(wo),Es,bs,Pt=class Ro extends(bs=Error,Es=Cf,bs){constructor({name:e,message:n,cause:r}){super(n),this[Es]=!0,this.name=e,this.cause=r}static isInstance(e){return Ro.hasMarker(e,wo)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function Lo(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Oo="AI_InvalidArgumentError",vo=`vercel.ai.error.${Oo}`,kf=Symbol.for(vo),Ts,xs,Sf=class extends(xs=Pt,Ts=kf,xs){constructor({message:t,cause:e,argument:n}){super({name:Oo,message:t,cause:e}),this[Ts]=!0,this.argument=n}static isInstance(t){return Pt.hasMarker(t,vo)}},Do="AI_JSONParseError",Po=`vercel.ai.error.${Do}`,If=Symbol.for(Po),_s,ys,As=class extends(ys=Pt,_s=If,ys){constructor({text:t,cause:e}){super({name:Do,message:`JSON parsing failed: Text: ${t}.
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lazy-highlighter-CioqVtm3.js","assets/index-CqA7I8ME.js","assets/index-FEm5nfEy.css","assets/core-BFzlzP8F.js","assets/json-BESjz4hO.js"])))=>i.map(i=>d[i]);
2
+ import{r as D,c as X,e as oo,K as Qe,q as Na,aF as Dd,aG as Pd,aH as Xe,w as W,aI as jr,aJ as lo,aK as Md,aL as Bd,aM as Fd,Y as Ye,X as rr,W as hr,v as ke,aN as ne,aO as It,aP as Hd,aQ as Ne,a0 as Ud,aj as wa,j as g,aR as An,a3 as co,ax as zd,f as jd,t as vr,am as $d}from"./index-CqA7I8ME.js";import{E as Yd,u as qd}from"./use-binding-BSrLFa69.js";import{u as Cn,i as Xt,c as fo,b as ho,T as po}from"./tooltip-BGO9FrAb.js";import{u as Vt,c as se,B as Mt}from"./button-Cu7Gpj_2.js";import{j as Vd,c as Wd}from"./dropdown-menu-De2MFXzP.js";import{T as Gd}from"./dialog-CC7Romxu.js";import{i as Ra}from"./CpuChip02-SXr5nJdo.js";import{i as mo}from"./SearchMd-DDy8E2Sf.js";import{I as go,b as Qd,U as Xd,e as Zd,c as Kd,u as Jd}from"./use-connection-CRNsw_EM.js";import{b as ef,a as tf,c as nf,S as rf,n as af}from"./select-Dg5JPxAc.js";import{u as sf}from"./use-mobile-DWX_zGvO.js";import{u as uf}from"./use-gateway-BDLgsIti.js";import{t as Eo}from"./ChevronDown-BtaAznAf.js";import{a as ni}from"./Copy01-DZzyV7nE.js";import{i as of}from"./AlertCircle-CAH7G7Fc.js";import{i as lf}from"./Terminal-CyVXhceX.js";import{C as cf}from"./connection-card-CjOjxUED.js";import{n as df}from"./LinkExternal01-CQv3krcN.js";import{S as ff}from"./spinner-CyJuCfoJ.js";import{i as hf}from"./File06-NpiRHtR-.js";import{i as pf}from"./InfoCircle-D6Oa5jFj.js";const bo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M15.938 15.938A7.001 7.001 0 0 0 15 2a7.001 7.001 0 0 0-6.938 6.062M16 15a7 7 0 1 1-14 0 7 7 0 0 1 14 0Z"}));bo.displayName="Coins01";const To=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M6 16a4 4 0 0 0 4 4h4a4 4 0 0 0 0-8h-4a4 4 0 0 1 0-8h4a4 4 0 0 1 4 4m-6-6v20"}));To.displayName="CurrencyDollar";const xo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M12 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm7-14a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM5 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm0 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"}));xo.displayName="DotsGrid";const _o=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M16.2 21H6.931c-.605 0-.908 0-1.049-.12a.5.5 0 0 1-.173-.42c.014-.183.228-.397.657-.826l8.503-8.503c.396-.396.594-.594.822-.668a1 1 0 0 1 .618 0c.228.074.426.272.822.668L21 15v1.2M16.2 21c1.68 0 2.52 0 3.162-.327a3 3 0 0 0 1.311-1.311C21 18.72 21 17.88 21 16.2M16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4M10.5 8.5a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"}));_o.displayName="Image01";const yo=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M15 16.5V19c0 .932 0 1.398-.152 1.765a2 2 0 0 1-1.083 1.083C13.398 22 12.932 22 12 22c-.932 0-1.398 0-1.765-.152a2 2 0 0 1-1.083-1.083C9 20.398 9 19.932 9 19v-2.5m6 0c2.649-1.157 4.5-3.925 4.5-7a7.5 7.5 0 0 0-15 0c0 3.075 1.851 5.843 4.5 7m6 0H9"}));yo.displayName="Lightbulb01";const Ao=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m18 8 4 4m0 0-4 4m4-4H9m6-7.796A8.383 8.383 0 0 0 10.667 3C5.88 3 2 7.03 2 12s3.88 9 8.667 9A8.384 8.384 0 0 0 15 19.796"}));Ao.displayName="LogOut04";const Co=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m10 15-3.075 3.114c-.43.434-.644.651-.828.666a.5.5 0 0 1-.421-.172c-.12-.14-.12-.446-.12-1.056v-1.56c0-.548-.449-.944-.99-1.024v0a3 3 0 0 1-2.534-2.533C2 12.219 2 11.96 2 11.445V6.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C4.28 2 5.12 2 6.8 2h7.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C19 4.28 19 5.12 19 6.8V11m0 11-2.176-1.513c-.306-.213-.46-.32-.626-.395a2.002 2.002 0 0 0-.462-.145c-.18-.033-.367-.033-.74-.033H13.2c-1.12 0-1.68 0-2.108-.218a2 2 0 0 1-.874-.874C10 18.394 10 17.834 10 16.714V14.2c0-1.12 0-1.68.218-2.108a2 2 0 0 1 .874-.874C11.52 11 12.08 11 13.2 11h5.6c1.12 0 1.68 0 2.108.218a2 2 0 0 1 .874.874C22 12.52 22 13.08 22 14.2v2.714c0 .932 0 1.398-.152 1.766a2 2 0 0 1-1.083 1.082c-.367.152-.833.152-1.765.152V22Z"}));Co.displayName="MessageChatSquare";const ri=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"m6.5 13 .784 1.569c.266.53.399.796.576 1.026a3 3 0 0 0 .545.545c.23.177.495.31 1.026.575L11 17.5l-1.569.785c-.53.265-.796.398-1.026.575a3 3 0 0 0-.545.545c-.177.23-.31.495-.576 1.026L6.5 22l-.784-1.569c-.266-.53-.399-.796-.576-1.026a3 3 0 0 0-.545-.545c-.23-.177-.495-.31-1.026-.575L2 17.5l1.569-.785c.53-.265.796-.398 1.026-.575a3 3 0 0 0 .545-.545c.177-.23.31-.495.576-1.026L6.5 13ZM15 2l1.179 3.064c.282.734.423 1.1.642 1.409a3 3 0 0 0 .706.706c.309.22.675.36 1.409.642L22 9l-3.064 1.179c-.734.282-1.1.423-1.409.642a3 3 0 0 0-.706.706c-.22.309-.36.675-.642 1.409L15 16l-1.179-3.064c-.282-.734-.423-1.1-.642-1.409a3 3 0 0 0-.706-.706c-.309-.22-.675-.36-1.409-.642L8 9l3.064-1.179c.734-.282 1.1-.423 1.409-.642a3 3 0 0 0 .706-.706c.22-.309.36-.675.642-1.409L15 2Z"}));ri.displayName="Stars01";const ko=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M3 7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h8.4c1.68 0 2.52 0 3.162.327a3 3 0 0 1 1.311 1.311C21 5.28 21 6.12 21 7.8v8.4c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8Z"}));ko.displayName="Stop";const So=({size:t=24,color:e="currentColor",...n})=>D.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},D.createElement("path",{d:"M16 8V5l3-3 1 2 2 1-3 3h-3Zm0 0-4 4m10 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2m5 10a5 5 0 1 1-5-5"}));So.displayName="Target04";var ir;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const a={};for(const s of i)a[s]=s;return a},t.getValidEnumValues=i=>{const a=t.objectKeys(i).filter(u=>typeof i[i[u]]!="number"),s={};for(const u of a)s[u]=i[u];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const a=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&a.push(s);return a},t.find=(i,a)=>{for(const s of i)if(a(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,a=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ir||(ir={}));var ms;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ms||(ms={}));ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ir.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class $r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},i=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let u=r,o=0;for(;o<s.path.length;){const l=s.path[o];o===s.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(n(s))):u[l]=u[l]||{_errors:[]},u=u[l],o++}}};return i(this),r}static assert(e){if(!(e instanceof $r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ir.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n=Object.create(null),r=[];for(const i of this.issues)if(i.path.length>0){const a=i.path[0];n[a]=n[a]||[],n[a].push(e(i))}else r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}$r.create=t=>new $r(t);var gs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(gs||(gs={}));var ae;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ae||(ae={}));function Zt(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function mf(t,e){let n;const r=()=>{if(n)return n;const i=indexedDB.open(t);return i.onupgradeneeded=()=>i.result.createObjectStore(e),n=Zt(i),n.then(a=>{a.onclose=()=>n=void 0},()=>{}),n};return(i,a)=>r().then(s=>a(s.transaction(e,i).objectStore(e)))}let Si;function ii(){return Si||(Si=mf("keyval-store","keyval")),Si}function La(t,e=ii()){return e("readonly",n=>Zt(n.get(t)))}function Wn(t,e,n=ii()){return n("readwrite",r=>(r.put(e,t),Zt(r.transaction)))}function Io(t,e=ii()){return e("readwrite",n=>(n.delete(t),Zt(n.transaction)))}function gf(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Zt(t.transaction)}function No(t=ii()){return t("readonly",e=>{if(e.getAll&&e.getAllKeys)return Promise.all([Zt(e.getAllKeys()),Zt(e.getAll())]).then(([r,i])=>r.map((a,s)=>[a,i[s]]));const n=[];return t("readonly",r=>gf(r,i=>n.push([i.key,i.value])).then(()=>n))})}async function Ef(t,e){const n=`${t}:threads:${e}`;return await La(n)??null}async function bf(t){const e=`${t}:threads:`;return(await No()).filter(([i])=>typeof i=="string"&&i.startsWith(e)).map(([,i])=>i).filter(i=>!i.hidden).sort((i,a)=>String(a.updated_at).localeCompare(String(i.updated_at)))}function Tf(t,e){const n=`${t}:messages:`;return No().then(r=>r.filter(([a])=>typeof a=="string"&&a.startsWith(n)).map(([,a])=>a).filter(a=>a.metadata?.thread_id===e||a.threadId===e).sort((a,s)=>{const u=a.metadata?.created_at||a.createdAt||"",o=s.metadata?.created_at||s.createdAt||"";return String(u).localeCompare(String(o))}))}function vy(){const t=X.c(12),{locator:e}=Cn();let n;t[0]!==e?(n=Qe.threads(e),t[0]=e,t[1]=n):n=t[1];let r;t[2]!==e?(r=()=>bf(e),t[2]=e,t[3]=r):r=t[3];let i;t[4]!==n||t[5]!==r?(i={queryKey:n,queryFn:r,staleTime:3e4},t[4]=n,t[5]=r,t[6]=i):i=t[6];const{data:a,refetch:s}=Na(i);let u;t[7]!==a?(u=a??[],t[7]=a,t[8]=u):u=t[8];let o;return t[9]!==s||t[10]!==u?(o={threads:u,refetch:s},t[9]=s,t[10]=u,t[11]=o):o=t[11],o}function xf(t){const e=X.c(11),{locator:n}=Cn();let r;e[0]!==n||e[1]!==t?(r=Qe.threadMessages(n,t),e[0]=n,e[1]=t,e[2]=r):r=e[2];let i;e[3]!==n||e[4]!==t?(i=()=>Tf(n,t),e[3]=n,e[4]=t,e[5]=i):i=e[5];let a;e[6]!==r||e[7]!==i?(a={queryKey:r,queryFn:i,staleTime:3e4},e[6]=r,e[7]=i,e[8]=a):a=e[8];const{data:s}=Na(a);let u;return e[9]!==s?(u=s??[],e[9]=s,e[10]=u):u=e[10],u}function _f(){const t=X.c(28),{locator:e}=Cn(),n=oo();let r;t[0]!==e?(r=async A=>{const b=`${e}:threads:${A.id}`;return await Wn(b,A),A},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=()=>{n.invalidateQueries({queryKey:Qe.threads(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=Vt(a);let u;t[8]!==e?(u=async A=>{const{id:b,updates:S}=A,E=`${e}:threads:${b}`,w=await La(E);if(!w)throw new Error(`Thread ${b} not found`);const R={...w,...S};return await Wn(E,R),R},t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=A=>{n.invalidateQueries({queryKey:Qe.threads(e)}),n.invalidateQueries({queryKey:Qe.thread(e,A.id)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Vt(l);let d;t[16]!==e?(d=async A=>{const b=`${e}:threads:${A}`;return await Io(b),A},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=()=>{n.invalidateQueries({queryKey:Qe.threads(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=Vt(h);let x;return t[24]!==m||t[25]!==s||t[26]!==f?(x={insert:s,update:f,delete:m},t[24]=m,t[25]=s,t[26]=f,t[27]=x):x=t[27],x}function yf(){const t=X.c(37),{locator:e}=Cn(),n=oo();let r;t[0]!==e?(r=async w=>{const R=`${e}:messages:${w.id}`;return await Wn(R,w),w},t[0]=e,t[1]=r):r=t[1];let i;t[2]!==e||t[3]!==n?(i=w=>{const R=w.metadata?.thread_id||w.threadId;R&&n.invalidateQueries({queryKey:Qe.threadMessages(e,R)}),n.invalidateQueries({queryKey:Qe.messages(e)})},t[2]=e,t[3]=n,t[4]=i):i=t[4];let a;t[5]!==r||t[6]!==i?(a={mutationFn:r,onSuccess:i},t[5]=r,t[6]=i,t[7]=a):a=t[7];const s=Vt(a);let u;t[8]!==e?(u=async w=>(await Promise.all(w.map(R=>{const C=`${e}:messages:${R.id}`;return Wn(C,R)})),w),t[8]=e,t[9]=u):u=t[9];let o;t[10]!==e||t[11]!==n?(o=w=>{const R=new Set;for(const C of w){const O=C.metadata?.thread_id||C.threadId;O&&R.add(O)}for(const C of R)n.invalidateQueries({queryKey:Qe.threadMessages(e,C)});n.invalidateQueries({queryKey:Qe.messages(e)})},t[10]=e,t[11]=n,t[12]=o):o=t[12];let l;t[13]!==u||t[14]!==o?(l={mutationFn:u,onSuccess:o},t[13]=u,t[14]=o,t[15]=l):l=t[15];const f=Vt(l);let d;t[16]!==e?(d=async w=>{const{id:R,updates:C}=w,O=`${e}:messages:${R}`,M=await La(O);if(!M)throw new Error(`Message ${R} not found`);const z={...M,...C};return await Wn(O,z),z},t[16]=e,t[17]=d):d=t[17];let p;t[18]!==e||t[19]!==n?(p=w=>{const R=w.metadata?.thread_id||w.threadId;R&&n.invalidateQueries({queryKey:Qe.threadMessages(e,R)}),n.invalidateQueries({queryKey:Qe.messages(e)})},t[18]=e,t[19]=n,t[20]=p):p=t[20];let h;t[21]!==d||t[22]!==p?(h={mutationFn:d,onSuccess:p},t[21]=d,t[22]=p,t[23]=h):h=t[23];const m=Vt(h);let x;t[24]!==e?(x=async w=>{const R=`${e}:messages:${w}`;return await Io(R),w},t[24]=e,t[25]=x):x=t[25];let A;t[26]!==e||t[27]!==n?(A=()=>{n.invalidateQueries({queryKey:Qe.messages(e)})},t[26]=e,t[27]=n,t[28]=A):A=t[28];let b;t[29]!==A||t[30]!==x?(b={mutationFn:x,onSuccess:A},t[29]=A,t[30]=x,t[31]=b):b=t[31];const S=Vt(b);let E;return t[32]!==S||t[33]!==s||t[34]!==f||t[35]!==m?(E={insert:s,insertMany:f,update:m,delete:S},t[32]=S,t[33]=s,t[34]=f,t[35]=m,t[36]=E):E=t[36],E}async function Af(t){const e=`/mcp/gateway/${t}`,n={"Content-Type":"application/json",Accept:"application/json, text/event-stream"};try{const r=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:1,method:"initialize",params:{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"mesh-chat",version:"1.0.0"}}})});if(!r.ok)return[];if((await r.json()).error)return[];const a=await fetch(e,{method:"POST",headers:n,body:JSON.stringify({jsonrpc:"2.0",id:2,method:"prompts/list",params:{}})});if(!a.ok)return[];const s=await a.json();return s.error?[]:s.result?.prompts||[]}catch{return[]}}function Dy(t){const e=X.c(7);let n;e[0]!==t?(n=Qe.gatewayPrompts(t),e[0]=t,e[1]=n):n=e[1];let r;e[2]!==t?(r=()=>Af(t),e[2]=t,e[3]=r):r=e[3];let i;return e[4]!==n||e[5]!==r?(i={queryKey:n,queryFn:r,staleTime:6e4,retry:!1},e[4]=n,e[5]=r,e[6]=i):i=e[6],Na(i)}var wo="vercel.ai.error",Cf=Symbol.for(wo),Es,bs,Pt=class Ro extends(bs=Error,Es=Cf,bs){constructor({name:e,message:n,cause:r}){super(n),this[Es]=!0,this.name=e,this.cause=r}static isInstance(e){return Ro.hasMarker(e,wo)}static hasMarker(e,n){const r=Symbol.for(n);return e!=null&&typeof e=="object"&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function Lo(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var Oo="AI_InvalidArgumentError",vo=`vercel.ai.error.${Oo}`,kf=Symbol.for(vo),Ts,xs,Sf=class extends(xs=Pt,Ts=kf,xs){constructor({message:t,cause:e,argument:n}){super({name:Oo,message:t,cause:e}),this[Ts]=!0,this.argument=n}static isInstance(t){return Pt.hasMarker(t,vo)}},Do="AI_JSONParseError",Po=`vercel.ai.error.${Do}`,If=Symbol.for(Po),_s,ys,As=class extends(ys=Pt,_s=If,ys){constructor({text:t,cause:e}){super({name:Do,message:`JSON parsing failed: Text: ${t}.
3
3
  Error message: ${Lo(e)}`,cause:e}),this[_s]=!0,this.text=t}static isInstance(t){return Pt.hasMarker(t,Po)}},Mo="AI_TypeValidationError",Bo=`vercel.ai.error.${Mo}`,Nf=Symbol.for(Bo),Cs,ks,Tn=class ea extends(ks=Pt,Cs=Nf,ks){constructor({value:e,cause:n}){super({name:Mo,message:`Type validation failed: Value: ${JSON.stringify(e)}.
4
4
  Error message: ${Lo(n)}`,cause:n}),this[Cs]=!0,this.value=e}static isInstance(e){return Pt.hasMarker(e,Bo)}static wrap({value:e,cause:n}){return ea.isInstance(n)&&n.value===e?n:new ea({value:e,cause:n})}},pr=({prefix:t,size:e=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=()=>{const a=n.length,s=new Array(e);for(let u=0;u<e;u++)s[u]=n[Math.random()*a|0];return s.join("")};if(t==null)return i;if(n.includes(r))throw new Sf({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${t}${r}${i()}`},wf=pr();function Ss(t=globalThis){var e,n,r;return t.window?"runtime/browser":(e=t.navigator)!=null&&e.userAgent?`runtime/${t.navigator.userAgent.toLowerCase()}`:(r=(n=t.process)==null?void 0:n.versions)!=null&&r.node?`runtime/node.js/${t.process.version.substring(0)}`:t.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function Yt(t){if(t==null)return{};const e={};if(t instanceof Headers)t.forEach((n,r)=>{e[r.toLowerCase()]=n});else{Array.isArray(t)||(t=Object.entries(t));for(const[n,r]of t)r!=null&&(e[n.toLowerCase()]=r)}return e}function Is(t,...e){const n=new Headers(Yt(t)),r=n.get("user-agent")||"";return n.set("user-agent",[r,...e].filter(Boolean).join(" ")),Object.fromEntries(n.entries())}var Rf=/"__proto__"\s*:/,Lf=/"constructor"\s*:/;function Ns(t){const e=JSON.parse(t);return e===null||typeof e!="object"||Rf.test(t)===!1&&Lf.test(t)===!1?e:Of(e)}function Of(t){let e=[t];for(;e.length;){const n=e;e=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const i in r){const a=r[i];a&&typeof a=="object"&&e.push(a)}}}return t}function vf(t){const{stackTraceLimit:e}=Error;try{Error.stackTraceLimit=0}catch{return Ns(t)}try{return Ns(t)}finally{Error.stackTraceLimit=e}}function Dr(t){if(t.type==="object"){t.additionalProperties=!1;const e=t.properties;if(e!=null)for(const n in e)e[n]=Dr(e[n])}return t.type==="array"&&t.items!=null&&(Array.isArray(t.items)?t.items=t.items.map(e=>Dr(e)):t.items=Dr(t.items)),t}var Df=Symbol("Let zodToJsonSchema decide on which parser to use"),ws={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Pf=t=>typeof t=="string"?{...ws,name:t}:{...ws,...t};function nt(){return{}}function Mf(t,e){var n,r,i;const a={type:"array"};return(n=t.type)!=null&&n._def&&((i=(r=t.type)==null?void 0:r._def)==null?void 0:i.typeName)!==ae.ZodAny&&(a.items=ye(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&(a.minItems=t.minLength.value),t.maxLength&&(a.maxItems=t.maxLength.value),t.exactLength&&(a.minItems=t.exactLength.value,a.maxItems=t.exactLength.value),a}function Bf(t){const e={type:"integer",format:"int64"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function Ff(){return{type:"boolean"}}function Fo(t,e){return ye(t.type._def,e)}var Hf=(t,e)=>ye(t.innerType._def,e);function Ho(t,e,n){const r=n??e.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((i,a)=>Ho(t,e,i))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Uf(t)}}var Uf=t=>{const e={type:"integer",format:"unix-time"};for(const n of t.checks)switch(n.kind){case"min":e.minimum=n.value;break;case"max":e.maximum=n.value;break}return e};function zf(t,e){return{...ye(t.innerType._def,e),default:t.defaultValue()}}function jf(t,e){return e.effectStrategy==="input"?ye(t.schema._def,e):nt()}function $f(t){return{type:"string",enum:Array.from(t.values)}}var Yf=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function qf(t,e){const n=[ye(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),ye(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(i=>!!i),r=[];return n.forEach(i=>{if(Yf(i))r.push(...i.allOf);else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){const{additionalProperties:s,...u}=i;a=u}r.push(a)}}),r.length?{allOf:r}:void 0}function Vf(t){const e=typeof t.value;return e!=="bigint"&&e!=="number"&&e!=="boolean"&&e!=="string"?{type:Array.isArray(t.value)?"array":"object"}:{type:e==="bigint"?"integer":e,const:t.value}}var Ii=void 0,ut={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Ii===void 0&&(Ii=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ii),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Uo(t,e){const n={type:"string"};if(t.checks)for(const r of t.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(e.emailStrategy){case"format:email":ot(n,"email",r.message,e);break;case"format:idn-email":ot(n,"idn-email",r.message,e);break;case"pattern:zod":$e(n,ut.email,r.message,e);break}break;case"url":ot(n,"uri",r.message,e);break;case"uuid":ot(n,"uuid",r.message,e);break;case"regex":$e(n,r.regex,r.message,e);break;case"cuid":$e(n,ut.cuid,r.message,e);break;case"cuid2":$e(n,ut.cuid2,r.message,e);break;case"startsWith":$e(n,RegExp(`^${Ni(r.value,e)}`),r.message,e);break;case"endsWith":$e(n,RegExp(`${Ni(r.value,e)}$`),r.message,e);break;case"datetime":ot(n,"date-time",r.message,e);break;case"date":ot(n,"date",r.message,e);break;case"time":ot(n,"time",r.message,e);break;case"duration":ot(n,"duration",r.message,e);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{$e(n,RegExp(Ni(r.value,e)),r.message,e);break}case"ip":{r.version!=="v6"&&ot(n,"ipv4",r.message,e),r.version!=="v4"&&ot(n,"ipv6",r.message,e);break}case"base64url":$e(n,ut.base64url,r.message,e);break;case"jwt":$e(n,ut.jwt,r.message,e);break;case"cidr":{r.version!=="v6"&&$e(n,ut.ipv4Cidr,r.message,e),r.version!=="v4"&&$e(n,ut.ipv6Cidr,r.message,e);break}case"emoji":$e(n,ut.emoji(),r.message,e);break;case"ulid":{$e(n,ut.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ot(n,"binary",r.message,e);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{$e(n,ut.base64,r.message,e);break}}break}case"nanoid":$e(n,ut.nanoid,r.message,e)}return n}function Ni(t,e){return e.patternStrategy==="escape"?Gf(t):t}var Wf=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gf(t){let e="";for(let n=0;n<t.length;n++)Wf.has(t[n])||(e+="\\"),e+=t[n];return e}function ot(t,e,n,r){var i;t.format||(i=t.anyOf)!=null&&i.some(a=>a.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format}),delete t.format),t.anyOf.push({format:e,...n&&r.errorMessages&&{errorMessage:{format:n}}})):t.format=e}function $e(t,e,n,r){var i;t.pattern||(i=t.allOf)!=null&&i.some(a=>a.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern}),delete t.pattern),t.allOf.push({pattern:Rs(e,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):t.pattern=Rs(e,r)}function Rs(t,e){var n;if(!e.applyRegexFlags||!t.flags)return t.source;const r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},i=r.i?t.source.toLowerCase():t.source;let a="",s=!1,u=!1,o=!1;for(let l=0;l<i.length;l++){if(s){a+=i[l],s=!1;continue}if(r.i){if(u){if(i[l].match(/[a-z]/)){o?(a+=i[l],a+=`${i[l-2]}-${i[l]}`.toUpperCase(),o=!1):i[l+1]==="-"&&((n=i[l+2])!=null&&n.match(/[a-z]/))?(a+=i[l],o=!0):a+=`${i[l]}${i[l].toUpperCase()}`;continue}}else if(i[l].match(/[a-z]/)){a+=`[${i[l]}${i[l].toUpperCase()}]`;continue}}if(r.m){if(i[l]==="^"){a+=`(^|(?<=[\r
5
5
  ]))`;continue}else if(i[l]==="$"){a+=`($|(?=[\r
6
6
  ]))`;continue}}if(r.s&&i[l]==="."){a+=u?`${i[l]}\r
7
7
  `:`[${i[l]}\r
8
- ]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function zo(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ae.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...f}=Uo(t.keyType._def,e);return{...o,propertyNames:f}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ae.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ae.ZodBranded&&t.keyType._def.type._def.typeName===ae.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...f}=Fo(t.keyType._def,e);return{...o,propertyNames:f}}}return o}function Qf(t,e){if(e.mapStrategy==="record")return zo(t,e);const n=ye(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||nt(),r=ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||nt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function Xf(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function Zf(){return{not:nt()}}function Kf(){return{type:"null"}}var ta={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Jf(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in ta&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=ta[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return eh(t,e)}var eh=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>ye(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function th(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[ta[t.innerType._def.typeName],"null"]};const n=ye(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function nh(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function rh(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=ah(u),l=ye(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=ih(t,e);return a!==void 0&&(n.additionalProperties=a),n}function ih(t,e){if(t.catchall._def.typeName!=="ZodNever")return ye(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function ah(t){try{return t.isOptional()}catch{return!0}}var sh=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ye(t.innerType._def,e);const r=ye(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:nt()},r]}:nt()},uh=(t,e)=>{if(e.pipeStrategy==="input")return ye(t.in._def,e);if(e.pipeStrategy==="output")return ye(t.out._def,e);const n=ye(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=ye(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function oh(t,e){return ye(t.type._def,e)}function lh(t,e){const r={type:"array",uniqueItems:!0,items:ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function ch(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>ye(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ye(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>ye(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function dh(){return{not:nt()}}function fh(){return nt()}var hh=(t,e)=>ye(t.innerType._def,e),ph=(t,e,n)=>{switch(e){case ae.ZodString:return Uo(t,n);case ae.ZodNumber:return nh(t);case ae.ZodObject:return rh(t,n);case ae.ZodBigInt:return Bf(t);case ae.ZodBoolean:return Ff();case ae.ZodDate:return Ho(t,n);case ae.ZodUndefined:return dh();case ae.ZodNull:return Kf();case ae.ZodArray:return Mf(t,n);case ae.ZodUnion:case ae.ZodDiscriminatedUnion:return Jf(t,n);case ae.ZodIntersection:return qf(t,n);case ae.ZodTuple:return ch(t,n);case ae.ZodRecord:return zo(t,n);case ae.ZodLiteral:return Vf(t);case ae.ZodEnum:return $f(t);case ae.ZodNativeEnum:return Xf(t);case ae.ZodNullable:return th(t,n);case ae.ZodOptional:return sh(t,n);case ae.ZodMap:return Qf(t,n);case ae.ZodSet:return lh(t,n);case ae.ZodLazy:return()=>t.getter()._def;case ae.ZodPromise:return oh(t,n);case ae.ZodNaN:case ae.ZodNever:return Zf();case ae.ZodEffects:return jf(t,n);case ae.ZodAny:return nt();case ae.ZodUnknown:return fh();case ae.ZodDefault:return zf(t,n);case ae.ZodBranded:return Fo(t,n);case ae.ZodReadonly:return hh(t,n);case ae.ZodCatch:return Hf(t,n);case ae.ZodPipeline:return uh(t,n);case ae.ZodFunction:case ae.ZodVoid:case ae.ZodSymbol:return;default:return(r=>{})()}},mh=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function ye(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==Df)return o}if(i&&!n){const o=gh(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=ph(t,t.typeName,e),u=typeof s=="function"?ye(s(),e):s;if(u&&Eh(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var gh=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:mh(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),nt()):e.$refStrategy==="seen"?nt():void 0}},Eh=(t,e,n)=>(t.description&&(n.description=t.description),n),bh=t=>{const e=Pf(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},Th=(t,e)=>{var n;const r=bh(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,d])=>{var p;return{...l,[f]:(p=ye(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0))!=null?p:nt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=ye(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:nt(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},na=Symbol.for("vercel.ai.schema");function xh(t){let e;return()=>(e==null&&(e=t()),e)}function ai(t,{validate:e}={}){return{[na]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function _h(t){return typeof t=="object"&&t!==null&&na in t&&t[na]===!0&&"jsonSchema"in t&&"validate"in t}function Oa(t){return t==null?ai({properties:{},additionalProperties:!1}):_h(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?jo(t):yh(t):t()}function yh(t){return ai(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Tn({value:e,cause:n.issues})}}})}function Ah(t,e){var n;const r=(n=void 0)!=null?n:!1;return ai(()=>Th(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Ch(t,e){var n;const r=(n=void 0)!=null?n:!1;return ai(()=>Dr(Pd(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await Dd(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function kh(t){return"_zod"in t}function jo(t,e){return kh(t)?Ch(t):Ah(t)}async function Ls({value:t,schema:e}){const n=await ar({value:t,schema:e});if(!n.success)throw Tn.wrap({value:t,cause:n.error});return n.value}async function ar({value:t,schema:e}){const n=Oa(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Tn.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Tn.wrap({value:t,cause:r}),rawValue:t}}}async function Kt({text:t,schema:e}){try{const n=vf(t);return e==null?{success:!0,value:n,rawValue:n}:await ar({value:n,schema:e})}catch(n){return{success:!1,error:As.isInstance(n)?n:new As({text:t,cause:n}),rawValue:void 0}}}function Sh({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Yd).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Kt({text:n,schema:e}))}}))}async function Lt(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Ih=Object.defineProperty,Nh=(t,e)=>{for(var n in e)Ih(t,n,{get:e[n],enumerable:!0})},$o="AI_NoObjectGeneratedError",Yo=`vercel.ai.error.${$o}`,wh=Symbol.for(Yo),qo,Dt=class extends Pt{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:$o,message:t,cause:e}),this[qo]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Pt.hasMarker(t,Yo)}};qo=wh;var Os="6.0.5",Vo=Xe([W(),jr(Uint8Array),jr(ArrayBuffer),lo(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),sr=Md(()=>Xe([Bd(),W(),Fd(),Ye(),rr(W(),sr.optional()),hr(sr)])),me=rr(W(),rr(W(),sr.optional())),Wo=ke({type:ne("text"),text:W(),providerOptions:me.optional()}),Rh=ke({type:ne("image"),image:Xe([Vo,jr(URL)]),mediaType:W().optional(),providerOptions:me.optional()}),Go=ke({type:ne("file"),data:Xe([Vo,jr(URL)]),filename:W().optional(),mediaType:W(),providerOptions:me.optional()}),Lh=ke({type:ne("reasoning"),text:W(),providerOptions:me.optional()}),Oh=ke({type:ne("tool-call"),toolCallId:W(),toolName:W(),input:It(),providerOptions:me.optional(),providerExecuted:Ye().optional()}),vh=Hd("type",[ke({type:ne("text"),value:W(),providerOptions:me.optional()}),ke({type:ne("json"),value:sr,providerOptions:me.optional()}),ke({type:ne("execution-denied"),reason:W().optional(),providerOptions:me.optional()}),ke({type:ne("error-text"),value:W(),providerOptions:me.optional()}),ke({type:ne("error-json"),value:sr,providerOptions:me.optional()}),ke({type:ne("content"),value:hr(Xe([ke({type:ne("text"),text:W(),providerOptions:me.optional()}),ke({type:ne("media"),data:W(),mediaType:W()}),ke({type:ne("file-data"),data:W(),mediaType:W(),filename:W().optional(),providerOptions:me.optional()}),ke({type:ne("file-url"),url:W(),providerOptions:me.optional()}),ke({type:ne("file-id"),fileId:Xe([W(),rr(W(),W())]),providerOptions:me.optional()}),ke({type:ne("image-data"),data:W(),mediaType:W(),providerOptions:me.optional()}),ke({type:ne("image-url"),url:W(),providerOptions:me.optional()}),ke({type:ne("image-file-id"),fileId:Xe([W(),rr(W(),W())]),providerOptions:me.optional()}),ke({type:ne("custom"),providerOptions:me.optional()})]))})]),Qo=ke({type:ne("tool-result"),toolCallId:W(),toolName:W(),output:vh,providerOptions:me.optional()}),Dh=ke({type:ne("tool-approval-request"),approvalId:W(),toolCallId:W()}),Ph=ke({type:ne("tool-approval-response"),approvalId:W(),approved:Ye(),reason:W().optional()}),Mh=ke({role:ne("system"),content:W(),providerOptions:me.optional()}),Bh=ke({role:ne("user"),content:Xe([W(),hr(Xe([Wo,Rh,Go]))]),providerOptions:me.optional()}),Fh=ke({role:ne("assistant"),content:Xe([W(),hr(Xe([Wo,Go,Lh,Oh,Qo,Dh]))]),providerOptions:me.optional()}),Hh=ke({role:ne("tool"),content:hr(Xe([Qo,Ph])),providerOptions:me.optional()});Xe([Mh,Bh,Fh,Hh]);function Xo(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=Xo(a,i):n[r]=i}return n}var Uh={};Nh(Uh,{array:()=>Yh,choice:()=>qh,json:()=>Vh,object:()=>$h,text:()=>jh});function zh(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,f){switch(o){case'"':{n=l,e.pop(),e.push(f),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(f),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(f),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(f),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,o+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const f=t.substring(r,t.length);"true".startsWith(f)?u+="true".slice(f.length):"false".startsWith(f)?u+="false".slice(f.length):"null".startsWith(f)&&(u+="null".slice(f.length))}}return u}async function mr(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Kt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Kt({text:zh(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var jh=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),$h=({schema:t,name:e,description:n})=>{const r=Oa(t);return{responseFormat:Lt(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Kt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await ar({value:s.value,schema:r});if(!u.success)throw new Dt({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await mr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Yh=({element:t,name:e,description:n})=>{const r=Oa(t);return{responseFormat:Lt(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Kt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Dt({message:"No object generated: response did not match schema.",cause:new Tn({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await ar({value:o,schema:r});if(!l.success)throw new Dt({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await mr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const f=await ar({value:l,schema:r});f.success&&o.push(f.value)}return{partial:o}}}}}},qh=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Kt({text:r});if(!a.success)throw new Dt({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Dt({message:"No object generated: response did not match schema.",cause:new Tn({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await mr(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),Vh=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Kt({text:n});if(!i.success)throw new Dt({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await mr(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});pr({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
8
+ ]`;continue}a+=i[l],i[l]==="\\"?s=!0:u&&i[l]==="]"?u=!1:!u&&i[l]==="["&&(u=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return a}function zo(t,e){var n,r,i,a,s,u;const o={type:"object",additionalProperties:(n=ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?n:e.allowedAdditionalProperties};if(((r=t.keyType)==null?void 0:r._def.typeName)===ae.ZodString&&((i=t.keyType._def.checks)!=null&&i.length)){const{type:l,...f}=Uo(t.keyType._def,e);return{...o,propertyNames:f}}else{if(((a=t.keyType)==null?void 0:a._def.typeName)===ae.ZodEnum)return{...o,propertyNames:{enum:t.keyType._def.values}};if(((s=t.keyType)==null?void 0:s._def.typeName)===ae.ZodBranded&&t.keyType._def.type._def.typeName===ae.ZodString&&((u=t.keyType._def.type._def.checks)!=null&&u.length)){const{type:l,...f}=Fo(t.keyType._def,e);return{...o,propertyNames:f}}}return o}function Qf(t,e){if(e.mapStrategy==="record")return zo(t,e);const n=ye(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||nt(),r=ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||nt();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function Xf(t){const e=t.values,r=Object.keys(t.values).filter(a=>typeof e[e[a]]!="number").map(a=>e[a]),i=Array.from(new Set(r.map(a=>typeof a)));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:r}}function Zf(){return{not:nt()}}function Kf(){return{type:"null"}}var ta={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Jf(t,e){const n=t.options instanceof Map?Array.from(t.options.values()):t.options;if(n.every(r=>r._def.typeName in ta&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((i,a)=>{const s=ta[a._def.typeName];return s&&!i.includes(s)?[...i,s]:i},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((i,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...i,s];case"bigint":return[...i,"integer"];case"object":if(a._def.value===null)return[...i,"null"];default:return i}},[]);if(r.length===n.length){const i=r.filter((a,s,u)=>u.indexOf(a)===s);return{type:i.length>1?i:i[0],enum:n.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,i)=>[...r,...i._def.values.filter(a=>!r.includes(a))],[])};return eh(t,e)}var eh=(t,e)=>{const n=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((r,i)=>ye(r._def,{...e,currentPath:[...e.currentPath,"anyOf",`${i}`]})).filter(r=>!!r&&(!e.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function th(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return{type:[ta[t.innerType._def.typeName],"null"]};const n=ye(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function nh(t){const e={type:"number"};if(!t.checks)return e;for(const n of t.checks)switch(n.kind){case"int":e.type="integer";break;case"min":n.inclusive?e.minimum=n.value:e.exclusiveMinimum=n.value;break;case"max":n.inclusive?e.maximum=n.value:e.exclusiveMaximum=n.value;break;case"multipleOf":e.multipleOf=n.value;break}return e}function rh(t,e){const n={type:"object",properties:{}},r=[],i=t.shape();for(const s in i){let u=i[s];if(u===void 0||u._def===void 0)continue;const o=ah(u),l=ye(u._def,{...e,currentPath:[...e.currentPath,"properties",s],propertyPath:[...e.currentPath,"properties",s]});l!==void 0&&(n.properties[s]=l,o||r.push(s))}r.length&&(n.required=r);const a=ih(t,e);return a!==void 0&&(n.additionalProperties=a),n}function ih(t,e){if(t.catchall._def.typeName!=="ZodNever")return ye(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function ah(t){try{return t.isOptional()}catch{return!0}}var sh=(t,e)=>{var n;if(e.currentPath.toString()===((n=e.propertyPath)==null?void 0:n.toString()))return ye(t.innerType._def,e);const r=ye(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:nt()},r]}:nt()},uh=(t,e)=>{if(e.pipeStrategy==="input")return ye(t.in._def,e);if(e.pipeStrategy==="output")return ye(t.out._def,e);const n=ye(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),r=ye(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(i=>i!==void 0)}};function oh(t,e){return ye(t.type._def,e)}function lh(t,e){const r={type:"array",uniqueItems:!0,items:ye(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&(r.minItems=t.minSize.value),t.maxSize&&(r.maxItems=t.maxSize.value),r}function ch(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((n,r)=>ye(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:ye(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((n,r)=>ye(n._def,{...e,currentPath:[...e.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function dh(){return{not:nt()}}function fh(){return nt()}var hh=(t,e)=>ye(t.innerType._def,e),ph=(t,e,n)=>{switch(e){case ae.ZodString:return Uo(t,n);case ae.ZodNumber:return nh(t);case ae.ZodObject:return rh(t,n);case ae.ZodBigInt:return Bf(t);case ae.ZodBoolean:return Ff();case ae.ZodDate:return Ho(t,n);case ae.ZodUndefined:return dh();case ae.ZodNull:return Kf();case ae.ZodArray:return Mf(t,n);case ae.ZodUnion:case ae.ZodDiscriminatedUnion:return Jf(t,n);case ae.ZodIntersection:return qf(t,n);case ae.ZodTuple:return ch(t,n);case ae.ZodRecord:return zo(t,n);case ae.ZodLiteral:return Vf(t);case ae.ZodEnum:return $f(t);case ae.ZodNativeEnum:return Xf(t);case ae.ZodNullable:return th(t,n);case ae.ZodOptional:return sh(t,n);case ae.ZodMap:return Qf(t,n);case ae.ZodSet:return lh(t,n);case ae.ZodLazy:return()=>t.getter()._def;case ae.ZodPromise:return oh(t,n);case ae.ZodNaN:case ae.ZodNever:return Zf();case ae.ZodEffects:return jf(t,n);case ae.ZodAny:return nt();case ae.ZodUnknown:return fh();case ae.ZodDefault:return zf(t,n);case ae.ZodBranded:return Fo(t,n);case ae.ZodReadonly:return hh(t,n);case ae.ZodCatch:return Hf(t,n);case ae.ZodPipeline:return uh(t,n);case ae.ZodFunction:case ae.ZodVoid:case ae.ZodSymbol:return;default:return(r=>{})()}},mh=(t,e)=>{let n=0;for(;n<t.length&&n<e.length&&t[n]===e[n];n++);return[(t.length-n).toString(),...e.slice(n)].join("/")};function ye(t,e,n=!1){var r;const i=e.seen.get(t);if(e.override){const o=(r=e.override)==null?void 0:r.call(e,t,e,i,n);if(o!==Df)return o}if(i&&!n){const o=gh(i,e);if(o!==void 0)return o}const a={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,a);const s=ph(t,t.typeName,e),u=typeof s=="function"?ye(s(),e):s;if(u&&Eh(t,e,u),e.postProcess){const o=e.postProcess(u,t,e);return a.jsonSchema=u,o}return a.jsonSchema=u,u}var gh=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:mh(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,r)=>e.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),nt()):e.$refStrategy==="seen"?nt():void 0}},Eh=(t,e,n)=>(t.description&&(n.description=t.description),n),bh=t=>{const e=Pf(t),n=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([r,i])=>[i._def,{def:i._def,path:[...e.basePath,e.definitionPath,r],jsonSchema:void 0}]))}},Th=(t,e)=>{var n;const r=bh(e);let i=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((l,[f,d])=>{var p;return{...l,[f]:(p=ye(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0))!=null?p:nt()}},{}):void 0;const a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=(n=ye(t._def,a===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,a]},!1))!=null?n:nt(),u=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;u!==void 0&&(s.title=u);const o=a===void 0?i?{...s,[r.definitionPath]:i}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,a].join("/"),[r.definitionPath]:{...i,[a]:s}};return o.$schema="http://json-schema.org/draft-07/schema#",o},na=Symbol.for("vercel.ai.schema");function xh(t){let e;return()=>(e==null&&(e=t()),e)}function ai(t,{validate:e}={}){return{[na]:!0,_type:void 0,get jsonSchema(){return typeof t=="function"&&(t=t()),t},validate:e}}function _h(t){return typeof t=="object"&&t!==null&&na in t&&t[na]===!0&&"jsonSchema"in t&&"validate"in t}function Oa(t){return t==null?ai({properties:{},additionalProperties:!1}):_h(t)?t:"~standard"in t?t["~standard"].vendor==="zod"?jo(t):yh(t):t()}function yh(t){return ai(()=>t["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async e=>{const n=await t["~standard"].validate(e);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new Tn({value:e,cause:n.issues})}}})}function Ah(t,e){var n;const r=(n=void 0)!=null?n:!1;return ai(()=>Th(t,{$refStrategy:r?"root":"none"}),{validate:async i=>{const a=await t.safeParseAsync(i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Ch(t,e){var n;const r=(n=void 0)!=null?n:!1;return ai(()=>Dr(Pd(t,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async i=>{const a=await Dd(t,i);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function kh(t){return"_zod"in t}function jo(t,e){return kh(t)?Ch(t):Ah(t)}async function Ls({value:t,schema:e}){const n=await ar({value:t,schema:e});if(!n.success)throw Tn.wrap({value:t,cause:n.error});return n.value}async function ar({value:t,schema:e}){const n=Oa(e);try{if(n.validate==null)return{success:!0,value:t,rawValue:t};const r=await n.validate(t);return r.success?{success:!0,value:r.value,rawValue:t}:{success:!1,error:Tn.wrap({value:t,cause:r.error}),rawValue:t}}catch(r){return{success:!1,error:Tn.wrap({value:t,cause:r}),rawValue:t}}}async function Kt({text:t,schema:e}){try{const n=vf(t);return e==null?{success:!0,value:n,rawValue:n}:await ar({value:n,schema:e})}catch(n){return{success:!1,error:As.isInstance(n)?n:new As({text:t,cause:n}),rawValue:void 0}}}function Sh({stream:t,schema:e}){return t.pipeThrough(new TextDecoderStream).pipeThrough(new Yd).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Kt({text:n,schema:e}))}}))}async function Lt(t){return typeof t=="function"&&(t=t()),Promise.resolve(t)}var Ih=Object.defineProperty,Nh=(t,e)=>{for(var n in e)Ih(t,n,{get:e[n],enumerable:!0})},$o="AI_NoObjectGeneratedError",Yo=`vercel.ai.error.${$o}`,wh=Symbol.for(Yo),qo,Dt=class extends Pt{constructor({message:t="No object generated.",cause:e,text:n,response:r,usage:i,finishReason:a}){super({name:$o,message:t,cause:e}),this[qo]=!0,this.text=n,this.response=r,this.usage=i,this.finishReason=a}static isInstance(t){return Pt.hasMarker(t,Yo)}};qo=wh;var Os="6.0.7",Vo=Xe([W(),jr(Uint8Array),jr(ArrayBuffer),lo(t=>{var e,n;return(n=(e=globalThis.Buffer)==null?void 0:e.isBuffer(t))!=null?n:!1},{message:"Must be a Buffer"})]),sr=Md(()=>Xe([Bd(),W(),Fd(),Ye(),rr(W(),sr.optional()),hr(sr)])),me=rr(W(),rr(W(),sr.optional())),Wo=ke({type:ne("text"),text:W(),providerOptions:me.optional()}),Rh=ke({type:ne("image"),image:Xe([Vo,jr(URL)]),mediaType:W().optional(),providerOptions:me.optional()}),Go=ke({type:ne("file"),data:Xe([Vo,jr(URL)]),filename:W().optional(),mediaType:W(),providerOptions:me.optional()}),Lh=ke({type:ne("reasoning"),text:W(),providerOptions:me.optional()}),Oh=ke({type:ne("tool-call"),toolCallId:W(),toolName:W(),input:It(),providerOptions:me.optional(),providerExecuted:Ye().optional()}),vh=Hd("type",[ke({type:ne("text"),value:W(),providerOptions:me.optional()}),ke({type:ne("json"),value:sr,providerOptions:me.optional()}),ke({type:ne("execution-denied"),reason:W().optional(),providerOptions:me.optional()}),ke({type:ne("error-text"),value:W(),providerOptions:me.optional()}),ke({type:ne("error-json"),value:sr,providerOptions:me.optional()}),ke({type:ne("content"),value:hr(Xe([ke({type:ne("text"),text:W(),providerOptions:me.optional()}),ke({type:ne("media"),data:W(),mediaType:W()}),ke({type:ne("file-data"),data:W(),mediaType:W(),filename:W().optional(),providerOptions:me.optional()}),ke({type:ne("file-url"),url:W(),providerOptions:me.optional()}),ke({type:ne("file-id"),fileId:Xe([W(),rr(W(),W())]),providerOptions:me.optional()}),ke({type:ne("image-data"),data:W(),mediaType:W(),providerOptions:me.optional()}),ke({type:ne("image-url"),url:W(),providerOptions:me.optional()}),ke({type:ne("image-file-id"),fileId:Xe([W(),rr(W(),W())]),providerOptions:me.optional()}),ke({type:ne("custom"),providerOptions:me.optional()})]))})]),Qo=ke({type:ne("tool-result"),toolCallId:W(),toolName:W(),output:vh,providerOptions:me.optional()}),Dh=ke({type:ne("tool-approval-request"),approvalId:W(),toolCallId:W()}),Ph=ke({type:ne("tool-approval-response"),approvalId:W(),approved:Ye(),reason:W().optional()}),Mh=ke({role:ne("system"),content:W(),providerOptions:me.optional()}),Bh=ke({role:ne("user"),content:Xe([W(),hr(Xe([Wo,Rh,Go]))]),providerOptions:me.optional()}),Fh=ke({role:ne("assistant"),content:Xe([W(),hr(Xe([Wo,Go,Lh,Oh,Qo,Dh]))]),providerOptions:me.optional()}),Hh=ke({role:ne("tool"),content:hr(Xe([Qo,Ph])),providerOptions:me.optional()});Xe([Mh,Bh,Fh,Hh]);function Xo(t,e){if(t===void 0&&e===void 0)return;if(t===void 0)return e;if(e===void 0)return t;const n={...t};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const i=e[r];if(i===void 0)continue;const a=r in t?t[r]:void 0,s=i!==null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),u=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&u?n[r]=Xo(a,i):n[r]=i}return n}var Uh={};Nh(Uh,{array:()=>Yh,choice:()=>qh,json:()=>Vh,object:()=>$h,text:()=>jh});function zh(t){const e=["ROOT"];let n=-1,r=null;function i(o,l,f){switch(o){case'"':{n=l,e.pop(),e.push(f),e.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=l,r=l,e.pop(),e.push(f),e.push("INSIDE_LITERAL");break}case"-":{e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l,e.pop(),e.push(f),e.push("INSIDE_NUMBER");break}case"{":{n=l,e.pop(),e.push(f),e.push("INSIDE_OBJECT_START");break}case"[":{n=l,e.pop(),e.push(f),e.push("INSIDE_ARRAY_START");break}}}function a(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=l,e.pop();break}}}function s(o,l){switch(o){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,e.pop();break}}}for(let o=0;o<t.length;o++){const l=t[o];switch(e[e.length-1]){case"ROOT":i(l,o,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{e.pop(),e.push("INSIDE_OBJECT_KEY");break}case"}":{n=o,e.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{l==='"'&&(e.pop(),e.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{l===":"&&(e.pop(),e.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(l,o,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(l,o);break}case"INSIDE_STRING":{switch(l){case'"':{e.pop(),n=o;break}case"\\":{e.push("INSIDE_STRING_ESCAPE");break}default:n=o}break}case"INSIDE_ARRAY_START":{l==="]"?(n=o,e.pop()):(n=o,i(l,o,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{e.pop(),e.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=o,e.pop();break}default:{n=o;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(l,o,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{e.pop(),n=o;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=o;break}case"e":case"E":case"-":case".":break;case",":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"}":{e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,o);break}case"]":{e.pop(),e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o);break}default:{e.pop();break}}break}case"INSIDE_LITERAL":{const d=t.substring(r,o+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(e.pop(),e[e.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(l,o):e[e.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(l,o)):n=o;break}}}let u=t.slice(0,n+1);for(let o=e.length-1;o>=0;o--)switch(e[o]){case"INSIDE_STRING":{u+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const f=t.substring(r,t.length);"true".startsWith(f)?u+="true".slice(f.length):"false".startsWith(f)?u+="false".slice(f.length):"null".startsWith(f)&&(u+="null".slice(f.length))}}return u}async function mr(t){if(t===void 0)return{value:void 0,state:"undefined-input"};let e=await Kt({text:t});return e.success?{value:e.value,state:"successful-parse"}:(e=await Kt({text:zh(t)}),e.success?{value:e.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var jh=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:t}){return t},async parsePartialOutput({text:t}){return{partial:t}}}),$h=({schema:t,name:e,description:n})=>{const r=Oa(t);return{responseFormat:Lt(r.jsonSchema).then(i=>({type:"json",schema:i,...e!=null&&{name:e},...n!=null&&{description:n}})),async parseCompleteOutput({text:i},a){const s=await Kt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=await ar({value:s.value,schema:r});if(!u.success)throw new Dt({message:"No object generated: response did not match schema.",cause:u.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});return u.value},async parsePartialOutput({text:i}){const a=await mr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},Yh=({element:t,name:e,description:n})=>{const r=Oa(t);return{responseFormat:Lt(r.jsonSchema).then(i=>{const{$schema:a,...s}=i;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}}),async parseCompleteOutput({text:i},a){const s=await Kt({text:i});if(!s.success)throw new Dt({message:"No object generated: could not parse the response.",cause:s.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});const u=s.value;if(u==null||typeof u!="object"||!("elements"in u)||!Array.isArray(u.elements))throw new Dt({message:"No object generated: response did not match schema.",cause:new Tn({value:u,cause:"response must be an object with an elements array"}),text:i,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const o of u.elements){const l=await ar({value:o,schema:r});if(!l.success)throw new Dt({message:"No object generated: response did not match schema.",cause:l.error,text:i,response:a.response,usage:a.usage,finishReason:a.finishReason})}return u.elements},async parsePartialOutput({text:i}){const a=await mr(i);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const u=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,o=[];for(const l of u){const f=await ar({value:l,schema:r});f.success&&o.push(f.value)}return{partial:o}}}}}},qh=({options:t,name:e,description:n})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:t}},required:["result"],additionalProperties:!1},...e!=null&&{name:e},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},i){const a=await Kt({text:r});if(!a.success)throw new Dt({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!t.includes(s.result))throw new Dt({message:"No object generated: response did not match schema.",cause:new Tn({value:s,cause:"response must be an object that contains a choice value."}),text:r,response:i.response,usage:i.usage,finishReason:i.finishReason});return s.result},async parsePartialOutput({text:r}){const i=await mr(r);switch(i.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=i.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=t.filter(u=>u.startsWith(a.result));return i.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),Vh=({name:t,description:e}={})=>({responseFormat:Promise.resolve({type:"json",...t!=null&&{name:t},...e!=null&&{description:e}}),async parseCompleteOutput({text:n},r){const i=await Kt({text:n});if(!i.success)throw new Dt({message:"No object generated: could not parse the response.",cause:i.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return i.value},async parsePartialOutput({text:n}){const r=await mr(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}}});pr({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(t,e){e.enqueue(`data: ${JSON.stringify(t)}
9
9
 
10
10
  `)},flush(t){t.enqueue(`data: [DONE]
11
11
 
@@ -93,5 +93,5 @@ Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An err
93
93
  `))+1))}const s="#".repeat(i),u=n.enter("headingAtx"),o=n.enter("phrasing");a.move(s+" ");let l=n.containerPhrasing(t,{before:"# ",after:`
94
94
  `,...a.current()});return/^[\t ]/.test(l)&&(l=cr(l.charCodeAt(0))+l.slice(1)),l=l?s+" "+l:s,n.options.closeAtx&&(l+=" "+s),o(),u(),l}Fc.peek=Dx;function Fc(t){return t.value||""}function Dx(){return"<"}Hc.peek=Px;function Hc(t,e,n,r){const i=us(n),a=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let u=n.enter("label");const o=n.createTracker(r);let l=o.move("![");return l+=o.move(n.safe(t.alt,{before:l,after:"]",...o.current()})),l+=o.move("]("),u(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(u=n.enter("destinationLiteral"),l+=o.move("<"),l+=o.move(n.safe(t.url,{before:l,after:">",...o.current()})),l+=o.move(">")):(u=n.enter("destinationRaw"),l+=o.move(n.safe(t.url,{before:l,after:t.title?" ":")",...o.current()}))),u(),t.title&&(u=n.enter(`title${a}`),l+=o.move(" "+i),l+=o.move(n.safe(t.title,{before:l,after:i,...o.current()})),l+=o.move(i),u()),l+=o.move(")"),s(),l}function Px(){return"!"}Uc.peek=Mx;function Uc(t,e,n,r){const i=t.referenceType,a=n.enter("imageReference");let s=n.enter("label");const u=n.createTracker(r);let o=u.move("![");const l=n.safe(t.alt,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),s();const f=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=f,a(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function Mx(){return"!"}zc.peek=Bx;function zc(t,e,n){let r=t.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a<n.unsafe.length;){const s=n.unsafe[a],u=n.compilePattern(s);let o;if(s.atBreak)for(;o=u.exec(r);){let l=o.index;r.charCodeAt(l)===10&&r.charCodeAt(l-1)===13&&l--,r=r.slice(0,l)+" "+r.slice(o.index+1)}}return i+r+i}function Bx(){return"`"}function jc(t,e){const n=Wa(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}$c.peek=Fx;function $c(t,e,n,r){const i=us(n),a=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,o;if(jc(t,n)){const f=n.stack;n.stack=[],u=n.enter("autolink");let d=s.move("<");return d+=s.move(n.containerPhrasing(t,{before:d,after:">",...s.current()})),d+=s.move(">"),u(),n.stack=f,d}u=n.enter("link"),o=n.enter("label");let l=s.move("[");return l+=s.move(n.containerPhrasing(t,{before:l,after:"](",...s.current()})),l+=s.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),l+=s.move("<"),l+=s.move(n.safe(t.url,{before:l,after:">",...s.current()})),l+=s.move(">")):(o=n.enter("destinationRaw"),l+=s.move(n.safe(t.url,{before:l,after:t.title?" ":")",...s.current()}))),o(),t.title&&(o=n.enter(`title${a}`),l+=s.move(" "+i),l+=s.move(n.safe(t.title,{before:l,after:i,...s.current()})),l+=s.move(i),o()),l+=s.move(")"),u(),l}function Fx(t,e,n){return jc(t,n)?"<":"["}Yc.peek=Hx;function Yc(t,e,n,r){const i=t.referenceType,a=n.enter("linkReference");let s=n.enter("label");const u=n.createTracker(r);let o=u.move("[");const l=n.containerPhrasing(t,{before:o,after:"]",...u.current()});o+=u.move(l+"]["),s();const f=n.stack;n.stack=[],s=n.enter("reference");const d=n.safe(n.associationId(t),{before:o,after:"]",...u.current()});return s(),n.stack=f,a(),i==="full"||!l||l!==d?o+=u.move(d+"]"):i==="shortcut"?o=o.slice(0,-1):o+=u.move("]"),o}function Hx(){return"["}function os(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function Ux(t){const e=os(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function zx(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function qc(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function jx(t,e,n,r){const i=n.enter("list"),a=n.bulletCurrent;let s=t.ordered?zx(n):os(n);const u=t.ordered?s==="."?")":".":Ux(n);let o=e&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((s==="*"||s==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(o=!0),qc(n)===s&&f){let d=-1;for(;++d<t.children.length;){const p=t.children[d];if(p&&p.type==="listItem"&&p.children&&p.children[0]&&p.children[0].type==="thematicBreak"){o=!0;break}}}}o&&(s=u),n.bulletCurrent=s;const l=n.containerFlow(t,r);return n.bulletLastUsed=s,n.bulletCurrent=a,i(),l}function $x(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function Yx(t,e,n,r){const i=$x(n);let a=n.bulletCurrent||os(n);e&&e.type==="list"&&e.ordered&&(a=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+a);let s=a.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(s=Math.ceil(s/4)*4);const u=n.createTracker(r);u.move(a+" ".repeat(s-a.length)),u.shift(s);const o=n.enter("listItem"),l=n.indentLines(n.containerFlow(t,u.current()),f);return o(),l;function f(d,p,h){return p?(h?"":" ".repeat(s))+d:(h?a:a+" ".repeat(s-a.length))+d}}function qx(t,e,n,r){const i=n.enter("paragraph"),a=n.enter("phrasing"),s=n.containerPhrasing(t,r);return a(),i(),s}const Vx=pi(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Wx(t,e,n,r){return(t.children.some(function(s){return Vx(s)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Gx(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Vc.peek=Qx;function Vc(t,e,n,r){const i=Gx(n),a=n.enter("strong"),s=n.createTracker(r),u=s.move(i+i);let o=s.move(n.containerPhrasing(t,{after:i,before:u,...s.current()}));const l=o.charCodeAt(0),f=Kr(r.before.charCodeAt(r.before.length-1),l,i);f.inside&&(o=cr(l)+o.slice(1));const d=o.charCodeAt(o.length-1),p=Kr(r.after.charCodeAt(0),d,i);p.inside&&(o=o.slice(0,-1)+cr(d));const h=s.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:p.outside,before:f.outside},u+o+h}function Qx(t,e,n){return n.options.strong||"*"}function Xx(t,e,n,r){return n.safe(t.value,r)}function Zx(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Kx(t,e,n){const r=(qc(n)+(n.options.ruleSpaces?" ":"")).repeat(Zx(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Wc={blockquote:_x,break:Wu,code:Ix,definition:wx,emphasis:Bc,hardBreak:Wu,heading:vx,html:Fc,image:Hc,imageReference:Uc,inlineCode:zc,link:$c,linkReference:Yc,list:jx,listItem:Yx,paragraph:qx,root:Wx,strong:Vc,text:Xx,thematicBreak:Kx};function Jx(){return{enter:{table:e3,tableData:Gu,tableHeader:Gu,tableRow:n3},exit:{codeText:r3,table:t3,tableData:Gi,tableHeader:Gi,tableRow:Gi}}}function e3(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function t3(t){this.exit(t),this.data.inTable=void 0}function n3(t){this.enter({type:"tableRow",children:[]},t)}function Gi(t){this.exit(t)}function Gu(t){this.enter({type:"tableCell",children:[]},t)}function r3(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,i3));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function i3(t,e){return e==="|"?e:t}function a3(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
95
95
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:o,tableRow:u}};function s(h,m,x,A){return l(f(h,x,A),h.align)}function u(h,m,x,A){const b=d(h,x,A),S=l([b]);return S.slice(0,S.indexOf(`
96
- `))}function o(h,m,x,A){const b=x.enter("tableCell"),S=x.enter("phrasing"),E=x.containerPhrasing(h,{...A,before:a,after:a});return S(),b(),E}function l(h,m){return Tx(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function f(h,m,x){const A=h.children;let b=-1;const S=[],E=m.enter("table");for(;++b<A.length;)S[b]=d(A[b],m,x);return E(),S}function d(h,m,x){const A=h.children;let b=-1;const S=[],E=m.enter("tableRow");for(;++b<A.length;)S[b]=o(A[b],h,m,x);return E(),S}function p(h,m,x){let A=Wc.inlineCode(h,m,x);return x.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function s3(){return{exit:{taskListCheckValueChecked:Qu,taskListCheckValueUnchecked:Qu,paragraph:o3}}}function u3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:l3}}}function Qu(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function o3(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function l3(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Wc.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+s}}function c3(){return[jT(),lx(),hx(),Jx(),s3()]}function d3(t){return{extensions:[$T(),cx(t),px(),a3(t),u3()]}}const f3={tokenize:b3,partial:!0},Gc={tokenize:T3,partial:!0},Qc={tokenize:x3,partial:!0},Xc={tokenize:_3,partial:!0},h3={tokenize:y3,partial:!0},Zc={name:"wwwAutolink",tokenize:g3,previous:Jc},Kc={name:"protocolAutolink",tokenize:E3,previous:ed},Ct={name:"emailAutolink",tokenize:m3,previous:td},Et={};function p3(){return{text:Et}}let jt=48;for(;jt<123;)Et[jt]=Ct,jt++,jt===58?jt=65:jt===91&&(jt=97);Et[43]=Ct;Et[45]=Ct;Et[46]=Ct;Et[95]=Ct;Et[72]=[Ct,Kc];Et[104]=[Ct,Kc];Et[87]=[Ct,Zc];Et[119]=[Ct,Zc];function m3(t,e,n){const r=this;let i,a;return s;function s(d){return!Ca(d)||!td.call(r,r.previous)||ls(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return Ca(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(h3,f,l)(d):d===45||d===95||Ue(d)?(a=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return a&&i&&qe(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function g3(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!Jc.call(r,r.previous)||ls(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(f3,t.attempt(Gc,t.attempt(Qc,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function E3(t,e,n){const r=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&ed.call(r,r.previous)&&!ls(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if(qe(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),a?l:(a=!0,o)):n(d)}function l(d){return d===null||Wr(d)||Se(d)||en(d)||di(d)?n(d):t.attempt(Gc,t.attempt(Qc,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function b3(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function T3(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Xc,o,u)(l):l===null||Se(l)||en(l)||l!==45&&di(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function x3(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Xc,e,a)(s):s===null||Se(s)||en(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function _3(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),a):u===93?(t.consume(u),i):u===60||u===null||Se(u)||en(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Se(u)||en(u)?e(u):r(u)}function a(u){return qe(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):qe(u)?(t.consume(u),s):n(u)}}function y3(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return Ue(a)?n(a):e(a)}}function Jc(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Se(t)}function ed(t){return!qe(t)}function td(t){return!(t===47||Ca(t))}function Ca(t){return t===43||t===45||t===46||t===95||Ue(t)}function ls(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const A3={tokenize:L3,partial:!0};function C3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:N3,continuation:{tokenize:w3},exit:R3}},text:{91:{name:"gfmFootnoteCall",tokenize:I3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:k3,resolveTo:S3}}}}function k3(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!s||!s._balanced)return n(o);const l=lt(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function S3(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function I3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(a>999||d===93&&!s||d===null||d===91||Se(d))return n(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(lt(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Se(d)||(s=!0),a++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),a++,l):l(d)}}function N3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,u;return o;function o(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(m)}function f(m){if(s>999||m===93&&!u||m===null||m===91||Se(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return a=lt(r.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Se(m)||(u=!0),s++,t.consume(m),m===92?d:f}function d(m){return m===91||m===92||m===93?(t.consume(m),s++,f):f(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(a)||i.push(a),ge(t,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return e(m)}}function w3(t,e,n){return t.check(Tr,e,t.attempt(A3,e,n))}function R3(t){t.exit("gfmFootnoteDefinition")}function L3(t,e,n){const r=this;return ge(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function O3(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},d={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",f,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&tt(p,p.length,0,fi(h,s.slice(l+1,o),u)),tt(p,p.length,0,[["exit",d,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",f,u]]),tt(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,f=this.events;let d=0;return p;function p(m){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(m):(s.enter("strikethroughSequenceTemporary"),h(m))}function h(m){const x=xn(l);if(m===126)return d>1?o(m):(s.consume(m),d++,h);if(d<2&&!n)return o(m);const A=s.exit("strikethroughSequenceTemporary"),b=xn(m);return A._open=!b||b===2&&!!x,A._close=!x||x===2&&!!b,u(m)}}}class v3{constructor(){this.map=[]}add(e,n,r){D3(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const a of i)e.push(a);i=r.pop()}this.map.length=0}}function D3(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function P3(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function M3(){return{flow:{null:{name:"table",tokenize:B3,resolveAll:F3}}}}function B3(t,e,n){const r=this;let i=0,a=0,s;return u;function u(N){let P=r.events.length-1;for(;P>-1;){const Y=r.events[P][1].type;if(Y==="lineEnding"||Y==="linePrefix")P--;else break}const H=P>-1?r.events[P][1].type:null,J=H==="tableHead"||H==="tableRow"?C:o;return J===C&&r.parser.lazy[r.now().line]?n(N):J(N)}function o(N){return t.enter("tableHead"),t.enter("tableRow"),l(N)}function l(N){return N===124||(s=!0,a+=1),f(N)}function f(N){return N===null?n(N):te(N)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),h):n(N):de(N)?ge(t,f,"whitespace")(N):(a+=1,s&&(s=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),s=!0,f):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||Se(N)?(t.exit("data"),f(N)):(t.consume(N),N===92?p:d)}function p(N){return N===92||N===124?(t.consume(N),d):d(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),s=!1,de(N)?ge(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?A(N):N===124?(s=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),x):R(N)}function x(N){return de(N)?ge(t,A,"whitespace")(N):A(N)}function A(N){return N===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),b):N===45?(a+=1,b(N)):N===null||te(N)?w(N):R(N)}function b(N){return N===45?(t.enter("tableDelimiterFiller"),S(N)):R(N)}function S(N){return N===45?(t.consume(N),S):N===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),E):(t.exit("tableDelimiterFiller"),E(N))}function E(N){return de(N)?ge(t,w,"whitespace")(N):w(N)}function w(N){return N===124?m(N):N===null||te(N)?!s||i!==a?R(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):R(N)}function R(N){return n(N)}function C(N){return t.enter("tableRow"),O(N)}function O(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),O):N===null||te(N)?(t.exit("tableRow"),e(N)):de(N)?ge(t,O,"whitespace")(N):(t.enter("data"),M(N))}function M(N){return N===null||N===124||Se(N)?(t.exit("data"),O(N)):(t.consume(N),N===92?z:M)}function z(N){return N===92||N===124?(t.consume(N),M):M(N)}}function F3(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,f,d;const p=new v3;for(;++n<t.length;){const h=t[n],m=h[1];h[0]==="enter"?m.type==="tableHead"?(u=!1,o!==0&&(Xu(p,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",l,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",f,e]])),i=m.type==="tableDelimiterRow"?2:f?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=Rr(p,e,a,i,void 0,d),a=[0,0,0,0]),s[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],d=Rr(p,e,a,i,void 0,d)),a=s,s=[a[1],n,0,0])):m.type==="tableHead"?(u=!0,o=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],d=Rr(p,e,a,i,n,d)):s[1]!==0&&(d=Rr(p,e,s,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&Xu(p,e,o,l,f),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=P3(e.events,n))}return t}function Rr(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},hn(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=hn(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=hn(e.events,n[2]),f=hn(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,x=n[3]-n[2]-1;t.add(m,x,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(a.end=Object.assign({},hn(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function Xu(t,e,n,r,i){const a=[],s=hn(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function hn(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const H3={name:"tasklistCheck",tokenize:z3};function U3(){return{text:{91:H3}}}function z3(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),a)}function a(o){return Se(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return te(o)?e(o):de(o)?t.check({tokenize:j3},e,n)(o):n(o)}}function j3(t,e,n){return ge(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function $3(t){return Rl([p3(),C3(),O3(t),M3(),U3()])}const Y3={};function q3(t){const e=this,n=t||Y3,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push($3(n)),a.push(c3()),s.push(d3(n))}const V3=D.lazy(()=>zd(()=>import("./lazy-highlighter-Bm3luqqx.js"),__vite__mapDeps([0,1,2,3,4])));function nd(){const t=X.c(3),[e,n]=D.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function W3(){const t=X.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(G3)}),t[1]=r):r=t[1],r}function G3(t,e){return g.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&g.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function Q3(t){const e=X.c(12),n=D.useRef(null),{handleCopy:r,copied:i}=nd(),a=X3;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?g.jsx(Xt,{size:12}):g.jsx(ni,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=g.jsx("div",{className:"flex justify-end items-center",children:g.jsxs(Mt,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=g.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:g.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=g.jsxs(g.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function X3(t){return t?Array.from(t.querySelectorAll("tr")).map(Z3).join(`
96
+ `))}function o(h,m,x,A){const b=x.enter("tableCell"),S=x.enter("phrasing"),E=x.containerPhrasing(h,{...A,before:a,after:a});return S(),b(),E}function l(h,m){return Tx(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function f(h,m,x){const A=h.children;let b=-1;const S=[],E=m.enter("table");for(;++b<A.length;)S[b]=d(A[b],m,x);return E(),S}function d(h,m,x){const A=h.children;let b=-1;const S=[],E=m.enter("tableRow");for(;++b<A.length;)S[b]=o(A[b],h,m,x);return E(),S}function p(h,m,x){let A=Wc.inlineCode(h,m,x);return x.stack.includes("tableCell")&&(A=A.replace(/\|/g,"\\$&")),A}}function s3(){return{exit:{taskListCheckValueChecked:Qu,taskListCheckValueUnchecked:Qu,paragraph:o3}}}function u3(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:l3}}}function Qu(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function o3(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let a=-1,s;for(;++a<i.length;){const u=i[a];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function l3(t,e,n,r){const i=t.children[0],a=typeof t.checked=="boolean"&&i&&i.type==="paragraph",s="["+(t.checked?"x":" ")+"] ",u=n.createTracker(r);a&&u.move(s);let o=Wc.listItem(t,e,n,{...r,...u.current()});return a&&(o=o.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),o;function l(f){return f+s}}function c3(){return[jT(),lx(),hx(),Jx(),s3()]}function d3(t){return{extensions:[$T(),cx(t),px(),a3(t),u3()]}}const f3={tokenize:b3,partial:!0},Gc={tokenize:T3,partial:!0},Qc={tokenize:x3,partial:!0},Xc={tokenize:_3,partial:!0},h3={tokenize:y3,partial:!0},Zc={name:"wwwAutolink",tokenize:g3,previous:Jc},Kc={name:"protocolAutolink",tokenize:E3,previous:ed},Ct={name:"emailAutolink",tokenize:m3,previous:td},Et={};function p3(){return{text:Et}}let jt=48;for(;jt<123;)Et[jt]=Ct,jt++,jt===58?jt=65:jt===91&&(jt=97);Et[43]=Ct;Et[45]=Ct;Et[46]=Ct;Et[95]=Ct;Et[72]=[Ct,Kc];Et[104]=[Ct,Kc];Et[87]=[Ct,Zc];Et[119]=[Ct,Zc];function m3(t,e,n){const r=this;let i,a;return s;function s(d){return!Ca(d)||!td.call(r,r.previous)||ls(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),u(d))}function u(d){return Ca(d)?(t.consume(d),u):d===64?(t.consume(d),o):n(d)}function o(d){return d===46?t.check(h3,f,l)(d):d===45||d===95||Ue(d)?(a=!0,t.consume(d),o):f(d)}function l(d){return t.consume(d),i=!0,o}function f(d){return a&&i&&qe(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function g3(t,e,n){const r=this;return i;function i(s){return s!==87&&s!==119||!Jc.call(r,r.previous)||ls(r.events)?n(s):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(f3,t.attempt(Gc,t.attempt(Qc,a),n),n)(s))}function a(s){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(s)}}function E3(t,e,n){const r=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&ed.call(r,r.previous)&&!ls(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),u):n(d)}function u(d){if(qe(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),u;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return t.consume(d),o}return n(d)}function o(d){return d===47?(t.consume(d),a?l:(a=!0,o)):n(d)}function l(d){return d===null||Wr(d)||Se(d)||en(d)||di(d)?n(d):t.attempt(Gc,t.attempt(Qc,f),n)(d)}function f(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function b3(t,e,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,t.consume(s),i):s===46&&r===3?(t.consume(s),a):n(s)}function a(s){return s===null?n(s):e(s)}}function T3(t,e,n){let r,i,a;return s;function s(l){return l===46||l===95?t.check(Xc,o,u)(l):l===null||Se(l)||en(l)||l!==45&&di(l)?o(l):(a=!0,t.consume(l),s)}function u(l){return l===95?r=!0:(i=r,r=void 0),t.consume(l),s}function o(l){return i||r||!a?n(l):e(l)}}function x3(t,e){let n=0,r=0;return i;function i(s){return s===40?(n++,t.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?t.check(Xc,e,a)(s):s===null||Se(s)||en(s)?e(s):(t.consume(s),i)}function a(s){return s===41&&r++,t.consume(s),i}}function _3(t,e,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(t.consume(u),r):u===38?(t.consume(u),a):u===93?(t.consume(u),i):u===60||u===null||Se(u)||en(u)?e(u):n(u)}function i(u){return u===null||u===40||u===91||Se(u)||en(u)?e(u):r(u)}function a(u){return qe(u)?s(u):n(u)}function s(u){return u===59?(t.consume(u),r):qe(u)?(t.consume(u),s):n(u)}}function y3(t,e,n){return r;function r(a){return t.consume(a),i}function i(a){return Ue(a)?n(a):e(a)}}function Jc(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Se(t)}function ed(t){return!qe(t)}function td(t){return!(t===47||Ca(t))}function Ca(t){return t===43||t===45||t===46||t===95||Ue(t)}function ls(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const A3={tokenize:L3,partial:!0};function C3(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:N3,continuation:{tokenize:w3},exit:R3}},text:{91:{name:"gfmFootnoteCall",tokenize:I3},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:k3,resolveTo:S3}}}}function k3(t,e,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const o=r.events[i][1];if(o.type==="labelImage"){s=o;break}if(o.type==="gfmFootnoteCall"||o.type==="labelLink"||o.type==="label"||o.type==="image"||o.type==="link")break}return u;function u(o){if(!s||!s._balanced)return n(o);const l=lt(r.sliceSerialize({start:s.end,end:r.now()}));return l.codePointAt(0)!==94||!a.includes(l.slice(1))?n(o):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(o),t.exit("gfmFootnoteCallLabelMarker"),e(o))}}function S3(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",a,e],["enter",s,e],["exit",s,e],["exit",a,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...u),t}function I3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return u;function u(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),o}function o(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",l)}function l(d){if(a>999||d===93&&!s||d===null||d===91||Se(d))return n(d);if(d===93){t.exit("chunkString");const p=t.exit("gfmFootnoteCallString");return i.includes(lt(r.sliceSerialize(p)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Se(d)||(s=!0),a++,t.consume(d),d===92?f:l}function f(d){return d===91||d===92||d===93?(t.consume(d),a++,l):l(d)}}function N3(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,u;return o;function o(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),l}function l(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(m)}function f(m){if(s>999||m===93&&!u||m===null||m===91||Se(m))return n(m);if(m===93){t.exit("chunkString");const x=t.exit("gfmFootnoteDefinitionLabelString");return a=lt(r.sliceSerialize(x)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),p}return Se(m)||(u=!0),s++,t.consume(m),m===92?d:f}function d(m){return m===91||m===92||m===93?(t.consume(m),s++,f):f(m)}function p(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),i.includes(a)||i.push(a),ge(t,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return e(m)}}function w3(t,e,n){return t.check(Tr,e,t.attempt(A3,e,n))}function R3(t){t.exit("gfmFootnoteDefinition")}function L3(t,e,n){const r=this;return ge(t,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?e(a):n(a)}}function O3(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let o=-1;for(;++o<s.length;)if(s[o][0]==="enter"&&s[o][1].type==="strikethroughSequenceTemporary"&&s[o][1]._close){let l=o;for(;l--;)if(s[l][0]==="exit"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._open&&s[o][1].end.offset-s[o][1].start.offset===s[l][1].end.offset-s[l][1].start.offset){s[o][1].type="strikethroughSequence",s[l][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},s[l][1].start),end:Object.assign({},s[o][1].end)},d={type:"strikethroughText",start:Object.assign({},s[l][1].end),end:Object.assign({},s[o][1].start)},p=[["enter",f,u],["enter",s[l][1],u],["exit",s[l][1],u],["enter",d,u]],h=u.parser.constructs.insideSpan.null;h&&tt(p,p.length,0,fi(h,s.slice(l+1,o),u)),tt(p,p.length,0,[["exit",d,u],["enter",s[o][1],u],["exit",s[o][1],u],["exit",f,u]]),tt(s,l-1,o-l+3,p),o=l+p.length-2;break}}for(o=-1;++o<s.length;)s[o][1].type==="strikethroughSequenceTemporary"&&(s[o][1].type="data");return s}function a(s,u,o){const l=this.previous,f=this.events;let d=0;return p;function p(m){return l===126&&f[f.length-1][1].type!=="characterEscape"?o(m):(s.enter("strikethroughSequenceTemporary"),h(m))}function h(m){const x=xn(l);if(m===126)return d>1?o(m):(s.consume(m),d++,h);if(d<2&&!n)return o(m);const A=s.exit("strikethroughSequenceTemporary"),b=xn(m);return A._open=!b||b===2&&!!x,A._close=!x||x===2&&!!b,u(m)}}}class v3{constructor(){this.map=[]}add(e,n,r){D3(this,e,n,r)}consume(e){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const a of i)e.push(a);i=r.pop()}this.map.length=0}}function D3(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function P3(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function M3(){return{flow:{null:{name:"table",tokenize:B3,resolveAll:F3}}}}function B3(t,e,n){const r=this;let i=0,a=0,s;return u;function u(N){let P=r.events.length-1;for(;P>-1;){const Y=r.events[P][1].type;if(Y==="lineEnding"||Y==="linePrefix")P--;else break}const H=P>-1?r.events[P][1].type:null,J=H==="tableHead"||H==="tableRow"?C:o;return J===C&&r.parser.lazy[r.now().line]?n(N):J(N)}function o(N){return t.enter("tableHead"),t.enter("tableRow"),l(N)}function l(N){return N===124||(s=!0,a+=1),f(N)}function f(N){return N===null?n(N):te(N)?a>1?(a=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),h):n(N):de(N)?ge(t,f,"whitespace")(N):(a+=1,s&&(s=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),s=!0,f):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||Se(N)?(t.exit("data"),f(N)):(t.consume(N),N===92?p:d)}function p(N){return N===92||N===124?(t.consume(N),d):d(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),s=!1,de(N)?ge(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):m(N))}function m(N){return N===45||N===58?A(N):N===124?(s=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),x):R(N)}function x(N){return de(N)?ge(t,A,"whitespace")(N):A(N)}function A(N){return N===58?(a+=1,s=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),b):N===45?(a+=1,b(N)):N===null||te(N)?w(N):R(N)}function b(N){return N===45?(t.enter("tableDelimiterFiller"),S(N)):R(N)}function S(N){return N===45?(t.consume(N),S):N===58?(s=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),E):(t.exit("tableDelimiterFiller"),E(N))}function E(N){return de(N)?ge(t,w,"whitespace")(N):w(N)}function w(N){return N===124?m(N):N===null||te(N)?!s||i!==a?R(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):R(N)}function R(N){return n(N)}function C(N){return t.enter("tableRow"),O(N)}function O(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),O):N===null||te(N)?(t.exit("tableRow"),e(N)):de(N)?ge(t,O,"whitespace")(N):(t.enter("data"),M(N))}function M(N){return N===null||N===124||Se(N)?(t.exit("data"),O(N)):(t.consume(N),N===92?z:M)}function z(N){return N===92||N===124?(t.consume(N),M):M(N)}}function F3(t,e){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],u=!1,o=0,l,f,d;const p=new v3;for(;++n<t.length;){const h=t[n],m=h[1];h[0]==="enter"?m.type==="tableHead"?(u=!1,o!==0&&(Xu(p,e,o,l,f),f=void 0,o=0),l={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",l,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,a=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,f={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},p.add(n,0,[["enter",f,e]])),i=m.type==="tableDelimiterRow"?2:f?3:1):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=Rr(p,e,a,i,void 0,d),a=[0,0,0,0]),s[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],d=Rr(p,e,a,i,void 0,d)),a=s,s=[a[1],n,0,0])):m.type==="tableHead"?(u=!0,o=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(o=n,a[1]!==0?(s[0]=s[1],d=Rr(p,e,a,i,n,d)):s[1]!==0&&(d=Rr(p,e,s,i,n,d)),i=0):i&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(s[3]=n)}for(o!==0&&Xu(p,e,o,l,f),p.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=P3(e.events,n))}return t}function Rr(t,e,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},hn(e.events,n[0])),t.add(n[0],0,[["exit",a,e]]));const o=hn(e.events,n[1]);if(a={type:s,start:Object.assign({},o),end:Object.assign({},o)},t.add(n[1],0,[["enter",a,e]]),n[2]!==0){const l=hn(e.events,n[2]),f=hn(e.events,n[3]),d={type:u,start:Object.assign({},l),end:Object.assign({},f)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const p=e.events[n[2]],h=e.events[n[3]];if(p[1].end=Object.assign({},h[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,x=n[3]-n[2]-1;t.add(m,x,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(a.end=Object.assign({},hn(e.events,i)),t.add(i,0,[["exit",a,e]]),a=void 0),a}function Xu(t,e,n,r,i){const a=[],s=hn(e.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,e])),r.end=Object.assign({},s),a.push(["exit",r,e]),t.add(n+1,0,a)}function hn(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const H3={name:"tasklistCheck",tokenize:z3};function U3(){return{text:{91:H3}}}function z3(t,e,n){const r=this;return i;function i(o){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(o):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),a)}function a(o){return Se(o)?(t.enter("taskListCheckValueUnchecked"),t.consume(o),t.exit("taskListCheckValueUnchecked"),s):o===88||o===120?(t.enter("taskListCheckValueChecked"),t.consume(o),t.exit("taskListCheckValueChecked"),s):n(o)}function s(o){return o===93?(t.enter("taskListCheckMarker"),t.consume(o),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),u):n(o)}function u(o){return te(o)?e(o):de(o)?t.check({tokenize:j3},e,n)(o):n(o)}}function j3(t,e,n){return ge(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function $3(t){return Rl([p3(),C3(),O3(t),M3(),U3()])}const Y3={};function q3(t){const e=this,n=t||Y3,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push($3(n)),a.push(c3()),s.push(d3(n))}const V3=D.lazy(()=>zd(()=>import("./lazy-highlighter-CioqVtm3.js"),__vite__mapDeps([0,1,2,3,4])));function nd(){const t=X.c(3),[e,n]=D.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function W3(){const t=X.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[85,70],t[0]=e):e=t[0];const n=e;let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"p-4 font-mono text-sm",style:{background:"#2d2d2d",borderRadius:"0 0 0.5rem 0.5rem",overflow:"auto",minHeight:"4rem"},children:n.map(G3)}),t[1]=r):r=t[1],r}function G3(t,e){return g.jsxs("div",{className:"flex gap-2 items-center my-1",children:[e>2&&e<7&&g.jsx("div",{className:"w-4 h-4 rounded-sm opacity-40 animate-pulse",style:{background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.1}s`}}),e%4===0&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"3rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.12}s`}}),e%3===1&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"2.5rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.14}s`}}),g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:`${t}%`,background:"rgba(255, 255, 255, 0.1)",animationDelay:`${e*.1}s`}}),e%5===2&&g.jsx("div",{className:"h-4 rounded animate-pulse",style:{width:"4rem",background:"rgba(128, 128, 128, 0.3)",animationDelay:`${e*.16}s`}})]},e)}function Q3(t){const e=X.c(12),n=D.useRef(null),{handleCopy:r,copied:i}=nd(),a=X3;let s;e[0]!==r?(s=async()=>{const p=a(n.current);await r(p)},e[0]=r,e[1]=s):s=e[1];const u=s;let o;e[2]!==i?(o=i?g.jsx(Xt,{size:12}):g.jsx(ni,{size:12}),e[2]=i,e[3]=o):o=e[3];let l;e[4]!==u||e[5]!==o?(l=g.jsx("div",{className:"flex justify-end items-center",children:g.jsxs(Mt,{variant:"ghost",onClick:u,"aria-label":"Copy as CSV",className:"text-muted-foreground hover:text-foreground h-6 text-[10px]",type:"button",children:["Copy as CSV",o]})}),e[4]=u,e[5]=o,e[6]=l):l=e[6];let f;e[7]!==t?(f=g.jsx("div",{className:"overflow-x-auto mb-4 rounded-lg border border-border",children:g.jsx("table",{ref:n,...t,className:"min-w-full border-collapse text-sm",children:t.children})}),e[7]=t,e[8]=f):f=e[8];let d;return e[9]!==l||e[10]!==f?(d=g.jsxs(g.Fragment,{children:[l,f]}),e[9]=l,e[10]=f,e[11]=d):d=e[11],d}function X3(t){return t?Array.from(t.querySelectorAll("tr")).map(Z3).join(`
97
97
  `):""}function Z3(t){return Array.from(t.querySelectorAll("th,td")).map(K3).join(",")}function K3(t){let e=t.textContent||"";return e=e.replace(/"/g,'""'),e.search(/([",\n])/g)>=0&&(e=`"${e}"`),e}const J3=[q3],e_=[MT],t_={p:t=>g.jsx("p",{...t,className:"leading-relaxed text-sm"}),strong:t=>g.jsx("strong",{...t,className:"font-bold"}),em:t=>g.jsx("em",{...t,className:"italic"}),a:t=>g.jsx("a",{...t,target:"_blank",rel:"noopener noreferrer",className:"text-primary-dark hover:underline break-all font-medium"}),ul:t=>g.jsx("ul",{...t,className:"list-disc ml-6 my-4 space-y-2"}),ol:t=>g.jsx("ol",{...t,className:"list-decimal ml-6 my-4 space-y-2"}),li:t=>g.jsx("li",{...t,className:"leading-relaxed text-sm"}),code:t=>g.jsx("code",{...t,className:"px-1 py-0.5 bg-muted rounded text-sm font-mono break-all"}),pre:t=>g.jsx("pre",{...t,className:"flex w-full min-w-0 my-4 bg-muted rounded overflow-hidden",children:g.jsx("code",{className:"flex-1 min-w-0 p-4 text-sm font-mono whitespace-pre overflow-x-auto",children:t.children})}),table:t=>g.jsx(Q3,{...t}),thead:t=>g.jsx("thead",{...t,className:"bg-muted",children:t.children}),tr:t=>g.jsx("tr",{...t,className:"even:bg-muted/50 border-b border-border last:border-0"}),th:t=>g.jsx("th",{...t,className:"px-4 py-2 text-left font-semibold text-muted-foreground border-b border-border"}),td:t=>g.jsx("td",{...t,className:"px-4 py-2 border-b border-border"})},rd=D.memo(t=>{const e=X.c(2),{content:n}=t;let r;return e[0]!==n?(r=g.jsx(xE,{remarkPlugins:J3,rehypePlugins:e_,components:t_,children:n}),e[0]=n,e[1]=r):r=e[1],r},(t,e)=>t.content===e.content);function n_(t){const e=X.c(20),{language:n,content:r}=t,{handleCopy:i,copied:a}=nd(),s=n||"text";let u;e[0]!==s?(u=g.jsx("span",{className:"text-xs font-mono uppercase text-muted-foreground tracking-widest select-none",children:s}),e[0]=s,e[1]=u):u=e[1];let o;e[2]!==r||e[3]!==i?(o=()=>i(r),e[2]=r,e[3]=i,e[4]=o):o=e[4];let l;e[5]!==a?(l=a?g.jsx(Xt,{size:14}):g.jsx(ni,{size:14}),e[5]=a,e[6]=l):l=e[6];let f;e[7]!==o||e[8]!==l?(f=g.jsx(Mt,{size:"icon",variant:"ghost",onClick:o,"aria-label":"Copy code",className:"text-muted-foreground hover:text-foreground rounded-lg h-8 w-8",children:l}),e[7]=o,e[8]=l,e[9]=f):f=e[9];let d;e[10]!==u||e[11]!==f?(d=g.jsxs("div",{className:"flex items-center justify-between p-1 pl-4 bg-muted border-b border-border",children:[u,f]}),e[10]=u,e[11]=f,e[12]=d):d=e[12];let p;e[13]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(W3,{}),e[13]=p):p=e[13];let h;e[14]!==r||e[15]!==n?(h=g.jsx(D.Suspense,{fallback:p,children:g.jsx(V3,{language:n,content:r})}),e[14]=r,e[15]=n,e[16]=h):h=e[16];let m;return e[17]!==d||e[18]!==h?(m=g.jsxs("div",{className:"my-4 rounded-lg bg-muted overflow-hidden border border-border grid min-w-0",children:[d,h]}),e[17]=d,e[18]=h,e[19]=m):m=e[19],m}rd.displayName="MemoizedMarkdownBlock";const cs=t=>{const e=X.c(7),{id:n,text:r}=t;let i;e[0]!==r?(i=_e.lexer(r),e[0]=r,e[1]=i):i=e[1];const a=i;let s;if(e[2]!==a||e[3]!==n){let u;e[5]!==n?(u=(o,l)=>o.type==="code"?g.jsx(n_,{language:o.lang,content:o.text},`${n}-block_${l}`):g.jsx(rd,{content:o.raw},`${n}-block_${l}`),e[5]=n,e[6]=u):u=e[6],s=a.map(u),e[2]=a,e[3]=n,e[4]=s}else s=e[4];return s};cs.displayName="MemoizedMarkdown";function r_(t,e){switch(e.type){case"TOGGLE":return{isExpanded:!t.isExpanded,wasManuallyToggled:!0};case"SET_EXPANDED":return t.wasManuallyToggled?t:{...t,isExpanded:e.payload};default:return t}}function i_(t){const e=X.c(38),{part:n,id:r}=t,{state:i}=n,a=i==="streaming";let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={isExpanded:!1,wasManuallyToggled:!1},e[0]=s):s=e[0];const[u,o]=D.useReducer(r_,s),{isExpanded:l}=u;let f,d;e[1]!==a?(f=()=>{o({type:"SET_EXPANDED",payload:a})},d=[a],e[1]=a,e[2]=f,e[3]=d):(f=e[2],d=e[3]),D.useEffect(f,d);let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{o({type:"TOGGLE"})},e[4]=p):p=e[4];const h=p,m=a&&"animate-pulse";let x;e[5]!==m?(x=se("text-muted-foreground transition-opacity",m),e[5]=m,e[6]=x):x=e[6];let A;e[7]!==x?(A=g.jsx(ri,{className:x}),e[7]=x,e[8]=A):A=e[8];const b=a&&"text-shimmer";let S;e[9]!==b?(S=se("text-sm font-medium text-muted-foreground",b),e[9]=b,e[10]=S):S=e[10];let E;e[11]!==S?(E=g.jsx("span",{className:S,children:"Agent thinking"}),e[11]=S,e[12]=E):E=e[12];const w=l?"rotate-180":"";let R;e[13]!==w?(R=se("text-muted-foreground transition-transform duration-200",w),e[13]=w,e[14]=R):R=e[14];let C;e[15]!==R?(C=g.jsx(Eo,{className:R}),e[15]=R,e[16]=C):C=e[16];let O;e[17]!==E||e[18]!==C||e[19]!==A?(O=g.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-2 py-2 transition-colors cursor-pointer",children:[A,E,C]}),e[17]=E,e[18]=C,e[19]=A,e[20]=O):O=e[20];const M=l?a?"max-h-[400px] opacity-100":"max-h-[200px] opacity-80":"max-h-0 opacity-0 overflow-hidden";let z;e[21]!==M?(z=se("transition-all duration-200 ease-in-out",M),e[21]=M,e[22]=z):z=e[22];const N=a?"max-h-[400px]":"max-h-[200px]";let P;e[23]!==N?(P=se("border-l-2 pl-4 overflow-y-auto",N),e[23]=N,e[24]=P):P=e[24];let H;e[25]===Symbol.for("react.memo_cache_sentinel")?(H=se("text-muted-foreground markdown-sm pb-2"),e[25]=H):H=e[25];let J;e[26]!==r||e[27]!==n.text?(J=g.jsx("div",{className:H,children:g.jsx(cs,{id:r,text:n.text})}),e[26]=r,e[27]=n.text,e[28]=J):J=e[28];let Y;e[29]!==P||e[30]!==J?(Y=g.jsx("div",{className:P,children:J}),e[29]=P,e[30]=J,e[31]=Y):Y=e[31];let F;e[32]!==z||e[33]!==Y?(F=g.jsx("div",{className:z,children:Y}),e[32]=z,e[33]=Y,e[34]=F):F=e[34];let Z;return e[35]!==O||e[36]!==F?(Z=g.jsxs("div",{className:"flex flex-col",children:[O,F]}),e[35]=O,e[36]=F,e[37]=Z):Z=e[37],Z}function a_(){const t=X.c(3),[e,n]=D.useState(!1);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=async s=>{await navigator.clipboard.writeText(s),n(!0),setTimeout(()=>n(!1),2e3)},t[0]=r):r=t[0];const i=r;let a;return t[1]!==e?(a={handleCopy:i,copied:e},t[1]=e,t[2]=a):a=t[2],a}function id(t){const e=X.c(15),{id:n,part:r,copyable:i,extraActions:a}=t,s=i===void 0?!1:i,{handleCopy:u}=a_(),[o,l]=D.useState(!1);let f;e[0]!==u||e[1]!==r.text?(f=async()=>{await u(r.text),l(!0),setTimeout(()=>l(!1),2e3)},e[0]=u,e[1]=r.text,e[2]=f):f=e[2];const d=f,p=s||a;let h;e[3]!==n||e[4]!==r.text?(h=g.jsx(cs,{id:n,text:r.text}),e[3]=n,e[4]=r.text,e[5]=h):h=e[5];let m;e[6]!==s||e[7]!==a||e[8]!==d||e[9]!==o||e[10]!==p?(m=p&&g.jsx("div",{className:"flex w-full items-center text-xs text-muted-foreground opacity-0 pointer-events-none transition-all duration-200 group-hover/part:opacity-100 group-hover/part:pointer-events-auto mt-2",children:g.jsxs("div",{className:"flex items-center gap-1",children:[s&&g.jsx(Mt,{onClick:d,variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground size-6 whitespace-nowrap",children:o?g.jsx(Xt,{size:12}):g.jsx(ni,{size:12})}),a]})}),e[6]=s,e[7]=a,e[8]=d,e[9]=o,e[10]=p,e[11]=m):m=e[11];let x;return e[12]!==h||e[13]!==m?(x=g.jsxs("div",{className:"group/part relative",children:[h,m]}),e[12]=h,e[13]=m,e[14]=x):x=e[14],x}function s_(t){const e=X.c(28),{toolName:n,input:r,output:i,isError:a}=t;let s;if(e[0]!==i){const l=JSON.stringify(i,null,2);s=l.length>2e3?l.slice(0,2e3)+"...[TRUNCATED]":l,e[0]=i,e[1]=s}else s=e[1];const u=s;if(n==="READ_MCP_TOOLS"){const l=r?.id;if(l){let f;return e[2]!==l?(f=g.jsx(Zu,{connectionId:l}),e[2]=l,e[3]=f):f=e[3],f}}if(n==="CALL_MCP_TOOL"){const l=r?.connectionId;let f;e[4]!==l?(f=l&&g.jsx(Zu,{connectionId:l,compact:!0}),e[4]=l,e[5]=f):f=e[5];let d;e[6]!==i?(d=JSON.stringify(i,null,2),e[6]=i,e[7]=d):d=e[7];let p;e[8]!==d?(p=g.jsx("div",{className:"absolute top-1 right-1 z-10",children:g.jsx(u_,{text:d})}),e[8]=d,e[9]=p):p=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Input"}),e[10]=h):h=e[10];let m;e[11]!==r?(m=JSON.stringify(r,null,2),e[11]=r,e[12]=m):m=e[12];let x;e[13]!==m?(x=g.jsx("pre",{className:"whitespace-pre-wrap break-all text-muted-foreground mb-2",children:m}),e[13]=m,e[14]=x):x=e[14];let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=g.jsx("div",{className:"font-semibold text-muted-foreground mb-0.5 text-[10px] uppercase tracking-wider",children:"Output"}),e[15]=A):A=e[15];const b=`whitespace-pre-wrap break-all ${a?"text-destructive":"text-foreground"}`;let S;e[16]!==u||e[17]!==b?(S=g.jsx("pre",{className:b,children:u}),e[16]=u,e[17]=b,e[18]=S):S=e[18];let E;e[19]!==S||e[20]!==p||e[21]!==x?(E=g.jsxs("div",{className:"relative bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:[p,h,x,A,S]}),e[19]=S,e[20]=p,e[21]=x,e[22]=E):E=e[22];let w;return e[23]!==E||e[24]!==f?(w=g.jsxs("div",{className:"flex flex-col gap-2",children:[f,E]}),e[23]=E,e[24]=f,e[25]=w):w=e[25],w}let o;return e[26]!==u?(o=g.jsx("div",{className:"bg-muted rounded-md p-2 text-xs font-mono overflow-auto max-h-[200px]",children:g.jsx("pre",{className:"whitespace-pre-wrap break-all",children:u})}),e[26]=u,e[27]=o):o=e[27],o}function Zu(t){const e=X.c(15),{connectionId:n,compact:r}=t,i=Qd(n),{org:a}=Cn(),{slug:s}=a,u=jd();if(!i)return null;let o;e[0]!==i.id||e[1]!==u||e[2]!==s?(o=()=>{u({to:"/$org/mcps/$connectionId",params:{org:s,connectionId:i.id}})},e[0]=i.id,e[1]=u,e[2]=s,e[3]=o):o=e[3];const l=o;if(r){let d;e[4]!==i.title?(d=g.jsx("span",{className:"font-medium text-foreground",children:i.title}),e[4]=i.title,e[5]=d):d=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g.jsx(df,{size:12}),e[6]=p):p=e[6];let h;e[7]!==l?(h=g.jsx("button",{type:"button",onClick:l,className:"hover:text-foreground transition-colors",title:"Open connection",children:p}),e[7]=l,e[8]=h):h=e[8];let m;return e[9]!==d||e[10]!==h?(m=g.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/50 px-2 py-1 rounded-md w-fit",children:[d,h]}),e[9]=d,e[10]=h,e[11]=m):m=e[11],m}let f;return e[12]!==i||e[13]!==l?(f=g.jsx(cf,{connection:i,onClick:l}),e[12]=i,e[13]=l,e[14]=f):f=e[14],f}function u_({text:t}){const e=async()=>{try{if(navigator.clipboard)await navigator.clipboard.writeText(t),vr.success("Copied to clipboard");else throw new Error("Clipboard API unavailable")}catch(n){try{const r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const i=document.execCommand("copy");if(document.body.removeChild(r),i)vr.success("Copied to clipboard");else throw new Error("Fallback copy failed")}catch(r){console.error("Copy failed",n,r),vr.error("Failed to copy to clipboard")}}};return g.jsx(Mt,{size:"icon",variant:"ghost",className:"h-5 w-5 hover:bg-background/50",onClick:e,children:g.jsx(ni,{size:12})})}function Ku(t){const e=X.c(39),{part:n}=t,{state:r}=n;let i;e[0]!==n?(i="toolName"in n?n.toolName:n.type.replace("tool-",""),e[0]=n,e[1]=i):i=e[1];const a=i;let s;e[2]!==r?(s=r==="output-error"?g.jsx(of,{className:"h-3.5 w-3.5 text-destructive"}):g.jsx(lf,{className:"h-3.5 w-3.5"}),e[2]=r,e[3]=s):s=e[3];const u=r==="output-error"&&"text-destructive/90";let o;e[4]!==u?(o=se(u),e[4]=u,e[5]=o):o=e[5];const l=r==="input-streaming"&&`Streaming ${a} arguments`,f=r==="input-available"&&`Calling ${a}`,d=r==="output-available"&&`Called ${a}`,p=r==="output-error"&&`Error calling ${a}`;let h;e[6]!==o||e[7]!==l||e[8]!==f||e[9]!==d||e[10]!==p?(h=g.jsxs("span",{className:o,children:[l,f,d,p]}),e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h):h=e[11];let m;e[12]!==r?(m=(r==="input-streaming"||r==="input-available")&&g.jsx("span",{className:"animate-spin",children:g.jsx(ff,{size:"xs"})}),e[12]=r,e[13]=m):m=e[13];let x;e[14]!==m||e[15]!==s||e[16]!==h?(x=g.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[s,h,m]}),e[14]=m,e[15]=s,e[16]=h,e[17]=x):x=e[17];const A=r==="output-error"?"border-destructive/50":"border-border";let b;e[18]!==A?(b=se("transition-all duration-200 ease-in-out","border-l-2 pl-3",A),e[18]=A,e[19]=b):b=e[19];let S;e[20]!==n.input||e[21]!==r?(S=(r==="input-streaming"||r==="input-available")&&!!n.input&&g.jsx("div",{className:"text-xs font-mono text-muted-foreground bg-muted/30 p-2 rounded",children:JSON.stringify(n.input,null,2)}),e[20]=n.input,e[21]=r,e[22]=S):S=e[22];let E;e[23]!==n.input||e[24]!==n.output||e[25]!==r||e[26]!==a?(E=r==="output-available"&&g.jsx(s_,{toolName:a,input:n.input,output:n.output}),e[23]=n.input,e[24]=n.output,e[25]=r,e[26]=a,e[27]=E):E=e[27];let w;e[28]!==n||e[29]!==r?(w=r==="output-error"&&g.jsx("div",{className:"text-xs font-mono bg-destructive/10 text-destructive p-2 rounded border border-destructive/20",children:"errorText"in n&&typeof n.errorText=="string"?n.errorText:"An unknown error occurred"}),e[28]=n,e[29]=r,e[30]=w):w=e[30];let R;e[31]!==b||e[32]!==S||e[33]!==E||e[34]!==w?(R=g.jsxs("div",{className:b,children:[S,E,w]}),e[31]=b,e[32]=S,e[33]=E,e[34]=w,e[35]=R):R=e[35];let C;return e[36]!==x||e[37]!==R?(C=g.jsxs("div",{className:"flex flex-col gap-1.5 py-1",children:[x,R]}),e[36]=x,e[37]=R,e[38]=C):C=e[38],C}const o_={openrouter:t=>{const e=t?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function l_(t){if(!t?.providerMetadata)return null;for(const e of Object.values(o_)){const n=e(t.providerMetadata);if(n!==null)return n}return null}function c_(t){return t.reduce((e,n)=>{const r=n.metadata?.usage;return r?{inputTokens:e.inputTokens+(r.inputTokens??0),outputTokens:e.outputTokens+(r.outputTokens??0),totalTokens:e.totalTokens+(r.totalTokens??0),cost:e.cost+(l_(r)??0)}:e},{inputTokens:0,outputTokens:0,totalTokens:0,cost:0})}function ad(t){const e=X.c(38),{messages:n}=t;let r,i,a,s,u,o,l,f,d,p,h,m;if(e[0]!==n){m=Symbol.for("react.early_return_sentinel");e:{const w=c_(n);if(!w){m=null;break e}const{totalTokens:R,inputTokens:C,outputTokens:O,cost:M}=w;if(a=M,!R&&!C&&!O){m=null;break e}i=fo;let z;e[13]===Symbol.for("react.memo_cache_sentinel")?(z=g.jsx(bo,{size:12}),e[13]=z):z=e[13];const N=g.jsxs(Mt,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground pl-1! h-6 gap-1 whitespace-nowrap",children:[z,g.jsx("span",{className:"text-[10px] font-mono tabular-nums",children:R.toLocaleString()})]});e[14]!==N?(h=g.jsx(ho,{asChild:!0,children:N}),e[14]=N,e[15]=h):h=e[15],r=po,d="top",p="font-mono text-[11px]",u="grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5",e[16]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("span",{className:"text-muted",children:"in"}),e[16]=o):o=e[16],l=g.jsx("span",{children:C.toLocaleString()}),e[17]===Symbol.for("react.memo_cache_sentinel")?(f=g.jsx("span",{className:"text-muted",children:"out"}),e[17]=f):f=e[17],s=O.toLocaleString()}e[0]=n,e[1]=r,e[2]=i,e[3]=a,e[4]=s,e[5]=u,e[6]=o,e[7]=l,e[8]=f,e[9]=d,e[10]=p,e[11]=h,e[12]=m}else r=e[1],i=e[2],a=e[3],s=e[4],u=e[5],o=e[6],l=e[7],f=e[8],d=e[9],p=e[10],h=e[11],m=e[12];if(m!==Symbol.for("react.early_return_sentinel"))return m;let x;e[18]!==s?(x=g.jsx("span",{children:s}),e[18]=s,e[19]=x):x=e[19];let A;e[20]!==a?(A=a>0&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"text-muted",children:"cost"}),g.jsxs("span",{children:["$",a.toFixed(4)]})]}),e[20]=a,e[21]=A):A=e[21];let b;e[22]!==x||e[23]!==A||e[24]!==u||e[25]!==o||e[26]!==l||e[27]!==f?(b=g.jsxs("div",{className:u,children:[o,l,f,x,A]}),e[22]=x,e[23]=A,e[24]=u,e[25]=o,e[26]=l,e[27]=f,e[28]=b):b=e[28];let S;e[29]!==r||e[30]!==b||e[31]!==d||e[32]!==p?(S=g.jsx(r,{side:d,className:p,children:b}),e[29]=r,e[30]=b,e[31]=d,e[32]=p,e[33]=S):S=e[33];let E;return e[34]!==i||e[35]!==S||e[36]!==h?(E=g.jsxs(i,{children:[h,S]}),e[34]=i,e[35]=S,e[36]=h,e[37]=E):E=e[37],E}const d_={planning:{icon:g.jsx(So,{className:"text-muted-foreground animate-pulse",size:20}),label:"Planning next moves"},thinking:{icon:g.jsx(ri,{className:"text-muted-foreground animate-pulse",size:20}),label:"Thinking"}},f_=1200;function h_(){const t=X.c(7),[e,n]=D.useState("planning");let r,i;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const o=setTimeout(()=>{n("thinking")},f_);return()=>{clearTimeout(o)}},i=[],t[0]=r,t[1]=i):(r=t[0],i=t[1]),D.useEffect(r,i);const a=d_[e];let s;t[2]!==a.label?(s=g.jsxs("span",{className:"text-sm font-medium text-muted-foreground text-shimmer",children:[a.label,"..."]}),t[2]=a.label,t[3]=s):s=t[3];let u;return t[4]!==a.icon||t[5]!==s?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2",children:[a.icon,s]}),t[4]=a.icon,t[5]=s,t[6]=u):u=t[6],u}function p_(t){const e=X.c(5),{duration:n}=t,r=n/1e3;let i;e[0]!==r?(i=r.toFixed(1),e[0]=r,e[1]=i):i=e[1];const a=i;let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx(yo,{className:"text-muted-foreground",size:16}),e[2]=s):s=e[2];let u;return e[3]!==a?(u=g.jsxs("div",{className:"flex items-center gap-2 py-2 opacity-60",children:[s,g.jsxs("span",{className:"text-xs text-muted-foreground",children:["Thought · ",a,"s"]})]}),e[3]=a,e[4]=u):u=e[4],u}function m_(t){const e=X.c(13),{part:n,id:r,usageStats:i}=t;switch(n.type){case"dynamic-tool":{let a;return e[0]!==r||e[1]!==n?(a=g.jsx(Ku,{part:n,id:r}),e[0]=r,e[1]=n,e[2]=a):a=e[2],a}case"text":{let a;return e[3]!==r||e[4]!==n||e[5]!==i?(a=g.jsx(id,{id:r,part:n,extraActions:i,copyable:!0}),e[3]=r,e[4]=n,e[5]=i,e[6]=a):a=e[6],a}case"reasoning":{let a;return e[7]!==r||e[8]!==n?(a=g.jsx(i_,{part:n,id:r}),e[7]=r,e[8]=n,e[9]=a):a=e[9],a}case"step-start":case"file":case"source-url":case"source-document":return null;default:if(n.type.startsWith("tool-")){const a=n;let s;return e[10]!==r||e[11]!==a?(s=g.jsx(Ku,{part:a,id:r}),e[10]=r,e[11]=a,e[12]=s):s=e[12],s}}throw new Error(`Unknown part type: ${n.type}`)}function g_(t){const e=X.c(27),{message:n,status:r,className:i}=t,{id:a,parts:s}=n,l=r==="streaming"||r==="submitted",f=D.useRef(null);let d;e[0]!==a?(d=()=>{const N=localStorage.getItem(`msg-duration-${a}`);return N?Number(N):null},e[0]=a,e[1]=d):d=e[1];const[p,h]=D.useState(d);let m,x;e[2]!==l?(m=()=>{l&&f.current===null&&(f.current=Date.now())},x=[l],e[2]=l,e[3]=m,e[4]=x):(m=e[3],x=e[4]),D.useEffect(m,x);let A,b;e[5]!==p||e[6]!==a||e[7]!==s.length?(A=()=>{if(s.length>0&&p===null&&f.current!==null){const N=Date.now()-f.current;h(N),localStorage.setItem(`msg-duration-${a}`,N.toString())}},b=[s.length,p,a],e[5]=p,e[6]=a,e[7]=s.length,e[8]=A,e[9]=b):(A=e[8],b=e[9]),D.useEffect(A,b);const S=s.length>0,E=S&&!l&&p!==null;let w;e[10]!==n?(w=g.jsx(ad,{messages:[n]}),e[10]=n,e[11]=w):w=e[11];const R=w;let C;e[12]!==i?(C=se("w-full min-w-0 group relative flex items-start gap-4 px-4 z-20 text-foreground flex-row",i),e[12]=i,e[13]=C):C=e[13];let O;e[14]!==p||e[15]!==S||e[16]!==a||e[17]!==l||e[18]!==s||e[19]!==E||e[20]!==R?(O=S?g.jsxs(g.Fragment,{children:[E&&g.jsx(p_,{duration:p}),s.map((N,P)=>g.jsx(m_,{part:N,id:a,usageStats:P===s.length-1?R:void 0},`${a}-${P}`))]}):l?g.jsx(h_,{}):null,e[14]=p,e[15]=S,e[16]=a,e[17]=l,e[18]=s,e[19]=E,e[20]=R,e[21]=O):O=e[21];let M;e[22]!==O?(M=g.jsx("div",{className:"flex flex-col gap-2 min-w-0 w-full items-start",children:g.jsx("div",{className:"w-full min-w-0 not-only:rounded-2xl text-sm wrap-break-word overflow-wrap-anywhere bg-transparent",children:O})}),e[22]=O,e[23]=M):M=e[23];let z;return e[24]!==C||e[25]!==M?(z=g.jsx("div",{className:C,children:M}),e[24]=C,e[25]=M,e[26]=z):z=e[26],z}const sd=D.createContext(null);function ud(t){const e=X.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function E_(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(!D.isValidElement(r))continue;if(r.props?.message?.role==="assistant"){const a=t[n-1],s=D.isValidElement(a)&&a.props?.message?.role,u=a&&D.isValidElement(a)&&s==="user"?a:null;e.push({user:u,assistant:r})}}return e}function b_(t){const e=X.c(27),{children:n,className:r,minHeightOffset:i}=t,a=D.useRef(null);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],e[0]=s):s=e[0];const u=D.useRef(s);let o,l,f,d,p,h,m;if(e[1]!==n||e[2]!==r||e[3]!==i){const S=D.Children.toArray(n),E=S[S.length-1];l=E&&D.isValidElement(E)&&E.type===ud?E:null;const w=l?S.slice(0,-1):S,R=E_(w);let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{const z=u.current[M];if(z&&a.current){const N=a.current.offsetTop,P=z.offsetTop;a.current.scrollTo({top:P-N,behavior:"smooth"})}},e[11]=C):C=e[11];const O=C;o=sd.Provider,e[12]===Symbol.for("react.memo_cache_sentinel")?(m={scrollToPair:O},e[12]=m):m=e[12],p=a,e[13]!==r?(h=se("w-full min-w-0 max-w-full overflow-y-auto h-full overflow-x-hidden",r),e[13]=r,e[14]=h):h=e[14],f="flex flex-col min-w-0 max-w-2xl mx-auto w-full",d=R.map((M,z)=>{const N=z===R.length-1;return g.jsxs("div",{ref:P=>{u.current[z]=P},className:"flex flex-col gap-2 pb-2",style:N&&i?{minHeight:`calc(100vh - ${i}px)`}:void 0,children:[g.jsx("div",{className:"sticky top-0 z-50 bg-background w-full h-4"}),g.jsx("div",{className:"sticky top-4 z-50",children:M.user&&D.isValidElement(M.user)?D.cloneElement(M.user,{pairIndex:z}):M.user}),M.assistant]},z)}),e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=l,e[6]=f,e[7]=d,e[8]=p,e[9]=h,e[10]=m}else o=e[4],l=e[5],f=e[6],d=e[7],p=e[8],h=e[9],m=e[10];let x;e[15]!==l||e[16]!==f||e[17]!==d?(x=g.jsxs("div",{className:f,children:[d,l]}),e[15]=l,e[16]=f,e[17]=d,e[18]=x):x=e[18];let A;e[19]!==p||e[20]!==h||e[21]!==x?(A=g.jsx("div",{ref:p,className:h,children:x}),e[19]=p,e[20]=h,e[21]=x,e[22]=A):A=e[22];let b;return e[23]!==o||e[24]!==m||e[25]!==A?(b=g.jsx(o,{value:m,children:A}),e[23]=o,e[24]=m,e[25]=A,e[26]=b):b=e[26],b}function T_(t){const e=X.c(29),{message:n,className:r,pairIndex:i}=t,{id:a,parts:s}=n,u=D.useRef(null),o=D.useContext(sd),[l,f]=D.useState(!1);if(!s||s.length===0)return null;const p=s.reduce(x_,0)>60;let h;e[0]!==o||e[1]!==i?(h=()=>{i!==void 0&&o?.scrollToPair(i)},e[0]=o,e[1]=i,e[2]=h):h=e[2];const m=h;let x;e[3]!==r?(x=se("message-block w-full min-w-0 group relative flex items-start gap-4 px-2 text-foreground flex-row-reverse",r),e[3]=r,e[4]=x):x=e[4];const A=p&&!l&&"overflow-hidden relative max-h-[60px]";let b;e[5]!==A?(b=se(A),e[5]=A,e[6]=b):b=e[6];let S;if(e[7]!==a||e[8]!==s){let M;e[10]!==a?(M=(z,N)=>z.type==="text"?g.jsx(id,{id:a,part:z},`${a}-${N}`):null,e[10]=a,e[11]=M):M=e[11],S=s.map(M),e[7]=a,e[8]=s,e[9]=S}else S=e[9];let E;e[12]!==l||e[13]!==p?(E=p&&!l&&g.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-12 bg-linear-to-t from-muted to-transparent pointer-events-none"}),e[12]=l,e[13]=p,e[14]=E):E=e[14];let w;e[15]!==b||e[16]!==S||e[17]!==E?(w=g.jsxs("div",{className:b,children:[S,E]}),e[15]=b,e[16]=S,e[17]=E,e[18]=w):w=e[18];let R;e[19]!==l||e[20]!==p?(R=p&&g.jsx("div",{className:"flex justify-center",children:g.jsx(Mt,{onClick:M=>{M.stopPropagation(),f(!l)},variant:"ghost",size:"xs",className:"text-xs w-full text-muted-foreground hover:text-foreground",children:l?g.jsx(af,{className:"text-sm"}):g.jsx(Eo,{className:"text-sm"})})}),e[19]=l,e[20]=p,e[21]=R):R=e[21];let C;e[22]!==m||e[23]!==w||e[24]!==R?(C=g.jsxs("div",{onClick:m,className:"w-full border min-w-0 shadow-[0_3px_6px_-1px_rgba(0,0,0,0.1)] rounded-lg text-[0.9375rem] wrap-break-word overflow-wrap-anywhere bg-muted px-4 py-2 cursor-pointer transition-colors",children:[w,R]}),e[22]=m,e[23]=w,e[24]=R,e[25]=C):C=e[25];let O;return e[26]!==x||e[27]!==C?(O=g.jsxs("div",{ref:u,className:x,children:[" ",C]}),e[26]=x,e[27]=C,e[28]=O):O=e[28],O}function x_(t,e){return e.type==="text"?t+e.text.length:t}function __(t,e){const n=X.c(4);let r;n[0]!==e?(r={},n[0]=e,n[1]=r):r=n[1];const i=r,a=t??Xd;let s;return n[2]!==a?(s=Kd(a),n[2]=a,n[3]=s):s=n[3],Zd(a,"LLM",s,i)}function y_(){const t=X.c(8),e=Jd();let n;t[0]!==e?(n={connections:e,binding:"LLMS"},t[0]=e,t[1]=n):n=t[1];const[r]=qd(n),i=__(r?.id);if(!i||!r){let s;return t[2]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[2]=s):s=t[2],s}let a;if(t[3]!==r||t[4]!==i){let s;t[6]!==r?(s=u=>({...u,name:u.title,contextWindow:u.limits?.contextWindow,outputLimit:u.limits?.maxOutputTokens,inputCost:u.costs?.input,outputCost:u.costs?.output,provider:u.provider,connectionId:r.id,connectionName:r.title}),t[6]=r,t[7]=s):s=t[7],a=i.map(s).sort(A_),t[3]=r,t[4]=i,t[5]=a}else a=t[5];return a}function A_(t,e){return t.name.localeCompare(e.name)}const C_={reasoning:{icon:g.jsx(ri,{className:"size-4"}),bg:"bg-purple-100",text:"text-purple-700",label:"Reasoning"},"image-upload":{icon:g.jsx(_o,{className:"size-4"}),bg:"bg-teal-100",text:"text-teal-700",label:"Can analyze images"},"file-upload":{icon:g.jsx(hf,{className:"size-4"}),bg:"bg-blue-100",text:"text-blue-700",label:"Can analyze files"},"web-search":{icon:g.jsx(mo,{className:"size-4"}),bg:"bg-amber-100",text:"text-amber-700",label:"Can search the web to answer questions"}},od=D.memo(function(e){const n=X.c(11),{capability:r}=e,i=C_[r];let a;n[0]!==r||n[1]!==i?(a=i||{icon:g.jsx(Xt,{className:"size-4"}),bg:"bg-slate-200",text:"text-slate-700",label:r},n[0]=r,n[1]=i,n[2]=a):a=n[2];const s=a,u=`flex items-center justify-center h-6 w-6 rounded-sm ${s.bg} ${s.text}`;let o;n[3]!==s.icon||n[4]!==u?(o=g.jsx(ho,{asChild:!0,children:g.jsx("div",{className:u,children:s.icon})}),n[3]=s.icon,n[4]=u,n[5]=o):o=n[5];let l;n[6]!==s.label?(l=g.jsx(po,{children:g.jsx("p",{children:s.label})}),n[6]=s.label,n[7]=l):l=n[7];let f;return n[8]!==o||n[9]!==l?(f=g.jsxs(fo,{children:[o,l]}),n[8]=o,n[9]=l,n[10]=f):f=n[10],f}),Ju=D.memo(function(e){const n=X.c(54),{model:r,compact:i}=e,a=i===void 0?!1:i;if(!r){let b;return n[0]===Symbol.for("react.memo_cache_sentinel")?(b=g.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Hover to preview"}),n[0]=b):b=n[0],b}const s=r.contextWindow||r.inputCost||r.outputCost||r.outputLimit;if(!s&&!a){let b;n[1]!==r.logo||n[2]!==r.name?(b=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[1]=r.logo,n[2]=r.name,n[3]=b):b=n[3];let S;n[4]!==r.name?(S=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[4]=r.name,n[5]=S):S=n[5];let E;n[6]!==b||n[7]!==S?(E=g.jsxs("div",{className:"flex items-center gap-3 py-2 px-0",children:[b,S]}),n[6]=b,n[7]=S,n[8]=E):E=n[8];let w;n[9]!==r.description?(w=r.description&&g.jsx("p",{className:"text-sm text-muted-foreground",children:r.description}),n[9]=r.description,n[10]=w):w=n[10];let R;return n[11]!==E||n[12]!==w?(R=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[E,w]}),n[11]=E,n[12]=w,n[13]=R):R=n[13],R}if(!s&&a)return null;if(a){let b;n[14]!==r.contextWindow?(b=r.contextWindow&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Context"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[14]=r.contextWindow,n[15]=b):b=n[15];let S;n[16]!==r.inputCost?(S=r.inputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Input cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.inputCost.toFixed(2)," / 1M"]})]}),n[16]=r.inputCost,n[17]=S):S=n[17];let E;n[18]!==r.outputCost?(E=r.outputCost&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output cost"}),g.jsxs("span",{className:"text-foreground font-medium",children:["$",r.outputCost.toFixed(2)," / 1M"]})]}),n[18]=r.outputCost,n[19]=E):E=n[19];let w;n[20]!==r.outputLimit?(w=r.outputLimit&&g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:"Output limit"}),g.jsxs("span",{className:"text-foreground font-medium",children:[r.outputLimit.toLocaleString()," tokens"]})]}),n[20]=r.outputLimit,n[21]=w):w=n[21];let R;return n[22]!==b||n[23]!==S||n[24]!==E||n[25]!==w?(R=g.jsxs("div",{className:"flex flex-col gap-2.5 pt-3 pb-3 px-3 rounded-b-xl text-xs",children:[b,S,E,w]}),n[22]=b,n[23]=S,n[24]=E,n[25]=w,n[26]=R):R=n[26],R}let u;n[27]!==r.logo||n[28]!==r.name?(u=r.logo&&g.jsx("img",{src:r.logo,className:"w-6 h-6",alt:r.name}),n[27]=r.logo,n[28]=r.name,n[29]=u):u=n[29];let o;n[30]!==r.name?(o=g.jsx("p",{className:"text-lg font-medium leading-7",children:r.name}),n[30]=r.name,n[31]=o):o=n[31];let l;n[32]!==u||n[33]!==o?(l=g.jsxs("div",{className:"flex items-center gap-3",children:[u,o]}),n[32]=u,n[33]=o,n[34]=l):l=n[34];let f;n[35]!==r.capabilities?(f=r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"flex items-center gap-2",children:r.capabilities.map(N_)}),n[35]=r.capabilities,n[36]=f):f=n[36];let d;n[37]!==l||n[38]!==f?(d=g.jsxs("div",{className:"flex flex-col gap-3 py-2 px-0",children:[l,f]}),n[37]=l,n[38]=f,n[39]=d):d=n[39];let p;n[40]!==r.contextWindow?(p=r.contextWindow&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Wd,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Context window"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.contextWindow.toLocaleString()," tokens"]})]}),n[40]=r.contextWindow,n[41]=p):p=n[41];let h;n[42]!==r.inputCost||n[43]!==r.outputCost?(h=(r.inputCost||r.outputCost)&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(To,{className:"w-3.5 h-3.5 text-muted-foreground"}),g.jsx("p",{className:"text-sm text-foreground",children:"Costs"})]}),g.jsxs("div",{className:"flex flex-col gap-0.5",children:[r.inputCost!==null&&r.inputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.inputCost.toFixed(2)," / 1M tokens (input)"]}),r.outputCost!==null&&r.outputCost!==void 0&&g.jsxs("p",{className:"text-sm text-muted-foreground",children:["$",r.outputCost.toFixed(2)," / 1M tokens (output)"]})]})]}),n[42]=r.inputCost,n[43]=r.outputCost,n[44]=h):h=n[44];let m;n[45]!==r.outputLimit?(m=r.outputLimit&&g.jsxs("div",{className:"flex flex-col gap-1.5",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(Ao,{className:"w-4.5 h-4.5 text-muted-foreground/70"}),g.jsx("p",{className:"text-sm text-foreground",children:"Output limit"})]}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.outputLimit.toLocaleString()," token limit"]})]}),n[45]=r.outputLimit,n[46]=m):m=n[46];let x;n[47]!==p||n[48]!==h||n[49]!==m?(x=g.jsxs("div",{className:"flex flex-col gap-4",children:[p,h,m]}),n[47]=p,n[48]=h,n[49]=m,n[50]=x):x=n[50];let A;return n[51]!==x||n[52]!==d?(A=g.jsxs("div",{className:"flex flex-col gap-3 py-1 px-1.5",children:[d,x]}),n[51]=x,n[52]=d,n[53]=A):A=n[53],A}),k_=D.memo(function(e){const n=X.c(27),{model:r,onHover:i,isSelected:a,hasExpandedInfo:s}=e,u=s?"rounded-t-xl":"rounded-xl";let o;n[0]!==u?(o=se("flex items-center gap-2 h-10 py-4 px-3 hover:bg-accent cursor-pointer",u),n[0]=u,n[1]=o):o=n[1];let l;n[2]!==r||n[3]!==i?(l=()=>i(r),n[2]=r,n[3]=i,n[4]=l):l=n[4];let f;n[5]!==r.logo||n[6]!==r.name?(f=r.logo&&g.jsx("img",{src:r.logo,className:"w-5 h-5 shrink-0",alt:r.name}),n[5]=r.logo,n[6]=r.name,n[7]=f):f=n[7];let d;n[8]!==r.name?(d=g.jsx("span",{className:"text-sm text-foreground",children:r.name}),n[8]=r.name,n[9]=d):d=n[9];let p;n[10]!==s||n[11]!==r.capabilities?(p=s&&r.capabilities&&r.capabilities.length>0&&g.jsx("div",{className:"md:hidden flex items-center gap-1.5 ml-auto",children:r.capabilities.map(w_)}),n[10]=s,n[11]=r.capabilities,n[12]=p):p=n[12];let h;n[13]!==s||n[14]!==a?(h=a&&!s&&g.jsx(Xt,{className:"w-4 h-4 text-foreground ml-auto"}),n[13]=s,n[14]=a,n[15]=h):h=n[15];let m;n[16]!==s||n[17]!==a?(m=a&&s&&g.jsx(Xt,{className:"w-4 h-4 text-foreground ml-2 shrink-0"}),n[16]=s,n[17]=a,n[18]=m):m=n[18];let x;return n[19]!==o||n[20]!==l||n[21]!==f||n[22]!==d||n[23]!==p||n[24]!==h||n[25]!==m?(x=g.jsxs("div",{className:o,onMouseEnter:l,children:[f,d,p,h,m]}),n[19]=o,n[20]=l,n[21]=f,n[22]=d,n[23]=p,n[24]=h,n[25]=m,n[26]=x):x=n[26],x});function S_(t){const e=X.c(9),{model:n}=t;if(!n){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("span",{className:"text-sm text-muted-foreground",children:"Select model"}),e[0]=s):s=e[0],s}let r;e[1]!==n.logo||e[2]!==n.name?(r=n.logo&&g.jsx("img",{src:n.logo,className:"w-4 h-4",alt:n.name}),e[1]=n.logo,e[2]=n.name,e[3]=r):r=e[3];let i;e[4]!==n.name?(i=g.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:n.name}),e[4]=n.name,e[5]=i):i=e[5];let a;return e[6]!==r||e[7]!==i?(a=g.jsxs("div",{className:"flex items-center gap-2",children:[r,i]}),e[6]=r,e[7]=i,e[8]=a):a=e[8],a}function I_(t){const e=X.c(57),{selectedModel:n,onModelChange:r,variant:i,className:a,placeholder:s}=t,u=i===void 0?"borderless":i,o=s===void 0?"Select model":s,[l,f]=D.useState(!1),[d,p]=D.useState(null),[h,m]=D.useState(!1),x=y_();let A;e[0]!==x||e[1]!==n?(A=n?x.find(V=>V.id===n.id&&V.connectionId===n.connectionId)?.id:void 0,e[0]=x,e[1]=n,e[2]=A):A=e[2];const b=A;let S;if(e[3]!==x||e[4]!==b){let V;e[6]!==b?(V=Q=>Q.id===b,e[6]=b,e[7]=V):V=e[7],S=x.find(V),e[3]=x,e[4]=b,e[5]=S}else S=e[5];const E=S;let w;e[8]!==x||e[9]!==r?(w=V=>{const Q=x.find(G=>G.id===V);Q&&(r({id:Q.id,connectionId:Q.connectionId,provider:Q.provider??void 0}),f(!1))},e[8]=x,e[9]=r,e[10]=w):w=e[10];const R=w;if(x.length===0)return null;const C=b||"",O=u==="borderless"&&"md:border-none";let M;e[11]!==a||e[12]!==O?(M=se("h-8! text-sm hover:bg-accent rounded-lg py-1 px-2 gap-1 shadow-none cursor-pointer border-0 group focus-visible:ring-0 focus-visible:ring-offset-0",O,a),e[11]=a,e[12]=O,e[13]=M):M=e[13];let z;e[14]!==E?(z=g.jsx(S_,{model:E}),e[14]=E,e[15]=z):z=e[15];let N;e[16]!==o||e[17]!==z?(N=g.jsx(rl,{placeholder:o,children:z}),e[16]=o,e[17]=z,e[18]=N):N=e[18];let P;e[19]!==N||e[20]!==M?(P=g.jsx(nl,{className:M,children:N}),e[19]=N,e[20]=M,e[21]=P):P=e[21];let H;e[22]!==h?(H=()=>m(!h),e[22]=h,e[23]=H):H=e[23];const J=h?"text-foreground":"text-muted-foreground";let Y;e[24]!==J?(Y=se("w-5 h-5 transition-colors",J),e[24]=J,e[25]=Y):Y=e[25];let F;e[26]!==Y?(F=g.jsx(pf,{className:Y}),e[26]=Y,e[27]=F):F=e[27];let Z;e[28]!==H||e[29]!==F?(Z=g.jsx("button",{type:"button",onClick:H,className:"md:hidden flex items-center justify-center h-8 w-8 rounded-lg hover:bg-accent transition-colors","aria-label":"Toggle model info",children:F}),e[28]=H,e[29]=F,e[30]=Z):Z=e[30];let re;if(e[31]!==R||e[32]!==x||e[33]!==b||e[34]!==h){let V;e[36]!==R||e[37]!==b||e[38]!==h?(V=Q=>g.jsxs("div",{onClick:()=>R(Q.id),className:se("rounded-xl mb-1",Q.id===b&&"bg-accent"),children:[g.jsx(k_,{model:Q,onHover:p,isSelected:Q.id===b,hasExpandedInfo:h}),h&&g.jsx("div",{className:"md:hidden",children:g.jsx(Ju,{model:Q,compact:!0})})]},Q.id),e[36]=R,e[37]=b,e[38]=h,e[39]=V):V=e[39],re=x.map(V),e[31]=R,e[32]=x,e[33]=b,e[34]=h,e[35]=re}else re=e[35];let fe;e[40]!==re?(fe=g.jsx("div",{className:"flex-1 overflow-y-auto px-0.5 md:border-r",children:re}),e[40]=re,e[41]=fe):fe=e[41];const Ae=d||E||null;let I;e[42]!==Ae?(I=g.jsx("div",{className:"hidden md:block md:w-[300px] p-3",children:g.jsx(Ju,{model:Ae})}),e[42]=Ae,e[43]=I):I=e[43];let Ee;e[44]!==fe||e[45]!==I?(Ee=g.jsxs("div",{className:"flex flex-col md:flex-row h-[350px]",children:[fe,I]}),e[44]=fe,e[45]=I,e[46]=Ee):Ee=e[46];let be;e[47]!==o||e[48]!==Z||e[49]!==Ee?(be=g.jsx(tl,{title:o,className:"w-full md:w-auto md:min-w-[600px] [&_button[aria-label='Scroll down']]:!hidden [&_button[aria-label='Scroll up']]:!hidden",headerActions:Z,children:Ee}),e[47]=o,e[48]=Z,e[49]=Ee,e[50]=be):be=e[50];let _;return e[51]!==R||e[52]!==l||e[53]!==P||e[54]!==be||e[55]!==C?(_=g.jsxs(el,{open:l,onOpenChange:f,value:C,onValueChange:R,children:[P,be]}),e[51]=R,e[52]=l,e[53]=P,e[54]=be,e[55]=C,e[56]=_):_=e[56],_}function N_(t){return g.jsx(od,{capability:t},t)}function w_(t){return g.jsx(od,{capability:t},t)}function R_({messageCount:t,sentinelRef:e}){const n=D.useRef(t),r=D.useRef(0);t>n.current&&r.current!==t&&queueMicrotask(()=>{e.current?.scrollIntoView({behavior:"smooth",block:"start"}),r.current=t}),n.current=t}function Jr(t,e){const n=D.Children.toArray(t);for(const r of n)if(D.isValidElement(r)&&r.type===e)return r;return null}function L_(t,e){return D.Children.toArray(t).filter(n=>D.isValidElement(n)?!e.includes(n.type):!0)}function O_(t){const e=X.c(5),{className:n,children:r}=t;let i;e[0]!==n?(i=se("h-full",n),e[0]=n,e[1]=i):i=e[1];let a;return e[2]!==r||e[3]!==i?(a=g.jsx(si,{className:i,children:r}),e[2]=r,e[3]=i,e[4]=a):a=e[4],a}function v_(t){const e=X.c(11),{children:n}=t;let r;e[0]!==n?(r=Jr(n,ld),e[0]=n,e[1]=r):r=e[1];const i=r;let a;e[2]!==n?(a=Jr(n,cd),e[2]=n,e[3]=a):a=e[3];const s=a,u=i?.props.children;let o;e[4]!==u?(o=g.jsx("div",{className:"flex items-center gap-2",children:u}),e[4]=u,e[5]=o):o=e[5];const l=s?.props.children;let f;e[6]!==l?(f=g.jsx("div",{className:"flex items-center gap-1",children:l}),e[6]=l,e[7]=f):f=e[7];let d;return e[8]!==o||e[9]!==f?(d=g.jsxs(si.Header,{children:[o,f]}),e[8]=o,e[9]=f,e[10]=d):d=e[10],d}function ld(t){const e=X.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function cd(t){const e=X.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(g.Fragment,{children:n}),e[0]=n,e[1]=r):r=e[1],r}function D_(t){const e=X.c(3),{children:n,className:r}=t;let i;return e[0]!==n||e[1]!==r?(i=g.jsx(si.Content,{className:r,children:n}),e[0]=n,e[1]=r,e[2]=i):i=e[2],i}function P_(t){const e=X.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx("div",{className:"h-full w-full flex items-center justify-center max-w-2xl mx-auto",children:n}),e[0]=n,e[1]=r):r=e[1],r}function M_(t){const e=X.c(12),{messages:n,status:r,minHeightOffset:i}=t,a=i===void 0?240:i,s=D.useRef(null);let u;e[0]!==n.length?(u={messageCount:n.length,sentinelRef:s},e[0]=n.length,e[1]=u):u=e[1],R_(u);let o;if(e[2]!==n||e[3]!==r){let d;e[5]!==n.length||e[6]!==r?(d=(p,h)=>p.role==="user"?g.jsx(T_,{message:p},p.id):p.role==="assistant"?g.jsx(g_,{message:p,status:h===n.length-1?r:void 0},p.id):null,e[5]=n.length,e[6]=r,e[7]=d):d=e[7],o=n.map(d),e[2]=n,e[3]=r,e[4]=o}else o=e[4];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=g.jsx(ud,{children:g.jsx("div",{ref:s,className:"h-0"})}),e[8]=l):l=e[8];let f;return e[9]!==a||e[10]!==o?(f=g.jsxs(b_,{minHeightOffset:a,children:[o,l]}),e[9]=a,e[10]=o,e[11]=f):f=e[11],f}function B_(t){const e=X.c(2),{children:n}=t;let r;return e[0]!==n?(r=g.jsx(si.Footer,{className:"max-w-2xl mx-auto w-full min-w-0",children:n}),e[0]=n,e[1]=r):r=e[1],r}function ka(t){return null}function Sa(t){return null}function F_(t){const e=X.c(31),{onSubmit:n,onStop:r,disabled:i,isStreaming:a,placeholder:s,usageMessages:u,children:o}=t,[l,f]=D.useState("");let d,p,h,m,x;if(e[0]!==o||e[1]!==l||e[2]!==a||e[3]!==n){const w=Jr(o,ka),R=Jr(o,Sa);let C;e[9]!==o?(C=L_(o,[ka,Sa]),e[9]=o,e[10]=C):C=e[10],p=C;let O;e[11]!==l||e[12]!==a||e[13]!==n?(O=async M=>{if(M?.preventDefault(),!l?.trim()||a)return;const z=l.trim();try{await n(z),f("")}catch(N){const P=N;console.error("Failed to send message:",P);const H=P instanceof Error?P.message:"Failed to send message";vr.error(H)}},e[11]=l,e[12]=a,e[13]=n,e[14]=O):O=e[14],d=O,h="flex items-center gap-2 min-w-0",m=R?g.jsx("div",{className:se("flex items-center gap-2 flex-wrap min-w-0",R.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(L0,{selectedGatewayId:R.props.selectedGatewayId,onGatewayChange:R.props.onGatewayChange,placeholder:"Gateway",variant:"bordered",className:R.props.className})}):null,x=w?g.jsx("div",{className:se("flex items-center gap-2 flex-wrap min-w-0",w.props.disabled&&"pointer-events-none opacity-60"),children:g.jsx(I_,{selectedModel:w.props.selectedModel,onModelChange:w.props.onModelChange,placeholder:"Model",variant:"borderless",className:w.props.className})}):null,e[0]=o,e[1]=l,e[2]=a,e[3]=n,e[4]=d,e[5]=p,e[6]=h,e[7]=m,e[8]=x}else d=e[4],p=e[5],h=e[6],m=e[7],x=e[8];let A;e[15]!==u?(A=u?g.jsx(ad,{messages:u}):null,e[15]=u,e[16]=A):A=e[16];let b;e[17]!==p||e[18]!==h||e[19]!==m||e[20]!==x||e[21]!==A?(b=g.jsxs("div",{className:h,children:[m,x,p,A]}),e[17]=p,e[18]=h,e[19]=m,e[20]=x,e[21]=A,e[22]=b):b=e[22];const S=b;let E;return e[23]!==i||e[24]!==d||e[25]!==l||e[26]!==a||e[27]!==S||e[28]!==r||e[29]!==s?(E=g.jsx(b0,{value:l,onChange:f,onSubmit:d,onStop:r,disabled:i,isStreaming:a,placeholder:s,leftActions:S}),e[23]=i,e[24]=d,e[25]=l,e[26]=a,e[27]=S,e[28]=r,e[29]=s,e[30]=E):E=e[30],E}const By=Object.assign(O_,{Header:Object.assign(v_,{Left:ld,Right:cd}),Main:D_,Messages:M_,EmptyState:P_,Footer:B_,Input:Object.assign(F_,{ModelSelector:ka,GatewaySelector:Sa})});function Fy(t){const e=X.c(19),{prompts:n,onSelect:r,className:i}=t;if(n.length===0)return null;let a,s,u,o;if(e[0]!==i||e[1]!==r||e[2]!==n){const d=n.slice(0,4);e[7]!==i?(u=se("flex flex-col gap-3 flex-1",i),e[7]=i,e[8]=u):u=e[8],e[9]===Symbol.for("react.memo_cache_sentinel")?(o=g.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Try asking"}),e[9]=o):o=e[9],a="grid grid-cols-1 sm:grid-cols-2 gap-2";let p;e[10]!==r?(p=h=>g.jsxs("button",{type:"button",onClick:()=>r(h),className:se("flex items-start gap-3 p-3 rounded-xl","bg-muted/50 hover:bg-muted transition-colors","text-left cursor-pointer group","border border-transparent hover:border-border"),children:[g.jsx("div",{className:"shrink-0 mt-0.5",children:g.jsx(Co,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors"})}),g.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[g.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:(h.title??h.name).replace(/_/g," ")}),h.description&&g.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:h.description})]})]},h.name),e[10]=r,e[11]=p):p=e[11],s=d.map(p),e[0]=i,e[1]=r,e[2]=n,e[3]=a,e[4]=s,e[5]=u,e[6]=o}else a=e[3],s=e[4],u=e[5],o=e[6];let l;e[12]!==a||e[13]!==s?(l=g.jsx("div",{className:a,children:s}),e[12]=a,e[13]=s,e[14]=l):l=e[14];let f;return e[15]!==u||e[16]!==o||e[17]!==l?(f=g.jsxs("div",{className:u,children:[o,l]}),e[15]=u,e[16]=o,e[17]=l,e[18]=f):f=e[18],f}function Hy(){const t=X.c(7);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=g.jsx("div",{className:"size-6 rounded-lg bg-muted animate-pulse"}),t[0]=e):e=t[0];let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=g.jsxs("div",{className:"flex items-center gap-3",children:[e,g.jsxs("div",{className:"flex flex-col gap-2",children:[g.jsx("div",{className:"h-3.5 w-28 rounded bg-muted animate-pulse"}),g.jsx("div",{className:"h-3 w-40 rounded bg-muted/60 animate-pulse"})]})]}),t[1]=n):n=t[1];let r;t[2]===Symbol.for("react.memo_cache_sentinel")?(r=g.jsx("div",{className:"flex items-center h-12 flex-none border-b border-border/80 px-4",children:g.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[n,g.jsxs("div",{className:"flex items-end gap-2",children:[g.jsx("div",{className:"h-6 w-6 rounded-full bg-muted animate-pulse"}),g.jsx("div",{className:"h-6 w-6 rounded-lg bg-muted animate-pulse"})]})]})}),t[2]=r):r=t[2];let i;t[3]===Symbol.for("react.memo_cache_sentinel")?(i=g.jsx("div",{className:"flex-1 overflow-hidden px-4 py-4",children:g.jsxs("div",{className:"mx-auto flex w-full max-w-2xl flex-col gap-4",children:[g.jsx(Lr,{align:"right",width:"w-3/4"}),g.jsx(Lr,{align:"left",width:"w-full",lines:3}),g.jsx(Lr,{align:"right",width:"w-2/3"}),g.jsx(Lr,{align:"left",width:"w-5/6",lines:2})]})}),t[3]=i):i=t[3];let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=g.jsx("div",{className:"relative flex flex-1 flex-col gap-2 p-2.5",children:g.jsx("div",{className:"relative flex-1",children:g.jsxs("div",{className:"space-y-2 p-2",children:[g.jsx("div",{className:"h-3 w-full rounded bg-muted/40 animate-pulse"}),g.jsx("div",{className:"h-3 w-4/5 rounded bg-muted/40 animate-pulse"})]})})}),t[4]=a):a=t[4];let s;t[5]===Symbol.for("react.memo_cache_sentinel")?(s=g.jsx("div",{className:"flex items-center gap-1",children:g.jsx("div",{className:"size-8 rounded-full bg-muted/60 animate-pulse"})}),t[5]=s):s=t[5];let u;return t[6]===Symbol.for("react.memo_cache_sentinel")?(u=g.jsxs("div",{className:"flex h-full w-full flex-col bg-sidebar",children:[r,i,g.jsx("div",{className:"px-4 py-4",children:g.jsx("div",{className:"mx-auto w-full max-w-2xl",children:g.jsxs("div",{className:"relative flex min-h-[130px] flex-col rounded-xl border border-border bg-background shadow-sm",children:[a,g.jsxs("div",{className:"flex items-center justify-between px-2.5 pb-2.5",children:[s,g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx("div",{className:"h-8 w-32 rounded-lg bg-muted/60 animate-pulse"}),g.jsx("div",{className:"size-8 rounded-full bg-muted animate-pulse"})]})]})]})})})]}),t[6]=u):u=t[6],u}function Lr(t){const e=X.c(22),{align:n,width:r,lines:i}=t,a=r===void 0?"w-full":r,s=i===void 0?1:i,u=n==="right"?"flex-row-reverse":"flex-row";let o;e[0]!==u?(o=se("flex w-full gap-4 px-4 py-2",u),e[0]=u,e[1]=o):o=e[1];const l=n==="right"?"ml-auto max-w-3/4 items-end":"w-full items-start";let f;e[2]!==l?(f=se("flex min-w-0 flex-col gap-2",l),e[2]=l,e[3]=f):f=e[3];let d;e[4]===Symbol.for("react.memo_cache_sentinel")?(d=g.jsx("div",{className:"h-3 w-16 rounded bg-muted/40 animate-pulse"}),e[4]=d):d=e[4];const p=n==="right"?"bg-muted":"bg-transparent border border-border/40";let h;e[5]!==p||e[6]!==a?(h=se("min-w-0 rounded-2xl p-4",p,a),e[5]=p,e[6]=a,e[7]=h):h=e[7];let m;e[8]!==s?(m=Array.from({length:s}),e[8]=s,e[9]=m):m=e[9];let x;e[10]!==s||e[11]!==m?(x=g.jsx("div",{className:"space-y-2",children:m.map((E,w)=>g.jsx("div",{className:se("h-3 rounded bg-muted-foreground/20 animate-pulse",w===s-1?"w-3/4":"w-full"),style:{animationDelay:`${w*.1}s`}},w))}),e[10]=s,e[11]=m,e[12]=x):x=e[12];let A;e[13]!==x||e[14]!==h?(A=g.jsx("div",{className:h,children:x}),e[13]=x,e[14]=h,e[15]=A):A=e[15];let b;e[16]!==A||e[17]!==f?(b=g.jsxs("div",{className:f,children:[d,A]}),e[16]=A,e[17]=f,e[18]=b):b=e[18];let S;return e[19]!==b||e[20]!==o?(S=g.jsx("div",{className:o,children:b}),e[19]=b,e[20]=o,e[21]=S):S=e[21],S}const _i=D.createContext(null);_i.displayName="PanelGroupContext";const ve={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},ds=10,Qt=D.useLayoutEffect,eo=$d.useId,H_=typeof eo=="function"?eo:()=>null;let U_=0;function fs(t=null){const e=H_(),n=D.useRef(t||e||null);return n.current===null&&(n.current=""+U_++),t??n.current}function dd({children:t,className:e="",collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:a,id:s,maxSize:u,minSize:o,onCollapse:l,onExpand:f,onResize:d,order:p,style:h,tagName:m="div",...x}){const A=D.useContext(_i);if(A===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:S,getPanelSize:E,getPanelStyle:w,groupId:R,isPanelCollapsed:C,reevaluatePanelConstraints:O,registerPanel:M,resizePanel:z,unregisterPanel:N}=A,P=fs(s),H=D.useRef({callbacks:{onCollapse:l,onExpand:f,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:u,minSize:o},id:P,idIsFromProps:s!==void 0,order:p});D.useRef({didLogMissingDefaultSizeWarning:!1}),Qt(()=>{const{callbacks:Y,constraints:F}=H.current,Z={...F};H.current.id=P,H.current.idIsFromProps=s!==void 0,H.current.order=p,Y.onCollapse=l,Y.onExpand=f,Y.onResize=d,F.collapsedSize=n,F.collapsible=r,F.defaultSize=i,F.maxSize=u,F.minSize=o,(Z.collapsedSize!==F.collapsedSize||Z.collapsible!==F.collapsible||Z.maxSize!==F.maxSize||Z.minSize!==F.minSize)&&O(H.current,Z)}),Qt(()=>{const Y=H.current;return M(Y),()=>{N(Y)}},[p,P,M,N]),D.useImperativeHandle(a,()=>({collapse:()=>{b(H.current)},expand:Y=>{S(H.current,Y)},getId(){return P},getSize(){return E(H.current)},isCollapsed(){return C(H.current)},isExpanded(){return!C(H.current)},resize:Y=>{z(H.current,Y)}}),[b,S,E,C,P,z]);const J=w(H.current,i);return D.createElement(m,{...x,children:t,className:e,id:P,style:{...J,...h},[ve.groupId]:R,[ve.panel]:"",[ve.panelCollapsible]:r||void 0,[ve.panelId]:P,[ve.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const fd=D.forwardRef((t,e)=>D.createElement(dd,{...t,forwardedRef:e}));dd.displayName="Panel";fd.displayName="forwardRef(Panel)";let Ia=null,zr=-1,Ot=null;function z_(t,e){if(e){const n=(e&Ed)!==0,r=(e&bd)!==0,i=(e&Td)!==0,a=(e&xd)!==0;if(n)return i?"se-resize":a?"ne-resize":"e-resize";if(r)return i?"sw-resize":a?"nw-resize":"w-resize";if(i)return"s-resize";if(a)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function j_(){Ot!==null&&(document.head.removeChild(Ot),Ia=null,Ot=null,zr=-1)}function Qi(t,e){var n,r;const i=z_(t,e);if(Ia!==i){if(Ia=i,Ot===null&&(Ot=document.createElement("style"),document.head.appendChild(Ot)),zr>=0){var a;(a=Ot.sheet)===null||a===void 0||a.removeRule(zr)}zr=(n=(r=Ot.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${i} !important;}`))!==null&&n!==void 0?n:-1}}function hd(t){return t.type==="keydown"}function pd(t){return t.type.startsWith("pointer")}function md(t){return t.type.startsWith("mouse")}function yi(t){if(pd(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(md(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function $_(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Y_(t,e,n){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function q_(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:ro(t),b:ro(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)t=n.a.pop(),e=n.b.pop(),r=t;le(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:no(to(n.a)),b:no(to(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let u=a.length;for(;u--;){const o=a[u];if(o===s.a)return 1;if(o===s.b)return-1}}return Math.sign(i.a-i.b)}const V_=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function W_(t){var e;const n=getComputedStyle((e=gd(t))!==null&&e!==void 0?e:t).display;return n==="flex"||n==="inline-flex"}function G_(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||W_(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||V_.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function to(t){let e=t.length;for(;e--;){const n=t[e];if(le(n,"Missing node"),G_(n))return n}return null}function no(t){return t&&Number(getComputedStyle(t).zIndex)||0}function ro(t){const e=[];for(;t;)e.push(t),t=gd(t);return e}function gd(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const Ed=1,bd=2,Td=4,xd=8,Q_=$_()==="coarse";let ct=[],bn=!1,qt=new Map,Ai=new Map;const dr=new Set;function X_(t,e,n,r,i){var a;const{ownerDocument:s}=e,u={direction:n,element:e,hitAreaMargins:r,setResizeHandlerState:i},o=(a=qt.get(s))!==null&&a!==void 0?a:0;return qt.set(s,o+1),dr.add(u),ei(),function(){var f;Ai.delete(t),dr.delete(u);const d=(f=qt.get(s))!==null&&f!==void 0?f:1;if(qt.set(s,d-1),ei(),d===1&&qt.delete(s),ct.includes(u)){const p=ct.indexOf(u);p>=0&&ct.splice(p,1),ps(),i("up",!0,null)}}}function Z_(t){const{target:e}=t,{x:n,y:r}=yi(t);bn=!0,hs({target:e,x:n,y:r}),ei(),ct.length>0&&(ti("down",t),t.preventDefault(),_d(e)||t.stopImmediatePropagation())}function Xi(t){const{x:e,y:n}=yi(t);if(bn&&t.buttons===0&&(bn=!1,ti("up",t)),!bn){const{target:r}=t;hs({target:r,x:e,y:n})}ti("move",t),ps(),ct.length>0&&t.preventDefault()}function Zi(t){const{target:e}=t,{x:n,y:r}=yi(t);Ai.clear(),bn=!1,ct.length>0&&(t.preventDefault(),_d(e)||t.stopImmediatePropagation()),ti("up",t),hs({target:e,x:n,y:r}),ps(),ei()}function _d(t){let e=t;for(;e;){if(e.hasAttribute(ve.resizeHandle))return!0;e=e.parentElement}return!1}function hs({target:t,x:e,y:n}){ct.splice(0);let r=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(r=t),dr.forEach(i=>{const{element:a,hitAreaMargins:s}=i,u=a.getBoundingClientRect(),{bottom:o,left:l,right:f,top:d}=u,p=Q_?s.coarse:s.fine;if(e>=l-p&&e<=f+p&&n>=d-p&&n<=o+p){if(r!==null&&document.contains(r)&&a!==r&&!a.contains(r)&&!r.contains(a)&&q_(r,a)>0){let m=r,x=!1;for(;m&&!m.contains(a);){if(Y_(m.getBoundingClientRect(),u)){x=!0;break}m=m.parentElement}if(x)return}ct.push(i)}})}function Ki(t,e){Ai.set(t,e)}function ps(){let t=!1,e=!1;ct.forEach(r=>{const{direction:i}=r;i==="horizontal"?t=!0:e=!0});let n=0;Ai.forEach(r=>{n|=r}),t&&e?Qi("intersection",n):t?Qi("horizontal",n):e?Qi("vertical",n):j_()}let Ji=new AbortController;function ei(){Ji.abort(),Ji=new AbortController;const t={capture:!0,signal:Ji.signal};dr.size&&(bn?(ct.length>0&&qt.forEach((e,n)=>{const{body:r}=n;e>0&&(r.addEventListener("contextmenu",Zi,t),r.addEventListener("pointerleave",Xi,t),r.addEventListener("pointermove",Xi,t))}),window.addEventListener("pointerup",Zi,t),window.addEventListener("pointercancel",Zi,t)):qt.forEach((e,n)=>{const{body:r}=n;e>0&&(r.addEventListener("pointerdown",Z_,t),r.addEventListener("pointermove",Xi,t))}))}function ti(t,e){dr.forEach(n=>{const{setResizeHandlerState:r}=n,i=ct.includes(n);r(t,i,e)})}function K_(){const[t,e]=D.useState(0);return D.useCallback(()=>e(n=>n+1),[])}function le(t,e){if(!t)throw console.error(e),Error(e)}function tn(t,e,n=ds){return t.toFixed(n)===e.toFixed(n)?0:t>e?1:-1}function _t(t,e,n=ds){return tn(t,e,n)===0}function et(t,e,n){return tn(t,e,n)===0}function J_(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const i=t[r],a=e[r];if(!et(i,a,n))return!1}return!0}function gn({panelConstraints:t,panelIndex:e,size:n}){const r=t[e];le(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:i=0,collapsible:a,maxSize:s=100,minSize:u=0}=r;if(tn(n,u)<0)if(a){const o=(i+u)/2;tn(n,o)<0?n=i:n=u}else n=u;return n=Math.min(s,n),n=parseFloat(n.toFixed(ds)),n}function qn({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(et(t,0))return e;const s=[...e],[u,o]=r;le(u!=null,"Invalid first pivot index"),le(o!=null,"Invalid second pivot index");let l=0;if(a==="keyboard"){{const d=t<0?o:u,p=n[d];le(p,`Panel constraints not found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=p;if(m){const A=e[d];if(le(A!=null,`Previous layout not found for panel index ${d}`),et(A,h)){const b=x-A;tn(b,Math.abs(t))>0&&(t=t<0?0-b:b)}}}{const d=t<0?u:o,p=n[d];le(p,`No panel constraints found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=p;if(m){const A=e[d];if(le(A!=null,`Previous layout not found for panel index ${d}`),et(A,x)){const b=A-h;tn(b,Math.abs(t))>0&&(t=t<0?0-b:b)}}}}{const d=t<0?1:-1;let p=t<0?o:u,h=0;for(;;){const x=e[p];le(x!=null,`Previous layout not found for panel index ${p}`);const b=gn({panelConstraints:n,panelIndex:p,size:100})-x;if(h+=b,p+=d,p<0||p>=n.length)break}const m=Math.min(Math.abs(t),Math.abs(h));t=t<0?0-m:m}{let p=t<0?u:o;for(;p>=0&&p<n.length;){const h=Math.abs(t)-Math.abs(l),m=e[p];le(m!=null,`Previous layout not found for panel index ${p}`);const x=m-h,A=gn({panelConstraints:n,panelIndex:p,size:x});if(!et(m,A)&&(l+=m-A,s[p]=A,l.toPrecision(3).localeCompare(Math.abs(t).toPrecision(3),void 0,{numeric:!0})>=0))break;t<0?p--:p++}}if(J_(i,s))return i;{const d=t<0?o:u,p=e[d];le(p!=null,`Previous layout not found for panel index ${d}`);const h=p+l,m=gn({panelConstraints:n,panelIndex:d,size:h});if(s[d]=m,!et(m,h)){let x=h-m,b=t<0?o:u;for(;b>=0&&b<n.length;){const S=s[b];le(S!=null,`Previous layout not found for panel index ${b}`);const E=S+x,w=gn({panelConstraints:n,panelIndex:b,size:E});if(et(S,w)||(x-=w-S,s[b]=w),et(x,0))break;t>0?b--:b++}}}const f=s.reduce((d,p)=>p+d,0);return et(f,100)?s:i}function ey({layout:t,panelsArray:e,pivotIndices:n}){let r=0,i=100,a=0,s=0;const u=n[0];le(u!=null,"No pivot index found"),e.forEach((d,p)=>{const{constraints:h}=d,{maxSize:m=100,minSize:x=0}=h;p===u?(r=x,i=m):(a+=x,s+=m)});const o=Math.min(i,100-a),l=Math.max(r,100-s),f=t[u];return{valueMax:o,valueMin:l,valueNow:f}}function fr(t,e=document){return Array.from(e.querySelectorAll(`[${ve.resizeHandleId}][data-panel-group-id="${t}"]`))}function yd(t,e,n=document){const i=fr(t,n).findIndex(a=>a.getAttribute(ve.resizeHandleId)===e);return i??null}function Ad(t,e,n){const r=yd(t,e,n);return r!=null?[r,r+1]:[-1,-1]}function Cd(t,e=document){var n;if(e instanceof HTMLElement&&(e==null||(n=e.dataset)===null||n===void 0?void 0:n.panelGroupId)==t)return e;const r=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return r||null}function Ci(t,e=document){const n=e.querySelector(`[${ve.resizeHandleId}="${t}"]`);return n||null}function ty(t,e,n,r=document){var i,a,s,u;const o=Ci(e,r),l=fr(t,r),f=o?l.indexOf(o):-1,d=(i=(a=n[f])===null||a===void 0?void 0:a.id)!==null&&i!==void 0?i:null,p=(s=(u=n[f+1])===null||u===void 0?void 0:u.id)!==null&&s!==void 0?s:null;return[d,p]}function ny({committedValuesRef:t,eagerValuesRef:e,groupId:n,layout:r,panelDataArray:i,panelGroupElement:a,setLayout:s}){D.useRef({didWarnAboutMissingResizeHandle:!1}),Qt(()=>{if(!a)return;const u=fr(n,a);for(let o=0;o<i.length-1;o++){const{valueMax:l,valueMin:f,valueNow:d}=ey({layout:r,panelsArray:i,pivotIndices:[o,o+1]}),p=u[o];if(p!=null){const h=i[o];le(h,`No panel data found for index "${o}"`),p.setAttribute("aria-controls",h.id),p.setAttribute("aria-valuemax",""+Math.round(l)),p.setAttribute("aria-valuemin",""+Math.round(f)),p.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{u.forEach((o,l)=>{o.removeAttribute("aria-controls"),o.removeAttribute("aria-valuemax"),o.removeAttribute("aria-valuemin"),o.removeAttribute("aria-valuenow")})}},[n,r,i,a]),D.useEffect(()=>{if(!a)return;const u=e.current;le(u,"Eager values not found");const{panelDataArray:o}=u,l=Cd(n,a);le(l!=null,`No group found for id "${n}"`);const f=fr(n,a);le(f,`No resize handles found for group id "${n}"`);const d=f.map(p=>{const h=p.getAttribute(ve.resizeHandleId);le(h,"Resize handle element has no handle id attribute");const[m,x]=ty(n,h,o,a);if(m==null||x==null)return()=>{};const A=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const S=o.findIndex(E=>E.id===m);if(S>=0){const E=o[S];le(E,`No panel data found for index ${S}`);const w=r[S],{collapsedSize:R=0,collapsible:C,minSize:O=0}=E.constraints;if(w!=null&&C){const M=qn({delta:et(w,R)?O-R:R-w,initialLayout:r,panelConstraints:o.map(z=>z.constraints),pivotIndices:Ad(n,h,a),prevLayout:r,trigger:"keyboard"});r!==M&&s(M)}}break}}};return p.addEventListener("keydown",A),()=>{p.removeEventListener("keydown",A)}});return()=>{d.forEach(p=>p())}},[a,t,e,n,r,i,s])}function io(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function kd(t,e){const n=t==="horizontal",{x:r,y:i}=yi(e);return n?r:i}function ry(t,e,n,r,i){const a=n==="horizontal",s=Ci(e,i);le(s,`No resize handle element found for id "${e}"`);const u=s.getAttribute(ve.groupId);le(u,"Resize handle element has no group id attribute");let{initialCursorPosition:o}=r;const l=kd(n,t),f=Cd(u,i);le(f,`No group element found for id "${u}"`);const d=f.getBoundingClientRect(),p=a?d.width:d.height;return(l-o)/p*100}function iy(t,e,n,r,i,a){if(hd(t)){const s=n==="horizontal";let u=0;t.shiftKey?u=100:i!=null?u=i:u=10;let o=0;switch(t.key){case"ArrowDown":o=s?0:u;break;case"ArrowLeft":o=s?-u:0;break;case"ArrowRight":o=s?u:0;break;case"ArrowUp":o=s?0:-u;break;case"End":o=100;break;case"Home":o=-100;break}return o}else return r==null?0:ry(t,e,n,r,a)}function ay({panelDataArray:t}){const e=Array(t.length),n=t.map(a=>a.constraints);let r=0,i=100;for(let a=0;a<t.length;a++){const s=n[a];le(s,`Panel constraints not found for index ${a}`);const{defaultSize:u}=s;u!=null&&(r++,e[a]=u,i-=u)}for(let a=0;a<t.length;a++){const s=n[a];le(s,`Panel constraints not found for index ${a}`);const{defaultSize:u}=s;if(u!=null)continue;const o=t.length-r,l=i/o;r++,e[a]=l,i-=l}return e}function cn(t,e,n){e.forEach((r,i)=>{const a=t[i];le(a,`Panel data not found for index ${i}`);const{callbacks:s,constraints:u,id:o}=a,{collapsedSize:l=0,collapsible:f}=u,d=n[o];if(d==null||r!==d){n[o]=r;const{onCollapse:p,onExpand:h,onResize:m}=s;m&&m(r,d),f&&(p||h)&&(h&&(d==null||_t(d,l))&&!_t(r,l)&&h(),p&&(d==null||!_t(d,l))&&_t(r,l)&&p())}})}function Or(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function sy({defaultSize:t,dragState:e,layout:n,panelData:r,panelIndex:i,precision:a=3}){const s=n[i];let u;return s==null?u=t!=null?t.toPrecision(a):"1":r.length===1?u="1":u=s.toPrecision(a),{flexBasis:0,flexGrow:u,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function uy(t,e=10){let n=null;return(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...i)},e)}}function ao(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,n)=>{localStorage.setItem(e,n)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function Sd(t){return`react-resizable-panels:${t}`}function Id(t){return t.map(e=>{const{constraints:n,id:r,idIsFromProps:i,order:a}=e;return i?r:a?`${a}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((e,n)=>e.localeCompare(n)).join(",")}function Nd(t,e){try{const n=Sd(t),r=e.getItem(n);if(r){const i=JSON.parse(r);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function oy(t,e,n){var r,i;const a=(r=Nd(t,n))!==null&&r!==void 0?r:{},s=Id(e);return(i=a[s])!==null&&i!==void 0?i:null}function ly(t,e,n,r,i){var a;const s=Sd(t),u=Id(e),o=(a=Nd(t,i))!==null&&a!==void 0?a:{};o[u]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(s,JSON.stringify(o))}catch(l){console.error(l)}}function so({layout:t,panelConstraints:e}){const n=[...t],r=n.reduce((a,s)=>a+s,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!et(r,100)&&n.length>0)for(let a=0;a<e.length;a++){const s=n[a];le(s!=null,`No layout data found for index ${a}`);const u=100/r*s;n[a]=u}let i=0;for(let a=0;a<e.length;a++){const s=n[a];le(s!=null,`No layout data found for index ${a}`);const u=gn({panelConstraints:e,panelIndex:a,size:s});s!=u&&(i+=s-u,n[a]=u)}if(!et(i,0))for(let a=0;a<e.length;a++){const s=n[a];le(s!=null,`No layout data found for index ${a}`);const u=s+i,o=gn({panelConstraints:e,panelIndex:a,size:u});if(s!==o&&(i-=o-s,n[a]=o,et(i,0)))break}return n}const cy=100,Vn={getItem:t=>(ao(Vn),Vn.getItem(t)),setItem:(t,e)=>{ao(Vn),Vn.setItem(t,e)}},uo={};function wd({autoSaveId:t=null,children:e,className:n="",direction:r,forwardedRef:i,id:a=null,onLayout:s=null,keyboardResizeBy:u=null,storage:o=Vn,style:l,tagName:f="div",...d}){const p=fs(a),h=D.useRef(null),[m,x]=D.useState(null),[A,b]=D.useState([]),S=K_(),E=D.useRef({}),w=D.useRef(new Map),R=D.useRef(0),C=D.useRef({autoSaveId:t,direction:r,dragState:m,id:p,keyboardResizeBy:u,onLayout:s,storage:o}),O=D.useRef({layout:A,panelDataArray:[],panelDataArrayChanged:!1});D.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),D.useImperativeHandle(i,()=>({getId:()=>C.current.id,getLayout:()=>{const{layout:_}=O.current;return _},setLayout:_=>{const{onLayout:V}=C.current,{layout:Q,panelDataArray:G}=O.current,K=so({layout:_,panelConstraints:G.map(ee=>ee.constraints)});io(Q,K)||(b(K),O.current.layout=K,V&&V(K),cn(G,K,E.current))}}),[]),Qt(()=>{C.current.autoSaveId=t,C.current.direction=r,C.current.dragState=m,C.current.id=p,C.current.onLayout=s,C.current.storage=o}),ny({committedValuesRef:C,eagerValuesRef:O,groupId:p,layout:A,panelDataArray:O.current.panelDataArray,setLayout:b,panelGroupElement:h.current}),D.useEffect(()=>{const{panelDataArray:_}=O.current;if(t){if(A.length===0||A.length!==_.length)return;let V=uo[t];V==null&&(V=uy(ly,cy),uo[t]=V);const Q=[..._],G=new Map(w.current);V(t,Q,G,A,o)}},[t,A,o]),D.useEffect(()=>{});const M=D.useCallback(_=>{const{onLayout:V}=C.current,{layout:Q,panelDataArray:G}=O.current;if(_.constraints.collapsible){const K=G.map(Oe=>Oe.constraints),{collapsedSize:ee=0,panelSize:ue,pivotIndices:pe}=$t(G,_,Q);if(le(ue!=null,`Panel size not found for panel "${_.id}"`),!_t(ue,ee)){w.current.set(_.id,ue);const Me=pn(G,_)===G.length-1?ue-ee:ee-ue,xe=qn({delta:Me,initialLayout:Q,panelConstraints:K,pivotIndices:pe,prevLayout:Q,trigger:"imperative-api"});Or(Q,xe)||(b(xe),O.current.layout=xe,V&&V(xe),cn(G,xe,E.current))}}},[]),z=D.useCallback((_,V)=>{const{onLayout:Q}=C.current,{layout:G,panelDataArray:K}=O.current;if(_.constraints.collapsible){const ee=K.map(Re=>Re.constraints),{collapsedSize:ue=0,panelSize:pe=0,minSize:Oe=0,pivotIndices:Me}=$t(K,_,G),xe=V??Oe;if(_t(pe,ue)){const Re=w.current.get(_.id),kt=Re!=null&&Re>=xe?Re:xe,sn=pn(K,_)===K.length-1?pe-kt:kt-pe,He=qn({delta:sn,initialLayout:G,panelConstraints:ee,pivotIndices:Me,prevLayout:G,trigger:"imperative-api"});Or(G,He)||(b(He),O.current.layout=He,Q&&Q(He),cn(K,He,E.current))}}},[]),N=D.useCallback(_=>{const{layout:V,panelDataArray:Q}=O.current,{panelSize:G}=$t(Q,_,V);return le(G!=null,`Panel size not found for panel "${_.id}"`),G},[]),P=D.useCallback((_,V)=>{const{panelDataArray:Q}=O.current,G=pn(Q,_);return sy({defaultSize:V,dragState:m,layout:A,panelData:Q,panelIndex:G})},[m,A]),H=D.useCallback(_=>{const{layout:V,panelDataArray:Q}=O.current,{collapsedSize:G=0,collapsible:K,panelSize:ee}=$t(Q,_,V);return le(ee!=null,`Panel size not found for panel "${_.id}"`),K===!0&&_t(ee,G)},[]),J=D.useCallback(_=>{const{layout:V,panelDataArray:Q}=O.current,{collapsedSize:G=0,collapsible:K,panelSize:ee}=$t(Q,_,V);return le(ee!=null,`Panel size not found for panel "${_.id}"`),!K||tn(ee,G)>0},[]),Y=D.useCallback(_=>{const{panelDataArray:V}=O.current;V.push(_),V.sort((Q,G)=>{const K=Q.order,ee=G.order;return K==null&&ee==null?0:K==null?-1:ee==null?1:K-ee}),O.current.panelDataArrayChanged=!0,S()},[S]);Qt(()=>{if(O.current.panelDataArrayChanged){O.current.panelDataArrayChanged=!1;const{autoSaveId:_,onLayout:V,storage:Q}=C.current,{layout:G,panelDataArray:K}=O.current;let ee=null;if(_){const pe=oy(_,K,Q);pe&&(w.current=new Map(Object.entries(pe.expandToSizes)),ee=pe.layout)}ee==null&&(ee=ay({panelDataArray:K}));const ue=so({layout:ee,panelConstraints:K.map(pe=>pe.constraints)});io(G,ue)||(b(ue),O.current.layout=ue,V&&V(ue),cn(K,ue,E.current))}}),Qt(()=>{const _=O.current;return()=>{_.layout=[]}},[]);const F=D.useCallback(_=>{let V=!1;const Q=h.current;return Q&&window.getComputedStyle(Q,null).getPropertyValue("direction")==="rtl"&&(V=!0),function(K){K.preventDefault();const ee=h.current;if(!ee)return()=>null;const{direction:ue,dragState:pe,id:Oe,keyboardResizeBy:Me,onLayout:xe}=C.current,{layout:Re,panelDataArray:kt}=O.current,{initialLayout:Ht}=pe??{},sn=Ad(Oe,_,ee);let He=iy(K,_,ue,pe,Me,ee);const Rn=ue==="horizontal";Rn&&V&&(He=-He);const Ar=kt.map(ki=>ki.constraints),Ut=qn({delta:He,initialLayout:Ht??Re,panelConstraints:Ar,pivotIndices:sn,prevLayout:Re,trigger:hd(K)?"keyboard":"mouse-or-touch"}),Cr=!Or(Re,Ut);(pd(K)||md(K))&&R.current!=He&&(R.current=He,!Cr&&He!==0?Rn?Ki(_,He<0?Ed:bd):Ki(_,He<0?Td:xd):Ki(_,0)),Cr&&(b(Ut),O.current.layout=Ut,xe&&xe(Ut),cn(kt,Ut,E.current))}},[]),Z=D.useCallback((_,V)=>{const{onLayout:Q}=C.current,{layout:G,panelDataArray:K}=O.current,ee=K.map(Re=>Re.constraints),{panelSize:ue,pivotIndices:pe}=$t(K,_,G);le(ue!=null,`Panel size not found for panel "${_.id}"`);const Me=pn(K,_)===K.length-1?ue-V:V-ue,xe=qn({delta:Me,initialLayout:G,panelConstraints:ee,pivotIndices:pe,prevLayout:G,trigger:"imperative-api"});Or(G,xe)||(b(xe),O.current.layout=xe,Q&&Q(xe),cn(K,xe,E.current))},[]),re=D.useCallback((_,V)=>{const{layout:Q,panelDataArray:G}=O.current,{collapsedSize:K=0,collapsible:ee}=V,{collapsedSize:ue=0,collapsible:pe,maxSize:Oe=100,minSize:Me=0}=_.constraints,{panelSize:xe}=$t(G,_,Q);xe!=null&&(ee&&pe&&_t(xe,K)?_t(K,ue)||Z(_,ue):xe<Me?Z(_,Me):xe>Oe&&Z(_,Oe))},[Z]),fe=D.useCallback((_,V)=>{const{direction:Q}=C.current,{layout:G}=O.current;if(!h.current)return;const K=Ci(_,h.current);le(K,`Drag handle element not found for id "${_}"`);const ee=kd(Q,V);x({dragHandleId:_,dragHandleRect:K.getBoundingClientRect(),initialCursorPosition:ee,initialLayout:G})},[]),Ae=D.useCallback(()=>{x(null)},[]),I=D.useCallback(_=>{const{panelDataArray:V}=O.current,Q=pn(V,_);Q>=0&&(V.splice(Q,1),delete E.current[_.id],O.current.panelDataArrayChanged=!0,S())},[S]),Ee=D.useMemo(()=>({collapsePanel:M,direction:r,dragState:m,expandPanel:z,getPanelSize:N,getPanelStyle:P,groupId:p,isPanelCollapsed:H,isPanelExpanded:J,reevaluatePanelConstraints:re,registerPanel:Y,registerResizeHandle:F,resizePanel:Z,startDragging:fe,stopDragging:Ae,unregisterPanel:I,panelGroupElement:h.current}),[M,m,r,z,N,P,p,H,J,re,Y,F,Z,fe,Ae,I]),be={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return D.createElement(_i.Provider,{value:Ee},D.createElement(f,{...d,children:e,className:n,id:a,ref:h,style:{...be,...l},[ve.group]:"",[ve.groupDirection]:r,[ve.groupId]:p}))}const Rd=D.forwardRef((t,e)=>D.createElement(wd,{...t,forwardedRef:e}));wd.displayName="PanelGroup";Rd.displayName="forwardRef(PanelGroup)";function pn(t,e){return t.findIndex(n=>n===e||n.id===e.id)}function $t(t,e,n){const r=pn(t,e),a=r===t.length-1?[r-1,r]:[r,r+1],s=n[r];return{...e.constraints,panelSize:s,pivotIndices:a}}function dy({disabled:t,handleId:e,resizeHandler:n,panelGroupElement:r}){D.useEffect(()=>{if(t||n==null||r==null)return;const i=Ci(e,r);if(i==null)return;const a=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const u=i.getAttribute(ve.groupId);le(u,`No group element found for id "${u}"`);const o=fr(u,r),l=yd(u,e,r);le(l!==null,`No resize element found for id "${e}"`);const f=s.shiftKey?l>0?l-1:o.length-1:l+1<o.length?l+1:0;o[f].focus();break}}};return i.addEventListener("keydown",a),()=>{i.removeEventListener("keydown",a)}},[r,t,e,n])}function Ld({children:t=null,className:e="",disabled:n=!1,hitAreaMargins:r,id:i,onBlur:a,onClick:s,onDragging:u,onFocus:o,onPointerDown:l,onPointerUp:f,style:d={},tabIndex:p=0,tagName:h="div",...m}){var x,A;const b=D.useRef(null),S=D.useRef({onClick:s,onDragging:u,onPointerDown:l,onPointerUp:f});D.useEffect(()=>{S.current.onClick=s,S.current.onDragging=u,S.current.onPointerDown=l,S.current.onPointerUp=f});const E=D.useContext(_i);if(E===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:w,groupId:R,registerResizeHandle:C,startDragging:O,stopDragging:M,panelGroupElement:z}=E,N=fs(i),[P,H]=D.useState("inactive"),[J,Y]=D.useState(!1),[F,Z]=D.useState(null),re=D.useRef({state:P});Qt(()=>{re.current.state=P}),D.useEffect(()=>{if(n)Z(null);else{const Ee=C(N);Z(()=>Ee)}},[n,N,C]);const fe=(x=r?.coarse)!==null&&x!==void 0?x:15,Ae=(A=r?.fine)!==null&&A!==void 0?A:5;D.useEffect(()=>{if(n||F==null)return;const Ee=b.current;le(Ee,"Element ref not attached");let be=!1;return X_(N,Ee,w,{coarse:fe,fine:Ae},(V,Q,G)=>{if(!Q){H("inactive");return}switch(V){case"down":{H("drag"),be=!1,le(G,'Expected event to be defined for "down" action'),O(N,G);const{onDragging:K,onPointerDown:ee}=S.current;K?.(!0),ee?.();break}case"move":{const{state:K}=re.current;be=!0,K!=="drag"&&H("hover"),le(G,'Expected event to be defined for "move" action'),F(G);break}case"up":{H("hover"),M();const{onClick:K,onDragging:ee,onPointerUp:ue}=S.current;ee?.(!1),ue?.(),be||K?.();break}}})},[fe,w,n,Ae,C,N,F,O,M]),dy({disabled:n,handleId:N,resizeHandler:F,panelGroupElement:z});const I={touchAction:"none",userSelect:"none"};return D.createElement(h,{...m,children:t,className:e,id:i,onBlur:()=>{Y(!1),a?.()},onFocus:()=>{Y(!0),o?.()},ref:b,role:"separator",style:{...I,...d},tabIndex:p,[ve.groupDirection]:w,[ve.groupId]:R,[ve.resizeHandle]:"",[ve.resizeHandleActive]:P==="drag"?"pointer":J?"keyboard":void 0,[ve.resizeHandleEnabled]:!n,[ve.resizeHandleId]:N,[ve.resizeHandleState]:P})}Ld.displayName="PanelResizeHandle";function Uy(t){const e=X.c(8);let n,r;e[0]!==t?({className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]);let i;e[3]!==n?(i=se("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),e[3]=n,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a=g.jsx(Rd,{"data-slot":"resizable-panel-group",className:i,...r}),e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function zy(t){const e=X.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let r;return e[2]!==n?(r=g.jsx(fd,{"data-slot":"resizable-panel",...n}),e[2]=n,e[3]=r):r=e[3],r}function jy(t){const e=X.c(12);let n,r,i;e[0]!==t?({withHandle:i,className:n,...r}=t,e[0]=t,e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;e[4]!==n?(a=se("bg-border focus-visible:ring-ring relative flex w-[0.5px] items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",n),e[4]=n,e[5]=a):a=e[5];let s;e[6]!==i?(s=i&&g.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:g.jsx(xo,{className:"size-2.5"})}),e[6]=i,e[7]=s):s=e[7];let u;return e[8]!==r||e[9]!==a||e[10]!==s?(u=g.jsx(Ld,{"data-slot":"resizable-handle",className:a,...r,children:s}),e[8]=r,e[9]=a,e[10]=s,e[11]=u):u=e[11],u}export{By as C,x0 as D,L0 as G,Fy as I,I_ as M,zy as R,vy as a,I0 as b,y_ as c,My as d,Dy as e,A0 as f,C0 as g,k0 as h,Ms as i,T0 as j,jy as k,Hy as l,Uy as m,_f as u};