factory-factory 0.5.6 → 0.5.7

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 (106) hide show
  1. package/dist/client/assets/{DotsThree.es-Dx8TXzzQ.js → DotsThree.es-6Y3ru9Fr.js} +1 -1
  2. package/dist/client/assets/{abnfDiagram-WEYOIA3C-D-WiX0ND.js → abnfDiagram-WEYOIA3C-Bz-2NjrY.js} +1 -1
  3. package/dist/client/assets/{admin-page-BdYXlEfi.js → admin-page-N8bqsl_U.js} +1 -1
  4. package/dist/client/assets/{agent-authoring-CzgCC7xn.js → agent-authoring-C33uSQgC.js} +1 -1
  5. package/dist/client/assets/{agents-CIGVR3Yk.js → agents-BNAsXKbn.js} +1 -1
  6. package/dist/client/assets/{agents-B6BxITMg.js → agents-MwqMFVNs.js} +1 -1
  7. package/dist/client/assets/{architectureDiagram-ZHVYKT53-D-Nk4IRx.js → architectureDiagram-ZHVYKT53-CpoGyKeM.js} +1 -1
  8. package/dist/client/assets/{chat-BsZewCkt.js → chat-B7u27d-i.js} +5 -5
  9. package/dist/client/assets/{chunk-2E7WHVMD-DsLW-8KW.js → chunk-2E7WHVMD-Baod-BdE.js} +1 -1
  10. package/dist/client/assets/{chunk-NQOKRVIF-CMnJ0k4D.js → chunk-NQOKRVIF-LCflra3k.js} +1 -1
  11. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-BRoc4t8Q.js → classDiagram-v2-4MYWR3UA-MRjV_MIA.js} +1 -1
  12. package/dist/client/assets/client-modules.json +1 -1
  13. package/dist/client/assets/{codex-accounts-C8imj_4P.js → codex-accounts-DP-Tb-tZ.js} +1 -1
  14. package/dist/client/assets/{cynefinDiagram-WF24UDRP-6T3PH0XT.js → cynefinDiagram-WF24UDRP-bzsiqTUL.js} +1 -1
  15. package/dist/client/assets/{data-import-button-BH9f-Pg6.js → data-import-button-BqRlwClc.js} +1 -1
  16. package/dist/client/assets/{detail-C4NZBe6t.js → detail-BXmaqHTp.js} +2 -2
  17. package/dist/client/assets/{diagram-CBK3MWTC-YepopftI.js → diagram-CBK3MWTC-DjtO1Qi7.js} +1 -1
  18. package/dist/client/assets/{diagram-I5XIIV2D-BJli7Wmv.js → diagram-I5XIIV2D-EW0H2MNl.js} +1 -1
  19. package/dist/client/assets/{diagram-ODIL2UCW-CSqmCku9.js → diagram-ODIL2UCW-DSWSmg75.js} +1 -1
  20. package/dist/client/assets/{diagram-RJA3I4VV-Din95BTu.js → diagram-RJA3I4VV-DGCPPXy9.js} +1 -1
  21. package/dist/client/assets/{diagram-TYUNFSNR-DDVwAmk7.js → diagram-TYUNFSNR-BRE0O5UU.js} +1 -1
  22. package/dist/client/assets/{diff-viewer-DNUPJg_G.js → diff-viewer-B2pMcSUo.js} +1 -1
  23. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bt8SCelN.js → ebnfDiagram-V4P3TTPT-LN1BHyLk.js} +1 -1
  24. package/dist/client/assets/{erDiagram-KYQIGQAA-BDYCjid-.js → erDiagram-KYQIGQAA-BagoNO7h.js} +1 -1
  25. package/dist/client/assets/{event-agent-workspace-form-CWmktyXd.js → event-agent-workspace-form-D6EZQxOA.js} +1 -1
  26. package/dist/client/assets/{file-viewer-CbXNMHbC.js → file-viewer-ByqeZE0U.js} +1 -1
  27. package/dist/client/assets/{flowDiagram-IUGLLWBU-CJN9xdYn.js → flowDiagram-IUGLLWBU-D263u80I.js} +1 -1
  28. package/dist/client/assets/{highlighted-body-JLMTFACH-Dy-R6Y8r.js → highlighted-body-JLMTFACH-CMb21a0T.js} +1 -1
  29. package/dist/client/assets/{home-pNFIyVOJ.js → home-9nWsYf3c.js} +1 -1
  30. package/dist/client/assets/index-ClP2IiKy.css +2 -0
  31. package/dist/client/assets/index-GmSorqXd.js +12 -0
  32. package/dist/client/assets/{infoDiagram-MVDRKAX5-CZx5KLLZ.js → infoDiagram-MVDRKAX5-DqtZTfKx.js} +1 -1
  33. package/dist/client/assets/{inline-workspace-form-DvVz3qgr.js → inline-workspace-form-DTOd1_IQ.js} +1 -1
  34. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-C0ax8nAT.js → ishikawaDiagram-HPEHV2GE-S--AK0b5.js} +1 -1
  35. package/dist/client/assets/{issue-launch-sheet-Cvig-i15.js → issue-launch-sheet-Cmq9AmXu.js} +1 -1
  36. package/dist/client/assets/{kanban-CWhDBIAX.js → kanban-DFqdaBrr.js} +1 -1
  37. package/dist/client/assets/{kanban-card-xzqAUkmg.js → kanban-card-CKNGUrJa.js} +1 -1
  38. package/dist/client/assets/{kanban-definition-FNSA4HC5-FG4uAvnN.js → kanban-definition-FNSA4HC5-BstZV_2x.js} +1 -1
  39. package/dist/client/assets/{legacy-COQTLf7j.js → legacy-BK7U5o2y.js} +1 -1
  40. package/dist/client/assets/{legacy-xGT-esX6.js → legacy-D010j6qa.js} +1 -1
  41. package/dist/client/assets/{list-DhQWjiv0.js → list-C2HYpkqg.js} +1 -1
  42. package/dist/client/assets/{list-sOGdiDXi.js → list-DG7Grxw5.js} +1 -1
  43. package/dist/client/assets/{logs-DOOyulI5.js → logs-C5_FYDNK.js} +1 -1
  44. package/dist/client/assets/mermaid-WFAXDIZX-ClIEnuTo.js +1 -0
  45. package/dist/client/assets/{mermaid-diagram-DHR-LEin.js → mermaid-diagram-7d3eG33H.js} +4 -4
  46. package/dist/client/assets/{mindmap-definition-6OY57UG3-B3bdhe56.js → mindmap-definition-6OY57UG3-flOx3ZeG.js} +1 -1
  47. package/dist/client/assets/{mobile-baseline-C2AnUNW1.js → mobile-baseline-oXH_VGTz.js} +1 -1
  48. package/dist/client/assets/new-C8WYrcew.js +1 -0
  49. package/dist/client/assets/{new-BJg9Bigj.js → new-COoW_By1.js} +1 -1
  50. package/dist/client/assets/{pegDiagram-ECIUJNBX-DOYkHKRd.js → pegDiagram-ECIUJNBX-BrDIK58N.js} +1 -1
  51. package/dist/client/assets/{pieDiagram-GNMPY74T-8JeV6xrB.js → pieDiagram-GNMPY74T-BMzBw5t-.js} +1 -1
  52. package/dist/client/assets/{pr-inbox-item-BGuMexFr.js → pr-inbox-item-vHdTaoxd.js} +1 -1
  53. package/dist/client/assets/project-CBrecHcv.js +1 -0
  54. package/dist/client/assets/project-header-BG9_VlHh.js +1 -0
  55. package/dist/client/assets/{project-repo-form-8h-x4Jm-.js → project-repo-form-6aODqQni.js} +1 -1
  56. package/dist/client/assets/{provider-cli-warning-B6YVtj_C.js → provider-cli-warning-Bcg15rKf.js} +1 -1
  57. package/dist/client/assets/{query-state-DeXwsPfq.js → query-state-BVQj0phN.js} +1 -1
  58. package/dist/client/assets/{railroadDiagram-Y72NRBL7-D6nXF23_.js → railroadDiagram-Y72NRBL7-3Eck62Bi.js} +1 -1
  59. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CjjGJH_A.js → requirementDiagram-EQYSW5RA-rbuIMTLU.js} +1 -1
  60. package/dist/client/assets/{reviews-r5Fft2S9.js → reviews-Dbotug95.js} +1 -1
  61. package/dist/client/assets/{right-panel-BUm-IUuW.js → right-panel-DaLnLjFu.js} +2 -2
  62. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-X8vRIVgX.js → sequenceDiagram-BLEHNHQU-CvP7tfWl.js} +1 -1
  63. package/dist/client/assets/{settings-page-layout-Cyc2QcuG.js → settings-page-layout-DWVd1wTJ.js} +1 -1
  64. package/dist/client/assets/{setup-terminal-modal-CRZrWgCt.js → setup-terminal-modal--e19kzCo.js} +2 -2
  65. package/dist/client/assets/{startup-script-form-edXnfByI.js → startup-script-form-BX-97uzx.js} +1 -1
  66. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-Bum1zshG.js → stateDiagram-v2-A6IESKWZ-DPQNuXMb.js} +1 -1
  67. package/dist/client/assets/{swimlanesDiagram-AYQRV4AK-DBKC7Yfq.js → swimlanesDiagram-AYQRV4AK-DBayrG3m.js} +1 -1
  68. package/dist/client/assets/{terminal-instance-Y05XGV6V.js → terminal-instance-Bhh6-6sl.js} +1 -1
  69. package/dist/client/assets/{timeline-definition-JXYKGLGB-CLF-s_Xn.js → timeline-definition-JXYKGLGB-C14nrPRo.js} +1 -1
  70. package/dist/client/assets/{transcript-scroll-fixture-DNVPzw5t.js → transcript-scroll-fixture-CLt6Bmfz.js} +1 -1
  71. package/dist/client/assets/use-project-header-navigation-D_Gx1LQ9.js +1 -0
  72. package/dist/client/assets/{use-workspace-creation-draft-Bl2dlNzf.js → use-workspace-creation-draft-BcIClFw-.js} +1 -1
  73. package/dist/client/assets/{use-workspace-project-navigation-B0LZj578.js → use-workspace-project-navigation-D6kEMUHY.js} +1 -1
  74. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-CUYfjlrO.js → usecaseDiagram-WPOLBNNX-CC_KUwpc.js} +1 -1
  75. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-B9Upmplw.js → vennDiagram-Q3Y3IDCW-BKPUQxLZ.js} +1 -1
  76. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-C9_DfFfF.js → wardleyDiagram-IVAIDKWA-pZxWIAfq.js} +1 -1
  77. package/dist/client/assets/{websocket-BT8C-OBP.js → websocket-Q9XnceTt.js} +1 -1
  78. package/dist/client/assets/{workspace-creation-drop-drain-BcuDXdq-.js → workspace-creation-drop-drain-6HaYe14j.js} +1 -1
  79. package/dist/client/assets/{xychartDiagram-4URNHDU4-wRTlHEa4.js → xychartDiagram-4URNHDU4-v1OTdqDZ.js} +1 -1
  80. package/dist/client/index.html +2 -2
  81. package/dist/src/backend/services/workspace/service/query/workspace-query.service.d.ts +4 -0
  82. package/dist/src/backend/services/workspace/service/query/workspace-query.service.d.ts.map +1 -1
  83. package/dist/src/backend/services/workspace/service/query/workspace-query.service.js +7 -0
  84. package/dist/src/backend/services/workspace/service/query/workspace-query.service.js.map +1 -1
  85. package/dist/src/backend/services/workspace/service/query/workspace-query.service.test.js +15 -0
  86. package/dist/src/backend/services/workspace/service/query/workspace-query.service.test.js.map +1 -1
  87. package/dist/src/backend/testing/npm-publish-workflow.test.js +8 -9
  88. package/dist/src/backend/testing/npm-publish-workflow.test.js.map +1 -1
  89. package/dist/src/backend/trpc/index.d.ts +10 -8
  90. package/dist/src/backend/trpc/index.d.ts.map +1 -1
  91. package/dist/src/backend/trpc/project.router.test.js +34 -0
  92. package/dist/src/backend/trpc/project.router.test.js.map +1 -1
  93. package/dist/src/backend/trpc/project.trpc.d.ts +10 -8
  94. package/dist/src/backend/trpc/project.trpc.d.ts.map +1 -1
  95. package/dist/src/backend/trpc/project.trpc.js +19 -1
  96. package/dist/src/backend/trpc/project.trpc.js.map +1 -1
  97. package/dist/tsconfig.backend.tsbuildinfo +1 -1
  98. package/package.json +46 -46
  99. package/scripts/postinstall.mjs +16 -50
  100. package/dist/client/assets/index-BHTworEd.js +0 -12
  101. package/dist/client/assets/index-sK2DBc7b.css +0 -2
  102. package/dist/client/assets/mermaid-WFAXDIZX-Bb-EeuSh.js +0 -1
  103. package/dist/client/assets/new-DUJNL_Jv.js +0 -1
  104. package/dist/client/assets/project-CTLOJEoH.js +0 -1
  105. package/dist/client/assets/project-header-cDqQN0Dp.js +0 -1
  106. package/dist/client/assets/use-project-header-navigation-CGIZMabH.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-JLMTFACH-Dy-R6Y8r.js","assets/rolldown-runtime-COiEfhsA.js","assets/jsx-runtime-CldxteV5.js","assets/mermaid-diagram-DHR-LEin.js","assets/preload-helper-BLdHbfdN.js","assets/index-BHTworEd.js","assets/react-dom-BNtzwOHF.js","assets/hooks-CZYZW9i_.js","assets/components-Be4xRGcU.js","assets/lib-D-JAPasO.js","assets/dist-DxBCWJgX.js","assets/trpc-D9WuCSM1.js","assets/queryClient-DaT6C6i7.js","assets/background-task-2TNZSSC3.js","assets/utils-DQeSPVda.js","assets/bundle-mjs-CdK3cBzO.js","assets/CheckCircle.es-WUl0_Fqk.js","assets/status-indicators-Dvz22Kk_.js","assets/Warning.es-BRY0GI4S.js","assets/es2015-CDGxiYHE.js","assets/button-Dslj7pht.js","assets/dist-B1Zs6lmy.js","assets/dialog-LD_zPUYD.js","assets/dist-y4SI7xsk.js","assets/dist-DmRbNcLV.js","assets/spinner-BxeSV-Bb.js","assets/ArrowClockwise.es-CucFsYLg.js","assets/CaretDown.es-Dad3vS2k.js","assets/pending-request-presentation-BqY92kUN.js","assets/ShieldWarning.es-CuA46yPp.js","assets/WarningCircle.es-D-X961df.js","assets/image-drop-zone-NvcW7wXO.js","assets/attachment-file-conversion-BG03_iix.js","assets/MagnifyingGlass.es-BlNhc0fx.js","assets/formatters-CbVS7bYs.js","assets/loading-SklnwAL1.js","assets/schemas-cLRPP1ma.js","assets/use-persistent-scroll-DMRAfhA7.js","assets/use-workspace-drawer-D5BHCzpQ.js","assets/use-mobile-Di9JSXG3.js","assets/workspace-cache-reconciler-TKQHxUsu.js","assets/appearance-DsbwoDTa.js","assets/appearance-D7nkDMex.js","assets/dist-D8Wfxh48.js","assets/input-uo3fNc4V.js","assets/dist-CLSCCiF9.js","assets/Plus.es-wnPcLFe1.js","assets/github-pr-preview-B2sd2tDg.js","assets/date-time-DaFd7tnC.js","assets/use-websocket-channel-BApRAMMz.js","assets/index-sK2DBc7b.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-BWF7jMDv.js","assets/chunk-DSNLSHJZ-CSSZ0uRv.js","assets/chunk-7S6XSTFO-v9BVbuJB.js","assets/dist-CumnGVmJ.js","assets/chunk-YZO67HFG-DrH1RXFI.js","assets/chunk-AQDTSKZB-Bh2e4nVN.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-UHW7PFBP-FWZD9983.js","assets/chunk-HAGFOTED-CTCHAkn7.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ZAUX2LTX-slbBeHT4.js","assets/chunk-WQQL4CDK-V1ZC59EX.js","assets/line-DYrY8V4I.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-HNE4Q36P-SXol6mIL.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./react-dom-BNtzwOHF.js";import{n as i}from"./trpc-D9WuCSM1.js";import{r as a,t as o}from"./background-task-2TNZSSC3.js";import{r as s,t as c}from"./utils-DQeSPVda.js";import{t as l}from"./CheckCircle.es-WUl0_Fqk.js";import{_ as u,c as d,d as f,f as p,g as m,i as h,l as g,m as _,o as v,p as y,r as b,s as x,u as S,v as C,y as w}from"./status-indicators-Dvz22Kk_.js";import{n as T,t as E}from"./spinner-BxeSV-Bb.js";import{t as D}from"./Warning.es-BRY0GI4S.js";import{t as O}from"./ArrowClockwise.es-CucFsYLg.js";import{n as ee,t as te}from"./CaretDown.es-Dad3vS2k.js";import{a as ne,i as re,n as ie,o as ae,r as oe,s as se,t as ce}from"./pending-request-presentation-BqY92kUN.js";import{t as le}from"./WarningCircle.es-D-X961df.js";import{c as ue,r as de,t as k}from"./button-Dslj7pht.js";import{n as A,t as fe}from"./bundle-mjs-CdK3cBzO.js";import{t as pe}from"./loading-SklnwAL1.js";import{C as me,S as he,T as ge,_ as j,a as _e,f as ve,g as ye,i as be,k as xe,l as Se,o as Ce,p as M,r as we,s as Te,u as Ee,v as N,w as De,x as P,y as Oe}from"./schemas-cLRPP1ma.js";import{c as ke,d as Ae,f as je,l as Me,o as Ne,s as Pe,u as Fe}from"./use-persistent-scroll-DMRAfhA7.js";import{$ as Ie,G as Le,K as Re,et as ze,g as Be,h as Ve,u as He}from"./workspace-cache-reconciler-TKQHxUsu.js";import{d as Ue,p as We}from"./es2015-CDGxiYHE.js";import{t as Ge}from"./preload-helper-BLdHbfdN.js";import{t as Ke}from"./MagnifyingGlass.es-BlNhc0fx.js";import{o as qe,r as Je,s as Ye,t as Xe}from"./dist-B1Zs6lmy.js";import{a as Ze,i as Qe,o as $e,r as et,s as tt,t as nt}from"./dialog-LD_zPUYD.js";import{n as rt,t as it}from"./attachment-file-conversion-BG03_iix.js";import"./input-uo3fNc4V.js";import{a as at,p as ot}from"./dist-y4SI7xsk.js";import{a as st,i as ct,n as lt,r as ut}from"./Plus.es-wnPcLFe1.js";import{t as dt}from"./use-mobile-Di9JSXG3.js";import{n as ft,o as pt,r as mt,s as ht}from"./github-pr-preview-B2sd2tDg.js";import{n as gt,r as _t}from"./use-websocket-channel-BApRAMMz.js";import{$ as vt,$t as yt,A as bt,C as xt,O as St,Q as Ct,Xt as wt,Yt as Tt,Z as Et,ct as Dt,en as Ot,et as kt,it as At,j as jt,kt as Mt,lt as Nt,nn as Pt,nt as Ft,on as It,rt as Lt,tn as Rt,w as zt}from"./index-BHTworEd.js";import{a as Bt,c as Vt,d as Ht,f as Ut,g as Wt,h as Gt,i as Kt,m as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt,u as $t}from"./lib-BF21T6dw.js";import{t as en}from"./FileText.es-C3zlL7Ja.js";import{c as tn,d as nn,p as rn,s as an,t as on,u as sn}from"./SlidersHorizontal.es-DWmgkQAH.js";import{i as cn}from"./codex-accounts-C8imj_4P.js";import{b as ln,c as un,d as dn,f as fn,i as pn,l as mn,m as hn,n as gn,p as _n,t as vn,u as yn}from"./websocket-BT8C-OBP.js";import{i as bn,r as xn,t as Sn}from"./popover-DjYf9lKZ.js";import{t as Cn}from"./Terminal.es-DXk70l2n.js";import{t as wn}from"./list-keys-CmT9WnL5.js";import{n as Tn,t as En}from"./agent-authoring-CzgCC7xn.js";import{n as Dn,r as On,t as kn}from"./collapsible-dJ6oDAH6.js";import{a as An,d as jn,f as Mn,i as Nn,l as Pn,n as Fn,o as In,p as Ln,r as Rn,s as zn,t as Bn}from"./CaretLeft.es-CZp1Z1Qg.js";import{n as Vn,t as Hn}from"./radio-group-FNSEl1BJ.js";var Un=1e9,Wn=1e3;function Gn(e){return e.type===`text`}function Kn(e){return e.type===`thinking`}function qn(e){return e.type===`tool_use`}function Jn(e){return e.type===`tool_result`}function Yn(e){if(e.type!==`image`)return!1;let t=e.source;if(typeof t!=`object`||!t)return!1;let n=t;return n.type===`base64`&&typeof n.media_type==`string`&&typeof n.data==`string`}function Xn(e){return e.type===`text`?typeof e.text==`string`:e.type===`thinking`?typeof e.thinking==`string`:e.type===`tool_use`?typeof e.id==`string`&&typeof e.name==`string`&&(e.input===void 0||typeof e.input==`object`&&e.input!==null):e.type===`tool_result`?typeof e.tool_use_id==`string`&&(typeof e.content==`string`||Array.isArray(e.content)):e.type===`image`&&Yn(e)}function Zn(e){return e.some(Xn)}function Qn(e){return Array.isArray(e)?e.some(e=>e.type===`tool_result`):!1}function $n(e){if(e.type===`user`)return e.message?Qn(e.message.content):!1;if(e.type===`assistant`){let t=e.message?.content;return typeof t==`string`?t.length>0:Array.isArray(t)&&Zn(t)}if(e.type===`result`||e.type!==`stream_event`)return!0;if(e.event?.type!==`content_block_start`)return!1;let t=e.event.content_block;return t.type!==`text`&&Xn(t)}var er={selectedModel:`opus`,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1};function tr(e){return e??er.selectedModel}var nr=1e4;function rr(e,t){return Array.isArray(e)&&e.some(e=>e.type===t)}function ir(e){return e.type===`stream_event`?e.event?.type===`content_block_start`&&e.event.content_block.type===`tool_result`:e.message?rr(e.message.content,`tool_result`):!1}function ar(e){return e.type===`stream_event`&&e.event?.type!==`content_block_start`}function or(e){return e.source===`user`?!0:e.message?!(ir(e.message)||ar(e.message)):!1}function sr(e){return e.message?.type===`session_lifecycle`?e.order:e.order<0?1/0:e.order}function cr(e,t){let n=sr(e),r=sr(t);return n===r?0:n<r?-1:1}function lr(e,t=Wn){let n=e.every((t,n)=>n===0||cr(e[n-1]??t,t)<=0)?e:[...e].sort(cr);if(n.length<=t)return n;let r=Math.max(0,n.length-t),i=n.findIndex((e,t)=>t>=r&&or(e));return i===-1?n.slice(r):n.slice(i)}function ur(e){if(e.type===`assistant`&&e.message){if(typeof e.message.content==`string`)return e.message.content.trim();if(Array.isArray(e.message.content))return e.message.content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim()}return e.type===`stream_event`&&e.event?.type===`content_block_start`&&e.event.content_block.type===`text`?e.event.content_block.text.trim():``}function dr(e,t=0){if(t>4||e==null)return null;if(typeof e==`string`)return e.trim();if(Array.isArray(e)){for(let n of e){let e=dr(n,t+1);if(e!==null)return e}return null}if(typeof e!=`object`)return null;let n=e;for(let e of[`result`,`text`,`output_text`,`output`,`message`,`content`]){if(!(e in n))continue;let r=dr(n[e],t+1);if(r!==null)return r}return null}function fr(e,t){if(t.type!==`result`)return!1;let n=dr(t.result);if(n===null)return!1;if(!n)return!0;let r=e=>e.source===`user`&&e.order<Un;for(let t=e.length-1;t>=0;--t){let i=e[t];if(!i)continue;if(r(i))return!1;if(i.source!==`agent`||!i.message)continue;if(i.message.type===`result`)return!1;let a=ur(i.message);if(a)return a===n}return!1}var pr=function(e){return e.PENDING=`PENDING`,e.SENT=`SENT`,e.ACCEPTED=`ACCEPTED`,e.DISPATCHED=`DISPATCHED`,e.COMMITTED=`COMMITTED`,e.REJECTED=`REJECTED`,e.FAILED=`FAILED`,e.CANCELLED=`CANCELLED`,e.STREAMING=`STREAMING`,e.COMPLETE=`COMPLETE`,e}({}),F=e(t(),1),I=n(),mr={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function hr({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=mr.indicator,imageBlockPolicy:c=mr.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=Tr(e,t,n,r,i,a,o,s,c);xr(l),qt(l,u)}}function gr(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function _r(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var vr=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),yr=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function br(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=gr(e,n);if(!o||yr.has(o.protocol)||!(vr.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=_r(e);return o&&t.some(e=>{let t=gr(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function xr(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)xr(t)}}var Sr=Symbol(`node-seen`);function Cr(e,t,n){return t===mr.remove?{type:`remove`}:t===mr.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function wr(e,t,n){if(t===mr.remove)return{type:`remove`};if(t===mr.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var Tr=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[Sr])return!0;if(u.tagName===`a`){let n=br(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[Sr]=!0,qt(u,l),f&&typeof d==`number`){let e=Cr(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[Gt,d];f.children[d]=e.element}return Gt}return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=br(u.properties.src,n,e,r,!0,i);if(t===null){if(u[Sr]=!0,qt(u,l),f&&typeof d==`number`){let e=wr(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[Gt,d];f.children[d]=e.element}return Gt}return u.properties.src=t,!0}return!0};return l},Er=Object.defineProperty,Dr=Object.defineProperties,Or=Object.getOwnPropertyDescriptors,kr=Object.getOwnPropertySymbols,Ar=Object.prototype.hasOwnProperty,jr=Object.prototype.propertyIsEnumerable,Mr=(e,t,n)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||={})Ar.call(t,n)&&Mr(e,n,t[n]);if(kr)for(var n of kr(t))jr.call(t,n)&&Mr(e,n,t[n]);return e},Pr=(e,t)=>Dr(e,Or(t)),L={PROSE:0,FENCE_MARKER:1,FENCE_INFO:2,FENCE_BODY:3,CODE_SPAN:4,CODE_SPAN_OPEN:5},Fr=/^(`{3,}|~{3,})(.*)$/,Ir=e=>e!==void 0&&e>=`0`&&e<=`9`,Lr=(e,t)=>{let n=t;if(e[n]===`-`||e[n]===`*`||e[n]===`+`)n+=1;else{for(;Ir(e[n])&&n-t<9;)n+=1;if(n===t||e[n]!==`.`&&e[n]!==`)`)return-1;n+=1}return e[n]===` `?n+1:-1},Rr=(e,t,n)=>{let r=0,i=t,a=!1,o=t;for(;;){for(;o<n&&e[o]===` `;)o+=1;if(e[o]===`>`){r+=1,o+=e[o+1]===` `?2:1,i=o,a=!1;continue}let t=o<n?Lr(e,o):-1;if(t===-1)return{contentStart:o,listIndent:a?o-i:0,quoteDepth:r};o=t,a=!0}},zr=(e,t,n,r)=>{let i=t;for(let t=0;t<r;t+=1){for(;i<n&&e[i]===` `;)i+=1;if(e[i]!==`>`)return-1;i+=1,e[i]===` `&&(i+=1)}return i},Br=(e,t,n,r,i)=>{let a=t+r;e.fill(L.FENCE_MARKER,a,a+i),e.fill(L.FENCE_INFO,a+i,Math.min(n+1,e.length))},Vr=(e,t,n,r)=>{let i=t;for(;i<n&&e[i]===` `;)i+=1;let a=0;for(;i<n&&e[i]===r.char;)i+=1,a+=1;if(a<r.length)return!1;for(;i<n;){if(e[i]!==` `&&e[i]!==` `&&e[i]!==`\r`)return!1;i+=1}return!0},Hr=(e,t,n,r)=>{let i=r>n&&e[r-1]===`\r`?r-1:r,a=Rr(e,n,i),o=e.slice(a.contentStart,i).match(Fr);if(!o)return null;let[,s,c]=o,l=s[0];return l==="`"&&c.includes("`")?null:(Br(t,n,r,a.contentStart-n,s.length),{char:l,length:s.length,listIndent:a.listIndent,quoteDepth:a.quoteDepth})},Ur=(e,t,n,r)=>{let i=zr(e,t,n,r.quoteDepth);if(i===-1||r.listIndent===0)return i;let a=i;for(;a<n&&e[a]===` `;)a+=1;return a===n||e[a]===`\r`&&a+1===n||a-i>=r.listIndent?i:-1},Wr=(e,t)=>{let n=e.length,r=null,i=0;for(;i<n;){let a=e.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-JLMTFACH-CMb21a0T.js","assets/rolldown-runtime-COiEfhsA.js","assets/jsx-runtime-CldxteV5.js","assets/mermaid-diagram-7d3eG33H.js","assets/preload-helper-BLdHbfdN.js","assets/index-GmSorqXd.js","assets/react-dom-BNtzwOHF.js","assets/hooks-CZYZW9i_.js","assets/components-Be4xRGcU.js","assets/lib-D-JAPasO.js","assets/dist-DxBCWJgX.js","assets/trpc-D9WuCSM1.js","assets/queryClient-DaT6C6i7.js","assets/background-task-2TNZSSC3.js","assets/utils-DQeSPVda.js","assets/bundle-mjs-CdK3cBzO.js","assets/CheckCircle.es-WUl0_Fqk.js","assets/status-indicators-Dvz22Kk_.js","assets/Warning.es-BRY0GI4S.js","assets/es2015-CDGxiYHE.js","assets/button-Dslj7pht.js","assets/dist-B1Zs6lmy.js","assets/dialog-LD_zPUYD.js","assets/dist-y4SI7xsk.js","assets/dist-DmRbNcLV.js","assets/spinner-BxeSV-Bb.js","assets/ArrowClockwise.es-CucFsYLg.js","assets/CaretDown.es-Dad3vS2k.js","assets/pending-request-presentation-BqY92kUN.js","assets/ShieldWarning.es-CuA46yPp.js","assets/WarningCircle.es-D-X961df.js","assets/image-drop-zone-NvcW7wXO.js","assets/attachment-file-conversion-BG03_iix.js","assets/MagnifyingGlass.es-BlNhc0fx.js","assets/formatters-CbVS7bYs.js","assets/loading-SklnwAL1.js","assets/schemas-cLRPP1ma.js","assets/use-persistent-scroll-DMRAfhA7.js","assets/use-workspace-drawer-D5BHCzpQ.js","assets/use-mobile-Di9JSXG3.js","assets/workspace-cache-reconciler-TKQHxUsu.js","assets/appearance-DsbwoDTa.js","assets/appearance-D7nkDMex.js","assets/dist-D8Wfxh48.js","assets/input-uo3fNc4V.js","assets/dist-CLSCCiF9.js","assets/Plus.es-wnPcLFe1.js","assets/github-pr-preview-B2sd2tDg.js","assets/date-time-DaFd7tnC.js","assets/use-websocket-channel-BApRAMMz.js","assets/index-ClP2IiKy.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-BWF7jMDv.js","assets/chunk-DSNLSHJZ-CSSZ0uRv.js","assets/chunk-7S6XSTFO-v9BVbuJB.js","assets/dist-CumnGVmJ.js","assets/chunk-YZO67HFG-DrH1RXFI.js","assets/chunk-AQDTSKZB-Bh2e4nVN.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-UHW7PFBP-FWZD9983.js","assets/chunk-HAGFOTED-CTCHAkn7.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-ZAUX2LTX-slbBeHT4.js","assets/chunk-WQQL4CDK-V1ZC59EX.js","assets/line-DYrY8V4I.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-HNE4Q36P-SXol6mIL.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./react-dom-BNtzwOHF.js";import{n as i}from"./trpc-D9WuCSM1.js";import{r as a,t as o}from"./background-task-2TNZSSC3.js";import{r as s,t as c}from"./utils-DQeSPVda.js";import{t as l}from"./CheckCircle.es-WUl0_Fqk.js";import{_ as u,c as d,d as f,f as p,g as m,i as h,l as g,m as _,o as v,p as y,r as b,s as x,u as S,v as C,y as w}from"./status-indicators-Dvz22Kk_.js";import{n as T,t as E}from"./spinner-BxeSV-Bb.js";import{t as D}from"./Warning.es-BRY0GI4S.js";import{t as O}from"./ArrowClockwise.es-CucFsYLg.js";import{n as ee,t as te}from"./CaretDown.es-Dad3vS2k.js";import{a as ne,i as re,n as ie,o as ae,r as oe,s as se,t as ce}from"./pending-request-presentation-BqY92kUN.js";import{t as le}from"./WarningCircle.es-D-X961df.js";import{c as ue,r as de,t as k}from"./button-Dslj7pht.js";import{n as A,t as fe}from"./bundle-mjs-CdK3cBzO.js";import{t as pe}from"./loading-SklnwAL1.js";import{C as me,S as he,T as ge,_ as j,a as _e,f as ve,g as ye,i as be,k as xe,l as Se,o as Ce,p as M,r as we,s as Te,u as Ee,v as N,w as De,x as P,y as Oe}from"./schemas-cLRPP1ma.js";import{c as ke,d as Ae,f as je,l as Me,o as Ne,s as Pe,u as Fe}from"./use-persistent-scroll-DMRAfhA7.js";import{$ as Ie,G as Le,K as Re,et as ze,g as Be,h as Ve,u as He}from"./workspace-cache-reconciler-TKQHxUsu.js";import{d as Ue,p as We}from"./es2015-CDGxiYHE.js";import{t as Ge}from"./preload-helper-BLdHbfdN.js";import{t as Ke}from"./MagnifyingGlass.es-BlNhc0fx.js";import{o as qe,r as Je,s as Ye,t as Xe}from"./dist-B1Zs6lmy.js";import{a as Ze,i as Qe,o as $e,r as et,s as tt,t as nt}from"./dialog-LD_zPUYD.js";import{n as rt,t as it}from"./attachment-file-conversion-BG03_iix.js";import"./input-uo3fNc4V.js";import{a as at,p as ot}from"./dist-y4SI7xsk.js";import{a as st,i as ct,n as lt,r as ut}from"./Plus.es-wnPcLFe1.js";import{t as dt}from"./use-mobile-Di9JSXG3.js";import{n as ft,o as pt,r as mt,s as ht}from"./github-pr-preview-B2sd2tDg.js";import{n as gt,r as _t}from"./use-websocket-channel-BApRAMMz.js";import{$ as vt,$t as yt,A as bt,C as xt,O as St,Q as Ct,Xt as wt,Yt as Tt,Z as Et,ct as Dt,en as Ot,et as kt,it as At,j as jt,kt as Mt,lt as Nt,nn as Pt,nt as Ft,on as It,rt as Lt,tn as Rt,w as zt}from"./index-GmSorqXd.js";import{a as Bt,c as Vt,d as Ht,f as Ut,g as Wt,h as Gt,i as Kt,m as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt,u as $t}from"./lib-BF21T6dw.js";import{t as en}from"./FileText.es-C3zlL7Ja.js";import{c as tn,d as nn,p as rn,s as an,t as on,u as sn}from"./SlidersHorizontal.es-DWmgkQAH.js";import{i as cn}from"./codex-accounts-DP-Tb-tZ.js";import{b as ln,c as un,d as dn,f as fn,i as pn,l as mn,m as hn,n as gn,p as _n,t as vn,u as yn}from"./websocket-Q9XnceTt.js";import{i as bn,r as xn,t as Sn}from"./popover-DjYf9lKZ.js";import{t as Cn}from"./Terminal.es-DXk70l2n.js";import{t as wn}from"./list-keys-CmT9WnL5.js";import{n as Tn,t as En}from"./agent-authoring-C33uSQgC.js";import{n as Dn,r as On,t as kn}from"./collapsible-dJ6oDAH6.js";import{a as An,d as jn,f as Mn,i as Nn,l as Pn,n as Fn,o as In,p as Ln,r as Rn,s as zn,t as Bn}from"./CaretLeft.es-CZp1Z1Qg.js";import{n as Vn,t as Hn}from"./radio-group-FNSEl1BJ.js";var Un=1e9,Wn=1e3;function Gn(e){return e.type===`text`}function Kn(e){return e.type===`thinking`}function qn(e){return e.type===`tool_use`}function Jn(e){return e.type===`tool_result`}function Yn(e){if(e.type!==`image`)return!1;let t=e.source;if(typeof t!=`object`||!t)return!1;let n=t;return n.type===`base64`&&typeof n.media_type==`string`&&typeof n.data==`string`}function Xn(e){return e.type===`text`?typeof e.text==`string`:e.type===`thinking`?typeof e.thinking==`string`:e.type===`tool_use`?typeof e.id==`string`&&typeof e.name==`string`&&(e.input===void 0||typeof e.input==`object`&&e.input!==null):e.type===`tool_result`?typeof e.tool_use_id==`string`&&(typeof e.content==`string`||Array.isArray(e.content)):e.type===`image`&&Yn(e)}function Zn(e){return e.some(Xn)}function Qn(e){return Array.isArray(e)?e.some(e=>e.type===`tool_result`):!1}function $n(e){if(e.type===`user`)return e.message?Qn(e.message.content):!1;if(e.type===`assistant`){let t=e.message?.content;return typeof t==`string`?t.length>0:Array.isArray(t)&&Zn(t)}if(e.type===`result`||e.type!==`stream_event`)return!0;if(e.event?.type!==`content_block_start`)return!1;let t=e.event.content_block;return t.type!==`text`&&Xn(t)}var er={selectedModel:`opus`,reasoningEffort:null,thinkingEnabled:!1,planModeEnabled:!1};function tr(e){return e??er.selectedModel}var nr=1e4;function rr(e,t){return Array.isArray(e)&&e.some(e=>e.type===t)}function ir(e){return e.type===`stream_event`?e.event?.type===`content_block_start`&&e.event.content_block.type===`tool_result`:e.message?rr(e.message.content,`tool_result`):!1}function ar(e){return e.type===`stream_event`&&e.event?.type!==`content_block_start`}function or(e){return e.source===`user`?!0:e.message?!(ir(e.message)||ar(e.message)):!1}function sr(e){return e.message?.type===`session_lifecycle`?e.order:e.order<0?1/0:e.order}function cr(e,t){let n=sr(e),r=sr(t);return n===r?0:n<r?-1:1}function lr(e,t=Wn){let n=e.every((t,n)=>n===0||cr(e[n-1]??t,t)<=0)?e:[...e].sort(cr);if(n.length<=t)return n;let r=Math.max(0,n.length-t),i=n.findIndex((e,t)=>t>=r&&or(e));return i===-1?n.slice(r):n.slice(i)}function ur(e){if(e.type===`assistant`&&e.message){if(typeof e.message.content==`string`)return e.message.content.trim();if(Array.isArray(e.message.content))return e.message.content.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim()}return e.type===`stream_event`&&e.event?.type===`content_block_start`&&e.event.content_block.type===`text`?e.event.content_block.text.trim():``}function dr(e,t=0){if(t>4||e==null)return null;if(typeof e==`string`)return e.trim();if(Array.isArray(e)){for(let n of e){let e=dr(n,t+1);if(e!==null)return e}return null}if(typeof e!=`object`)return null;let n=e;for(let e of[`result`,`text`,`output_text`,`output`,`message`,`content`]){if(!(e in n))continue;let r=dr(n[e],t+1);if(r!==null)return r}return null}function fr(e,t){if(t.type!==`result`)return!1;let n=dr(t.result);if(n===null)return!1;if(!n)return!0;let r=e=>e.source===`user`&&e.order<Un;for(let t=e.length-1;t>=0;--t){let i=e[t];if(!i)continue;if(r(i))return!1;if(i.source!==`agent`||!i.message)continue;if(i.message.type===`result`)return!1;let a=ur(i.message);if(a)return a===n}return!1}var pr=function(e){return e.PENDING=`PENDING`,e.SENT=`SENT`,e.ACCEPTED=`ACCEPTED`,e.DISPATCHED=`DISPATCHED`,e.COMMITTED=`COMMITTED`,e.REJECTED=`REJECTED`,e.FAILED=`FAILED`,e.CANCELLED=`CANCELLED`,e.STREAMING=`STREAMING`,e.COMPLETE=`COMPLETE`,e}({}),F=e(t(),1),I=n(),mr={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function hr({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=mr.indicator,imageBlockPolicy:c=mr.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=Tr(e,t,n,r,i,a,o,s,c);xr(l),qt(l,u)}}function gr(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function _r(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var vr=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),yr=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function br(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=gr(e,n);if(!o||yr.has(o.protocol)||!(vr.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=_r(e);return o&&t.some(e=>{let t=gr(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function xr(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)xr(t)}}var Sr=Symbol(`node-seen`);function Cr(e,t,n){return t===mr.remove?{type:`remove`}:t===mr.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function wr(e,t,n){if(t===mr.remove)return{type:`remove`};if(t===mr.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var Tr=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[Sr])return!0;if(u.tagName===`a`){let n=br(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[Sr]=!0,qt(u,l),f&&typeof d==`number`){let e=Cr(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[Gt,d];f.children[d]=e.element}return Gt}return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=br(u.properties.src,n,e,r,!0,i);if(t===null){if(u[Sr]=!0,qt(u,l),f&&typeof d==`number`){let e=wr(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[Gt,d];f.children[d]=e.element}return Gt}return u.properties.src=t,!0}return!0};return l},Er=Object.defineProperty,Dr=Object.defineProperties,Or=Object.getOwnPropertyDescriptors,kr=Object.getOwnPropertySymbols,Ar=Object.prototype.hasOwnProperty,jr=Object.prototype.propertyIsEnumerable,Mr=(e,t,n)=>t in e?Er(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||={})Ar.call(t,n)&&Mr(e,n,t[n]);if(kr)for(var n of kr(t))jr.call(t,n)&&Mr(e,n,t[n]);return e},Pr=(e,t)=>Dr(e,Or(t)),L={PROSE:0,FENCE_MARKER:1,FENCE_INFO:2,FENCE_BODY:3,CODE_SPAN:4,CODE_SPAN_OPEN:5},Fr=/^(`{3,}|~{3,})(.*)$/,Ir=e=>e!==void 0&&e>=`0`&&e<=`9`,Lr=(e,t)=>{let n=t;if(e[n]===`-`||e[n]===`*`||e[n]===`+`)n+=1;else{for(;Ir(e[n])&&n-t<9;)n+=1;if(n===t||e[n]!==`.`&&e[n]!==`)`)return-1;n+=1}return e[n]===` `?n+1:-1},Rr=(e,t,n)=>{let r=0,i=t,a=!1,o=t;for(;;){for(;o<n&&e[o]===` `;)o+=1;if(e[o]===`>`){r+=1,o+=e[o+1]===` `?2:1,i=o,a=!1;continue}let t=o<n?Lr(e,o):-1;if(t===-1)return{contentStart:o,listIndent:a?o-i:0,quoteDepth:r};o=t,a=!0}},zr=(e,t,n,r)=>{let i=t;for(let t=0;t<r;t+=1){for(;i<n&&e[i]===` `;)i+=1;if(e[i]!==`>`)return-1;i+=1,e[i]===` `&&(i+=1)}return i},Br=(e,t,n,r,i)=>{let a=t+r;e.fill(L.FENCE_MARKER,a,a+i),e.fill(L.FENCE_INFO,a+i,Math.min(n+1,e.length))},Vr=(e,t,n,r)=>{let i=t;for(;i<n&&e[i]===` `;)i+=1;let a=0;for(;i<n&&e[i]===r.char;)i+=1,a+=1;if(a<r.length)return!1;for(;i<n;){if(e[i]!==` `&&e[i]!==` `&&e[i]!==`\r`)return!1;i+=1}return!0},Hr=(e,t,n,r)=>{let i=r>n&&e[r-1]===`\r`?r-1:r,a=Rr(e,n,i),o=e.slice(a.contentStart,i).match(Fr);if(!o)return null;let[,s,c]=o,l=s[0];return l==="`"&&c.includes("`")?null:(Br(t,n,r,a.contentStart-n,s.length),{char:l,length:s.length,listIndent:a.listIndent,quoteDepth:a.quoteDepth})},Ur=(e,t,n,r)=>{let i=zr(e,t,n,r.quoteDepth);if(i===-1||r.listIndent===0)return i;let a=i;for(;a<n&&e[a]===` `;)a+=1;return a===n||e[a]===`\r`&&a+1===n||a-i>=r.listIndent?i:-1},Wr=(e,t)=>{let n=e.length,r=null,i=0;for(;i<n;){let a=e.indexOf(`
3
3
  `,i);a===-1&&(a=n);let o=r?Ur(e,i,a,r):-1;r&&o===-1&&(r=null),r?Vr(e,o,a,r)?(t.fill(L.FENCE_MARKER,i,a),r=null):t.fill(L.FENCE_BODY,i,Math.min(a+1,n)):r=Hr(e,t,i,a),i=a+1}return r},Gr=(e,t)=>{let n=t+1;for(;n<e.length&&e[n]==="`";)n+=1;return n},Kr=(e,t)=>{let n=t+1;for(;n<e.length&&(e[n]===` `||e[n]===` `||e[n]===`\r`);)n+=1;return n<e.length&&e[n]===`
4
4
  `},qr=(e,t,n)=>{let r=n;for(;;){let n=e.indexOf("`",r);if(n===-1)return-1;let i=n>r&&e[n-1]===`\\`&&t[n-1]===L.PROSE;if(t[n]===L.PROSE&&!i)return n;r=n+1}},Jr=(e,t)=>{let n=e.length,r=-1,i=0,a=0;for(;a<n;){if(r<0){if(a=qr(e,t,a),a===-1)break;let n=Gr(e,a);r=a,i=n-a,a=n;continue}if(t[a]!==L.PROSE){t.fill(L.CODE_SPAN_OPEN,r,a),r=-1,a+=1;continue}if(e[a]===`
5
5
  `&&Kr(e,a)){r=-1,a+=1;continue}if(e[a]!=="`"){a+=1;continue}let n=Gr(e,a);n-a===i&&(t.fill(L.CODE_SPAN,r,n),r=-1),a=n}return r>=0?(t.fill(L.CODE_SPAN_OPEN,r,n),{start:r,runLength:i}):null},Yr=e=>{let t=new Uint8Array(e.length);return{text:e,regions:t,openFence:Wr(e,t),openSpan:Jr(e,t),mathMask:null,linkUrlMask:null,htmlTagMask:null}},Xr=null,Zr=null,Qr=e=>{if(Zr!==null&&e===Xr)return Zr;let t=Yr(e);return Xr=e,Zr=t,t},$r=()=>{Xr=null,Zr=null},ei=(e,t)=>t>=e.regions.length?e.openFence!==null||e.openSpan!==null:t<0?!1:e.regions[t]!==L.PROSE,ti=(e,t)=>e.regions[t]===L.CODE_SPAN,ni=(e,t)=>{let n=Qr(e),r=t+t,i=0;for(let t=e.indexOf(r);t!==-1;t=e.indexOf(r,t))n.regions[t]===L.PROSE?(i+=1,t+=2):t+=1;return i},ri=new Uint8Array,ii=e=>e===`inlineLatex`||e===`blockLatex`,ai=(e,t)=>t===`[`&&e===`none`?`blockLatex`:t===`]`&&e===`blockLatex`?`none`:t===`(`&&e===`none`?`inlineLatex`:t===`)`&&e===`inlineLatex`?`none`:null,oi=(e,t)=>t?e===`blockDollar`?`none`:`blockDollar`:e===`blockDollar`?e:e===`inlineDollar`?`none`:`inlineDollar`,si=e=>e.includes(`$`)||e.includes(`\\(`)||e.includes(`\\[`),ci=(e,t,n)=>{let r=e[t+1];if(e[t]===`\\`){if(r===`$`)return{context:n,length:2};let e=ai(n,r);return e===null?null:{context:e,length:2}}if(e[t]===`$`&&!ii(n)){let e=r===`$`;return{context:oi(n,e),length:e?2:1}}return null},li=e=>{let{text:t,regions:n}=e,r=t.length,i=new Uint8Array(r),a=`none`,o=0;for(;o<r;){i[o]=a===`none`?0:1;let e=n[o]===L.PROSE?ci(t,o,a):null;e===null?o+=1:(a=e.context,e.length===2&&(i[o+1]=a===`none`?0:1),o+=e.length)}return i},ui=(e,t)=>t<0||t>=e.text.length?!1:(e.mathMask===null&&(e.mathMask=si(e.text)?li(e):ri),e.mathMask[t]===1),di=(e,t,n,r)=>{let{text:i,regions:a}=e,o=new Uint8Array(n-t),s=0;for(let e=n-1;e>=t;--e)i[e]===`)`&&a[e]===L.PROSE&&(s=1),o[e-t]=s;let c=!1;for(let e=t;e<n;e+=1)c&&o[e-t]===1&&(r[e]=1),a[e]===L.PROSE&&(i[e]===`)`?c=!1:i[e]===`(`&&(c=e>0&&i[e-1]===`]`))},fi=e=>{let{text:t}=e,n=t.length,r=new Uint8Array(n),i=0;for(;i<n;){let a=t.indexOf(`
@@ -94,7 +94,7 @@ ${e}</tr>
94
94
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${_s(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?_s(n,!0):this.parser.parseInline(r),o=ys(e);if(o===null)return a;e=_s(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+_s(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ys(e);if(i===null)return _s(n);e=i;let a=`<img src="${_s(e)}" alt="${_s(n)}"`;return t&&(a+=` title="${_s(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:_s(e.text)}},Rs=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},zs=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ka,this.options.renderer=this.options.renderer||new Ls,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Rs,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Bs=class{options;block;constructor(e){this.options=e||Ka}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Is.lex:Is.lexInline}provideParser(e=this.block){return e?zs.parse:zs.parseInline}};function Vs(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Hs=new class{defaults=Ga();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=zs;Renderer=Ls;TextRenderer=Rs;Lexer=Is;Tokenizer=Fs;Hooks=Bs;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Vs(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Vs(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Vs(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Vs(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);Vs(n,this.walkTokens(i,t))}):e.tokens&&Vs(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Ls(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Fs(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Bs;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Bs.passThroughHooks.has(n)?e=>{if(t.options.async&&Bs.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return Vs(n,r.call(this,e)),t&&Vs(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Is.lex(e,t??this.defaults)}parser(e,t){return zs.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Is.lex:Is.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?zs.parse:zs.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Is.lex:Is.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?zs.parse:zs.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
95
95
  Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+_s(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function z(e,t){return Hs.parse(e,t)}z.options=z.setOptions=function(e){return Hs.setOptions(e),z.defaults=Hs.defaults,qa(z.defaults),z},z.getDefaults=Ga,z.defaults=Ka;function Us(...e){return Hs.use(...e),z.defaults=Hs.defaults,qa(z.defaults),z}z.use=Us,z.walkTokens=function(e,t){return Hs.walkTokens(e,t)},z.parseInline=Hs.parseInline,z.Parser=zs,z.parser=zs.parse,z.Renderer=Ls,z.TextRenderer=Rs,z.Lexer=Is,z.lexer=Is.lex,z.Tokenizer=Fs,z.Hooks=Bs,z.parse=z,z.options,z.setOptions,z.walkTokens,z.parseInline,zs.parse,Is.lex;var Ws=300,Gs=`300px`,Ks=500;function qs(e={}){let{immediate:t=!1,debounceDelay:n=Ws,rootMargin:r=Gs,idleTimeout:i=Ks}=e,[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),c=(0,F.useRef)(null),l=(0,F.useRef)(null),u=(0,F.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,F.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,F.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,F.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var Js=320,Ys=4,Xs=()=>typeof performance>`u`?Date.now():performance.now();function Zs(e){let t=e?.now??Xs,n=e?.maxBacklogMs??Js,r=0,i=0;return{now:t,beginPass(e){i=Math.min(Math.max(r,e),e+n)},mark(){return i},rewind(e){i=e},take(e,t,r){if(e<=0)return{baseDelay:0,step:Math.max(0,t)};let a=Math.max(0,t),o=a===0?0:Math.min(a,Ys),s=Math.max(i,r),c=r+n,l=s+Math.max(0,e-1)*a,u=a;if(l>c&&e>1){if(s<c){let t=c-s;u=Math.max(o,t/(e-1))}else u=o}let d=Math.max(0,Math.round(s-r));return i=s+e*u,{baseDelay:d,step:u}},commitPass(){r=i}}}var Qs=/\s/,$s=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\u3000-\u303F\uFF00-\uFFEF]/u,ec=/^\s+$/,tc=new Set([`pre`,`svg`,`math`,`annotation`]),nc=new Set([`img`,`hr`]),rc=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,ic=e=>e.some(e=>rc(e)&&tc.has(e.tagName)),ac=e=>{for(let t=e.length-1;t>=0;t--){let n=e[t];if(rc(n)&&n.tagName===`li`)return n}},oc=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate-marker`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-marker-duration:${t}ms;--sd-marker-delay:${Math.round(n)}ms;--sd-marker-easing:${r}`},sc=new Set([`ul`,`ol`,`li`]),cc=e=>{for(let t of e.children)if(rc(t)){if(t.tagName===`input`)return t;if(sc.has(t.tagName))continue;let e=cc(t);if(e)return e}},lc=(e,t,n,r)=>{e.properties??={},e.properties[`data-sd-animate`]=!0;let i=typeof e.properties.style==`string`?`${e.properties.style};`:``;e.properties.style=`${i}--sd-animation:sd-${t.animation};--sd-duration:${n}ms;--sd-easing:${t.easing};--sd-delay:${Math.round(r)}ms`},uc=(e,t,n,r)=>{let i=cc(e);i&&lc(i,t,n,r)},dc=(e,t,n,r,i,a)=>{if(ic(t))return;let o=r.prevContentLength,s=i.count;i.count+=1;let c=o>0&&s<o,l=c?0:a.baseDelay+i.newIndex++*a.step;lc(e,n,c?0:n.duration,l)},fc=e=>{var t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(rc(r)){if((t=r.properties)!=null&&t[`data-sd-animated`])break;r.properties={...r.properties,"data-sd-animated":!0}}}},pc=e=>{let t=[],n=``,r=!1,i=!1;for(let a of e){let e=Qs.test(a),o=!e&&$s.test(a);if(!e&&n!==``&&(o||i))t.push(n),n=``,r=!1;else if(e!==r&&n){if(e){n+=a,r=!0;continue}t.push(n),n=``}n+=a,r=e,i=o}return n&&t.push(n),t},mc=e=>{let t=[],n=``;for(let r of e)Qs.test(r)?t.length>0&&!ec.test(t.at(-1))?t[t.length-1]+=r:n+=r:(n&&=(t.push(n),``),t.push(r));return n&&(t.length>0?t[t.length-1]+=n:t.push(n)),t},hc=/^[^\s;:'"\\/](?:[^;:'"\\/\r\n]*[^\s;:'"\\/])?$/,gc=(e,t,n,r)=>{let i=`sd-${t.animation}`,a=`${n?0:t.duration}ms`,o;return t.styleObjects?(o={"--sd-animation":i,"--sd-duration":a,"--sd-easing":t.easing},r&&(o[`--sd-delay`]=`${Math.round(r)}ms`)):(o=`--sd-animation:${i};--sd-duration:${a};--sd-easing:${t.easing}`,r&&(o+=`;--sd-delay:${Math.round(r)}ms`)),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},_c=(e,t)=>!(e>0&&t<e),vc=e=>rc(e)&&nc.has(e.tagName),yc=(e,t,n)=>{let r=0,i=0;return Wt(e,e=>e.type===`text`||vc(e),(e,a)=>{if(ic(a))return Gt;if(vc(e)){_c(n,i)&&(r+=1),i+=1;return}let o=e.value;if(!o.trim()){i+=o.length;return}let s=t.sep===`char`?mc(o):pc(o);for(let e of s){let t=i;i+=e.length,!ec.test(e)&&_c(n,t)&&(r+=1)}}),r},bc=(e,t,n,r,i,a)=>{var o;let s=t.at(-1);if(!(s&&`children`in s))return;if(ic(t))return Gt;let c=s,l=c.children.indexOf(e);if(l===-1)return;let u=e.value;if(!u.trim()){i.count+=u.length;return}let d=n.sep===`char`?mc(u):pc(u),f=r.prevContentLength,p=!1,m=ac(t),h=!(!m||(o=m.properties)!=null&&o[`data-sd-animate-marker`]),g=!1,_=d.map(e=>{let t=i.count;if(i.count+=e.length,ec.test(e))return{type:`text`,value:e};let r=f>0&&t<f,o=r?0:a.baseDelay+i.newIndex++*a.step;if(p=!0,m&&h&&!g){let e=r?0:n.duration;oc(m,e,o,n.easing),uc(m,n,e,o),g=!0}return gc(e,n,r,o)});return p&&fc(t),c.children.splice(l,1,..._),l+_.length},xc=0;function Sc(e){return wc(e,!1)}var Cc=e=>wc(e,!0);function wc(e,t){let n=e?.animation??`fadeIn`,r=e?.easing??`ease`,i={animation:n,duration:e?.duration??150,easing:r,sep:e?.sep??`word`,stagger:e?.stagger??40,styleObjects:t&&hc.test(n)&&hc.test(r),timeline:e?.timeline},a={committedCharCount:0,prevContentLength:0,lastRenderCharCount:0,pendingMark:null},o=xc++,s=()=>e=>{let t={count:0,newIndex:0};a.prevContentLength=a.committedCharCount;let n=i.timeline,r=n?.now()??Xs();n&&(a.pendingMark===null?a.pendingMark=n.mark():n.rewind(a.pendingMark));let o=n?n.take(yc(e,i,a.prevContentLength),i.stagger,r):{baseDelay:0,step:i.stagger};Wt(e,e=>e.type===`text`||vc(e),(e,n)=>{if(e.type===`text`)return bc(e,n,i,a,t,o);dc(e,n,i,a,t,o)}),a.lastRenderCharCount=t.count,a.prevContentLength=0};return Object.defineProperty(s,"name",{value:`rehypeAnimate$${o}`}),{name:`animate`,type:`animate`,rehypePlugin:s,setPrevContentLength(e){a.committedCharCount=e,a.prevContentLength=e},getLastRenderCharCount(){return a.lastRenderCharCount},commit(){a.committedCharCount=a.lastRenderCharCount,a.pendingMark=null}}}Sc();var Tc=(0,F.createContext)(!1),Ec=()=>(0,F.useContext)(Tc),Dc=(...e)=>fe(A(e)),Oc=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},kc=e=>e?(...t)=>Oc(e,fe(A(t))):Dc,Ac=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},jc=(0,F.createContext)(Dc),B=()=>(0,F.useContext)(jc),Mc=8,Nc=e=>{if(e!==void 0&&e!==0&&e!==1/0){if(typeof e==`number`)return Number.isFinite(e)&&e>0?`${e}px`:void 0;if(e!==`0`&&e!==`none`&&e!==`Infinity`)return e}},Pc=(e,t,n)=>{let r=(0,F.useRef)(null),i=(0,F.useRef)(!0),a=(0,F.useRef)(!1),o=(0,F.useRef)(null);return(0,F.useEffect)(()=>{let e=r.current;if(!(e&&t))return;let n=()=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<Mc;i.current=t};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[t]),(0,F.useEffect)(()=>{e&&!a.current&&(i.current=!0),e||(i.current=!0),a.current=e},[e]),(0,F.useEffect)(()=>()=>{o.current!==null&&cancelAnimationFrame(o.current)},[]),(0,F.useEffect)(()=>{let n=r.current;!(n&&t&&e&&i.current)||o.current!==null||(o.current=requestAnimationFrame(()=>{o.current=null,i.current&&n.scrollTo({top:n.scrollHeight,behavior:`instant`})}))},[e,t,n]),r},Fc=Dc(`block`),Ic=Dc(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),Lc=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},Rc=(0,F.memo)(({children:e,result:t,language:n,className:r,maxHeight:i,startLine:a,lineNumbers:o=!0,...s})=>{let c=B(),{isAnimating:l}=(0,F.useContext)($d),u=Nc(i),d=Pc(l,!!u,t),f=(0,F.useMemo)(()=>c(Ic),[c]),p=(0,F.useMemo)(()=>c(Fc),[c]),m=(0,F.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,Lc(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,I.jsx)(`div`,{className:c(r,u?`overflow-y-auto`:null,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,ref:d,style:u?{maxHeight:u}:void 0,...s,children:(0,I.jsx)(`pre`,{className:c(r,`bg-[var(--sdm-bg,inherit)]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]`),style:m,children:(0,I.jsx)(`code`,{className:o?c(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:o&&a&&a>1?{counterReset:`line ${a-1}`}:void 0,children:t.tokens.map((e,t)=>(0,I.jsx)(`span`,{className:o?f:p,children:e.length===0||e.length===1&&e[0].content===``?`
96
96
  `:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,I.jsx)(`span`,{className:c(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})}),zc=({className:e,language:t,style:n,isIncomplete:r,...i})=>{let a=B();return(0,I.jsx)(`div`,{className:a(`relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i})},Bc=(0,F.createContext)({code:``}),Vc=()=>(0,F.useContext)(Bc),Hc=({language:e})=>{let t=B();return(0,I.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,I.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},Uc=e=>{let t=e.length;for(;t>0&&e[t-1]===`
97
- `;)t--;return e.slice(0,t)},Wc=(0,F.lazy)(()=>Ge(()=>import(`./highlighted-body-JLMTFACH-Dy-R6Y8r.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1,2]))),Gc=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=B(),{codeBlockMaxHeight:l}=(0,F.useContext)($d),u=(0,F.useMemo)(()=>Uc(e),[e]),d=(0,F.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
97
+ `;)t--;return e.slice(0,t)},Wc=(0,F.lazy)(()=>Ge(()=>import(`./highlighted-body-JLMTFACH-CMb21a0T.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1,2]))),Gc=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=B(),{codeBlockMaxHeight:l}=(0,F.useContext)($d),u=(0,F.useMemo)(()=>Uc(e),[e]),d=(0,F.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:u.split(`
98
98
  `).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[u]);return(0,I.jsx)(Bc.Provider,{value:{code:e},children:(0,I.jsxs)(zc,{dir:`ltr`,isIncomplete:i,language:t,children:[(0,I.jsx)(Hc,{language:t}),r?(0,I.jsx)(`div`,{className:c(`pointer-events-none absolute top-2 right-2 z-10 flex items-center`),children:(0,I.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(Rc,{className:n,language:t,lineNumbers:o,maxHeight:l,result:d,startLine:a,...s}),children:(0,I.jsx)(Wc,{className:n,code:u,isIncomplete:i,language:t,lineNumbers:o,maxHeight:l,raw:d,startLine:a,...s})})]})})},Kc={CheckIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,I.jsxs)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,I.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,I.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,I.jsx)(`svg`,{"aria-hidden":`true`,color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,I.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},qc=(0,F.createContext)(Kc),Jc=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])},Yc=({icons:e,children:t})=>{let n=(0,F.useRef)(e),r=(0,F.useRef)(e?{...Kc,...e}:Kc);Jc(n.current,e)||(n.current=e,r.current=e?{...Kc,...e}:Kc);let i=r.current;return(0,I.jsx)(qc.Provider,{value:i,children:t})},Xc=()=>(0,F.useContext)(qc),Zc={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,zoomIn:`Zoom in`,zoomOut:`Zoom out`,resetView:`Reset zoom and pan`,mermaidAriaLabel:`Mermaid chart`,errorMermaid:`Failed to render Mermaid chart`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},Qc=(0,F.createContext)(Zc),$c=()=>(0,F.useContext)(Qc),el=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=B(),[c,l]=(0,F.useState)(!1),u=(0,F.useRef)(0),{code:d}=Vc(),{isAnimating:f}=(0,F.useContext)($d),p=$c(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText))t?.(Error(`Clipboard API not available`));else try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,F.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=Xc(),_=c?g.CheckIcon:g.CopyIcon;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{"aria-label":p.copyCode,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,I.jsx)(_,{"aria-hidden":`true`,size:14})}),c&&(0,I.jsx)(`output`,{"aria-live":`polite`,className:`sr-only`,children:p.copied})]})},tl=(e,t,n)=>{if(typeof e==`boolean`)return n;let r=e[t];if(typeof r!=`object`)return n;let i=r.download;return typeof i==`object`&&i.filename||n},nl=(e,t)=>{if(typeof e==`boolean`)return{};let n=e[t];if(typeof n!=`object`)return{};let r=n.copy;return typeof r!=`object`||!r?{}:{onCopy:r.onCopy,onError:r.onError}},rl={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},il=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=B(),{code:c}=Vc(),{isAnimating:l,controls:u}=(0,F.useContext)($d),d=$c(),f=Xc(),p=a??c,m=n&&n in rl?rl[n]:`txt`,h=`${tl(u,`code`,`file`)}.${m}`;return(0,I.jsx)(`button`,{"aria-label":d.downloadFile,className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{Ac(h,p,`text/plain`),e?.()}catch(e){t?.(e)}},title:d.downloadFile,type:`button`,...o,children:r??(0,I.jsx)(f.DownloadIcon,{size:14})})},al=()=>{let{Loader2Icon:e}=Xc(),t=B();return(0,I.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,I.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,I.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,I.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},ol=/\.[^/.]+$/,sl=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,showControls:o=!0,showDownloadControl:s=!0,...c})=>{let{DownloadIcon:l}=Xc(),u=B(),d=(0,F.useRef)(null),[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(!1),g=$c(),_=c.width!=null||c.height!=null,v=(f||_)&&!m&&o&&s,y=m&&!_;(0,F.useEffect)(()=>{let e=d.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;p(t),h(!t)}},[]);let b=(0,F.useCallback)(e=>{p(!0),h(!1),i?.(e)},[i]),x=(0,F.useCallback)(e=>{p(!1),h(!0),a?.(e)},[a]),S=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(ol,``)}.${i}`}Ac(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?n===`streamdown:incomplete-image`?(0,I.jsx)(`div`,{className:u(`group relative my-4 inline-block`),"data-incomplete":`true`,"data-streamdown":`image-wrapper`,children:(0,I.jsx)(`div`,{className:u(`h-24 w-48 animate-pulse rounded-lg bg-muted`),"data-streamdown":`image-placeholder`})}):(0,I.jsxs)(`div`,{className:u(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,I.jsx)(`img`,{alt:r,className:u(`max-w-full rounded-lg`,y&&`hidden`,t),"data-streamdown":`image`,onError:x,onLoad:b,ref:d,src:n,...c}),y&&(0,I.jsx)(`span`,{className:u(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:g.imageNotAvailable}),o&&(0,I.jsx)(`div`,{className:u(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`),"data-streamdown":`image-overlay`}),v&&(0,I.jsx)(`button`,{className:u(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:S,title:g.downloadImage,type:`button`,children:(0,I.jsx)(l,{size:14})})]}):null},cl=e=>(typeof e==`function`?e():e)??document.body,ll=0,ul=()=>{ll+=1,ll===1&&(document.body.style.overflow=`hidden`)},dl=()=>{ll=Math.max(0,ll-1),ll===0&&(document.body.style.overflow=``)},fl=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=Xc(),c=B(),[l,u]=(0,F.useState)(!1),d=$c(),{portal:f}=(0,F.useContext)($d),p=(0,F.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),m=(0,F.useCallback)(()=>{r(),n()},[r,n]);if((0,F.useEffect)(()=>{if(t){ul();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),dl()}}},[t,n]),!t||typeof document>`u`)return null;let h=(0,I.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,I.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,I.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,I.jsx)(s,{size:16})}),(0,I.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,I.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,I.jsx)(o,{size:20}),(0,I.jsx)(`span`,{children:d.openExternalLink})]}),(0,I.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,I.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,I.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,I.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:p,type:`button`,children:l?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(i,{size:14}),(0,I.jsx)(`span`,{children:d.copied})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{size:14}),(0,I.jsx)(`span`,{children:d.copyLink})]})}),(0,I.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:m,type:`button`,children:[(0,I.jsx)(o,{size:14}),(0,I.jsx)(`span`,{children:d.openLink})]})]})]})});return(0,Wa.createPortal)(h,cl(f))},pl=(0,F.createContext)(null),ml=()=>(0,F.useContext)(pl),hl=()=>ml()?.code??null,gl=()=>ml()?.mermaid??null,_l=e=>{var t;let n=ml();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},vl=/<svg\b[^>]*>/i,yl=/\bviewBox=(['"])(.*?)\1/i,bl=/[\s,]+/,xl=/\swidth=(['"]).*?\1/gi,Sl=/\sheight=(['"]).*?\1/gi,Cl=/\sstyle=(['"])(.*?)\1/i,wl=/^width\s*:/i,Tl=/^height\s*:/i,El=/^max-width\s*:/i,Dl=/^<svg/i,Ol=e=>{let t=e.match(vl);if(!t)return null;let n=t[0].match(yl)?.[2];if(!n)return null;let r=n.trim().split(bl).map(e=>Number.parseFloat(e));if(r.length<4||r.slice(0,4).some(Number.isNaN))return null;let i=r[2],a=r[3];return i>0&&a>0?{height:a,width:i}:null},kl=e=>{let t=e.match(vl);if(!t)return e;try{let n=t[0],r=Ol(e);if(!r)return e;let{width:i,height:a}=r,o=n.replace(xl,``).replace(Sl,``),s=o.match(Cl),c=`width:${i}px;height:${a}px;max-width:none;`;if(s){let e=s[1],t=s[2].split(`;`).map(e=>e.trim()).filter(Boolean).filter(e=>!(wl.test(e)||Tl.test(e)||El.test(e))).join(`;`),n=`${c}${t?`${t};`:``}`;o=o.replace(Cl,` style=${e}${n}${e}`)}else o=o.replace(Dl,`<svg style="${c}"`);return o=o.replace(Dl,`<svg width="${i}" height="${a}"`),e.replace(n,o)}catch{return e}},Al=e=>{if(typeof DOMParser>`u`||typeof XMLSerializer>`u`)return e;let t=new DOMParser().parseFromString(e,`text/html`).querySelector(`svg`);return t?new XMLSerializer().serializeToString(t):e},jl=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);o?(o.drawImage(i,0,0,r,a),e.toBlob(e=>{e?t(e):n(Error(`Failed to create PNG blob`))},`image/png`)):n(Error(`Failed to create 2D canvas context for PNG export`))},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),Ml=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=B(),[s,c]=(0,F.useState)(!1),l=(0,F.useRef)(null),{isAnimating:u,controls:d}=(0,F.useContext)($d),f=Xc(),p=gl(),m=$c(),h=tl(d,`mermaid`,`diagram`),g=async t=>{try{if(t===`mmd`){Ac(`${h}.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!p){a?.(Error(`Mermaid plugin not available`));return}let n=p.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}let u=Al(l);if(t===`svg`){Ac(`${h}.svg`,u,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){let e=await jl(u);Ac(`${h}.png`,e,`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,F.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,I.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,I.jsx)(`button`,{"aria-label":m.downloadDiagram,className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:m.downloadDiagram,type:`button`,children:t??(0,I.jsx)(f.DownloadIcon,{"aria-hidden":`true`,size:14})}),s?(0,I.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,I.jsx)(`button`,{"aria-label":m.downloadDiagramAsSvg,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`svg`),title:m.downloadDiagramAsSvg,type:`button`,children:m.mermaidFormatSvg}),(0,I.jsx)(`button`,{"aria-label":m.downloadDiagramAsPng,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`png`),title:m.downloadDiagramAsPng,type:`button`,children:m.mermaidFormatPng}),(0,I.jsx)(`button`,{"aria-label":m.downloadDiagramAsMmd,className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`mmd`),title:m.downloadDiagramAsMmd,type:`button`,children:m.mermaidFormatMmd})]}):null]})},Nl=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=Xc(),c=B(),[l,u]=(0,F.useState)(!1),{isAnimating:d,controls:f,portal:p}=(0,F.useContext)($d),m=$c(),h=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.panZoom!==!1})(),g=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.download!==!1})(),_=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0||e.copy!==!1})(),v=()=>{u(!l)};return(0,F.useEffect)(()=>{if(l){ul();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),dl()}}},[l]),(0,F.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:v,title:m.viewFullscreen,type:`button`,...a,"aria-label":m.viewFullscreen,children:(0,I.jsx)(o,{"aria-hidden":`true`,size:14})}),l?(0,Wa.createPortal)((0,I.jsxs)(`div`,{"aria-label":m.viewFullscreen,"aria-modal":`true`,className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),"data-streamdown":`mermaid-fullscreen`,onClick:v,onKeyDown:e=>{e.key===`Escape`&&v()},role:`dialog`,children:[(0,I.jsxs)(`div`,{className:c(`absolute top-4 right-4 z-10 flex items-center gap-1`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[g?(0,I.jsx)(Ml,{chart:e,config:t}):null,_?(0,I.jsx)(el,{code:e}):null,(0,I.jsx)(`button`,{"aria-label":m.exitFullscreen,className:c(`rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:v,title:m.exitFullscreen,type:`button`,children:(0,I.jsx)(s,{"aria-hidden":`true`,size:20})})]}),(0,I.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,I.jsx)(mf,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:h})})]}),cl(p)):null]})};function Pl(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??``;if(e.nodeType!==Node.ELEMENT_NODE)return``;let t=e;return t.tagName===`BR`?`
99
99
  `:Array.from(t.childNodes).map(Pl).join(``)}var Fl=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(Pl(e).trim());let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(Pl(e).trim());n.push(t)}return{headers:t,rows:n}},Il=e=>{if(typeof e!=`object`)return`,`;let t=e.table;return typeof t==`object`?t.csvSeparator??`,`:`,`},Ll=(e,t=`,`)=>{let n;n=t===`auto`?Intl.NumberFormat().format(1.1).includes(`,`)?`;`:`,`:t;let{headers:r,rows:i}=e,a=e=>{let t=!1;for(let r of e)if(r===n||r===`"`||r===`
100
100
  `||r===`\r`){t=!0;break}return t?`"${e.replace(/"/g,`""`)}"`:e},o=r.length>0?i.length+1:i.length,s=Array(o),c=0;r.length>0&&(s[c]=r.map(a).join(n),c+=1);for(let e of i)s[c]=e.map(a).join(n),c+=1;return s.join(`
@@ -104,7 +104,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error
104
104
  `)},zl=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`||n===`
105
105
  `||n===`&`||n===`<`||n===`>`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):t===`
106
106
  `?n.push(`<br>`):t===`&`?n.push(`&amp;`):t===`<`?n.push(`&lt;`):t===`>`?n.push(`&gt;`):n.push(t);return n.join(``)},Bl=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0,a=t.map(e=>zl(e));r[i]=`| ${a.join(` | `)} |`,i+=1;let o=Array(t.length);for(let e=0;e<t.length;e+=1)o[e]=`---`;r[i]=`| ${o.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?zl(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else{let t=e.map(e=>zl(e));r[i]=`| ${t.join(` | `)} |`,i+=1}return r.join(`
107
- `)},Vl=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=B(),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(!1),u=(0,F.useRef)(null),d=(0,F.useRef)(0),{isAnimating:f,controls:p}=(0,F.useContext)($d),m=$c(),h=Il(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write))r?.(Error(`Clipboard API not available`));else try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Fl(t),o=``;o=e===`csv`?Ll(a,h):e===`tsv`?Rl(a):Bl(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,F.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=Xc(),v=c?_.CheckIcon:_.CopyIcon;return(0,I.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,I.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,I.jsx)(v,{height:14,width:14})}),o?(0,I.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},Hl=({children:e,className:t,onDownload:n,onError:r})=>{let i=B(),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),{isAnimating:c,controls:l}=(0,F.useContext)($d),u=$c(),d=Xc(),f=Il(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Fl(t),a=e===`csv`?Ll(i,f):Bl(i),c=e===`csv`?`csv`:`md`;Ac(`${tl(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,F.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,I.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,I.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,I.jsx)(d.DownloadIcon,{size:14})}),a?(0,I.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,I.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,I.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},Ul=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=Xc(),o=B(),[s,c]=(0,F.useState)(!1),{isAnimating:l,portal:u}=(0,F.useContext)($d),d=$c(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,F.useEffect)(()=>{if(s){ul();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),dl()}}},[s]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:d.viewFullscreen,type:`button`,children:(0,I.jsx)(i,{size:14})}),s?(0,Wa.createPortal)((0,I.jsx)(`div`,{"aria-label":d.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,I.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,I.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,I.jsx)(Vl,{}):null,r?(0,I.jsx)(Hl,{}):null,(0,I.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:d.exitFullscreen,type:`button`,children:(0,I.jsx)(a,{size:20})})]}),(0,I.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,I.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),cl(u)):null]})},Wl=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=B(),{isAnimating:l}=(0,F.useContext)($d),u=Nc(n),d=Pc(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,I.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,I.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,I.jsx)(Vl,{}):null,p?(0,I.jsx)(Hl,{}):null,m?(0,I.jsx)(Ul,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,I.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,I.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},Gl=/startLine=(\d+)/,Kl=/\bnoLineNumbers\b/,ql=(0,F.lazy)(()=>Ge(()=>import(`./mermaid-WFAXDIZX-Bb-EeuSh.js`).then(e=>({default:e.Mermaid})),[])),Jl=/language-([^\s]+)/,Yl=`node`;function V(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==Yl&&!Object.is(r[e],i[e]))return!1;return!0}function Xl(e,t){return e?.properties?.metastring===t?.properties?.metastring}var Zl=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,Ql=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},$l=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},eu=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},tu=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},nu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>V(e,t));nu.displayName=`MarkdownOl`;var ru=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B(),a=Array.isArray(e)?e.filter(e=>e!==`
107
+ `)},Vl=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=B(),[o,s]=(0,F.useState)(!1),[c,l]=(0,F.useState)(!1),u=(0,F.useRef)(null),d=(0,F.useRef)(0),{isAnimating:f,controls:p}=(0,F.useContext)($d),m=$c(),h=Il(p),g=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write))r?.(Error(`Clipboard API not available`));else try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=Fl(t),o=``;o=e===`csv`?Ll(a,h):e===`tsv`?Rl(a):Bl(a);let c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,F.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let _=Xc(),v=c?_.CheckIcon:_.CopyIcon;return(0,I.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,I.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:m.copyTable,type:`button`,children:e??(0,I.jsx)(v,{height:14,width:14})}),o?(0,I.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`md`),title:m.copyTableAsMarkdown,type:`button`,children:m.tableFormatMarkdown}),(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`csv`),title:m.copyTableAsCsv,type:`button`,children:m.tableFormatCsv}),(0,I.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>g(`tsv`),title:m.copyTableAsTsv,type:`button`,children:m.tableFormatTsv})]}):null]})},Hl=({children:e,className:t,onDownload:n,onError:r})=>{let i=B(),[a,o]=(0,F.useState)(!1),s=(0,F.useRef)(null),{isAnimating:c,controls:l}=(0,F.useContext)($d),u=$c(),d=Xc(),f=Il(l),p=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=Fl(t),a=e===`csv`?Ll(i,f):Bl(i),c=e===`csv`?`csv`:`md`;Ac(`${tl(l,`table`,`table`)}.${c}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,F.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,I.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,I.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:u.downloadTable,type:`button`,children:e??(0,I.jsx)(d.DownloadIcon,{size:14})}),a?(0,I.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,I.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`csv`),title:u.downloadTableAsCsv,type:`button`,children:u.tableFormatCsv}),(0,I.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>p(`markdown`),title:u.downloadTableAsMarkdown,type:`button`,children:u.tableFormatMarkdown})]}):null]})},Ul=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=Xc(),o=B(),[s,c]=(0,F.useState)(!1),{isAnimating:l,portal:u}=(0,F.useContext)($d),d=$c(),f=()=>{c(!0)},p=()=>{c(!1)};return(0,F.useEffect)(()=>{if(s){ul();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),dl()}}},[s]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:f,title:d.viewFullscreen,type:`button`,children:(0,I.jsx)(i,{size:14})}),s?(0,Wa.createPortal)((0,I.jsx)(`div`,{"aria-label":d.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:p,onKeyDown:e=>{e.key===`Escape`&&p()},role:`dialog`,children:(0,I.jsxs)(`div`,{className:o(`flex h-full flex-col`),"data-streamdown":`table-wrapper`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,I.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,I.jsx)(Vl,{}):null,r?(0,I.jsx)(Hl,{}):null,(0,I.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:p,title:d.exitFullscreen,type:`button`,children:(0,I.jsx)(a,{size:20})})]}),(0,I.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,I.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),cl(u)):null]})},Wl=({children:e,className:t,maxHeight:n,showControls:r,showCopy:i=!0,showDownload:a=!0,showFullscreen:o=!0,...s})=>{let c=B(),{isAnimating:l}=(0,F.useContext)($d),u=Nc(n),d=Pc(l,!!u,e),f=r&&i,p=r&&a,m=r&&o,h=f||p||m;return(0,I.jsxs)(`div`,{className:c(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[h?(0,I.jsxs)(`div`,{className:c(`flex items-center justify-end gap-1`),children:[f?(0,I.jsx)(Vl,{}):null,p?(0,I.jsx)(Hl,{}):null,m?(0,I.jsx)(Ul,{showCopy:f,showDownload:p,children:e}):null]}):null,(0,I.jsx)(`div`,{className:c(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),ref:d,style:u?{maxHeight:u}:void 0,children:(0,I.jsx)(`table`,{className:c(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...s,children:e})})]})},Gl=/startLine=(\d+)/,Kl=/\bnoLineNumbers\b/,ql=(0,F.lazy)(()=>Ge(()=>import(`./mermaid-WFAXDIZX-ClIEnuTo.js`).then(e=>({default:e.Mermaid})),[])),Jl=/language-([^\s]+)/,Yl=`node`;function V(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=e,i=t;for(let e of n)if(e!==Yl&&!Object.is(r[e],i[e]))return!1;return!0}function Xl(e,t){return e?.properties?.metastring===t?.properties?.metastring}var Zl=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,Ql=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},$l=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},eu=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},tu=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.image;return n===!1?!1:n===!0||n===void 0||n[t]!==!1},nu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`ol`,{className:i(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e})},(e,t)=>V(e,t));nu.displayName=`MarkdownOl`;var ru=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B(),a=Array.isArray(e)?e.filter(e=>e!==`
108
108
  `&&e!==``):[e],o=a.length===1&&(0,F.isValidElement)(a[0])&&(a[0].type===Eu||a[0].props.node?.tagname===`p`)?a[0].props.children:e;return(0,I.jsx)(`li`,{className:i(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:o})},(e,t)=>V(e,t));ru.displayName=`MarkdownLi`;var iu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`ul`,{className:i(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e})},(e,t)=>V(e,t));iu.displayName=`MarkdownUl`;var au=(0,F.memo)(({className:e,node:t,...n})=>{let r=B();return(0,I.jsx)(`hr`,{className:r(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n})},(e,t)=>V(e,t));au.displayName=`MarkdownHr`;var ou=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`span`,{className:i(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e})},(e,t)=>V(e,t));ou.displayName=`MarkdownStrong`;var su=(0,F.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=B(),{linkSafety:o}=(0,F.useContext)($d),[s,c]=(0,F.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,F.useCallback)(async e=>{if(o!=null&&o.enabled&&n&&!l){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,F.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,F.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,I.jsx)(fl,{...p})]}):(0,I.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>V(e,t));su.displayName=`MarkdownA`;var cu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h1`,{className:i(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e})},(e,t)=>V(e,t));cu.displayName=`MarkdownH1`;var lu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h2`,{className:i(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e})},(e,t)=>V(e,t));lu.displayName=`MarkdownH2`;var uu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h3`,{className:i(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e})},(e,t)=>V(e,t));uu.displayName=`MarkdownH3`;var du=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h4`,{className:i(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e})},(e,t)=>V(e,t));du.displayName=`MarkdownH4`;var fu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h5`,{className:i(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e})},(e,t)=>V(e,t));fu.displayName=`MarkdownH5`;var pu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`h6`,{className:i(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e})},(e,t)=>V(e,t));pu.displayName=`MarkdownH6`;var mu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i,tableMaxHeight:a}=(0,F.useContext)($d),o=Zl(i,`table`),s=Ql(i,`copy`),c=Ql(i,`download`),l=Ql(i,`fullscreen`);return(0,I.jsx)(Wl,{className:t,maxHeight:a,showControls:o,showCopy:s,showDownload:c,showFullscreen:l,...r,children:e})},(e,t)=>V(e,t));mu.displayName=`MarkdownTable`;var hu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`thead`,{className:i(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e})},(e,t)=>V(e,t));hu.displayName=`MarkdownThead`;var gu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`tbody`,{className:i(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e})},(e,t)=>V(e,t));gu.displayName=`MarkdownTbody`;var _u=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`tr`,{className:i(`border-border`,t),"data-streamdown":`table-row`,...r,children:e})},(e,t)=>V(e,t));_u.displayName=`MarkdownTr`;var vu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`th`,{className:i(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e})},(e,t)=>V(e,t));vu.displayName=`MarkdownTh`;var yu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`td`,{className:i(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e})},(e,t)=>V(e,t));yu.displayName=`MarkdownTd`;var bu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`blockquote`,{className:i(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e})},(e,t)=>V(e,t));bu.displayName=`MarkdownBlockquote`;var xu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`sup`,{className:i(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e})},(e,t)=>V(e,t));xu.displayName=`MarkdownSup`;var Su=(0,F.memo)(({children:e,className:t,node:n,...r})=>{let i=B();return(0,I.jsx)(`sub`,{className:i(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e})},(e,t)=>V(e,t));Su.displayName=`MarkdownSub`;var Cu=(0,F.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,F.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,F.isValidElement)(e)){if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t)if(typeof e==`string`&&e.trim()!==``||(0,F.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,F.isValidElement)(e))return e;if(e.type===nu){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,I.jsx)(`section`,{className:t,...r,children:i}):null}return(0,I.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>V(e,t));Cu.displayName=`MarkdownSection`;var wu=(0,F.memo)(({node:e,className:t,children:n,...r})=>{let i=B(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,F.useContext)($d),l=gl(),u=Ec(),d=(t?.match(Jl))?.at(1)??``,f=_l(d);if(a)return(0,I.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(Gl),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&Kl.test(p))&&c!==!1,v=``;if((0,F.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(al,{}),children:(0,I.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=Zl(s,`mermaid`),n=eu(s,`download`),r=eu(s,`copy`),a=eu(s,`fullscreen`),c=eu(s,`panZoom`),l=e&&(n||r||a);return(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(al,{}),children:(0,I.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,I.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,I.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,I.jsx)(`div`,{className:i(`pointer-events-none absolute top-2 right-2 z-10 flex items-center`),children:(0,I.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,I.jsx)(Ml,{chart:v,config:o?.config}):null,r?(0,I.jsx)(el,{code:v,...nl(s,`mermaid`)}):null,a?(0,I.jsx)(Nl,{chart:v,config:o?.config}):null]})}):null,(0,I.jsx)(`div`,{className:i(`overflow-hidden rounded-md border border-border bg-background`),children:(0,I.jsx)(ql,{chart:v,config:o?.config,showControls:c})})]})})}let y=Zl(s,`code`),b=$l(s,`download`),x=$l(s,`copy`),{"data-block":S,...C}=r;return(0,I.jsx)(Gc,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,...C,children:y?(0,I.jsxs)(I.Fragment,{children:[b?(0,I.jsx)(il,{code:v,language:d}):null,x?(0,I.jsx)(el,{...nl(s,`code`)}):null]}):null})},(e,t)=>V(e,t)&&Xl(e.node,t.node));wu.displayName=`MarkdownCode`;var Tu=(0,F.memo)(({node:e,className:t,...n})=>{let{controls:r}=(0,F.useContext)($d),i=Zl(r,`image`),a=i&&tu(r,`download`);return(0,I.jsx)(sl,{className:t,node:e,showControls:i,showDownloadControl:a,...n})},(e,t)=>V(e,t));Tu.displayName=`MarkdownImg`;var Eu=(0,F.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,F.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,I.jsx)(I.Fragment,{children:e})}return(0,I.jsx)(`p`,{...n,children:e})},(e,t)=>V(e,t));Eu.displayName=`MarkdownParagraph`;var Du={ol:nu,li:ru,ul:iu,hr:au,strong:ou,a:su,h1:cu,h2:lu,h3:uu,h4:du,h5:fu,h6:pu,table:mu,thead:hu,tbody:gu,tr:_u,th:vu,td:yu,blockquote:bu,code:wu,img:Tu,pre:({children:e})=>(0,F.isValidElement)(e)?(0,F.cloneElement)(e,{"data-block":`true`}):e,sup:xu,sub:Su,p:Eu,section:Cu},Ou=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,ku=/\p{L}/u;function Au(e){let t=e.replace(/(```|~~~)[\s\S]*?\1/g,``).replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``),n,r=0,i=0;for(let e of t)Ou.test(e)?(n??=`rtl`,i+=1):ku.test(e)&&(n??=`ltr`,r+=1);return i>r?`rtl`:r>i?`ltr`:n??`ltr`}var ju=/^[ \t]{0,3}(`{3,}|~{3,})/,Mu=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,Nu=e=>{let t=e.split(`
109
109
  `),n=null,r=0;for(let e of t){let t=ju.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},Pu=e=>{let t=e.split(`
110
110
  `);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&Mu.test(t))return!0}return!1},Fu=()=>e=>{qt(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},Iu=[],Lu={allowDangerousHtml:!0},Ru=new WeakMap,zu=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=Ru.get(e);n||(n=e.name,Ru.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=Ru.get(r);e||(e=r.name,Ru.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},Bu=e=>{let t=Vu(e),n=e.children||``;return Ju(t.runSync(t.parse(n),n),e)},Vu=e=>{let t=zu.get(e);if(t)return t;let n=Uu(e);return zu.set(e,n),n},Hu=e=>e.some(e=>Array.isArray(e)?e[0]===Ut:e===Ut),Uu=e=>{let t=e.rehypePlugins||Iu,n=e.remarkPlugins||Iu,r=Hu(t)?n:[...n,Fu],i=e.remarkRehypeOptions?{...Lu,...e.remarkRehypeOptions}:Lu;return Xt().use(Bt).use(r).use(Kt,i).use(t)},Wu=e=>e,Gu=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},Ku=(e,t)=>{for(let n in Yt)if(Object.hasOwn(Yt,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=Yt[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},qu=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},Ju=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||Wu;qt(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return Gu(c,s,a,e.value),s;if(e.type===`element`&&(Ku(e,t),qu(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return Zt(e,{Fragment:I.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:I.jsx,jsxs:I.jsxs,passKeys:!0,passNode:!0})},Yu=/\[\^[\w-]{1,200}\](?!:)/,Xu=/\[\^[\w-]{1,200}\]:/,Zu=/<([A-Za-z][\w:-]*)[\s>/]/,Qu=/^ {0,3}\[[^\]]+\]:/m,$u=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),ed=new Map,td=new Map,nd=e=>{let t=e.toLowerCase(),n=ed.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return ed.set(t,r),r},rd=e=>{let t=e.toLowerCase(),n=td.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return td.set(t,r),r},id=(e,t)=>{if($u.has(t.toLowerCase()))return 0;let n=e.match(nd(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},ad=(e,t)=>{let n=e.match(rd(t));return n?n.length:0},od=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},sd=/\r\n|\r/g,cd=e=>{let t=new Is({gfm:!0});return{tokens:t.blockTokens(e),hasLinkDefinitions:Object.keys(t.tokens.links).length>0}},ld=null,ud=`
@@ -131,7 +131,7 @@ ${n}`,i=e.length;break}if(!c.startsWith(`
131
131
  `);r+=`${t}
132
132
 
133
133
  ${u}`,i=e.length;break}return i===0?e:r+e.slice(i)},Sd=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>bd(t,n,r)),n=xd(n,e)}return n},Cd=/([\\`*_~[\]|])/g,wd=e=>e.replace(Cd,`\\$1`),Td=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+wd(n).replace(/\n\n/g,`&#10;&#10;`)+r)}return n},Ed=new Set([`blockquote`,`dd`,`dt`,`figcaption`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`li`,`p`,`td`,`th`]),Dd=new Set([`code`,`kbd`,`pre`,`samp`,`var`]);function Od(e){return e.children.map(e=>e.type===`text`?e.value:e.type===`element`&&!Dd.has(e.tagName)?Od(e):``).join(``)}function kd(){return e=>{qt(e,`element`,e=>{Dd.has(e.tagName)?(e.properties??={},e.properties.dir=`ltr`):Ed.has(e.tagName)&&(e.properties??={},typeof e.properties.dir!=`string`&&(e.properties.dir=Au(Od(e))))})}}var Ad=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(Ad).join(``):``,jd=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));qt(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=Ad(e);e.children=t?[{type:`text`,value:t}]:[]}})},Md=()=>e=>{qt(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},Nd=/^([a-zA-Z][a-zA-Z\d+\-.]*:)/,Pd=e=>new Set(e.map(e=>e.trim().toLowerCase()).filter(e=>e.length>0).map(e=>e.endsWith(`:`)?e:`${e}:`));function Fd(e,t,n){let r=e.position?.start?.offset;if(typeof r==`number`&&n.charCodeAt(r)===91||e.children.length!==1)return!1;let[i]=e.children;if(i.type!==`text`)return!1;let a=Nd.exec(e.url);if(!a)return!1;let o=a[1].toLowerCase();return t.has(o)?o===`mailto:`?e.url===`mailto:${i.value}`:e.url===i.value||e.url===`${o}//${i.value}`:!1}var Id=(e=[])=>{let t=Pd(e);return(e,n)=>{if(t.size===0)return;let r=String(n.value??``);qt(e,`link`,(e,n,i)=>{if(i&&n!==void 0&&Fd(e,t,r))return i.children.splice(n,1,...e.children),n})}},Ld=`data-sd-caret-hidden`,Rd=()=>{},zd=()=>Rd,Bd=e=>{let t=(0,F.useRef)(null),n=(0,F.useRef)(null),r=(0,F.useSyncExternalStore)(zd,()=>!0,()=>!1);return(0,F.useLayoutEffect)(()=>{var r;let i=e&&(r=t.current?.lastElementChild)!=null?r:null,a=n.current;a!==i&&(a?.removeAttribute(Ld),i?.setAttribute(Ld,``),n.current=i)}),{containerRef:t,showCaret:r||!e}},Vd=/^[a-z]/,Hd=/^[ \t]*<[\w!/?-]/,Ud=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,Wd=e=>typeof e!=`string`||e.length===0||!Hd.test(e)?e:e.replace(Ud,`$1`),Gd={...Ht,clobberPrefix:``,protocols:{...Ht.protocols,href:[...Ht.protocols?.href??[],`tel`,`streamdown`],src:[...Ht.protocols?.src??[],`streamdown`]},attributes:{...Ht.attributes,code:[...Ht.attributes?.code??[],`metastring`]}},Kd={raw:Ut,sanitize:[$t,Gd],harden:[hr,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},qd={gfm:[Vt,{}],codeMeta:Md},Jd=Object.values(Kd),Yd=Object.values(qd),Xd={block:` ▋`,circle:` ●`},Zd=[`github-light`,`github-dark`],Qd={enabled:!0},$d=(0,F.createContext)({codeBlockMaxHeight:400,shikiTheme:Zd,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:Qd,portal:void 0,tableMaxHeight:300}),ef=(0,F.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{(0,F.useLayoutEffect)(()=>{o?.commit()});let c=typeof e==`string`&&n?Wd(e):e,l=(0,I.jsx)(Bu,{...s,children:c});return(0,I.jsx)(Tc.Provider,{value:i,children:a?(0,I.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return e.rehypePlugins===t.rehypePlugins&&e.remarkPlugins===t.remarkPlugins&&!!e.animatePlugin==!!t.animatePlugin});ef.displayName=`Block`;var tf=e=>{let t={};for(let[n,r]of Object.entries(e))(n.startsWith(`data-`)||n.startsWith(`aria-`))&&(t[n]=r);return t},nf=(e,t)=>{let n=tf(e),r=tf(t),i=Object.keys(n);return i.length===Object.keys(r).length&&i.every(e=>Object.hasOwn(r,e)&&n[e]===r[e])},rf=(0,F.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=Jd,remarkPlugins:s=Yd,className:c,shikiTheme:l,mermaid:u,codeBlockMaxHeight:d=400,controls:f=!0,isAnimating:p=!1,tableMaxHeight:m=300,animated:h,BlockComponent:g=ef,parseMarkdownIntoBlocksFn:_=gd,caret:v,plugins:y,remend:b,linkSafety:x=Qd,portal:S,lineNumbers:C=!0,allowedTags:w,fallbackComponent:T,literalTagContent:E,disableAutolinkProtocols:D,translations:O,icons:ee,prefix:te,onAnimationStart:ne,onAnimationEnd:re,...ie})=>{let ae=(0,F.useId)(),oe=tf(ie),se=(0,F.useMemo)(()=>kc(te),[te]),ce=(0,F.useRef)(null),le=(0,F.useRef)(ne),ue=(0,F.useRef)(re);le.current=ne,ue.current=re,(0,F.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=ce.current;ce.current=p,i===null?p&&((e=le.current)==null||e.call(le)):p&&!i?(n=le.current)==null||n.call(le):!p&&i&&((r=ue.current)==null||r.call(ue))},[p,t]);let de=(0,F.useMemo)(()=>w?Object.keys(w):[],[w]),k=(0,F.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?Ua(e,b):e;return E&&E.length>0&&(n=Td(n,E)),de.length>0&&(n=Sd(n,de)),n},[e,t,r,b,de,E]),A=(0,F.useMemo)(()=>_(k),[k,_]),fe=(0,F.useMemo)(()=>n===`auto`?A.map(Au):void 0,[A,n]),pe=(0,F.useMemo)(()=>A.map((e,t)=>`${ae}-${t}`),[A.length,ae]),me=(0,F.useMemo)(()=>h===!0?`true`:h?JSON.stringify(h):``,[h]),he=(0,F.useRef)(null),ge=(0,F.useRef)([]),j=(0,F.useRef)([]),_e=(0,F.useRef)(null),ve=(0,F.useRef)(``);me?(ve.current===me?he.current||=Zs():(ve.current=me,he.current=Zs({maxBacklogMs:me===`true`?void 0:h.maxBacklogMs}),ge.current=[],j.current=[]),p&&he.current&&he.current.beginPass(he.current.now())):(he.current=null,ge.current=[],j.current=[],ve.current=``),(0,F.useLayoutEffect)(()=>{var e;p&&((e=he.current)==null||e.commitPass())});let ye=(0,F.useMemo)(()=>({codeBlockMaxHeight:d,shikiTheme:l??(y?.code)?.getThemes()??Zd,controls:f,isAnimating:p,lineNumbers:C,mode:t,mermaid:u,linkSafety:x,portal:S,tableMaxHeight:m}),[d,l,f,p,C,t,u,x,S,y?.code,m]),be=(0,F.useMemo)(()=>O?JSON.stringify(O):``,[O]),xe=(0,F.useMemo)(()=>({...Zc,...O}),[be]),Se=(0,F.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...Du,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,F.createElement)(t,n):null:(0,F.createElement)(e,n)}if(T){if(w)for(let e of Object.keys(w))Object.hasOwn(n,e)||(n[e]=T);let e={configurable:!0,enumerable:!1,value:T,writable:!1};return new Proxy(n,{getOwnPropertyDescriptor(t,n){let r=Object.getOwnPropertyDescriptor(t,n);if(r)return r;if(typeof n==`string`&&Vd.test(n))return e},get(e,t,n){return typeof t==`string`&&Vd.test(t)&&!Object.hasOwn(e,t)?T:Reflect.get(e,t,n)}})}return n},[a,T,w]),Ce=(0,F.useMemo)(()=>{let e=[];return y!=null&&y.cjk&&(e=[...e,...y.cjk.remarkPluginsBefore]),e=[...e,...s],D&&D.length>0&&(e=[...e,[Id,D]]),y!=null&&y.cjk&&(e=[...e,...y.cjk.remarkPluginsAfter]),y!=null&&y.math&&(e=[...e,y.math.remarkPlugin]),e},[s,y?.math,y?.cjk,D]),M=(0,F.useMemo)(()=>{let e=o;if(w&&Object.keys(w).length>0&&o===Jd){let t={...Gd,tagNames:[...Gd.tagNames??[],...Object.keys(w)],attributes:{...Gd.attributes,...w}};e=[Kd.raw,[$t,t],Kd.harden]}return E&&E.length>0&&(e=[...e,[jd,E]]),y!=null&&y.math&&(e=[...e,y.math.rehypePlugin]),n===`auto`&&t===`static`&&(e=[...e,kd]),e},[o,y?.math,w,E,n,t]),we=(0,F.useMemo)(()=>v&&p?{"--streamdown-caret":`"${Xd[v]}"`}:void 0,[v,p]),{containerRef:Te,showCaret:Ee}=Bd((0,F.useMemo)(()=>{if(!p||A.length===0)return!1;let e=A.at(-1);return Nu(e)||Pu(e)},[p,A])),N=e=>{let t=null;if(he.current&&p){if(!ge.current[e]){let{maxBacklogMs:t,...n}=me&&me!==`true`?h:{};ge.current[e]=Cc({...n,timeline:he.current})}t=ge.current[e]}_e.current!==M&&(j.current=[],_e.current=M),t&&!j.current[e]&&(j.current[e]=[...M,t.rehypePlugin]);let n=t&&j.current[e]?j.current[e]:M;return{blockAnimatePlugin:t,blockRehypePlugins:n}};return t===`static`?(0,I.jsx)(Qc.Provider,{value:xe,children:(0,I.jsx)(pl.Provider,{value:y??null,children:(0,I.jsx)($d.Provider,{value:ye,children:(0,I.jsx)(Yc,{icons:ee,children:(0,I.jsx)(jc.Provider,{value:se,children:(0,I.jsx)(`div`,{...oe,className:se(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?void 0:n,children:(0,I.jsx)(Bu,{components:Se,rehypePlugins:M,remarkPlugins:Ce,...ie,children:k})})})})})})}):(0,I.jsx)(Qc.Provider,{value:xe,children:(0,I.jsx)(pl.Provider,{value:y??null,children:(0,I.jsx)($d.Provider,{value:ye,children:(0,I.jsx)(Yc,{icons:ee,children:(0,I.jsx)(jc.Provider,{value:se,children:(0,I.jsxs)(`div`,{...oe,className:se(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,v&&Ee?`[&>*:last-child:not([data-sd-caret-hidden])]:after:inline [&>*:last-child:not([data-sd-caret-hidden])]:after:align-baseline [&>*:last-child:not([data-sd-caret-hidden])]:after:content-[var(--streamdown-caret)]`:null,c),ref:Te,style:we,children:[A.length===0&&v&&p&&(0,I.jsx)(`span`,{}),A.map((e,t)=>{let a=t===A.length-1,o=p&&a&&Nu(e),{blockAnimatePlugin:s,blockRehypePlugins:c}=N(t);return(0,I.jsx)(g,{animatePlugin:s,components:Se,content:e,dir:fe?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:c,remarkPlugins:Ce,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...ie},pe[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.codeBlockMaxHeight===t.codeBlockMaxHeight&&e.tableMaxHeight===t.tableMaxHeight&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&e.disableAutolinkProtocols===t.disableAutolinkProtocols&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir&&e.fallbackComponent===t.fallbackComponent&&nf(e,t));rf.displayName=`Streamdown`;var af=e=>e>0?e:null,of=(e,t)=>{if(e.endsWith(`px`))return af(Number.parseFloat(e));if(e.endsWith(`rem`)){let t=Number.parseFloat(getComputedStyle(document.documentElement).fontSize||`16`);return af(Number.parseFloat(e)*t)}if(e.endsWith(`em`)){let n=Number.parseFloat(getComputedStyle(t).fontSize||`16`);return af(Number.parseFloat(e)*n)}if(e.endsWith(`vh`))return af(Number.parseFloat(e)/100*window.innerHeight);if(e.endsWith(`%`)){let n=t.parentElement;return n&&n.clientHeight>0?af(Number.parseFloat(e)/100*n.clientHeight):null}return null},sf=(e,t)=>{let n=t.trim().toLowerCase();return!n||n===`none`||n===`auto`?null:of(n,e)},cf=/^min\(\s*([^,]+)\s*,\s*([^)]+)\s*\)$/i,lf=(e,t)=>{let n=sf(e,t);if(n!=null)return n;let r=t.trim().match(cf);if(!r)return null;let i=sf(e,r[1].trim()),a=sf(e,r[2].trim());return i==null||a==null?null:Math.min(i,a)},uf=(e,t,n)=>{let r=t.clientWidth;if(!(r>0))return null;if(n){let n=t.clientHeight;if(!(n>0))return null;let i=Math.min(r/e.width,n/e.height,1);return!(i>0)||Number.isNaN(i)?null:{fitZoom:i,viewportHeight:null}}let i=Math.min(r/e.width,1);if(!(i>0)||Number.isNaN(i))return null;let a=e.height*i,o=null,s=t;for(;s&&o==null;){let e=getComputedStyle(s);o=lf(s,e.maxHeight),s=s.parentElement}let c=o==null?a:Math.min(a,o),l=Math.min(i,c/e.height,1);return!(l>0)||Number.isNaN(l)?null:{fitZoom:l,viewportHeight:c}},df=({children:e,className:t,contentSize:n,fitKey:r,minZoom:i=.5,maxZoom:a=3,zoomStep:o=.1,showControls:s=!0,initialZoom:c=1,isAutoFit:l=!1,fullscreen:u=!1})=>{let{RotateCcwIcon:d,ZoomInIcon:f,ZoomOutIcon:p}=Xc(),m=B(),h=$c(),g=(0,F.useRef)(null),_=(0,F.useRef)(null),v=(0,F.useRef)(!1),[y,b]=(0,F.useState)(c),[x,S]=(0,F.useState)(i),[C,w]=(0,F.useState)(c),[T,E]=(0,F.useState)({x:0,y:0}),[D,O]=(0,F.useState)(!1),[ee,te]=(0,F.useState)({x:0,y:0}),[ne,re]=(0,F.useState)({x:0,y:0}),[ie,ae]=(0,F.useState)(null),oe=(0,F.useCallback)(e=>{let t=g.current;if(!t)return;let n=uf(e,t,u);if(!n)return;let{fitZoom:r,viewportHeight:a}=n;ae(a),b(r),S(Math.min(i,r)),v.current||(w(r),E({x:0,y:0}))},[u,i]),se=(0,F.useCallback)(e=>{w(t=>Math.max(x,Math.min(a,t+e))),v.current=!0},[x,a]),ce=(0,F.useCallback)(()=>{se(o)},[se,o]),le=(0,F.useCallback)(()=>{se(-o)},[se,o]),ue=(0,F.useCallback)(()=>{w(y),E({x:0,y:0}),v.current=!1},[y]),de=(0,F.useCallback)(e=>{e.preventDefault();let t=e.deltaY>0?-o:o;se(t)},[se,o]),k=(0,F.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;O(!0),v.current=!0,te({x:e.clientX,y:e.clientY}),re(T);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[T]),A=(0,F.useCallback)(e=>{if(!D)return;e.preventDefault();let t=e.clientX-ee.x,n=e.clientY-ee.y;E({x:ne.x+t,y:ne.y+n})},[D,ee,ne]),fe=(0,F.useCallback)(e=>{O(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);(0,F.useEffect)(()=>{S(i),l||(b(c),w(c),ae(null))},[c,l,i]),(0,F.useLayoutEffect)(()=>{if(!(l&&n))return;oe(n);let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{oe(n)});return t.observe(e),()=>{t.disconnect()}},[oe,n,l]),(0,F.useEffect)(()=>{l&&(v.current=!1)},[r,l]),(0,F.useEffect)(()=>{let e=g.current;if(e)return e.addEventListener(`wheel`,de,{passive:!1}),()=>{e.removeEventListener(`wheel`,de)}},[de]),(0,F.useEffect)(()=>{let e=_.current;if(e&&D)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,A,{passive:!1}),e.addEventListener(`pointerup`,fe),e.addEventListener(`pointercancel`,fe),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,A),e.removeEventListener(`pointerup`,fe),e.removeEventListener(`pointercancel`,fe)}},[D,A,fe]);let pe=!u&&l&&ie!=null?{height:ie}:void 0;return(0,I.jsxs)(`div`,{className:m(`relative flex flex-col`,u?`h-full w-full`:`min-h-28 w-full`,t),ref:g,style:{cursor:D?`grabbing`:`grab`,...pe},children:[s?(0,I.jsxs)(`div`,{className:m(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,u?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,I.jsx)(`button`,{"aria-label":h.zoomIn,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:C>=a,onClick:ce,title:h.zoomIn,type:`button`,children:(0,I.jsx)(f,{"aria-hidden":`true`,size:16})}),(0,I.jsx)(`button`,{"aria-label":h.zoomOut,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:C<=x,onClick:le,title:h.zoomOut,type:`button`,children:(0,I.jsx)(p,{"aria-hidden":`true`,size:16})}),(0,I.jsx)(`button`,{"aria-label":h.resetView,className:m(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:ue,title:h.resetView,type:`button`,children:(0,I.jsx)(d,{"aria-hidden":`true`,size:16})})]}):null,(0,I.jsx)(`div`,{className:m(`flex h-full w-full flex-1 origin-center items-center justify-center transition-transform duration-150 ease-out`),onPointerDown:k,ref:_,role:`application`,style:{transform:`translate(${T.x}px, ${T.y}px) scale(${C})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},ff=(e,t)=>new Promise(n=>{let r=setTimeout(n,e);t(()=>{clearTimeout(r),n()})}),pf=async(e,{chart:t,config:n},r,i)=>{try{let i=e.getMermaid(n),a=t.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),o=`mermaid-${Math.abs(a)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:s}=await i.render(o,t),c=Ol(s);return{ok:!0,svg:r?s:kl(s),size:c}}catch(e){return{ok:!1,error:e instanceof Error?e.message:i}}},mf=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=B(),[o,s]=(0,F.useState)(null),[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(``),[f,p]=(0,F.useState)(null),m=$c(),[h,g]=(0,F.useState)(``),[_,v]=(0,F.useState)(0),{mermaid:y}=(0,F.useContext)($d),b=gl(),x=y?.errorComponent,{shouldRender:S,containerRef:C}=qs({immediate:r}),w=(0,F.useRef)(null),T=(0,F.useRef)(!1),E=(0,F.useRef)(!1),D=Ec(),O=(0,F.useRef)(D),ee=(0,F.useRef)(null);(0,F.useEffect)(()=>(E.current=!0,()=>{var e;E.current=!1,(e=ee.current)==null||e.call(ee)}),[]),(0,F.useEffect)(()=>{var e;O.current=D,D||(e=ee.current)==null||e.call(ee)},[D]);let te=async e=>{O.current&&(await ff(e,e=>{ee.current=e}),ee.current=null)};if((0,F.useEffect)(()=>{if(!S)return;if(!b){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}if(w.current={chart:e,config:n},T.current)return;let t=(e,t)=>{t.ok?(d(t.svg),p(t.size),g(t.svg)):e===w.current&&s(t.error)};(async()=>{T.current=!0,s(null),l(!0);try{let e=w.current;for(;e;){let n=performance.now(),i=await pf(b,e,r,m.errorMermaid);if(!E.current||(t(e,i),i.ok&&await te(performance.now()-n),!E.current||e===w.current))return;e=w.current}}finally{T.current=!1,E.current&&l(!1)}})()},[e,n,_,S,b]),!(S||u||h))return(0,I.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:C});if(c&&!u&&!h)return(0,I.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:C,children:(0,I.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,I.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,I.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!h)return x?(0,I.jsx)(`div`,{ref:C,children:(0,I.jsx)(x,{chart:e,error:o,retry:()=>v(e=>e+1)})}):(0,I.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:C,children:[(0,I.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,I.jsxs)(`details`,{className:a(`mt-2`),children:[(0,I.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,I.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let ne=u||h;return(0,I.jsx)(`div`,{className:a(r?`size-full`:`max-h-[min(70vh,40rem)] w-full`,t),"data-streamdown":`mermaid`,ref:C,children:(0,I.jsx)(df,{className:a(r?`size-full overflow-hidden`:`max-h-[min(70vh,40rem)] overflow-hidden`,t),contentSize:f,fitKey:e,fullscreen:r,isAutoFit:!0,maxZoom:3,minZoom:.1,showControls:i,zoomStep:.1,children:(0,I.jsx)(`div`,{"aria-label":m.mermaidAriaLabel,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:ne},role:`img`})})})},hf=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))]]),gf=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:hf}));gf.displayName=`ArrowCounterClockwiseIcon`;var _f=2e3;function vf(){let[e,t]=(0,F.useState)(!1),n=(0,F.useRef)(null);return(0,F.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),{copied:e,copy:(0,F.useCallback)(async e=>{try{if(!navigator.clipboard)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e)}catch{return a.error(`Couldn't copy to the clipboard.`),!1}return t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),_f),!0},[])}}function yf({message:e,onRetry:t,onRestart:n,onDismiss:r,retryDisabled:i=!1,className:a}){let{copied:o,copy:s}=vf(),l=o?ee:se;return(0,I.jsxs)(`section`,{"aria-label":`Agent error`,"data-testid":`agent-error-strip`,className:c(`mx-4 mt-2 flex flex-col gap-2 rounded-md border px-3 py-2 text-sm`,x(`danger`).surface,a),children:[(0,I.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,I.jsx)(b,{tone:`danger`,icon:w,className:`mt-0.5 h-4 w-4`}),(0,I.jsxs)(`div`,{role:`alert`,className:`min-w-0 flex-1`,children:[(0,I.jsx)(`p`,{className:`font-medium`,children:`Agent error`}),(0,I.jsx)(`p`,{className:`mt-0.5 max-h-24 overflow-y-auto rounded-sm whitespace-pre-wrap break-words text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:e})]}),r&&(0,I.jsx)(k,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`-my-1 -mr-2 shrink-0 text-muted-foreground hover:text-foreground`,"aria-label":`Dismiss error`,onClick:r,children:(0,I.jsx)(We,{"aria-hidden":`true`})})]}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pl-6 text-foreground`,children:[t&&(0,I.jsxs)(k,{type:`button`,size:`sm`,variant:`outline`,title:`Send your last message again`,disabled:i,onClick:t,children:[(0,I.jsx)(gf,{"aria-hidden":`true`}),`Retry`]}),n&&(0,I.jsxs)(k,{type:`button`,size:`sm`,variant:`outline`,title:`Stop and restart the agent, resuming from where it left off`,onClick:n,children:[(0,I.jsx)(It,{"aria-hidden":`true`}),`Restart agent`]}),(0,I.jsxs)(k,{type:`button`,size:`sm`,variant:`ghost`,className:`text-muted-foreground hover:text-foreground`,onClick:()=>void s(e),children:[(0,I.jsx)(l,{"aria-hidden":`true`}),o?`Copied`:`Copy error`]}),(0,I.jsx)(`span`,{role:`status`,className:`sr-only`,children:o?`Error copied to the clipboard`:``})]})]})}var bf=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))]]),xf=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:bf}));xf.displayName=`ArrowDownIcon`;var Sf=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M128,152a12,12,0,1,1,12-12A12,12,0,0,1,128,152Zm104-24A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128ZM40,128v.33a135.93,135.93,0,0,1,176,0V128a88,88,0,0,0-176,0Zm67.5,85.58L90.45,168H49.63A88.35,88.35,0,0,0,107.5,213.58ZM128,216c.83,0,1.66,0,2.49,0l20.07-53.57a16.07,16.07,0,0,1,15-10.39h47.12c.38-1.31.72-2.64,1-4a120,120,0,0,0-171.4,0c.31,1.34.65,2.67,1,4H90.45a16.08,16.08,0,0,1,15,10.4l20,53.56C126.31,216,127.15,216,128,216Zm78.37-48H165.55l-17.09,45.59A88.34,88.34,0,0,0,206.37,168Z`}))]]),Cf=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:Sf}));Cf.displayName=`SteeringWheelIcon`;var wf=N({type:M(`text`),text:P()}),Tf=N({type:M(`image`),source:N({type:M(`base64`),data:P(),media_type:P()})}),Ef=De().transform((e,t)=>typeof e!=`object`||!e||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null?(t.issues.push({code:`custom`,message:`Expected a JSON object`,input:e}),xe):Object.entries(e)),Df=ve(()=>me([P(),j(),Te(),be(),Ce(Df),Of])),Of=Ef.pipe(Ce(he([P(),Df]))).transform(e=>Object.fromEntries(e)),kf=Se(`type`,[wf,N({type:M(`thinking`),thinking:P()}),N({type:M(`tool_use`),id:P(),name:P(),input:Of}),N({type:M(`tool_result`),tool_use_id:P(),content:me([P(),Ce(Se(`type`,[wf,Tf]))]),is_error:Te().optional()}),Tf]),Af=me([P(),Ce(kf)]),jf=N({input_tokens:j().optional(),output_tokens:j().optional(),cache_creation_input_tokens:j().optional(),cache_read_input_tokens:j().optional(),service_tier:P().optional()}),Mf=N({inputTokens:j(),outputTokens:j(),cacheReadInputTokens:j(),cacheCreationInputTokens:j(),webSearchRequests:j(),costUSD:j(),contextWindow:j(),maxOutputTokens:j()}),Nf=Ef.pipe(Ce(he([P(),Mf]))).transform(e=>Object.fromEntries(e)),Pf=N({name:P(),description:P().optional(),input_schema:Of.optional()}),Ff=Se(`type`,[N({type:M(`message_start`),message:N({id:P().optional(),type:P().optional(),role:we([`assistant`,`user`]),model:P().optional(),content:Af,stop_reason:P().optional()})}),N({type:M(`content_block_start`),index:j(),content_block:kf}),N({type:M(`content_block_delta`),index:j(),delta:Se(`type`,[N({type:M(`text_delta`),text:P()}),N({type:M(`thinking_delta`),thinking:P()}),N({type:M(`input_json_delta`),partial_json:P()})])}),N({type:M(`content_block_stop`),index:j()}),N({type:M(`message_delta`),delta:N({stop_reason:P().optional(),stop_sequence:P().optional()}).optional(),usage:jf.optional()}),N({type:M(`message_stop`)})]),If={prDeliveryState:we([`queued`,`delivered`,`failed`,`cancelled`]).optional(),timestamp:P().optional(),childWorkspaceId:P().optional(),childWorkspaceName:P().optional(),childProjectName:P().optional(),parentWorkspaceId:P().optional(),parentWorkspaceName:P().optional(),parentProjectName:P().optional(),text:P().optional(),session_id:P().optional(),parent_tool_use_id:P().optional(),message:N({role:we([`assistant`,`user`]),content:Af}).optional(),event:Ff.optional(),usage:jf.optional(),duration_ms:j().optional(),duration_api_ms:j().optional(),total_cost_usd:j().optional(),num_turns:j().optional(),is_error:Te().optional(),error:P().optional(),result:Df.optional(),model_usage:Nf.optional(),subtype:P().optional(),tools:Ce(Pf).optional(),model:P().optional(),cwd:P().optional(),apiKeySource:P().optional(),status:P().optional()},Lf=Se(`type`,[N({...If,type:M(`session_lifecycle`),lifecycle:N({eventId:P(),kind:we(Le),reason:we(Re),message:P(),timestamp:P()})}),N({...If,type:we([`system`,`assistant`,`user`,`stream_event`,`result`,`error`,`child_workspace_update`,`parent_workspace_update`,`pr_update`]),lifecycle:ye().optional()})]),Rf=N({subagentId:P().optional(),subagentIconIndex:j().optional(),id:P(),source:we([`user`,`agent`]),text:P().optional(),message:Lf.optional(),timestamp:P(),attachments:Ce(vn).optional(),order:j()}),zf=N({source:N({type:M(`pr_event`),request:He}).optional(),id:P(),text:P(),timestamp:P(),attachments:Ce(vn).optional(),voiceMode:Te().optional(),settings:gn}),Bf=N({optionId:P(),name:P(),kind:we([`allow_once`,`allow_always`,`reject_once`,`reject_always`])}),Vf=N({requestId:P(),toolName:P(),rawToolName:P().optional(),toolUseId:P(),input:Oe(P(),De()),elicitation:we([`form`,`url`]).optional(),planContent:P().nullable(),acpOptions:Ce(Bf).optional(),timestamp:P()}),Hf={queue_updated:N({type:M(`queue_updated`),queuedMessages:Ce(zf)}),pending_request_updated:N({type:M(`pending_request_updated`),pendingInteractiveRequest:Vf.nullable()}),transcript_message_committed:N({type:M(`transcript_message_committed`),chatMessage:Rf,queuedMessages:Ce(zf)})};function Uf(e){return Object.hasOwn(Hf,e)}function Wf(e,t){return Uf(e)?Hf[e].safeParse(t).success:null}var Gf=new Set(Me),Kf=new Set(ke),qf=new Set(Fe),Jf=new Set(Object.values(Le)),Yf=new Set(Object.values(Re));function Xf(e){return typeof e==`string`&&e.length>0}function Zf(e){if(typeof e!=`object`||!e)return!1;let t=e;return Xf(t.eventId)&&typeof t.kind==`string`&&Jf.has(t.kind)&&typeof t.reason==`string`&&Yf.has(t.reason)&&Xf(t.message)&&Xf(t.timestamp)&&!Number.isNaN(Date.parse(t.timestamp))}function Qf(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.type!=`string`||!qf.has(t.type)?!1:t.type!==`session_lifecycle`||Zf(t.lifecycle)}var $f=N({removedMessageIds:Ce(P()).optional(),resetTranscript:Te().optional()});function ep(e){if(!$f.safeParse(e).success)return!1;let t=e.messages;return Array.isArray(t)?t.every(e=>{if(typeof e!=`object`||!e)return!1;let t=e.message;return typeof t!=`object`||!t||t.type!==`session_lifecycle`||Qf(t)}):!1}function tp(e){let t=e;return typeof t.messageId==`string`&&t.messageId.length>0&&typeof t.order==`number`&&Number.isInteger(t.order)&&t.order>=0&&typeof t.offset==`number`&&Number.isInteger(t.offset)&&t.offset>=0&&typeof t.text==`string`}function np(e){let t=e.data;if(typeof t!=`object`||!t)return!1;let n=t;return typeof n.type!=`string`||!Gf.has(n.type)||Kf.has(n.type)?!1:rp(t)}function rp(e){if(typeof e!=`object`||!e)return!1;let t=e;if(typeof t.type!=`string`||!Gf.has(t.type))return!1;if(t.type===`session_delta`)return np(e);if(t.type===`subagents_changed`)return Ne.safeParse(e).success;let n=Wf(t.type,e);return n===null?t.type===`agent_message`?Qf(t.data):t.type===`session_snapshot`?ep(e):t.type!==`assistant_text_delta`||tp(e):n}function ip(e){return e.type===`agent_message`&&typeof e.data==`object`&&e.data!==null}function ap(e){return e.type===`stream_event`&&e.event!=null}function op(e){return e.type===`content_block_start`&&e.content_block?.type===`tool_use`}function sp(e){return op(e)?e.content_block.id:null}function cp(e){return Gn(e)?e.text:Kn(e)?e.thinking:``}function lp(e){return e.type===`text_delta`?e.text:e.type===`thinking_delta`?e.thinking:``}function up(e){return e.type===`content_block_start`?cp(e.content_block):e.type===`content_block_delta`?lp(e.delta):``}function dp(e){return Gn(e)?e.text:Kn(e)?e.thinking:``}function fp(e){return typeof e==`string`?e:Array.isArray(e)?e.map(dp).filter(Boolean).join(`
134
- `):``}function pp(e){return e.type===`stream_event`&&e.event?up(e.event):e.message?fp(e.message.content):e.type===`error`&&e.error?e.error:e.type===`result`&&e.result?typeof e.result==`string`?e.result:JSON.stringify(e.result):``}function mp(e){let t=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};if(e.type===`stream_event`&&e.event){if(e.event.type===`content_block_start`){let n=e.event.content_block;if(qn(n))return{name:n.name,id:n.id,input:t(n.input)}}return null}if(e.message&&Array.isArray(e.message.content)){for(let n of e.message.content)if(qn(n))return{name:n.name,id:n.id,input:t(n.input)}}return null}function hp(e){return mp(e)!==null}function gp(e){return e.type===`stream_event`&&e.event?e.event.type===`content_block_start`&&Jn(e.event.content_block):e.message&&Array.isArray(e.message.content)?e.message.content.some(e=>Jn(e)):!1}function _p(e,t){let n={toolUseId:e.tool_use_id,content:e.content,isError:e.is_error??!1};return t&&(n.selectedBlock=e),n}function vp(e,t){return e.type===`content_block_start`&&Jn(e.content_block)?_p(e.content_block,t):null}function yp(e,t){let n=e.find(e=>Jn(e));return n&&Jn(n)?_p(n,t):null}function bp(e,t=!1){return e.type===`stream_event`&&e.event?vp(e.event,t):e.message&&Array.isArray(e.message.content)?yp(e.message.content,t):null}function xp(e){return e.type===`tool_sequence`}function Sp(e){if(!(e.message&&hp(e.message)))return null;let t=mp(e.message);return!t||Cp(t.name,t.input)?null:{id:t.id,name:t.name,input:t.input,status:`pending`}}function Cp(e,t){if(typeof e!=`string`)return!1;let n=e.trim().toLowerCase();if(n===`reasoning`||n===`thinking`||n===`think`)return!0;if(typeof t!=`object`||!t||Array.isArray(t))return!1;let r=t.type;return typeof r==`string`&&r.trim().toLowerCase()===`reasoning`}function wp(e,t,n,r){if(!(e.message&&gp(e.message)))return;let i=bp(e.message,r!==void 0);if(!i)return;let a=n.get(i.toolUseId);if(!a)return;let o=a.shift();if(o===void 0)return;a.length===0&&n.delete(i.toolUseId);let s=t[o];s&&(Tp(s,i),i.selectedBlock&&r?.onToolResult?.(e,i.selectedBlock,s))}function Tp(e,t){e.status=t.isError?`error`:`success`,e.result={content:t.content,isError:t.isError}}function Ep(e,t){let n=[],r=new Map;for(let i of e){let e=Sp(i);if(e){let a=r.get(e.id)??[];a.push(n.length),r.set(e.id,a),n.push(e),t?.onToolCall?.(i,e)}}for(let i of e)wp(i,n,r,t);return n}function Dp(e,t){for(let n=t-1;n>=0;--n){let t=e[n];if(t){if(t.source===`user`)return null;if(t.source===`agent`&&t.message&&(t.message.type!==`system`||t.message.subtype!==`subagent_started`&&t.message.subtype!==`subagent_finished`))return t.message.type===`result`?null:pp(t.message).trim()||null}}return null}function Op(e){return e.filter((t,n)=>{if(t.source!==`agent`||!t.message||t.message.type!==`result`)return!0;let r=pp(t.message).trim();return!r||Dp(e,n)!==r})}function kp(e){let t=e.source===`agent`?e.message:void 0;if(t?.type===`assistant`){let e=t.message?.content;if(Array.isArray(e)&&e.length>0&&e.every(Kn))return!1}return t?.type===`stream_event`&&t.event?.type===`content_block_start`&&Kn(t.event.content_block)?!1:e.source!==`agent`||e.message?.type!==`result`||typeof e.message.result==`string`&&e.message.result.trim().length>0}function Ap(e,t){for(let n of e){if(n.status!==`pending`)continue;let e=t.get(n.id)??[];e.push(n),t.set(n.id,e)}}function jp(e,t,n,r){let i=t.get(e.toolUseId);if(!i)return!1;let a=i.shift();return a?(Tp(a,e),e.selectedBlock&&r?.onToolResult?.(n,e.selectedBlock,a),i.length===0&&t.delete(e.toolUseId),!0):!1}function Mp(e,t,n){let r=[],i=[],a=new Map,o=()=>{if(i.length===0)return;let e=i[0];if(!e)return;let n=Ep(i,t),o={type:`tool_sequence`,id:`tool-seq-${e.id}`,pairedCalls:n};o.pairedCalls.length>0&&(r.push(o),Ap(o.pairedCalls,a),t?.onToolSequence?.(o,i)),i=[]};for(let s of e.filter(kp)){n?.has(s.id)&&o();let e=s.message&&gp(s.message)?bp(s.message,t!==void 0):null;e&&jp(e,a,s,t)||(s.message&&(hp(s.message)||gp(s.message))?i.push(s):(o(),r.push(s)))}return o(),r}function Np(){return{inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,totalCostUsd:0,totalDurationMs:0,totalDurationApiMs:0,turnCount:0,webSearchRequests:0,contextWindow:null,contextUsedTokens:null,maxOutputTokens:null,serviceTier:null}}function Pp(e){if(!e)return null;let t=Object.values(e);return t.length>0?t[0]??null:null}var Fp=N({sessionUpdate:M(`usage_update`),used:j().finite().nonnegative(),size:j().finite().positive()});function Ip(e,t){if(t.type!==`result`)return e;let n=Pp(t.model_usage),r=Fp.safeParse(t.result).data;return{inputTokens:e.inputTokens+(t.usage?.input_tokens??0),outputTokens:e.outputTokens+(t.usage?.output_tokens??0),cacheReadInputTokens:e.cacheReadInputTokens+(t.usage?.cache_read_input_tokens??0),cacheCreationInputTokens:e.cacheCreationInputTokens+(t.usage?.cache_creation_input_tokens??0),totalDurationMs:e.totalDurationMs+(t.duration_ms??0),totalDurationApiMs:e.totalDurationApiMs+(t.duration_api_ms??0),totalCostUsd:t.total_cost_usd??e.totalCostUsd,turnCount:t.num_turns??e.turnCount,webSearchRequests:e.webSearchRequests+(n?.webSearchRequests??0),contextWindow:r?.size??n?.contextWindow??e.contextWindow,contextUsedTokens:r?.used??e.contextUsedTokens??null,maxOutputTokens:n?.maxOutputTokens??e.maxOutputTokens,serviceTier:t.usage?.service_tier??e.serviceTier}}var Lp=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M237.66,66.34a8,8,0,0,0-11.32,0L192,100.69,155.31,64l34.35-34.34a8,8,0,1,0-11.32-11.32L144,52.69,117.66,26.34a8,8,0,0,0-11.32,11.32L112.69,44l-53,53a40,40,0,0,0,0,56.57l15.71,15.71L26.34,218.34a8,8,0,0,0,11.32,11.32l49.09-49.09,15.71,15.71a40,40,0,0,0,56.57,0l53-53,6.34,6.35a8,8,0,0,0,11.32-11.32L203.31,112l34.35-34.34A8,8,0,0,0,237.66,66.34ZM147.72,185a24,24,0,0,1-33.95,0L71,142.23a24,24,0,0,1,0-33.95l53-53L200.69,132Z`}))]]),Rp=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:Lp}));Rp.displayName=`PlugIcon`;var zp={github:`GitHub`,pr:`PR`,api:`API`,url:`URL`,id:`ID`,ui:`UI`,mcp:`MCP`};function Bp(e){let t=e.toLowerCase();return Object.hasOwn(zp,t)?zp[t]??e:/^[\p{Lu}\p{N}]{2,}s?$/u.test(e)?e:t}function Vp(e,t,n,r,i){let a=i.slice(r+e.length);return n.endsWith(`s`)&&/^(?:$|[_-]|\p{Lu})/u.test(a)?e:`${t} ${n}`}function Hp(e){let t=e.toLowerCase();if(Object.hasOwn(zp,t))return zp[t]??e;let n=e.replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu,Vp).replace(/([\p{Ll}\p{M}0-9])(\p{Lu})/gu,`$1 $2`).replace(/[_-]+/g,` `).replace(/[\p{L}\p{N}]+/gu,Bp).trim().replace(/\bpull request\b/g,`PR`);return n.charAt(0).toUpperCase()+n.slice(1)}function Up(e){let t=e.trim(),n=t.startsWith(`mcp__`)?/^mcp__([^\s]+?)__(\S+)$/.exec(t):/^mcp\.(?:codex_apps\.)?([^.\s]+)\.([^.\s]+)$/.exec(t),r=n?.[1],i=n?.[2];return r&&i&&/[a-z0-9]/i.test(r)&&/[a-z0-9]/i.test(i)?{service:Hp(r),action:r===`playwright`&&i===`browser_take_screenshot`?`Take screenshot`:Hp(i)}:null}function Wp(e){return/^list files(?:\s+in(?:\s|$)|$)/i.test(e.trim())}var Gp=new Map([[`git`,[`-C`,`-c`,`--git-dir`,`--work-tree`,`--namespace`,`--config-env`]],[`gh`,[`-R`,`--repo`,`--hostname`]],[`pnpm`,[`-C`,`--dir`,`--filter`,`-F`]],[`npm`,[`--prefix`,`--workspace`,`-w`]],[`bun`,[`--cwd`]],[`cargo`,[`--manifest-path`,`--color`,`--config`,`-Z`]],[`docker`,[`--context`,`-c`,`--host`,`-H`,`--config`,`--log-level`,`-l`]],[`kubectl`,[`--context`,`--namespace`,`-n`,`--kubeconfig`,`--server`]],[`uv`,[`--directory`,`--project`]],[`pip`,[]],[`pip3`,[]],[`go`,[]],[`ff`,[]]]),Kp=new Set([`bash`,`dash`,`ksh`,`mksh`,`sh`,`zsh`,`fish`]),qp=new Set([`--no-pager`,`--paginate`,`--bare`,`--no-replace-objects`,`--literal-pathspecs`,`--glob-pathspecs`,`--noglob-pathspecs`,`--icase-pathspecs`,`--no-optional-locks`,`--no-lazy-fetch`,`--recursive`,`-r`,`--workspace-root`,`--silent`,`--offline`,`--debug`,`--verbose`,`--quiet`,`-q`]);function Jp(e){let t=e.match(/(?:[^\s"';&|<>\\]|\\.|"[^"]*"|'[^']*')+|[;&|<>\n]/g)??[],n=t.findIndex(e=>/^[;&|<>\n]$/.test(e));return(n<0?t:t.slice(0,n)).map(e=>e.replace(/"([^"]*)"|'([^']*)'|\\(.)/g,(e,t,n,r)=>t??n??r))}function Yp(e,t){let n=Gp.get(e);if(!n)return e;for(let r=1;r<t.length;r++){let i=t[r]??``;if(n.includes(i))r++;else if(i.startsWith(`-`)&&!i.includes(`=`)&&!qp.has(i))return e;else if(!i.startsWith(`-`))return/^[a-z][a-z0-9-]*$/i.test(i)?`${e} ${i}`:e}return e}function Xp(e){let t=typeof e==`string`?Jp(e):e,n=t.findIndex(e=>!/^[A-Za-z_][A-Za-z0-9_]*=/.test(e)),r=t.slice(n<0?t.length:n),i=r[0]?.split(/[/\\]/).pop()?.replace(/\.exe$/i,``)||`command`;if(Kp.has(i)){let e=r.findIndex(e=>/^-[a-zA-Z]*c[a-zA-Z]*$/.test(e)),t=r[e+1];if(e>0&&t)return Xp(t)}return Yp(i,r)}function Zp(e){return/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(e.trim())?.[1]??e}function Qp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $p(e,t){let n=t.depth??0;if(n>t.maxDepth)return null;if(Array.isArray(e)){for(let r of e){let e=$p(r,{type:t.type,maxDepth:t.maxDepth,depth:n+1});if(e)return e}return null}if(!Qp(e))return null;let r=e.type;if(typeof r==`string`&&r.toLowerCase()===t.type.toLowerCase())return e;for(let r of Object.values(e)){let e=$p(r,{type:t.type,maxDepth:t.maxDepth,depth:n+1});if(e)return e}return null}var em=`filechange`,tm=6;function nm(e){return typeof e==`string`&&e.trim().length>0?e:null}function rm(e){return e.replace(/[\s_-]+/g,``).toLowerCase()}function im(e,t){switch((typeof e==`string`?e:Qp(e)?nm(e.type)??``:``).toLowerCase()){case`create`:case`add`:case`added`:return`create`;case`update`:case`edit`:case`modified`:return t?`move`:`update`;case`delete`:case`remove`:case`deleted`:return`delete`;case`move`:case`rename`:return`move`;default:return t?`move`:`unknown`}}function am(e){if(!Qp(e))return null;let t=nm(e.path);if(!t)return null;let n=e.kind,r=(Qp(n)?nm(n.move_path):null)??nm(e.move_path)??nm(e.movePath),i=nm(e.diff);return{path:t,kind:im(n,r),...i?{diff:i}:{},...r?{movePath:r}:{}}}function om(e){return e!==null}function sm(e){if(!Qp(e)||nm(e.type)?.toLowerCase()!==em)return null;let t=e.changes,n=Array.isArray(t)?t.map(am).filter(om):[],r=nm(e.id)??void 0,i=nm(e.status)??void 0;return{...r?{id:r}:{},...i?{status:i}:{},changes:n}}function cm(e){let t=e.trim();if(t.length===0)return null;try{let n=$p(JSON.parse(Zp(t)),{type:em,maxDepth:tm});if(!n)return null;let r=sm(n);return r?{...r,rawText:e}:null}catch{return null}}function lm(e){return/^filechanges?$/.test(rm(e))}function um(e){return sm(e)}function dm(e){if(typeof e==`string`)return cm(e);for(let t of e){if(t.type!==`text`)continue;let e=cm(t.text??``);if(e)return e}return null}function fm(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var pm=`websearch`,mm=6;function hm(e){return typeof e==`string`&&e.trim().length>0?e:null}function gm(e){let t=hm(e);return t?t.replace(/[\s_-]+/g,``).toLowerCase():null}function _m(e){return e.replace(/[\s_-]+/g,``).toLowerCase()}function vm(e){return Array.from(new Set(e.map(e=>e.trim()).filter(e=>e.length>0)))}function ym(e){if(!Qp(e))return{type:`other`};let t=hm(e.type)??`other`,n=hm(e.query)??void 0,r=Array.isArray(e.queries)?vm(e.queries.filter(e=>typeof e==`string`)):void 0;return{type:t,...n?{query:n}:{},...r&&r.length>0?{queries:r}:{}}}function bm(e,t){if(t.length===0)return e;let n=vm(e.queries??[]),r=n.length>0?n:[t],i=e.type.trim().toLowerCase()===`other`?`search`:e.type;return{...e,type:i,query:t,queries:r}}function xm(e){if(!Qp(e)||gm(e.type)!==pm)return null;let t=hm(e.id)??void 0,n=ym(e.action),r=[hm(e.query),n.query,n.queries?.[0]].find(e=>typeof e==`string`)??``,i=bm(n,r);return{type:`webSearch`,...t?{id:t}:{},query:r,action:i}}function Sm(e){let t=e.trim();if(t.length===0)return null;try{let n=$p(JSON.parse(Zp(t)),{type:pm,maxDepth:mm});if(!n)return null;let r=xm(n);return r?{...r,rawText:e}:null}catch{return null}}function Cm(e){let t=_m(e);return t===pm||t.startsWith(`${pm}:`)}function wm(e){return xm(e)}function Tm(e){if(typeof e==`string`)return Sm(e);for(let t of e){if(t.type!==`text`)continue;let e=Sm(t.text??``);if(e)return e}return null}var Em=24,Dm=96,Om=84,km=new Set([`bash`,`dash`,`ksh`,`mksh`,`sh`,`zsh`,`fish`]);function Am(e){return e.replace(/\s+/g,` `).trim()}function jm(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Mm(e){return e.split(/[/\\]/).pop()?.toLowerCase()??``}function Nm(e){let t=e[0];return t?km.has(Mm(t)):!1}function Pm(e){let t=Am(e);return/^run(?:\s|$)/i.test(t)}function Fm(e){let t=e.command;if(typeof t==`string`)return Am(t)||null;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length===0)return null;let n=e.findIndex(e=>e===`-c`||e===`-lc`);if(Nm(e)&&n>=0&&n<e.length-1){let t=Am(e[n+1]??``);if(t)return t}return Am(e.join(` `))||null}return null}function Im(e,t,n={}){let r=Am(e);if(!r)return`Tool`;if(Pm(r)){if(n.summary)return`Run`;let e=Fm(t);return e?jm(`Run ${e}`,84):`Run`}if(lm(r))return`File changes`;if(Cm(r)){if(n.summary)return`Web search`;let e=wm(t)?.query??(/^websearch\s*:\s*(.+)$/i.exec(r)?.[1]?.trim()||``);return e?jm(`Web search ${e}`,Om):`Web search`}return jm(r,n.summary?Em:Dm)}function Lm(e,t,n={}){let r=Up(e);return r?n.summary?r.service:`${r.action} · ${r.service}`:Wp(e)?`List files`:Im(e,t,n)}var Rm={command:{pending:`Running`,error:`Failed`,success:`Ran`},edit:{pending:`Editing`,error:`Couldn't edit`,success:`Edited`},read:{pending:`Reading`,error:`Couldn't read`,success:`Read`}};function zm(e){return Up(e)?`mcp`:Wp(e)?`list`:Pm(e)||/^(bash|shell|terminal|exec_command|execute_command)$/i.test(e.trim())?`command`:lm(e)||/^(edit|write|multiedit|apply_patch)$/i.test(e.trim())?`edit`:/^(read|readfile|read_file)(\s|$)/i.test(e.trim())?`read`:Cm(e)||/^(grep|glob|search)(\s|$)/i.test(e.trim())?`search`:`other`}function Bm(e){return Fm(e.input)||(typeof e.input.cmd==`string`?Am(e.input.cmd)||`command`:Pm(e.name)&&e.name.replace(/^run\s*/i,``).trim()||`command`)}function Vm(e){return typeof e.file_path==`string`?e.file_path:typeof e.path==`string`?e.path:`files`}function Hm(e){return jm(Xp(Array.isArray(e.input.command)?e.input.command.filter(e=>typeof e==`string`):typeof e.input.command==`string`?e.input.command:typeof e.input.cmd==`string`?e.input.cmd:Bm(e)),76)}function Um(e){let t=e.length===1?e[0]:void 0,n=t?Vm(t.input):`files`,r=n.split(/[/\\]/).pop();return n===`files`||!r?`files`:`file ${r}`}function Wm(e){let t=e.length===1?e[0]:void 0;return t?Hm(t):`commands`}function Gm(e){let t=zm(e.name);return t===`mcp`||t===`list`?t:typeof e.input.command==`string`||Array.isArray(e.input.command)||typeof e.input.cmd==`string`?`command`:t}function Km(e){let t=zm(e.name);return t===`command`?jm(`${Rm.command[e.status]} ${Bm(e)}`,84):t===`edit`||t===`read`?`${Rm[t][e.status]} ${Vm(e.input)}`:Lm(e.name,e.input)}function qm(e){let t=new Map;for(let n of e){let e=Up(n.name)?.service??n.name;t.set(e,(t.get(e)??0)+1)}return[...t].map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `)}function Jm(e,t){let n=t.some(e=>e.status===`pending`);switch(e){case`command`:return`${n?`Running`:`Ran`} ${Wm(t)}`;case`edit`:{let e=t.length===1&&!lm(t[0]?.name??``)?`a file`:`files`;return`${n?`Editing`:`Edited`} ${e}`}case`read`:return`${n?`Reading`:`Read`} ${Um(t)}`;case`search`:return n?`Searching`:`Searched`;case`list`:return n?`Listing files`:`Listed files`;case`mcp`:return qm(t);case`other`:return[...new Set(t.map(e=>Lm(e.name,e.input,{summary:!0})))].join(`, `)}}function Ym(e){return new Set(e.map(Gm))}function Xm(e){let t=new Map;for(let n of e){let e=Gm(n),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t].map(([e,t],n)=>{let r=Jm(e,t);return n===0||e===`other`||e===`mcp`?r:r.charAt(0).toLowerCase()+r.slice(1)}).join(`, `)}function Zm(e){let t=e.filter(e=>e.status===`error`).length;return t===0?null:e.length===1?`failed`:`${t} of ${e.length} failed`}var Qm=(0,F.memo)(function({todo:e}){let t=e.status===`completed`,n=e.status===`in_progress`;return(0,I.jsxs)(`div`,{className:`flex items-start gap-2.5 text-sm`,children:[(0,I.jsx)(`span`,{role:`img`,"aria-label":t?`Completed`:n?`In progress`:`Pending`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:t?(0,I.jsx)(l,{weight:`fill`,className:`h-4 w-4`}):(0,I.jsx)(`span`,{className:c(`block h-4 w-4 rounded-full border-2`,n?`border-primary/40 border-t-primary animate-spin motion-reduce:animate-none`:`border-dashed border-muted-foreground/60`)})}),(0,I.jsx)(`span`,{className:c(`min-w-0 break-words [overflow-wrap:anywhere]`,t&&`text-muted-foreground`),children:n&&e.activeForm||e.content})]})});function $m(e){let t=e.filter(e=>e.status===`completed`).length,n=e.length;return{completedCount:t,totalCount:n,progressPercent:n>0?Math.round(t/n*100):0}}var eh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z`}))]]),th=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:eh}));th.displayName=`ArrowsLeftRightIcon`;var nh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))]]),rh=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:nh}));rh.displayName=`FileDashedIcon`;var ih=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16h48A8,8,0,0,1,160,152Z`}))]]),ah=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:ih}));ah.displayName=`FileMinusIcon`;var oh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z`}))]]),sh=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:oh}));sh.displayName=`FilePlusIcon`;var ch=8,lh=4e3,uh=12e3;function dh(e,t){return e.length<=t?e:`${e.slice(0,t)}\n… (truncated)`}function fh(e){switch(e){case`create`:return`Added`;case`update`:return`Modified`;case`delete`:return`Deleted`;case`move`:return`Moved`;case`unknown`:return`Changed`}}function ph(e){switch(e){case`create`:return{icon:sh,className:`text-success border-success/40 bg-success/10`,iconColorClass:`text-success`};case`update`:return{icon:Ae,className:`text-warning border-warning/40 bg-warning/10`,iconColorClass:`text-warning`};case`delete`:return{icon:ah,className:`text-destructive border-destructive/40 bg-destructive/10`,iconColorClass:`text-destructive`};case`move`:return{icon:th,className:`text-info border-info/40 bg-info/10`,iconColorClass:`text-info`};case`unknown`:return{icon:rh,className:`text-muted-foreground border-border bg-muted/50`,iconColorClass:`text-muted-foreground`}}}function mh(e){let t=e.split(`/`);return{filename:t[t.length-1]??e,directory:t.slice(0,-1).join(`/`)}}function hh(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return[`create`,`update`,`delete`,`move`,`unknown`].map(e=>({kind:e,count:t.get(e)??0})).filter(e=>e.count>0)}var gh=(0,F.memo)(function({payload:e,rawPayload:t}){let n=e.changes.slice(0,ch),r=Math.max(0,e.changes.length-n.length),i=hh(e.changes),a=t??e.rawText;return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,I.jsx)(Ae,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`span`,{className:`font-medium`,children:[e.changes.length,` file `,e.changes.length===1?`change`:`changes`]}),e.status&&(0,I.jsx)(`span`,{className:`ml-auto rounded border bg-muted/50 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:e.status})]}),i.length>0&&(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(({kind:e,count:t})=>{let n=ph(e);return(0,I.jsxs)(`span`,{className:c(`rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:[t,` `,fh(e)]},`${e}-${t}`)})})]}),n.length===0?(0,I.jsx)(`div`,{className:`rounded border bg-muted/20 px-2 py-1.5 text-xs text-muted-foreground`,children:`No file paths were included in this payload.`}):(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[wn(n,e=>JSON.stringify([e.path,e.kind,e.movePath])).map(({item:e,key:t})=>{let n=ph(e.kind),r=n.icon,{directory:i,filename:a}=mh(e.path);return(0,I.jsxs)(`div`,{className:`rounded border bg-muted/20 px-2 py-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,I.jsx)(r,{className:c(`h-4 w-4 shrink-0`,n.iconColorClass)}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`font-mono text-xs truncate`,title:e.path,children:a}),i&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground truncate`,title:i,children:i})]}),(0,I.jsx)(`span`,{className:c(`rounded border px-1 py-0.5 text-[10px] font-medium`,n.className),children:fh(e.kind)})]}),e.movePath&&(0,I.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,I.jsx)(th,{className:`h-3 w-3 shrink-0`}),(0,I.jsx)(`span`,{className:`font-mono truncate`,title:e.movePath,children:e.movePath})]}),e.diff&&(0,I.jsxs)(`details`,{className:`mt-1 text-xs`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:`Diff preview`}),(0,I.jsx)(`pre`,{className:`mt-1 overflow-x-auto max-h-36 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:dh(e.diff,lh)})]})]},t)}),r>0&&(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`+`,r,` more file `,r===1?`change`:`changes`]})]}),a&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:`Raw payload`}),(0,I.jsx)(`pre`,{className:`mt-1 overflow-x-auto max-h-40 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:dh(a,uh)})]})]})}),_h=5e3,vh=2e3;function yh(e,t){return e.length<=t?e:`${e.slice(0,t)}\n… (truncated)`}var bh=(0,F.memo)(function({path:e}){if(!e)return null;let t=e.split(`/`),n=t[t.length-1],r=t.slice(0,-1).join(`/`);return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-sm min-w-0`,children:[(0,I.jsx)(Ae,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate`,children:[r,`/`]}),(0,I.jsx)(`span`,{className:`font-medium shrink-0`,children:n})]})}),xh=(0,F.memo)(function({input:e}){let t=e.subagent_type,n=e.description,r=e.prompt;return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(ae,{className:`h-4 w-4 shrink-0 text-primary`}),(0,I.jsx)(`span`,{className:`font-semibold text-sm`,children:t?`${t} agent`:`Subagent`})]}),n&&(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:n}),r&&(0,I.jsxs)(`div`,{className:`rounded bg-muted/50 px-2 py-1.5`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-muted-foreground mb-0.5`,children:`Task`}),(0,I.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap overflow-x-auto max-h-32 overflow-y-auto`,children:r})]}),Object.keys(e).filter(e=>![`subagent_type`,`description`,`prompt`].includes(e)).length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Additional parameters`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(Object.fromEntries(Object.entries(e).filter(([e])=>![`subagent_type`,`description`,`prompt`].includes(e))),null,2)})]})]})}),Sh=(0,F.memo)(function({input:e}){let t=e.todos;if(!t||t.length===0)return(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No todos`});let{completedCount:n,totalCount:r,progressPercent:i}=$m(t);return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`span`,{className:`text-xs font-medium`,children:[`Task List (`,n,`/`,r,`)`]}),(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i,`%`]})]}),(0,I.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-primary transition-all duration-300`,style:{width:`${i}%`}})}),(0,I.jsx)(`div`,{className:`space-y-1.5`,children:wn(t,e=>e.content).map(({item:e,key:t})=>(0,I.jsx)(Qm,{todo:e},t))})]})}),Ch=(0,F.memo)(function({input:e}){let t=Fm(e),n=e.command,r=Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:null,i=t??(typeof n==`string`?n:n==null?`(no command)`:JSON.stringify(n,null,2)),a=Object.fromEntries(Object.entries(e).filter(([e])=>![`command`,`description`,`cwd`].includes(e)));return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap break-words`,children:yh(i,_h)})}),typeof e.cwd==`string`&&e.cwd.length>0&&(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`cwd: `,e.cwd]}),typeof e.description==`string`&&e.description.length>0&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.description}),r&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Invocation args`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(r,null,2)})]}),Object.keys(a).length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Additional parameters`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(a,null,2)})]})]})}),wh=(0,F.memo)(function({input:e,resultContent:t}){let n=(t?Tm(t):null)??wm(e);if(!n)return(0,I.jsx)(`div`,{className:`w-0 min-w-full`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(e,null,2)})});let r=n.action.queries??(n.query?[n.query]:[]);return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap break-words`,children:n.query||`(query not resolved yet)`})}),(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`action: `,n.action.type]}),r.length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Queries`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(r,null,2)})]})]})});function Th({name:e,input:t,resultContent:n}){if(e===`Task`)return(0,I.jsx)(xh,{input:t});if(e===`TodoWrite`)return(0,I.jsx)(Sh,{input:t});if(Pm(e))return(0,I.jsx)(Ch,{input:t});if(Cm(e))return(0,I.jsx)(wh,{input:t,resultContent:n});let r=um(t);return r&&lm(e)?(0,I.jsx)(gh,{payload:r,rawPayload:fm(t)}):null}var Eh=(0,F.memo)(function({name:e,input:t,resultContent:n}){let r=Th({name:e,input:t,resultContent:n});if(r)return r;switch(e){case`Read`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),t.offset!==void 0&&(0,I.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Lines `,String(t.offset),` - `,Number(t.offset)+(Number(t.limit)||100)]})]});case`Write`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto`,children:yh(t.content??``,_h)})})]});case`Edit`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,I.jsxs)(`div`,{className:`rounded bg-destructive/10 px-1.5 py-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-destructive mb-0.5`,children:`Remove`}),(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-16 overflow-y-auto`,children:yh(t.old_string??``,vh)})]}),(0,I.jsxs)(`div`,{className:`rounded bg-success/10 px-1.5 py-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-success mb-0.5`,children:`Add`}),(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-16 overflow-y-auto`,children:yh(t.new_string??``,vh)})]})]})]});case`Bash`:return(0,I.jsxs)(`div`,{className:`space-y-0.5 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap`,children:String(t.command??``)})}),t.description!=null&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:String(t.description)})]});case`Glob`:case`Grep`:return(0,I.jsxs)(`div`,{className:`space-y-0.5 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`font-mono text-xs`,children:String(t.pattern??``)}),t.path!=null&&(0,I.jsx)(bh,{path:String(t.path)})]});default:return(0,I.jsx)(`div`,{className:`w-0 min-w-full`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(t,null,2)})})}});function Dh(e,t){return!(/^image\/(png|jpeg|jpg|gif|webp)$/.test(e)&&t)||t.length>13981016||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)?null:`data:${e};base64,${t}`}function Oh({src:e,alt:t,source:n,loading:r,title:i,interactive:a=!0}){let[o,s]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),d=n?/^data:/i.test(n):!1;if(!e||o)return(0,I.jsxs)(`span`,{className:c(`inline-flex max-w-full min-w-0 flex-col rounded border p-2 text-xs text-muted-foreground`,d&&`w-80`),children:[(0,I.jsxs)(`span`,{children:[r?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{className:`mr-1 inline size-3 align-text-bottom`,"aria-hidden":`true`}),`Loading image…`]}):`Image unavailable`,t?`: ${t}`:``]}),n&&(d&&a?(0,I.jsx)(`textarea`,{"aria-label":`Image source`,readOnly:!0,rows:2,wrap:`off`,value:n,className:`w-full min-w-0 max-w-full resize-none rounded border bg-muted p-1 font-mono text-xs`}):(0,I.jsx)(`code`,{className:`max-h-24 overflow-auto select-text whitespace-pre-wrap break-all`,children:n}))]});let f=(0,I.jsx)(`img`,{src:e,alt:t,title:i,loading:`lazy`,className:`my-0 max-h-80 max-w-full rounded object-contain`,onError:()=>s(!0)});return a?(0,I.jsxs)(`span`,{className:`inline-flex max-w-full flex-col align-top`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-label":`Open ${t} at full size`,className:`max-w-full cursor-zoom-in rounded focus-visible:outline focus-visible:outline-ring`,onClick:e=>{e.preventDefault(),e.stopPropagation(),u(!0)},children:f}),(0,I.jsx)(nt,{open:l,onOpenChange:u,children:(0,I.jsxs)(et,{className:`flex max-h-[90vh] max-w-[95vw] flex-col sm:max-w-5xl`,children:[(0,I.jsxs)($e,{children:[(0,I.jsx)(tt,{children:t}),(0,I.jsx)(Qe,{className:`break-all`,children:n&&!d?n:`Full-size image preview`})]}),(0,I.jsx)(`div`,{className:`overflow-auto`,children:(0,I.jsx)(`img`,{src:e,alt:t,title:i,className:`mx-auto max-w-none`})})]})})]}):f}var kh=/\r\n|\r|\n/g,Ah=/^[ \t]*$/,jh=/^( {0,3})(`{3,}|~{3,})(.*)$/,Mh=/^ {0,3}(`{3,}|~{3,})[ \t]*$/,Nh=/^[ \t]*(?:`{3,}|~{3,})/,Ph=/^(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/,Fh=String.raw`^(?:[ \t>]|(?:[-*+]|\d{1,9}[.)])[ \t])*`,Ih=new RegExp(String.raw`${Fh}\[[^\]]*\]:`),Lh=new RegExp(String.raw`${Fh}<(?:script|pre|style|textarea|!--|\?|![A-Za-z]|!\[CDATA\[)`,`i`);function Rh(e){let t=jh.exec(e),n=t?.[2];return!n||n.startsWith("`")&&t[3]?.includes("`")?null:{marker:n.charAt(0),length:n.length,indent:t[1]?.length??0}}function zh(e,t){let n=Mh.exec(e)?.[1];return n!==void 0&&n.charAt(0)===t.marker&&n.length>=t.length}function Bh(e,t){return t.indent===0||Ah.test(e)?!1:e.length-e.replace(/^ */,``).length<t.indent||Nh.test(e)}function Vh(e){let t=e.charAt(0);return t!==` `&&t!==` `&&!Ph.test(e)}function Hh(e,t){if(t.fence){if(zh(e,t.fence))t.fence=null;else if(Bh(e,t.fence))return null;return t.previousBlank=!1,!1}if(Ah.test(e))return t.previousBlank=!0,!1;if(Ih.test(e)||Lh.test(e))return null;let n=t.previousBlank&&t.hasContent&&Vh(e);return t.fence=Rh(e),t.previousBlank=!1,t.hasContent=!0,n}function Uh(e){let t={fence:null,previousBlank:!1,hasContent:!1},n=[],r=0,i=0,a=[...e.matchAll(kh)];for(let o=0;o<=a.length;o++){let s=a[o],c=s?s.index:e.length,l=Hh(e.slice(i,c),t);if(l===null)return[e];l&&(n.push(e.slice(r,i)),r=i),i=c+(s?.[0].length??0)}return n.push(e.slice(r)),n}var Wh=(0,F.lazy)(()=>Ge(()=>import(`./mermaid-diagram-DHR-LEin.js`).then(e=>e.t),__vite__mapDeps([3,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]))),Gh=[Vt],Kh=/^[A-Za-z]:(?:[\\/]|%5C)/i,qh=(0,F.createContext)(!1),Jh=(0,F.memo)(function({content:e,components:t,urlTransform:n}){return(0,I.jsx)(Qt,{remarkPlugins:Gh,components:t,urlTransform:n,children:e})}),Yh=(0,F.memo)(function({content:e,className:t,resolveWorkspaceFileLink:n,onWorkspaceFileLink:r,renderExternalLink:i,streaming:a=!1,renderImage:o,renderContent:s}){let l=(0,F.useRef)(r);(0,F.useLayoutEffect)(()=>{l.current=r},[r]);let u=!!r,d=(0,F.useMemo)(()=>({...o?{img:({src:e,alt:t,title:n})=>o({src:e,alt:t,title:n})}:{},code:({className:e,children:t,...n})=>{let r=e?.startsWith(`language-`),i=e?.replace(`language-`,``);return r?i===`mermaid`?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(`pre`,{className:`my-4 overflow-x-auto`,children:t}),children:(0,I.jsx)(Wh,{chart:String(t).trim()})}):(0,I.jsx)(`code`,{className:e,...n,children:t}):(0,I.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs`,...n,children:t})},pre:({children:e,...t})=>{let n=Array.isArray(e)?e[0]:e;return(0,F.isValidElement)(n)&&typeof n.props.className==`string`&&n.props.className.includes(`language-mermaid`)?(0,I.jsx)(I.Fragment,{children:e}):(0,I.jsx)(`pre`,{className:`bg-muted text-foreground border border-border/70 p-3 rounded-md overflow-x-auto shadow-sm`,...t,children:e})},a:({href:e,children:t})=>{let r=e?n?.(e):null;if(r&&u)return(0,I.jsx)(qh,{value:!0,children:(0,I.jsxs)(`a`,{href:e,onClick:e=>{e.preventDefault(),l.current?.(r)},onAuxClick:e=>{e.button===1&&(e.preventDefault(),l.current?.(r))},className:`text-primary underline hover:no-underline inline-flex items-center gap-0.5`,children:[t,(0,I.jsx)(Ae,{className:`h-3 w-3 shrink-0`})]})});let a=(0,I.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline hover:no-underline inline-flex items-center gap-0.5`,children:[t,(0,I.jsx)(je,{className:`h-3 w-3 shrink-0`})]});return(0,I.jsx)(qh,{value:!0,children:i?i(a):a})},p:({children:e})=>(0,I.jsx)(`p`,{className:`mb-4 last:mb-0`,children:e})}),[u,n,i,o]),f=(0,F.useCallback)((e,t)=>t===`src`&&o||u&&Kh.test(e)&&n?.(e)?e:Jt(e),[u,n,o]),p=(0,F.useMemo)(()=>{if(s)return[];let t=0;return(a?Uh(e):[e]).map(e=>{let n={start:t,text:e};return t+=e.length,n})},[e,a,s]);return(0,I.jsx)(`div`,{className:c(`prose prose-sm dark:prose-invert max-w-none min-w-0 overflow-hidden break-words text-sm leading-loose [&_a]:break-all [&_li]:break-words [&_p]:break-words [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_table]:block [&_table]:w-full [&_table]:overflow-x-auto`,t),children:s?.({content:e,streaming:a,components:d,urlTransform:f})??p.map(({start:e,text:t})=>(0,I.jsx)(Jh,{content:t,components:d,urlTransform:f},e))})});N({title:P(),state:we([`OPEN`,`CLOSED`]),author:N({login:P()}).nullable(),createdAt:ze()});function Xh(e){return mt(e,`issues`)}function Zh(e,t){let n=+In(e)-In(t);return n<0?-1:n>0?1:n}function Qh(e){return zn(e,Date.now())}function $h(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function eg(e,t,n){let r=An(),i=n?.locale??r.locale??Fn,a=Zh(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Rn(n?.in,...a>0?[t,e]:[e,t]),l=$h(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/Pn,f=(u-(Nn(c)-Nn(s)))/Pn,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}if(m===`day`){let e=l(f/jn);return i.formatDistance(`xDays`,e,o)}if(m===`month`){let e=l(f/Mn);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}{let e=l(f/Ln);return i.formatDistance(`xYears`,e,o)}}function tg(e,t){return eg(e,Qh(e),t)}var ng={staleTime:6e4,retry:!1,refetchOnWindowFocus:!1};function rg(e){let t=new Date(e);return Math.abs(Date.now()-t.getTime())<=5e3?`now`:tg(t,{addSuffix:!0})}function ig({repo:e,number:t,kind:n,data:r,state:i,icon:a,isError:o=!1,children:s}){return(0,I.jsxs)(`div`,{className:`space-y-3 text-sm leading-normal`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[i&&(0,I.jsxs)(`span`,{className:c(`inline-flex items-center gap-1 rounded-full px-2 py-1 font-medium`,i.color),children:[a,i.label]}),(0,I.jsxs)(`span`,{className:`min-w-0 break-all`,children:[e,` #`,t]}),r&&(0,I.jsx)(`time`,{dateTime:r.createdAt,title:new Date(r.createdAt).toLocaleString(),children:rg(r.createdAt)})]}),r?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`break-words text-base font-medium text-popover-foreground`,children:r.title}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{className:`min-w-0 break-all`,children:r.author?.login??`Deleted user`}),s]})]}):(0,I.jsx)(`div`,{className:`text-muted-foreground`,role:`status`,children:o?`Preview unavailable. Open the link to view this ${n}.`:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(E,{className:`size-3`,"aria-hidden":`true`}),`Loading ${n}…`]})})]})}function ag({link:e,children:t}){return(0,I.jsx)(ct,{delayDuration:350,children:(0,I.jsxs)(lt,{children:[(0,I.jsx)(st,{asChild:!0,children:e}),(0,I.jsx)(ut,{align:`start`,side:`bottom`,sideOffset:8,showArrow:!1,className:`not-prose w-96 max-w-[calc(100vw-2rem)] rounded-xl border border-border bg-popover p-4 text-left text-popover-foreground shadow-xl text-wrap`,children:t})]})})}var og={OPEN:{label:`Open`,color:x(`success`).chip},CLOSED:{label:`Closed`,color:x(`merged`).chip}};function sg({repo:e,number:t,data:n,isError:r=!1}){let i=n?og[n.state]:null,a=n?.state===`CLOSED`?l:at;return(0,I.jsx)(ig,{repo:e,number:t,kind:`issue`,data:n,state:i,icon:(0,I.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),isError:r})}function cg({repo:e,number:t}){let{data:n,isError:r}=i.github.getIssuePreview.useQuery({repo:e.toLowerCase(),number:t},ng);return(0,I.jsx)(sg,{repo:e,number:t,data:n,isError:r})}function lg({link:e}){let t=e.props.href?Xh(e.props.href):null;return t?(0,I.jsx)(ag,{link:e,children:(0,I.jsx)(cg,{...t})}):e}function ug(e){let t=v(e.state===`OPEN`&&e.isDraft?`DRAFT`:e.state);return t?{label:t.label,color:x(t.tone).chip}:null}function dg({repo:e,number:t,data:n,isError:r=!1}){let i=n?ug(n):null,a=n?.state===`MERGED`?g:f;return(0,I.jsx)(ig,{repo:e,number:t,kind:`pull request`,data:n,state:i,icon:(0,I.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),isError:r,children:n&&(0,I.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`rounded-md bg-muted px-2 py-1`,children:[(0,I.jsxs)(`span`,{className:h.added,children:[`+`,n.additions.toLocaleString()]}),` `,(0,I.jsxs)(`span`,{className:h.removed,children:[`−`,n.deletions.toLocaleString()]})]}),(0,I.jsxs)(`span`,{className:`rounded-md bg-muted px-2 py-1`,children:[n.changedFiles,` `,n.changedFiles===1?`file`:`files`]})]})})}function fg({repo:e,number:t}){let{data:n,isError:r}=i.github.getPRPreview.useQuery({repo:e.toLowerCase(),number:t},ng);return(0,I.jsx)(dg,{repo:e,number:t,data:n,isError:r})}function pg({link:e}){let t=e.props.href?ft(e.props.href):null;return t?(0,I.jsx)(ag,{link:e,children:(0,I.jsx)(fg,{...t})}):e}var mg=(0,F.createContext)(void 0);function hg(e){try{if(/^file:/i.test(e)){let t=new URL(e);if(t.hostname)return null;let n=decodeURIComponent(t.pathname);return/^\/[A-Za-z]:\//.test(n)?n.slice(1):n}if(/^[A-Za-z]:(?:[\\/]|%5C)/i.test(e)||!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`//`)))return decodeURIComponent(e)}catch{}return null}function gg({workspaceId:e,path:t,source:n,...r}){let a=i.workspace.readChatImage.useQuery({workspaceId:e,path:t},{retry:!1,staleTime:6e4,refetchOnWindowFocus:!1}),o=a.data&&Dh(a.data.mimeType,a.data.data);return(0,I.jsx)(Oh,{src:o||void 0,...r,source:n,loading:a.isPending},o||n)}function _g({src:e,alt:t=`Image`,title:n}){let r=(0,F.useContext)(mg),i=(0,F.useContext)(qh),a=e?hg(e):null;if(a&&r&&e)return(0,I.jsx)(gg,{workspaceId:r,path:a,alt:t,source:e,title:n,interactive:!i});let o;if(e&&/^(https?:\/\/|\/\/)/i.test(e))o=e;else if(e&&/^data:/i.test(e)){let t=/^data:([^;,]+);base64,(.*)$/i.exec(e);o=t?Dh(t[1]??``,t[2]??``)??void 0:void 0}return(0,I.jsx)(Oh,{src:o,alt:t,source:e,title:n,interactive:!i},e)}var vg={animation:`fadeIn`,duration:120,sep:`word`,stagger:0},yg=[],bg=`(prefers-reduced-motion: reduce)`,xg={a:`a`,blockquote:`blockquote`,code:`code`,h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,hr:`hr`,img:`img`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,section:`section`,strong:`strong`,sub:`sub`,sup:`sup`,table:`table`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`};function Sg(e){let t=window.matchMedia?.(bg);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)}function Cg(){return window.matchMedia?.(bg).matches??!0}function wg({content:e,streaming:t,components:n,urlTransform:r}){let i=(0,F.useSyncExternalStore)(Sg,Cg,()=>!0),a=(0,F.useMemo)(()=>({...xg,...n}),[n]),[o,s]=(0,F.useState)({components:n,urlTransform:r,revision:0});return(o.components!==n||o.urlTransform!==r)&&s({components:n,urlTransform:r,revision:o.revision+1}),(0,I.jsx)(rf,{components:a,urlTransform:r,rehypePlugins:yg,parseIncompleteMarkdown:t,isAnimating:t,animated:!i&&vg,controls:!1,children:e},o.revision)}function Tg(e){return(0,I.jsx)(wg,{...e})}function Eg(e){return(0,I.jsx)(_g,{...e})}function Dg({link:e}){let t=xt();if(t===void 0)return(0,F.cloneElement)(e,{href:void 0,"aria-disabled":!0});let n=t===!0&&e.props.href?zt(e.props.href):null;return n?(0,F.cloneElement)(e,{href:n.href,title:`Opens port ${n.port} on the host through Tailscale`}):e}function Og(e){let t=e.props.href;return t&&Xh(t)?(0,I.jsx)(lg,{link:e}):t&&zt(t)?(0,I.jsx)(Dg,{link:e}):(0,I.jsx)(pg,{link:e})}var kg=(0,F.memo)(function(e){return(0,I.jsx)(Yh,{renderContent:Tg,...e,renderExternalLink:Og,renderImage:Eg})}),Ag=8;function jg(e){let t=e.trim();return/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(t)?.[1]??e}function Mg(e){let t=e.trim();return t.startsWith(`#`)||t.includes(`
134
+ `):``}function pp(e){return e.type===`stream_event`&&e.event?up(e.event):e.message?fp(e.message.content):e.type===`error`&&e.error?e.error:e.type===`result`&&e.result?typeof e.result==`string`?e.result:JSON.stringify(e.result):``}function mp(e){let t=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:{};if(e.type===`stream_event`&&e.event){if(e.event.type===`content_block_start`){let n=e.event.content_block;if(qn(n))return{name:n.name,id:n.id,input:t(n.input)}}return null}if(e.message&&Array.isArray(e.message.content)){for(let n of e.message.content)if(qn(n))return{name:n.name,id:n.id,input:t(n.input)}}return null}function hp(e){return mp(e)!==null}function gp(e){return e.type===`stream_event`&&e.event?e.event.type===`content_block_start`&&Jn(e.event.content_block):e.message&&Array.isArray(e.message.content)?e.message.content.some(e=>Jn(e)):!1}function _p(e,t){let n={toolUseId:e.tool_use_id,content:e.content,isError:e.is_error??!1};return t&&(n.selectedBlock=e),n}function vp(e,t){return e.type===`content_block_start`&&Jn(e.content_block)?_p(e.content_block,t):null}function yp(e,t){let n=e.find(e=>Jn(e));return n&&Jn(n)?_p(n,t):null}function bp(e,t=!1){return e.type===`stream_event`&&e.event?vp(e.event,t):e.message&&Array.isArray(e.message.content)?yp(e.message.content,t):null}function xp(e){return e.type===`tool_sequence`}function Sp(e){if(!(e.message&&hp(e.message)))return null;let t=mp(e.message);return!t||Cp(t.name,t.input)?null:{id:t.id,name:t.name,input:t.input,status:`pending`}}function Cp(e,t){if(typeof e!=`string`)return!1;let n=e.trim().toLowerCase();if(n===`reasoning`||n===`thinking`||n===`think`)return!0;if(typeof t!=`object`||!t||Array.isArray(t))return!1;let r=t.type;return typeof r==`string`&&r.trim().toLowerCase()===`reasoning`}function wp(e,t,n,r){if(!(e.message&&gp(e.message)))return;let i=bp(e.message,r!==void 0);if(!i)return;let a=n.get(i.toolUseId);if(!a)return;let o=a.shift();if(o===void 0)return;a.length===0&&n.delete(i.toolUseId);let s=t[o];s&&(Tp(s,i),i.selectedBlock&&r?.onToolResult?.(e,i.selectedBlock,s))}function Tp(e,t){e.status=t.isError?`error`:`success`,e.result={content:t.content,isError:t.isError}}function Ep(e,t){let n=[],r=new Map;for(let i of e){let e=Sp(i);if(e){let a=r.get(e.id)??[];a.push(n.length),r.set(e.id,a),n.push(e),t?.onToolCall?.(i,e)}}for(let i of e)wp(i,n,r,t);return n}function Dp(e,t){for(let n=t-1;n>=0;--n){let t=e[n];if(t){if(t.source===`user`)return null;if(t.source===`agent`&&t.message&&(t.message.type!==`system`||t.message.subtype!==`subagent_started`&&t.message.subtype!==`subagent_finished`))return t.message.type===`result`?null:pp(t.message).trim()||null}}return null}function Op(e){return e.filter((t,n)=>{if(t.source!==`agent`||!t.message||t.message.type!==`result`)return!0;let r=pp(t.message).trim();return!r||Dp(e,n)!==r})}function kp(e){let t=e.source===`agent`?e.message:void 0;if(t?.type===`assistant`){let e=t.message?.content;if(Array.isArray(e)&&e.length>0&&e.every(Kn))return!1}return t?.type===`stream_event`&&t.event?.type===`content_block_start`&&Kn(t.event.content_block)?!1:e.source!==`agent`||e.message?.type!==`result`||typeof e.message.result==`string`&&e.message.result.trim().length>0}function Ap(e,t){for(let n of e){if(n.status!==`pending`)continue;let e=t.get(n.id)??[];e.push(n),t.set(n.id,e)}}function jp(e,t,n,r){let i=t.get(e.toolUseId);if(!i)return!1;let a=i.shift();return a?(Tp(a,e),e.selectedBlock&&r?.onToolResult?.(n,e.selectedBlock,a),i.length===0&&t.delete(e.toolUseId),!0):!1}function Mp(e,t,n){let r=[],i=[],a=new Map,o=()=>{if(i.length===0)return;let e=i[0];if(!e)return;let n=Ep(i,t),o={type:`tool_sequence`,id:`tool-seq-${e.id}`,pairedCalls:n};o.pairedCalls.length>0&&(r.push(o),Ap(o.pairedCalls,a),t?.onToolSequence?.(o,i)),i=[]};for(let s of e.filter(kp)){n?.has(s.id)&&o();let e=s.message&&gp(s.message)?bp(s.message,t!==void 0):null;e&&jp(e,a,s,t)||(s.message&&(hp(s.message)||gp(s.message))?i.push(s):(o(),r.push(s)))}return o(),r}function Np(){return{inputTokens:0,outputTokens:0,cacheReadInputTokens:0,cacheCreationInputTokens:0,totalCostUsd:0,totalDurationMs:0,totalDurationApiMs:0,turnCount:0,webSearchRequests:0,contextWindow:null,contextUsedTokens:null,maxOutputTokens:null,serviceTier:null}}function Pp(e){if(!e)return null;let t=Object.values(e);return t.length>0?t[0]??null:null}var Fp=N({sessionUpdate:M(`usage_update`),used:j().finite().nonnegative(),size:j().finite().positive()});function Ip(e,t){if(t.type!==`result`)return e;let n=Pp(t.model_usage),r=Fp.safeParse(t.result).data;return{inputTokens:e.inputTokens+(t.usage?.input_tokens??0),outputTokens:e.outputTokens+(t.usage?.output_tokens??0),cacheReadInputTokens:e.cacheReadInputTokens+(t.usage?.cache_read_input_tokens??0),cacheCreationInputTokens:e.cacheCreationInputTokens+(t.usage?.cache_creation_input_tokens??0),totalDurationMs:e.totalDurationMs+(t.duration_ms??0),totalDurationApiMs:e.totalDurationApiMs+(t.duration_api_ms??0),totalCostUsd:t.total_cost_usd??e.totalCostUsd,turnCount:t.num_turns??e.turnCount,webSearchRequests:e.webSearchRequests+(n?.webSearchRequests??0),contextWindow:r?.size??n?.contextWindow??e.contextWindow,contextUsedTokens:r?.used??e.contextUsedTokens??null,maxOutputTokens:n?.maxOutputTokens??e.maxOutputTokens,serviceTier:t.usage?.service_tier??e.serviceTier}}var Lp=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M237.66,66.34a8,8,0,0,0-11.32,0L192,100.69,155.31,64l34.35-34.34a8,8,0,1,0-11.32-11.32L144,52.69,117.66,26.34a8,8,0,0,0-11.32,11.32L112.69,44l-53,53a40,40,0,0,0,0,56.57l15.71,15.71L26.34,218.34a8,8,0,0,0,11.32,11.32l49.09-49.09,15.71,15.71a40,40,0,0,0,56.57,0l53-53,6.34,6.35a8,8,0,0,0,11.32-11.32L203.31,112l34.35-34.34A8,8,0,0,0,237.66,66.34ZM147.72,185a24,24,0,0,1-33.95,0L71,142.23a24,24,0,0,1,0-33.95l53-53L200.69,132Z`}))]]),Rp=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:Lp}));Rp.displayName=`PlugIcon`;var zp={github:`GitHub`,pr:`PR`,api:`API`,url:`URL`,id:`ID`,ui:`UI`,mcp:`MCP`};function Bp(e){let t=e.toLowerCase();return Object.hasOwn(zp,t)?zp[t]??e:/^[\p{Lu}\p{N}]{2,}s?$/u.test(e)?e:t}function Vp(e,t,n,r,i){let a=i.slice(r+e.length);return n.endsWith(`s`)&&/^(?:$|[_-]|\p{Lu})/u.test(a)?e:`${t} ${n}`}function Hp(e){let t=e.toLowerCase();if(Object.hasOwn(zp,t))return zp[t]??e;let n=e.replace(/(\p{Lu}+)(\p{Lu}\p{Ll})/gu,Vp).replace(/([\p{Ll}\p{M}0-9])(\p{Lu})/gu,`$1 $2`).replace(/[_-]+/g,` `).replace(/[\p{L}\p{N}]+/gu,Bp).trim().replace(/\bpull request\b/g,`PR`);return n.charAt(0).toUpperCase()+n.slice(1)}function Up(e){let t=e.trim(),n=t.startsWith(`mcp__`)?/^mcp__([^\s]+?)__(\S+)$/.exec(t):/^mcp\.(?:codex_apps\.)?([^.\s]+)\.([^.\s]+)$/.exec(t),r=n?.[1],i=n?.[2];return r&&i&&/[a-z0-9]/i.test(r)&&/[a-z0-9]/i.test(i)?{service:Hp(r),action:r===`playwright`&&i===`browser_take_screenshot`?`Take screenshot`:Hp(i)}:null}function Wp(e){return/^list files(?:\s+in(?:\s|$)|$)/i.test(e.trim())}var Gp=new Map([[`git`,[`-C`,`-c`,`--git-dir`,`--work-tree`,`--namespace`,`--config-env`]],[`gh`,[`-R`,`--repo`,`--hostname`]],[`pnpm`,[`-C`,`--dir`,`--filter`,`-F`]],[`npm`,[`--prefix`,`--workspace`,`-w`]],[`bun`,[`--cwd`]],[`cargo`,[`--manifest-path`,`--color`,`--config`,`-Z`]],[`docker`,[`--context`,`-c`,`--host`,`-H`,`--config`,`--log-level`,`-l`]],[`kubectl`,[`--context`,`--namespace`,`-n`,`--kubeconfig`,`--server`]],[`uv`,[`--directory`,`--project`]],[`pip`,[]],[`pip3`,[]],[`go`,[]],[`ff`,[]]]),Kp=new Set([`bash`,`dash`,`ksh`,`mksh`,`sh`,`zsh`,`fish`]),qp=new Set([`--no-pager`,`--paginate`,`--bare`,`--no-replace-objects`,`--literal-pathspecs`,`--glob-pathspecs`,`--noglob-pathspecs`,`--icase-pathspecs`,`--no-optional-locks`,`--no-lazy-fetch`,`--recursive`,`-r`,`--workspace-root`,`--silent`,`--offline`,`--debug`,`--verbose`,`--quiet`,`-q`]);function Jp(e){let t=e.match(/(?:[^\s"';&|<>\\]|\\.|"[^"]*"|'[^']*')+|[;&|<>\n]/g)??[],n=t.findIndex(e=>/^[;&|<>\n]$/.test(e));return(n<0?t:t.slice(0,n)).map(e=>e.replace(/"([^"]*)"|'([^']*)'|\\(.)/g,(e,t,n,r)=>t??n??r))}function Yp(e,t){let n=Gp.get(e);if(!n)return e;for(let r=1;r<t.length;r++){let i=t[r]??``;if(n.includes(i))r++;else if(i.startsWith(`-`)&&!i.includes(`=`)&&!qp.has(i))return e;else if(!i.startsWith(`-`))return/^[a-z][a-z0-9-]*$/i.test(i)?`${e} ${i}`:e}return e}function Xp(e){let t=typeof e==`string`?Jp(e):e,n=t.findIndex(e=>!/^[A-Za-z_][A-Za-z0-9_]*=/.test(e)),r=t.slice(n<0?t.length:n),i=r[0]?.split(/[/\\]/).pop()?.replace(/\.exe$/i,``)||`command`;if(Kp.has(i)){let e=r.findIndex(e=>/^-[a-zA-Z]*c[a-zA-Z]*$/.test(e)),t=r[e+1];if(e>0&&t)return Xp(t)}return Yp(i,r)}function Zp(e){return/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(e.trim())?.[1]??e}function Qp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $p(e,t){let n=t.depth??0;if(n>t.maxDepth)return null;if(Array.isArray(e)){for(let r of e){let e=$p(r,{type:t.type,maxDepth:t.maxDepth,depth:n+1});if(e)return e}return null}if(!Qp(e))return null;let r=e.type;if(typeof r==`string`&&r.toLowerCase()===t.type.toLowerCase())return e;for(let r of Object.values(e)){let e=$p(r,{type:t.type,maxDepth:t.maxDepth,depth:n+1});if(e)return e}return null}var em=`filechange`,tm=6;function nm(e){return typeof e==`string`&&e.trim().length>0?e:null}function rm(e){return e.replace(/[\s_-]+/g,``).toLowerCase()}function im(e,t){switch((typeof e==`string`?e:Qp(e)?nm(e.type)??``:``).toLowerCase()){case`create`:case`add`:case`added`:return`create`;case`update`:case`edit`:case`modified`:return t?`move`:`update`;case`delete`:case`remove`:case`deleted`:return`delete`;case`move`:case`rename`:return`move`;default:return t?`move`:`unknown`}}function am(e){if(!Qp(e))return null;let t=nm(e.path);if(!t)return null;let n=e.kind,r=(Qp(n)?nm(n.move_path):null)??nm(e.move_path)??nm(e.movePath),i=nm(e.diff);return{path:t,kind:im(n,r),...i?{diff:i}:{},...r?{movePath:r}:{}}}function om(e){return e!==null}function sm(e){if(!Qp(e)||nm(e.type)?.toLowerCase()!==em)return null;let t=e.changes,n=Array.isArray(t)?t.map(am).filter(om):[],r=nm(e.id)??void 0,i=nm(e.status)??void 0;return{...r?{id:r}:{},...i?{status:i}:{},changes:n}}function cm(e){let t=e.trim();if(t.length===0)return null;try{let n=$p(JSON.parse(Zp(t)),{type:em,maxDepth:tm});if(!n)return null;let r=sm(n);return r?{...r,rawText:e}:null}catch{return null}}function lm(e){return/^filechanges?$/.test(rm(e))}function um(e){return sm(e)}function dm(e){if(typeof e==`string`)return cm(e);for(let t of e){if(t.type!==`text`)continue;let e=cm(t.text??``);if(e)return e}return null}function fm(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}var pm=`websearch`,mm=6;function hm(e){return typeof e==`string`&&e.trim().length>0?e:null}function gm(e){let t=hm(e);return t?t.replace(/[\s_-]+/g,``).toLowerCase():null}function _m(e){return e.replace(/[\s_-]+/g,``).toLowerCase()}function vm(e){return Array.from(new Set(e.map(e=>e.trim()).filter(e=>e.length>0)))}function ym(e){if(!Qp(e))return{type:`other`};let t=hm(e.type)??`other`,n=hm(e.query)??void 0,r=Array.isArray(e.queries)?vm(e.queries.filter(e=>typeof e==`string`)):void 0;return{type:t,...n?{query:n}:{},...r&&r.length>0?{queries:r}:{}}}function bm(e,t){if(t.length===0)return e;let n=vm(e.queries??[]),r=n.length>0?n:[t],i=e.type.trim().toLowerCase()===`other`?`search`:e.type;return{...e,type:i,query:t,queries:r}}function xm(e){if(!Qp(e)||gm(e.type)!==pm)return null;let t=hm(e.id)??void 0,n=ym(e.action),r=[hm(e.query),n.query,n.queries?.[0]].find(e=>typeof e==`string`)??``,i=bm(n,r);return{type:`webSearch`,...t?{id:t}:{},query:r,action:i}}function Sm(e){let t=e.trim();if(t.length===0)return null;try{let n=$p(JSON.parse(Zp(t)),{type:pm,maxDepth:mm});if(!n)return null;let r=xm(n);return r?{...r,rawText:e}:null}catch{return null}}function Cm(e){let t=_m(e);return t===pm||t.startsWith(`${pm}:`)}function wm(e){return xm(e)}function Tm(e){if(typeof e==`string`)return Sm(e);for(let t of e){if(t.type!==`text`)continue;let e=Sm(t.text??``);if(e)return e}return null}var Em=24,Dm=96,Om=84,km=new Set([`bash`,`dash`,`ksh`,`mksh`,`sh`,`zsh`,`fish`]);function Am(e){return e.replace(/\s+/g,` `).trim()}function jm(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Mm(e){return e.split(/[/\\]/).pop()?.toLowerCase()??``}function Nm(e){let t=e[0];return t?km.has(Mm(t)):!1}function Pm(e){let t=Am(e);return/^run(?:\s|$)/i.test(t)}function Fm(e){let t=e.command;if(typeof t==`string`)return Am(t)||null;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length===0)return null;let n=e.findIndex(e=>e===`-c`||e===`-lc`);if(Nm(e)&&n>=0&&n<e.length-1){let t=Am(e[n+1]??``);if(t)return t}return Am(e.join(` `))||null}return null}function Im(e,t,n={}){let r=Am(e);if(!r)return`Tool`;if(Pm(r)){if(n.summary)return`Run`;let e=Fm(t);return e?jm(`Run ${e}`,84):`Run`}if(lm(r))return`File changes`;if(Cm(r)){if(n.summary)return`Web search`;let e=wm(t)?.query??(/^websearch\s*:\s*(.+)$/i.exec(r)?.[1]?.trim()||``);return e?jm(`Web search ${e}`,Om):`Web search`}return jm(r,n.summary?Em:Dm)}function Lm(e,t,n={}){let r=Up(e);return r?n.summary?r.service:`${r.action} · ${r.service}`:Wp(e)?`List files`:Im(e,t,n)}var Rm={command:{pending:`Running`,error:`Failed`,success:`Ran`},edit:{pending:`Editing`,error:`Couldn't edit`,success:`Edited`},read:{pending:`Reading`,error:`Couldn't read`,success:`Read`}};function zm(e){return Up(e)?`mcp`:Wp(e)?`list`:Pm(e)||/^(bash|shell|terminal|exec_command|execute_command)$/i.test(e.trim())?`command`:lm(e)||/^(edit|write|multiedit|apply_patch)$/i.test(e.trim())?`edit`:/^(read|readfile|read_file)(\s|$)/i.test(e.trim())?`read`:Cm(e)||/^(grep|glob|search)(\s|$)/i.test(e.trim())?`search`:`other`}function Bm(e){return Fm(e.input)||(typeof e.input.cmd==`string`?Am(e.input.cmd)||`command`:Pm(e.name)&&e.name.replace(/^run\s*/i,``).trim()||`command`)}function Vm(e){return typeof e.file_path==`string`?e.file_path:typeof e.path==`string`?e.path:`files`}function Hm(e){return jm(Xp(Array.isArray(e.input.command)?e.input.command.filter(e=>typeof e==`string`):typeof e.input.command==`string`?e.input.command:typeof e.input.cmd==`string`?e.input.cmd:Bm(e)),76)}function Um(e){let t=e.length===1?e[0]:void 0,n=t?Vm(t.input):`files`,r=n.split(/[/\\]/).pop();return n===`files`||!r?`files`:`file ${r}`}function Wm(e){let t=e.length===1?e[0]:void 0;return t?Hm(t):`commands`}function Gm(e){let t=zm(e.name);return t===`mcp`||t===`list`?t:typeof e.input.command==`string`||Array.isArray(e.input.command)||typeof e.input.cmd==`string`?`command`:t}function Km(e){let t=zm(e.name);return t===`command`?jm(`${Rm.command[e.status]} ${Bm(e)}`,84):t===`edit`||t===`read`?`${Rm[t][e.status]} ${Vm(e.input)}`:Lm(e.name,e.input)}function qm(e){let t=new Map;for(let n of e){let e=Up(n.name)?.service??n.name;t.set(e,(t.get(e)??0)+1)}return[...t].map(([e,t])=>t>1?`${e} ×${t}`:e).join(`, `)}function Jm(e,t){let n=t.some(e=>e.status===`pending`);switch(e){case`command`:return`${n?`Running`:`Ran`} ${Wm(t)}`;case`edit`:{let e=t.length===1&&!lm(t[0]?.name??``)?`a file`:`files`;return`${n?`Editing`:`Edited`} ${e}`}case`read`:return`${n?`Reading`:`Read`} ${Um(t)}`;case`search`:return n?`Searching`:`Searched`;case`list`:return n?`Listing files`:`Listed files`;case`mcp`:return qm(t);case`other`:return[...new Set(t.map(e=>Lm(e.name,e.input,{summary:!0})))].join(`, `)}}function Ym(e){return new Set(e.map(Gm))}function Xm(e){let t=new Map;for(let n of e){let e=Gm(n),r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t].map(([e,t],n)=>{let r=Jm(e,t);return n===0||e===`other`||e===`mcp`?r:r.charAt(0).toLowerCase()+r.slice(1)}).join(`, `)}function Zm(e){let t=e.filter(e=>e.status===`error`).length;return t===0?null:e.length===1?`failed`:`${t} of ${e.length} failed`}var Qm=(0,F.memo)(function({todo:e}){let t=e.status===`completed`,n=e.status===`in_progress`;return(0,I.jsxs)(`div`,{className:`flex items-start gap-2.5 text-sm`,children:[(0,I.jsx)(`span`,{role:`img`,"aria-label":t?`Completed`:n?`In progress`:`Pending`,className:`mt-0.5 shrink-0 text-muted-foreground`,children:t?(0,I.jsx)(l,{weight:`fill`,className:`h-4 w-4`}):(0,I.jsx)(`span`,{className:c(`block h-4 w-4 rounded-full border-2`,n?`border-primary/40 border-t-primary animate-spin motion-reduce:animate-none`:`border-dashed border-muted-foreground/60`)})}),(0,I.jsx)(`span`,{className:c(`min-w-0 break-words [overflow-wrap:anywhere]`,t&&`text-muted-foreground`),children:n&&e.activeForm||e.content})]})});function $m(e){let t=e.filter(e=>e.status===`completed`).length,n=e.length;return{completedCount:t,totalCount:n,progressPercent:n>0?Math.round(t/n*100):0}}var eh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,181.66l-32,32a8,8,0,0,1-11.32-11.32L188.69,184H48a8,8,0,0,1,0-16H188.69l-18.35-18.34a8,8,0,0,1,11.32-11.32l32,32A8,8,0,0,1,213.66,181.66Zm-139.32-64a8,8,0,0,0,11.32-11.32L67.31,88H208a8,8,0,0,0,0-16H67.31L85.66,53.66A8,8,0,0,0,74.34,42.34l-32,32a8,8,0,0,0,0,11.32Z`}))]]),th=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:eh}));th.displayName=`ArrowsLeftRightIcon`;var nh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M80,224a8,8,0,0,1-8,8H56a16,16,0,0,1-16-16V184a8,8,0,0,1,16,0v32H72A8,8,0,0,1,80,224ZM216,88v48a8,8,0,0,1-16,0V96H152a8,8,0,0,1-8-8V40H120a8,8,0,0,1,0-16h32a8,8,0,0,1,5.66,2.34l56,56A8,8,0,0,1,216,88Zm-56-8h28.69L160,51.31ZM80,24H56A16,16,0,0,0,40,40V64a8,8,0,0,0,16,0V40H80a8,8,0,0,0,0-16ZM208,168a8,8,0,0,0-8,8v40h-8a8,8,0,0,0,0,16h8a16,16,0,0,0,16-16V176A8,8,0,0,0,208,168ZM48,152a8,8,0,0,0,8-8V104a8,8,0,0,0-16,0v40A8,8,0,0,0,48,152Zm104,64H112a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Z`}))]]),rh=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:nh}));rh.displayName=`FileDashedIcon`;var ih=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H104a8,8,0,0,1,0-16h48A8,8,0,0,1,160,152Z`}))]]),ah=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:ih}));ah.displayName=`FileMinusIcon`;var oh=new Map([[`regular`,F.createElement(F.Fragment,null,F.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-40-64a8,8,0,0,1-8,8H136v16a8,8,0,0,1-16,0V160H104a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,160,152Z`}))]]),sh=F.forwardRef((e,t)=>F.createElement(s,{ref:t,...e,weights:oh}));sh.displayName=`FilePlusIcon`;var ch=8,lh=4e3,uh=12e3;function dh(e,t){return e.length<=t?e:`${e.slice(0,t)}\n… (truncated)`}function fh(e){switch(e){case`create`:return`Added`;case`update`:return`Modified`;case`delete`:return`Deleted`;case`move`:return`Moved`;case`unknown`:return`Changed`}}function ph(e){switch(e){case`create`:return{icon:sh,className:`text-success border-success/40 bg-success/10`,iconColorClass:`text-success`};case`update`:return{icon:Ae,className:`text-warning border-warning/40 bg-warning/10`,iconColorClass:`text-warning`};case`delete`:return{icon:ah,className:`text-destructive border-destructive/40 bg-destructive/10`,iconColorClass:`text-destructive`};case`move`:return{icon:th,className:`text-info border-info/40 bg-info/10`,iconColorClass:`text-info`};case`unknown`:return{icon:rh,className:`text-muted-foreground border-border bg-muted/50`,iconColorClass:`text-muted-foreground`}}}function mh(e){let t=e.split(`/`);return{filename:t[t.length-1]??e,directory:t.slice(0,-1).join(`/`)}}function hh(e){let t=new Map;for(let n of e)t.set(n.kind,(t.get(n.kind)??0)+1);return[`create`,`update`,`delete`,`move`,`unknown`].map(e=>({kind:e,count:t.get(e)??0})).filter(e=>e.count>0)}var gh=(0,F.memo)(function({payload:e,rawPayload:t}){let n=e.changes.slice(0,ch),r=Math.max(0,e.changes.length-n.length),i=hh(e.changes),a=t??e.rawText;return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`space-y-1`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,I.jsx)(Ae,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`span`,{className:`font-medium`,children:[e.changes.length,` file `,e.changes.length===1?`change`:`changes`]}),e.status&&(0,I.jsx)(`span`,{className:`ml-auto rounded border bg-muted/50 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground`,children:e.status})]}),i.length>0&&(0,I.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(({kind:e,count:t})=>{let n=ph(e);return(0,I.jsxs)(`span`,{className:c(`rounded border px-1.5 py-0.5 text-[10px] font-medium`,n.className),children:[t,` `,fh(e)]},`${e}-${t}`)})})]}),n.length===0?(0,I.jsx)(`div`,{className:`rounded border bg-muted/20 px-2 py-1.5 text-xs text-muted-foreground`,children:`No file paths were included in this payload.`}):(0,I.jsxs)(`div`,{className:`space-y-1.5`,children:[wn(n,e=>JSON.stringify([e.path,e.kind,e.movePath])).map(({item:e,key:t})=>{let n=ph(e.kind),r=n.icon,{directory:i,filename:a}=mh(e.path);return(0,I.jsxs)(`div`,{className:`rounded border bg-muted/20 px-2 py-1.5`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,I.jsx)(r,{className:c(`h-4 w-4 shrink-0`,n.iconColorClass)}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`div`,{className:`font-mono text-xs truncate`,title:e.path,children:a}),i&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground truncate`,title:i,children:i})]}),(0,I.jsx)(`span`,{className:c(`rounded border px-1 py-0.5 text-[10px] font-medium`,n.className),children:fh(e.kind)})]}),e.movePath&&(0,I.jsxs)(`div`,{className:`mt-1 flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,I.jsx)(th,{className:`h-3 w-3 shrink-0`}),(0,I.jsx)(`span`,{className:`font-mono truncate`,title:e.movePath,children:e.movePath})]}),e.diff&&(0,I.jsxs)(`details`,{className:`mt-1 text-xs`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:`Diff preview`}),(0,I.jsx)(`pre`,{className:`mt-1 overflow-x-auto max-h-36 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:dh(e.diff,lh)})]})]},t)}),r>0&&(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`+`,r,` more file `,r===1?`change`:`changes`]})]}),a&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:`Raw payload`}),(0,I.jsx)(`pre`,{className:`mt-1 overflow-x-auto max-h-40 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:dh(a,uh)})]})]})}),_h=5e3,vh=2e3;function yh(e,t){return e.length<=t?e:`${e.slice(0,t)}\n… (truncated)`}var bh=(0,F.memo)(function({path:e}){if(!e)return null;let t=e.split(`/`),n=t[t.length-1],r=t.slice(0,-1).join(`/`);return(0,I.jsxs)(`div`,{className:`flex items-center gap-1 text-sm min-w-0`,children:[(0,I.jsx)(Ae,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),(0,I.jsxs)(`span`,{className:`text-muted-foreground truncate`,children:[r,`/`]}),(0,I.jsx)(`span`,{className:`font-medium shrink-0`,children:n})]})}),xh=(0,F.memo)(function({input:e}){let t=e.subagent_type,n=e.description,r=e.prompt;return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,I.jsx)(ae,{className:`h-4 w-4 shrink-0 text-primary`}),(0,I.jsx)(`span`,{className:`font-semibold text-sm`,children:t?`${t} agent`:`Subagent`})]}),n&&(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground italic`,children:n}),r&&(0,I.jsxs)(`div`,{className:`rounded bg-muted/50 px-2 py-1.5`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-muted-foreground mb-0.5`,children:`Task`}),(0,I.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap overflow-x-auto max-h-32 overflow-y-auto`,children:r})]}),Object.keys(e).filter(e=>![`subagent_type`,`description`,`prompt`].includes(e)).length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Additional parameters`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(Object.fromEntries(Object.entries(e).filter(([e])=>![`subagent_type`,`description`,`prompt`].includes(e))),null,2)})]})]})}),Sh=(0,F.memo)(function({input:e}){let t=e.todos;if(!t||t.length===0)return(0,I.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`No todos`});let{completedCount:n,totalCount:r,progressPercent:i}=$m(t);return(0,I.jsxs)(`div`,{className:`space-y-2 w-0 min-w-full`,children:[(0,I.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,I.jsxs)(`span`,{className:`text-xs font-medium`,children:[`Task List (`,n,`/`,r,`)`]}),(0,I.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[i,`%`]})]}),(0,I.jsx)(`div`,{className:`h-1.5 rounded-full bg-muted overflow-hidden`,children:(0,I.jsx)(`div`,{className:`h-full bg-primary transition-all duration-300`,style:{width:`${i}%`}})}),(0,I.jsx)(`div`,{className:`space-y-1.5`,children:wn(t,e=>e.content).map(({item:e,key:t})=>(0,I.jsx)(Qm,{todo:e},t))})]})}),Ch=(0,F.memo)(function({input:e}){let t=Fm(e),n=e.command,r=Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:null,i=t??(typeof n==`string`?n:n==null?`(no command)`:JSON.stringify(n,null,2)),a=Object.fromEntries(Object.entries(e).filter(([e])=>![`command`,`description`,`cwd`].includes(e)));return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap break-words`,children:yh(i,_h)})}),typeof e.cwd==`string`&&e.cwd.length>0&&(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`cwd: `,e.cwd]}),typeof e.description==`string`&&e.description.length>0&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:e.description}),r&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Invocation args`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(r,null,2)})]}),Object.keys(a).length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Additional parameters`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(a,null,2)})]})]})}),wh=(0,F.memo)(function({input:e,resultContent:t}){let n=(t?Tm(t):null)??wm(e);if(!n)return(0,I.jsx)(`div`,{className:`w-0 min-w-full`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(e,null,2)})});let r=n.action.queries??(n.query?[n.query]:[]);return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap break-words`,children:n.query||`(query not resolved yet)`})}),(0,I.jsxs)(`div`,{className:`text-[10px] text-muted-foreground`,children:[`action: `,n.action.type]}),r.length>0&&(0,I.jsxs)(`details`,{className:`text-xs`,children:[(0,I.jsx)(`summary`,{className:`text-muted-foreground cursor-pointer hover:text-foreground`,children:`Queries`}),(0,I.jsx)(`pre`,{className:`mt-1 text-xs overflow-x-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(r,null,2)})]})]})});function Th({name:e,input:t,resultContent:n}){if(e===`Task`)return(0,I.jsx)(xh,{input:t});if(e===`TodoWrite`)return(0,I.jsx)(Sh,{input:t});if(Pm(e))return(0,I.jsx)(Ch,{input:t});if(Cm(e))return(0,I.jsx)(wh,{input:t,resultContent:n});let r=um(t);return r&&lm(e)?(0,I.jsx)(gh,{payload:r,rawPayload:fm(t)}):null}var Eh=(0,F.memo)(function({name:e,input:t,resultContent:n}){let r=Th({name:e,input:t,resultContent:n});if(r)return r;switch(e){case`Read`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),t.offset!==void 0&&(0,I.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Lines `,String(t.offset),` - `,Number(t.offset)+(Number(t.limit)||100)]})]});case`Write`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto`,children:yh(t.content??``,_h)})})]});case`Edit`:return(0,I.jsxs)(`div`,{className:`space-y-1 w-0 min-w-full`,children:[(0,I.jsx)(bh,{path:t.file_path}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,I.jsxs)(`div`,{className:`rounded bg-destructive/10 px-1.5 py-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-destructive mb-0.5`,children:`Remove`}),(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-16 overflow-y-auto`,children:yh(t.old_string??``,vh)})]}),(0,I.jsxs)(`div`,{className:`rounded bg-success/10 px-1.5 py-1 min-w-0`,children:[(0,I.jsx)(`div`,{className:`text-[10px] font-medium text-success mb-0.5`,children:`Add`}),(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-16 overflow-y-auto`,children:yh(t.new_string??``,vh)})]})]})]});case`Bash`:return(0,I.jsxs)(`div`,{className:`space-y-0.5 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`rounded bg-muted px-1.5 py-1 font-mono`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto whitespace-pre-wrap`,children:String(t.command??``)})}),t.description!=null&&(0,I.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:String(t.description)})]});case`Glob`:case`Grep`:return(0,I.jsxs)(`div`,{className:`space-y-0.5 w-0 min-w-full`,children:[(0,I.jsx)(`div`,{className:`font-mono text-xs`,children:String(t.pattern??``)}),t.path!=null&&(0,I.jsx)(bh,{path:String(t.path)})]});default:return(0,I.jsx)(`div`,{className:`w-0 min-w-full`,children:(0,I.jsx)(`pre`,{className:`text-xs overflow-x-auto max-h-32 overflow-y-auto rounded bg-muted px-1.5 py-1`,children:JSON.stringify(t,null,2)})})}});function Dh(e,t){return!(/^image\/(png|jpeg|jpg|gif|webp)$/.test(e)&&t)||t.length>13981016||t.length%4!=0||!/^[A-Za-z0-9+/]+={0,2}$/.test(t)?null:`data:${e};base64,${t}`}function Oh({src:e,alt:t,source:n,loading:r,title:i,interactive:a=!0}){let[o,s]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),d=n?/^data:/i.test(n):!1;if(!e||o)return(0,I.jsxs)(`span`,{className:c(`inline-flex max-w-full min-w-0 flex-col rounded border p-2 text-xs text-muted-foreground`,d&&`w-80`),children:[(0,I.jsxs)(`span`,{children:[r?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{className:`mr-1 inline size-3 align-text-bottom`,"aria-hidden":`true`}),`Loading image…`]}):`Image unavailable`,t?`: ${t}`:``]}),n&&(d&&a?(0,I.jsx)(`textarea`,{"aria-label":`Image source`,readOnly:!0,rows:2,wrap:`off`,value:n,className:`w-full min-w-0 max-w-full resize-none rounded border bg-muted p-1 font-mono text-xs`}):(0,I.jsx)(`code`,{className:`max-h-24 overflow-auto select-text whitespace-pre-wrap break-all`,children:n}))]});let f=(0,I.jsx)(`img`,{src:e,alt:t,title:i,loading:`lazy`,className:`my-0 max-h-80 max-w-full rounded object-contain`,onError:()=>s(!0)});return a?(0,I.jsxs)(`span`,{className:`inline-flex max-w-full flex-col align-top`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-label":`Open ${t} at full size`,className:`max-w-full cursor-zoom-in rounded focus-visible:outline focus-visible:outline-ring`,onClick:e=>{e.preventDefault(),e.stopPropagation(),u(!0)},children:f}),(0,I.jsx)(nt,{open:l,onOpenChange:u,children:(0,I.jsxs)(et,{className:`flex max-h-[90vh] max-w-[95vw] flex-col sm:max-w-5xl`,children:[(0,I.jsxs)($e,{children:[(0,I.jsx)(tt,{children:t}),(0,I.jsx)(Qe,{className:`break-all`,children:n&&!d?n:`Full-size image preview`})]}),(0,I.jsx)(`div`,{className:`overflow-auto`,children:(0,I.jsx)(`img`,{src:e,alt:t,title:i,className:`mx-auto max-w-none`})})]})})]}):f}var kh=/\r\n|\r|\n/g,Ah=/^[ \t]*$/,jh=/^( {0,3})(`{3,}|~{3,})(.*)$/,Mh=/^ {0,3}(`{3,}|~{3,})[ \t]*$/,Nh=/^[ \t]*(?:`{3,}|~{3,})/,Ph=/^(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/,Fh=String.raw`^(?:[ \t>]|(?:[-*+]|\d{1,9}[.)])[ \t])*`,Ih=new RegExp(String.raw`${Fh}\[[^\]]*\]:`),Lh=new RegExp(String.raw`${Fh}<(?:script|pre|style|textarea|!--|\?|![A-Za-z]|!\[CDATA\[)`,`i`);function Rh(e){let t=jh.exec(e),n=t?.[2];return!n||n.startsWith("`")&&t[3]?.includes("`")?null:{marker:n.charAt(0),length:n.length,indent:t[1]?.length??0}}function zh(e,t){let n=Mh.exec(e)?.[1];return n!==void 0&&n.charAt(0)===t.marker&&n.length>=t.length}function Bh(e,t){return t.indent===0||Ah.test(e)?!1:e.length-e.replace(/^ */,``).length<t.indent||Nh.test(e)}function Vh(e){let t=e.charAt(0);return t!==` `&&t!==` `&&!Ph.test(e)}function Hh(e,t){if(t.fence){if(zh(e,t.fence))t.fence=null;else if(Bh(e,t.fence))return null;return t.previousBlank=!1,!1}if(Ah.test(e))return t.previousBlank=!0,!1;if(Ih.test(e)||Lh.test(e))return null;let n=t.previousBlank&&t.hasContent&&Vh(e);return t.fence=Rh(e),t.previousBlank=!1,t.hasContent=!0,n}function Uh(e){let t={fence:null,previousBlank:!1,hasContent:!1},n=[],r=0,i=0,a=[...e.matchAll(kh)];for(let o=0;o<=a.length;o++){let s=a[o],c=s?s.index:e.length,l=Hh(e.slice(i,c),t);if(l===null)return[e];l&&(n.push(e.slice(r,i)),r=i),i=c+(s?.[0].length??0)}return n.push(e.slice(r)),n}var Wh=(0,F.lazy)(()=>Ge(()=>import(`./mermaid-diagram-7d3eG33H.js`).then(e=>e.t),__vite__mapDeps([3,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68]))),Gh=[Vt],Kh=/^[A-Za-z]:(?:[\\/]|%5C)/i,qh=(0,F.createContext)(!1),Jh=(0,F.memo)(function({content:e,components:t,urlTransform:n}){return(0,I.jsx)(Qt,{remarkPlugins:Gh,components:t,urlTransform:n,children:e})}),Yh=(0,F.memo)(function({content:e,className:t,resolveWorkspaceFileLink:n,onWorkspaceFileLink:r,renderExternalLink:i,streaming:a=!1,renderImage:o,renderContent:s}){let l=(0,F.useRef)(r);(0,F.useLayoutEffect)(()=>{l.current=r},[r]);let u=!!r,d=(0,F.useMemo)(()=>({...o?{img:({src:e,alt:t,title:n})=>o({src:e,alt:t,title:n})}:{},code:({className:e,children:t,...n})=>{let r=e?.startsWith(`language-`),i=e?.replace(`language-`,``);return r?i===`mermaid`?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsx)(`pre`,{className:`my-4 overflow-x-auto`,children:t}),children:(0,I.jsx)(Wh,{chart:String(t).trim()})}):(0,I.jsx)(`code`,{className:e,...n,children:t}):(0,I.jsx)(`code`,{className:`bg-muted px-1.5 py-0.5 rounded text-xs`,...n,children:t})},pre:({children:e,...t})=>{let n=Array.isArray(e)?e[0]:e;return(0,F.isValidElement)(n)&&typeof n.props.className==`string`&&n.props.className.includes(`language-mermaid`)?(0,I.jsx)(I.Fragment,{children:e}):(0,I.jsx)(`pre`,{className:`bg-muted text-foreground border border-border/70 p-3 rounded-md overflow-x-auto shadow-sm`,...t,children:e})},a:({href:e,children:t})=>{let r=e?n?.(e):null;if(r&&u)return(0,I.jsx)(qh,{value:!0,children:(0,I.jsxs)(`a`,{href:e,onClick:e=>{e.preventDefault(),l.current?.(r)},onAuxClick:e=>{e.button===1&&(e.preventDefault(),l.current?.(r))},className:`text-primary underline hover:no-underline inline-flex items-center gap-0.5`,children:[t,(0,I.jsx)(Ae,{className:`h-3 w-3 shrink-0`})]})});let a=(0,I.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`text-primary underline hover:no-underline inline-flex items-center gap-0.5`,children:[t,(0,I.jsx)(je,{className:`h-3 w-3 shrink-0`})]});return(0,I.jsx)(qh,{value:!0,children:i?i(a):a})},p:({children:e})=>(0,I.jsx)(`p`,{className:`mb-4 last:mb-0`,children:e})}),[u,n,i,o]),f=(0,F.useCallback)((e,t)=>t===`src`&&o||u&&Kh.test(e)&&n?.(e)?e:Jt(e),[u,n,o]),p=(0,F.useMemo)(()=>{if(s)return[];let t=0;return(a?Uh(e):[e]).map(e=>{let n={start:t,text:e};return t+=e.length,n})},[e,a,s]);return(0,I.jsx)(`div`,{className:c(`prose prose-sm dark:prose-invert max-w-none min-w-0 overflow-hidden break-words text-sm leading-loose [&_a]:break-all [&_li]:break-words [&_p]:break-words [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_table]:block [&_table]:w-full [&_table]:overflow-x-auto`,t),children:s?.({content:e,streaming:a,components:d,urlTransform:f})??p.map(({start:e,text:t})=>(0,I.jsx)(Jh,{content:t,components:d,urlTransform:f},e))})});N({title:P(),state:we([`OPEN`,`CLOSED`]),author:N({login:P()}).nullable(),createdAt:ze()});function Xh(e){return mt(e,`issues`)}function Zh(e,t){let n=+In(e)-In(t);return n<0?-1:n>0?1:n}function Qh(e){return zn(e,Date.now())}function $h(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function eg(e,t,n){let r=An(),i=n?.locale??r.locale??Fn,a=Zh(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Rn(n?.in,...a>0?[t,e]:[e,t]),l=$h(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/Pn,f=(u-(Nn(c)-Nn(s)))/Pn,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}if(m===`day`){let e=l(f/jn);return i.formatDistance(`xDays`,e,o)}if(m===`month`){let e=l(f/Mn);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}{let e=l(f/Ln);return i.formatDistance(`xYears`,e,o)}}function tg(e,t){return eg(e,Qh(e),t)}var ng={staleTime:6e4,retry:!1,refetchOnWindowFocus:!1};function rg(e){let t=new Date(e);return Math.abs(Date.now()-t.getTime())<=5e3?`now`:tg(t,{addSuffix:!0})}function ig({repo:e,number:t,kind:n,data:r,state:i,icon:a,isError:o=!1,children:s}){return(0,I.jsxs)(`div`,{className:`space-y-3 text-sm leading-normal`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-muted-foreground`,children:[i&&(0,I.jsxs)(`span`,{className:c(`inline-flex items-center gap-1 rounded-full px-2 py-1 font-medium`,i.color),children:[a,i.label]}),(0,I.jsxs)(`span`,{className:`min-w-0 break-all`,children:[e,` #`,t]}),r&&(0,I.jsx)(`time`,{dateTime:r.createdAt,title:new Date(r.createdAt).toLocaleString(),children:rg(r.createdAt)})]}),r?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`break-words text-base font-medium text-popover-foreground`,children:r.title}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,I.jsx)(`span`,{className:`min-w-0 break-all`,children:r.author?.login??`Deleted user`}),s]})]}):(0,I.jsx)(`div`,{className:`text-muted-foreground`,role:`status`,children:o?`Preview unavailable. Open the link to view this ${n}.`:(0,I.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,I.jsx)(E,{className:`size-3`,"aria-hidden":`true`}),`Loading ${n}…`]})})]})}function ag({link:e,children:t}){return(0,I.jsx)(ct,{delayDuration:350,children:(0,I.jsxs)(lt,{children:[(0,I.jsx)(st,{asChild:!0,children:e}),(0,I.jsx)(ut,{align:`start`,side:`bottom`,sideOffset:8,showArrow:!1,className:`not-prose w-96 max-w-[calc(100vw-2rem)] rounded-xl border border-border bg-popover p-4 text-left text-popover-foreground shadow-xl text-wrap`,children:t})]})})}var og={OPEN:{label:`Open`,color:x(`success`).chip},CLOSED:{label:`Closed`,color:x(`merged`).chip}};function sg({repo:e,number:t,data:n,isError:r=!1}){let i=n?og[n.state]:null,a=n?.state===`CLOSED`?l:at;return(0,I.jsx)(ig,{repo:e,number:t,kind:`issue`,data:n,state:i,icon:(0,I.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),isError:r})}function cg({repo:e,number:t}){let{data:n,isError:r}=i.github.getIssuePreview.useQuery({repo:e.toLowerCase(),number:t},ng);return(0,I.jsx)(sg,{repo:e,number:t,data:n,isError:r})}function lg({link:e}){let t=e.props.href?Xh(e.props.href):null;return t?(0,I.jsx)(ag,{link:e,children:(0,I.jsx)(cg,{...t})}):e}function ug(e){let t=v(e.state===`OPEN`&&e.isDraft?`DRAFT`:e.state);return t?{label:t.label,color:x(t.tone).chip}:null}function dg({repo:e,number:t,data:n,isError:r=!1}){let i=n?ug(n):null,a=n?.state===`MERGED`?g:f;return(0,I.jsx)(ig,{repo:e,number:t,kind:`pull request`,data:n,state:i,icon:(0,I.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`}),isError:r,children:n&&(0,I.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,I.jsxs)(`span`,{className:`rounded-md bg-muted px-2 py-1`,children:[(0,I.jsxs)(`span`,{className:h.added,children:[`+`,n.additions.toLocaleString()]}),` `,(0,I.jsxs)(`span`,{className:h.removed,children:[`−`,n.deletions.toLocaleString()]})]}),(0,I.jsxs)(`span`,{className:`rounded-md bg-muted px-2 py-1`,children:[n.changedFiles,` `,n.changedFiles===1?`file`:`files`]})]})})}function fg({repo:e,number:t}){let{data:n,isError:r}=i.github.getPRPreview.useQuery({repo:e.toLowerCase(),number:t},ng);return(0,I.jsx)(dg,{repo:e,number:t,data:n,isError:r})}function pg({link:e}){let t=e.props.href?ft(e.props.href):null;return t?(0,I.jsx)(ag,{link:e,children:(0,I.jsx)(fg,{...t})}):e}var mg=(0,F.createContext)(void 0);function hg(e){try{if(/^file:/i.test(e)){let t=new URL(e);if(t.hostname)return null;let n=decodeURIComponent(t.pathname);return/^\/[A-Za-z]:\//.test(n)?n.slice(1):n}if(/^[A-Za-z]:(?:[\\/]|%5C)/i.test(e)||!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith(`//`)))return decodeURIComponent(e)}catch{}return null}function gg({workspaceId:e,path:t,source:n,...r}){let a=i.workspace.readChatImage.useQuery({workspaceId:e,path:t},{retry:!1,staleTime:6e4,refetchOnWindowFocus:!1}),o=a.data&&Dh(a.data.mimeType,a.data.data);return(0,I.jsx)(Oh,{src:o||void 0,...r,source:n,loading:a.isPending},o||n)}function _g({src:e,alt:t=`Image`,title:n}){let r=(0,F.useContext)(mg),i=(0,F.useContext)(qh),a=e?hg(e):null;if(a&&r&&e)return(0,I.jsx)(gg,{workspaceId:r,path:a,alt:t,source:e,title:n,interactive:!i});let o;if(e&&/^(https?:\/\/|\/\/)/i.test(e))o=e;else if(e&&/^data:/i.test(e)){let t=/^data:([^;,]+);base64,(.*)$/i.exec(e);o=t?Dh(t[1]??``,t[2]??``)??void 0:void 0}return(0,I.jsx)(Oh,{src:o,alt:t,source:e,title:n,interactive:!i},e)}var vg={animation:`fadeIn`,duration:120,sep:`word`,stagger:0},yg=[],bg=`(prefers-reduced-motion: reduce)`,xg={a:`a`,blockquote:`blockquote`,code:`code`,h1:`h1`,h2:`h2`,h3:`h3`,h4:`h4`,h5:`h5`,h6:`h6`,hr:`hr`,img:`img`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,section:`section`,strong:`strong`,sub:`sub`,sup:`sup`,table:`table`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`};function Sg(e){let t=window.matchMedia?.(bg);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)}function Cg(){return window.matchMedia?.(bg).matches??!0}function wg({content:e,streaming:t,components:n,urlTransform:r}){let i=(0,F.useSyncExternalStore)(Sg,Cg,()=>!0),a=(0,F.useMemo)(()=>({...xg,...n}),[n]),[o,s]=(0,F.useState)({components:n,urlTransform:r,revision:0});return(o.components!==n||o.urlTransform!==r)&&s({components:n,urlTransform:r,revision:o.revision+1}),(0,I.jsx)(rf,{components:a,urlTransform:r,rehypePlugins:yg,parseIncompleteMarkdown:t,isAnimating:t,animated:!i&&vg,controls:!1,children:e},o.revision)}function Tg(e){return(0,I.jsx)(wg,{...e})}function Eg(e){return(0,I.jsx)(_g,{...e})}function Dg({link:e}){let t=xt();if(t===void 0)return(0,F.cloneElement)(e,{href:void 0,"aria-disabled":!0});let n=t===!0&&e.props.href?zt(e.props.href):null;return n?(0,F.cloneElement)(e,{href:n.href,title:`Opens port ${n.port} on the host through Tailscale`}):e}function Og(e){let t=e.props.href;return t&&Xh(t)?(0,I.jsx)(lg,{link:e}):t&&zt(t)?(0,I.jsx)(Dg,{link:e}):(0,I.jsx)(pg,{link:e})}var kg=(0,F.memo)(function(e){return(0,I.jsx)(Yh,{renderContent:Tg,...e,renderExternalLink:Og,renderImage:Eg})}),Ag=8;function jg(e){let t=e.trim();return/^```(?:json)?\s*([\s\S]*?)\s*```$/i.exec(t)?.[1]??e}function Mg(e){let t=e.trim();return t.startsWith(`#`)||t.includes(`
135
135
  #`)||t.includes(`
136
136
  ##`)||t.includes(`
137
137
  - `)||t.includes(`