@hienlh/ppm 0.13.78 → 0.13.80

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 (84) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/assets/skills/ppm/SKILL.md +1 -1
  3. package/assets/skills/ppm/references/http-api.md +1 -1
  4. package/dist/web/assets/{api-settings-BJTjIG4U.js → api-settings-CQWMP6tw.js} +1 -1
  5. package/dist/web/assets/architecture-PBZL5I3N-zg_XUpAf.js +1 -0
  6. package/dist/web/assets/{audio-preview-DFrv27cv.js → audio-preview-BnX8NIsE.js} +1 -1
  7. package/dist/web/assets/chat-tab-BUirKQ4S.js +16 -0
  8. package/dist/web/assets/code-editor-D2pokrVT.js +10 -0
  9. package/dist/web/assets/{conflict-editor-DGm0Z6Mc.js → conflict-editor-Cb0fYF_-.js} +1 -1
  10. package/dist/web/assets/{csv-preview-asMfgR0r.js → csv-preview-DqoFTfkO.js} +1 -1
  11. package/dist/web/assets/{data-grid-overlay-editor-DGjqvYn6.js → data-grid-overlay-editor-DZGHoBdv.js} +1 -1
  12. package/dist/web/assets/{database-viewer-D1nO6a11.js → database-viewer-DecyPfgQ.js} +1 -1
  13. package/dist/web/assets/diff-viewer-B4g62Spc.js +4 -0
  14. package/dist/web/assets/{docx-preview-BRpopR6E.js → docx-preview-DkHLPuP6.js} +1 -1
  15. package/dist/web/assets/{esm-xVTUq__o.js → esm-A3ZetkGj.js} +1 -1
  16. package/dist/web/assets/{extension-webview-BXeDxyVt.js → extension-webview-uY-shXbu.js} +1 -1
  17. package/dist/web/assets/{git-log-panel-B5n35kot.js → git-log-panel-B01kljlC.js} +1 -1
  18. package/dist/web/assets/gitGraph-HDMCJU4V-CAfOBCyo.js +1 -0
  19. package/dist/web/assets/{glide-data-grid-4mwS1Swl.js → glide-data-grid-C6pJGtR4.js} +7 -7
  20. package/dist/web/assets/{image-preview-Bu5XcdqW.js → image-preview-ptN8ieUy.js} +1 -1
  21. package/dist/web/assets/{index-CuOntRL_.js → index-BGYnwVhe.js} +15 -15
  22. package/dist/web/assets/index-DXxsPKPw.css +2 -0
  23. package/dist/web/assets/info-3K5VOQVL-CevMMhkM.js +1 -0
  24. package/dist/web/assets/{input-CArJe9WS.js → input-BDYfKz0A.js} +1 -1
  25. package/dist/web/assets/keybindings-store-Cw3Lglzq.js +1 -0
  26. package/dist/web/assets/{markdown-renderer-Be-gcsCi.js → markdown-renderer-Bcv82eST.js} +3 -3
  27. package/dist/web/assets/notification-store-Bx4JtvpX.js +1 -0
  28. package/dist/web/assets/{number-overlay-editor-DtUBprPW.js → number-overlay-editor-DSno9uQL.js} +1 -1
  29. package/dist/web/assets/packet-RMMSAZCW-CBPKYQg3.js +1 -0
  30. package/dist/web/assets/{panel-store-C9VAhbZz.js → panel-store-BETELS-N.js} +1 -1
  31. package/dist/web/assets/{pdf-preview-hiA6Dkic.js → pdf-preview-BmeAT0uQ.js} +1 -1
  32. package/dist/web/assets/pie-UPGHQEXC-BA4yGjJM.js +1 -0
  33. package/dist/web/assets/{port-forwarding-tab-DTPLT4nk.js → port-forwarding-tab-7Kf5w4YY.js} +1 -1
  34. package/dist/web/assets/{postgres-viewer-LimIiFby.js → postgres-viewer-FCmpTue5.js} +3 -3
  35. package/dist/web/assets/{project-store-DlbHpIq0.js → project-store-Byuc-f31.js} +1 -1
  36. package/dist/web/assets/radar-KQ55EAFF-0aJoWjiU.js +1 -0
  37. package/dist/web/assets/settings-store-BL2a9FtJ.js +2 -0
  38. package/dist/web/assets/settings-tab-CikbBtzb.js +1 -0
  39. package/dist/web/assets/{sql-query-editor-DGcroNAs.js → sql-query-editor-BjQxcBDR.js} +1 -1
  40. package/dist/web/assets/{sqlite-viewer-DIfCI2va.js → sqlite-viewer-KXkg83Jr.js} +1 -1
  41. package/dist/web/assets/{system-monitor-tab-CIVm3sgY.js → system-monitor-tab-CTZjF0H0.js} +1 -1
  42. package/dist/web/assets/{tab-store-CIcbSn0c.js → tab-store-B_Kf29se.js} +1 -1
  43. package/dist/web/assets/{terminal-tab-Dj9xDdbc.js → terminal-tab-B_Y_f0sq.js} +2 -2
  44. package/dist/web/assets/treemap-KZPCXAKY-C2M84arV.js +1 -0
  45. package/dist/web/assets/{use-blob-url-DrPfBQBM.js → use-blob-url-BiQjyxOy.js} +1 -1
  46. package/dist/web/assets/{use-monaco-theme-BLIgarH5.js → use-monaco-theme-B9wG8s0C.js} +1 -1
  47. package/dist/web/assets/{vendor-mermaid-DkqjpqJK.js → vendor-mermaid-Bfbv_YGB.js} +2 -2
  48. package/dist/web/assets/{video-preview-CnRJmbG8.js → video-preview-CRIWCfhS.js} +1 -1
  49. package/dist/web/index.html +13 -13
  50. package/dist/web/sw.js +1 -1
  51. package/package.json +1 -1
  52. package/src/services/cloud-ws.service.ts +3 -2
  53. package/src/services/db.service.ts +0 -8
  54. package/src/web/components/layout/tab-bar.tsx +37 -16
  55. package/src/web/components/settings/settings-tab.tsx +16 -2
  56. package/src/web/stores/settings-store.ts +10 -0
  57. package/dist/web/assets/architecture-PBZL5I3N-CkdUQjA_.js +0 -1
  58. package/dist/web/assets/chat-tab-DNmhvaZ_.js +0 -16
  59. package/dist/web/assets/code-editor-CHwXYDhx.js +0 -10
  60. package/dist/web/assets/diff-viewer-Blji3pAc.js +0 -4
  61. package/dist/web/assets/gitGraph-HDMCJU4V-D3UR56AG.js +0 -1
  62. package/dist/web/assets/index-fyMt5gpO.css +0 -2
  63. package/dist/web/assets/info-3K5VOQVL-DUhLSKI2.js +0 -1
  64. package/dist/web/assets/keybindings-store-Clt4mfff.js +0 -1
  65. package/dist/web/assets/notification-store-B0D4A68q.js +0 -1
  66. package/dist/web/assets/packet-RMMSAZCW-BIpeVUGW.js +0 -1
  67. package/dist/web/assets/pie-UPGHQEXC-CNoizzjb.js +0 -1
  68. package/dist/web/assets/radar-KQ55EAFF-7dns-ho5.js +0 -1
  69. package/dist/web/assets/settings-store-DQUFTPk2.js +0 -2
  70. package/dist/web/assets/settings-tab-B1wiEtFH.js +0 -1
  71. package/dist/web/assets/text-wrap-DJz9Bgpa.js +0 -1
  72. package/dist/web/assets/treemap-KZPCXAKY-D3DZCLoE.js +0 -1
  73. /package/dist/web/assets/{api-client-BK4NPNoY.js → api-client-bbJLzRVE.js} +0 -0
  74. /package/dist/web/assets/{csv-parser-D1b_lg2T.js → csv-parser-B9nz_FWE.js} +0 -0
  75. /package/dist/web/assets/{data-grid-types-DzL5W2em.js → data-grid-types-DcEKQO3y.js} +0 -0
  76. /package/dist/web/assets/{dist-CohudVKa.js → dist-B5ErTtYs.js} +0 -0
  77. /package/dist/web/assets/{dist-BM2EHhLH.js → dist-JYGF-20y.js} +0 -0
  78. /package/dist/web/assets/{katex-CHaeM9QC.js → katex-DxcN2mZR.js} +0 -0
  79. /package/dist/web/assets/{lib-LPmTkMu4.js → lib-D4CEhqqn.js} +0 -0
  80. /package/dist/web/assets/{react-DHBl6KRc.js → react-9ZmE0_ty.js} +0 -0
  81. /package/dist/web/assets/{utils-CSCvNZxE.js → utils-B1vxU5xS.js} +0 -0
  82. /package/dist/web/assets/{vendor-xterm-t3d5xZdz.js → vendor-xterm-vh96p1Au.js} +0 -0
  83. /package/dist/web/assets/{wifi-CgM9T6HR.js → wifi-cAuzu8sM.js} +0 -0
  84. /package/dist/web/assets/{x-Dx3jsRgu.js → x-BVxklgnd.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./database-NmqHg29g.js";import{t as i}from"./glide-data-grid-4mwS1Swl.js";import{t as a}from"./table-BzjWcs87.js";import{i as o,t as s}from"./api-client-BK4NPNoY.js";import"./settings-store-DQUFTPk2.js";import"./vendor-mermaid-DkqjpqJK.js";import"./panel-store-C9VAhbZz.js";import"./tab-store-CIcbSn0c.js";import{Ot as c,ot as l,pt as u}from"./index-CuOntRL_.js";import"./data-grid-types-DzL5W2em.js";import"./use-monaco-theme-BLIgarH5.js";import{t as d}from"./sql-query-editor-DGcroNAs.js";var f=e(n(),1);function p(e,t,n){let[r,i]=(0,f.useState)([]),[a,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)([]),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(1),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(!1),E=n?`/api/db/connections/${n}`:null,D=E??`${o(e)}/sqlite`,O=E?``:`path=${encodeURIComponent(t)}`,k=(0,f.useCallback)(async()=>{h(!0),_(null);try{let e=E?`?cached=1`:O?`?${O}`:``,t=await s.get(`${D}/tables${e}`);i(t),!E&&t.length>0&&!a&&c(t[0].name)}catch(e){_(e.message)}finally{h(!1)}},[D,O,E]);(0,f.useEffect)(()=>{k()},[k]);let A=(0,f.useCallback)(async()=>{if(a){h(!0);try{let e=O?`${O}&`:``,[t,n]=await Promise.all([s.get(`${D}/data?${e}table=${encodeURIComponent(a)}&page=${v}&limit=100`),s.get(`${D}/schema?${e}table=${encodeURIComponent(a)}`)]);u(t),p(n)}catch(e){_(e.message)}finally{h(!1)}}},[D,O,a,v]);return(0,f.useEffect)(()=>{A()},[A]),{tables:r,selectedTable:a,selectTable:(0,f.useCallback)(e=>{c(e),y(1),x(null)},[]),tableData:l,schema:d,loading:m,error:g,page:v,setPage:y,queryResult:b,queryError:S,queryLoading:w,executeQuery:(0,f.useCallback)(async e=>{T(!0),C(null);try{let n=E?{sql:e}:{path:t,sql:e},r=await s.post(`${D}/query`,n);x(r),r.changeType===`modify`&&A()}catch(e){C(e.message)}finally{T(!1)}},[D,E,t,A]),updateCell:(0,f.useCallback)(async(e,n,r)=>{if(a)try{E?await s.put(`${D}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await s.put(`${D}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),A()}catch(e){_(e.message)}},[D,E,t,a,A]),deleteRow:(0,f.useCallback)(async e=>{if(a)try{E?await s.del(`${D}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await s.del(`${D}/row`,{path:t,table:a,rowid:e}),A(),k()}catch(e){_(e.message)}},[D,E,t,a,A,k]),refreshTables:k,refreshData:A}}var m=t();function h({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,m.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,m.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,m.jsx)(l,{className:`size-3`})})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,m.jsx)(a,{className:`size-3 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,m.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,m.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function g({onExecute:e,loading:t}){return(0,m.jsx)(d,{onExecute:e,loading:t})}function _({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,f.useState)(!1);return i?(0,m.jsx)(v,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0}):!t||!n?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,m.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,m.jsx)(v,{projectName:n,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function v({projectName:e,dbPath:t,connectionId:n,connectionName:a,initialTable:o,queryPanelOpen:s,onToggleQueryPanel:l,hideTableList:d}){let _=p(e,t,n),v=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{o&&!v.current&&_.tables.length>0&&(v.current=!0,_.selectTable(o))},[o,_.tables]),_.error&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,m.jsx)(c,{className:`size-10 text-destructive`}),(0,m.jsx)(`p`,{className:`text-sm`,children:_.error})]}):_.loading&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,m.jsx)(u,{className:`size-5 animate-spin`}),(0,m.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,m.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!d&&(0,m.jsx)(h,{tables:_.tables,selectedTable:_.selectedTable,onSelect:_.selectTable,onRefresh:_.refreshTables}),(0,m.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${d?``:`border-l border-border`}`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,m.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:a??t}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_.selectedTable&&`/ ${_.selectedTable}`}),(0,m.jsx)(`div`,{className:`ml-auto`,children:(0,m.jsx)(`button`,{type:`button`,onClick:l,className:`px-2 py-1 rounded text-xs transition-colors ${s?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,m.jsx)(`div`,{className:`flex-1 overflow-hidden ${s?`max-h-[60%]`:``}`,children:_.tableData?(0,m.jsx)(i,{columns:_.tableData.columns,rows:_.tableData.rows,total:_.tableData.total,limit:_.tableData.limit,schema:_.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:_.loading,page:_.page,onPageChange:_.setPage,onCellUpdate:(e,t,n,r)=>_.updateCell(t,n,r),onRowDelete:(e,t)=>_.deleteRow(t)}):(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:_.loading?(0,m.jsx)(u,{className:`size-4 animate-spin`}):`Select a table`})}),s&&(0,m.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,m.jsx)(g,{onExecute:_.executeQuery,loading:_.queryLoading})})]})]})}export{_ as SqliteViewer};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./database-NmqHg29g.js";import{t as i}from"./glide-data-grid-C6pJGtR4.js";import{t as a}from"./table-BzjWcs87.js";import{i as o,t as s}from"./api-client-bbJLzRVE.js";import"./settings-store-BL2a9FtJ.js";import"./vendor-mermaid-Bfbv_YGB.js";import"./panel-store-BETELS-N.js";import"./tab-store-B_Kf29se.js";import{kt as c,mt as l,st as u}from"./index-BGYnwVhe.js";import"./data-grid-types-DcEKQO3y.js";import"./use-monaco-theme-B9wG8s0C.js";import{t as d}from"./sql-query-editor-BjQxcBDR.js";var f=e(n(),1);function p(e,t,n){let[r,i]=(0,f.useState)([]),[a,c]=(0,f.useState)(null),[l,u]=(0,f.useState)(null),[d,p]=(0,f.useState)([]),[m,h]=(0,f.useState)(!1),[g,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(1),[b,x]=(0,f.useState)(null),[S,C]=(0,f.useState)(null),[w,T]=(0,f.useState)(!1),E=n?`/api/db/connections/${n}`:null,D=E??`${o(e)}/sqlite`,O=E?``:`path=${encodeURIComponent(t)}`,k=(0,f.useCallback)(async()=>{h(!0),_(null);try{let e=E?`?cached=1`:O?`?${O}`:``,t=await s.get(`${D}/tables${e}`);i(t),!E&&t.length>0&&!a&&c(t[0].name)}catch(e){_(e.message)}finally{h(!1)}},[D,O,E]);(0,f.useEffect)(()=>{k()},[k]);let A=(0,f.useCallback)(async()=>{if(a){h(!0);try{let e=O?`${O}&`:``,[t,n]=await Promise.all([s.get(`${D}/data?${e}table=${encodeURIComponent(a)}&page=${v}&limit=100`),s.get(`${D}/schema?${e}table=${encodeURIComponent(a)}`)]);u(t),p(n)}catch(e){_(e.message)}finally{h(!1)}}},[D,O,a,v]);return(0,f.useEffect)(()=>{A()},[A]),{tables:r,selectedTable:a,selectTable:(0,f.useCallback)(e=>{c(e),y(1),x(null)},[]),tableData:l,schema:d,loading:m,error:g,page:v,setPage:y,queryResult:b,queryError:S,queryLoading:w,executeQuery:(0,f.useCallback)(async e=>{T(!0),C(null);try{let n=E?{sql:e}:{path:t,sql:e},r=await s.post(`${D}/query`,n);x(r),r.changeType===`modify`&&A()}catch(e){C(e.message)}finally{T(!1)}},[D,E,t,A]),updateCell:(0,f.useCallback)(async(e,n,r)=>{if(a)try{E?await s.put(`${D}/cell`,{table:a,pkColumn:`rowid`,pkValue:e,column:n,value:r}):await s.put(`${D}/cell`,{path:t,table:a,rowid:e,column:n,value:r}),A()}catch(e){_(e.message)}},[D,E,t,a,A]),deleteRow:(0,f.useCallback)(async e=>{if(a)try{E?await s.del(`${D}/row`,{table:a,pkColumn:`rowid`,pkValue:e}):await s.del(`${D}/row`,{path:t,table:a,rowid:e}),A(),k()}catch(e){_(e.message)}},[D,E,t,a,A,k]),refreshTables:k,refreshData:A}}var m=t();function h({tables:e,selectedTable:t,onSelect:n,onRefresh:r}){return(0,m.jsxs)(`div`,{className:`w-48 shrink-0 flex flex-col bg-background overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border`,children:[(0,m.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Tables`}),(0,m.jsx)(`button`,{type:`button`,onClick:r,className:`text-muted-foreground hover:text-foreground transition-colors`,title:`Refresh tables`,children:(0,m.jsx)(u,{className:`size-3`})})]}),(0,m.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[e.map(e=>(0,m.jsxs)(`button`,{type:`button`,onClick:()=>n(e.name),className:`w-full flex items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors ${t===e.name?`bg-muted text-foreground`:`text-muted-foreground hover:bg-muted/50 hover:text-foreground`}`,children:[(0,m.jsx)(a,{className:`size-3 shrink-0`}),(0,m.jsx)(`span`,{className:`truncate flex-1`,children:e.name}),(0,m.jsx)(`span`,{className:`text-[10px] opacity-60`,children:e.rowCount})]},e.name)),e.length===0&&(0,m.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No tables found`})]})]})}function g({onExecute:e,loading:t}){return(0,m.jsx)(d,{onExecute:e,loading:t})}function _({metadata:e}){let t=e?.filePath,n=e?.projectName,i=e?.connectionId,a=e?.tableName,[o,s]=(0,f.useState)(!1);return i?(0,m.jsx)(v,{projectName:``,dbPath:``,connectionId:i,connectionName:e?.connectionName,initialTable:a,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e),hideTableList:!0}):!t||!n?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full text-text-secondary text-sm`,children:[(0,m.jsx)(r,{className:`size-5 mr-2`}),` No database file selected.`]}):(0,m.jsx)(v,{projectName:n,dbPath:t,queryPanelOpen:o,onToggleQueryPanel:()=>s(e=>!e)})}function v({projectName:e,dbPath:t,connectionId:n,connectionName:a,initialTable:o,queryPanelOpen:s,onToggleQueryPanel:u,hideTableList:d}){let _=p(e,t,n),v=(0,f.useRef)(!1);return(0,f.useEffect)(()=>{o&&!v.current&&_.tables.length>0&&(v.current=!0,_.selectTable(o))},[o,_.tables]),_.error&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-text-secondary`,children:[(0,m.jsx)(c,{className:`size-10 text-destructive`}),(0,m.jsx)(`p`,{className:`text-sm`,children:_.error})]}):_.loading&&_.tables.length===0?(0,m.jsxs)(`div`,{className:`flex items-center justify-center h-full gap-2 text-text-secondary`,children:[(0,m.jsx)(l,{className:`size-5 animate-spin`}),(0,m.jsx)(`span`,{className:`text-sm`,children:`Loading database...`})]}):(0,m.jsxs)(`div`,{className:`flex h-full w-full overflow-hidden`,children:[!d&&(0,m.jsx)(h,{tables:_.tables,selectedTable:_.selectedTable,onSelect:_.selectTable,onRefresh:_.refreshTables}),(0,m.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden ${d?``:`border-l border-border`}`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 border-b border-border bg-background shrink-0`,children:[(0,m.jsx)(r,{className:`size-3.5 text-muted-foreground`}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:a??t}),(0,m.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_.selectedTable&&`/ ${_.selectedTable}`}),(0,m.jsx)(`div`,{className:`ml-auto`,children:(0,m.jsx)(`button`,{type:`button`,onClick:u,className:`px-2 py-1 rounded text-xs transition-colors ${s?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`,children:`SQL`})})]}),(0,m.jsx)(`div`,{className:`flex-1 overflow-hidden ${s?`max-h-[60%]`:``}`,children:_.tableData?(0,m.jsx)(i,{columns:_.tableData.columns,rows:_.tableData.rows,total:_.tableData.total,limit:_.tableData.limit,schema:_.schema.map(e=>({name:e.name,type:e.type,nullable:!e.notnull,pk:!!e.pk,defaultValue:e.dflt_value,fk:e.fk??null})),loading:_.loading,page:_.page,onPageChange:_.setPage,onCellUpdate:(e,t,n,r)=>_.updateCell(t,n,r),onRowDelete:(e,t)=>_.deleteRow(t)}):(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full text-xs text-muted-foreground`,children:_.loading?(0,m.jsx)(l,{className:`size-4 animate-spin`}):`Select a table`})}),s&&(0,m.jsx)(`div`,{className:`border-t border-border h-[40%] shrink-0`,children:(0,m.jsx)(g,{onExecute:_.executeQuery,loading:_.queryLoading})})]})]})}export{_ as SqliteViewer};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./createLucideIcon-BjHrJDVb.js";import{t as i}from"./arrow-down-D825m4vm.js";import{t as a}from"./arrow-up-Rcw6_KKu.js";import{n as o,t as s}from"./chevron-down-CiFNPrfI.js";import{t as c}from"./chevron-right-BzAdxJRG.js";import{t as l}from"./wifi-CgM9T6HR.js";import{t as u}from"./x-Dx3jsRgu.js";import{t as d}from"./api-client-BK4NPNoY.js";import{n as f}from"./utils-CSCvNZxE.js";import{E as p,J as m,X as h,a as g,it as _,lt as v}from"./index-CuOntRL_.js";var y=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),b=r(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),x=e(n(),1),S=t(),C=(0,x.memo)(function({data:e,width:t=120,height:n=24,color:r=`#3b82f6`}){let i=(0,x.useRef)(null),a=(0,x.useRef)(0);return(0,x.useEffect)(()=>{let o=Date.now();if(o-a.current<1e3)return;a.current=o;let s=i.current;if(!s||e.length<2)return;let c=s.getContext(`2d`);if(!c)return;let l=window.devicePixelRatio||1;s.width=t*l,s.height=n*l,c.scale(l,l),c.clearRect(0,0,t,n);let u=Math.max(...e,1),d=t/(e.length-1),f=n-4;c.beginPath(),c.strokeStyle=r,c.lineWidth=1.5,c.lineJoin=`round`;for(let t=0;t<e.length;t++){let n=t*d,r=2+f-e[t]/u*f;t===0?c.moveTo(n,r):c.lineTo(n,r)}c.stroke()},[e,t,n,r]),(0,S.jsx)(`canvas`,{ref:i,style:{width:t,height:n},className:`inline-block`})});function w(e){return e>80?`text-red-500`:e>50?`text-yellow-500`:`text-green-500`}function T(e){return e<1024?`${e.toFixed(0)} MB`:`${(e/1024).toFixed(1)} GB`}function E(e){if(!e)return``;let t=Math.round((Date.now()-e)/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}var D=(0,x.memo)(function({group:e,Icon:t,isExpanded:n,sparkData:r,isMobile:i,sortKey:a,sortDir:o,onToggle:l,onKill:d}){let p=n?s:c,m=(0,x.useMemo)(()=>a?[...e.processes].sort((e,t)=>{let n=a===`cpu`?e.cpu:e.ramMB,r=a===`cpu`?t.cpu:t.ramMB;return o===`asc`?n-r:r-n}):e.processes,[e.processes,a,o]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`tr`,{className:`hover:bg-surface-hover cursor-pointer transition-colors`,onClick:l,children:[(0,S.jsx)(`td`,{className:`py-1.5 px-3`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(p,{className:`size-3 text-text-subtle shrink-0`}),(0,S.jsx)(t,{className:`size-3.5 text-text-secondary shrink-0`}),(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),(0,S.jsxs)(`span`,{className:`text-text-subtle`,children:[`(`,e.processes.length,`)`]})]})}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`py-1.5 px-2`,children:r.length>1&&(0,S.jsx)(C,{data:r,width:120,height:20})})]}),n&&m.map(e=>(0,S.jsxs)(`tr`,{className:`text-text-subtle group/proc hover:bg-surface-hover transition-colors`,children:[(0,S.jsx)(`td`,{className:`py-1 px-3 pl-10`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,S.jsx)(`span`,{className:`text-text-subtle shrink-0`,children:e.pid}),(0,S.jsx)(`span`,{className:`break-all text-text-secondary`,title:e.command,children:e.command})]})}),(0,S.jsxs)(`td`,{className:`text-right py-1 px-2 align-top`,children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1 px-2 align-top`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`align-top py-1 px-2`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,S.jsx)(`span`,{className:`text-text-subtle`,title:e.startedAt?new Date(e.startedAt).toLocaleString():``,children:E(e.startedAt)}),(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d(e.pid)},className:`opacity-0 group-hover/proc:opacity-100 p-0.5 rounded hover:bg-red-500/20 hover:text-red-500 transition-all`,title:`End process ${e.pid}`,children:(0,S.jsx)(u,{className:`size-3`})})]})})]},e.pid))]})});function O({label:e,field:t,activeKey:n,activeDir:r,onClick:o,className:s}){let c=n===t,l=c?r===`asc`?a:i:null;return(0,S.jsx)(`th`,{className:f(`text-right py-1.5 px-2 font-medium cursor-pointer select-none hover:text-text-primary transition-colors`,c&&`text-text-primary`,s),onClick:()=>o(t),children:(0,S.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,S.jsx)(`span`,{children:e}),l&&(0,S.jsx)(l,{className:`size-3`})]})})}var k={server:_,terminal:v,"ai-tool":o,build:b,unknown:y},A=200;function j(e,t,n){return e===n?t===`desc`?[n,`asc`]:[null,`desc`]:[n,`desc`]}function M(e,t,n){return t?[...e].sort((e,r)=>{let i=t===`cpu`?e.cpu:e.ramMB,a=t===`cpu`?r.cpu:r.ramMB;return n===`asc`?i-a:a-i}):e}var N=(0,x.memo)(function(){let{latest:e,history:t,isConnected:n}=g(),[r,i]=(0,x.useState)(()=>new Set([`server`])),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(`desc`),u=p(),_=(0,x.useMemo)(()=>{let e=new Map,n=t.slice(-A);for(let t of n)for(let n of t.groups){let t=`${n.type}:${n.label}`,r=e.get(t)??[];r.push(n.cpu),e.set(t,r)}return e},[t]),v=(0,x.useMemo)(()=>e?M(e.groups,a,s):[],[e,a,s]),b=(0,x.useCallback)(async e=>{try{await d.post(`/api/system/resources/kill/${e}`),m.success(`Sent SIGTERM to PID ${e}`)}catch(t){m.error(t.message||`Failed to kill PID ${e}`)}},[]),C=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},E=e=>{let[t,n]=j(a,s,e);o(t),c(n)};if(!e)return(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm`,children:n?`Waiting for data...`:`Connecting to resource monitor...`});let N=Math.round((Date.now()-e.timestamp)/1e3);return(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,children:[n?(0,S.jsx)(l,{className:`size-3 text-green-500`}):(0,S.jsx)(h,{className:`size-3 text-red-500`}),(0,S.jsx)(`span`,{children:n?`Updated ${N}s ago`:`Disconnected`})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,S.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-text-subtle border-b border-border`,children:[(0,S.jsx)(`th`,{className:`text-left py-1.5 px-3 font-medium`,children:`Process`}),(0,S.jsx)(O,{label:`CPU`,field:`cpu`,activeKey:a,activeDir:s,onClick:E,className:`w-16`}),(0,S.jsx)(O,{label:`RAM`,field:`ram`,activeKey:a,activeDir:s,onClick:E,className:`w-20`}),!u&&(0,S.jsx)(`th`,{className:`py-1.5 px-2 font-medium w-[130px]`,children:`Trend / Age`})]})}),(0,S.jsx)(`tbody`,{children:v.map(e=>{let t=`${e.type}:${e.label}`;return(0,S.jsx)(D,{group:e,Icon:k[e.type]??y,isExpanded:r.has(t),sparkData:_.get(t)??[],isMobile:u,sortKey:a,sortDir:s,onToggle:()=>C(t),onKill:b},t)})}),(0,S.jsx)(`tfoot`,{children:(0,S.jsxs)(`tr`,{className:`border-t border-border font-medium`,children:[(0,S.jsxs)(`td`,{className:`py-1.5 px-3`,children:[`Total (`,e.total.processCount,` processes)`]}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.total.cpu)),children:[e.total.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.total.ramMB)}),!u&&(0,S.jsx)(`td`,{})]})})]})})]})});export{N as SystemMonitorTab};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import{t as r}from"./createLucideIcon-BjHrJDVb.js";import{t as i}from"./arrow-down-D825m4vm.js";import{t as a}from"./arrow-up-Rcw6_KKu.js";import{n as o,t as s}from"./chevron-down-CiFNPrfI.js";import{t as c}from"./chevron-right-BzAdxJRG.js";import{t as l}from"./wifi-cAuzu8sM.js";import{t as u}from"./x-BVxklgnd.js";import{t as d}from"./api-client-bbJLzRVE.js";import{n as f}from"./utils-B1vxU5xS.js";import{E as p,J as m,X as h,a as g,at as _,ut as v}from"./index-BGYnwVhe.js";var y=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),b=r(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),x=e(n(),1),S=t(),C=(0,x.memo)(function({data:e,width:t=120,height:n=24,color:r=`#3b82f6`}){let i=(0,x.useRef)(null),a=(0,x.useRef)(0);return(0,x.useEffect)(()=>{let o=Date.now();if(o-a.current<1e3)return;a.current=o;let s=i.current;if(!s||e.length<2)return;let c=s.getContext(`2d`);if(!c)return;let l=window.devicePixelRatio||1;s.width=t*l,s.height=n*l,c.scale(l,l),c.clearRect(0,0,t,n);let u=Math.max(...e,1),d=t/(e.length-1),f=n-4;c.beginPath(),c.strokeStyle=r,c.lineWidth=1.5,c.lineJoin=`round`;for(let t=0;t<e.length;t++){let n=t*d,r=2+f-e[t]/u*f;t===0?c.moveTo(n,r):c.lineTo(n,r)}c.stroke()},[e,t,n,r]),(0,S.jsx)(`canvas`,{ref:i,style:{width:t,height:n},className:`inline-block`})});function w(e){return e>80?`text-red-500`:e>50?`text-yellow-500`:`text-green-500`}function T(e){return e<1024?`${e.toFixed(0)} MB`:`${(e/1024).toFixed(1)} GB`}function E(e){if(!e)return``;let t=Math.round((Date.now()-e)/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);return r<24?`${r}h ${n%60}m`:`${Math.floor(r/24)}d ${r%24}h`}var D=(0,x.memo)(function({group:e,Icon:t,isExpanded:n,sparkData:r,isMobile:i,sortKey:a,sortDir:o,onToggle:l,onKill:d}){let p=n?s:c,m=(0,x.useMemo)(()=>a?[...e.processes].sort((e,t)=>{let n=a===`cpu`?e.cpu:e.ramMB,r=a===`cpu`?t.cpu:t.ramMB;return o===`asc`?n-r:r-n}):e.processes,[e.processes,a,o]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`tr`,{className:`hover:bg-surface-hover cursor-pointer transition-colors`,onClick:l,children:[(0,S.jsx)(`td`,{className:`py-1.5 px-3`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(p,{className:`size-3 text-text-subtle shrink-0`}),(0,S.jsx)(t,{className:`size-3.5 text-text-secondary shrink-0`}),(0,S.jsx)(`span`,{className:`truncate`,children:e.label}),(0,S.jsxs)(`span`,{className:`text-text-subtle`,children:[`(`,e.processes.length,`)`]})]})}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.cpu)),children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`py-1.5 px-2`,children:r.length>1&&(0,S.jsx)(C,{data:r,width:120,height:20})})]}),n&&m.map(e=>(0,S.jsxs)(`tr`,{className:`text-text-subtle group/proc hover:bg-surface-hover transition-colors`,children:[(0,S.jsx)(`td`,{className:`py-1 px-3 pl-10`,children:(0,S.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,S.jsx)(`span`,{className:`text-text-subtle shrink-0`,children:e.pid}),(0,S.jsx)(`span`,{className:`break-all text-text-secondary`,title:e.command,children:e.command})]})}),(0,S.jsxs)(`td`,{className:`text-right py-1 px-2 align-top`,children:[e.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1 px-2 align-top`,children:T(e.ramMB)}),!i&&(0,S.jsx)(`td`,{className:`align-top py-1 px-2`,children:(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-1`,children:[(0,S.jsx)(`span`,{className:`text-text-subtle`,title:e.startedAt?new Date(e.startedAt).toLocaleString():``,children:E(e.startedAt)}),(0,S.jsx)(`button`,{onClick:t=>{t.stopPropagation(),d(e.pid)},className:`opacity-0 group-hover/proc:opacity-100 p-0.5 rounded hover:bg-red-500/20 hover:text-red-500 transition-all`,title:`End process ${e.pid}`,children:(0,S.jsx)(u,{className:`size-3`})})]})})]},e.pid))]})});function O({label:e,field:t,activeKey:n,activeDir:r,onClick:o,className:s}){let c=n===t,l=c?r===`asc`?a:i:null;return(0,S.jsx)(`th`,{className:f(`text-right py-1.5 px-2 font-medium cursor-pointer select-none hover:text-text-primary transition-colors`,c&&`text-text-primary`,s),onClick:()=>o(t),children:(0,S.jsxs)(`div`,{className:`flex items-center justify-end gap-0.5`,children:[(0,S.jsx)(`span`,{children:e}),l&&(0,S.jsx)(l,{className:`size-3`})]})})}var k={server:_,terminal:v,"ai-tool":o,build:b,unknown:y},A=200;function j(e,t,n){return e===n?t===`desc`?[n,`asc`]:[null,`desc`]:[n,`desc`]}function M(e,t,n){return t?[...e].sort((e,r)=>{let i=t===`cpu`?e.cpu:e.ramMB,a=t===`cpu`?r.cpu:r.ramMB;return n===`asc`?i-a:a-i}):e}var N=(0,x.memo)(function(){let{latest:e,history:t,isConnected:n}=g(),[r,i]=(0,x.useState)(()=>new Set([`server`])),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(`desc`),u=p(),_=(0,x.useMemo)(()=>{let e=new Map,n=t.slice(-A);for(let t of n)for(let n of t.groups){let t=`${n.type}:${n.label}`,r=e.get(t)??[];r.push(n.cpu),e.set(t,r)}return e},[t]),v=(0,x.useMemo)(()=>e?M(e.groups,a,s):[],[e,a,s]),b=(0,x.useCallback)(async e=>{try{await d.post(`/api/system/resources/kill/${e}`),m.success(`Sent SIGTERM to PID ${e}`)}catch(t){m.error(t.message||`Failed to kill PID ${e}`)}},[]),C=e=>{i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},E=e=>{let[t,n]=j(a,s,e);o(t),c(n)};if(!e)return(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-text-subtle text-sm`,children:n?`Waiting for data...`:`Connecting to resource monitor...`});let N=Math.round((Date.now()-e.timestamp)/1e3);return(0,S.jsxs)(`div`,{className:`h-full flex flex-col overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b border-border shrink-0`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-medium`,children:`System Monitor`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-text-subtle`,children:[n?(0,S.jsx)(l,{className:`size-3 text-green-500`}):(0,S.jsx)(h,{className:`size-3 text-red-500`}),(0,S.jsx)(`span`,{children:n?`Updated ${N}s ago`:`Disconnected`})]})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0`,children:(0,S.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`text-text-subtle border-b border-border`,children:[(0,S.jsx)(`th`,{className:`text-left py-1.5 px-3 font-medium`,children:`Process`}),(0,S.jsx)(O,{label:`CPU`,field:`cpu`,activeKey:a,activeDir:s,onClick:E,className:`w-16`}),(0,S.jsx)(O,{label:`RAM`,field:`ram`,activeKey:a,activeDir:s,onClick:E,className:`w-20`}),!u&&(0,S.jsx)(`th`,{className:`py-1.5 px-2 font-medium w-[130px]`,children:`Trend / Age`})]})}),(0,S.jsx)(`tbody`,{children:v.map(e=>{let t=`${e.type}:${e.label}`;return(0,S.jsx)(D,{group:e,Icon:k[e.type]??y,isExpanded:r.has(t),sparkData:_.get(t)??[],isMobile:u,sortKey:a,sortDir:s,onToggle:()=>C(t),onKill:b},t)})}),(0,S.jsx)(`tfoot`,{children:(0,S.jsxs)(`tr`,{className:`border-t border-border font-medium`,children:[(0,S.jsxs)(`td`,{className:`py-1.5 px-3`,children:[`Total (`,e.total.processCount,` processes)`]}),(0,S.jsxs)(`td`,{className:f(`text-right py-1.5 px-2`,w(e.total.cpu)),children:[e.total.cpu.toFixed(1),`%`]}),(0,S.jsx)(`td`,{className:`text-right py-1.5 px-2 text-text-secondary`,children:T(e.total.ramMB)}),!u&&(0,S.jsx)(`td`,{})]})})]})})]})});export{N as SystemMonitorTab};
@@ -1 +1 @@
1
- import{t as e}from"./react-DHBl6KRc.js";import{a as t,t as n}from"./panel-store-C9VAhbZz.js";var r=e()(()=>({tabs:[],activeTabId:null,tabHistory:[],currentProject:null,switchProject:e=>{n.getState().switchProject(e),i()},openTab:e=>{let t=n.getState().openTab(e);return i(),t},closeTab:e=>{n.getState().closeTab(e),i()},setActiveTab:e=>{n.getState().setActiveTab(e),i()},updateTab:(e,t)=>{n.getState().updateTab(e,t),i()},openNewFile:()=>{let e=n.getState(),r=t(e.panels),a=e.openTab({type:`editor`,title:`Untitled-${r}`,projectId:null,metadata:{isUntitled:!0,untitledNumber:r},closable:!0});return i(),a}}));function i(){let e=n.getState(),t=e.panels[e.focusedPanelId];r.setState({tabs:t?.tabs??[],activeTabId:t?.activeTabId??null,tabHistory:t?.tabHistory??[],currentProject:e.currentProject})}n.subscribe(()=>i());export{r as t};
1
+ import{t as e}from"./react-9ZmE0_ty.js";import{a as t,t as n}from"./panel-store-BETELS-N.js";var r=e()(()=>({tabs:[],activeTabId:null,tabHistory:[],currentProject:null,switchProject:e=>{n.getState().switchProject(e),i()},openTab:e=>{let t=n.getState().openTab(e);return i(),t},closeTab:e=>{n.getState().closeTab(e),i()},setActiveTab:e=>{n.getState().setActiveTab(e),i()},updateTab:(e,t)=>{n.getState().updateTab(e,t),i()},openNewFile:()=>{let e=n.getState(),r=t(e.panels),a=e.openTab({type:`editor`,title:`Untitled-${r}`,projectId:null,metadata:{isUntitled:!0,untitledNumber:r},closable:!0});return i(),a}}));function i(){let e=n.getState(),t=e.panels[e.focusedPanelId];r.setState({tabs:t?.tabs??[],activeTabId:t?.activeTabId??null,tabHistory:t?.tabHistory??[],currentProject:e.currentProject})}n.subscribe(()=>i());export{r as t};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import"./api-client-BK4NPNoY.js";import{n as r}from"./settings-store-DQUFTPk2.js";import"./vendor-mermaid-DkqjpqJK.js";import{n as i}from"./utils-CSCvNZxE.js";import{t as a}from"./panel-store-C9VAhbZz.js";import{Et as o,J as s,at as c,dt as l,wt as u}from"./index-CuOntRL_.js";import{n as d,r as f,t as p}from"./vendor-xterm-t3d5xZdz.js";var m=e(n(),1),h={background:`#0f1419`,foreground:`#e5e7eb`,cursor:`#e5e7eb`,selectionBackground:`#3b82f640`,black:`#1a1f2e`,red:`#ef4444`,green:`#10b981`,yellow:`#f59e0b`,blue:`#3b82f6`,magenta:`#a855f7`,cyan:`#06b6d4`,white:`#e5e7eb`,brightBlack:`#6b7280`,brightRed:`#f87171`,brightGreen:`#34d399`,brightYellow:`#fbbf24`,brightBlue:`#60a5fa`,brightMagenta:`#c084fc`,brightCyan:`#22d3ee`,brightWhite:`#f9fafb`},g={background:`#ffffff`,foreground:`#1a1f2e`,cursor:`#1a1f2e`,selectionBackground:`#2563eb30`,black:`#1a1f2e`,red:`#dc2626`,green:`#059669`,yellow:`#d97706`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f8fafc`,brightBlack:`#64748b`,brightRed:`#ef4444`,brightGreen:`#10b981`,brightYellow:`#f59e0b`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`};function _(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?h:g:e===`light`?g:h}var v=`RESIZE:`;function y(e){let{sessionId:t,containerRef:n}=e,i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)(null),c=(0,m.useRef)(0),[l,u]=(0,m.useState)(!1),[h,g]=(0,m.useState)(!1),[y,b]=(0,m.useState)(!1),x=e.tabId?`ppm:terminal-session:${e.tabId}`:null,S=(0,m.useRef)((()=>{if(x)try{return localStorage.getItem(x)??t}catch{}return t})()),C=(0,m.useRef)(0),w=(0,m.useCallback)(e=>{let t=o.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),T=(0,m.useCallback)(()=>i.current?.getSelection()??``,[]),E=(0,m.useCallback)(()=>{let e=i.current;if(!e)return``;let t=e.buffer.active,n=C.current,r=t.baseY+t.cursorY,a=[];for(let e=n;e<=r;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{b as t,x as n}from"./vendor-markdown-0Mxgxy0L.js";import"./vendor-ui-UXCWAcmi.js";import"./api-client-bbJLzRVE.js";import{n as r}from"./settings-store-BL2a9FtJ.js";import"./vendor-mermaid-Bfbv_YGB.js";import{n as i}from"./utils-B1vxU5xS.js";import{t as a}from"./panel-store-BETELS-N.js";import{Dt as o,J as s,Tt as c,ft as l,ot as u}from"./index-BGYnwVhe.js";import{n as d,r as f,t as p}from"./vendor-xterm-vh96p1Au.js";var m=e(n(),1),h={background:`#0f1419`,foreground:`#e5e7eb`,cursor:`#e5e7eb`,selectionBackground:`#3b82f640`,black:`#1a1f2e`,red:`#ef4444`,green:`#10b981`,yellow:`#f59e0b`,blue:`#3b82f6`,magenta:`#a855f7`,cyan:`#06b6d4`,white:`#e5e7eb`,brightBlack:`#6b7280`,brightRed:`#f87171`,brightGreen:`#34d399`,brightYellow:`#fbbf24`,brightBlue:`#60a5fa`,brightMagenta:`#c084fc`,brightCyan:`#22d3ee`,brightWhite:`#f9fafb`},g={background:`#ffffff`,foreground:`#1a1f2e`,cursor:`#1a1f2e`,selectionBackground:`#2563eb30`,black:`#1a1f2e`,red:`#dc2626`,green:`#059669`,yellow:`#d97706`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f8fafc`,brightBlack:`#64748b`,brightRed:`#ef4444`,brightGreen:`#10b981`,brightYellow:`#f59e0b`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`};function _(e){return e===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?h:g:e===`light`?g:h}var v=`RESIZE:`;function y(e){let{sessionId:t,containerRef:n}=e,i=(0,m.useRef)(null),a=(0,m.useRef)(null),o=(0,m.useRef)(null),s=(0,m.useRef)(null),c=(0,m.useRef)(0),[l,u]=(0,m.useState)(!1),[h,g]=(0,m.useState)(!1),[y,b]=(0,m.useState)(!1),x=e.tabId?`ppm:terminal-session:${e.tabId}`:null,S=(0,m.useRef)((()=>{if(x)try{return localStorage.getItem(x)??t}catch{}return t})()),C=(0,m.useRef)(0),w=(0,m.useCallback)(e=>{let t=o.current;t?.readyState===WebSocket.OPEN&&t.send(e)},[]),T=(0,m.useCallback)(()=>i.current?.getSelection()??``,[]),E=(0,m.useCallback)(()=>{let e=i.current;if(!e)return``;let t=e.buffer.active,n=C.current,r=t.baseY+t.cursorY,a=[];for(let e=n;e<=r;e++){let n=t.getLine(e);n&&a.push(n.translateToString(!0))}for(;a.length>0&&a[a.length-1].trim()===``;)a.pop();return a.join(`
2
2
  `)},[]),D=(0,m.useCallback)(()=>{let e=i.current,t=o.current;e&&t?.readyState===WebSocket.OPEN&&t.send(`${v}${e.cols},${e.rows}`)},[]),O=(0,m.useCallback)(()=>{if(s.current&&clearTimeout(s.current),o.current?.close(),o.current=null,S.current=`new`,x)try{localStorage.removeItem(x)}catch{}c.current=0,b(!1),u(!1),g(!1),setTimeout(()=>k(),0)},[]),k=(0,m.useCallback)(()=>{s.current&&=(clearTimeout(s.current),null),o.current&&=(o.current.onclose=null,o.current.close(),null);let t=i.current;if(!t)return;let n=window.location.protocol===`https:`?`wss:`:`ws:`,r=e.projectName??``,a=S.current,l=`/ws/project/${encodeURIComponent(r)}/terminal/${a}`,d=`${n}//${window.location.host}${l}`,f=new WebSocket(d);o.current=f,f.onopen=()=>{u(!0),g(!1),c.current=0,D()},f.onmessage=e=>{if(typeof e.data==`string`){if(e.data.startsWith(`{`))try{let n=JSON.parse(e.data);if(n.type){if(n.type===`session`&&n.id&&(S.current=n.id,x))try{localStorage.setItem(x,n.id)}catch{}n.type===`error`&&t.write(`\r\n\x1b[31mError: ${n.message}\x1b[0m\r\n`),n.type===`exited`&&b(!0);return}}catch{}t.write(e.data)}},f.onclose=()=>{u(!1),A()},f.onerror=()=>{f.close()}},[D]);function A(){let e=Math.min(1e3*2**c.current,3e4);c.current++,g(!0),s.current=setTimeout(()=>{k()},e)}return(0,m.useEffect)(()=>{let e=n.current;if(!e)return;let t=new f({cursorBlink:!0,fontSize:13,fontFamily:`var(--font-mono)`,theme:_(r.getState().theme)}),c=new d,l=new p;t.loadAddon(c),t.loadAddon(l),t.open(e),c.fit(),i.current=t,a.current=c,t.onData(e=>{if(e.includes(`\r`)||e.includes(`
3
- `)){let e=t.buffer.active;C.current=e.baseY+e.cursorY+1}let n=o.current;n?.readyState===WebSocket.OPEN&&n.send(e)}),k();let u=new ResizeObserver(()=>{try{c.fit(),D()}catch{}});u.observe(e);let m=r.getState().theme,h=r.subscribe(e=>{e.theme!==m&&(m=e.theme,t.options.theme=_(e.theme))});return()=>{h(),u.disconnect(),s.current&&clearTimeout(s.current),o.current?.close(),o.current=null,t.dispose(),i.current=null,a.current=null}},[]),{connected:l,reconnecting:h,exited:y,sendData:w,getSelection:T,getLastCommandOutput:E,restart:O}}var b=t(),x=[{label:`Tab`,value:` `},{label:`Esc`,value:`\x1B`},{label:`Ctrl`,value:null,isModifier:!0},{label:`↑`,value:`\x1B[A`},{label:`↓`,value:`\x1B[B`},{label:`←`,value:`\x1B[D`},{label:`→`,value:`\x1B[C`}],S=(0,m.memo)(function({metadata:e,tabId:t}){let n=e?.sessionId??`new`,r=e?.projectName,d=(0,m.useRef)(null),{connected:f,reconnecting:p,exited:h,sendData:g,getSelection:_,getLastCommandOutput:v,restart:S}=y({sessionId:n,projectName:r,containerRef:d,tabId:t}),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=window.visualViewport;if(!e)return;function t(){e&&E(e.height)}return e.addEventListener(`resize`,t),()=>e.removeEventListener(`resize`,t)},[]);let D=(0,m.useCallback)(()=>{(d.current?.querySelector(`.xterm-helper-textarea`))?.focus()},[]),O=(0,m.useCallback)(e=>{if(D(),C&&e.length===1){let t=e.toLowerCase().charCodeAt(0)-96;t>=1&&t<=26&&g(String.fromCharCode(t)),w(!1);return}g(e)},[C,g,D]),k=(0,m.useCallback)(async()=>{let e=_();e&&await navigator.clipboard.writeText(e)},[_]),A=(0,m.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&(g(e),D())}catch{}},[g,D]),j=(0,m.useCallback)(()=>{let e=_(),t=e||v();if(!t.trim())return;let n="```bash\n"+t+"\n```",i=e?`Terminal selection`:`Terminal output`,o=!1,c=()=>{o=!0};window.addEventListener(`ppm:send-to-chat:ack`,c,{once:!0}),window.dispatchEvent(new CustomEvent(`ppm:send-to-chat`,{detail:{text:n,label:i,projectName:r}})),window.removeEventListener(`ppm:send-to-chat:ack`,c),o?s.success(`Sent to chat`,{duration:1500}):a.getState().openTab({type:`chat`,title:`Chat`,projectId:null,metadata:{projectName:r,pendingMessage:n},closable:!0})},[_,v,r]),M=typeof window<`u`&&`ontouchstart`in window;return(0,b.jsxs)(`div`,{className:`flex flex-col h-full`,style:T?{maxHeight:`${T}px`}:void 0,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1 bg-surface border-b border-border text-xs`,children:[(0,b.jsx)(`span`,{className:i(`size-2 rounded-full`,h?`bg-error`:f?`bg-success`:p?`bg-warning`:`bg-error`)}),(0,b.jsx)(`span`,{className:`text-text-secondary`,children:h?`Process exited`:f?`Connected`:p?`Reconnecting...`:`Disconnected`}),h&&(0,b.jsxs)(`button`,{onClick:S,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors`,children:[(0,b.jsx)(c,{size:10}),`Restart`]}),(0,b.jsxs)(`button`,{onClick:j,title:`Send to Chat`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors ml-auto`,children:[(0,b.jsx)(l,{size:10}),`Chat`]}),(0,b.jsx)(`span`,{className:`text-text-subtle font-mono`,children:n})]}),(0,b.jsx)(`div`,{ref:d,className:`flex-1 min-h-0 bg-background p-1`}),M&&(0,b.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 bg-surface border-t border-border overflow-x-auto`,children:[(0,b.jsx)(`button`,{onClick:k,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,children:(0,b.jsx)(u,{size:14})}),(0,b.jsx)(`button`,{onClick:A,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,children:(0,b.jsx)(o,{size:14})}),(0,b.jsx)(`button`,{onClick:j,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,"aria-label":`Send to Chat`,children:(0,b.jsx)(l,{size:14})}),(0,b.jsx)(`div`,{className:`w-px h-5 bg-border mx-0.5`}),x.map(e=>(0,b.jsx)(`button`,{onClick:()=>{e.label===`Ctrl`?w(!C):e.value&&O(e.value)},className:i(`px-3 py-1.5 rounded text-xs font-mono min-w-[36px] min-h-[32px]`,`bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground`,`transition-colors select-none`,e.label===`Ctrl`&&C&&`bg-primary text-primary-foreground`),children:e.label},e.label))]})]})});export{S as TerminalTab};
3
+ `)){let e=t.buffer.active;C.current=e.baseY+e.cursorY+1}let n=o.current;n?.readyState===WebSocket.OPEN&&n.send(e)}),k();let u=new ResizeObserver(()=>{try{c.fit(),D()}catch{}});u.observe(e);let m=r.getState().theme,h=r.subscribe(e=>{e.theme!==m&&(m=e.theme,t.options.theme=_(e.theme))});return()=>{h(),u.disconnect(),s.current&&clearTimeout(s.current),o.current?.close(),o.current=null,t.dispose(),i.current=null,a.current=null}},[]),{connected:l,reconnecting:h,exited:y,sendData:w,getSelection:T,getLastCommandOutput:E,restart:O}}var b=t(),x=[{label:`Tab`,value:` `},{label:`Esc`,value:`\x1B`},{label:`Ctrl`,value:null,isModifier:!0},{label:`↑`,value:`\x1B[A`},{label:`↓`,value:`\x1B[B`},{label:`←`,value:`\x1B[D`},{label:`→`,value:`\x1B[C`}],S=(0,m.memo)(function({metadata:e,tabId:t}){let n=e?.sessionId??`new`,r=e?.projectName,d=(0,m.useRef)(null),{connected:f,reconnecting:p,exited:h,sendData:g,getSelection:_,getLastCommandOutput:v,restart:S}=y({sessionId:n,projectName:r,containerRef:d,tabId:t}),[C,w]=(0,m.useState)(!1),[T,E]=(0,m.useState)(null);(0,m.useEffect)(()=>{let e=window.visualViewport;if(!e)return;function t(){e&&E(e.height)}return e.addEventListener(`resize`,t),()=>e.removeEventListener(`resize`,t)},[]);let D=(0,m.useCallback)(()=>{(d.current?.querySelector(`.xterm-helper-textarea`))?.focus()},[]),O=(0,m.useCallback)(e=>{if(D(),C&&e.length===1){let t=e.toLowerCase().charCodeAt(0)-96;t>=1&&t<=26&&g(String.fromCharCode(t)),w(!1);return}g(e)},[C,g,D]),k=(0,m.useCallback)(async()=>{let e=_();e&&await navigator.clipboard.writeText(e)},[_]),A=(0,m.useCallback)(async()=>{try{let e=await navigator.clipboard.readText();e&&(g(e),D())}catch{}},[g,D]),j=(0,m.useCallback)(()=>{let e=_(),t=e||v();if(!t.trim())return;let n="```bash\n"+t+"\n```",i=e?`Terminal selection`:`Terminal output`,o=!1,c=()=>{o=!0};window.addEventListener(`ppm:send-to-chat:ack`,c,{once:!0}),window.dispatchEvent(new CustomEvent(`ppm:send-to-chat`,{detail:{text:n,label:i,projectName:r}})),window.removeEventListener(`ppm:send-to-chat:ack`,c),o?s.success(`Sent to chat`,{duration:1500}):a.getState().openTab({type:`chat`,title:`Chat`,projectId:null,metadata:{projectName:r,pendingMessage:n},closable:!0})},[_,v,r]),M=typeof window<`u`&&`ontouchstart`in window;return(0,b.jsxs)(`div`,{className:`flex flex-col h-full`,style:T?{maxHeight:`${T}px`}:void 0,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1 bg-surface border-b border-border text-xs`,children:[(0,b.jsx)(`span`,{className:i(`size-2 rounded-full`,h?`bg-error`:f?`bg-success`:p?`bg-warning`:`bg-error`)}),(0,b.jsx)(`span`,{className:`text-text-secondary`,children:h?`Process exited`:f?`Connected`:p?`Reconnecting...`:`Disconnected`}),h&&(0,b.jsxs)(`button`,{onClick:S,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors`,children:[(0,b.jsx)(u,{size:10}),`Restart`]}),(0,b.jsxs)(`button`,{onClick:j,title:`Send to Chat`,className:`flex items-center gap-1 px-1.5 py-0.5 rounded text-xs bg-surface-elevated text-text-primary hover:bg-primary hover:text-primary-foreground active:bg-primary active:text-primary-foreground transition-colors ml-auto`,children:[(0,b.jsx)(l,{size:10}),`Chat`]}),(0,b.jsx)(`span`,{className:`text-text-subtle font-mono`,children:n})]}),(0,b.jsx)(`div`,{ref:d,className:`flex-1 min-h-0 bg-background p-1`}),M&&(0,b.jsxs)(`div`,{className:`flex items-center gap-1 px-2 py-1.5 bg-surface border-t border-border overflow-x-auto`,children:[(0,b.jsx)(`button`,{onClick:k,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,children:(0,b.jsx)(c,{size:14})}),(0,b.jsx)(`button`,{onClick:A,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,children:(0,b.jsx)(o,{size:14})}),(0,b.jsx)(`button`,{onClick:j,className:`px-2 py-1.5 rounded text-xs min-w-[36px] min-h-[32px] bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground transition-colors select-none`,"aria-label":`Send to Chat`,children:(0,b.jsx)(l,{size:14})}),(0,b.jsx)(`div`,{className:`w-px h-5 bg-border mx-0.5`}),x.map(e=>(0,b.jsx)(`button`,{onClick:()=>{e.label===`Ctrl`?w(!C):e.value&&O(e.value)},className:i(`px-3 py-1.5 rounded text-xs font-mono min-w-[36px] min-h-[32px]`,`bg-surface-elevated text-text-primary active:bg-primary active:text-primary-foreground`,`transition-colors select-none`,e.label===`Ctrl`&&C&&`bg-primary text-primary-foreground`),children:e.label},e.label))]})]})});export{S as TerminalTab};
@@ -0,0 +1 @@
1
+ import{N as e}from"./vendor-mermaid-Bfbv_YGB.js";export{e as createTreemapServices};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{x as t}from"./vendor-markdown-0Mxgxy0L.js";import{i as n,r}from"./api-client-BK4NPNoY.js";var i=e(t(),1);function a(e,t,a,o=0){let[s,c]=(0,i.useState)(null),[l,u]=(0,i.useState)(!1),d=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let i=!1,o=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/raw?path=${encodeURIComponent(e)}`:`${n(t)}/files/raw?path=${encodeURIComponent(e)}`,s=r();return fetch(o,{headers:s?{Authorization:`Bearer ${s}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{if(i)return;let t=a?new Blob([e],{type:a}):e,n=URL.createObjectURL(t);d.current&&URL.revokeObjectURL(d.current),d.current=n,c(n)}).catch(()=>{i||u(!0)}),()=>{i=!0}},[e,t,a,o]),(0,i.useEffect)(()=>()=>{d.current&&URL.revokeObjectURL(d.current)},[]),{blobUrl:s,error:l}}export{a as t};
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{x as t}from"./vendor-markdown-0Mxgxy0L.js";import{i as n,r}from"./api-client-bbJLzRVE.js";var i=e(t(),1);function a(e,t,a,o=0){let[s,c]=(0,i.useState)(null),[l,u]=(0,i.useState)(!1),d=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let i=!1,o=/^(\/|[A-Za-z]:[/\\])/.test(e)?`/api/fs/raw?path=${encodeURIComponent(e)}`:`${n(t)}/files/raw?path=${encodeURIComponent(e)}`,s=r();return fetch(o,{headers:s?{Authorization:`Bearer ${s}`}:{}}).then(e=>{if(!e.ok)throw Error(`Failed`);return e.blob()}).then(e=>{if(i)return;let t=a?new Blob([e],{type:a}):e,n=URL.createObjectURL(t);d.current&&URL.revokeObjectURL(d.current),d.current=n,c(n)}).catch(()=>{i||u(!0)}),()=>{i=!0}},[e,t,a,o]),(0,i.useEffect)(()=>()=>{d.current&&URL.revokeObjectURL(d.current)},[]),{blobUrl:s,error:l}}export{a as t};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{x as t}from"./vendor-markdown-0Mxgxy0L.js";import{n}from"./settings-store-DQUFTPk2.js";function r(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){if(Array.isArray(e))return e}function a(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function s(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{x as t}from"./vendor-markdown-0Mxgxy0L.js";import{n}from"./settings-store-BL2a9FtJ.js";function r(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){if(Array.isArray(e))return e}function a(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function s(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if(e==null)return{};var n,r,i=d(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function d(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function f(e,t){return i(e)||o(e,t)||h(e,t)||s()}function p(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function m(e){var t=p(e,`string`);return typeof t==`symbol`?t:t+``}function h(e,t){if(e){if(typeof e==`string`)return r(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function b(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function x(e){return{}.toString.call(e).includes(`Object`)}function S(e){return!Object.keys(e).length}function C(e){return typeof e==`function`}function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function T(e,t){return x(t)||A(`changeType`),Object.keys(t).some(function(t){return!w(e,t)})&&A(`changeField`),t}function E(e){C(e)||A(`selectorType`)}function D(e){C(e)||x(e)||A(`handlerType`),x(e)&&Object.values(e).some(function(e){return!C(e)})&&A(`handlersType`)}function O(e){e||A(`initialIsRequired`),x(e)||A(`initialType`),S(e)&&A(`initialContent`)}function k(e,t){throw Error(e[t]||e.default)}var A=b(k)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),j={changes:T,selector:E,handler:D,initial:O};function ee(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};j.initial(e),j.handler(t);var n={current:e},r=b(P)(n,t),i=b(N)(n),a=b(j.changes)(e),o=b(M)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return j.selector(e),e(n.current)}function c(e){y(r,i,a,o)(e)}return[s,c]}function M(e,t){return C(t)?t(e.current):t}function N(e,t){return e.current=v(v({},e.current),t),t}function P(e,t,n){return C(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var F={create:ee},te={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function ne(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function re(e){return{}.toString.call(e).includes(`Object`)}function ie(e){return e||L(`configIsRequired`),re(e)||L(`configType`),e.urls?(ae(),{paths:{vs:e.urls.monacoBase}}):e}function ae(){console.warn(I.deprecation)}function oe(e,t){throw Error(e[t]||e.default)}var I={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4