junhost 0.2.1 → 0.2.4

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 (141) hide show
  1. package/bin/jun.js +55 -1
  2. package/dist/browser-mcp-server.js +1 -1
  3. package/dist/index.js +58 -59
  4. package/dist/mcp-server.js +11 -11
  5. package/package.json +1 -1
  6. package/ui-dist/assets/BrowserPage-SOejdSXd.js +1 -0
  7. package/ui-dist/assets/DashboardPage-DBSjArx4.js +1 -0
  8. package/ui-dist/assets/FilesPage-Co7w4yPV.js +64 -0
  9. package/ui-dist/assets/FormContext-CdQ9sDWR.js +1 -0
  10. package/ui-dist/assets/LogsPage-BPcYN5yl.js +1 -0
  11. package/ui-dist/assets/McpPage-DMSfd_bz.js +1 -0
  12. package/ui-dist/assets/MemoriesPage-BrZWQnNs.js +1 -0
  13. package/ui-dist/assets/{RunsPage-CK9pwAgz.js → RunsPage-DGPOmwHg.js} +50 -50
  14. package/ui-dist/assets/SchedulesPage-CGRBnO2D.js +1 -0
  15. package/ui-dist/assets/SettingsPage-C_hWawaj.js +1 -0
  16. package/ui-dist/assets/SkillsPage-CpF3t2F6.js +1 -0
  17. package/ui-dist/assets/api-DTaM-PBA.js +1 -0
  18. package/ui-dist/assets/architecture-7EHR7CIX-Dcu_L_tZ.js +1 -0
  19. package/ui-dist/assets/{architectureDiagram-3BPJPVTR-BP2MZYle.js → architectureDiagram-3BPJPVTR-CYwo6wbL.js} +1 -1
  20. package/ui-dist/assets/badge-Czi0QcSt.js +1 -0
  21. package/ui-dist/assets/{blockDiagram-GPEHLZMM-Af1ue8xv.js → blockDiagram-GPEHLZMM-ESzvgY_d.js} +1 -1
  22. package/ui-dist/assets/button-C5SbvNQM.js +1 -0
  23. package/ui-dist/assets/{c4Diagram-AAUBKEIU-AY7PqfkW.js → c4Diagram-AAUBKEIU-BFIF6RjX.js} +1 -1
  24. package/ui-dist/assets/channel-BCV_BwnR.js +1 -0
  25. package/ui-dist/assets/checkbox-CvgOimO2.js +1 -0
  26. package/ui-dist/assets/{chunk-2J33WTMH-h9HiYY_u.js → chunk-2J33WTMH-DHrqzPNv.js} +1 -1
  27. package/ui-dist/assets/{chunk-3OPIFGDE-BhRd3oVg.js → chunk-3OPIFGDE-D-OBfFax.js} +1 -1
  28. package/ui-dist/assets/{chunk-5ZQYHXKU-3UMjEqrw.js → chunk-5ZQYHXKU-D5zzqgKr.js} +1 -1
  29. package/ui-dist/assets/{chunk-727SXJPM-BcWt_3lo.js → chunk-727SXJPM-C3PXI115.js} +1 -1
  30. package/ui-dist/assets/{chunk-AQP2D5EJ-Cpch5yeN.js → chunk-AQP2D5EJ-Bpj50bQh.js} +1 -1
  31. package/ui-dist/assets/{chunk-BO2N2NFS-tci6_YFK.js → chunk-BO2N2NFS-CgXJ5x75.js} +4 -4
  32. package/ui-dist/assets/{chunk-CSCIHK7Q-B7WJrDNL.js → chunk-CSCIHK7Q-BtmPGR8Z.js} +3 -3
  33. package/ui-dist/assets/{chunk-KSCS5N6A-C_P0C3_7.js → chunk-KSCS5N6A-CopX8M46.js} +1 -1
  34. package/ui-dist/assets/{chunk-L5ZTLDWV-CgJ4GCaj.js → chunk-L5ZTLDWV-BviTnq5M.js} +1 -1
  35. package/ui-dist/assets/{chunk-LZXEDZCA-C2PsTcer.js → chunk-LZXEDZCA-BAENHcPD.js} +2 -2
  36. package/ui-dist/assets/{chunk-ND2GUHAM-CSipvS6t.js → chunk-ND2GUHAM-DZ9eeo3O.js} +1 -1
  37. package/ui-dist/assets/{chunk-NZK2D7GU-BmtPBmfa.js → chunk-NZK2D7GU-B-IcekpZ.js} +1 -1
  38. package/ui-dist/assets/{chunk-O5CBEL6O-DHg6U4bD.js → chunk-O5CBEL6O-uzui4fRc.js} +1 -1
  39. package/ui-dist/assets/{chunk-WU5MYG2G-Jao3JHnT.js → chunk-WU5MYG2G-CYvvOcUE.js} +1 -1
  40. package/ui-dist/assets/{circle-x-BSTd_gmE.js → circle-x-CAsSuVme.js} +1 -1
  41. package/ui-dist/assets/classDiagram-4FO5ZUOK-Dq-Bv-C-.js +1 -0
  42. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-Dq-Bv-C-.js +1 -0
  43. package/ui-dist/assets/collapsible-DBUxLbzP.js +1 -0
  44. package/ui-dist/assets/{dagre-BM42HDAG-CmyaiNOn.js → dagre-BM42HDAG-BnZediLS.js} +1 -1
  45. package/ui-dist/assets/{diagram-2AECGRRQ-C8X3Dn_F.js → diagram-2AECGRRQ-R3SA74dj.js} +1 -1
  46. package/ui-dist/assets/{diagram-5GNKFQAL-D7FdDkBI.js → diagram-5GNKFQAL-BIFqDshR.js} +1 -1
  47. package/ui-dist/assets/{diagram-KO2AKTUF-DTvmbX9D.js → diagram-KO2AKTUF-BewO5gZn.js} +1 -1
  48. package/ui-dist/assets/{diagram-LMA3HP47-C4ytoinJ.js → diagram-LMA3HP47-VCDqO0nt.js} +1 -1
  49. package/ui-dist/assets/{diagram-OG6HWLK6-Ck8n45l9.js → diagram-OG6HWLK6-CqtMJ04I.js} +1 -1
  50. package/ui-dist/assets/dialog-DNn7-a_m.js +1 -0
  51. package/ui-dist/assets/{erDiagram-TEJ5UH35-DEdyi5kb.js → erDiagram-TEJ5UH35-DieBE3Rx.js} +1 -1
  52. package/ui-dist/assets/eventmodeling-FCH6USID-BSOzHW1O.js +1 -0
  53. package/ui-dist/assets/{external-link-DiZ5uX5z.js → external-link-DCXGJhiP.js} +1 -1
  54. package/ui-dist/assets/{flowDiagram-I6XJVG4X-DJh6JTpP.js → flowDiagram-I6XJVG4X-_gTMsbYe.js} +1 -1
  55. package/ui-dist/assets/{ganttDiagram-6RSMTGT7-40CbH6vs.js → ganttDiagram-6RSMTGT7-Ojxb0li0.js} +1 -1
  56. package/ui-dist/assets/{gitGraph-WXDBUCRP-Bb8N_3_Z.js → gitGraph-WXDBUCRP-CAGTBNn6.js} +1 -1
  57. package/ui-dist/assets/{gitGraphDiagram-PVQCEYII-CYO8lsXs.js → gitGraphDiagram-PVQCEYII-BCMq34-W.js} +1 -1
  58. package/ui-dist/assets/{highlighted-body-OFNGDK62-C9QojPJP.js → highlighted-body-OFNGDK62-CtSa94q8.js} +1 -1
  59. package/ui-dist/assets/{index-CZzHSXB1.css → index-CWOY_p-K.css} +1 -1
  60. package/ui-dist/assets/index-yyhnv7Ap.js +12 -0
  61. package/ui-dist/assets/{info-J43DQDTF-CuL2NM7A.js → info-J43DQDTF-gykbtpzn.js} +1 -1
  62. package/ui-dist/assets/{infoDiagram-5YYISTIA-BPLgO20D.js → infoDiagram-5YYISTIA-CAFjVe3v.js} +1 -1
  63. package/ui-dist/assets/input-CzAFDIdf.js +1 -0
  64. package/ui-dist/assets/{ishikawaDiagram-YF4QCWOH-CvaXogtI.js → ishikawaDiagram-YF4QCWOH-D3BdPtw9.js} +1 -1
  65. package/ui-dist/assets/{journeyDiagram-JHISSGLW-C1J-v-pE.js → journeyDiagram-JHISSGLW-BzT9Xthe.js} +1 -1
  66. package/ui-dist/assets/{kanban-definition-UN3LZRKU-CRmhIHz7.js → kanban-definition-UN3LZRKU-CQj8Taa5.js} +1 -1
  67. package/ui-dist/assets/katex-BX33ra8Y.js +1 -0
  68. package/ui-dist/assets/{key-round-D965pLEl.js → key-round-i_iJarVP.js} +1 -1
  69. package/ui-dist/assets/label-Bu19spuB.js +1 -0
  70. package/ui-dist/assets/{line-BdBKXCG0.js → line-BofMfFGW.js} +1 -1
  71. package/ui-dist/assets/mermaid-GHXKKRXX-CJkN8RLl.js +1 -0
  72. package/ui-dist/assets/{mermaid-parser.core-BS-vIFlR.js → mermaid-parser.core-B-NMEyis.js} +2 -2
  73. package/ui-dist/assets/{mindmap-definition-RKZ34NQL-1LEnd-Xo.js → mindmap-definition-RKZ34NQL-Co7nZa8L.js} +1 -1
  74. package/ui-dist/assets/{packet-YPE3B663-BYcxKrId.js → packet-YPE3B663-CUHl-3-z.js} +1 -1
  75. package/ui-dist/assets/{pause-h76ixDr5.js → pause-DhMeMeEd.js} +1 -1
  76. package/ui-dist/assets/{pie-LRSECV5Y-DYSxmFzY.js → pie-LRSECV5Y-66vPnpWw.js} +1 -1
  77. package/ui-dist/assets/{pieDiagram-4H26LBE5-EqE8umht.js → pieDiagram-4H26LBE5-anqqKj6T.js} +1 -1
  78. package/ui-dist/assets/play-D3mjFMmX.js +1 -0
  79. package/ui-dist/assets/{quadrantDiagram-W4KKPZXB-CEBlRqkN.js → quadrantDiagram-W4KKPZXB-CH1Wkvzf.js} +1 -1
  80. package/ui-dist/assets/{radar-GUYGQ44K-DloreDUf.js → radar-GUYGQ44K-C-aSbLx7.js} +1 -1
  81. package/ui-dist/assets/{requirementDiagram-4Y6WPE33-BtG32uo4.js → requirementDiagram-4Y6WPE33-BXgFmUPx.js} +1 -1
  82. package/ui-dist/assets/{rotate-cw-B1ZRM7VI.js → rotate-cw-BUTALXBe.js} +1 -1
  83. package/ui-dist/assets/{sankeyDiagram-5OEKKPKP-LFkiQmlj.js → sankeyDiagram-5OEKKPKP-BZJiw-wH.js} +1 -1
  84. package/ui-dist/assets/search-CKqhWG6h.js +1 -0
  85. package/ui-dist/assets/select-s2HSAntK.js +1 -0
  86. package/ui-dist/assets/{sequenceDiagram-3UESZ5HK-BFABrHKQ.js → sequenceDiagram-3UESZ5HK-C6ZDPDNO.js} +1 -1
  87. package/ui-dist/assets/square-COjZqkOL.js +1 -0
  88. package/ui-dist/assets/{stateDiagram-AJRCARHV-UZadGigl.js → stateDiagram-AJRCARHV-BNz2d_tV.js} +1 -1
  89. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-C7n6nn-m.js +1 -0
  90. package/ui-dist/assets/tabs-grE19_AL.js +1 -0
  91. package/ui-dist/assets/textarea-CwL3B5t5.js +1 -0
  92. package/ui-dist/assets/{timeline-definition-PNZ67QCA-B0GbqI20.js → timeline-definition-PNZ67QCA-Ctli85zn.js} +1 -1
  93. package/ui-dist/assets/{trash-2-D4CnL8wv.js → trash-2-D5W0vize.js} +1 -1
  94. package/ui-dist/assets/{treeView-BLDUP644-COM1up3U.js → treeView-BLDUP644-DsKAQvGU.js} +1 -1
  95. package/ui-dist/assets/{treemap-LRROVOQU-CWvutEBH.js → treemap-LRROVOQU-DabIXs6O.js} +1 -1
  96. package/ui-dist/assets/useBaseUiId-DL38u1cQ.js +1 -0
  97. package/ui-dist/assets/useButton-kcIJA9wR.js +1 -0
  98. package/ui-dist/assets/useCompositeListItem-I_fNdF1_.js +1 -0
  99. package/ui-dist/assets/useRegisterFieldControl-DOObtV36.js +1 -0
  100. package/ui-dist/assets/{vennDiagram-CIIHVFJN-BU2bLP3c.js → vennDiagram-CIIHVFJN-DYyyOGXD.js} +1 -1
  101. package/ui-dist/assets/{wardley-L42UT6IY-DiQe6mxF.js → wardley-L42UT6IY-4pZOEfsT.js} +1 -1
  102. package/ui-dist/assets/{wardleyDiagram-YWT4CUSO-D4BuSn5f.js → wardleyDiagram-YWT4CUSO-Ba6H_8tB.js} +1 -1
  103. package/ui-dist/assets/{xychartDiagram-2RQKCTM6-CcKf_YnL.js → xychartDiagram-2RQKCTM6-DQSqwpal.js} +1 -1
  104. package/ui-dist/index.html +4 -4
  105. package/ui-dist/assets/BrowserPage-vw54Zy8i.js +0 -1
  106. package/ui-dist/assets/DashboardPage-Fae7MOCk.js +0 -1
  107. package/ui-dist/assets/FilesPage-DGMWNSyG.js +0 -64
  108. package/ui-dist/assets/FormContext-6Ydu-jal.js +0 -1
  109. package/ui-dist/assets/LogsPage-ChoGgfAX.js +0 -1
  110. package/ui-dist/assets/McpPage-CZ_0PAsI.js +0 -1
  111. package/ui-dist/assets/MemoriesPage-j2hFZJtC.js +0 -1
  112. package/ui-dist/assets/SchedulesPage-BdOov1_M.js +0 -1
  113. package/ui-dist/assets/SettingsPage-BawGPDde.js +0 -1
  114. package/ui-dist/assets/SkillsPage-BoDc74ND.js +0 -1
  115. package/ui-dist/assets/architecture-7EHR7CIX-4fzAtq46.js +0 -1
  116. package/ui-dist/assets/badge-DjyNiZCE.js +0 -1
  117. package/ui-dist/assets/button-Cg-0y2B2.js +0 -1
  118. package/ui-dist/assets/channel-COgxKgTn.js +0 -1
  119. package/ui-dist/assets/checkbox-B77q6yf0.js +0 -1
  120. package/ui-dist/assets/classDiagram-4FO5ZUOK-CxJD7YbT.js +0 -1
  121. package/ui-dist/assets/classDiagram-v2-Q7XG4LA2-CxJD7YbT.js +0 -1
  122. package/ui-dist/assets/collapsible-CP1QD5GK.js +0 -1
  123. package/ui-dist/assets/dialog-CPRWiMQj.js +0 -1
  124. package/ui-dist/assets/eventmodeling-FCH6USID-CZSE8Xfh.js +0 -1
  125. package/ui-dist/assets/index-CqEDC1ie.js +0 -12
  126. package/ui-dist/assets/input-B0qeLI2E.js +0 -1
  127. package/ui-dist/assets/katex--eycYE9W.js +0 -1
  128. package/ui-dist/assets/label-CxX4-RmK.js +0 -1
  129. package/ui-dist/assets/mermaid-GHXKKRXX-CvI11iBs.js +0 -1
  130. package/ui-dist/assets/play-B4R5rXMZ.js +0 -1
  131. package/ui-dist/assets/search-09Pme-NO.js +0 -1
  132. package/ui-dist/assets/select-CF2SUxSi.js +0 -1
  133. package/ui-dist/assets/square-_9cV5Fet.js +0 -1
  134. package/ui-dist/assets/stateDiagram-v2-BHNVJYJU-BeslXd68.js +0 -1
  135. package/ui-dist/assets/tabs-CpVOS0Mr.js +0 -1
  136. package/ui-dist/assets/textarea-5JHEEgU-.js +0 -1
  137. package/ui-dist/assets/useBaseUiId-dSIElxm7.js +0 -1
  138. package/ui-dist/assets/useButton-DKtiRcm8.js +0 -1
  139. package/ui-dist/assets/useCompositeListItem-CJiAiQsj.js +0 -1
  140. package/ui-dist/assets/useRegisterFieldControl-CbOBCC3j.js +0 -1
  141. package/ui-dist/assets/utils-BX1Diber.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "junhost",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
