@opentig/cli 0.2.1 → 0.2.2

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 (112) hide show
  1. package/dist/bin.mjs +2 -1
  2. package/dist/chunks/{cli-B6JTojx_.mjs → cli-DNzGBqmL.mjs} +1 -1
  3. package/dist/client/assets/App-BbT5H97Z.js +138 -0
  4. package/dist/client/assets/{CreatePullRequestDialog-CAeykZ72.js → CreatePullRequestDialog-DRLeMY4e.js} +2 -2
  5. package/dist/client/assets/{DiffWorkspace-BRicWHvw.js → DiffWorkspace-DJX00otP.js} +1 -1
  6. package/dist/client/assets/{EditableFileViewer-DWeSDnZn.js → EditableFileViewer-Cmbomx5y.js} +1 -1
  7. package/dist/client/assets/{File-D65shwRR.js → File-4o4egqlz.js} +1 -1
  8. package/dist/client/assets/FilesView-TmUF-VLr.js +1 -0
  9. package/dist/client/assets/{GitHubAvatar-C8R3iNoM.js → GitHubAvatar-azKPrTMv.js} +1 -1
  10. package/dist/client/assets/HistoryView-Go6rXO0P.js +1 -0
  11. package/dist/client/assets/{HtmlFileViewer-JXLHTNPm.js → HtmlFileViewer-WpYnLdMW.js} +1 -1
  12. package/dist/client/assets/{IconEdit-3fgBTCQ4.js → IconEdit-B8LZHB8l.js} +1 -1
  13. package/dist/client/assets/{IconFolderSymlink-C4ydD1eS.js → IconFolderSymlink-D29EhQPC.js} +1 -1
  14. package/dist/client/assets/{ImageFileViewer-YH2xhkkk.js → ImageFileViewer-1ObUacJu.js} +1 -1
  15. package/dist/client/assets/LocalRefsDialog-VcrlFgxR.js +1 -0
  16. package/dist/client/assets/{MarkdownFileViewer-BsB8WkIH.js → MarkdownFileViewer-CvsKPnvF.js} +2 -2
  17. package/dist/client/assets/{PairingPage-DXRyAYHn.js → PairingPage-cSoKZi8t.js} +1 -1
  18. package/dist/client/assets/{PierreDiffViewer-DoV3V0IW.js → PierreDiffViewer-DVTrOwX4.js} +1 -1
  19. package/dist/client/assets/{PierreEditBoundary-BnYZbHfi.js → PierreEditBoundary-DPtaTiUB.js} +1 -1
  20. package/dist/client/assets/{PierreWorkerPool-Cg9zdxiI.js → PierreWorkerPool-BxP-s6jD.js} +1 -1
  21. package/dist/client/assets/PullRequestDiff-DeQznd9n.js +1 -0
  22. package/dist/client/assets/PullRequestViewer-IhGZZs_A.js +2 -0
  23. package/dist/client/assets/{PullRequestsView-GStKxG7k.js → PullRequestsView-BG0xrok4.js} +1 -1
  24. package/dist/client/assets/QuickOpenDialog-DpmcAzTx.js +1 -0
  25. package/dist/client/assets/RepositoryProjectsDialog-DAzbUB3X.js +1 -0
  26. package/dist/client/assets/{SearchView-D5XB6wdu.js → SearchView-HoiWKG8z.js} +1 -1
  27. package/dist/client/assets/SettingsDialog-pmJKOaiK.js +9 -0
  28. package/dist/client/assets/{Viewer-Gfy3Ejyo.js → Viewer-BCk8FHrc.js} +3 -3
  29. package/dist/client/assets/{abnfDiagram-N423BO3Z-DdAfHevw.js → abnfDiagram-N423BO3Z-BvfKOanh.js} +1 -1
  30. package/dist/client/assets/{arc-C43uoeEi.js → arc-DB2nIH2Y.js} +1 -1
  31. package/dist/client/assets/{architectureDiagram-T3A2C74G-C7q0hhRO.js → architectureDiagram-T3A2C74G-Bqh4uY3R.js} +1 -1
  32. package/dist/client/assets/base-ui-DIP2rZxz.js +1 -0
  33. package/dist/client/assets/{blockDiagram-VBNYF7ZC-C1x9Iap4.js → blockDiagram-VBNYF7ZC-DMW415Ms.js} +1 -1
  34. package/dist/client/assets/{c4Diagram-5PPSVZJV-BmKaVW6q.js → c4Diagram-5PPSVZJV-BSNPes7l.js} +1 -1
  35. package/dist/client/assets/channel-VcDernYy.js +1 -0
  36. package/dist/client/assets/{checkbox-XfIUFPxh.js → checkbox-Dta4gqy2.js} +1 -1
  37. package/dist/client/assets/{chunk-2GRJ4B5K-kzy_H3BQ.js → chunk-2GRJ4B5K-D-86JbWu.js} +1 -1
  38. package/dist/client/assets/{chunk-2Q5K7J3B-BMj-FT4X.js → chunk-2Q5K7J3B-BNI-SD-k.js} +1 -1
  39. package/dist/client/assets/{chunk-5RXB4S5H-DmPGiCCb.js → chunk-5RXB4S5H-OFFYyML8.js} +1 -1
  40. package/dist/client/assets/{chunk-5VM5RSS4-DYFL8__L.js → chunk-5VM5RSS4-DpE1dtnL.js} +1 -1
  41. package/dist/client/assets/{chunk-6Q2QTUOP-CI98oVdT.js → chunk-6Q2QTUOP-DxAnzBXJ.js} +1 -1
  42. package/dist/client/assets/{chunk-GF5L2VYU-D9JiiMlX.js → chunk-GF5L2VYU-DNrTNRgr.js} +1 -1
  43. package/dist/client/assets/{chunk-JWPE2WC7-D0THYpZl.js → chunk-JWPE2WC7-D-jfKyIh.js} +1 -1
  44. package/dist/client/assets/{chunk-KBJHAD2P-Z1tJfyAr.js → chunk-KBJHAD2P-CIyQl_ts.js} +1 -1
  45. package/dist/client/assets/{chunk-RYQCIY6F-31aS4cD3.js → chunk-RYQCIY6F-CgCYQccM.js} +1 -1
  46. package/dist/client/assets/{chunk-XXDRQBXY-ClWDHmEp.js → chunk-XXDRQBXY-B31oXtqU.js} +1 -1
  47. package/dist/client/assets/classDiagram-JCYQIIEL-CUuEGRCt.js +1 -0
  48. package/dist/client/assets/classDiagram-v2-OCEON4UE-CUuEGRCt.js +1 -0
  49. package/dist/client/assets/{cose-bilkent-JH36ORCC-Btg2MYLh.js → cose-bilkent-JH36ORCC-CrX-LDNw.js} +1 -1
  50. package/dist/client/assets/{cynefin-VYW2F7L2-Cbh4Pk6j.js → cynefin-VYW2F7L2-DnkWlsqW.js} +1 -1
  51. package/dist/client/assets/{cynefinDiagram-MW4NZA55-BBqorl0u.js → cynefinDiagram-MW4NZA55-bUDQ9ElF.js} +1 -1
  52. package/dist/client/assets/{dagre-VZM6K2ZE-DugEItZ0.js → dagre-VZM6K2ZE-BW5Kni4n.js} +1 -1
  53. package/dist/client/assets/{diagram-7IWD3JNH-Biu7dmH8.js → diagram-7IWD3JNH-1EXGwguC.js} +1 -1
  54. package/dist/client/assets/{diagram-B4RE2ZJO-UDm4DXFS.js → diagram-B4RE2ZJO-CzpH5ieN.js} +1 -1
  55. package/dist/client/assets/{diagram-LBJQPF4R-Bcku4gb-.js → diagram-LBJQPF4R-BnKszJ_B.js} +1 -1
  56. package/dist/client/assets/{diagram-Q27KOJAE-DFRjglV-.js → diagram-Q27KOJAE-DbQlD3OM.js} +1 -1
  57. package/dist/client/assets/{diagram-UB23O5K3-CgfMWtd0.js → diagram-UB23O5K3-BqZ-RSlm.js} +1 -1
  58. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-CZzYOqs0.js → ebnfDiagram-BXEA7PRR-B2iPWDvr.js} +1 -1
  59. package/dist/client/assets/{erDiagram-JOGREHBK-Cdlbxgs6.js → erDiagram-JOGREHBK-aMqHrKCk.js} +1 -1
  60. package/dist/client/assets/{flowDiagram-UKHOOZJN-BgImDwpP.js → flowDiagram-UKHOOZJN-ivrTsn4D.js} +1 -1
  61. package/dist/client/assets/{ganttDiagram-PKOTCBZU-SFhtiyL4.js → ganttDiagram-PKOTCBZU-IMfIqkXw.js} +1 -1
  62. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-Bkm5ueys.js → gitGraphDiagram-DS77QQ5N-BNURRh2N.js} +1 -1
  63. package/dist/client/assets/{index-B5RC4THs.js → index-B3QJsvjR.js} +4 -4
  64. package/dist/client/assets/index-Cx9LaJW8.css +1 -0
  65. package/dist/client/assets/{infoDiagram-6WML65LV-pCYc-VX2.js → infoDiagram-6WML65LV-BKEENkUQ.js} +1 -1
  66. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BtNbG3Y6.js → ishikawaDiagram-WSZJBQD7-HrCSmiTr.js} +1 -1
  67. package/dist/client/assets/{journeyDiagram-NVQOT4AX-CPW2qT3y.js → journeyDiagram-NVQOT4AX-CQIuWA6F.js} +1 -1
  68. package/dist/client/assets/{kanban-definition-27J2QSJJ-wD6JXQFs.js → kanban-definition-27J2QSJJ-h4fSAkel.js} +1 -1
  69. package/dist/client/assets/{linear-sj8MOkmS.js → linear-BAdz-uC9.js} +1 -1
  70. package/dist/client/assets/{mermaid.core-CGJtfmwb.js → mermaid.core-vLn7mMZB.js} +4 -4
  71. package/dist/client/assets/{mindmap-definition-FAOFIHXS-BQwLHBVs.js → mindmap-definition-FAOFIHXS-DOrZl827.js} +1 -1
  72. package/dist/client/assets/{pegDiagram-VL7TDLO6-DtDsb-Z8.js → pegDiagram-VL7TDLO6-_Vs7p633.js} +1 -1
  73. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-B3WhqNuS.js → pieDiagram-7S7Q4E2Y-7qbB_Z16.js} +1 -1
  74. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-CPi38pp_.js → quadrantDiagram-CIZ2JOQS-DNH8SosA.js} +1 -1
  75. package/dist/client/assets/{railroadDiagram-AXF67PYL-Btac44Ux.js → railroadDiagram-AXF67PYL-Ctazrrpa.js} +1 -1
  76. package/dist/client/assets/{render-markdown-hAIWRfn0.js → render-markdown-dvHhHbC0.js} +1 -1
  77. package/dist/client/assets/{requirementDiagram-LRYGKXZP-CHJgDNdg.js → requirementDiagram-LRYGKXZP-BAH8dYer.js} +1 -1
  78. package/dist/client/assets/{sankeyDiagram-W5VNT64P-OYJHfmtd.js → sankeyDiagram-W5VNT64P-CuffrpdF.js} +1 -1
  79. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-9ypa9W08.js → sequenceDiagram-SI44F4Z6-CaO4fJnS.js} +1 -1
  80. package/dist/client/assets/{sizeCapture-X5ZJPWSS-5ZDUTERI.js → sizeCapture-X5ZJPWSS-B_LramBU.js} +1 -1
  81. package/dist/client/assets/{stateDiagram-OKZ733FA-nGHE1hN7.js → stateDiagram-OKZ733FA-bc7zBYHn.js} +1 -1
  82. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-C-UGmA2d.js +1 -0
  83. package/dist/client/assets/{swimlanes-SLNWSIFB-BZFv9Zp8.js → swimlanes-SLNWSIFB-DQzg1IPn.js} +2 -2
  84. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DnopIiWa.js +8 -0
  85. package/dist/client/assets/{tanstack-CcfAJoQ7.js → tanstack-BysN2Oew.js} +1 -1
  86. package/dist/client/assets/{timeline-definition-Z64GVDOM-pUIcaCIE.js → timeline-definition-Z64GVDOM-CtbuIB6K.js} +1 -1
  87. package/dist/client/assets/{vennDiagram-T6HMQDX7-D6dEIJmP.js → vennDiagram-T6HMQDX7-pYJ0ZfFS.js} +1 -1
  88. package/dist/client/assets/{viewer-tabs-BjG3oKQ9.js → viewer-tabs-Cnfyd6rg.js} +1 -1
  89. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-DZ8ro_-y.js → wardleyDiagram-T6FBY63Y-DYl_Oi-Y.js} +1 -1
  90. package/dist/client/assets/{xychartDiagram-ELKLHX3M-WJ2Zfmlk.js → xychartDiagram-ELKLHX3M-Cj5YUfP5.js} +1 -1
  91. package/dist/client/index.html +4 -4
  92. package/dist/dev.mjs +2 -1
  93. package/dist/manifest.json +1 -1
  94. package/dist/server.mjs +779 -211
  95. package/dist/utility.mjs +1 -0
  96. package/package.json +1 -1
  97. package/dist/client/assets/App-Dfm5F199.js +0 -74
  98. package/dist/client/assets/FilesView-EfoU7sF-.js +0 -1
  99. package/dist/client/assets/HistoryView-C6T2dsBC.js +0 -1
  100. package/dist/client/assets/LocalRefsDialog--1NiYKYj.js +0 -1
  101. package/dist/client/assets/PullRequestDiff-D6QG5Anx.js +0 -1
  102. package/dist/client/assets/PullRequestViewer-jC3LVmiO.js +0 -2
  103. package/dist/client/assets/QuickOpenDialog-HvslpGQl.js +0 -1
  104. package/dist/client/assets/RepositoryProjectsDialog-Biqv5GO_.js +0 -1
  105. package/dist/client/assets/SettingsDialog-DWAunOQB.js +0 -72
  106. package/dist/client/assets/base-ui-CJ8ZIx3d.js +0 -1
  107. package/dist/client/assets/channel-Diwpee6E.js +0 -1
  108. package/dist/client/assets/classDiagram-JCYQIIEL-BDuo9kiS.js +0 -1
  109. package/dist/client/assets/classDiagram-v2-OCEON4UE-BDuo9kiS.js +0 -1
  110. package/dist/client/assets/index-Dc9xVluy.css +0 -1
  111. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CkCpE1Yu.js +0 -1
  112. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-Dxlb7bju.js +0 -8