4
4
  "description": "Jun — a self-hosted dashboard that runs and supervises Codex as a 24/7 local/VPS agent: chat runs, workspace files, remote browser, skills, MCP, schedules.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as i}from"./pause-DhMeMeEd.js";import{t as a}from"./play-D3mjFMmX.js";import{t as o}from"./rotate-cw-BUTALXBe.js";import{t as s}from"./square-COjZqkOL.js";import{c,n as l,r as u,s as d}from"./api-DTaM-PBA.js";import{Yt as f,t as p}from"./index-yyhnv7Ap.js";import{t as m}from"./button-C5SbvNQM.js";import{t as h}from"./input-CzAFDIdf.js";var ee=r(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),g=r(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),_=r(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),v=r(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),y=r(`mouse-pointer`,[[`path`,{d:`M12.586 12.586 19 19`,key:`ea5xo7`}],[`path`,{d:`M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z`,key:`277e5u`}]]),b=e(t(),1),x=n(),S={width:1280,height:720},C=[{value:`agent`,label:`Agent`,icon:_},{value:`user`,label:`You`,icon:y},{value:`paused`,label:`Paused`,icon:i}];function w(e){return!!e.altKey|(e.ctrlKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0)}var T=[`left`,`middle`,`right`];function E(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)([]),[i,_]=(0,b.useState)(``),[E,D]=(0,b.useState)(null),[O,te]=(0,b.useState)(null),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),N=(0,b.useRef)(null),P=(0,b.useRef)(null),F=(0,b.useRef)(null),I=(0,b.useRef)(null),L=(0,b.useCallback)(()=>{let e=I.current;if(!e)return;let t=S.width/S.height,n=e.clientWidth,r=e.clientHeight;if(n===0||r===0)return;let i=n,a=n/t;a>r&&(a=r,i=r*t);let o={w:Math.floor(i),h:Math.floor(a)};te(e=>e?.w===o.w&&e?.h===o.h?e:o)},[]);(0,b.useEffect)(()=>{L();let e=new ResizeObserver(L);return I.current&&e.observe(I.current),()=>e.disconnect()},[L]);let R=(0,b.useRef)(!1),z=(0,b.useRef)(0),B=e?.streaming??!1,V=e?.running??!1,H=e?.controller??`agent`,U=H===`user`,W=(0,b.useCallback)(async()=>{try{let[{status:e},{actions:n}]=await Promise.all([l(`/api/browser/status`),l(`/api/browser/actions`)]);t(e),r(n),!R.current&&e.url&&e.url!==`about:blank`&&_(e.url),M(null)}catch(e){M(e instanceof Error?e.message:String(e))}},[]);p(W,5e3),(0,b.useEffect)(()=>{U&&F.current?.focus()},[U]),(0,b.useEffect)(()=>{if(!B){D(null);return}let e=!1,t=null,n=0,r=()=>{let i=d(`/api/browser/stream`);N.current=i,i.onmessage=e=>{try{let t=JSON.parse(String(e.data));t.type===`frame`&&t.data&&(n=0,D(`data:image/jpeg;base64,${t.data}`))}catch{}},i.onclose=()=>{if(N.current===i&&(N.current=null),e)return;let a=Math.min(1e3*2**n,1e4);n+=1,t=setTimeout(r,a)}};return r(),()=>{e=!0,t&&clearTimeout(t),N.current?.close(),N.current=null}},[B]);let G=(0,b.useCallback)(async e=>{A(!0),M(null);try{await e(),await W()}catch(e){M(e instanceof Error?e.message:String(e))}finally{A(!1)}},[W]),K=()=>G(()=>u(`/api/browser/start`,{url:i.trim()||void 0})),q=()=>G(()=>u(`/api/browser/stop`)),J=()=>{let e=i.trim();if(!e)return;let t=/^[a-z]+:\/\//i.test(e)?e:`https://${e}`;return G(()=>u(`/api/browser/navigate`,{url:t}))},Y=e=>G(()=>u(`/api/browser/${e}`)),ne=()=>G(()=>u(`/api/browser/screenshot`)),X=e=>G(()=>u(`/api/browser/control`,{controller:e})),Z=e=>{let t=N.current;t&&t.readyState===WebSocket.OPEN&&t.send(JSON.stringify(e))},re=e=>{let t=P.current;if(!t)return null;let n=t.getBoundingClientRect();return n.width===0||n.height===0?null:{x:Math.round((e.clientX-n.left)/n.width*S.width),y:Math.round((e.clientY-n.top)/n.height*S.height)}},Q=(e,t,n={})=>{if(!U)return;let r=re(e);r&&(e.preventDefault(),Z({type:`input_mouse`,eventType:t,...r,button:T[e.button]??`left`,clickCount:e.detail||1,modifiers:w(e),...n}))},ie=e=>{let t=performance.now();t-z.current<33||(z.current=t,Q(e,`mouseMoved`))},ae=e=>{let t=e.ctrlKey||e.metaKey||e.altKey;if(e.key.length===1&&!t)return null;let n=[];return e.ctrlKey&&n.push(`Control`),e.shiftKey&&n.push(`Shift`),e.altKey&&n.push(`Alt`),e.metaKey&&n.push(`Meta`),n.push(e.key===` `?`Space`:e.key),n.join(`+`)},$=(e,t)=>{if(!U)return;e.preventDefault();let n=ae(e);if(n){t===`keyDown`&&u(`/api/browser/key`,{key:n}).catch(()=>{});return}Z({type:`input_keyboard`,eventType:t,key:e.key,code:e.code,text:t===`keyDown`?e.key:void 0,modifiers:w(e)})};return(0,x.jsxs)(`div`,{className:`flex h-full min-h-0`,children:[(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 p-4`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`back`),children:(0,x.jsx)(ee,{})}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`forward`),children:(0,x.jsx)(g,{})}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:()=>Y(`reload`),children:(0,x.jsx)(o,{})})]}),(0,x.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,x.jsx)(h,{placeholder:`https://example.com`,value:i,onChange:e=>_(e.target.value),onFocus:()=>R.current=!0,onBlur:()=>R.current=!1,onKeyDown:e=>{e.key===`Enter`&&(V?J:K)()}}),(0,x.jsx)(m,{size:`sm`,variant:`outline`,disabled:k||i.trim().length===0,onClick:()=>V?J():K(),children:`Go`})]}),(0,x.jsx)(m,{size:`icon-sm`,variant:`outline`,disabled:!V||k,onClick:ne,title:`Screenshot → workspace/screenshots`,children:(0,x.jsx)(v,{})}),(0,x.jsx)(`div`,{className:`flex items-center rounded-md border p-0.5`,children:C.map(({value:e,label:t,icon:n})=>(0,x.jsxs)(m,{size:`sm`,variant:H===e?`secondary`:`ghost`,className:`h-7 gap-1.5 px-2`,disabled:k,onClick:()=>X(e),children:[(0,x.jsx)(n,{className:`size-3.5`}),t]},e))}),V?(0,x.jsxs)(m,{size:`sm`,variant:`outline`,className:`text-destructive hover:text-destructive`,disabled:k,onClick:q,children:[(0,x.jsx)(s,{className:`size-3.5`}),` Stop`]}):(0,x.jsxs)(m,{size:`sm`,disabled:k,onClick:K,children:[(0,x.jsx)(a,{className:`size-3.5`}),` Start`]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,x.jsx)(`span`,{className:c(`inline-block size-2 rounded-full`,V?`bg-emerald-500`:`bg-neutral-300`)}),V?e?.title||e?.url||`Browser running`:`Browser stopped`,U&&V&&(0,x.jsx)(`span`,{className:`rounded bg-primary/10 px-1.5 py-0.5 font-medium text-primary`,children:`You have control — click the page and type`})]}),j&&(0,x.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}),(0,x.jsx)(`div`,{ref:I,className:`flex min-h-0 flex-1 items-center justify-center`,children:(0,x.jsxs)(`div`,{ref:F,style:O?{width:O.w,height:O.h}:void 0,className:c(`group relative flex items-center justify-center overflow-hidden rounded-lg border bg-neutral-950/95 outline-none`,U&&`ring-2 ring-primary/60`),tabIndex:0,onMouseDown:()=>{U&&F.current?.focus()},onKeyDown:e=>$(e,`keyDown`),onKeyUp:e=>$(e,`keyUp`),children:[E?(0,x.jsx)(`img`,{ref:P,src:E,alt:`Browser viewport`,draggable:!1,className:c(`h-full w-full select-none object-contain`,U?`cursor-crosshair`:`cursor-default`),onMouseDown:e=>Q(e,`mousePressed`),onMouseUp:e=>Q(e,`mouseReleased`),onMouseMove:ie,onContextMenu:e=>U&&e.preventDefault(),onWheel:e=>Q(e,`mouseWheel`,{deltaX:e.deltaX,deltaY:e.deltaY})}):(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-sm text-neutral-400`,children:[(0,x.jsx)(f,{className:`size-8`}),V?`Waiting for viewport frames…`:`Start the browser to see the live viewport.`]}),!U&&E&&(0,x.jsx)(`div`,{className:`absolute inset-0 flex items-end justify-center pb-4 opacity-0 transition-opacity group-hover:opacity-100`,children:(0,x.jsxs)(m,{size:`sm`,className:`shadow-lg`,onClick:()=>X(`user`),children:[(0,x.jsx)(y,{className:`size-3.5`}),` Take control`]})})]})})]}),(0,x.jsxs)(`aside`,{className:`flex w-72 shrink-0 flex-col border-l`,children:[(0,x.jsx)(`div`,{className:`border-b px-3 py-2 text-sm font-semibold`,children:`Action log`}),(0,x.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-1 overflow-auto p-2`,children:[n.map(e=>(0,x.jsxs)(`div`,{className:`rounded-md px-2 py-1.5 text-xs hover:bg-muted/60`,children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`font-medium`,children:e.kind}),(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:new Date(e.ts).toLocaleTimeString()})]}),e.detail&&(0,x.jsx)(`div`,{className:`truncate text-muted-foreground`,title:e.detail,children:e.detail})]},e.id)),n.length===0&&(0,x.jsx)(`p`,{className:`px-2 py-4 text-xs text-muted-foreground`,children:`No actions yet. Start the browser or navigate somewhere.`})]})]})]})}export{E as BrowserPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{c as r,n as i}from"./api-DTaM-PBA.js";import{en as a}from"./index-yyhnv7Ap.js";import{t as o}from"./button-C5SbvNQM.js";import{t as s}from"./badge-Czi0QcSt.js";var c=e(t(),1),l=n();function u({className:e,size:t=`default`,...n}){return(0,l.jsx)(`div`,{"data-slot":`card`,"data-size":t,className:r(`group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function d({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-header`,className:r(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3`,e),...t})}function f({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-title`,className:r(`text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function p({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function m({className:e,...t}){return(0,l.jsx)(`div`,{"data-slot":`card-content`,className:r(`px-4 group-data-[size=sm]/card:px-3`,e),...t})}function h(){let[e,t]=(0,c.useState)(null),[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{i(`/api/status`).then(t).catch(()=>{}),i(`/api/runs`).then(({runs:e})=>r(e.filter(e=>[`queued`,`starting`,`running`,`waiting_approval`].includes(e.status)).length)).catch(()=>{})},[]),(0,l.jsxs)(`div`,{className:`page`,children:[(0,l.jsx)(`h1`,{children:`Dashboard`}),(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:[(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Daemon`,(0,l.jsx)(s,{variant:e?`default`:`destructive`,children:e?`online`:`offline`})]}),(0,l.jsx)(p,{children:`Local Jun control plane`})]}),(0,l.jsx)(m,{className:`text-sm text-muted-foreground`,children:e?(0,l.jsxs)(`p`,{className:`truncate`,title:e.workspaceRoot,children:[`up `,e.uptimeSeconds,`s`]}):(0,l.jsx)(`p`,{children:`Waiting for daemon…`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsxs)(f,{className:`flex items-center justify-between`,children:[`Codex runs`,n!==null&&(0,l.jsxs)(s,{variant:n>0?`default`:`secondary`,children:[n,` active`]})]}),(0,l.jsx)(p,{children:`Agent activity in this workspace`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{size:`sm`,render:(0,l.jsx)(a,{to:`/runs`}),children:`Open Runs`})})]}),(0,l.jsxs)(u,{children:[(0,l.jsxs)(d,{children:[(0,l.jsx)(f,{children:`Dynamic widgets`}),(0,l.jsx)(p,{children:`JSON Render widgets arrive in Phase 7 — this grid is their home.`})]}),(0,l.jsx)(m,{children:(0,l.jsx)(o,{variant:`secondary`,size:`sm`,render:(0,l.jsx)(a,{to:`/files`}),children:`Browse workspace`})})]})]})]})}export{h as DashboardPage};
@@ -0,0 +1,64 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{i,n as a,r as o,t as s}from"./collapsible-DBUxLbzP.js";import{a as c,c as l,n as u,o as d,r as f,s as p}from"./api-DTaM-PBA.js";import{Xt as m}from"./index-yyhnv7Ap.js";var h=r(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),g=r(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),_=e(t(),1),v=n(),y=(0,_.createContext)({expandedPaths:new Set,togglePath:()=>{}}),b=({expanded:e,defaultExpanded:t=new Set,selectedPath:n,onSelect:r,onExpandedChange:i,className:a,children:o,...s})=>{let[c,u]=(0,_.useState)(t),d=e??c,f=(0,_.useCallback)(e=>{let t=new Set(d);t.has(e)?t.delete(e):t.add(e),u(t),i?.(t)},[d,i]),p=(0,_.useMemo)(()=>({expandedPaths:d,onSelect:r,selectedPath:n,togglePath:f}),[d,r,n,f]);return(0,v.jsx)(y.Provider,{value:p,children:(0,v.jsx)(`div`,{className:l(`rounded-lg border bg-background font-mono text-sm`,a),role:`tree`,...s,children:(0,v.jsx)(`div`,{className:`p-2`,children:o})})})},x=({className:e,children:t,...n})=>(0,v.jsx)(`span`,{className:l(`shrink-0`,e),...n,children:t}),S=({className:e,children:t,...n})=>(0,v.jsx)(`span`,{className:l(`truncate`,e),...n,children:t}),C=(0,_.createContext)({isExpanded:!1,name:``,path:``}),w=({path:e,name:t,className:n,children:r,...c})=>{let{expandedPaths:u,togglePath:d,selectedPath:f,onSelect:p}=(0,_.useContext)(y),h=u.has(e),b=f===e,w=(0,_.useCallback)(()=>{d(e)},[d,e]),T=(0,_.useCallback)(()=>{p?.(e)},[p,e]),E=(0,_.useMemo)(()=>({isExpanded:h,name:t,path:e}),[h,t,e]);return(0,v.jsx)(C.Provider,{value:E,children:(0,v.jsx)(s,{onOpenChange:w,open:h,children:(0,v.jsxs)(`div`,{className:l(``,n),role:`treeitem`,tabIndex:0,...c,children:[(0,v.jsxs)(`div`,{className:l(`flex w-full items-center gap-1 rounded px-2 py-1 text-left transition-colors hover:bg-muted/50`,b&&`bg-muted`),children:[(0,v.jsx)(o,{className:`flex shrink-0 cursor-pointer items-center border-none bg-transparent p-0`,children:(0,v.jsx)(i,{className:l(`size-4 shrink-0 text-muted-foreground transition-transform`,h&&`rotate-90`)})}),(0,v.jsxs)(`button`,{className:`flex min-w-0 flex-1 cursor-pointer items-center gap-1 border-none bg-transparent p-0 text-left`,onClick:T,type:`button`,children:[(0,v.jsx)(x,{children:h?(0,v.jsx)(m,{className:`size-4`}):(0,v.jsx)(g,{className:`size-4`})}),(0,v.jsx)(S,{children:t})]})]}),(0,v.jsx)(a,{children:(0,v.jsx)(`div`,{className:`ml-4 border-l pl-2`,children:r})})]})})})},T=(0,_.createContext)({name:``,path:``}),E=({path:e,name:t,icon:n,className:r,children:i,...a})=>{let{selectedPath:o,onSelect:s}=(0,_.useContext)(y),c=o===e,u=(0,_.useCallback)(()=>{s?.(e)},[s,e]),d=(0,_.useCallback)(t=>{(t.key===`Enter`||t.key===` `)&&s?.(e)},[s,e]),f=(0,_.useMemo)(()=>({name:t,path:e}),[t,e]);return(0,v.jsx)(T.Provider,{value:f,children:(0,v.jsx)(`div`,{className:l(`flex cursor-pointer items-center gap-1 rounded px-2 py-1 transition-colors hover:bg-muted/50`,c&&`bg-muted`,r),onClick:u,onKeyDown:d,role:`treeitem`,tabIndex:0,...a,children:i??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`span`,{className:`size-4 shrink-0`}),(0,v.jsx)(x,{children:n??(0,v.jsx)(h,{className:`size-4 text-muted-foreground`})}),(0,v.jsx)(S,{children:t})]})})})};function ee({root:e,selectedPath:t,expanded:n,onSelect:r,onToggle:i}){let a=new Map;return D(e,a),(0,v.jsx)(b,{className:`ai-file-tree`,expanded:n,selectedPath:t??void 0,onExpandedChange:e=>{let t=O(n,e);t&&i(t)},onSelect:e=>{let t=a.get(e);t&&r(t)},children:(e.children??[]).map(e=>(0,v.jsx)(te,{node:e},e.path))})}function te({node:e}){return e.type===`dir`?(0,v.jsx)(w,{name:e.name,path:e.path,children:(e.children??[]).map(e=>(0,v.jsx)(te,{node:e},e.path))}):(0,v.jsx)(E,{name:e.name,path:e.path})}function D(e,t){t.set(e.path,e);for(let n of e.children??[])D(n,t)}function O(e,t){for(let n of t)if(!e.has(n))return n;for(let n of e)if(!t.has(n))return n;return null}function k(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var A=k();function ne(e){A=e}var j={exec:()=>null};function M(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function N(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(P.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var re=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),P={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:M(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:M(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:M(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:M(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:M(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:M(e=>RegExp(`^ {0,${e}}>`))},ie=/^(?:[ \t]*(?:\n|$))+/,ae=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oe=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,F=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,se=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ce=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,le=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ue=N(le).replace(/bull/g,ce).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),de=N(le).replace(/bull/g,ce).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),fe=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pe=/^[^\n]+/,me=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,he=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,me).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ge=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ce).getRegex(),I=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,L=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_e=N(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,L).replace(`tag`,I).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ve=N(fe).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,I).getRegex(),R={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ve).getRegex(),code:ae,def:he,fences:oe,heading:se,hr:F,html:_e,lheading:ue,list:ge,newline:ie,paragraph:ve,table:j,text:pe},ye=N(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,I).getRegex(),be={...R,lheading:de,table:ye,paragraph:N(fe).replace(`hr`,F).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ye).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,I).getRegex()},xe={...R,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,L).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:j,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(fe).replace(`hr`,F).replace(`heading`,` *#{1,6} *[^
2
+ ]`).replace(`lheading`,ue).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Se=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ce=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,we=/^( {2,}|\\)\n(?!\s*$)/,Te=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,z=/[\p{P}\p{S}]/u,B=/[\s\p{P}\p{S}]/u,Ee=/[^\s\p{P}\p{S}]/u,De=N(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,B).getRegex(),Oe=/(?!~)[\p{P}\p{S}]/u,ke=/(?!~)[\s\p{P}\p{S}]/u,Ae=/(?:[^\s\p{P}\p{S}]|~)/u,je=N(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,re?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Me=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ne=N(Me,`u`).replace(/punct/g,z).getRegex(),Pe=N(Me,`u`).replace(/punct/g,Oe).getRegex(),Fe=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ie=N(Fe,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,B).replace(/punct/g,z).getRegex(),Le=N(Fe,`gu`).replace(/notPunctSpace/g,Ae).replace(/punctSpace/g,ke).replace(/punct/g,Oe).getRegex(),Re=N(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,B).replace(/punct/g,z).getRegex(),ze=N(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,z).getRegex(),Be=N(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Ee).replace(/punctSpace/g,B).replace(/punct/g,z).getRegex(),Ve=N(/\\(punct)/,`gu`).replace(/punct/g,z).getRegex(),He=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ue=N(L).replace(`(?:-->|$)`,`-->`).getRegex(),We=N(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Ue).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),V=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ge=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,V).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ke=N(/^!?\[(label)\]\[(ref)\]/).replace(`label`,V).replace(`ref`,me).getRegex(),qe=N(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,me).getRegex(),Je=N(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Ke).replace(`nolink`,qe).getRegex(),Ye=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Xe={_backpedal:j,anyPunctuation:Ve,autolink:He,blockSkip:je,br:we,code:Ce,del:j,delLDelim:j,delRDelim:j,emStrongLDelim:Ne,emStrongRDelimAst:Ie,emStrongRDelimUnd:Re,escape:Se,link:Ge,nolink:qe,punctuation:De,reflink:Ke,reflinkSearch:Je,tag:We,text:Te,url:j},Ze={...Xe,link:N(/^!?\[(label)\]\((.*?)\)/).replace(`label`,V).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,V).getRegex()},Qe={...Xe,emStrongRDelimAst:Le,emStrongLDelim:Pe,delLDelim:ze,delRDelim:Be,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ye).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:N(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Ye).getRegex()},$e={...Qe,br:N(we).replace(`{2,}`,`*`).getRegex(),text:N(Qe.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},H={normal:R,gfm:be,pedantic:xe},U={normal:Xe,gfm:Qe,breaks:$e,pedantic:Ze},et={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},tt=e=>et[e];function W(e,t){if(t){if(P.escapeTest.test(e))return e.replace(P.escapeReplace,tt)}else if(P.escapeTestNoEncode.test(e))return e.replace(P.escapeReplaceNoEncode,tt);return e}function nt(e){try{e=encodeURI(e).replace(P.percentDecode,`%`)}catch{return null}return e}function rt(e,t){let n=e.replace(P.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(P.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(P.slashPipe,`|`);return n}function G(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function it(e){let t=e.split(`
3
+ `),n=t.length-1;for(;n>=0&&P.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
+ `)}function at(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function ot(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function st(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function ct(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
6
+ `)}var K=class{options;rules;lexer;constructor(e){this.options=e||A}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:it(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ct(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=G(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:G(t[0],`
7
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:G(t[0],`
8
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=G(t[0],`
9
+ `).split(`
10
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
12
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
+ ${s}`:s,r=r?`${r}
14
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
15
+ `+e.join(`
16
+ `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
17
+ `+e.join(`
18
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
19
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=ot(t[2].split(`
20
+ `,1)[0],t[1].length),l=e.split(`
21
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
22
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
23
+ `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
24
+ `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
25
+ `+l}u=!l.trim(),r+=p+`
26
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=it(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:G(t[0],`
27
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=rt(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
28
+ `):[],a={type:`table`,raw:G(t[0],`
29
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(rt(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:G(t[0],`
30
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
31
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=G(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=at(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),st(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return st(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},q=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||A,this.options.tokenizer=this.options.tokenizer||new K,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:P,block:H.normal,inline:U.normal};this.options.pedantic?(t.block=H.pedantic,t.inline=U.pedantic):this.options.gfm&&(t.block=H.gfm,this.options.breaks?t.inline=U.breaks:t.inline=U.gfm),this.tokenizer.rules=t}static get rules(){return{block:H,inline:U}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(P.carriageReturn,`
32
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(P.tabCharGlobal,` `).replace(P.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
33
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
34
+ `)?``:`
35
+ `)+i.raw,n.text+=`
36
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
37
+ `)?``:`
38
+ `)+i.raw,n.text+=`
39
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
40
+ `)?``:`
41
+ `)+i.raw,r.text+=`
42
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
43
+ `)?``:`
44
+ `)+i.raw,n.text+=`
45
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``,s=1/0;for(;e;){if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},J=class{options;parser;constructor(e){this.options=e||A}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(P.notSpaceStart)?.[0],i=e.replace(P.endingNewline,``)+`
46
+ `;return r?`<pre><code class="language-`+W(r)+`">`+(n?i:W(i,!0))+`</code></pre>
47
+ `:`<pre><code>`+(n?i:W(i,!0))+`</code></pre>
48
+ `}blockquote({tokens:e}){return`<blockquote>
49
+ ${this.parser.parse(e)}</blockquote>
50
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
51
+ `}hr(e){return`<hr>
52
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
53
+ `+r+`</`+i+`>
54
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
55
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
56
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
57
+ <thead>
58
+ `+t+`</thead>
59
+ `+r+`</table>
60
+ `}tablerow({text:e}){return`<tr>
61
+ ${e}</tr>
62
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
63
+ `}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>${W(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=nt(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+W(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=nt(e);if(i===null)return W(n);e=i;let a=`<img src="${e}" alt="${W(n)}"`;return t&&(a+=` title="${W(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:W(e.text)}},Y=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},X=class e{options;renderer;textRenderer;constructor(e){this.options=e||A,this.options.renderer=this.options.renderer||new J,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Y}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`,`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`,`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}},Z=class{options;block;constructor(e){this.options=e||A}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?q.lex:q.lexInline}provideParser(e=this.block){return e?X.parse:X.parseInline}},Q=new class{defaults=k();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=X;Renderer=J;TextRenderer=Y;Lexer=q;Tokenizer=K;Hooks=Z;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(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);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};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 J(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||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new K(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 Z;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];Z.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Z.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)}:t[r]=(...e)=>{if(this.defaults.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 n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return q.lex(e,t??this.defaults)}parser(e,t){return X.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?q.lex:q.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?X.parse:X.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?q.lex:q.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?X.parse:X.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+=`
64
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+W(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,ne($.defaults),$},$.getDefaults=k,$.defaults=A,$.use=function(...e){return Q.use(...e),$.defaults=Q.defaults,ne($.defaults),$},$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=X,$.parser=X.parse,$.Renderer=J,$.TextRenderer=Y,$.Lexer=q,$.lexer=q.lex,$.Tokenizer=K,$.Hooks=Z,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,X.parse,q.lex;function lt({file:e}){return e.kind===`image`?(0,v.jsx)(`div`,{className:`preview-pane`,children:(0,v.jsx)(`img`,{className:`preview-image`,src:d(e.path),alt:e.path})}):e.kind===`binary`?(0,v.jsx)(`div`,{className:`preview-pane`,children:(0,v.jsxs)(`p`,{className:`page-hint`,children:[`Binary file (`,e.size,` bytes).`,` `,(0,v.jsx)(`a`,{href:d(e.path),children:`Download`})]})}):e.kind===`markdown`?(0,v.jsx)(ut,{content:e.content??``}):e.kind===`json`?(0,v.jsx)(dt,{content:e.content??``}):(0,v.jsx)(`div`,{className:`preview-pane`,children:(0,v.jsx)(`pre`,{className:`code-block`,children:e.content??``})})}function ut({content:e}){return(0,v.jsx)(`div`,{className:`preview-pane markdown-body`,dangerouslySetInnerHTML:{__html:(0,_.useMemo)(()=>$.parse(e,{async:!1}),[e])}})}function dt({content:e}){return(0,v.jsx)(`div`,{className:`preview-pane`,children:(0,v.jsx)(`pre`,{className:`code-block`,children:(0,_.useMemo)(()=>{try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}},[e])})})}function ft(){let[e,t]=(0,_.useState)(null),[n,r]=(0,_.useState)(new Set),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(null),[l,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(!1),[y,b]=(0,_.useState)(`edit`),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useRef)(null),E=(0,_.useCallback)(async()=>{try{t(await u(`/api/files/tree`)),S(null)}catch(e){S(e instanceof Error?e.message:String(e))}},[]);(0,_.useEffect)(()=>{E()},[E]),(0,_.useEffect)(()=>{let e=p(`/api/files/watch`),t=null;return e.onmessage=()=>{t&&clearTimeout(t),t=setTimeout(E,400)},()=>{t&&clearTimeout(t),e.close()}},[E]);let te=(0,_.useCallback)(async e=>{if(a(e),w(null),e.type!==`file`){s(null);return}try{let t=await u(`/api/files/read?path=${encodeURIComponent(e.path)}`);s(t),m(t.content??``),g(!1),b(t.kind===`markdown`||t.kind===`json`?`preview`:`edit`),S(null)}catch(e){s(null),S(e instanceof Error?e.message:String(e))}},[]),D=(0,_.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),O=()=>{if(!i)return`.`;if(i.type===`dir`)return i.path;let e=i.path.lastIndexOf(`/`);return e===-1?`.`:i.path.slice(0,e)},k=async(e,t)=>{try{await e(),S(null),t&&w(t),await E()}catch(e){S(e instanceof Error?e.message:String(e))}},A=()=>{let e=window.prompt(`New file name (relative to selected folder):`);if(!e)return;let t=pt(O(),e);k(()=>f(`/api/files/write`,{path:t,content:``}),`Created ${t}`)},ne=()=>{let e=window.prompt(`New folder name:`);if(!e)return;let t=pt(O(),e);k(()=>f(`/api/files/mkdir`,{path:t}),`Created ${t}/`)},j=()=>{if(!i)return;let e=window.prompt(`New path:`,i.path);if(!e||e===i.path)return;let t=i.path;k(async()=>{await f(`/api/files/rename`,{from:t,to:e}),a(null),s(null)},`Renamed to ${e}`)},M=()=>{if(!i||!window.confirm(`Delete ${i.path}? This cannot be undone.`))return;let e=i.path;k(async()=>{await f(`/api/files/delete`,{path:e}),a(null),s(null)},`Deleted ${e}`)},N=e=>{if(!e||e.length===0)return;let t=new FormData;t.set(`path`,O());for(let n of Array.from(e))t.append(`file`,n);k(()=>c(`/api/files/upload`,t),`Uploaded ${e.length} file(s)`)},re=()=>{o&&k(async()=>{await f(`/api/files/write`,{path:o.path,content:l}),s({...o,content:l}),g(!1)},`Saved ${o.path}`)},P=o&&o.kind!==`image`&&o.kind!==`binary`;return(0,v.jsxs)(`div`,{className:`files-page`,children:[(0,v.jsxs)(`aside`,{className:`files-sidebar`,children:[(0,v.jsxs)(`div`,{className:`files-toolbar`,children:[(0,v.jsx)(`button`,{onClick:A,children:`+ File`}),(0,v.jsx)(`button`,{onClick:ne,children:`+ Folder`}),(0,v.jsx)(`button`,{onClick:()=>T.current?.click(),children:`Upload`}),(0,v.jsx)(`button`,{onClick:E,children:`Refresh`}),(0,v.jsx)(`input`,{ref:T,type:`file`,multiple:!0,hidden:!0,onChange:e=>{N(e.target.files),e.target.value=``}})]}),e?(0,v.jsx)(ee,{root:e,selectedPath:i?.path??null,expanded:n,onSelect:te,onToggle:D}):(0,v.jsx)(`p`,{className:`page-hint`,children:`Loading workspace…`})]}),(0,v.jsxs)(`section`,{className:`files-content`,children:[x&&(0,v.jsx)(`div`,{className:`banner error`,children:x}),C&&!x&&(0,v.jsx)(`div`,{className:`banner notice`,children:C}),i?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`files-header`,children:[(0,v.jsxs)(`span`,{className:`files-path`,title:i.path,children:[i.path,h?` •`:``]}),(0,v.jsxs)(`div`,{className:`files-actions`,children:[P&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`button`,{className:y===`edit`?`active`:``,onClick:()=>b(`edit`),children:`Edit`}),(0,v.jsx)(`button`,{className:y===`preview`?`active`:``,onClick:()=>b(`preview`),children:`Preview`}),(0,v.jsx)(`button`,{disabled:!h,onClick:re,children:`Save`})]}),i.type===`file`&&(0,v.jsx)(`a`,{className:`button-link`,href:d(i.path),children:`Download`}),(0,v.jsx)(`button`,{onClick:j,children:`Rename`}),(0,v.jsx)(`button`,{className:`danger`,onClick:M,children:`Delete`})]})]}),i.type===`dir`?(0,v.jsx)(`p`,{className:`page-hint`,children:`Folder selected. New files, folders, and uploads land here.`}):o?y===`edit`&&P?(0,v.jsx)(`textarea`,{className:`file-editor`,value:l,spellCheck:!1,onChange:e=>{m(e.target.value),g(!0)}}):(0,v.jsx)(lt,{file:h?{...o,content:l}:o}):(0,v.jsx)(`p`,{className:`page-hint`,children:`Loading file…`})]}):(0,v.jsx)(`p`,{className:`page-hint`,children:`Select a file from the workspace tree to view or edit it.`})]})]})}function pt(e,t){let n=t.replace(/^[/\\]+/,``);return e===`.`?n:`${e}/${n}`}export{ft as FilesPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t}from"./bundle-mjs-DssaXR6m.js";import{x as n}from"./useBaseUiId-DL38u1cQ.js";import{y as r}from"./api-DTaM-PBA.js";var i=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),a=e(t()),o=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:r,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function s(){return a.useContext(o)}export{i as n,s as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{t as i}from"./pause-DhMeMeEd.js";import{t as a}from"./play-D3mjFMmX.js";import{t as o}from"./trash-2-D5W0vize.js";import{n as s,s as c}from"./api-DTaM-PBA.js";import{t as l}from"./button-C5SbvNQM.js";import{t as u}from"./input-CzAFDIdf.js";var d=r(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),f=e(t(),1),p=n(),m=2e3,h=[{key:`all`,label:`All`},{key:`warn`,label:`Warnings`},{key:`error`,label:`Errors`}],g={info:0,warn:1,error:2},_={info:`var(--muted-foreground)`,warn:`oklch(0.62 0.17 75)`,error:`oklch(0.58 0.22 27)`};function v(){let[e,t]=(0,f.useState)([]),[n,r]=(0,f.useState)(`all`),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(!0),[S,C]=(0,f.useState)(!1),w=(0,f.useRef)(null),T=(0,f.useRef)(null);(0,f.useEffect)(()=>{let e=!0,n=null,r=null;s(`/api/logs?limit=1000`).then(n=>e&&t(n.logs)).catch(()=>{});let i=()=>{n=c(`/api/logs/stream`),n.onopen=()=>e&&C(!0),n.onclose=()=>{e&&(C(!1),r=setTimeout(i,1500))},n.onmessage=e=>{try{let n=JSON.parse(e.data);t(e=>{if(e.length&&e[e.length-1].seq>=n.seq)return e;let t=[...e,n];return t.length>m?t.slice(-2e3):t})}catch{}}};return i(),()=>{e=!1,r&&clearTimeout(r),n?.close()}},[]);let E=(0,f.useMemo)(()=>{let t=n===`all`?0:g[n],r=v.trim().toLowerCase();return e.filter(e=>g[e.level]>=t&&(!r||e.text.toLowerCase().includes(r)))},[e,n,v]);return(0,f.useEffect)(()=>{b&&w.current?.scrollIntoView({block:`end`})},[E,b]),(0,p.jsxs)(`div`,{className:`flex h-full flex-col gap-3 p-6`,children:[(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,p.jsx)(`h1`,{className:`mr-2 text-lg font-semibold`,children:`Logs`}),(0,p.jsx)(`div`,{className:`flex items-center gap-1 rounded-md border p-0.5`,style:{borderColor:`var(--border)`},children:h.map(e=>(0,p.jsx)(`button`,{onClick:()=>r(e.key),className:`rounded px-2 py-1 text-xs`,style:{background:n===e.key?`var(--primary)`:`transparent`,color:n===e.key?`var(--primary-foreground)`:`var(--muted-foreground)`},children:e.label},e.key))}),(0,p.jsx)(u,{value:v,onChange:e=>y(e.target.value),placeholder:`Filter…`,className:`h-8 w-48`}),(0,p.jsxs)(`span`,{className:`ml-auto flex items-center gap-1.5 text-xs`,style:{color:`var(--muted-foreground)`},children:[(0,p.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:S?`oklch(0.7 0.17 145)`:`var(--muted-foreground)`}}),S?`live`:`reconnecting…`,` · `,E.length,` lines`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>x(e=>!e),children:[b?(0,p.jsx)(i,{className:`size-4`}):(0,p.jsx)(a,{className:`size-4`}),b?`Pause scroll`:`Resume`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>{w.current?.scrollIntoView({block:`end`}),x(!0)},children:[(0,p.jsx)(d,{className:`size-4`}),` Bottom`]}),(0,p.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>t([]),children:[(0,p.jsx)(o,{className:`size-4`}),` Clear`]})]}),(0,p.jsx)(`div`,{ref:T,onScroll:()=>{let e=T.current;e&&x(e.scrollHeight-e.scrollTop-e.clientHeight<40)},className:`min-h-0 flex-1 overflow-auto rounded-md border font-mono text-xs leading-relaxed`,style:{borderColor:`var(--border)`,background:`var(--card)`},children:E.length===0?(0,p.jsxs)(`div`,{className:`p-4`,style:{color:`var(--muted-foreground)`},children:[`No log lines`,v||n!==`all`?` match the filter`:` yet`,`.`]}):(0,p.jsxs)(`div`,{className:`p-2`,children:[E.map(e=>(0,p.jsxs)(`div`,{className:`flex gap-2 whitespace-pre-wrap break-words px-1 py-0.5`,children:[(0,p.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.ts.slice(11,23)}),(0,p.jsx)(`span`,{style:{color:_[e.level],minWidth:`2.6rem`},children:e.level}),(0,p.jsx)(`span`,{style:{color:e.level===`error`?_.error:`var(--foreground)`},children:e.text})]},e.seq)),(0,p.jsx)(`div`,{ref:w})]})})]})}export{v as LogsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{x as r}from"./useBaseUiId-DL38u1cQ.js";import{i,n as a,r as o,t as s}from"./collapsible-DBUxLbzP.js";import{t as c}from"./circle-x-CAsSuVme.js";import{t as l}from"./key-round-i_iJarVP.js";import{a as u,i as d,n as f,r as p,t as m}from"./tabs-grE19_AL.js";import{E as h}from"./useCompositeListItem-I_fNdF1_.js";import{t as g}from"./rotate-cw-BUTALXBe.js";import{t as _}from"./trash-2-D5W0vize.js";import{a as v,i as y,o as b,r as x,s as S,t as C}from"./dialog-DNn7-a_m.js";import{c as w,i as T,n as E,r as D,t as O}from"./api-DTaM-PBA.js";import{qt as k}from"./index-yyhnv7Ap.js";import{t as A}from"./button-C5SbvNQM.js";import{t as j}from"./input-CzAFDIdf.js";import{t as M}from"./badge-Czi0QcSt.js";import{t as N}from"./label-Bu19spuB.js";import{t as P}from"./textarea-CwL3B5t5.js";var F=r(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),I=r(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),L=e(t(),1),R=n();function z({server:e}){if(!e.enabled)return(0,R.jsx)(M,{variant:`outline`,children:`disabled`});switch(e.startupState){case`ready`:return(0,R.jsxs)(M,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(F,{className:`size-3 text-emerald-600`}),` ready`]});case`starting`:return(0,R.jsxs)(M,{variant:`secondary`,className:`gap-1`,children:[(0,R.jsx)(u,{className:`size-3 animate-spin`}),` starting`]});case`failed`:case`cancelled`:return(0,R.jsxs)(M,{variant:`outline`,className:`gap-1 text-destructive`,children:[(0,R.jsx)(c,{className:`size-3`}),` `,e.startupState]});default:return(0,R.jsxs)(M,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(I,{className:`size-3`}),` not connected`]})}}function B(){let[e,t]=(0,L.useState)([]),[n,r]=(0,L.useState)(``),[c,u]=(0,L.useState)(!1),[v,y]=(0,L.useState)(null),[b,x]=(0,L.useState)(!1),[S,C]=(0,L.useState)(null),[j,N]=(0,L.useState)(!1),F=(0,L.useCallback)(async()=>{try{let[{servers:e},{toml:n}]=await Promise.all([E(`/api/mcp`),E(`/api/mcp/config`)]);t(e),c||r(n),y(null)}catch(e){y(e instanceof Error?e.message:String(e))}},[c]);(0,L.useEffect)(()=>{F()},[F]);let I=(0,L.useCallback)(async e=>{x(!0),y(null);try{await e(),await F()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}},[F]),B=()=>I(()=>D(`/api/mcp/reload`)),H=()=>I(async()=>{await T(`/api/mcp/config`,{toml:n}),u(!1),await D(`/api/mcp/reload`)}),U=e=>I(async()=>{await D(`/api/mcp/servers/${e.name}/enable`,{enabled:!e.enabled}),await D(`/api/mcp/reload`)}),W=e=>I(async()=>{window.confirm(`Remove MCP server "${e}"?`)&&(await O(`/api/mcp/servers/${e}`),await D(`/api/mcp/reload`))});return(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`h1`,{className:`text-base font-semibold`,children:`MCP servers`}),(0,R.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,R.jsxs)(A,{size:`sm`,variant:`outline`,onClick:B,disabled:b,children:[(0,R.jsx)(g,{className:`size-3.5`}),` Reload`]}),(0,R.jsxs)(A,{size:`sm`,onClick:()=>N(!0),disabled:b,children:[(0,R.jsx)(h,{className:`size-3.5`}),` Add server`]})]})]}),v&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:v}),(0,R.jsxs)(m,{defaultValue:`servers`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(p,{children:[(0,R.jsx)(d,{value:`servers`,children:`Servers`}),(0,R.jsx)(d,{value:`toml`,children:`config.toml`})]}),(0,R.jsx)(f,{value:`servers`,className:`min-h-0 flex-1 overflow-auto pt-2`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.map(e=>(0,R.jsx)(`div`,{className:`rounded-lg border bg-card`,children:(0,R.jsxs)(s,{open:S===e.name,onOpenChange:t=>C(t?e.name:null),children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(k,{className:`size-4 shrink-0 text-muted-foreground`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,R.jsx)(z,{server:e}),e.tools.length>0&&(0,R.jsxs)(M,{variant:`outline`,children:[e.tools.length,` tools`]}),e.authStatus===`notLoggedIn`&&(0,R.jsxs)(M,{variant:`outline`,className:`gap-1`,children:[(0,R.jsx)(l,{className:`size-3`}),` login required`]})]}),(0,R.jsx)(`code`,{className:`block truncate text-xs text-muted-foreground`,children:e.url??[e.command,...e.args??[]].join(` `)}),e.envKeys&&e.envKeys.length>0&&(0,R.jsxs)(`div`,{className:`text-xs text-muted-foreground/70`,children:[`env: `,e.envKeys.map(e=>`${e}=••••`).join(` `)]})]}),(0,R.jsx)(A,{size:`sm`,variant:`outline`,onClick:()=>U(e),disabled:b,children:e.enabled?`Disable`:`Enable`}),(0,R.jsx)(A,{size:`icon-sm`,variant:`ghost`,className:`text-destructive hover:text-destructive`,onClick:()=>W(e.name),disabled:b,children:(0,R.jsx)(_,{})}),e.tools.length>0&&(0,R.jsx)(o,{className:`flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted`,children:(0,R.jsx)(i,{className:w(`size-4 transition-transform`,S===e.name&&`rotate-90`)})})]}),(0,R.jsx)(a,{children:(0,R.jsx)(`div`,{className:`grid gap-1 border-t p-3 sm:grid-cols-2`,children:e.tools.map(e=>(0,R.jsxs)(`div`,{className:`rounded-md bg-muted/40 px-2 py-1.5`,children:[(0,R.jsx)(`code`,{className:`text-xs font-medium`,children:e.name}),e.description&&(0,R.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,title:e.description,children:e.description})]},e.name))})})]})},e.name)),e.length===0&&(0,R.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-12 text-center text-sm text-muted-foreground`,children:[(0,R.jsx)(k,{className:`size-8`}),`No MCP servers configured. Add one to give Codex extra tools.`]})]})}),(0,R.jsxs)(f,{value:`toml`,className:`flex min-h-0 flex-1 flex-col gap-2 pt-2`,children:[(0,R.jsx)(P,{value:n,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{r(e.target.value),u(!0)}}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(A,{size:`sm`,onClick:H,disabled:!c||b,children:b?`Saving…`:`Save & reload`}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Editing here preserves your comments; structured edits reformat the file.`})]})]})]}),(0,R.jsx)(V,{open:j,onOpenChange:N,onAdded:()=>I(()=>D(`/api/mcp/reload`))})]})}function V({open:e,onOpenChange:t,onAdded:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(``),[s,c]=(0,L.useState)(``),[l,u]=(0,L.useState)(``),[d,f]=(0,L.useState)(null),[p,m]=(0,L.useState)(!1);return(0,R.jsx)(C,{open:e,onOpenChange:t,children:(0,R.jsxs)(x,{children:[(0,R.jsxs)(b,{children:[(0,R.jsx)(S,{children:`Add MCP server`}),(0,R.jsxs)(y,{children:[`A stdio command server (e.g. `,(0,R.jsx)(`code`,{children:`npx -y @scope/pkg`}),`). For URL or advanced transports, use the config.toml tab.`]})]}),d&&(0,R.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:d}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-name`,children:`Name`}),(0,R.jsx)(j,{id:`mcp-name`,value:r,placeholder:`context7`,onChange:e=>i(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-command`,children:`Command`}),(0,R.jsx)(j,{id:`mcp-command`,value:a,placeholder:`npx`,onChange:e=>o(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-args`,children:`Args (space-separated)`}),(0,R.jsx)(j,{id:`mcp-args`,value:s,placeholder:`-y @upstash/context7-mcp`,onChange:e=>c(e.target.value)})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(N,{htmlFor:`mcp-env`,children:`Env (KEY=value per line)`}),(0,R.jsx)(P,{id:`mcp-env`,value:l,rows:3,placeholder:`API_KEY=sk-…`,onChange:e=>u(e.target.value)})]})]}),(0,R.jsxs)(v,{children:[(0,R.jsx)(A,{variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,R.jsx)(A,{onClick:async()=>{m(!0),f(null);try{let e={};for(let t of l.split(/\r?\n/)){let n=t.indexOf(`=`);n>0&&(e[t.slice(0,n).trim()]=t.slice(n+1).trim())}await D(`/api/mcp/servers`,{name:r.trim(),command:a.trim()||void 0,args:s.trim()?s.trim().split(/\s+/):void 0,env:Object.keys(e).length>0?e:void 0}),t(!1),i(``),o(``),c(``),u(``),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{m(!1)}},disabled:p||r.trim().length===0||a.trim().length===0,children:p?`Adding…`:`Add & reload`})]})]})})}export{B as McpPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{t as r}from"./checkbox-CvgOimO2.js";import{t as i}from"./rotate-cw-BUTALXBe.js";import{t as a}from"./trash-2-D5W0vize.js";import{c as o,i as s,n as c,t as l}from"./api-DTaM-PBA.js";import{Qt as u}from"./index-yyhnv7Ap.js";import{t as d}from"./button-C5SbvNQM.js";import{t as f}from"./input-CzAFDIdf.js";import{t as p}from"./badge-Czi0QcSt.js";import{t as m}from"./label-Bu19spuB.js";import{t as h}from"./textarea-CwL3B5t5.js";var g=e(t(),1),_=n();function v(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function y(){let[e,t]=(0,g.useState)(null),[n,y]=(0,g.useState)(null),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),[w,T]=(0,g.useState)(``),[E,D]=(0,g.useState)(!1),[O,k]=(0,g.useState)(``),A=(0,g.useCallback)(async()=>{try{let e=await c(`/api/memories`);t(e),k(e.settings.minRateLimitRemainingPercent===void 0?``:String(e.settings.minRateLimitRemainingPercent)),y(null)}catch(e){y(e instanceof Error?e.message:String(e))}},[]);(0,g.useEffect)(()=>{A()},[A]);let j=(0,g.useCallback)(async e=>{x(!0),y(null);try{await e(),await A()}catch(e){y(e instanceof Error?e.message:String(e))}finally{x(!1)}},[A]),M=()=>j(()=>s(`/api/memories/config`,{enabled:!e?.enabled})),N=e=>j(()=>s(`/api/memories/config`,{settings:e})),P=()=>{let e=Number(O);if(!Number.isFinite(e)||e<0||e>100){y(`Rate-limit threshold must be a number between 0 and 100`);return}N({minRateLimitRemainingPercent:e})},F=e=>j(async()=>{let t=await c(`/api/memories/file?path=${encodeURIComponent(e.path)}`);C(t.path),T(t.content),D(!1)}),I=()=>j(async()=>{S&&(await s(`/api/memories/file`,{path:S,content:w}),D(!1))}),L=e=>j(async()=>{window.confirm(`Delete memory file "${e}"?`)&&(await l(`/api/memories/file?path=${encodeURIComponent(e)}`),S===e&&(C(null),T(``),D(!1)))}),R=e?.enabled??!1,z=e?.settings??{},B=e?.files??[];return(0,_.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3 p-4`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`h1`,{className:`text-base font-semibold`,children:`Memories`}),(0,_.jsx)(p,{variant:`outline`,children:`beta`}),e&&e.liveEnabled!==null&&e.liveEnabled!==R&&(0,_.jsx)(p,{variant:`outline`,className:`text-amber-600`,children:`engine state differs — restart pending`}),(0,_.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,_.jsxs)(d,{size:`sm`,variant:`outline`,onClick:()=>A(),disabled:b,children:[(0,_.jsx)(i,{className:`size-3.5`}),` Refresh`]}),(0,_.jsx)(d,{size:`sm`,onClick:M,disabled:b||!e,children:R?`Disable`:`Enable`})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Codex turns useful context from past sessions into local memory files and brings them into new conversations. Memories are global across workspaces (they live in the shared Codex home) and are generated in the background — new files can take a while to appear.`}),n&&(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:n}),(0,_.jsxs)(`div`,{className:o(`flex flex-col gap-3`,!R&&`opacity-60`),children:[(0,_.jsxs)(`div`,{className:`rounded-lg border bg-card p-3`,children:[(0,_.jsx)(`div`,{className:`mb-2 text-sm font-medium`,children:`Behavior`}),(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(r,{checked:z.generateMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({generateMemories:e===!0})}),`Generate memories from new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(r,{checked:z.useMemories!==!1,disabled:b||!R,onCheckedChange:e=>N({useMemories:e===!0})}),`Use existing memories in new sessions`]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(r,{checked:z.disableOnExternalContext===!0,disabled:b||!R,onCheckedChange:e=>N({disableOnExternalContext:e===!0})}),`Skip sessions that used external context (MCP tools, web search)`]}),(0,_.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(m,{htmlFor:`mem-rate`,className:`font-normal`,children:`Pause generation below`}),(0,_.jsx)(f,{id:`mem-rate`,type:`number`,min:0,max:100,placeholder:`25`,className:`h-7 w-20`,value:O,disabled:b||!R,onChange:e=>k(e.target.value),onBlur:()=>{O!==``&&P()},onKeyDown:e=>{e.key===`Enter`&&O!==``&&P()}}),(0,_.jsx)(`span`,{className:`text-muted-foreground`,children:`% rate limit remaining`})]})]}),(0,_.jsx)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:`Behavior settings are read by the engine at startup; the on/off toggle applies immediately.`})]}),(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-3`,children:[(0,_.jsxs)(`div`,{className:`flex w-72 shrink-0 flex-col gap-1 overflow-auto`,children:[(0,_.jsxs)(`div`,{className:`text-sm font-medium`,children:[`Memory files`,B.length>0&&` (${B.length})`]}),B.map(e=>(0,_.jsxs)(`div`,{className:o(`group flex cursor-pointer items-center gap-2 rounded-md border px-2 py-1.5`,S===e.path?`border-foreground/30 bg-muted/60`:`bg-card hover:bg-muted/40`),onClick:()=>F(e),children:[(0,_.jsx)(u,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`div`,{className:`truncate text-sm`,title:e.path,children:e.path}),(0,_.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[v(e.size),` · `,new Date(e.modifiedAt).toLocaleString()]})]}),(0,_.jsx)(d,{size:`icon-sm`,variant:`ghost`,className:`invisible text-destructive hover:text-destructive group-hover:visible`,disabled:b,onClick:t=>{t.stopPropagation(),L(e.path)},children:(0,_.jsx)(a,{})})]},e.path)),B.length===0&&(0,_.jsxs)(`div`,{className:`flex flex-col items-center gap-2 px-4 py-10 text-center text-sm text-muted-foreground`,children:[(0,_.jsx)(u,{className:`size-8`}),R?`No memories yet. Codex builds them in the background from finished sessions.`:`Enable memories to let Codex remember context across sessions.`]})]}),(0,_.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2`,children:S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,_.jsx)(`code`,{className:`truncate text-xs text-muted-foreground`,children:S}),(0,_.jsx)(d,{size:`sm`,className:`ml-auto`,onClick:I,disabled:!E||b,children:b?`Saving…`:`Save`})]}),(0,_.jsx)(h,{value:w,spellCheck:!1,className:`min-h-0 flex-1 resize-none font-mono text-sm`,onChange:e=>{T(e.target.value),D(!0)}})]}):(0,_.jsx)(`div`,{className:`flex flex-1 items-center justify-center rounded-lg border border-dashed text-sm text-muted-foreground`,children:`Select a memory file to inspect or edit it`})})]})]})]})}export{y as MemoriesPage};