@@ -1 +0,0 @@
1
- import{j as e,r as a,a as Ut}from"./react-rd22PHbN.js";import{a as dt}from"./tanstack-CcfAJoQ7.js";import{a3 as Q,D as Vt,a as Bt,b as qt,c as Yt,an as Me,ao as Le,ap as ut,aq as Gt,g as nt,ar as He,_ as ye,as as st,at as $e,W as _e,h as at,I as Wt,a1 as ht,j as Ae,C as ft,V as mt,ai as Xt,au as Qt,av as it,aw as Zt,ax as Jt,ay as en,a2 as tn,az as nn,aA as sn,aB as an,aC as on,aD as Y,q as ln,aE as rn,aF as cn,aG as ot,aH as dn,aI as un,aJ as Ue,aK as hn,aL as fn,aM as mn,aN as xn,aO as pn,aP as gn}from"./App-Dfm5F199.js";import{c as re,a as Ve,B as R,I as be}from"./index-B5RC4THs.js";import{m as jn,n as bn,M as yn,o as vn,p as Cn,q as kn,S as Nn}from"./base-ui-CJ8ZIx3d.js";import{a as lt,I as Be}from"./IconFolderSymlink-C4ydD1eS.js";import{I as xt}from"./IconEdit-3fgBTCQ4.js";const wn=[["path",{d:"M9 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M5 10h11a4 4 0 1 1 0 8h-1",key:"svg-1"}]],pt=re("outline","arrow-back-up","ArrowBackUp",wn);const Dn=[["path",{d:"M15 14l4 -4l-4 -4",key:"svg-0"}],["path",{d:"M19 10h-11a4 4 0 1 0 0 8h1",key:"svg-1"}]],gt=re("outline","arrow-forward-up","ArrowForwardUp",Dn);const Sn=[["path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",key:"svg-0"}],["path",{d:"M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2",key:"svg-1"}]],Re=re("outline","clipboard","Clipboard",Sn);const Mn=[["path",{d:"M3 4a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-16",key:"svg-0"}],["path",{d:"M12 3v18",key:"svg-1"}]],jt=re("outline","columns-2","Columns2",Mn);const Rn=[["path",{d:"M4 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M9.15 14.85l8.85 -10.85",key:"svg-2"}],["path",{d:"M6 4l8.85 10.85",key:"svg-3"}]],Oe=re("outline","cut","Cut",Rn);const En=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]],Ee=re("outline","file-plus","FilePlus",En),In=jn,Fn=bn;function Pn({className:t,children:i,...f}){return e.jsx(yn,{children:e.jsx(vn,{className:"isolate z-50 outline-none",children:e.jsx(Cn,{"data-slot":"context-menu-content",className:Ve("min-w-44 origin-(--transform-origin) rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...f,children:i})})})}function z({className:t,...i}){return e.jsx(kn,{"data-slot":"context-menu-item",className:Ve("flex h-8 cursor-default items-center gap-2 rounded-md px-2 text-xs outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-45 [&_svg]:size-3.5 [&_svg]:shrink-0",t),...i})}function je({className:t,...i}){return e.jsx(Nn,{"data-slot":"context-menu-separator",className:Ve("mx-1 my-1 h-px bg-border",t),...i})}function bt({state:t,onClose:i,onRename:f,onCreate:g}){const[p,o]=a.useState("");if(a.useEffect(()=>{t&&o(t.mode==="rename"?t.entry.name:"")},[t]),!t)return null;const h=t.mode==="rename",d=t.mode==="new-folder"?"directory":"file",M=t.entry.type==="directory"?t.entry.path:Q(t.entry.path),D=h?"Rename":d==="directory"?"New Folder":"New File",k=p.trim(),T=k.length>0&&!/[\\/]/.test(k)&&!(h&&k===t.entry.name),P=()=>{T&&(h?f(t.entry,k):g(M,k,d),i())};return e.jsx(Vt,{open:!0,onOpenChange:y=>{y||i()},children:e.jsx(Bt,{className:"name-dialog",children:e.jsxs("form",{className:"name-dialog-content",onSubmit:y=>{y.preventDefault(),P()},children:[e.jsx(qt,{children:D}),e.jsx(Yt,{children:h?e.jsxs(e.Fragment,{children:["Enter a new name for ",e.jsx("code",{children:t.entry.name}),"."]}):e.jsxs(e.Fragment,{children:["Create a new ",d==="directory"?"folder":"file"," in ",e.jsx("code",{children:M||"the repository root"}),"."]})}),e.jsx("input",{autoFocus:!0,className:"name-dialog-input",value:p,maxLength:255,placeholder:h?"New name":d==="directory"?"Folder name":"File name",onChange:y=>o(y.target.value),onFocus:y=>{if(!h)return;const w=t.entry.name.lastIndexOf(".");y.target.setSelectionRange(0,w>0?w:t.entry.name.length)}}),e.jsxs("div",{className:"name-dialog-actions",children:[e.jsx(R,{type:"button",variant:"ghost",onClick:i,children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!T,children:h?"Rename":"Create"})]})]})})})}function yt(t,i,f,g=!0){const[p,o]=a.useState(null);a.useEffect(()=>{if(!g)return;let d=!1;return f(t).then(M=>{d||o({path:t,revision:i,entries:M,failed:!1})},()=>{d||o({path:t,revision:i,entries:[],failed:!0})}),()=>{d=!0}},[t,i,f,g]);const h=g&&p?.path===t;return{entries:h?p.entries:null,failed:h&&p.failed,refreshing:!h||p.revision!==i}}function zn({entries:t,initialDirectory:i,revision:f,readOnly:g,onLoadDirectory:p,onMove:o,onClose:h}){const[d,M]=a.useState(i),[D,k]=a.useState(!1),{entries:T,failed:P,refreshing:y}=yt(d,f,p),w=t.map(j=>j.path),L=T?.filter(j=>j.type==="directory"&&!w.some(te=>Me(te,j.path)))??[],O=!g&&!D&&!y&&T!==null&&!P&&Le(w,d),G=async()=>{if(O){k(!0);try{await o(t,d),h()}finally{k(!1)}}};return e.jsxs(ut,{open:!0,onOpenChange:j=>{!j&&!D&&h()},title:"Move to…",description:`${t.length} selected ${t.length===1?"item":"items"}. Choose a destination folder.`,children:[e.jsxs("div",{className:"mobile-folder-location",children:[d&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Parent folder",disabled:D,onClick:()=>M(Q(d)),children:e.jsx(Gt,{})}),e.jsx("span",{children:d||"Repository root"})]}),e.jsx("div",{className:"mobile-destination-list",children:T===null?e.jsxs("p",{className:"mobile-list-message",role:"status",children:[e.jsx(nt,{className:"animate-spin"})," Loading folders…"]}):P?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):L.length===0?e.jsx("p",{className:"mobile-list-message",children:"No subfolders. You can choose this folder below."}):L.map(j=>e.jsxs("button",{className:"mobile-sheet-action",disabled:D,onClick:()=>M(j.path),children:[e.jsx("img",{src:He(j.path,!1),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{children:j.name}),e.jsx(ye,{})]},j.path))}),e.jsxs("div",{className:"mobile-sheet-footer",children:[e.jsx(R,{variant:"ghost",disabled:D,onClick:h,children:"Cancel"}),e.jsxs(R,{disabled:!O,onClick:()=>{G()},children:[D&&e.jsx(nt,{className:"animate-spin"})," Move here"]})]})]})}const Tn=56;function Ln(t){const[i,f]=a.useState(()=>Q(t.activePath??"")),[g,p]=a.useState(""),[o,h]=a.useState(!1),[d,M]=a.useState(new Map),[D,k]=a.useState(null),[T,P]=a.useState(null),[y,w]=a.useState(null),L=a.useRef(null),O=a.useRef(new Map),G=a.useRef(t.activePath),{entries:j,failed:te}=yt(i,t.filesSnapshotRevision,t.onLoadDirectory,t.active),K=a.useMemo(()=>(j??[]).filter(u=>(t.showDotEnvFiles||!u.ignored)&&u.name.toLocaleLowerCase().includes(g.toLocaleLowerCase())),[j,t.showDotEnvFiles,g]),ne=dt({count:K.length,enabled:t.active&&j!==null,getScrollElement:()=>L.current,estimateSize:()=>Tn,getItemKey:u=>K[u].path,overscan:8,paddingEnd:12});a.useEffect(()=>{t.activePath!==G.current&&(G.current=t.activePath,t.activePath&&(f(Q(t.activePath)),p("")))},[t.activePath]),a.useEffect(()=>{if(!j)return;const u=new Set(j.map(x=>x.path));M(x=>{const b=new Map([...x].filter(([H])=>u.has(H)));return b.size===x.size?x:b})},[j]),a.useEffect(()=>{j&&L.current&&(L.current.scrollTop=O.current.get(i)??0)},[i,j]),a.useEffect(()=>{if(!t.files||!i||st(t.files,i)!=="missing")return;let u=Q(i);for(;u&&st(t.files,u)==="missing";)u=Q(u);f(u),p(""),M(new Map)},[t.files,i]);const W=u=>{f(u),p(""),M(new Map)},ce=u=>M(x=>{const b=new Map(x);return b.has(u.path)?b.delete(u.path):b.set(u.path,u),b}),se={type:"directory",path:i,name:i.split("/").pop()??"",children:[]},X=[...d.values()],v=D&&D!=="tools"?D:null,C=u=>{k(null),u()};return e.jsxs("div",{className:"mobile-files-view",children:[e.jsxs("div",{className:"mobile-view-heading",children:[e.jsxs("h2",{children:[o?"Select items":"Files",o&&e.jsx("small",{children:d.size})]}),e.jsxs("div",{children:[e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":o,onClick:()=>{h(!o),M(new Map)},children:o?"Cancel":"Select"}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"File browser actions",onClick:()=>k("tools"),children:e.jsx($e,{})})]})]}),e.jsxs("label",{className:"mobile-file-filter",children:[e.jsx(_e,{"aria-hidden":"true"}),e.jsx("input",{type:"search",value:g,placeholder:"Filter this folder…","aria-label":"Filter this folder",onChange:u=>{p(u.target.value),O.current.set(i,0),L.current?.scrollTo({top:0})}})]}),e.jsxs("nav",{className:"mobile-file-breadcrumb","aria-label":"Folder location",children:[e.jsxs("button",{onClick:()=>W(""),"aria-current":i===""?"location":void 0,children:[e.jsx(at,{"aria-hidden":"true"})," Root"]}),i.split("/").filter(Boolean).map((u,x,b)=>{const H=b.slice(0,x+1).join("/");return e.jsxs("span",{children:[e.jsx(ye,{"aria-hidden":"true"}),e.jsx("button",{"aria-current":H===i?"location":void 0,onClick:()=>W(H),children:u})]},H)})]}),e.jsx("div",{className:"mobile-files-scroll",ref:L,onScroll:u=>O.current.set(i,u.currentTarget.scrollTop),children:j===null?e.jsx("p",{className:"mobile-list-message",role:"status",children:"Loading files…"}):te?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):K.length===0?e.jsx("p",{className:"mobile-list-message",children:g?"No matching files in this folder.":"This folder is empty."}):e.jsx("div",{className:"virtual-list",role:"list","aria-label":"Files in this folder",style:{height:ne.getTotalSize()},children:ne.getVirtualItems().map(u=>{const x=K[u.index],b=d.has(x.path);return e.jsxs("div",{role:"listitem",className:`mobile-file-row ${b?"selected":""}`,style:{height:u.size,transform:`translateY(${u.start}px)`},children:[e.jsxs("button",{className:"mobile-file-open","aria-pressed":o?b:void 0,"aria-current":t.activePath===x.path?"true":void 0,onClick:()=>o?ce(x):x.type==="directory"?W(x.path):t.onOpenFile(x.path),children:[o?e.jsx("span",{className:`mobile-file-check ${b?"checked":""}`,children:b&&e.jsx(Wt,{"aria-hidden":"true"})}):e.jsx("img",{src:x.type==="directory"?He(x.path,!1):ht(x.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsxs("span",{className:"mobile-file-copy",children:[e.jsx("strong",{children:x.name}),e.jsx("small",{children:x.type==="directory"?x.ignored?"Ignored folder":"Folder":`${x.ignored?"Ignored · ":""}${Math.max(1,Math.ceil(x.size/1024))} KB`})]}),!o&&x.type==="directory"&&e.jsx(ye,{"aria-hidden":"true"})]}),!o&&e.jsx(R,{variant:"ghost",size:"icon",className:"mobile-file-menu","aria-label":`Actions for ${x.name}`,onClick:()=>k(x),children:e.jsx($e,{})})]},x.path)})})}),o&&e.jsxs("div",{className:"mobile-file-selection-actions",children:[e.jsxs(R,{variant:"ghost",size:"sm",disabled:t.readOnly||d.size===0,onClick:()=>w(X),children:[e.jsx(lt,{})," Move to…"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:d.size===0,onClick:()=>{t.fileClipboardAvailable?t.onCopyEntries(X):t.onCopyPath(X)},children:[e.jsx(be,{})," ",t.fileClipboardAvailable?"Copy":"Copy paths"]}),t.fileClipboardAvailable&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Cut selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onCutEntries(X)},children:e.jsx(Oe,{})}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Delete selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onDeleteEntries(X)},children:e.jsx(Ae,{})})]}),e.jsx(ut,{open:D!==null,onOpenChange:u=>{u||k(null)},title:v?.name??"File browser actions",description:v?.path??"Actions for the current folder.",children:v?e.jsxs(e.Fragment,{children:[v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>t.onOpenFile(v.path,"pinned")),children:[e.jsx(Ee,{}),e.jsx("span",{children:"Keep file open"})]}),v.type==="directory"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>W(v.path)),children:[e.jsx(at,{}),e.jsx("span",{children:"Open folder"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>w([v])),children:[e.jsx(lt,{}),e.jsx("span",{children:"Move to…"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>P({mode:"rename",entry:v})),children:[e.jsx(xt,{}),e.jsx("span",{children:"Rename"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyEntries([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onCutEntries([v])}),children:[e.jsx(Oe,{}),e.jsx("span",{children:"Cut"})]}),e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyPath([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy path"})]}),v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyContents(v)}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy contents"})]}),t.revealAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onReveal(v)}),children:[e.jsx(ft,{}),e.jsx("span",{children:"Reveal in file manager"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(v.type==="directory"?v.path:Q(v.path))}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action destructive",disabled:t.readOnly,onClick:()=>C(()=>{t.onDeleteEntries([v])}),children:[e.jsx(Ae,{}),e.jsx("span",{children:"Delete"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(t.onQuickOpen),children:[e.jsx(_e,{}),e.jsx("span",{children:"Find file in repository"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>P({mode:"new-file",entry:se})),children:[e.jsx(Ee,{}),e.jsx("span",{children:"New file"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>P({mode:"new-folder",entry:se})),children:[e.jsx(Be,{}),e.jsx("span",{children:"New folder"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(i)}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canUndo,onClick:()=>C(()=>{t.onUndo()}),children:[e.jsx(pt,{}),e.jsx("span",{children:t.historyState.undoLabel?`Undo ${t.historyState.undoLabel}`:"Undo"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canRedo,onClick:()=>C(()=>{t.onRedo()}),children:[e.jsx(gt,{}),e.jsx("span",{children:t.historyState.redoLabel?`Redo ${t.historyState.redoLabel}`:"Redo"})]})]})}),e.jsx(bt,{state:T,onClose:()=>P(null),onRename:t.onRename,onCreate:t.onCreate}),y&&e.jsx(zn,{entries:y,initialDirectory:i,revision:t.filesSnapshotRevision,readOnly:t.readOnly,onLoadDirectory:t.onLoadDirectory,onMove:t.onMoveEntries,onClose:()=>{w(null),M(new Map)}})]})}function es(t){return mt()?e.jsx(Ln,{...t}):e.jsx(Hn,{...t})}const $n=29,Se=6,vt="files-tree-root-drop",_n=550,An={duration:160,easing:"cubic-bezier(0.2, 0, 0, 1)"},rt=6,On=t=>{const i=dn(t),f=i.length>0?i:un(t),g=f.find(p=>p.id!==vt);return g?[g]:f.slice(0,1)};function Ct(t,i,f=0){const g=[];for(const p of t)g.push({entry:p,depth:f}),p.type==="directory"&&i.has(p.path)&&g.push(...Ct(p.children,i,f+1));return g}function Kn(t,i,f){const g=t.findIndex(d=>d.entry.path===i),p=t.findIndex(d=>d.entry.path===f);if(g===-1||p===-1)return[f];const[o,h]=g<=p?[g,p]:[p,g];return t.slice(o,h+1).map(d=>d.entry.path)}function Ke(t){return t.type==="directory"?t.path:Q(t.path)}function Hn({active:t,initialExpandedPaths:i,files:f,filesSnapshotRevision:g,showDotEnvFiles:p,activePath:o,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onQuickOpen:k,onUndo:T,onRedo:P,onOpenFile:y,onLoadDirectory:w,onPersistExpandedPaths:L,onCopyPath:O,onCopyEntries:G,onCutEntries:j,onCopyContents:te,onPaste:K,onMoveEntries:ne,onDeleteEntries:W,onReveal:ce,onRename:se,onCreate:X}){const v=Xt(),C=mt(),[u,x]=a.useState(!1),b=C?44:$n,H=a.useRef(null),ae=a.useRef(null),[S,U]=a.useState(new Set),[ve,ie]=a.useState(o),[oe,Z]=a.useState(o),[A,de]=a.useState(()=>new Set(i)),[Ce,ue]=a.useState([]),[$,J]=a.useState(null),[he,Ie]=a.useState(null),[Ye,kt]=a.useState(null),[Nt,wt]=a.useState(!1),[Dt,ee]=a.useState(null),[ke,St]=a.useState(0),[V,Ne]=a.useState(new Map),Mt=Qt(it(Jt,{activationConstraint:{distance:5}}),it(Zt)),Ge=a.useRef(V),fe=a.useRef(new Set),We=a.useRef(0),B=a.useRef(null),me=a.useRef(null),Xe=a.useRef(i.join("\0")),we=a.useMemo(()=>new Set(V.keys()),[V]),q=a.useMemo(()=>f===null?null:en(f,V),[f,V]),N=a.useMemo(()=>q===null?null:p?q:tn(q),[q,p]);a.useEffect(()=>{Ge.current=V},[V]),a.useEffect(()=>{kt(document.getElementById(nn))},[o]),a.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>wt(n.matches);return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),a.useEffect(()=>()=>{B.current&&clearTimeout(B.current)},[]),a.useEffect(()=>{const n=++We.current,s=[...Ge.current.keys()];s.length!==0&&Promise.all(s.map(async l=>({path:l,children:await w(l)}))).then(l=>{if(n!==We.current)return;const r=new Map(l.map(({path:m,children:c})=>[m,c]));Ne(m=>sn(m,r))})},[g,w]),a.useEffect(()=>{if(!q){fe.current.clear(),Ne(n=>n.size===0?n:new Map);return}de(n=>{const s=new Set(an(q,n,we).retained);return ct(n,s)?n:s})},[we,q]),a.useEffect(()=>{if(!q)return;const n=on(q,A,we),s=n.join("\0");s!==Xe.current&&(Xe.current=s,L(n))},[A,we,q,L]),a.useEffect(()=>{if(!t||!N)return;let n=Math.max(0,2-fe.current.size);for(const s of A){if(n===0)break;const l=Y(N,s);!l||l.type!=="directory"||l.ignored!==!0||l.children.length>0||V.has(s)||fe.current.has(s)||(fe.current.add(s),n-=1,w(s).catch(()=>[]).then(r=>{Ne(m=>new Map(m).set(s,r))}).finally(()=>{fe.current.delete(s)}))}},[t,A,V,w,N]),a.useEffect(()=>{t||(ee(null),ue([]),J(null),Ie(null),B.current&&clearTimeout(B.current),B.current=null,me.current=null)},[t]),a.useEffect(()=>{N&&(U(n=>{if(n.size===0)return n;const s=new Set([...n].filter(l=>Y(N,l)));return s.size===n.size?n:s}),ie(n=>n&&Y(N,n)?n:null),Z(n=>n&&Y(N,n)?n:o&&Y(N,o)?o:null))},[o,N]);const E=a.useMemo(()=>N?Ct(N,A):[],[A,N]),le=dt({enabled:t,count:E.length,getScrollElement:()=>H.current,estimateSize:()=>b,getItemKey:n=>E[n]?.entry.path??n,overscan:12,paddingStart:Se,paddingEnd:12});a.useEffect(()=>{le.measure()},[le,b]),a.useEffect(()=>{!t||!o||!N||!Y(N,o)||de(n=>{const s=new Set(n);let l=!1;const r=o.split("/");let m="";for(let c=0;c<r.length-1;c+=1)m=m?`${m}/${r[c]}`:r[c],s.has(m)||(s.add(m),l=!0);return l?s:n})},[t,o,N]),a.useEffect(()=>{if(!t)return;if(!o){ae.current=null;return}if(ae.current===o)return;const n=E.findIndex(s=>s.entry.path===o);n>=0&&(le.scrollToIndex(n,{align:"auto"}),ae.current=o)},[t,o,E]);const Qe=a.useMemo(()=>{const n=new Map;for(const s of E)n.set(s.entry.path,s);return n},[E]),xe=a.useMemo(()=>{const n={headers:[],push:0};if(E.length===0||!o)return n;const s=new Set,l=o.split("/");let r="";for(let F=0;F<l.length-1;F+=1)r=r?`${r}/${l[F]}`:l[F],s.add(r);if(s.size===0)return n;const m=Math.min(E.length-1,Math.max(0,Math.floor((ke-Se)/b))),c=E[m];if(!c)return n;const I=c.entry.path.split("/"),_=[];let ge="";for(let F=0;F<I.length-1;F+=1){if(ge=ge?`${ge}/${I[F]}`:I[F],!s.has(ge))continue;const Te=Qe.get(ge);Te&&Te.entry.type==="directory"&&_.push(Te)}if(_.length>rt&&_.splice(0,_.length-rt),_.length===0)return n;const Ot=_[_.length-1],et=_.length*b;let tt=1/0;const Kt=Math.ceil((ke+et-Se)/b)+2;for(let F=m;F<E.length&&F<=Kt;F+=1)if(E[F].depth<=Ot.depth){tt=Se+F*b;break}const Ht=Math.max(0,Math.min(b,et-(tt-ke)));return{headers:_,push:Ht}},[E,Qe,ke,o,b]);if(N===null)return e.jsx("div",{className:"view-loading",role:"status",hidden:!t,children:e.jsx(ln,{text:"Loading files…"})});const Rt=u||S.size>0?S:o?new Set([o]):new Set,Et=S.size>0?[...S]:o?[o]:[],Fe=n=>{const s=[];for(const l of n){const r=Y(N,l);r&&s.push(r)}return s},Pe=n=>{U(new Set([n])),ie(n),Z(n)},It=n=>{const s=E.findIndex(l=>l.entry.path===n.path);s>=0&&le.scrollToIndex(s,{align:"start"})},Ft=(n,s)=>{if(C&&u){U(l=>{const r=new Set(l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r});return}if(s.shift&&(ve||oe)){const l=Kn(E,ve??oe,n.path);U(new Set(l)),Z(n.path);return}if(s.ctrl){U(l=>{const r=new Set(l.size===0&&o?[o]:l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r}),ie(n.path),Z(n.path),n.type==="file"&&y(n.path,"pinned");return}Pe(n.path),n.type==="file"?y(n.path):Ze(n.path)},Pt=n=>{!(C&&u)&&n.type==="file"&&y(n.path,"pinned")},zt=n=>{S.has(n.path)||Pe(n.path)},De=n=>S.has(n.path)&&S.size>0?Fe(S):[n],Tt=n=>{if(hn(n.target))return;const s=fn(n.nativeEvent,v);if(s==="undo"&&D.canUndo&&!h){n.preventDefault(),n.repeat||T();return}if(s==="redo"&&D.canRedo&&!h){n.preventDefault(),n.repeat||P();return}const l=(n.ctrlKey||n.metaKey)&&!n.altKey,r=n.key.toLowerCase();if(l&&r==="a"){n.preventDefault(),U(new Set(E.map(I=>I.entry.path)));return}const m=Fe(Et),c=oe?Y(N,oe):null;if(l&&r==="c"&&m.length){n.preventDefault(),G(m);return}if(l&&r==="x"&&m.length&&!h){n.preventDefault(),j(m);return}if(l&&r==="v"&&!h&&d){n.preventDefault();const I=c?Ke(c):Q(m[0]?.path??"");K(I);return}if(n.key==="F2"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h){if(S.size===1){const I=Y(N,[...S][0]);I&&(n.preventDefault(),ee({mode:"rename",entry:I}))}return}n.key==="Delete"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h&&m.length&&(n.preventDefault(),W(m))},Lt=async(n,s)=>{const l=Fe(n);l.length&&await ne(l,s)},Ze=(n,s=!1)=>{const l=!s&&A.has(n),r=l&&Y(N??[],n)?.ignored===!0;de(m=>{const c=new Set(m);if(s||!c.has(n)){if(c.has(n))return m;c.add(n)}else if(r)for(const I of c)Me(n,I)&&c.delete(I);else c.delete(n);return ct(m,c)?m:c}),l&&Ne(m=>{const c=[...m.keys()].filter(_=>Me(n,_));if(c.length===0)return m;const I=new Map(m);for(const _ of c)I.delete(_);return I})},pe=()=>{B.current&&clearTimeout(B.current),B.current=null,me.current=null},Je=()=>{pe(),ue([]),J(null),Ie(null)},ze=n=>{const s=n.active.data.current;return s?.entry&&Array.isArray(s.sourcePaths)?{entry:s.entry,sourcePaths:s.sourcePaths}:null},$t=n=>{const s=ze(n);s&&(S.has(s.entry.path)||Pe(s.entry.path),ue(s.sourcePaths),Ie({entry:s.entry,sourcePaths:s.sourcePaths,count:s.sourcePaths.length}))},_t=n=>{const s=ze(n);if(n.over?.data.current?.openPinned===!0){J(null),pe();return}const l=n.over?.data.current?.targetDirectory;if(!s||typeof l!="string"||!Le(s.sourcePaths,l)){J(null),pe();return}J(l);const r=n.over?.data.current?.expandPath;if(typeof r!="string"||A.has(r)){pe();return}me.current!==r&&(pe(),me.current=r,B.current=setTimeout(()=>{Ze(r,!0),B.current=null,me.current=null},_n))},At=n=>{const s=ze(n),l=n.over?.data.current?.openPinned===!0,r=n.over?.data.current?.targetDirectory;if(Je(),s&&l&&ot(s.entry,s.sourcePaths)){y(s.entry.path,"pinned");return}s&&typeof r=="string"&&Le(s.sourcePaths,r)&&Lt(s.sourcePaths,r)};return e.jsxs(rn,{sensors:Mt,collisionDetection:On,autoScroll:{enabled:!0,threshold:{x:.1,y:.16},acceleration:12},onDragStart:$t,onDragOver:_t,onDragCancel:Je,onDragEnd:At,children:[e.jsxs("div",{className:"files-mobile-tools",children:[e.jsxs(R,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(_e,{})," Find file"]}),e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":u,onClick:()=>{x(!u),U(new Set)},children:u?`Done (${S.size})`:"Select"}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-file",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Ee,{})," New file"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-folder",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Be,{})," Folder"]}),d&&e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>{K("")},children:[e.jsx(Re,{})," Paste"]})]}),e.jsxs("div",{ref:H,className:"files-view virtual-scroll",hidden:!t,onScroll:n=>St(n.currentTarget.scrollTop),children:[xe.headers.length>0&&e.jsx("div",{className:"files-sticky",children:xe.headers.map((n,s)=>{const l=s===xe.headers.length-1;return e.jsxs("button",{type:"button",className:"file-tree-row files-sticky-row","aria-label":`Scroll to ${n.entry.path}`,style:{top:s*b-(l?xe.push:0),paddingLeft:12+n.depth*14,zIndex:xe.headers.length-s},onClick:()=>It(n.entry),children:[e.jsx(ye,{className:"folder-chevron open"}),e.jsx(qe,{path:n.entry.path,type:"directory",expanded:!0}),e.jsx("span",{children:n.entry.name})]},n.entry.path)})}),N.length?e.jsx(Un,{role:"tree","aria-label":"Files",className:`files-tree ${$===""&&Ce.length>0?"root-drop-target":""}`,style:{height:le.getTotalSize()},tabIndex:0,onKeyDown:Tt,onPointerDown:n=>{n.target.closest(".file-tree-row, .file-touch-actions")||(U(new Set),ie(null),Z(null),n.currentTarget.focus())},children:le.getVirtualItems().map(n=>{const{entry:s,depth:l}=E[n.index],r=s.type==="directory"&&A.has(s.path),m=S.has(s.path)&&S.size>1;return e.jsx("div",{className:"virtual-row",style:{height:n.size,transform:`translateY(${n.start}px)`},children:e.jsx(qn,{entry:s,depth:l,expanded:r,pendingChildren:s.type==="directory"&&s.ignored===!0&&s.children.length===0&&!V.has(s.path),selected:Rt.has(s.path),active:o===s.path,multiSelected:m,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onUndo:T,onRedo:P,draggedPaths:Ce,dropTargetPath:$,onFocus:Z,onRowClick:Ft,onRowDoubleClick:Pt,onRowContextMenu:zt,onOpen:c=>y(c.path),onOpenPinned:c=>y(c.path,"pinned"),onCopy:c=>{G(De(c))},onCut:c=>{j(De(c))},onPasteInto:c=>{K(Ke(c))},onCopyPath:c=>{O(De(c))},onCopyContents:te,onRename:c=>ee({mode:"rename",entry:c}),onNewFile:c=>ee({mode:"new-file",entry:c}),onNewFolder:c=>ee({mode:"new-folder",entry:c}),onReveal:ce,onDelete:c=>{W(De(c))},dragPaths:S.has(s.path)&&S.size>0?[...S]:[s.path]})},n.key)})}):e.jsx("p",{className:"empty-list",children:"No files."}),e.jsx(bt,{state:Dt,onClose:()=>ee(null),onRename:se,onCreate:X})]}),e.jsx(cn,{dropAnimation:Nt?null:An,children:he&&e.jsx(Bn,{preview:he})}),Ye&&Ut.createPortal(e.jsx(Vn,{visible:!!(he&&ot(he.entry,he.sourcePaths))}),Ye)]})}function Un(t){const{setNodeRef:i}=Ue({id:vt,data:{targetDirectory:"",expandPath:null}});return e.jsx("div",{ref:i,...t})}function Vn({visible:t}){const{isOver:i,setNodeRef:f}=Ue({id:"files-open-pinned-drop",data:{openPinned:!0}});return e.jsxs("div",{ref:f,className:`open-files-drop-target ${t?"visible":""} ${t&&i?"over":""}`,"aria-hidden":"true",children:[e.jsx(jt,{}),e.jsx("span",{children:"Drop to open beside"})]})}function Bn({preview:t}){return e.jsxs("div",{className:"file-drag-overlay",children:[e.jsx(qe,{path:t.entry.path,type:t.entry.type,expanded:!1}),e.jsx("span",{children:t.entry.name}),t.count>1&&e.jsx("strong",{children:t.count})]})}function ct(t,i){if(t.size!==i.size)return!1;for(const f of t)if(!i.has(f))return!1;return!0}function qn({entry:t,depth:i,expanded:f,pendingChildren:g,selected:p,active:o,multiSelected:h,readOnly:d,fileClipboardAvailable:M,revealAvailable:D,historyState:k,onUndo:T,onRedo:P,draggedPaths:y,dropTargetPath:w,onFocus:L,onRowClick:O,onRowDoubleClick:G,onRowContextMenu:j,onOpen:te,onOpenPinned:K,onCopy:ne,onCut:W,onPasteInto:ce,onCopyPath:se,onCopyContents:X,onRename:v,onNewFile:C,onNewFolder:u,onReveal:x,onDelete:b,dragPaths:H}){const ae=a.useRef(null),S=Ke(t),{attributes:U,listeners:ve,setNodeRef:ie,isDragging:oe}=mn({id:`file-drag:${t.path}`,data:{sourcePaths:H,entry:t},disabled:d}),{setNodeRef:Z}=Ue({id:`file-drop:${t.path}`,data:{targetDirectory:S,expandPath:t.type==="directory"?t.path:null}}),A=$=>{ae.current=$,ie($),Z($)},de=y.length>0&&t.type==="directory"&&w===t.path,Ce=y.length>0&&w!==null&&w!==""&&w!==t.path&&Me(w,t.path),ue=e.jsxs("button",{type:"button",ref:A,...U,role:"treeitem","aria-selected":p,"aria-current":o?"true":void 0,"aria-expanded":t.type==="directory"?f:void 0,className:["file-tree-row",t.ignored?"ignored-file":"",y.includes(t.path)||oe?"dragging":"",de?"drop-target":"",Ce?"drop-target-region":""].filter(Boolean).join(" "),style:{paddingLeft:12+i*14},...ve,onClick:$=>O(t,{ctrl:$.ctrlKey||$.metaKey,shift:$.shiftKey}),onDoubleClick:()=>G(t),onFocus:()=>L(t.path),onContextMenu:()=>j(t),children:[t.type==="directory"?e.jsx(ye,{className:`folder-chevron ${f?"open":""} ${t.children.length===0&&!g?"empty":""}`}):e.jsx("span",{className:"tree-spacer"}),e.jsx(qe,{path:t.path,type:t.type,expanded:f}),e.jsx("span",{children:t.name})]});return e.jsxs(In,{children:[e.jsx(Fn,{render:ue}),e.jsx("button",{type:"button",className:"file-touch-actions","aria-label":`Actions for ${t.name}`,"aria-haspopup":"menu",onClick:$=>{$.stopPropagation();const J=$.currentTarget.getBoundingClientRect();ae.current?.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:J.left,clientY:J.bottom}))},children:e.jsx($e,{})}),e.jsxs(Pn,{children:[t.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsxs(z,{onClick:()=>te(t),children:[e.jsx(xn,{"aria-hidden":"true"})," Open"]}),e.jsxs(z,{onClick:()=>K(t),children:[e.jsx(jt,{"aria-hidden":"true"})," Open to the Side ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Click"})]}),e.jsx(je,{})]}),e.jsxs(z,{disabled:d||!k.canUndo,onClick:()=>{T()},children:[e.jsx(pt,{"aria-hidden":"true"})," ",k.undoLabel?`Undo ${k.undoLabel}`:"Undo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Z"})]}),e.jsxs(z,{disabled:d||!k.canRedo,onClick:()=>{P()},children:[e.jsx(gt,{"aria-hidden":"true"})," ",k.redoLabel?`Redo ${k.redoLabel}`:"Redo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Shift+Z"})]}),e.jsx(je,{}),e.jsxs(z,{onClick:()=>ne(t),children:[e.jsx(pn,{"aria-hidden":"true"})," Copy ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+C"})]}),e.jsxs(z,{disabled:d,onClick:()=>W(t),children:[e.jsx(Oe,{"aria-hidden":"true"})," Cut ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+X"})]}),M&&e.jsxs(z,{disabled:d,onClick:()=>ce(t),children:[e.jsx(Re,{"aria-hidden":"true"})," Paste ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+V"})]}),e.jsx(je,{}),e.jsxs(z,{disabled:d||h,onClick:()=>v(t),children:[e.jsx(xt,{"aria-hidden":"true"})," Rename ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"F2"})]}),e.jsxs(z,{disabled:d||h,onClick:()=>C(t),children:[e.jsx(Ee,{"aria-hidden":"true"})," New File…"]}),e.jsxs(z,{disabled:d||h,onClick:()=>u(t),children:[e.jsx(Be,{"aria-hidden":"true"})," New Folder…"]}),e.jsx(je,{}),e.jsxs(z,{onClick:()=>se(t),children:[e.jsx(gn,{"aria-hidden":"true"})," Copy path"]}),e.jsxs(z,{disabled:t.type!=="file"||h,onClick:()=>{X(t)},children:[e.jsx(be,{"aria-hidden":"true"})," Copy contents"]}),D&&e.jsxs(z,{disabled:h,onClick:()=>{x(t)},children:[e.jsx(ft,{"aria-hidden":"true"})," Reveal in File Explorer"]}),e.jsx(je,{}),e.jsxs(z,{className:"text-destructive data-highlighted:text-destructive",disabled:d,onClick:()=>b(t),children:[e.jsx(Ae,{"aria-hidden":"true"})," Delete ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Del"})]})]})]})}function qe({path:t,type:i,expanded:f=!1}){const g=i==="file"?ht(t):He(t,f);return e.jsx("img",{className:"vscode-tree-icon",src:g,alt:"","aria-hidden":"true"})}export{es as FilesView};
@@ -1 +0,0 @@
1
- import{r as w,j as e}from"./react-rd22PHbN.js";import{V as ne,g as J,q as Q,W as ae,X as re,Y as oe,Z as ie,_ as le,A as ce,B as de,w as he,$ as ue,a0 as me,a1 as pe}from"./App-Dfm5F199.js";import{a as xe}from"./tanstack-CcfAJoQ7.js";import{T as N,b as C,d as v,B as _,o as je,w as fe,s as K}from"./index-B5RC4THs.js";import"./base-ui-CJ8ZIx3d.js";function ge(s){let n=[],a=s.some(r=>r.color!==void 0)?3:0,t=1;const o=new Map,j=[],i=new Map(s.map(r=>[r.oid,r])),u=new Set;let d=s[0];for(;d&&!u.has(d.oid);)u.add(d.oid),d.color!==void 0&&o.set(d.oid,d.color),d=i.get(d.parentOids[0]??"");for(const r of s){let h=n.indexOf(r.oid);const p=h>=0;h<0&&(h=n.length,n=[...n,r.oid]);const f=n,$=be(o,r.oid,()=>r.color??a++),x=$<3?r.color??$:$;o.set(r.oid,x);const y=f.filter((g,l)=>l!==h);let P=Math.min(h,y.length);r.parentOids.forEach((g,l)=>{o.has(g)||o.set(g,l===0?x:a++),!y.includes(g)&&(y.splice(P,0,g),P+=1)});const E=[];f.forEach((g,l)=>{if(l===h){p&&E.push({fromLane:l,from:"top",toLane:h,to:"node",color:$});return}const A=y.indexOf(g);A>=0&&E.push({fromLane:l,from:"top",toLane:A,to:"bottom",color:o.get(g)??0})}),r.parentOids.forEach(g=>{const l=y.indexOf(g);l>=0&&E.push({fromLane:h,from:"node",toLane:l,to:"bottom",color:o.get(g)??x})}),t=Math.max(t,f.length,y.length),j.push({lane:h,color:x,segments:E,continuations:y.map((g,l)=>({lane:l,color:o.get(g)??0}))}),n=y}return{rows:j,laneCount:t}}function be(s,n,a){const t=s.get(n);if(t!==void 0)return t;const o=a();return s.set(n,o),o}function ye(s){const n=s.parentCount>1&&/^Merge pull request #(\d+)\b/i.exec(s.subject),a=/\(#(\d+)\)\s*$/.exec(s.subject),t=n||a;if(!t)return null;const o=Number(t[1]);return Number.isSafeInteger(o)&&o>0?{number:o,source:n?"merge":"subject"}:null}function Ne(s){if(s.upstreamState==="local-only")return 0;if(s.baseState==="included")return 2;if(s.upstreamState==="published")return 1}function Ce(s,n){if(!n)return s.map(i=>({commit:i,parentOids:i.parentOids,grouped:[]}));const a=new Map(s.map(i=>[i.oid,i])),t=new Map;s.forEach(i=>i.parentOids.forEach(u=>{const d=t.get(u)??new Set;d.add(i.oid),t.set(u,d)}));const o=new Set,j=[];for(const i of s){if(o.has(i.oid))continue;const u={commit:i,parentOids:i.parentOids,grouped:[]};if(j.push(u),i.parentOids.length!==2)continue;const d=new Set;let r=a.get(i.parentOids[0]);for(;r&&!d.has(r.oid);)d.add(r.oid),r=a.get(r.parentOids[0]??"");let h=i.parentOids[1];const p=[],f=new Set;for(;!d.has(h);){const x=a.get(h);if(!x||f.has(h)||o.has(h)||x.isHead||x.parentOids.length!==1)break;f.add(h),p.push(x),h=x.parentOids[0]}if(!d.has(h)||p.length===0)continue;const $=new Set([i.oid,...p.map(x=>x.oid)]);p.some(x=>[...t.get(x.oid)??[]].some(y=>!$.has(y)))||p.some(x=>j.some(y=>y.commit.oid===x.oid))||(u.grouped=p,u.parentOids=[i.parentOids[0]],p.forEach(x=>o.add(x.oid)))}return j}function Z(s,n){const a=n.trim().toLocaleLowerCase();return a.length>0&&[s.subject,s.author,s.oid,...s.decorations].some(t=>t.toLocaleLowerCase().includes(a))}function Fe({repositoryId:s,upstream:n,readOnly:a,operation:t,canPublish:o,pushBusy:j,onPublish:i,commits:u,nextCursor:d,loading:r,undoing:h,baseRef:p,activeOid:f,onSelectReference:$,onSelectCommit:x,onSelectFile:y,onUndo:P,onMore:E}){const g=ne(),l=w.useRef(null),[A,L]=w.useState(new Set),[M,T]=w.useState(!0),[O,G]=w.useState(!1),[S,R]=w.useState(""),[q,V]=w.useState(-1),c=g?52:M?42:56,b=w.useMemo(()=>Ce(u??[],O&&!S.trim()),[u,O,S]),U=w.useMemo(()=>ge(b.map(({commit:m,parentOids:k})=>({oid:m.oid,parentOids:k,color:Ne(m)}))),[b]),F=w.useMemo(()=>b.flatMap(({commit:m},k)=>Z(m,S)?[k]:[]),[b,S]),se=$e(U.laneCount),H=xe({count:b.length,getScrollElement:()=>l.current,estimateSize:()=>c,getItemKey:m=>b[m].commit.oid,overscan:8});w.useEffect(()=>{H.measure()},[H,M,O,S,g]);const W=()=>{if(!F.length)return;const m=(q+1)%F.length;V(m),H.scrollToIndex(F[m],{align:"center"})};if(u===null)return e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Q,{text:"Loading history…"})]});const z=u.filter(m=>m.upstreamState==="local-only").length;return e.jsxs("div",{className:"history-list",style:{"--history-row-height":`${c}px`},children:[e.jsxs("div",{className:"history-toolbar",children:[e.jsxs("label",{className:"history-search",children:[e.jsx(ae,{"aria-hidden":"true"}),e.jsx("input",{type:"search","aria-label":"Search loaded commits",placeholder:"Find commit…",value:S,onChange:m=>{R(m.target.value),V(-1)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),W())}})]}),S&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-next-match",onClick:W,disabled:!F.length,"aria-label":"Next matching commit"}),children:e.jsx(re,{})}),e.jsx(v,{children:"Next match in loaded history (Enter)"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":O,disabled:!u.some(m=>m.parentCount>1),onClick:()=>G(!O)}),children:"Group merges"}),e.jsx(v,{children:"Collapse complete merge branches. Searching reveals their commits."})]}),!g&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":M,onClick:()=>T(!M)}),children:M?"Compact":"Comfortable"}),e.jsx(v,{children:"Change row density without moving the diff viewer"})]})]}),!n&&u.length>0&&e.jsxs("div",{className:"history-upstream-notice",role:"status",children:[e.jsx("span",{children:"Publish this branch to configure an upstream and distinguish local from published commits."}),o&&e.jsx(_,{variant:"outline",size:"xs",disabled:j||a||!!t,onClick:i,children:j?"Publishing…":"Publish branch"})]}),n&&z>0&&e.jsxs("div",{className:"history-local-summary",children:["↑ ",z," ",z===1?"local commit":"local commits"," in loaded history"]}),e.jsx("div",{ref:l,className:"history-scroll",role:"list","aria-label":"Commit history",children:b.length===0?e.jsx("p",{className:"empty-list",children:"This repository has no commits yet."}):e.jsxs("div",{className:"virtual-list",style:{height:H.getTotalSize()+(d?52:0)},children:[H.getVirtualItems().map(m=>{const{commit:k,grouped:X}=b[m.index];return e.jsx("div",{ref:H.measureElement,"data-index":m.index,className:"virtual-row",style:{transform:`translateY(${m.start}px)`},children:e.jsx(ve,{repositoryId:s,upstream:n,baseRef:p,commit:k,graphRow:U.rows[m.index],graphWidth:se,rowHeight:c,active:f===k.oid||X.some(Y=>Y.oid===f),match:Z(k,S),groupedCount:X.length,onRevealGroup:()=>G(!1),onSelectReference:$,expanded:A.has(k.oid),onExpandedChange:Y=>L(te=>{const B=new Set(te);return Y?B.add(k.oid):B.delete(k.oid),B}),canUndo:!a&&!t&&!h&&k.upstreamState==="local-only"&&k.isHead&&k.parentCount===1,onSelectCommit:x,onSelectFile:y,onUndo:P})},m.key)}),d&&e.jsx(_,{variant:"ghost",className:"history-more",style:{top:H.getTotalSize()},disabled:r,onClick:E,children:r?"Loading…":"Load more"})]})}),u.length>0&&e.jsxs("div",{className:"history-legend",children:[e.jsxs("span",{children:[e.jsx("i",{"data-color":"local"}),"Local"]}),e.jsxs("span",{children:[e.jsx("i",{"data-color":"published"}),"Published"]}),p&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"history-base-label"}),children:[e.jsx("i",{"data-color":"base"}),p]}),e.jsxs(v,{children:["Primary-line commits reachable from ",p,", using the latest known local refs. Side branches use the published color."]})]}),e.jsx("span",{className:"history-count",role:"status",children:S?`${F.length} matches in ${u.length} loaded`:`${u.length} loaded`})]})]})}function ve({repositoryId:s,upstream:n,baseRef:a,commit:t,graphRow:o,graphWidth:j,rowHeight:i,active:u,match:d,groupedCount:r,onRevealGroup:h,onSelectReference:p,expanded:f,onExpandedChange:$,canUndo:x,onSelectCommit:y,onSelectFile:P,onUndo:E}){const g=`${s}:${t.oid}`,[l,A]=w.useState(()=>oe(g)??null),[L,M]=w.useState(null);w.useEffect(()=>{if(!f||l||L)return;let c=!0;return je.commits.files(s,t.oid).then(b=>{c&&(ie(g,b),A(b))}).catch(b=>{c&&M(Me(b))}),()=>{c=!1}},[g,t.oid,f,l,L,s]);const T=ye(t),O=Ee(t.decorations),G=O.slice(0,3),S=O.slice(3),R=l?.reduce((c,b)=>c+b.additions,0)??0,q=l?.reduce((c,b)=>c+b.deletions,0)??0,V=async()=>{try{await fe(t.oid),K.success({title:"Hash copied",description:t.oid})}catch{K.error({title:"Could not copy hash"})}};return e.jsxs("div",{className:`commit-item${u?" active":""}${d?" search-match":""}`,role:"listitem",children:[e.jsxs("div",{className:"commit-header",children:[e.jsx(Se,{graph:o,width:j,height:i,merge:t.parentCount>1,head:t.isHead}),e.jsx("button",{className:"commit-expand","aria-expanded":f,"aria-label":f?"Collapse commit":"Expand commit",onClick:()=>$(!f),children:e.jsx(le,{className:`folder-chevron ${f?"open":""}`})}),e.jsxs("div",{className:"commit-main",children:[e.jsxs("span",{className:"commit-title-row",children:[e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-subject","aria-pressed":u,onClick:()=>y(t)}),children:t.subject||"(no subject)"}),e.jsxs(v,{side:"right",children:[t.subject||"(no subject)",e.jsx("br",{}),"Open the full commit diff"]})]}),T&&e.jsxs(N,{children:[e.jsxs(C,{render:p?e.jsx("button",{className:"ref-chip commit-pr",onClick:()=>p(T.number),"aria-label":`Open pull request #${T.number}`}):e.jsx("span",{className:"ref-chip commit-pr"}),children:[e.jsx(ce,{"aria-hidden":"true"}),"#",T.number]}),e.jsxs(v,{children:[T.source==="merge"?"Pull request reference from the merge message.":"Reference from the commit subject; it may identify a pull request or issue.",p?" Open as a pull request in the right-hand viewer.":""," No merge method is inferred from the number."]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("time",{className:"commit-date",dateTime:t.date}),children:de(t.date)}),e.jsx(v,{children:he(t.date)})]})]}),e.jsxs("span",{className:"commit-meta",children:[(O.length>0||t.parentCount>1||t.upstreamState==="local-only")&&e.jsxs("span",{className:"commit-refs",children:[t.upstreamState==="local-only"&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"ref-chip local-only"}),children:"Local"}),e.jsx(v,{children:t.isHead?`Not in ${n??"the upstream"} according to the latest known remote state.`:"Not published. To avoid rewriting multiple commits, only the latest can be undone."})]}),t.parentCount>1&&e.jsx("span",{className:"ref-chip merge",children:"merge"}),G.map(c=>e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:`ref-chip ${c.kind}`,"data-base":c.label===a||c.label.endsWith("/HEAD")&&t.baseState==="included"}),children:c.label}),e.jsx(v,{children:c.label})]},`${c.kind}:${c.label}`)),S.length>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"ref-chip more"}),children:["+",S.length]}),e.jsx(v,{children:S.map(c=>c.label).join(" · ")})]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-oid",onClick:()=>{V()},"aria-label":`Copiar hash ${t.shortOid}`}),children:t.shortOid}),e.jsx(v,{children:"Copy full hash"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"commit-author"}),children:t.author}),e.jsx(v,{children:t.author})]}),r>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-group-count",onClick:h}),children:[r," grouped"]}),e.jsxs(v,{children:["Show the ",r," commits in this merge branch"]})]})]})]}),x&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx(_,{variant:"ghost",size:"icon-xs",className:"change-action-button commit-undo",onClick:c=>{c.stopPropagation(),E(t)},"aria-label":`Undo commit ${t.shortOid}`}),children:e.jsx(ue,{})}),e.jsx(v,{children:"Undo commit and keep its changes staged"})]})]}),f&&o.continuations.length>0&&e.jsx(ke,{graph:o,width:j}),f&&e.jsxs("div",{className:"commit-files",style:{paddingLeft:j+31},children:[t.body&&e.jsx("p",{className:"commit-description",children:t.body}),L&&e.jsx("div",{className:"commit-files-message error",children:L}),!l&&!L&&e.jsxs("div",{className:"commit-files-message",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Q,{text:"Loading files…"})]}),l&&l.length===0&&e.jsx("div",{className:"commit-files-message",children:"This commit does not modify its own files (merge)."}),l&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"commit-files-summary",children:[l.length," ",l.length===1?"file":"files",(R>0||q>0)&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"add",children:["+",R]})," ",e.jsxs("span",{className:"del",children:["−",q]})]})]}),l.map(c=>e.jsx(Oe,{file:c,onSelect:()=>P(t.oid,c)},c.path))]})]})]})}const ee=14,we=["var(--history-local)","var(--history-published)","var(--history-base)"];function $e(s){return 14+Math.max(0,s-1)*ee}function I(s){return 7+s*ee}function D(s){return we[s]??"var(--history-published)"}function Se({graph:s,width:n,height:a,merge:t,head:o}){const j=a/2;return e.jsxs("svg",{className:"commit-graph",width:n,height:a,viewBox:`0 0 ${n} ${a}`,"aria-hidden":"true",children:[s.segments.map((i,u)=>{const d=I(i.fromLane),r=I(i.toLane),h=i.from==="top"?0:j,p=i.to==="node"?j:a,f=(h+p)/2,$=d===r?`M ${d} ${h} L ${r} ${p}`:`M ${d} ${h} C ${d} ${f}, ${r} ${f}, ${r} ${p}`;return e.jsx("path",{d:$,stroke:D(i.color)},`${u}:${$}`)}),e.jsx("circle",{cx:I(s.lane),cy:j,r:t||o?4.5:3,fill:t||o?"var(--sidebar)":D(s.color),stroke:D(s.color)}),t&&e.jsx("circle",{cx:I(s.lane),cy:j,r:"1.6",fill:D(s.color)})]})}function ke({graph:s,width:n}){return e.jsx("svg",{className:"commit-graph-continuation",width:n,viewBox:`0 0 ${n} 100`,preserveAspectRatio:"none","aria-hidden":"true",children:s.continuations.map(a=>e.jsx("line",{x1:I(a.lane),y1:"0",x2:I(a.lane),y2:"100",stroke:D(a.color)},a.lane))})}function Oe({file:s,onSelect:n}){const a=w.useRef(null),t=s.path.lastIndexOf("/"),o=t<0?s.path:s.path.slice(t+1),j=s.oldPath?.split("/").pop();return e.jsxs("div",{ref:a,className:"commit-file-row",children:[e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-file-label",onClick:n,"aria-label":`Ver el diff de ${s.path}`}),children:[e.jsx(Le,{path:s.path,type:"file"}),e.jsxs("span",{className:"commit-file-text",children:[e.jsx("span",{children:o}),j&&e.jsxs("small",{className:"commit-file-rename",children:[j," →"]})]})]}),e.jsx(v,{anchor:a,side:"right",sideOffset:10,children:s.oldPath?`${s.oldPath} → ${s.path}`:s.path})]}),e.jsx("span",{className:"commit-file-stats",children:s.binary?e.jsx("span",{className:"binary",children:"bin"}):e.jsxs(e.Fragment,{children:[s.additions>0&&e.jsxs("span",{className:"add",children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{className:"del",children:["−",s.deletions]})]})}),e.jsx("span",{className:"status-code","data-kind":s.kind,children:me(s.kind)})]})}function Ee(s){return s.map(n=>n.startsWith("tag: ")?{label:n.slice(5),kind:"tag"}:n.startsWith("HEAD -> ")?{label:n.slice(8),kind:"head"}:n==="HEAD"?{label:"HEAD",kind:"head"}:{label:n,kind:n.includes("/")?"remote":"branch"})}function Le({path:s}){return e.jsx("img",{className:"vscode-tree-icon",src:pe(s),alt:"","aria-hidden":"true",draggable:!1})}function Me(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{Fe as HistoryView};
@@ -1 +0,0 @@
1
- import{r as o,j as e}from"./react-rd22PHbN.js";import{w as ie,H as I,z as Me,A as ze,P as Ke,C as de,E as Be,g as P,f as L,p as De,j as Z,a4 as Qe,a5 as We,a6 as A,a7 as M,a8 as ye,D as He,a as Ue,b as _e,c as Ye,d as Ne,e as ve,a9 as te,W as Ve,S as Xe,aa as Je,B as Ze,ab as ce,ac as Fe,R as ea,ad as aa,ae as sa,af as ra,ag as la,I as na,U as ta}from"./App-Dfm5F199.js";import{b as ca,u as H}from"./tanstack-CcfAJoQ7.js";import{c as Te,B as b,q as U,T as he,b as me,d as ue,I as oa,w as ia,o as B}from"./index-B5RC4THs.js";import{C as da}from"./checkbox-XfIUFPxh.js";import"./base-ui-CJ8ZIx3d.js";const ha=[["path",{d:"M6.657 18c-2.572 0 -4.657 -2.007 -4.657 -4.483c0 -2.475 2.085 -4.482 4.657 -4.482c.393 -1.762 1.794 -3.2 3.675 -3.773c1.88 -.572 3.956 -.193 5.444 1c1.488 1.19 2.162 3.007 1.77 4.769h.99c1.913 0 3.464 1.56 3.464 3.486c0 1.927 -1.551 3.487 -3.465 3.487h-11.878",key:"svg-0"}]],oe=Te("outline","cloud","Cloud",ha);const ma=[["path",{d:"M4 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M4 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M16 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M6 8v8",key:"svg-3"}],["path",{d:"M18 11v5",key:"svg-4"}],["path",{d:"M16 4l4 4m0 -4l-4 4",key:"svg-5"}]],ua=Te("outline","git-pull-request-closed","GitPullRequestClosed",ma);function ba(a){const{details:r,pullRequest:l,anyBusy:t}=a,d=r.remoteState==="missing",[g,m]=o.useState(!1),[h,f]=o.useState(r.branchName);return o.useEffect(()=>{m(!1),f(r.branchName)},[r.fullName,r.branchName]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(oe,{"aria-hidden":"true"}),e.jsxs("span",{children:[r.remote,"/",r.branchName]})]}),e.jsx("small",{className:"local-refs-remote-label",children:d?"Deleted on remote · Cached reference":`Remote branch${r.defaultBranch===r.branchName?" · Default":""}`})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Remote"}),e.jsx("dd",{children:r.remote})]}),e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Full ref"}),e.jsx("dd",{children:e.jsx("code",{className:"local-refs-selectable",children:r.fullName})})]}),e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Fetched tip"}),e.jsxs("dd",{children:[e.jsx("code",{children:r.shortOid})," ",r.subject]})]}),e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Author"}),e.jsx("dd",{children:r.author||"—"})]}),e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Last commit"}),e.jsx("dd",{children:r.date?ie(r.date):"—"})]}),e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"Local branches"}),e.jsxs("dd",{children:[r.localBranches.length?r.localBranches.map(c=>e.jsxs("button",{type:"button",className:"local-refs-local-link",disabled:t,onClick:()=>a.onShowLocal(c.fullName),children:[e.jsx(I,{"aria-hidden":"true"}),c.name,c.worktreePath?" · In a worktree":""]},c.fullName)):"No local tracking branch",!d&&!g&&e.jsxs("div",{className:"local-refs-tracking-action",children:[e.jsxs("button",{type:"button",className:"local-refs-local-link",disabled:t,onClick:()=>m(!0),children:[e.jsx(I,{"aria-hidden":"true"}),r.localBranches.length?"Create another local tracking branch…":"Create local tracking branch…"]}),e.jsx("small",{children:"Work on this branch locally without switching your checkout."})]})]})]}),l&&e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:"GitHub PR"}),e.jsx("dd",{children:e.jsxs("button",{type:"button",className:`local-refs-pr-link ${l.state.toLowerCase()}${l.state==="OPEN"&&l.isDraft?" draft":""}`,onClick:()=>Be(l.url),children:[l.state==="MERGED"?e.jsx(Me,{"aria-hidden":"true"}):l.state==="CLOSED"?e.jsx(ua,{"aria-hidden":"true"}):e.jsx(ze,{"aria-hidden":"true"}),"#",l.number," · ",l.state==="MERGED"?`Merged into ${l.baseRefName}`:Ke(l),e.jsx(de,{"aria-hidden":"true"})]})})]})]}),g&&!d&&e.jsxs("form",{className:"local-refs-create-branch",onSubmit:c=>{c.preventDefault(),!t&&h.trim()&&a.onCreate(h.trim())},children:[e.jsx("label",{htmlFor:"tracking-branch-name",children:"Local branch name"}),e.jsx("input",{id:"tracking-branch-name",value:h,onChange:c=>f(c.target.value),disabled:t,autoFocus:!0,autoComplete:"off",spellCheck:!1}),e.jsx("p",{children:"Creates a tracking branch at the fetched tip. Your checkout and uncommitted changes stay intact."}),e.jsxs("div",{className:"local-refs-detail-actions",children:[e.jsxs(b,{type:"submit",variant:"outline",size:"sm",disabled:t||!h.trim(),children:[a.creating?e.jsx(P,{className:"animate-spin"}):e.jsx(I,{})," ",a.creating?"Creating…":"Create local branch"]}),e.jsx(b,{type:"button",variant:"ghost",size:"sm",disabled:t,onClick:()=>m(!1),children:"Cancel"})]})]}),e.jsx("div",{className:`local-refs-danger ${r.deletionBlockedReason?"blocked":"ready"}`,children:r.deletionBlockedReason?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"local-refs-reason",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:d?`This branch was already deleted from ${r.remote}. Only its cached reference remains; there is no remote branch to delete.`:r.deletionBlockedReason})]}),d&&e.jsxs(b,{variant:"outline",size:"sm",disabled:t,onClick:a.onFetch,children:[a.fetching?e.jsx(P,{className:"animate-spin"}):e.jsx(De,{}),a.fetching?"Fetching…":"Fetch and clean up"]})]}):a.confirming?e.jsxs("div",{className:"local-refs-confirm",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsxs("p",{children:["Delete ",e.jsx("strong",{children:r.branchName})," from ",e.jsx("strong",{children:r.remote}),"? This removes the branch on the remote server. Your local branches, commits and worktrees stay intact."]}),e.jsxs("span",{className:"local-refs-confirm-actions",children:[e.jsxs(b,{variant:"destructive",size:"sm",disabled:t,onClick:a.onDelete,children:[a.deleting?e.jsx(P,{className:"animate-spin"}):e.jsx(Z,{}),a.deleting?"Deleting…":`Delete from ${r.remote}`]}),e.jsx(b,{variant:"ghost",size:"sm",disabled:t,onClick:a.onCancel,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"local-refs-reason",children:[e.jsx(oe,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete only this branch from ",r.remote,". Local branches and worktrees are kept."]})]}),e.jsxs(b,{variant:"destructive",size:"sm",disabled:t,onClick:a.onConfirm,children:[e.jsx(Z,{}),"Delete from ",r.remote]})]})})]})}function Ca(a){const{open:r,tab:l,repositoryId:t,onMutated:d,onBusyChange:g}=a,m=ca(),[h,f]=o.useState(""),[c,x]=o.useState("all"),[p,N]=o.useState(""),[z,k]=o.useState(!1),[G,v]=o.useState(null),[O,_]=o.useState(null),[ae,F]=o.useState(null),[i,be]=o.useState(null),[Y,C]=o.useState(null),[Se,V]=o.useState(!1),fe=o.useRef(null);o.useEffect(()=>{k(!1)},[r,t]);const $=H({queryKey:U.localRefs(t),queryFn:()=>B.refs.localRefsSnapshot(t),enabled:r}),w=$.data??null,X=$.isFetching,xe=$.error?J($.error):null,T=o.useMemo(()=>Qe(w?.branches??[],h).filter(s=>(c==="all"||s.remote===(c==="remote"))&&(!s.remote||!p||s.remoteName===p)),[w,h,c,p]),Ee=o.useMemo(()=>{const s=[...new Set(T.filter(n=>n.remote).map(n=>n.remoteName??"Unmapped references"))];return[{label:"Local",branches:T.filter(n=>!n.remote)},...s.map(n=>({label:n,branches:T.filter(u=>u.remote&&(u.remoteName??"Unmapped references")===n)}))].filter(n=>n.branches.length>0)},[T]),se=o.useMemo(()=>We(w?.worktrees??[],h),[w,h]),j=T.find(s=>A(s)===G)??null,K=se.find(s=>M(s)===O)??null,je=H({queryKey:U.branchDetails(t,j?.fullName??""),queryFn:()=>B.refs.branchDetails({repositoryId:t,fullName:j.fullName}),enabled:r&&l==="branches"&&j!==null&&!j.remote}),R=je.data??null,ge=H({queryKey:U.remoteBranchDetails(t,j?.fullName??""),queryFn:()=>B.refs.remoteBranchDetails({repositoryId:t,fullName:j.fullName}),enabled:r&&l==="branches"&&j?.remote===!0,staleTime:3e4}),S=ge.data??null,re=j?.remote?S?.branchName:R?.name,Ie=H({queryKey:U.branchPullRequest(t,re??""),queryFn:()=>B.github.findPullRequestForBranch(t,re),enabled:r&&l==="branches"&&!!re&&(j?.remote?S?.remote==="origin":R!==null&&(R.deletion==="unknown"||R.deletion==="unmerged"))}),pe=j?.remote&&S?.remote!=="origin"?null:Ie.data??null,ke=H({queryKey:U.worktreeDetails(t,K?.path??""),queryFn:()=>B.refs.worktreeDetails({repositoryId:t,path:K.path}),enabled:r&&l==="worktrees"&&K!==null}),E=ke.data??null,le=l==="branches"?j?.remote?ge:je:ke,Q=le.isFetching,q=le.error?J(le.error):null,D=o.useCallback(async()=>{await $.refetch(),await Promise.all([m.invalidateQueries({queryKey:["repository",t,"branch-details"]}),m.invalidateQueries({queryKey:["repository",t,"remote-branch-details"]}),m.invalidateQueries({queryKey:["repository",t,"worktree-details"]}),m.invalidateQueries({queryKey:["repository",t,"branch-pull-request"]})])},[m,t,$]);o.useEffect(()=>{if(!w)return;const s=fe.current;fe.current=w,v(n=>ye(T.map(A),(s?.branches??[]).map(A),n)),_(n=>ye(w.worktrees.map(M),(s?.worktrees??[]).map(M),n))},[w,T]),o.useEffect(()=>{r||(f(""),x("all"),N(""),F(null),C(null),V(!1))},[r]),o.useEffect(()=>{F(null),C(null),V(!1)},[l,G,O]);const W=async(s,n)=>{be(s),g(!0),C(null);try{await n()&&F(null)}catch(u){C(J(u))}finally{be(null),g(!1)}},Pe=(s,n)=>W("delete-branch",async()=>{const u=await B.refs.deleteBranch({repositoryId:t,fullName:s.fullName,expectedOid:s.oid,force:n});return u.status!=="deleted"?(C(ja(u.status)),await D(),!1):(d(null),await D(),!0)}),Le=s=>W("delete-remote-branch",async()=>{const n=await B.refs.deleteRemoteBranch({repositoryId:t,fullName:s.fullName,expectedOid:s.oid,destinationId:s.destinationId});if(n.status!=="deleted")return C(n.status==="rejected"?n.message:Ce(n.status)),await D(),!1;const u=await B.refs.fetchBranches(t);return d(null),await D(),u.status==="failed"&&C("The remote branch was deleted, but fetching failed. Fetch again to update the list."),!0}),Ge=(s,n)=>W("create-tracking-branch",async()=>{const u=await B.refs.createTrackingBranch({repositoryId:t,fullName:s.fullName,expectedOid:s.oid,localName:n});return u.status!=="created"?(C(u.status==="exists"?"That local branch already exists. Choose another name.":Ce(u.status)),await D(),!1):(d(null),await D(),f(""),x("local"),N(""),v(u.fullName),!0)}),we=()=>W("fetch-branches",async()=>{const s=await B.refs.fetchBranches(t);return d(null),await D(),s.status==="failed"&&C(s.message),s.status==="success"}),Oe=(s,n,u)=>W("remove-worktree",async()=>{const ne=await B.refs.removeWorktree({repositoryId:t,path:s.path,expectedOid:s.oid,force:n,deleteBranch:u});return ne.status!=="removed"?(C(ga(ne.status)),await D(),!1):(d(ne.recentRepositories),await D(),!0)}),$e=async s=>{try{await ia(s),V(!0),window.setTimeout(()=>V(!1),1600)}catch(n){C(J(n))}},qe={branches:w?.branches.length??0,worktrees:w?.worktrees.length??0},Ae=l==="branches"?T.length===0:se.length===0;return e.jsx(He,{open:r,onOpenChange:s=>{i||a.onOpenChange(s)},children:e.jsxs(Ue,{className:"local-refs-dialog",children:[e.jsxs("header",{className:"local-refs-header",children:[e.jsxs("div",{children:[e.jsx(_e,{children:"Branches and worktrees"}),e.jsx(Ye,{children:"Inspect local and remote branches, and manage this repository’s worktrees."})]}),e.jsx(Ne,{render:e.jsx(b,{variant:"ghost",size:"icon-sm","aria-label":"Close the refs manager",disabled:!!i}),children:e.jsx(ve,{})})]}),e.jsxs("div",{className:"local-refs-toolbar",children:[e.jsx("div",{className:"local-refs-tabs",role:"tablist","aria-label":"Branches and worktrees",children:["branches","worktrees"].map(s=>e.jsxs("button",{type:"button",role:"tab",id:`local-refs-tab-${s}`,"aria-selected":l===s,"aria-controls":`local-refs-panel-${s}`,className:"local-refs-tab",disabled:!!i,onClick:()=>{a.onTabChange(s),k(!1)},children:[s==="branches"?e.jsx(I,{"aria-hidden":"true"}):e.jsx(te,{"aria-hidden":"true"}),e.jsx("span",{children:s==="branches"?"Branches":"Worktrees"}),e.jsx("small",{children:qe[s]})]},s))}),e.jsxs("div",{className:"local-refs-search",children:[e.jsx(Ve,{"aria-hidden":"true"}),e.jsxs("label",{className:"sr-only",htmlFor:"local-refs-search-input",children:["Search ",l]}),e.jsx("input",{id:"local-refs-search-input",value:h,disabled:!!i,onChange:s=>f(s.target.value),placeholder:l==="branches"?"Search branches…":"Search worktrees…",autoComplete:"off",spellCheck:!1}),h&&e.jsx(b,{variant:"ghost",size:"icon-xs","aria-label":"Clear search",disabled:!!i,onClick:()=>f(""),children:e.jsx(ve,{})})]}),e.jsxs(he,{children:[e.jsxs(me,{render:e.jsx(b,{variant:"outline",size:"sm",onClick:()=>l==="branches"?void we():void D(),disabled:X||!!i}),children:[X||i==="fetch-branches"?e.jsx(P,{className:"animate-spin"}):e.jsx(De,{})," ",l==="branches"?"Fetch":"Refresh"]}),e.jsx(ue,{children:l==="branches"?"Fetch branches from all remotes and remove obsolete remote references":"Refresh local worktrees"})]})]}),l==="branches"&&e.jsxs("div",{className:"local-refs-branch-filters",children:[e.jsx("div",{className:"local-refs-tabs",role:"group","aria-label":"Branch scope",children:["all","local","remote"].map(s=>e.jsx("button",{type:"button",className:"local-refs-tab","aria-pressed":c===s,disabled:!!i,onClick:()=>{x(s),k(!1)},children:s==="all"?"All":s==="local"?"Local":"Remote"},s))}),c!=="local"&&e.jsx(Xe,{label:"Filter by remote",placeholder:"Search remotes…",value:p,triggerLabel:p||"All remotes",onValueChange:s=>{N(s),k(!1)},disabled:!!i,groups:[{id:"remotes",label:"Remotes",items:[{value:"",label:"All remotes",pinned:!0},...(w?.remotes??[]).map(s=>({value:s,label:s}))]}]}),e.jsx("small",{children:"Remote refs reflect the last fetch."})]}),(xe||Y)&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:xe??Y})]}),z&&e.jsxs("button",{type:"button",className:"local-refs-mobile-back",onClick:()=>k(!1),children:["← Back to ",l]}),e.jsxs("div",{className:"local-refs-body","data-mobile-detail":z,role:"tabpanel",id:`local-refs-panel-${l}`,"aria-labelledby":`local-refs-tab-${l}`,children:[e.jsxs("div",{className:"local-refs-list",role:"listbox","aria-label":l==="branches"?"Branches":"Worktrees",tabIndex:-1,children:[X&&!w&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(P,{className:"animate-spin","aria-hidden":"true"})," Reading the repository…"]}),!X&&Ae&&e.jsx("p",{className:"local-refs-placeholder",children:h||p?"No matches for these filters.":`This repository has no ${l==="branches"?`${c==="all"?"":`${c} `}branches`:"worktrees"}.`}),l==="branches"&&Ee.map(s=>e.jsxs("div",{className:"local-refs-branch-group",role:"group","aria-label":s.label,children:[e.jsxs("div",{className:"local-refs-group-heading",children:[e.jsx("span",{children:s.label}),e.jsx("small",{children:s.branches.length})]}),s.branches.map(n=>e.jsxs("button",{type:"button",role:"option","aria-selected":A(n)===G,className:"local-refs-row",disabled:!!i,onClick:()=>{v(A(n)),k(!0)},children:[e.jsxs("span",{className:"local-refs-row-head",children:[n.remote?e.jsx(oe,{"aria-hidden":"true"}):e.jsx(I,{"aria-hidden":"true"}),e.jsx("strong",{children:n.remoteBranchName??n.name}),e.jsx(ee,{badges:Je(n)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("code",{children:n.shortOid}),n.subject&&e.jsx("span",{children:n.subject}),n.date&&e.jsx("time",{dateTime:n.date,children:Ze(n.date)})]})]},A(n)))]},s.label)),l==="worktrees"&&se.map(s=>e.jsxs("button",{type:"button",role:"option","aria-selected":M(s)===O,className:"local-refs-row",disabled:!!i,onClick:()=>{_(M(s)),k(!0)},children:[e.jsxs("span",{className:"local-refs-row-head",children:[e.jsx(te,{"aria-hidden":"true"}),e.jsx("strong",{children:ce(s.path)}),e.jsx(ee,{badges:Fe(s)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("span",{className:"local-refs-row-branch",children:s.branch?`${s.branch}`:"Detached HEAD"}),e.jsx("span",{children:s.path})]})]},M(s)))]}),e.jsxs("div",{className:"local-refs-detail",children:[q&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:q})]}),Q&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(P,{className:"animate-spin","aria-hidden":"true"})," Loading details…"]}),!Q&&!q&&l==="branches"&&S&&j?.remote&&e.jsx(ba,{details:S,pullRequest:pe,anyBusy:!!i,deleting:i==="delete-remote-branch",creating:i==="create-tracking-branch",confirming:ae==="delete-remote-branch",onConfirm:()=>F("delete-remote-branch"),onCancel:()=>F(null),onDelete:()=>{Le(S)},onCreate:s=>{Ge(S,s)},onFetch:()=>{we()},fetching:i==="fetch-branches",onShowLocal:s=>{f(""),x("local"),N(""),v(s)}}),!Q&&!q&&l==="branches"&&R&&j&&!j.remote&&e.jsx(fa,{details:R,pullRequest:pe,busy:i==="delete-branch",anyBusy:!!i,confirming:ae==="delete-branch",actionError:Y,onConfirm:()=>F("delete-branch"),onCancel:()=>F(null),onDelete:s=>{Pe(R,s)}}),!Q&&!q&&l==="worktrees"&&E&&K&&e.jsx(xa,{details:E,busy:i==="remove-worktree",anyBusy:!!i,confirming:ae==="remove-worktree",actionError:Y,copied:Se,onConfirm:()=>F("remove-worktree"),onCancel:()=>F(null),onRemove:(s,n)=>{Oe(E,s,n)},onCopyPath:()=>{$e(E.path)},onOpen:()=>a.onOpenWorktree(E.path),onShowBranch:()=>{E.branch&&(v(`refs/heads/${E.branch}`),f(""),x("local"),N(""),a.onTabChange("branches"))}}),!Q&&!q&&!j&&!K&&e.jsxs("p",{className:"local-refs-placeholder",children:["Select a ",l==="branches"?"branch":"worktree"," to see its details."]})]})]},l),e.jsxs("footer",{className:"local-refs-footer",children:[e.jsx("small",{children:"Deleting a remote branch keeps local branches and worktrees. Removing a worktree deletes its branch only when explicitly selected."}),e.jsx(Ne,{render:e.jsx(b,{variant:"outline",size:"sm",disabled:!!i}),children:"Done"})]})]})})}function fa({details:a,pullRequest:r,busy:l,anyBusy:t,confirming:d,actionError:g,onConfirm:m,onCancel:h,onDelete:f}){const c=aa(a,r),x=c.forceAllowed===!0,p=c.allowed||x;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(I,{"aria-hidden":"true"}),e.jsxs(he,{children:[e.jsx(me,{render:e.jsx("span",{}),children:a.name}),e.jsx(ue,{children:a.name})]})]}),e.jsx(ee,{badges:sa(a)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(y,{label:"Full ref",children:e.jsx("code",{className:"local-refs-selectable",children:a.fullName})}),e.jsxs(y,{label:"Tip",children:[e.jsx("code",{children:a.shortOid})," ",a.subject]}),e.jsx(y,{label:"Author",children:a.author||"—"}),e.jsx(y,{label:"Last commit",children:a.date?ie(a.date):"—"}),e.jsx(y,{label:"Upstream",children:a.upstream?`${a.upstream} · ↑${a.ahead} ↓${a.behind}`:"Not configured"}),e.jsx(y,{label:"Compared with",children:a.comparisonBase??"Not compared"}),r&&e.jsx(y,{label:"GitHub PR",children:e.jsxs("button",{type:"button",className:"local-refs-pr-link",onClick:()=>Be(r.url),children:["#",r.number," · ",r.state==="MERGED"?`Merged into ${r.baseRefName}`:r.state==="OPEN"?"Open":"Closed"," ",e.jsx(de,{"aria-hidden":"true"})]})})]}),e.jsx(Re,{tone:c.allowed?"ready":"blocked",reason:c.reason,actionError:g,confirming:d,busy:l,anyBusy:t,actionLabel:x?"Force delete branch":"Delete branch",confirmLabel:l?"Deleting…":x?"Permanently delete":"Delete branch",allowed:p,confirmation:x?e.jsxs(e.Fragment,{children:["Force-delete the local branch ",e.jsx("strong",{children:a.name}),"? This keeps any remote branch and pull request, but commits found only on this local branch may become inaccessible. ",r?.state==="MERGED"?e.jsxs(e.Fragment,{children:["GitHub reports PR ",e.jsxs("strong",{children:["#",r.number]})," as merged into ",e.jsx("strong",{children:r.baseRefName}),", although local Git cannot verify the ancestry."]}):null]}):e.jsxs(e.Fragment,{children:["Delete the local branch ",e.jsx("strong",{children:a.name}),"? This removes only the local branch, keeping every worktree and any remote copy. Git confirmed it is fully merged into ",e.jsx("strong",{children:a.comparisonBase}),"."]}),onConfirm:m,onCancel:h,onAct:()=>f(x)})]})}function xa({details:a,busy:r,anyBusy:l,confirming:t,actionError:d,copied:g,onConfirm:m,onCancel:h,onRemove:f,onCopyPath:c,onOpen:x,onShowBranch:p}){const[N,z]=o.useState(!1),k=ra(a),G=la(a),v=k.forceAllowed===!0,O=k.allowed||v;return o.useEffect(()=>z(!1),[a.path]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(te,{"aria-hidden":"true"}),e.jsxs(he,{children:[e.jsx(me,{render:e.jsx("span",{}),children:ce(a.path)}),e.jsx(ue,{children:ce(a.path)})]})]}),e.jsx(ee,{badges:Fe(a)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(y,{label:"Folder",children:e.jsx("span",{className:"local-refs-path local-refs-selectable",children:a.path})}),e.jsx(y,{label:"Branch",children:a.branch??"Detached HEAD"}),e.jsx(y,{label:"HEAD",children:a.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{children:a.lastCommit.shortOid})," ",a.lastCommit.subject]}):e.jsx("code",{children:a.oid?a.oid.slice(0,7):"—"})}),e.jsx(y,{label:"Committed",children:a.lastCommit?.date?ie(a.lastCommit.date):"—"}),e.jsx(y,{label:"Local changes",children:a.available?G??"None":"Not readable"})]}),e.jsxs("div",{className:"local-refs-detail-actions",children:[e.jsxs(b,{variant:"outline",size:"sm",onClick:c,disabled:l,children:[g?e.jsx(na,{}):e.jsx(oa,{})," ",g?"Copied":"Copy path"]}),!a.current&&a.available&&!a.locked&&e.jsxs(b,{variant:"outline",size:"sm",onClick:x,disabled:l,children:[e.jsx(de,{})," Open worktree"]}),a.branch&&e.jsxs(b,{variant:"ghost",size:"sm",onClick:p,disabled:l,children:[e.jsx(I,{})," Show branch"]})]}),a.branch&&O&&e.jsxs("label",{htmlFor:"remove-worktree-delete-branch",className:"local-refs-delete-branch",children:[e.jsx(da,{id:"remove-worktree-delete-branch",checked:N,onCheckedChange:_=>z(_===!0),disabled:l}),e.jsxs("span",{children:["Also delete branch ",e.jsx("strong",{children:a.branch})]})]}),e.jsx(Re,{tone:k.allowed?"ready":"blocked",reason:k.reason,actionError:d,confirming:t,busy:r,anyBusy:l,actionLabel:v?"Force remove worktree":"Remove worktree",confirmLabel:r?"Removing…":v?"Permanently remove":"Remove worktree",allowed:O,confirmation:e.jsxs(e.Fragment,{children:[v?e.jsxs(e.Fragment,{children:["Permanently remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:a.path}),"? ",e.jsx("strong",{children:G??`The ${a.operation??"current Git operation"}`})," and every uncommitted file will be lost. The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}):e.jsxs(e.Fragment,{children:["Remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:a.path}),"? The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}),N&&a.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:a.branch})," will also be force-deleted. Commits found only on that branch may become inaccessible."]}):a.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:a.branch})," and its commits stay in the repository."]}):"No branch is deleted."]}),onConfirm:m,onCancel:h,onAct:()=>f(v,N)})]})}function Re({tone:a,reason:r,actionError:l,confirming:t,busy:d,anyBusy:g,allowed:m,actionLabel:h,confirmLabel:f,confirmation:c,onConfirm:x,onCancel:p,onAct:N}){return e.jsxs("div",{className:`local-refs-danger ${a}`,children:[l&&e.jsxs("p",{className:"local-refs-danger-error",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:l})]}),t&&m?e.jsxs("div",{className:"local-refs-confirm",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("p",{children:c}),e.jsxs("span",{className:"local-refs-confirm-actions",children:[e.jsxs(b,{variant:"destructive",size:"sm",onClick:N,disabled:d,children:[d?e.jsx(P,{className:"animate-spin"}):e.jsx(Z,{})," ",f]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:p,disabled:d,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"local-refs-reason",children:[a==="ready"?e.jsx(ta,{"aria-hidden":"true"}):e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:r})]}),m&&e.jsxs(b,{variant:"destructive",size:"sm",onClick:x,disabled:g,children:[e.jsx(Z,{})," ",h]})]})]})}function ee({badges:a}){return a.length===0?null:e.jsx("span",{className:"local-refs-badges",children:a.map(r=>e.jsx(ea,{variant:r.tone==="current"?"default":r.tone==="warning"?"destructive":"outline",children:r.label},r.label))})}function y({label:a,children:r}){return e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:a}),e.jsx("dd",{children:r})]})}function ja(a){switch(a){case"stale":return"The branch moved since this view loaded. It was refreshed; check the new state before deleting.";case"current":return"This branch is now checked out here, so Git will not delete it.";case"checked-out":return"Another worktree now has this branch checked out.";case"unmerged":return"Git found commits that are not in the comparison base, so the branch was kept.";case"unknown":return"The comparison base is not available locally, so the branch was kept.";default:return"The branch no longer exists."}}function Ce(a){switch(a){case"stale":return"The branch changed since this view loaded. Fetch and review its new tip before trying again.";case"default":return"This is now the remote’s default branch. It was kept.";case"destination-changed":return"The remote destination changed. Review the refreshed details before trying again.";default:return"The remote branch no longer exists. Fetch to update the list."}}function ga(a){switch(a){case"stale":return"The worktree moved since this view loaded. It was refreshed; check the new state before removing.";case"main":return"Git can never remove the main worktree.";case"current":return"OpenTig has this worktree open. Switch to another one first.";case"dirty":return"The worktree has local changes or an operation in progress, so it was kept.";case"locked":return"The worktree is locked. Unlock it in Git first.";case"prunable":return"Git can no longer find this worktree on disk.";case"bare":return"This entry is a bare repository, not a removable worktree.";default:return"The worktree no longer exists."}}function J(a){return a instanceof Error?a.message:String(a)}export{Ca as LocalRefsDialog};
@@ -1 +0,0 @@
1
- import{r as d,j as e}from"./react-rd22PHbN.js";import{u as b}from"./tanstack-CcfAJoQ7.js";import{q as S,B as m,T as q,b as T,d as w,o as D}from"./index-B5RC4THs.js";import{k as P,l as R,m as $,n as z,o as E,p as H,g as B,q as I}from"./App-Dfm5F199.js";import{D as K}from"./DiffWorkspace-BRicWHvw.js";import{P as L}from"./PierreWorkerPool-Cg9zdxiI.js";import"./base-ui-CJ8ZIx3d.js";import"./platform-Bqt97_Jr.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./EditContext-CvJWfVl1.js";import"./index-CtEztN1P.js";function Z({diff:n,prNumber:a,repositoryId:u,commits:l,diffView:g,themeType:j,wrapLines:v,onDiffViewChange:y,onWrapLinesChange:C,onClose:N}){const[o,p]=d.useState("all"),[x,k]=d.useState(l[0]?.oid??""),i=d.useMemo(()=>l.find(s=>s.oid===x)??l[0]??null,[l,x]),r=b({queryKey:S.pullRequestCommitDiff(u,i?.oid??""),queryFn:()=>D.github.getPullRequestCommitDiff(u,i.oid),enabled:o==="commit"&&i!==null}),h=r.error instanceof Error?r.error.message:r.error?"Could not load the commit diff.":null,t=e.jsxs("div",{className:"pr-code-scope",children:[e.jsxs("div",{className:"pr-code-mode",role:"group","aria-label":"Pull request code grouping",children:[e.jsx(m,{type:"button",variant:o==="all"?"secondary":"ghost",size:"xs","aria-pressed":o==="all",onClick:()=>p("all"),children:"All changes"}),e.jsx(m,{type:"button",variant:o==="commit"?"secondary":"ghost",size:"xs","aria-pressed":o==="commit",disabled:l.length===0,onClick:()=>p("commit"),children:"By commit"})]}),o==="commit"&&i&&e.jsxs(P,{value:i.oid,onValueChange:s=>{s&&k(s)},children:[e.jsxs(q,{children:[e.jsx(T,{render:e.jsx($,{className:"pr-commit-select",size:"sm","aria-label":"Commit"}),children:e.jsxs(R,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})}),e.jsxs(w,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})]}),e.jsx(z,{align:"start",alignItemWithTrigger:!1,className:"pr-commit-menu",children:l.map(s=>e.jsxs(E,{value:s.oid,label:`${s.oid.slice(0,7)} ${s.messageHeadline||"(no commit message)"}`,children:[e.jsx("span",{className:"shrink-0 self-start font-mono text-xs text-muted-foreground",children:s.oid.slice(0,7)}),e.jsx("span",{className:"min-w-0 whitespace-normal break-words",children:s.messageHeadline||"(no commit message)"})]},s.oid))})]})]}),c=o==="all"?n:r.data??null;return o==="commit"&&h?e.jsxs(f,{scopeControl:t,children:[e.jsx("p",{className:"text-destructive",children:h}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>{r.refetch()},children:[e.jsx(H,{})," Try again"]})]}):c?c.patch?e.jsx(L,{children:e.jsx(K,{contentKey:o==="all"?`pull:${a}:all`:`pull:${a}:commit:${i?.oid??""}`,diff:c,diffView:g,themeType:j,wrapLines:v,initiallyCollapsed:!0,scopeControl:t,onDiffViewChange:y,onWrapLinesChange:C,onClose:N})}):e.jsx(f,{scopeControl:t,children:"No differences to show."}):e.jsxs(f,{scopeControl:t,children:[e.jsx(B,{className:"spinner"})," ",e.jsx(I,{text:"Loading commit diff…"})]})}function f({scopeControl:n,children:a}){return e.jsxs("div",{className:"diff-workspace",children:[e.jsx("div",{className:"diff-workspace-toolbar",children:e.jsx("div",{className:"diff-workspace-scope",children:n})}),e.jsx("div",{className:"viewer-message flex-col gap-3",children:a})]})}export{Z as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-D6QG5Anx.js","assets/react-rd22PHbN.js","assets/tanstack-CcfAJoQ7.js","assets/base-ui-CJ8ZIx3d.js","assets/index-B5RC4THs.js","assets/index-Dc9xVluy.css","assets/App-Dfm5F199.js","assets/DiffWorkspace-BRicWHvw.js","assets/PierreWorkerPool-Cg9zdxiI.js","assets/platform-Bqt97_Jr.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-CtEztN1P.js","assets/EditContext-CvJWfVl1.js","assets/render-markdown-hAIWRfn0.js"])))=>i.map(i=>d[i]);
2
- import{c as H,B as g,T as D,b as V,d as F,_ as q,o as b,q as w}from"./index-B5RC4THs.js";import{r as u,j as e}from"./react-rd22PHbN.js";import{p as $,g as o,q as d,P as O,Q as M,R as y,w as C,H as B,C as Q,E as U,U as z,F as K}from"./App-Dfm5F199.js";import{G as k,P as X,I as J,a as W}from"./GitHubAvatar-C8R3iNoM.js";import{u as T}from"./tanstack-CcfAJoQ7.js";import{V as Y,a as Z,b as m}from"./viewer-tabs-BjG3oKQ9.js";/* empty css */import"./base-ui-CJ8ZIx3d.js";const ee=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],se=H("outline","tag","Tag",ee),ae=u.lazy(()=>q(()=>import("./PullRequestDiff-D6QG5Anx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function ue({repositoryId:r,prNumber:i,diffView:t,themeType:P,wrapLines:_,onDiffViewChange:L,onWrapLinesChange:R,onClose:I,onSelectPullRequest:A}){const[h,E]=u.useState("summary"),l=T({queryKey:w.pullRequest(r,i),queryFn:async()=>{const a=await b.github.getPullRequest(r,i),S=a.body.trim()?await q(async()=>{const{renderMarkdown:c}=await import("./render-markdown-hAIWRfn0.js").then(G=>G.a);return{renderMarkdown:c}},__vite__mapDeps([14,6,4,1,2,3,5,10,11])).then(({renderMarkdown:c})=>c(a.body)).catch(()=>"<p>Could not render the description.</p>"):"";return{details:a,bodyHtml:S}}}),s=l.data?.details??null,p=l.data?.bodyHtml??"",x=l.error instanceof Error?l.error.message:l.error?"Could not load the pull request.":null,n=T({queryKey:w.pullRequestDiff(r,i),queryFn:()=>b.github.getPullRequestDiff(r,i),enabled:h==="diff"&&s!==null}),j=n.data??null,v=n.error instanceof Error?n.error.message:n.error?"Could not load the diff.":null;if(x)return e.jsxs("div",{className:"viewer-message flex-col gap-3",children:[e.jsx("p",{className:"text-destructive",children:x}),e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>{l.refetch()},children:[e.jsx($,{})," Try again"]})]});if(!s)return e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:`Loading pull request #${i}…`})]});const f=O(s),N=M(s.reviewDecision);return e.jsxs(Y,{value:h,onValueChange:a=>E(a),className:"pr-viewer",children:[e.jsxs("header",{className:"pr-viewer-header",children:[e.jsxs("div",{className:"pr-viewer-overview",children:[e.jsxs("div",{className:"pr-viewer-title",children:[e.jsx(y,{variant:s.state==="OPEN"&&!s.isDraft?"default":"secondary",className:`pr-state-badge ${f.toLowerCase().replace(/\s+/g,"-")}`,children:f}),e.jsxs("h2",{children:[s.title||"(no title)"," ",e.jsxs("span",{className:"pr-number",children:["#",s.number]})]})]}),e.jsxs("div",{className:"pr-viewer-meta",children:[e.jsxs("span",{className:"pr-author-with-avatar",children:[e.jsx(k,{src:s.authorAvatarUrl,className:"pr-author-avatar"},s.authorAvatarUrl),e.jsx("span",{className:"pr-author",children:s.author})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["updated ",e.jsx("time",{dateTime:s.updatedAt,children:C(s.updatedAt)})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-branches",children:[e.jsx(B,{"aria-hidden":"true"})," ",s.headRefName," → ",s.baseRefName]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-counters",children:[s.changedFiles," ",s.changedFiles===1?"file":"files"," ",e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]}),e.jsx(re,{state:s.checksState}),N&&e.jsx(y,{variant:"outline",className:"pr-review-badge",children:N}),s.stack&&e.jsx(X,{repositoryId:r,number:i,membership:s.stack,onSelect:A}),e.jsx("span",{className:"pr-viewer-actions",children:e.jsxs(g,{variant:"outline",size:"xs",onClick:()=>U(s.url),children:[e.jsx(Q,{})," Open on GitHub"]})})]}),s.labels.length>0&&e.jsxs("div",{className:"pr-labels","aria-label":"Pull request labels",children:[e.jsx(se,{"aria-hidden":"true"}),s.labels.map(a=>e.jsx("span",{className:"pr-label",style:{borderColor:`#${a.color}`,backgroundColor:`#${a.color}22`},children:a.name},`${a.name}-${a.color}`))]})]}),e.jsx(Z,{label:"Pull request view",className:"markdown-viewer-tabs pr-viewer-tabs",items:[{value:"summary",label:"Summary"},{value:"timeline",label:"Timeline"},{value:"diff",label:"Code"}]})]}),e.jsx(m,{value:"summary",className:"markdown-preview-scroll pr-description-scroll",children:e.jsx("section",{className:"pr-summary-section",children:p?e.jsx("div",{className:"markdown-prose",dangerouslySetInnerHTML:{__html:p}}):e.jsx("p",{className:"pr-empty-description",children:"This pull request has no description."})})}),e.jsx(m,{value:"timeline",className:"markdown-preview-scroll pr-description-scroll",children:e.jsxs("section",{className:"pr-timeline standalone","aria-label":"Commit timeline",children:[e.jsxs("h3",{children:[e.jsx(z,{"aria-hidden":"true"})," Commits ",e.jsx("span",{children:s.commits.length})]}),s.commits.length?s.commits.map(a=>e.jsxs("article",{className:"pr-timeline-item",children:[e.jsx("span",{className:"pr-timeline-rail",children:e.jsx("span",{})}),e.jsx(k,{src:a.authorAvatarUrl,className:"pr-commit-avatar"}),e.jsxs("span",{className:"pr-commit-content",children:[e.jsx("strong",{children:a.messageHeadline||"(no commit message)"}),e.jsxs("span",{children:[e.jsx("b",{children:a.author})," committed ",e.jsx("time",{dateTime:a.authoredAt,children:C(a.authoredAt)})]})]}),e.jsxs(D,{children:[e.jsx(V,{render:e.jsx("code",{}),children:a.oid.slice(0,7)}),e.jsx(F,{children:a.oid})]})]},a.oid)):e.jsx("p",{className:"pr-empty-description",children:"No commits were returned by GitHub."})]})}),e.jsx(m,{value:"diff",className:"pr-diff-panel",children:v?e.jsx("div",{className:"viewer-message text-destructive",children:v}):j?e.jsx(u.Suspense,{fallback:e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:"Loading diff viewer…"})]}),children:e.jsx(ae,{diff:j,prNumber:s.number,repositoryId:r,commits:s.commits,diffView:t,themeType:P,wrapLines:_,onDiffViewChange:L,onWrapLinesChange:R,onClose:I})}):e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:"Loading diff…"})]})})]})}function re({state:r}){if(r==="NONE")return null;const i=r==="PASSING"?J:r==="FAILING"?W:K,t=r==="PASSING"?"Checks passing":r==="FAILING"?"Checks failing":"Checks pending";return e.jsxs("span",{className:`pr-checks ${r.toLowerCase()}`,children:[e.jsx(i,{"aria-hidden":"true"})," ",t]})}export{ue as PullRequestViewer};
@@ -1 +0,0 @@
1
- import{r as f,j as e}from"./react-rd22PHbN.js";import{a2 as y,a3 as N,D as v,a as R,b as C,c as b,W as D,g as F,q as S,a1 as q}from"./App-Dfm5F199.js";import{c as I}from"./index-B5RC4THs.js";import{A as M,j as w,k as z,l as L}from"./base-ui-CJ8ZIx3d.js";import"./tanstack-CcfAJoQ7.js";const O=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],Q=I("outline","file-search","FileSearch",O);function E(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:N(i.path)})};return r(s?t:y(t)),n}function T(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=E(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>P(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function P(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function U({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?T(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(v,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(b,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(M,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(D,{"aria-hidden":"true"}),e.jsx(w,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(z,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(F,{className:"spinner","aria-hidden":"true"})," ",e.jsx(S,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(Q,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(L,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:q(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{U as QuickOpenDialog};
@@ -1 +0,0 @@
1
- import{r as o,j as e}from"./react-rd22PHbN.js";import{D as W,a as Y,b as q,c as Q,d as z,e as Z,f as w,M as I,g as O,h as C,i as ee,j as E,s as se,S as ne,O as ae}from"./App-Dfm5F199.js";import{B as r,T as k,b as B,d as R,o as h}from"./index-B5RC4THs.js";import{I as ie,a as re}from"./IconFolderSymlink-C4ydD1eS.js";import"./tanstack-CcfAJoQ7.js";import"./base-ui-CJ8ZIx3d.js";const D="__opentig_no_project__";function he({open:l,projects:c,repositories:x,onOpenChange:F,onOrganizationChange:M,onForgetRepository:L,onRelocateRepository:P}){const[A,g]=o.useState(null),[p,f]=o.useState(null),[b,T]=o.useState(""),[y,d]=o.useState(null),[N,$]=o.useState(""),[G,j]=o.useState(null),[n,v]=o.useState(null),[S,m]=o.useState(null),J=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(g(null),f(null),d(null),j(null),m(null))},[l]);const u=async(s,a)=>{v(s),m(null);try{const t=await a();return M(t),!0}catch(t){return m(_(t)),!1}finally{v(null)}},K=async s=>{s.preventDefault();const a=b.trim();!a||n||await u("create",()=>h.projects.create(a))&&T("")},X=async s=>{s.preventDefault();const a=N.trim();!y||!a||n||await u(`rename:${y}`,()=>h.projects.rename(y,a))&&d(null)},H=async s=>{n||await u(`remove:${s}`,()=>h.projects.remove(s))&&j(null)},U=async(s,a)=>{n||await u(`assign:${s}`,()=>h.projects.assign(s,a))},V=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}v(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await P(s,a)}catch(a){m(_(a))}finally{v(null)}}};return e.jsxs(W,{open:l,onOpenChange:s=>{n||F(s)},children:[e.jsxs(Y,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]",children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(q,{children:"Manage projects"}),e.jsx(Q,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(z,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(Z,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[S&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsx("span",{children:S})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:c.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{K(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:b,maxLength:I,onChange:s=>T(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!b.trim()||!!n,children:[n==="create"?e.jsx(O,{className:"animate-spin"}):e.jsx(ie,{})," Create"]})]})]}),e.jsxs("div",{className:"repository-project-list",children:[c.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),c.map(s=>{const a=s.repositoryKeys.length,t=n===`rename:${s.id}`||n===`remove:${s.id}`;return e.jsx("div",{className:"repository-project-row","aria-busy":t||void 0,children:y===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{X(i)},onKeyDown:i=>{i.key==="Escape"&&d(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:N,maxLength:I,onChange:i=>$(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!N.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):G===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{H(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>j(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(C,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[a," ",a===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),$(s.name),j(null)},children:e.jsx(ee,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{j(s.id),d(null)},children:e.jsx(E,{})})]})]})},s.id)})]})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:x.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[x.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),x.map(s=>{const a=J.get(s.key)??D,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:A===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(w,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:s.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{u(`forget:${s.key}`,()=>L(s)).then(i=>{i&&g(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>g(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx("small",{}),children:se(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(O,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsx(ne,{groups:[{id:"none",label:"",items:[{value:D,label:"No project",pinned:!0}]},{id:"projects",label:"Projects",items:c.map(i=>({value:i.id,label:i.name,icon:e.jsx(C,{})}))}],value:a,onValueChange:i=>{U(s.key,i===D?null:i)},label:`Project for ${s.name}`,triggerLabel:c.find(i=>i.id===a)?.name??"No project",placeholder:"Search projects…",disabled:!!n}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{V(s)}}),children:e.jsx(re,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(k,{children:[e.jsx(B,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{g(s.key),m(null)}}),children:e.jsx(E,{})}),e.jsx(R,{children:"Remove from OpenTig"})]})]})]})},s.key)})]})]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(z,{render:e.jsx(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(ae,{open:p!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${p?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",initialPath:p?.recent.path,recent:x.map(s=>s.recent),onBrowse:h.repository.browseDirectories,onOpen:async s=>{p&&await P(p,s)}})]})}function _(l){return l instanceof Error?l.message:String(l)}export{he as RepositoryProjectsDialog};