@opentig/cli 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +14 -14
  3. package/dist/bin.mjs +25 -10
  4. package/dist/chunks/{cli-L6lvCZdX.mjs → cli-gyjD1t0O.mjs} +611 -268
  5. package/dist/chunks/network-settings-CdFeKFRB.mjs +142 -0
  6. package/dist/chunks/{server-Cz0gvydn.mjs → server-DMk8-Xxt.mjs} +557 -105
  7. package/dist/chunks/{service-manager-Jyx-MWo-.mjs → service-manager-BxSmV_8Z.mjs} +88 -14
  8. package/dist/client/assets/App-Bfw_TX8q.js +132 -0
  9. package/dist/client/assets/CreatePullRequestDialog-DyPd6SKH.js +2 -0
  10. package/dist/client/assets/DiffWorkspace-DCo89dF1.js +7 -0
  11. package/dist/client/assets/EditableFileViewer-Dotntfij.js +1 -0
  12. package/dist/client/assets/EditableFileViewer-svutjHZv.css +1 -0
  13. package/dist/client/assets/ExternalLink-jdtpN_yL.js +1 -0
  14. package/dist/client/assets/{File-BPxtFxHC.js → File-DHnVtIhS.js} +1 -1
  15. package/dist/client/assets/FilesView-D6f1hPVy.js +1 -0
  16. package/dist/client/assets/GitHubAvatar-B6vyoVlh.js +1 -0
  17. package/dist/client/assets/HistoryView-D9RhzCPY.js +1 -0
  18. package/dist/client/assets/HtmlFileViewer-Bwmj5umg.js +2 -0
  19. package/dist/client/assets/{IconAlertTriangle-C1OX2bTH.js → IconAlertTriangle-B9iDJKvP.js} +1 -1
  20. package/dist/client/assets/IconCheck-C-G-IA13.js +1 -0
  21. package/dist/client/assets/IconChevronDown-DU5i40lD.js +1 -0
  22. package/dist/client/assets/{IconEdit-BP5Emwzw.js → IconEdit-CZe-EJxX.js} +1 -1
  23. package/dist/client/assets/{IconFolderSymlink-BNWI0eXB.js → IconFolderSymlink-DkLEuUb6.js} +1 -1
  24. package/dist/client/assets/IconGitMerge-D9KEj1cE.js +1 -0
  25. package/dist/client/assets/IconGitPullRequest-ClaUqyVa.js +1 -0
  26. package/dist/client/assets/{IconLoader4-Bk6G4Bls.js → IconLoader4-D2VN7u1V.js} +1 -1
  27. package/dist/client/assets/{IconPlus-DUFNSK_i.js → IconPlus-DJCoD3wt.js} +1 -1
  28. package/dist/client/assets/{IconSearch-ZL3YVslZ.js → IconSearch-1VQ4P4kW.js} +1 -1
  29. package/dist/client/assets/{IconSelector-BGwY84R8.js → IconSelector-BVMU1PEt.js} +1 -1
  30. package/dist/client/assets/ImageFileViewer-3izbFVTw.css +1 -0
  31. package/dist/client/assets/ImageFileViewer-CdFLl_in.js +1 -0
  32. package/dist/client/assets/LinkedMarkdown-Bnc2OA63.js +1 -0
  33. package/dist/client/assets/LinkedText-BD6K3d1t.js +1 -0
  34. package/dist/client/assets/LocalRefsDialog-Bl-fddap.js +1 -0
  35. package/dist/client/assets/MarkdownFileViewer-NUAoQmv5.js +2 -0
  36. package/dist/client/assets/PairingPage-CqrxpC3_.js +1 -0
  37. package/dist/client/assets/PierreDiffViewer-CDfQ32e0.js +1 -0
  38. package/dist/client/assets/{PierreEditBoundary-Bt0q7SXc.js → PierreEditBoundary-DAdYNYZ3.js} +1 -1
  39. package/dist/client/assets/{PierreWorkerPool-DMFigp0u.js → PierreWorkerPool-mIDzTMB9.js} +3 -3
  40. package/dist/client/assets/PullRequestDiff-n1NZFHKN.js +1 -0
  41. package/dist/client/assets/PullRequestViewer-u89zl169.js +2 -0
  42. package/dist/client/assets/PullRequestsView-D6BqvB4E.js +1 -0
  43. package/dist/client/assets/QuickOpenDialog-BbEifGRi.js +1 -0
  44. package/dist/client/assets/RepositoryProjectsDialog-EGAsXL-Z.js +1 -0
  45. package/dist/client/assets/{SearchView-BYz1K1Ta.js → SearchView-BMz7qOdc.js} +1 -1
  46. package/dist/client/assets/SettingsDialog-DmD7HvhX.js +9 -0
  47. package/dist/client/assets/Viewer-CDj_vo6w.js +3 -0
  48. package/dist/client/assets/{abnfDiagram-YUKMZFIV-CpKAN_8n.js → abnfDiagram-YUKMZFIV-It6tW-4v.js} +1 -1
  49. package/dist/client/assets/{architecture-WOLXFQ4H-DrizVopY.js → architecture-WOLXFQ4H-CaOaChND.js} +1 -1
  50. package/dist/client/assets/{architectureDiagram-47P4ROYG-gvUijB3H.js → architectureDiagram-47P4ROYG-COtncecA.js} +1 -1
  51. package/dist/client/assets/{blockDiagram-E7TT5TSB-CdcXmnf_.js → blockDiagram-E7TT5TSB-NU4wFrfP.js} +1 -1
  52. package/dist/client/assets/{c4Diagram-CRA5TL53-DtoD1jKt.js → c4Diagram-CRA5TL53-0xzM4S8q.js} +1 -1
  53. package/dist/client/assets/channel-QED-4ACa.js +1 -0
  54. package/dist/client/assets/checkbox-Dh4T0bCe.js +1 -0
  55. package/dist/client/assets/{chunk-2BW5OAIV-Bxqf2dFQ.js → chunk-2BW5OAIV-BQMxlSNI.js} +1 -1
  56. package/dist/client/assets/{chunk-3YJQHVM4-BhzXJiq0.js → chunk-3YJQHVM4-CdP15KtA.js} +1 -1
  57. package/dist/client/assets/{chunk-4EA7E6EY-CvEILf8c.js → chunk-4EA7E6EY-xRPCCZLU.js} +1 -1
  58. package/dist/client/assets/{chunk-7TKQ45FW-pTEdzVz3.js → chunk-7TKQ45FW-Cr_UAObV.js} +1 -1
  59. package/dist/client/assets/{chunk-AW2ZBBNX-LVROkcXk.js → chunk-AW2ZBBNX-DBqqxF2h.js} +1 -1
  60. package/dist/client/assets/{chunk-DBDB3WZW-FCGrB-q8.js → chunk-DBDB3WZW-BonEIRP2.js} +1 -1
  61. package/dist/client/assets/{chunk-E2ZNV5FY-B3rGXPn-.js → chunk-E2ZNV5FY-DnKvxSiA.js} +1 -1
  62. package/dist/client/assets/{chunk-EU5HNXII-D6a_Ly_W.js → chunk-EU5HNXII-DLK0K3sR.js} +1 -1
  63. package/dist/client/assets/{chunk-FVRAUYC3-B5hy0Ket.js → chunk-FVRAUYC3-DmjKoYAh.js} +1 -1
  64. package/dist/client/assets/{chunk-HJ2JQQFS-CKHFz1Wl.js → chunk-HJ2JQQFS-AF4phse0.js} +1 -1
  65. package/dist/client/assets/{chunk-HTAEGDNF-CtwDuO27.js → chunk-HTAEGDNF-CG4pBnUZ.js} +1 -1
  66. package/dist/client/assets/{chunk-KQW6MTUR-BN3uxLYf.js → chunk-KQW6MTUR-Dd87yj5r.js} +1 -1
  67. package/dist/client/assets/{chunk-NTY3LDVX-CfXSvyIC.js → chunk-NTY3LDVX-OolU2PaP.js} +1 -1
  68. package/dist/client/assets/{chunk-VPRB5NB3-LAggcSji.js → chunk-VPRB5NB3-Dnr3edxV.js} +3 -3
  69. package/dist/client/assets/{chunk-XC4XBNZT-BksIPWQU.js → chunk-XC4XBNZT-CIqGRxkD.js} +1 -1
  70. package/dist/client/assets/{classDiagram-v2-K4WV4PDN-DH78Maqm.js → classDiagram-v2-K4WV4PDN-CPGawm8n.js} +1 -1
  71. package/dist/client/assets/createReactComponent-Ctub7J3a.js +1 -0
  72. package/dist/client/assets/{cynefin-EF2NZ3EQ-DozKlDV1.js → cynefin-EF2NZ3EQ-OA2R9WCH.js} +1 -1
  73. package/dist/client/assets/{cynefinDiagram-3GCD6N5R-A1yS7NKN.js → cynefinDiagram-3GCD6N5R-DqCVtoKt.js} +1 -1
  74. package/dist/client/assets/{dagre-W4DXFKR2-DRJ1mmbe.js → dagre-W4DXFKR2-kc3-tkAQ.js} +1 -1
  75. package/dist/client/assets/{diagram-2UJZ2QOL-B1sI2b2o.js → diagram-2UJZ2QOL-DoBZKT3s.js} +1 -1
  76. package/dist/client/assets/{diagram-OVF4WLC6-DLE1o4-P.js → diagram-OVF4WLC6-DGkyha_F.js} +1 -1
  77. package/dist/client/assets/{diagram-PFPMY2P6-UtIEsv14.js → diagram-PFPMY2P6-DpRDDgdV.js} +1 -1
  78. package/dist/client/assets/{diagram-UMYRVEAY-BwTyzVap.js → diagram-UMYRVEAY-DlsfhYv3.js} +1 -1
  79. package/dist/client/assets/{diagram-YEKJPTXX-DNPUQqu0.js → diagram-YEKJPTXX-BIhRZzBM.js} +1 -1
  80. package/dist/client/assets/{diagram-ZIFT7M5P-ClXykQ3I.js → diagram-ZIFT7M5P-mweJcgBZ.js} +1 -1
  81. package/dist/client/assets/diff-parse.worker-C1IFRYY9.js +13 -0
  82. package/dist/client/assets/{ebnfDiagram-VR2GEFS7-Dm8VAviu.js → ebnfDiagram-VR2GEFS7-Dn5zyIbZ.js} +1 -1
  83. package/dist/client/assets/{elk-IJKZMXRS-CEEoPARn.js → elk-IJKZMXRS-eBPlf1-o.js} +1 -1
  84. package/dist/client/assets/{erDiagram-O2IAPWRE-CaDE4obX.js → erDiagram-O2IAPWRE-WEE519yZ.js} +1 -1
  85. package/dist/client/assets/{eventmodeling-K75KTNOO-PjYgMkPC.js → eventmodeling-K75KTNOO-BgE_VmNy.js} +1 -1
  86. package/dist/client/assets/external-url-IUS7RmYD.js +1 -0
  87. package/dist/client/assets/flowDiagram-OXPTDLAJ-CHQYfkMg.js +1 -0
  88. package/dist/client/assets/{ganttDiagram-R7TSEDQI-CmkBarBi.js → ganttDiagram-R7TSEDQI-D_1KyJZU.js} +1 -1
  89. package/dist/client/assets/{gitGraph-VSP46ZUC-DeotTdHj.js → gitGraph-VSP46ZUC-CEbT7DA4.js} +1 -1
  90. package/dist/client/assets/{gitGraphDiagram-XJZIOB7I-uV1hPaZT.js → gitGraphDiagram-XJZIOB7I-QQyYc1gM.js} +1 -1
  91. package/dist/client/assets/index-DsKvWsTs.js +47 -0
  92. package/dist/client/assets/index-kyWCnbkb.css +2 -0
  93. package/dist/client/assets/{info-OHQRW6UA-BQDsGvSl.js → info-OHQRW6UA-ChHAnveo.js} +1 -1
  94. package/dist/client/assets/{infoDiagram-5W2HQ5XZ-CDfEPsgZ.js → infoDiagram-5W2HQ5XZ-BaxAE7UA.js} +1 -1
  95. package/dist/client/assets/{ishikawaDiagram-K3B6WC7H-Bb7PQGe6.js → ishikawaDiagram-K3B6WC7H-vhUflBE_.js} +1 -1
  96. package/dist/client/assets/{journeyDiagram-COXZFDF6-BDythglw.js → journeyDiagram-COXZFDF6-C8WWosVa.js} +1 -1
  97. package/dist/client/assets/{kanban-definition-P3RFRI5V-CvY5kXhh.js → kanban-definition-P3RFRI5V-CU6W9Yi3.js} +1 -1
  98. package/dist/client/assets/katex-CQfTPFh0.js +1 -0
  99. package/dist/client/assets/{line-99p2yFnB.js → line-Axq4vVX-.js} +1 -1
  100. package/dist/client/assets/{mermaid-parser.core-BjZYtoJ8.js → mermaid-parser.core-DNeaCX12.js} +3 -3
  101. package/dist/client/assets/{mermaid.core-DRcXnUox.js → mermaid.core-Dtt7rXw0.js} +4 -4
  102. package/dist/client/assets/{mindmap-definition-LZFPQGKD-t9LoCpnW.js → mindmap-definition-LZFPQGKD-D_8ZqQot.js} +1 -1
  103. package/dist/client/assets/{packet-JDAUHWVQ-BlR-5V7K.js → packet-JDAUHWVQ-6z7ujmGF.js} +1 -1
  104. package/dist/client/assets/{pegDiagram-BGZESJAR-CWeGI-T9.js → pegDiagram-BGZESJAR-3ujyk-bt.js} +1 -1
  105. package/dist/client/assets/{pie-XZMESJXO-BkvYHWgl.js → pie-XZMESJXO-DvpLy2DB.js} +1 -1
  106. package/dist/client/assets/{pieDiagram-CAPJLFHJ-CY5PPIr3.js → pieDiagram-CAPJLFHJ-BPMPWyc7.js} +1 -1
  107. package/dist/client/assets/{quadrantDiagram-GDMTTRAM-kqj-z271.js → quadrantDiagram-GDMTTRAM-BVUCR_lf.js} +1 -1
  108. package/dist/client/assets/{radar-ABXABTNO-DuEtYatv.js → radar-ABXABTNO-lu14X99R.js} +1 -1
  109. package/dist/client/assets/{railroad-I3PHUGI6-CVlnj2j9.js → railroad-I3PHUGI6-DI_WtDmt.js} +1 -1
  110. package/dist/client/assets/{railroad-abnf-LNEFI6M7-9Qiczw4d.js → railroad-abnf-LNEFI6M7-CmWAKZ2T.js} +1 -1
  111. package/dist/client/assets/{railroad-ebnf-DWYD2UWJ-BNL7TMEg.js → railroad-ebnf-DWYD2UWJ-BWKFU_UH.js} +1 -1
  112. package/dist/client/assets/{railroad-peg-JR7BVNR7-DdpRxgk6.js → railroad-peg-JR7BVNR7-9wkgzxMB.js} +1 -1
  113. package/dist/client/assets/{railroadDiagram-SM67HX2B-CDXvYNqW.js → railroadDiagram-SM67HX2B-4JnRbxl_.js} +1 -1
  114. package/dist/client/assets/{render-markdown-DF9Fy7MD.js → render-markdown-CQi2yKYQ.js} +2 -2
  115. package/dist/client/assets/{requirementDiagram-X7JNWC4A-BDdhqnZA.js → requirementDiagram-X7JNWC4A-CVJiZZsi.js} +1 -1
  116. package/dist/client/assets/{sankeyDiagram-UM26HJRW-Rkyk5oEf.js → sankeyDiagram-UM26HJRW-BmlWQdkv.js} +1 -1
  117. package/dist/client/assets/select-Dq3KDX2O.js +1 -0
  118. package/dist/client/assets/{sequenceDiagram-ZO4K6R2Y-Coj9ap7h.js → sequenceDiagram-ZO4K6R2Y-zUx3LmPj.js} +1 -1
  119. package/dist/client/assets/{stateDiagram-v2-TBUQTH76-BucWlahR.js → stateDiagram-v2-TBUQTH76-o_ci-2bu.js} +1 -1
  120. package/dist/client/assets/{swimlanes-N4OXWK64-tEECcFP9.js → swimlanes-N4OXWK64-BlI0GC5-.js} +1 -1
  121. package/dist/client/assets/swimlanesDiagram-K3J5GTZL-BEeJLN8d.js +8 -0
  122. package/dist/client/assets/tanstack-CVAt_k_T.js +1 -0
  123. package/dist/client/assets/{timeline-definition-YOQAKGHF-XvIbGO4d.js → timeline-definition-YOQAKGHF-DLnvF__o.js} +1 -1
  124. package/dist/client/assets/{treeView-D4JQ5SDB-DuhJpfXe.js → treeView-D4JQ5SDB-DPuMLQhB.js} +1 -1
  125. package/dist/client/assets/{treemap-SAJKECNS-CLiUWfZh.js → treemap-SAJKECNS-DjxqxJ8-.js} +1 -1
  126. package/dist/client/assets/{usecaseDiagram-VIAY4XPW-BuwkpV9w.js → usecaseDiagram-VIAY4XPW-BtnFNltN.js} +1 -1
  127. package/dist/client/assets/utils-D0T3A-kS.js +1 -0
  128. package/dist/client/assets/{vennDiagram-BLWOH2XV-kfza5Rxq.js → vennDiagram-BLWOH2XV-CAiF2FKz.js} +1 -1
  129. package/dist/client/assets/viewer-tabs-DkkqN9MD.js +1 -0
  130. package/dist/client/assets/{wardley-7MLQ67FV-CcbU_Ykg.js → wardley-7MLQ67FV-DAWySamq.js} +1 -1
  131. package/dist/client/assets/{wardleyDiagram-YMQ3BMBF-DnxlEg3a.js → wardleyDiagram-YMQ3BMBF-DiBCclEL.js} +1 -1
  132. package/dist/client/assets/{xychartDiagram-TAQBALBS-BzgtwtvK.js → xychartDiagram-TAQBALBS-B0NgfXz6.js} +1 -1
  133. package/dist/client/index.html +6 -4
  134. package/dist/dev.mjs +6 -6
  135. package/dist/manifest.json +1 -1
  136. package/dist/server.mjs +1 -1
  137. package/dist/service-update.mjs +11 -3
  138. package/dist/utility.mjs +25 -4
  139. package/package.json +4 -4
  140. package/dist/client/assets/App-DEIZhWJG.js +0 -132
  141. package/dist/client/assets/CreatePullRequestDialog-BceOUbYK.js +0 -2
  142. package/dist/client/assets/DiffWorkspace-BMtV4MMc.js +0 -6
  143. package/dist/client/assets/EditableFileViewer-B44TSuFu.css +0 -1
  144. package/dist/client/assets/EditableFileViewer-BE3AsnVa.js +0 -1
  145. package/dist/client/assets/FilesView-DoVhRfi1.js +0 -1
  146. package/dist/client/assets/GitHubAvatar-RiePq1Yf.js +0 -1
  147. package/dist/client/assets/HistoryView-Dl8uqmKe.js +0 -1
  148. package/dist/client/assets/HtmlFileViewer-xfjY1Swc.js +0 -2
  149. package/dist/client/assets/IconCheck-BPhxw_LS.js +0 -1
  150. package/dist/client/assets/IconChevronDown-C3FplJL8.js +0 -1
  151. package/dist/client/assets/ImageFileViewer-BJBOmpsf.css +0 -1
  152. package/dist/client/assets/ImageFileViewer-DXaIo7_d.js +0 -1
  153. package/dist/client/assets/LocalRefsDialog-C5J3kgTe.js +0 -1
  154. package/dist/client/assets/MarkdownFileViewer-18mvm0f2.js +0 -2
  155. package/dist/client/assets/PairingPage-BEUj3t0V.js +0 -1
  156. package/dist/client/assets/PierreDiffViewer-p29h7lW_.js +0 -1
  157. package/dist/client/assets/PullRequestDiff-C17JA4ko.js +0 -1
  158. package/dist/client/assets/PullRequestViewer-DaMtkESD.js +0 -2
  159. package/dist/client/assets/PullRequestsView-44f03VLC.js +0 -1
  160. package/dist/client/assets/QuickOpenDialog-Bi-L68PU.js +0 -1
  161. package/dist/client/assets/RepositoryProjectsDialog-DFGn74fe.js +0 -1
  162. package/dist/client/assets/SettingsDialog-CruoIiyN.js +0 -9
  163. package/dist/client/assets/Viewer-3WKpwRzo.js +0 -3
  164. package/dist/client/assets/channel-BqKQxg-1.js +0 -1
  165. package/dist/client/assets/checkbox-MDl2t9_3.js +0 -1
  166. package/dist/client/assets/createReactComponent-BfrD_oQK.js +0 -1
  167. package/dist/client/assets/flowDiagram-OXPTDLAJ-DSokwYKA.js +0 -1
  168. package/dist/client/assets/index-CoZCJqTQ.js +0 -47
  169. package/dist/client/assets/index-DUERTTRS.css +0 -2
  170. package/dist/client/assets/katex-C6e6EqXB.js +0 -1
  171. package/dist/client/assets/select-pZpCy7qn.js +0 -1
  172. package/dist/client/assets/swimlanesDiagram-K3J5GTZL-DEFKR6Vf.js +0 -8
  173. package/dist/client/assets/tanstack-CYi5knVJ.js +0 -1
  174. package/dist/client/assets/viewer-tabs-MMNrJqGE.js +0 -1
@@ -1 +0,0 @@
1
- .image-preview-workspace,.svg-file-viewer{background:var(--background);flex-direction:column;flex:1;height:100%;min-height:0;display:flex;position:relative}.svg-file-panel{flex-direction:column;flex:1;min-height:0;display:flex}.image-file-details{color:var(--muted-foreground);font-family:var(--font-mono);white-space:nowrap;flex:none;padding:0 7px;font-size:10px}.image-sizing-toggle,.image-zoom-controls{flex:none;align-items:center;gap:2px;display:inline-flex}.image-sizing-toggle{border-left:1px solid var(--border);border-right:1px solid var(--border);padding:0 6px}.image-preview-toolbar [data-slot=button]{border-radius:999px}.image-zoom-value{min-width:47px;font-family:var(--font-mono);font-size:10px}.image-preview-canvas{background-color:var(--background);background-image:linear-gradient(45deg, color-mix(in oklch, var(--muted) 62%, transparent) 25%, transparent 25%), linear-gradient(-45deg, color-mix(in oklch, var(--muted) 62%, transparent) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, color-mix(in oklch, var(--muted) 62%, transparent) 75%), linear-gradient(-45deg, transparent 75%, color-mix(in oklch, var(--muted) 62%, transparent) 75%);cursor:zoom-in;background-position:0 0,0 8px,8px -8px,-8px 0;background-size:16px 16px;outline:none;flex:1;justify-content:center;align-items:center;min-height:0;display:flex;overflow:auto}.image-preview-canvas[data-zoom-limit=max]{cursor:zoom-out}.image-preview-canvas:focus-visible{box-shadow:inset 0 0 0 2px var(--ring)}.image-preview-canvas[data-sizing=fit]{padding:24px}.image-preview-canvas[data-sizing=fit] img{object-fit:contain;width:auto;max-width:100%;height:auto;max-height:100%}.image-preview-canvas[data-sizing=actual] img{flex:none;margin:auto}.image-preview-canvas[data-sizing=actual]{justify-content:flex-start;align-items:flex-start}.image-preview-canvas img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;display:block}.image-preview-loading{border-radius:var(--radius-md);background:color-mix(in oklch, var(--background) 86%, transparent);color:var(--muted-foreground);align-items:center;gap:8px;padding:8px 12px;font-size:11px;display:flex}.image-preview-loading svg{width:15px;height:15px;color:var(--primary);flex:none}.image-viewer-message{background:var(--background);text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:5px;height:100%;min-height:120px;padding:24px;display:flex}.image-viewer-message strong{color:var(--foreground);font-size:13px}.image-viewer-message span{max-width:min(680px,90%);color:var(--muted-foreground);font-family:var(--font-mono);text-overflow:ellipsis;white-space:nowrap;font-size:10px;overflow:hidden}.image-viewer-tabs{border-right:1px solid var(--border);flex:none;gap:2px;padding-right:4px}.image-viewer-tabs button{height:28px;color:var(--muted-foreground);border-radius:999px;align-items:center;gap:5px;padding:0 9px;font-size:11px;font-weight:650;transition:background-color .12s,color .12s;display:inline-flex}.image-viewer-tabs button:hover:not([aria-selected=true]){background:color-mix(in oklch, var(--muted) 78%, transparent);color:var(--foreground)}.image-viewer-tabs button[aria-selected=true]{color:var(--foreground);box-shadow:none;background:0 0}.image-unsaved-dot{background:var(--warning);border-radius:50%;width:6px;height:6px}.svg-code-view{flex:1;min-height:0;overflow:hidden}@media (width<=760px){.image-file-details{display:none}.image-sizing-toggle{margin-left:auto}}
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{t as r}from"./createReactComponent-BfrD_oQK.js";import{t as i}from"./IconLoader4-Bk6G4Bls.js";import{O as a,T as o,g as s,h as c,v as l}from"./index-CoZCJqTQ.js";import{n as u,r as d,t as f}from"./viewer-tabs-MMNrJqGE.js";import{FileSaveControls as p,SourceCodeEditor as m,t as h}from"./EditableFileViewer-BE3AsnVa.js";var g=r(`outline`,`zoom-in`,`ZoomIn`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M7 10l6 0`,key:`svg-1`}],[`path`,{d:`M10 7l0 6`,key:`svg-2`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-3`}]]),_=r(`outline`,`zoom-out`,`ZoomOut`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M7 10l6 0`,key:`svg-1`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-2`}]]),v=e(t()),y=.25,b=[.25,.5,.75,1,1.25,1.5,2,3,4,6,8];function x(e){return Number.isFinite(e)?Math.min(8,Math.max(y,e)):1}function S(e){let t=x(e);return b.find(e=>e>t+2**-52)??8}function C(e){let t=x(e);return[...b].reverse().find(e=>e<t-2**-52)??.25}var w=n(),T={conflictTitle:`SVG was changed outside OpenTig`,successTitle:`SVG saved`,errorTitle:`Could not save SVG`};function E({image:e}){return e.status===`unsupported`?(0,w.jsx)(A,{title:`Image format is not supported`,detail:`${e.path} · ${N(e.size)}`}):e.status===`too-large`?(0,w.jsx)(A,{title:`Image is too large to preview`,detail:`${e.path} · ${N(e.size)} · limit ${N(e.limit)}`}):(0,w.jsx)(D,{path:e.path,mimeType:e.mimeType,size:e.size,data:e.data})}function D({path:e,mimeType:t,size:n,data:r}){let i=j(r,t);return(0,w.jsx)(k,{objectUrl:i,path:e,size:n})}function O({file:e,initialContent:t,themeType:n,wrapLines:r,readOnly:i,onDirtyChange:a,onDraftChange:o,onSave:s}){let[c,l]=(0,v.useState)(`preview`),{draft:g,updateDraft:_,dirty:y,saving:b,save:x}=h({file:e,initialContent:t,readOnly:i,messages:T,onDirtyChange:a,onDraftChange:o,onSave:s}),S=j(g,`image/svg+xml`);(0,v.useEffect)(()=>{l(`preview`)},[e.path]);let C=(0,w.jsx)(u,{label:`SVG view`,className:`file-viewer-tabs image-viewer-tabs`,items:[{value:`preview`,label:`Preview`},{value:`code`,label:(0,w.jsxs)(w.Fragment,{children:[`Code `,y&&(0,w.jsx)(`span`,{className:`image-unsaved-dot`,"aria-label":`Unsaved changes`})]})}]}),E=(0,w.jsx)(p,{dirty:y,saving:b,readOnly:i,onSave:()=>void x()});return(0,w.jsxs)(f,{value:c,onValueChange:e=>l(e),className:`svg-file-viewer`,children:[(0,w.jsx)(d,{value:`preview`,className:`svg-file-panel`,children:(0,w.jsx)(k,{objectUrl:S,path:e.path,size:new TextEncoder().encode(g).byteLength,toolbarStart:C,toolbarEnd:E})}),(0,w.jsxs)(d,{value:`code`,className:`svg-file-panel`,children:[(0,w.jsxs)(`div`,{className:`file-viewer-pill svg-file-toolbar`,children:[C,E]}),(0,w.jsx)(`div`,{className:`svg-code-view`,children:(0,w.jsx)(m,{path:e.path,cacheKey:e.path,value:g,themeType:n,wrapLines:r,readOnly:i||b,onChange:_})})]})]})}function k({objectUrl:e,path:t,size:n,toolbarStart:r,toolbarEnd:u}){let[d,f]=(0,v.useState)(`fit`),[p,m]=(0,v.useState)(1),[h,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(!1),T=(0,v.useRef)(null);(0,v.useEffect)(()=>{y(null),x(!1)},[e]),(0,v.useEffect)(()=>{let e=T.current;if(!e)return;let t=0,n=e=>{e.preventDefault();let n=e.deltaMode===WheelEvent.DOM_DELTA_LINE?16:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?100:1;if(t+=e.deltaY*n,Math.abs(t)<24)return;let r=t<0;t=0,f(`actual`),m(e=>r?S(e):C(e))};return e.addEventListener(`wheel`,n,{passive:!1}),()=>e.removeEventListener(`wheel`,n)},[]);let E=h?h.width*p:void 0,D=h?h.height*p:void 0,O=[N(n),h?`${h.width} × ${h.height}`:null].filter(Boolean).join(` · `),k=e=>{f(`actual`),m(t=>e===`in`?S(t):C(t))};return(0,w.jsxs)(`div`,{className:`image-preview-workspace`,children:[(0,w.jsxs)(`div`,{className:`file-viewer-pill image-preview-toolbar`,children:[r,(0,w.jsx)(`span`,{className:`image-file-details`,children:O}),(0,w.jsxs)(`div`,{className:`image-sizing-toggle`,role:`group`,"aria-label":`Image size`,children:[(0,w.jsx)(o,{type:`button`,size:`xs`,variant:d===`fit`?`secondary`:`ghost`,"aria-pressed":d===`fit`,onClick:()=>f(`fit`),children:`Fit`}),(0,w.jsx)(o,{type:`button`,size:`xs`,variant:d===`actual`&&p===1?`secondary`:`ghost`,"aria-pressed":d===`actual`&&p===1,onClick:()=>{f(`actual`),m(1)},children:`1:1`})]}),(0,w.jsxs)(`div`,{className:`image-zoom-controls`,children:[(0,w.jsxs)(c,{children:[(0,w.jsx)(l,{render:(0,w.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Zoom out`,onClick:()=>k(`out`)}),children:(0,w.jsx)(_,{})}),(0,w.jsx)(s,{children:`Zoom out`})]}),(0,w.jsxs)(o,{type:`button`,variant:`ghost`,size:`xs`,className:`image-zoom-value`,"aria-label":`Reset zoom to 100%`,onClick:()=>{f(`actual`),m(1)},children:[Math.round(p*100),`%`]}),(0,w.jsxs)(c,{children:[(0,w.jsx)(l,{render:(0,w.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Zoom in`,onClick:()=>k(`in`)}),children:(0,w.jsx)(g,{})}),(0,w.jsx)(s,{children:`Zoom in`})]})]}),u]}),(0,w.jsx)(`div`,{ref:T,className:`image-preview-canvas`,"data-sizing":d,"data-zoom-limit":p>=8?`max`:`normal`,tabIndex:0,"aria-label":`Image preview for ${t}`,onKeyDown:e=>{if(e.key===`+`||e.key===`=`)k(`in`);else if(e.key===`-`)k(`out`);else if(e.key===`0`)f(`actual`),m(1);else if(e.key.toLowerCase()===`f`)f(`fit`);else return;e.preventDefault()},children:e?b?(0,w.jsx)(A,{title:`Could not decode this image`,detail:t}):(0,w.jsx)(`img`,{src:e,alt:M(t),draggable:!1,style:d===`actual`&&E&&D?{width:E,height:D,maxWidth:`none`,maxHeight:`none`}:void 0,onLoad:e=>{x(!1),y({width:e.currentTarget.naturalWidth,height:e.currentTarget.naturalHeight})},onError:()=>x(!0)}):(0,w.jsxs)(`span`,{className:`image-preview-loading`,children:[(0,w.jsx)(i,{className:`animate-spin`,"aria-hidden":`true`}),(0,w.jsx)(a,{text:`Loading image…`})]})})]})}function A({title:e,detail:t}){return(0,w.jsxs)(`div`,{className:`image-viewer-message`,children:[(0,w.jsx)(`strong`,{children:e}),(0,w.jsx)(`span`,{children:t})]})}function j(e,t){let[n,r]=(0,v.useState)(null);return(0,v.useEffect)(()=>{let n=typeof e==`string`?e:new Uint8Array(e),i=URL.createObjectURL(new Blob([n],{type:t}));return r(i),()=>{URL.revokeObjectURL(i),r(e=>e===i?null:e)}},[t,e]),n}function M(e){return e.replace(/\\/g,`/`).split(`/`).pop()||e}function N(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}export{E as ImageFileViewer,O as SvgFileViewer};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{l as r,m as i}from"./tanstack-CYi5knVJ.js";import{t as a}from"./createReactComponent-BfrD_oQK.js";import{t as o}from"./IconAlertTriangle-C1OX2bTH.js";import{t as s}from"./IconCheck-BPhxw_LS.js";import{t as c}from"./IconLoader4-Bk6G4Bls.js";import{t as l}from"./IconSearch-ZL3YVslZ.js";import{O as u,S as d,T as f,g as ee,h as p,l as m,n as h,v as te,w as ne}from"./index-CoZCJqTQ.js";import{A as g,At as _,Bt as v,Ct as y,D as b,Dt as re,Et as ie,F as ae,Ht as x,I as S,L as oe,M as se,N as C,O as w,Ot as ce,P as le,Pt as ue,R as T,Rt as de,St as fe,Tt as pe,Vt as E,_ as D,g as O,j as me,jt as k,k as A,kt as he,qt as j,wt as ge,xt as M,zt as _e}from"./App-DEIZhWJG.js";import{t as N}from"./checkbox-MDl2t9_3.js";var ve=a(`outline`,`cloud`,`Cloud`,[[`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`}]]),P=a(`outline`,`git-pull-request-closed`,`GitPullRequestClosed`,[[`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`}]]),F=e(t()),I=n();function ye(e){let{details:t,pullRequest:n,anyBusy:r}=e,i=t.remoteState===`missing`,[a,s]=(0,F.useState)(!1),[l,d]=(0,F.useState)(t.branchName);return(0,F.useEffect)(()=>{s(!1),d(t.branchName)},[t.fullName,t.branchName]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,I.jsxs)(`h3`,{children:[(0,I.jsx)(ve,{"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[t.remote,`/`,t.branchName]})]}),(0,I.jsx)(`small`,{className:`local-refs-remote-label`,children:i?`Deleted on remote · Cached reference`:`Remote branch${t.defaultBranch===t.branchName?` · Default`:``}`})]}),(0,I.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Remote`}),(0,I.jsx)(`dd`,{children:t.remote})]}),(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Full ref`}),(0,I.jsx)(`dd`,{children:(0,I.jsx)(`code`,{className:`local-refs-selectable`,children:t.fullName})})]}),(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Fetched tip`}),(0,I.jsxs)(`dd`,{children:[(0,I.jsx)(`code`,{children:t.shortOid}),` `,t.subject]})]}),(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Author`}),(0,I.jsx)(`dd`,{children:t.author||`—`})]}),(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Last commit`}),(0,I.jsx)(`dd`,{children:t.date?y(t.date):`—`})]}),(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`Local branches`}),(0,I.jsxs)(`dd`,{children:[t.localBranches.length?t.localBranches.map(t=>(0,I.jsxs)(`button`,{type:`button`,className:`local-refs-local-link`,disabled:r,onClick:()=>e.onShowLocal(t.fullName),children:[(0,I.jsx)(x,{"aria-hidden":`true`}),t.name,t.worktreePath?` · In a worktree`:``]},t.fullName)):`No local tracking branch`,!i&&!a&&(0,I.jsxs)(`div`,{className:`local-refs-tracking-action`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`local-refs-local-link`,disabled:r,onClick:()=>s(!0),children:[(0,I.jsx)(x,{"aria-hidden":`true`}),t.localBranches.length?`Create another local tracking branch…`:`Create local tracking branch…`]}),(0,I.jsx)(`small`,{children:`Work on this branch locally without switching your checkout.`})]})]})]}),n&&(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:`GitHub PR`}),(0,I.jsx)(`dd`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`local-refs-pr-link ${n.state.toLowerCase()}${n.state===`OPEN`&&n.isDraft?` draft`:``}`,onClick:()=>O(n.url),children:[n.state===`MERGED`?(0,I.jsx)(v,{"aria-hidden":`true`}):n.state===`CLOSED`?(0,I.jsx)(P,{"aria-hidden":`true`}):(0,I.jsx)(_e,{"aria-hidden":`true`}),`#`,n.number,` · `,n.state===`MERGED`?`Merged into ${n.baseRefName}`:D(n),(0,I.jsx)(j,{"aria-hidden":`true`})]})})]})]}),a&&!i&&(0,I.jsxs)(`form`,{className:`local-refs-create-branch`,onSubmit:t=>{t.preventDefault(),!r&&l.trim()&&e.onCreate(l.trim())},children:[(0,I.jsx)(`label`,{htmlFor:`tracking-branch-name`,children:`Local branch name`}),(0,I.jsx)(`input`,{id:`tracking-branch-name`,value:l,onChange:e=>d(e.target.value),disabled:r,autoFocus:!0,autoComplete:`off`,spellCheck:!1}),(0,I.jsx)(`p`,{children:`Creates a tracking branch at the fetched tip. Your checkout and uncommitted changes stay intact.`}),(0,I.jsxs)(`div`,{className:`local-refs-detail-actions`,children:[(0,I.jsxs)(f,{type:`submit`,variant:`outline`,size:`sm`,disabled:r||!l.trim(),children:[e.creating?(0,I.jsx)(c,{className:`animate-spin`}):(0,I.jsx)(x,{}),` `,e.creating?(0,I.jsx)(u,{text:`Creating…`}):`Create local branch`]}),(0,I.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,onClick:()=>s(!1),children:`Cancel`})]})]}),(0,I.jsx)(`div`,{className:`local-refs-danger ${t.deletionBlockedReason?`blocked`:`ready`}`,children:t.deletionBlockedReason?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`local-refs-reason`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:i?`This branch was already deleted from ${t.remote}. Only its cached reference remains; there is no remote branch to delete.`:t.deletionBlockedReason})]}),i&&(0,I.jsxs)(f,{variant:`outline`,size:`sm`,disabled:r,onClick:e.onFetch,children:[e.fetching?(0,I.jsx)(c,{className:`animate-spin`}):(0,I.jsx)(ue,{}),e.fetching?(0,I.jsx)(u,{text:`Fetching…`}):`Fetch and clean up`]})]}):e.confirming?(0,I.jsxs)(`div`,{className:`local-refs-confirm`,role:`alert`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsxs)(`p`,{children:[`Delete `,(0,I.jsx)(`strong`,{children:t.branchName}),` from `,(0,I.jsx)(`strong`,{children:t.remote}),`? This removes the branch on the remote server. Your local branches, commits and worktrees stay intact.`]}),(0,I.jsxs)(`span`,{className:`local-refs-confirm-actions`,children:[(0,I.jsxs)(f,{variant:`destructive`,size:`sm`,disabled:r,onClick:e.onDelete,children:[e.deleting?(0,I.jsx)(c,{className:`animate-spin`}):(0,I.jsx)(k,{}),e.deleting?(0,I.jsx)(u,{text:`Deleting…`}):`Delete from ${t.remote}`]}),(0,I.jsx)(f,{variant:`ghost`,size:`sm`,disabled:r,onClick:e.onCancel,children:`Cancel`})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`local-refs-reason`,children:[(0,I.jsx)(ve,{"aria-hidden":`true`}),(0,I.jsxs)(`span`,{children:[`Delete only this branch from `,t.remote,`. Local branches and worktrees are kept.`]})]}),(0,I.jsxs)(f,{variant:`destructive`,size:`sm`,disabled:r,onClick:e.onConfirm,children:[(0,I.jsx)(k,{}),`Delete from `,t.remote]})]})})]})}function L(e){let{open:t,tab:n,repositoryId:a,onMutated:s,onBusyChange:ne}=e,v=i(),[y,C]=(0,F.useState)(``),[w,T]=(0,F.useState)(`all`),[E,D]=(0,F.useState)(``),[O,k]=(0,F.useState)(!1),[A,j]=(0,F.useState)(null),[M,_e]=(0,F.useState)(null),[N,P]=(0,F.useState)(null),[L,R]=(0,F.useState)(null),[B,V]=(0,F.useState)(null),[Ee,De]=(0,F.useState)(!1),Oe=(0,F.useRef)(null);(0,F.useEffect)(()=>{k(!1)},[t,a]);let H=r({queryKey:h.localRefs(a),queryFn:()=>m.refs.localRefsSnapshot(a),enabled:t}),U=H.data??null,ke=H.isFetching,Ae=H.error?Te(H.error):null,W=(0,F.useMemo)(()=>me(U?.branches??[],y).filter(e=>(w===`all`||e.remote===(w===`remote`))&&(!e.remote||!E||e.remoteName===E)),[U,y,w,E]),je=(0,F.useMemo)(()=>{let e=[...new Set(W.filter(e=>e.remote).map(e=>e.remoteName??`Unmapped references`))];return[{label:`Local`,branches:W.filter(e=>!e.remote)},...e.map(e=>({label:e,branches:W.filter(t=>t.remote&&(t.remoteName??`Unmapped references`)===e)}))].filter(e=>e.branches.length>0)},[W]),Me=(0,F.useMemo)(()=>se(U?.worktrees??[],y),[U,y]),G=W.find(e=>g(e)===A)??null,K=Me.find(e=>S(e)===M)??null,Ne=r({queryKey:h.branchDetails(a,G?.fullName??``),queryFn:()=>m.refs.branchDetails({repositoryId:a,fullName:G.fullName}),enabled:t&&n===`branches`&&G!==null&&!G.remote}),q=Ne.data??null,Pe=r({queryKey:h.remoteBranchDetails(a,G?.fullName??``),queryFn:()=>m.refs.remoteBranchDetails({repositoryId:a,fullName:G.fullName}),enabled:t&&n===`branches`&&G?.remote===!0,staleTime:3e4}),J=Pe.data??null,Fe=G?.remote?J?.branchName:q?.name,Ie=r({queryKey:h.branchPullRequest(a,Fe??``),queryFn:()=>m.github.findPullRequestForBranch(a,Fe),enabled:t&&n===`branches`&&!!Fe&&(G?.remote?J?.remote===`origin`:q!==null&&(q.deletion===`unknown`||q.deletion===`unmerged`))}),Le=G?.remote&&J?.remote!==`origin`?null:Ie.data??null,Re=r({queryKey:h.worktreeDetails(a,K?.path??``),queryFn:()=>m.refs.worktreeDetails({repositoryId:a,path:K.path}),enabled:t&&n===`worktrees`&&K!==null}),Y=Re.data??null,ze=n===`branches`?G?.remote?Pe:Ne:Re,X=ze.isFetching,Z=ze.error?Te(ze.error):null,Q=(0,F.useCallback)(async()=>{await H.refetch(),await Promise.all([v.invalidateQueries({queryKey:[`repository`,a,`branch-details`]}),v.invalidateQueries({queryKey:[`repository`,a,`remote-branch-details`]}),v.invalidateQueries({queryKey:[`repository`,a,`worktree-details`]}),v.invalidateQueries({queryKey:[`repository`,a,`branch-pull-request`]})])},[v,a,H]);(0,F.useEffect)(()=>{if(!U)return;let e=Oe.current;Oe.current=U,j(t=>le(W.map(g),(e?.branches??[]).map(g),t)),_e(t=>le(U.worktrees.map(S),(e?.worktrees??[]).map(S),t))},[U,W]),(0,F.useEffect)(()=>{t||(C(``),T(`all`),D(``),P(null),V(null),De(!1))},[t]),(0,F.useEffect)(()=>{P(null),V(null),De(!1)},[n,A,M]);let $=async(e,t)=>{R(e),ne(!0),V(null);try{await t()&&P(null)}catch(e){V(Te(e))}finally{R(null),ne(!1)}},Be=(e,t)=>$(`delete-branch`,async()=>{let n=await m.refs.deleteBranch({repositoryId:a,fullName:e.fullName,expectedOid:e.oid,force:t});return n.status===`deleted`?(s(null),await Q(),!0):(V(Se(n.status)),await Q(),!1)}),Ve=e=>$(`delete-remote-branch`,async()=>{let t=await m.refs.deleteRemoteBranch({repositoryId:a,fullName:e.fullName,expectedOid:e.oid,destinationId:e.destinationId});if(t.status!==`deleted`)return V(t.status===`rejected`?t.message:Ce(t.status)),await Q(),!1;let n=await m.refs.fetchBranches(a);return s(null),await Q(),n.status===`failed`&&V(`The remote branch was deleted, but fetching failed. Fetch again to update the list.`),!0}),He=(e,t)=>$(`create-tracking-branch`,async()=>{let n=await m.refs.createTrackingBranch({repositoryId:a,fullName:e.fullName,expectedOid:e.oid,localName:t});return n.status===`created`?(s(null),await Q(),C(``),T(`local`),D(``),j(n.fullName),!0):(V(n.status===`exists`?`That local branch already exists. Choose another name.`:Ce(n.status)),await Q(),!1)}),Ue=()=>$(`fetch-branches`,async()=>{let e=await m.refs.fetchBranches(a);return s(null),await Q(),e.status===`failed`&&V(e.message),e.status===`success`}),We=(e,t,n)=>$(`remove-worktree`,async()=>{let r=await m.refs.removeWorktree({repositoryId:a,path:e.path,expectedOid:e.oid,force:t,deleteBranch:n});return r.status===`removed`?(s(r.recentRepositories),await Q(),!0):(V(we(r.status)),await Q(),!1)}),Ge=async e=>{try{await d(e),De(!0),window.setTimeout(()=>De(!1),1600)}catch(e){V(Te(e))}},Ke={branches:U?.branches.length??0,worktrees:U?.worktrees.length??0},qe=n===`branches`?W.length===0:Me.length===0;return(0,I.jsx)(pe,{open:t,onOpenChange:t=>{L||e.onOpenChange(t)},children:(0,I.jsxs)(ce,{className:`local-refs-dialog`,children:[(0,I.jsxs)(`header`,{className:`local-refs-header`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(he,{children:`Branches and worktrees`}),(0,I.jsx)(re,{children:`Inspect local and remote branches, and manage this repository’s worktrees.`})]}),(0,I.jsx)(ie,{render:(0,I.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close the refs manager`,disabled:!!L}),children:(0,I.jsx)(_,{})})]}),(0,I.jsxs)(`div`,{className:`local-refs-toolbar`,children:[(0,I.jsx)(`div`,{className:`local-refs-tabs`,role:`tablist`,"aria-label":`Branches and worktrees`,children:[`branches`,`worktrees`].map(t=>(0,I.jsxs)(`button`,{type:`button`,role:`tab`,id:`local-refs-tab-${t}`,"aria-selected":n===t,"aria-controls":`local-refs-panel-${t}`,className:`local-refs-tab`,disabled:!!L,onClick:()=>{e.onTabChange(t),k(!1)},children:[t===`branches`?(0,I.jsx)(x,{"aria-hidden":`true`}):(0,I.jsx)(de,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:t===`branches`?`Branches`:`Worktrees`}),(0,I.jsx)(`small`,{children:Ke[t]})]},t))}),(0,I.jsxs)(`div`,{className:`local-refs-search`,children:[(0,I.jsx)(l,{"aria-hidden":`true`}),(0,I.jsxs)(`label`,{className:`sr-only`,htmlFor:`local-refs-search-input`,children:[`Search `,n]}),(0,I.jsx)(`input`,{id:`local-refs-search-input`,value:y,disabled:!!L,onChange:e=>C(e.target.value),placeholder:n===`branches`?`Search branches…`:`Search worktrees…`,autoComplete:`off`,spellCheck:!1}),y&&(0,I.jsx)(f,{variant:`ghost`,size:`icon-xs`,"aria-label":`Clear search`,disabled:!!L,onClick:()=>C(``),children:(0,I.jsx)(_,{})})]}),(0,I.jsxs)(p,{children:[(0,I.jsxs)(te,{render:(0,I.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>n===`branches`?void Ue():void Q(),disabled:ke||!!L}),children:[ke||L===`fetch-branches`?(0,I.jsx)(c,{className:`animate-spin`}):(0,I.jsx)(ue,{}),` `,n===`branches`?`Fetch`:`Refresh`]}),(0,I.jsx)(ee,{children:n===`branches`?`Fetch branches from all remotes and remove obsolete remote references`:`Refresh local worktrees`})]})]}),n===`branches`&&(0,I.jsxs)(`div`,{className:`local-refs-branch-filters`,children:[(0,I.jsx)(`div`,{className:`local-refs-tabs`,role:`group`,"aria-label":`Branch scope`,children:[`all`,`local`,`remote`].map(e=>(0,I.jsx)(`button`,{type:`button`,className:`local-refs-tab`,"aria-pressed":w===e,disabled:!!L,onClick:()=>{T(e),k(!1)},children:e===`all`?`All`:e===`local`?`Local`:`Remote`},e))}),w!==`local`&&(0,I.jsx)(ge,{label:`Filter by remote`,placeholder:`Search remotes…`,value:E,triggerLabel:E||`All remotes`,onValueChange:e=>{D(e),k(!1)},disabled:!!L,groups:[{id:`remotes`,label:`Remotes`,items:[{value:``,label:`All remotes`,pinned:!0},...(U?.remotes??[]).map(e=>({value:e,label:e}))]}]}),(0,I.jsx)(`small`,{children:`Remote refs reflect the last fetch.`})]}),(Ae||B)&&(0,I.jsxs)(`div`,{className:`local-refs-error`,role:`alert`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:Ae??B})]}),O&&(0,I.jsxs)(`button`,{type:`button`,className:`local-refs-mobile-back`,onClick:()=>k(!1),children:[`← Back to `,n]}),(0,I.jsxs)(`div`,{className:`local-refs-body`,"data-mobile-detail":O,role:`tabpanel`,id:`local-refs-panel-${n}`,"aria-labelledby":`local-refs-tab-${n}`,children:[(0,I.jsxs)(`div`,{className:`local-refs-list`,role:`listbox`,"aria-label":n===`branches`?`Branches`:`Worktrees`,tabIndex:-1,children:[ke&&!U&&(0,I.jsxs)(`p`,{className:`local-refs-placeholder`,children:[(0,I.jsx)(c,{className:`animate-spin`,"aria-hidden":`true`}),(0,I.jsx)(u,{text:`Reading the repository…`})]}),!ke&&qe&&(0,I.jsx)(`p`,{className:`local-refs-placeholder`,children:y||E?`No matches for these filters.`:`This repository has no ${n===`branches`?`${w===`all`?``:`${w} `}branches`:`worktrees`}.`}),n===`branches`&&je.map(e=>(0,I.jsxs)(`div`,{className:`local-refs-branch-group`,role:`group`,"aria-label":e.label,children:[(0,I.jsxs)(`div`,{className:`local-refs-group-heading`,children:[(0,I.jsx)(`span`,{children:e.label}),(0,I.jsx)(`small`,{children:e.branches.length})]}),e.branches.map(e=>(0,I.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":g(e)===A,className:`local-refs-row`,disabled:!!L,onClick:()=>{j(g(e)),k(!0)},children:[(0,I.jsxs)(`span`,{className:`local-refs-row-head`,children:[e.remote?(0,I.jsx)(ve,{"aria-hidden":`true`}):(0,I.jsx)(x,{"aria-hidden":`true`}),(0,I.jsx)(`strong`,{children:e.remoteBranchName??e.name}),(0,I.jsx)(z,{badges:b(e)})]}),(0,I.jsxs)(`small`,{className:`local-refs-row-meta`,children:[(0,I.jsx)(`code`,{children:e.shortOid}),e.subject&&(0,I.jsx)(`span`,{children:e.subject}),e.date&&(0,I.jsx)(`time`,{dateTime:e.date,children:fe(e.date)})]})]},g(e)))]},e.label)),n===`worktrees`&&Me.map(e=>(0,I.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":S(e)===M,className:`local-refs-row`,disabled:!!L,onClick:()=>{_e(S(e)),k(!0)},children:[(0,I.jsxs)(`span`,{className:`local-refs-row-head`,children:[(0,I.jsx)(de,{"aria-hidden":`true`}),(0,I.jsx)(`strong`,{children:oe(e.path)}),(0,I.jsx)(z,{badges:ae(e)})]}),(0,I.jsxs)(`small`,{className:`local-refs-row-meta`,children:[(0,I.jsx)(`span`,{className:`local-refs-row-branch`,children:e.branch?`${e.branch}`:`Detached HEAD`}),(0,I.jsx)(`span`,{children:e.path})]})]},S(e)))]}),(0,I.jsxs)(`div`,{className:`local-refs-detail`,children:[Z&&(0,I.jsxs)(`div`,{className:`local-refs-error`,role:`alert`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:Z})]}),X&&(0,I.jsxs)(`p`,{className:`local-refs-placeholder`,children:[(0,I.jsx)(c,{className:`animate-spin`,"aria-hidden":`true`}),(0,I.jsx)(u,{text:`Loading details…`})]}),!X&&!Z&&n===`branches`&&J&&G?.remote&&(0,I.jsx)(ye,{details:J,pullRequest:Le,anyBusy:!!L,deleting:L===`delete-remote-branch`,creating:L===`create-tracking-branch`,confirming:N===`delete-remote-branch`,onConfirm:()=>P(`delete-remote-branch`),onCancel:()=>P(null),onDelete:()=>void Ve(J),onCreate:e=>void He(J,e),onFetch:()=>void Ue(),fetching:L===`fetch-branches`,onShowLocal:e=>{C(``),T(`local`),D(``),j(e)}}),!X&&!Z&&n===`branches`&&q&&G&&!G.remote&&(0,I.jsx)(be,{details:q,pullRequest:Le,busy:L===`delete-branch`,anyBusy:!!L,confirming:N===`delete-branch`,actionError:B,onConfirm:()=>P(`delete-branch`),onCancel:()=>P(null),onDelete:e=>void Be(q,e)}),!X&&!Z&&n===`worktrees`&&Y&&K&&(0,I.jsx)(xe,{details:Y,busy:L===`remove-worktree`,anyBusy:!!L,confirming:N===`remove-worktree`,actionError:B,copied:Ee,onConfirm:()=>P(`remove-worktree`),onCancel:()=>P(null),onRemove:(e,t)=>void We(Y,e,t),onCopyPath:()=>void Ge(Y.path),onOpen:()=>e.onOpenWorktree(Y.path),onShowBranch:()=>{Y.branch&&(j(`refs/heads/${Y.branch}`),C(``),T(`local`),D(``),e.onTabChange(`branches`))}}),!X&&!Z&&!G&&!K&&(0,I.jsxs)(`p`,{className:`local-refs-placeholder`,children:[`Select a `,n===`branches`?`branch`:`worktree`,` to see its details.`]})]})]},n),(0,I.jsxs)(`footer`,{className:`local-refs-footer`,children:[(0,I.jsx)(`small`,{children:`Deleting a remote branch keeps local branches and worktrees. Removing a worktree deletes its branch only when explicitly selected.`}),(0,I.jsx)(ie,{render:(0,I.jsx)(f,{variant:`outline`,size:`sm`,disabled:!!L}),children:`Done`})]})]})})}function be({details:e,pullRequest:t,busy:n,anyBusy:r,confirming:i,actionError:a,onConfirm:o,onCancel:s,onDelete:c}){let l=w(e,t),u=l.forceAllowed===!0,d=l.allowed||u;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,I.jsxs)(`h3`,{children:[(0,I.jsx)(x,{"aria-hidden":`true`}),(0,I.jsxs)(p,{children:[(0,I.jsx)(te,{render:(0,I.jsx)(`span`,{}),children:e.name}),(0,I.jsx)(ee,{children:e.name})]})]}),(0,I.jsx)(z,{badges:A(e)})]}),(0,I.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,I.jsx)(B,{label:`Full ref`,children:(0,I.jsx)(`code`,{className:`local-refs-selectable`,children:e.fullName})}),(0,I.jsxs)(B,{label:`Tip`,children:[(0,I.jsx)(`code`,{children:e.shortOid}),` `,e.subject]}),(0,I.jsx)(B,{label:`Author`,children:e.author||`—`}),(0,I.jsx)(B,{label:`Last commit`,children:e.date?y(e.date):`—`}),(0,I.jsx)(B,{label:`Upstream`,children:e.upstream?`${e.upstream} · ↑${e.ahead} ↓${e.behind}`:`Not configured`}),(0,I.jsx)(B,{label:`Compared with`,children:e.comparisonBase??`Not compared`}),t&&(0,I.jsx)(B,{label:`GitHub PR`,children:(0,I.jsxs)(`button`,{type:`button`,className:`local-refs-pr-link`,onClick:()=>O(t.url),children:[`#`,t.number,` · `,t.state===`MERGED`?`Merged into ${t.baseRefName}`:t.state===`OPEN`?`Open`:`Closed`,` `,(0,I.jsx)(j,{"aria-hidden":`true`})]})})]}),(0,I.jsx)(R,{tone:l.allowed?`ready`:`blocked`,reason:l.reason,actionError:a,confirming:i,busy:n,anyBusy:r,actionLabel:u?`Force delete branch`:`Delete branch`,confirmLabel:n?`Deleting…`:u?`Permanently delete`:`Delete branch`,allowed:d,confirmation:u?(0,I.jsxs)(I.Fragment,{children:[`Force-delete the local branch `,(0,I.jsx)(`strong`,{children:e.name}),`? This keeps any remote branch and pull request, but commits found only on this local branch may become inaccessible. `,t?.state===`MERGED`?(0,I.jsxs)(I.Fragment,{children:[`GitHub reports PR `,(0,I.jsxs)(`strong`,{children:[`#`,t.number]}),` as merged into `,(0,I.jsx)(`strong`,{children:t.baseRefName}),`, although local Git cannot verify the ancestry.`]}):null]}):(0,I.jsxs)(I.Fragment,{children:[`Delete the local branch `,(0,I.jsx)(`strong`,{children:e.name}),`? This removes only the local branch, keeping every worktree and any remote copy. Git confirmed it is fully merged into `,(0,I.jsx)(`strong`,{children:e.comparisonBase}),`.`]}),onConfirm:o,onCancel:s,onAct:()=>c(u)})]})}function xe({details:e,busy:t,anyBusy:n,confirming:r,actionError:i,copied:a,onConfirm:o,onCancel:c,onRemove:l,onCopyPath:u,onOpen:d,onShowBranch:m}){let[h,g]=(0,F.useState)(!1),_=T(e),v=C(e),b=_.forceAllowed===!0,re=_.allowed||b;return(0,F.useEffect)(()=>g(!1),[e.path]),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,I.jsxs)(`h3`,{children:[(0,I.jsx)(de,{"aria-hidden":`true`}),(0,I.jsxs)(p,{children:[(0,I.jsx)(te,{render:(0,I.jsx)(`span`,{}),children:oe(e.path)}),(0,I.jsx)(ee,{children:oe(e.path)})]})]}),(0,I.jsx)(z,{badges:ae(e)})]}),(0,I.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,I.jsx)(B,{label:`Folder`,children:(0,I.jsx)(`span`,{className:`local-refs-path local-refs-selectable`,children:e.path})}),(0,I.jsx)(B,{label:`Branch`,children:e.branch??`Detached HEAD`}),(0,I.jsx)(B,{label:`HEAD`,children:e.lastCommit?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`code`,{children:e.lastCommit.shortOid}),` `,e.lastCommit.subject]}):(0,I.jsx)(`code`,{children:e.oid?e.oid.slice(0,7):`—`})}),(0,I.jsx)(B,{label:`Committed`,children:e.lastCommit?.date?y(e.lastCommit.date):`—`}),(0,I.jsx)(B,{label:`Local changes`,children:e.available?v??`None`:`Not readable`})]}),(0,I.jsxs)(`div`,{className:`local-refs-detail-actions`,children:[(0,I.jsxs)(f,{variant:`outline`,size:`sm`,onClick:u,disabled:n,children:[a?(0,I.jsx)(s,{}):(0,I.jsx)(ne,{}),` `,a?`Copied`:`Copy path`]}),!e.current&&e.available&&!e.locked&&(0,I.jsxs)(f,{variant:`outline`,size:`sm`,onClick:d,disabled:n,children:[(0,I.jsx)(j,{}),` Open worktree`]}),e.branch&&(0,I.jsxs)(f,{variant:`ghost`,size:`sm`,onClick:m,disabled:n,children:[(0,I.jsx)(x,{}),` Show branch`]})]}),e.branch&&re&&(0,I.jsxs)(`label`,{htmlFor:`remove-worktree-delete-branch`,className:`local-refs-delete-branch`,children:[(0,I.jsx)(N,{id:`remove-worktree-delete-branch`,checked:h,onCheckedChange:e=>g(e===!0),disabled:n}),(0,I.jsxs)(`span`,{children:[`Also delete branch `,(0,I.jsx)(`strong`,{children:e.branch})]})]}),(0,I.jsx)(R,{tone:_.allowed?`ready`:`blocked`,reason:_.reason,actionError:i,confirming:r,busy:t,anyBusy:n,actionLabel:b?`Force remove worktree`:`Remove worktree`,confirmLabel:t?`Removing…`:b?`Permanently remove`:`Remove worktree`,allowed:re,confirmation:(0,I.jsxs)(I.Fragment,{children:[b?(0,I.jsxs)(I.Fragment,{children:[`Permanently remove the worktree at `,(0,I.jsx)(`strong`,{className:`local-refs-path`,children:e.path}),`? `,(0,I.jsx)(`strong`,{children:v??`The ${e.operation??`current Git operation`}`}),` and every uncommitted file will be lost. The folder is deleted from disk and is `,(0,I.jsx)(`strong`,{children:`not`}),` moved to system Trash. `]}):(0,I.jsxs)(I.Fragment,{children:[`Remove the worktree at `,(0,I.jsx)(`strong`,{className:`local-refs-path`,children:e.path}),`? The folder is deleted from disk and is `,(0,I.jsx)(`strong`,{children:`not`}),` moved to system Trash. `]}),h&&e.branch?(0,I.jsxs)(I.Fragment,{children:[`The branch `,(0,I.jsx)(`strong`,{children:e.branch}),` will also be force-deleted. Commits found only on that branch may become inaccessible.`]}):e.branch?(0,I.jsxs)(I.Fragment,{children:[`The branch `,(0,I.jsx)(`strong`,{children:e.branch}),` and its commits stay in the repository.`]}):`No branch is deleted.`]}),onConfirm:o,onCancel:c,onAct:()=>l(b,h)})]})}function R({tone:e,reason:t,actionError:n,confirming:r,busy:i,anyBusy:a,allowed:s,actionLabel:l,confirmLabel:d,confirmation:ee,onConfirm:p,onCancel:m,onAct:h}){return(0,I.jsxs)(`div`,{className:`local-refs-danger ${e}`,children:[n&&(0,I.jsxs)(`p`,{className:`local-refs-danger-error`,role:`alert`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:n})]}),r&&s?(0,I.jsxs)(`div`,{className:`local-refs-confirm`,role:`alert`,children:[(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`p`,{children:ee}),(0,I.jsxs)(`span`,{className:`local-refs-confirm-actions`,children:[(0,I.jsxs)(f,{variant:`destructive`,size:`sm`,onClick:h,disabled:i,children:[i?(0,I.jsx)(c,{className:`animate-spin`}):(0,I.jsx)(k,{}),` `,i?(0,I.jsx)(u,{text:d}):d]}),(0,I.jsx)(f,{variant:`ghost`,size:`sm`,onClick:m,disabled:i,children:`Cancel`})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`local-refs-reason`,children:[e===`ready`?(0,I.jsx)(E,{"aria-hidden":`true`}):(0,I.jsx)(o,{"aria-hidden":`true`}),(0,I.jsx)(`span`,{children:t})]}),s&&(0,I.jsxs)(f,{variant:`destructive`,size:`sm`,onClick:p,disabled:a,children:[(0,I.jsx)(k,{}),` `,l]})]})]})}function z({badges:e}){return e.length===0?null:(0,I.jsx)(`span`,{className:`local-refs-badges`,children:e.map(e=>(0,I.jsx)(M,{variant:e.tone===`current`?`default`:e.tone===`warning`?`destructive`:`outline`,children:e.label},e.label))})}function B({label:e,children:t}){return(0,I.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,I.jsx)(`dt`,{children:e}),(0,I.jsx)(`dd`,{children:t})]})}function Se(e){switch(e){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(e){switch(e){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 we(e){switch(e){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 Te(e){return e instanceof Error?e.message:String(e)}export{L as LocalRefsDialog};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DRcXnUox.js","assets/index-CoZCJqTQ.js","assets/rolldown-runtime-C0FnF6B9.js","assets/base-ui-DDpgJXgO.js","assets/react-BlQ_XOQu.js","assets/tanstack-CYi5knVJ.js","assets/createReactComponent-BfrD_oQK.js","assets/index-DUERTTRS.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-JH1jZ6Eh.js","assets/chunk-VPRB5NB3-LAggcSji.js","assets/render-markdown-DF9Fy7MD.js","assets/string-TLTPtCPs-SBynuHAV.js","assets/dist-B8XHAue7.js","assets/App-DEIZhWJG.js","assets/IconAlertTriangle-C1OX2bTH.js","assets/IconPlus-DUFNSK_i.js","assets/IconCheck-BPhxw_LS.js","assets/select-pZpCy7qn.js","assets/IconChevronDown-C3FplJL8.js","assets/IconSelector-BGwY84R8.js","assets/IconLoader4-Bk6G4Bls.js","assets/IconSearch-ZL3YVslZ.js","assets/shortcuts-BzIlT01I.js","assets/chunk-3YJQHVM4-BhzXJiq0.js","assets/dist-Cz2MTljl.js","assets/chunk-HJ2JQQFS-CKHFz1Wl.js","assets/chunk-E2ZNV5FY-B3rGXPn-.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-4EA7E6EY-CvEILf8c.js","assets/chunk-XC4XBNZT-BksIPWQU.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DBDB3WZW-FCGrB-q8.js","assets/chunk-2BW5OAIV-Bxqf2dFQ.js","assets/line-99p2yFnB.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-NTY3LDVX-CfXSvyIC.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,St as n,xt as r}from"./base-ui-DDpgJXgO.js";import{t as i}from"./createReactComponent-BfrD_oQK.js";import{t as a}from"./IconLoader4-Bk6G4Bls.js";import{A as o,O as s,S as c,b as ee,g as l,h as u,l as d,t as f,v as p}from"./index-CoZCJqTQ.js";import{u as m}from"./App-DEIZhWJG.js";import{n as te,r as h,t as ne}from"./viewer-tabs-MMNrJqGE.js";import{FileSaveControls as g,SourceCodeEditor as _,n as v,t as y}from"./EditableFileViewer-BE3AsnVa.js";import{renderMarkdown as b}from"./render-markdown-DF9Fy7MD.js";/* empty css */var x=i(`outline`,`viewport-narrow`,`ViewportNarrow`,[[`path`,{d:`M3 12h7l-3 -3`,key:`svg-0`}],[`path`,{d:`M7 15l3 -3`,key:`svg-1`}],[`path`,{d:`M21 12h-7l3 -3`,key:`svg-2`}],[`path`,{d:`M17 15l-3 -3`,key:`svg-3`}],[`path`,{d:`M9 6v-1a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v1`,key:`svg-4`}],[`path`,{d:`M9 18v1a2 2 0 0 0 2 2h2a2 2 0 0 0 2 -2v-1`,key:`svg-5`}]]),S=i(`outline`,`viewport-wide`,`ViewportWide`,[[`path`,{d:`M10 12h-7l3 -3`,key:`svg-0`}],[`path`,{d:`M6 15l-3 -3`,key:`svg-1`}],[`path`,{d:`M14 12h7l-3 -3`,key:`svg-2`}],[`path`,{d:`M18 15l3 -3`,key:`svg-3`}],[`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v1`,key:`svg-4`}],[`path`,{d:`M3 18v1a2 2 0 0 0 2 2h14a2 2 0 0 0 2 -2v-1`,key:`svg-5`}]]),C=e(t()),re=e(n());function w(e,t){let n=t.trim();if(!n||n.startsWith(`#`)||n.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(n))return null;let r=n.split(/[?#]/,1)[0];if(!r)return null;let i;try{i=decodeURIComponent(r).replaceAll(`\\`,`/`)}catch{return null}let a=i.startsWith(`/`)?[]:e.replaceAll(`\\`,`/`).split(`/`).slice(0,-1).filter(Boolean);for(let e of i.split(`/`))if(e&&e!==`.`){if(e===`..`){if(a.length===0)return null;a.pop()}else{if(T(e))return null;a.push(e)}}return a.length>0?a.join(`/`):null}function T(e){return[...e].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)===127)}function E(e,t,n,r,i){let a=document.createElement(`template`);a.innerHTML=t;let o=new Map;for(let e of a.content.querySelectorAll(`img[src]`)){if(e.classList.contains(`markdown-code-icon`))continue;let t=e.getAttribute(`src`).trim();if(/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(t))continue;e.removeAttribute(`src`),e.removeAttribute(`srcset`);let n=w(r,t);if(!n)continue;let i=o.get(n)??[];i.push(e),o.set(n,i)}e.replaceChildren(a.content);let s=!1,c=[];for(let[e,t]of o)(async()=>{let r;if(m(e)){let t=await i.readFile(n,e);if(t.binary||t.tooLarge)return;r=new Blob([t.content],{type:`image/svg+xml`})}else{let t=await i.readImage(n,e);if(t.status!==`ready`)return;r=new Blob([new Uint8Array(t.data)],{type:t.mimeType})}if(s)return;let a=URL.createObjectURL(r);c.push(a);for(let e of t)e.src=a})().catch(()=>{});return()=>{s=!0;for(let e of c)URL.revokeObjectURL(e)}}var D=0;function O(){return document.documentElement.classList.contains(`dark`)?`dark`:`default`}function k(e,t,n){let[r,i]=(0,C.useState)(O);(0,C.useEffect)(()=>{let e=new MutationObserver(()=>i(O()));return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>e.disconnect()},[]);let a=(0,C.useCallback)(async n=>{if(!t||!e.current)return;let i=Array.from(e.current.querySelectorAll(`.mermaid`));if(i.length!==0)try{let{default:t}=await f(async()=>{let{default:e}=await import(`./mermaid.core-DRcXnUox.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38]));if(n()||!e.current)return;t.initialize({startOnLoad:!1,theme:r,securityLevel:`strict`});for(let e of i){let r=e.dataset.mermaidSource;if(r){e.removeAttribute(`data-mermaid-error`);try{let i=decodeURIComponent(r),a=`mermaid-diagram-${D++}`,{svg:o,bindFunctions:s}=await t.render(a,i,e);if(n()||!e.isConnected)return;e.innerHTML=o,e.dataset.processed=`true`,s?.(e)}catch{!n()&&e.isConnected&&(e.textContent=decodeURIComponent(r),e.dataset.mermaidError=`Could not render diagram`)}}}}catch{for(let e of i)!n()&&e.isConnected&&(e.dataset.mermaidError=`Could not load Mermaid`)}},[t,e,r]);(0,C.useEffect)(()=>{let e=!1;return a(()=>e),()=>{e=!0}},[n,a])}var A=r(),j=`opentig:markdown-content-width`,M=/^([a-z][a-z0-9+.-]*:)?\/\//i,N={conflictTitle:`Markdown was changed outside OpenTig`,successTitle:`Markdown saved`,errorTitle:`Could not save Markdown`};function P(){try{return window.localStorage.getItem(j)===`fit`?`fit`:`reading`}catch{return`reading`}}function ie({html:e,repositoryId:t,markdownPath:n,onClick:r,onLinkHover:i}){let a=(0,C.useRef)(null),o=(0,C.useRef)(null);(0,C.useLayoutEffect)(()=>{let r=a.current?E(a.current,e,t,n,d.repository):void 0;return o.current=null,i(null),r},[e,t,n,i]),k(a,!0,e);let s=(0,C.useCallback)(e=>{let t=e.target.closest(`a[href]`);t&&t!==o.current&&(o.current=t,i(t))},[i]),c=(0,C.useCallback)(e=>{let t=o.current;if(!t)return;let n=e.relatedTarget;n&&t.contains(n)||(o.current=null,i(null))},[i]);return(0,A.jsx)(`div`,{ref:a,className:`markdown-prose`,onClick:r,onMouseOver:s,onMouseOut:c})}function F({repositoryId:e,file:t,initialContent:n,revision:r,themeType:i,wrapLines:d,readOnly:f,onOpenFile:m,onDirtyChange:T,onDraftChange:E,onSave:D}){let[O,k]=(0,C.useState)(`preview`),[F,ae]=(0,C.useState)(P),[I,L]=(0,C.useState)(``),[R,z]=(0,C.useState)(!0),[B,V]=(0,C.useState)(!1),[H,U]=(0,C.useState)(null),W=(0,C.useRef)(0),G=(0,C.useRef)(null),K=(0,C.useRef)(null),q=(0,C.useRef)(null),J=(0,C.useRef)(null),Y=(0,C.useRef)(null),{draft:X,updateDraft:oe,dirty:Z,saving:Q,save:se}=y({file:t,initialContent:n,readOnly:f,messages:N,onDirtyChange:T,onDraftChange:E,onSave:D});(0,C.useEffect)(()=>{Y.current?.(),J.current=null,k(`preview`)},[t.path]);let ce=(0,C.useCallback)(e=>{if(e!==O){if(Y.current?.(),O===`preview`){let e=K.current,t=e?e.scrollHeight-e.clientHeight:0;J.current=e&&t>0?e.scrollTop/t:0}else J.current=q.current?.getScrollFraction()??0;k(e)}},[O]);(0,C.useLayoutEffect)(()=>{let e=J.current;if(e==null)return;if(O===`code`){J.current=null,q.current?.scrollToFraction(e);return}let t=K.current;!t||R&&!I||(J.current=null,Y.current=v({getScrollRange:()=>Math.max(0,t.scrollHeight-t.clientHeight),getScrollTop:()=>t.scrollTop,getContentHeight:()=>t.scrollHeight,scrollTo:e=>{t.scrollTop=e}},e))},[I,R,O]),(0,C.useEffect)(()=>()=>Y.current?.(),[]),(0,C.useEffect)(()=>{let e=++W.current;z(!0);let t=window.setTimeout(()=>{let t=window.__opentigPerformanceAutomation?performance.now():null;b(X).then(n=>{e===W.current&&(L(n),t!==null&&(window.__opentigPerformanceResults??=[],window.__opentigPerformanceResults.push({kind:`markdown-render`,durationMs:Math.round((performance.now()-t)*100)/100})))}).catch(()=>{e===W.current&&L(`<p>Could not render Markdown.</p>`)}).finally(()=>{e===W.current&&z(!1)})},Z?120:0);return()=>window.clearTimeout(t)},[Z,X,t.mtimeMs,t.path,r,i]),(0,C.useEffect)(()=>()=>{G.current&&window.clearTimeout(G.current.timer)},[]);let le=(0,C.useCallback)(async e=>{let n=e.target,r=n.closest(`[data-copy-code]`);if(r){let e=r.dataset.copyCode;if(!e)return;try{await c(decodeURIComponent(e));let t=G.current;t&&(window.clearTimeout(t.timer),delete t.button.dataset.copyState,t.button.setAttribute(`aria-label`,`Copy code`)),r.dataset.copyState=`copied`,r.setAttribute(`aria-label`,`Copied`),V(!0);let n=window.setTimeout(()=>{G.current?.button===r&&(delete r.dataset.copyState,r.setAttribute(`aria-label`,`Copy code`),G.current=null,V(!1))},2e3);G.current={button:r,timer:n}}catch{o.error({title:`Could not copy code`})}return}let i=n.closest(`a[href]`),a=i?.getAttribute(`href`);if(!i||!a)return;if(e.preventDefault(),a.startsWith(`#`)){e.currentTarget.querySelector(`#${CSS.escape(a.slice(1))}`)?.scrollIntoView({behavior:`smooth`,block:`start`});return}if(M.test(a)||a.startsWith(`mailto:`)){try{ee(a)}catch{}return}let s=w(t.path,a);s&&m(s)},[t.path,m]),ue=(0,C.useCallback)(e=>{if(!e){U(null);return}let n=e.getAttribute(`href`);if(!n||n.startsWith(`#`)){U(null);return}let r=e.getBoundingClientRect(),i={top:r.bottom+6,left:r.left};n.startsWith(`mailto:`)?U({...i,label:`Open in mail app`,href:n.replace(/^mailto:/,``)}):M.test(n)?U({...i,label:`Open in browser`,href:n}):w(t.path,n)?U({...i,label:`Open file`,href:n}):U(null)},[t.path]),$=e=>{ae(e);try{window.localStorage.setItem(j,e)}catch{}};return(0,A.jsxs)(ne,{value:O,onValueChange:e=>ce(e),className:`markdown-viewer`,"data-content-width":F,children:[(0,A.jsxs)(`div`,{className:`file-viewer-pill markdown-viewer-toolbar`,children:[(0,A.jsx)(te,{label:`Markdown view`,className:`file-viewer-tabs markdown-viewer-tabs`,items:[{value:`preview`,label:`Preview`},{value:`code`,label:(0,A.jsxs)(A.Fragment,{children:[`Code `,Z&&(0,A.jsx)(`span`,{className:`markdown-unsaved-dot`,"aria-label":`Unsaved changes`})]})}]}),(0,A.jsx)(g,{dirty:Z,saving:Q,readOnly:f,onSave:()=>void se()}),(0,A.jsxs)(`div`,{className:`markdown-width-toggle`,role:`group`,"aria-label":`Markdown content width`,children:[(0,A.jsxs)(u,{children:[(0,A.jsx)(p,{render:(0,A.jsx)(`button`,{type:`button`,"aria-label":`Reading width`,"aria-pressed":F===`reading`,onClick:()=>$(`reading`)}),children:(0,A.jsx)(x,{"aria-hidden":`true`})}),(0,A.jsx)(l,{children:`Reading width`})]}),(0,A.jsxs)(u,{children:[(0,A.jsx)(p,{render:(0,A.jsx)(`button`,{type:`button`,"aria-label":`Fit to width`,"aria-pressed":F===`fit`,onClick:()=>$(`fit`)}),children:(0,A.jsx)(S,{"aria-hidden":`true`})}),(0,A.jsx)(l,{children:`Fit to width`})]})]})]}),(0,A.jsxs)(h,{ref:K,value:`preview`,className:`markdown-preview-scroll`,onScroll:()=>U(null),children:[R&&!I?(0,A.jsxs)(`div`,{className:`viewer-message`,children:[(0,A.jsx)(a,{className:`spinner`,"aria-hidden":`true`}),(0,A.jsx)(s,{text:`Rendering Markdown…`})]}):(0,A.jsx)(ie,{repositoryId:e,markdownPath:t.path,html:I,onClick:e=>void le(e),onLinkHover:ue},`${e}:${t.path}:${r}`),(0,A.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:B?`Code copied`:``}),H?(0,re.createPortal)((0,A.jsxs)(`div`,{className:`markdown-link-tooltip`,style:{top:H.top,left:H.left},role:`tooltip`,children:[(0,A.jsx)(`span`,{className:`markdown-link-tooltip-label`,children:H.label}),(0,A.jsx)(`span`,{className:`markdown-link-tooltip-href`,children:H.href})]}),document.body):null]}),(0,A.jsx)(h,{value:`code`,className:`markdown-code-view`,"data-theme":i,children:(0,A.jsx)(_,{ref:q,path:t.path,cacheKey:t.path,value:X,themeType:i,wrapLines:d,readOnly:f||Q,onChange:oe})})]})}export{F as MarkdownFileViewer};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{t as r}from"./IconLoader4-Bk6G4Bls.js";import{O as i,T as a,f as o,p as s}from"./index-CoZCJqTQ.js";var c=e(t());async function l(e,t=fetch){try{let n=await t(`/api/auth/descriptor`,{credentials:`include`,cache:`no-store`,signal:e});if(!n.ok)return`unavailable`;let r=await n.json();return!r||typeof r!=`object`||!(`authenticated`in r)?`unavailable`:r.authenticated===!0?`authenticated`:`browserAccessEnabled`in r&&r.browserAccessEnabled===!1?`disabled`:r.authenticated===!1?`unpaired`:`unavailable`}catch{return`unavailable`}}function u(e,t){let n=e.hash;return t.replaceState(null,``,`${e.pathname}${e.search}`),new URLSearchParams(n.startsWith(`#`)?n.slice(1):n).get(`token`)??``}async function d(e,t,n=fetch){try{let r=await n(`/api/auth/pair`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,clientName:t})});if(r.ok)return`paired`;if(r.status===403&&r.json){let e=await r.json();if(e&&typeof e==`object`&&`code`in e&&e.code===`WEB_ACCESS_DISABLED`)return`disabled`}return`rejected`}catch{return`unavailable`}}function f(e){let t=[[/Edg\//,`Edge`],[/Firefox\//,`Firefox`],[/OPR\//,`Opera`],[/Chrome\//,`Chrome`],[/Safari\//,`Safari`]].find(([t])=>t.test(e))?.[1]??`Browser`,n=[[/Windows NT/,`Windows`],[/Android/,`Android`],[/(?:iPhone|iPod)/,`iPhone`],[/iPad/,`iPad`],[/CrOS/,`ChromeOS`],[/Macintosh|Mac OS X/,`Mac`],[/Linux/,`Linux`]].find(([t])=>t.test(e))?.[1];return n?`${t} on ${n}`:t}var p=n(),m={rejected:`This code is invalid, expired, or already used. Create a new one from OpenTig.`,unavailable:`OpenTig could not complete pairing. Check the server and try again.`,disabled:`Web access is paused. Enable it in Settings → Web access in the desktop app, then reload. Previously paired browsers keep their access while their session is valid; new devices need a pairing link.`};function h(){let[e,t]=(0,c.useState)(()=>u(window.location,window.history)),[n,h]=(0,c.useState)(()=>f(window.navigator.userAgent)),[g,_]=(0,c.useState)(`idle`),[v,y]=(0,c.useState)(`checking`),[b,x]=(0,c.useState)(0);(0,c.useEffect)(()=>{let e=new AbortController,t=!0,n=window.setTimeout(()=>e.abort(),1e4);return l(e.signal).then(e=>{t&&(e===`authenticated`&&window.location.replace(`/`),y(e))}).finally(()=>window.clearTimeout(n)),()=>{t=!1,e.abort(),window.clearTimeout(n)}},[b]);let S=async t=>{t.preventDefault();let r=n.trim(),i=e.trim();if(!r||!i||r.length>64)return;_(`pairing`);let a=await d(i,r);a===`paired`?window.location.replace(`/`):_(a)};return v===`disabled`||g===`disabled`?(0,p.jsx)(`main`,{className:`access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground`,children:(0,p.jsxs)(`section`,{className:`w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm`,children:[(0,p.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Web access is paused`}),(0,p.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,role:`status`,children:m.disabled}),(0,p.jsx)(a,{className:`mt-5`,onClick:()=>{_(`idle`),y(`checking`),x(e=>e+1)},children:`Check again`})]})}):v===`unpaired`?(0,p.jsx)(`main`,{className:`access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground`,children:(0,p.jsxs)(`section`,{className:`w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm`,children:[(0,p.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Pair this browser`}),(0,p.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`Enter the one-use code shown by the `,s,` desktop app or generated with the command below on the server. It expires after five minutes.`]}),(0,p.jsx)(o,{}),(0,p.jsxs)(`form`,{className:`mt-5 grid gap-4`,onSubmit:e=>void S(e),children:[(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,htmlFor:`pairing-code`,children:[(0,p.jsx)(`span`,{className:`font-medium`,children:`Pairing code`}),(0,p.jsx)(`input`,{id:`pairing-code`,className:`h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 font-mono text-base outline-none focus:border-ring focus:ring-2 focus:ring-ring/20`,value:e,onChange:e=>t(e.target.value),autoComplete:`off`,spellCheck:!1,required:!0})]}),(0,p.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,htmlFor:`device-name`,children:[(0,p.jsx)(`span`,{className:`font-medium`,children:`Device name`}),(0,p.jsx)(`input`,{id:`device-name`,className:`h-10 w-full min-w-0 rounded-md border border-input bg-background px-3 text-base outline-none focus:border-ring focus:ring-2 focus:ring-ring/20`,value:n,onChange:e=>h(e.target.value),maxLength:64,autoComplete:`off`,required:!0})]}),(0,p.jsx)(a,{type:`submit`,disabled:g===`pairing`||!e.trim()||!n.trim(),children:g===`pairing`?(0,p.jsx)(i,{text:`Pairing…`}):`Pair browser`})]}),(g===`rejected`||g===`unavailable`)&&(0,p.jsx)(`p`,{className:`mt-4 text-sm text-destructive`,role:`alert`,children:m[g]}),(0,p.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`The code is removed from the address bar immediately and is never stored by the browser.`}),(0,p.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`This browser remembers its access and renews it automatically while you use OpenTig. Pair again after 30 days without renewal, clearing cookies, or revoking access.`})]})}):(0,p.jsx)(`main`,{className:`access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground`,children:(0,p.jsxs)(`section`,{className:`w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm`,children:[(0,p.jsx)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold`,children:v===`unavailable`?`Could not check this browser`:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(r,{className:`size-5 animate-spin text-primary`,"aria-hidden":`true`}),(0,p.jsx)(i,{text:`Checking this browser…`})]})}),(0,p.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,role:`status`,children:v===`unavailable`?`Could not verify your saved session. Check your connection and try again.`:(0,p.jsx)(i,{text:`Checking your saved session before asking you to pair again.`})}),v===`unavailable`&&(0,p.jsx)(a,{className:`mt-5`,onClick:()=>{y(`checking`),x(e=>e+1)},children:`Try again`})]})})}export{h as default};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./DiffWorkspace-BMtV4MMc.js";import{O as f,T as p}from"./index-CoZCJqTQ.js";import{m,p as h,y as g}from"./color-C1Sk4dBL.js";import{B as _,D as v,Ft as y,Pt as b,Rt as x,St as S,Y as C,_ as w,a as T,c as E,ht as D,i as O,n as k,o as A,q as ee,t as j,wt as M,yt as N}from"./PierreWorkerPool-DMFigp0u.js";import{r as P}from"./EditContext-rlYgrfe2.js";import{t as te}from"./File-BPxtFxHC.js";var F=class extends l{pendingConflictActions=[];pendingMarkerRows=[];injectedRows=new Map;options;constructor(e={theme:m},t,n,r){super(void 0,t,n,r),this.options=e}setConflictState(e,t,n){this.pendingConflictActions=e,this.pendingMarkerRows=t,this.syncInjectedRows(e,t,n)}syncInjectedRows(e,t,n){this.injectedRows.clear();for(let t of e){let e=t==null?void 0:u(t,n);if(t==null||e==null)continue;let r={type:`actions`,hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:t.conflictIndex};this.addInjectedRow(r)}for(let e of t)this.addInjectedRow(e)}addInjectedRow(e){let t=`${e.hunkIndex}:${e.lineIndex}`,n=this.injectedRows.get(t);n==null?this.injectedRows.set(t,[e]):n.push(e)}renderDiff(e,t=h){return e!=null&&this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.renderDiff(e,t)}async asyncRender(e,t=h){return this.syncInjectedRows(this.pendingConflictActions,this.pendingMarkerRows,e),super.asyncRender(e,t)}createPreElement(e,t){return super.createPreElement(e,t,{"data-has-merge-conflict":``})}getUnifiedLineDecoration({type:e,lineType:t}){let n=e===`change`?t===`change-deletion`?`current`:`incoming`:void 0;return{gutterLineType:e===`change`?`context`:t,gutterProperties:I(n),contentProperties:L(e,n)}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`current`:`incoming`:void 0;return{gutterLineType:t===`change`?`context`:t,gutterProperties:I(n),contentProperties:L(t,n)}}getUnifiedInjectedRowsForLine=e=>{let t=this.injectedRows.get(`${e.hunkIndex}:${e.lineIndex}`);if(t==null||t.length===0)return;let{mergeConflictActionsType:n}=this.getOptionsWithDefaults(),r=[],i=[];for(let e of t)e.type===`actions`?r.push({content:ne({row:e,includeDefaultActions:n==="default",includeSlot:!0}),gutter:R(`action`)}):(e.type===`marker-end`?i:r).push({content:re(e),gutter:R(`marker`,e.type)});return{before:r.length>0?r:void 0,after:i.length>0?i:void 0}};getOptionsWithDefaults(){let e=super.getOptionsWithDefaults();return e.diffStyle=`unified`,e.lineDiffType=`none`,e.mergeConflictActionsType=this.options.mergeConflictActionsType??`default`,e}};function I(e){return e==null?void 0:{"data-merge-conflict":e}}function L(e,t){if(t!=null){if(e===`change`)return t===`current`||t===`incoming`?{"data-line-type":`context`,"data-merge-conflict":t}:void 0;if(t===`marker-start`||t===`marker-base`||t===`marker-separator`||t===`marker-end`)return{"data-merge-conflict":t}}}function R(e,t){let n=N(void 0,`annotation`,1);return n.properties[`data-gutter-buffer`]=e===`action`?`merge-conflict-action`:`merge-conflict-${t??`marker`}`,n}function ne({row:e,includeDefaultActions:t,includeSlot:n}){let r=t?z(e.conflictIndex):[];return n&&r.push(S({tagName:`slot`,properties:{name:o({hunkIndex:e.hunkIndex,lineIndex:e.lineIndex,conflictIndex:e.conflictIndex}),"data-merge-conflict-action-slot":``}})),S({tagName:`div`,properties:{"data-merge-conflict-actions":``},children:[S({tagName:`div`,properties:{"data-merge-conflict-actions-content":``},children:r})]})}function re(e){return S({tagName:`div`,properties:{"data-merge-conflict":e.type,"data-merge-conflict-marker-row":``},children:[M(e.lineText.replace(/(?:\r\n|\n|\r)$/,``))]})}function z(e){return[B({resolution:`current`,label:`Accept current change`,conflictIndex:e}),V(),B({resolution:`incoming`,label:`Accept incoming change`,conflictIndex:e}),V(),B({resolution:`both`,label:`Accept both`,conflictIndex:e})]}function B({resolution:e,label:t,conflictIndex:n}){return S({tagName:`button`,properties:{type:`button`,"data-merge-conflict-action":e,"data-merge-conflict-conflict-index":`${n}`},children:[M(t)]})}function V(){return S({tagName:`span`,properties:{"data-merge-conflict-action-separator":``},children:[M(`|`)]})}function H(e,t){return e.hunkIndex===t.hunkIndex&&e.startContentIndex===t.startContentIndex&&e.endContentIndex===t.endContentIndex&&e.currentContentIndex===t.currentContentIndex&&e.baseContentIndex===t.baseContentIndex&&e.incomingContentIndex===t.incomingContentIndex&&e.endMarkerContentIndex===t.endMarkerContentIndex&&e.conflictIndex===t.conflictIndex&&U(e.conflict,t.conflict)}function U(e,t){return e.conflictIndex===t.conflictIndex&&e.startLineIndex===t.startLineIndex&&e.startLineNumber===t.startLineNumber&&e.separatorLineIndex===t.separatorLineIndex&&e.separatorLineNumber===t.separatorLineNumber&&e.endLineIndex===t.endLineIndex&&e.endLineNumber===t.endLineNumber&&e.baseMarkerLineIndex===t.baseMarkerLineIndex&&e.baseMarkerLineNumber===t.baseMarkerLineNumber}function W(e){let t=typeof e==`string`?e:e.type;return t===`accept`||t===`incoming`?`additions`:t===`reject`||t===`current`?`deletions`:`both`}function G(e,t){let{resolution:n,hunkIndex:r,startContentIndex:i,endContentIndex:a,indexesToDelete:o=new Set}=t,s=e.hunks[r];if(s==null)throw console.error({diff:e,hunkIndex:r}),Error(`resolveRegion: Invalid hunk index: ${r}`);if(i<0||a>=s.hunkContent.length||i>a)throw Error(`resolveRegion: Invalid content range, ${i}, ${a}`);let{hunks:c,additionLines:l,deletionLines:u}=e,d={...e,hunks:[],deletionLines:[],additionLines:[],splitLineCount:0,unifiedLineCount:0,cacheKey:e.cacheKey==null?void 0:`${e.cacheKey}:${n[0]}-${r}:${i}-${a}`},f={nextAdditionLineIndex:0,nextDeletionLineIndex:0,nextAdditionStart:1,nextDeletionStart:1,splitLineCount:0,unifiedLineCount:0},p=r===c.length-1&&a===s.hunkContent.length-1,m=!e.isPartial;for(let[t,s]of c.entries()){q(e,d,f,y(s.deletionStart,s.deletionCount)-s.collapsedBefore,y(s.additionStart,s.additionCount)-s.collapsedBefore,s.collapsedBefore,m);let c={...s,hunkContent:[],additionStart:f.nextAdditionStart,deletionStart:f.nextDeletionStart,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex,additionCount:0,deletionCount:0,deletionLines:0,additionLines:0,splitLineStart:f.splitLineCount,unifiedLineStart:f.unifiedLineCount,splitLineCount:0,unifiedLineCount:0};for(let[e,p]of s.hunkContent.entries())if(t!==r||e<i||e>a){J(p,d,u,l);let e={...p,additionLineIndex:f.nextAdditionLineIndex,deletionLineIndex:f.nextDeletionLineIndex};c.hunkContent.push(e),X(e,f,c)}else if(o.has(e))c.hunkContent.push({type:`context`,lines:0,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex});else if(p.type===`context`){J(p,d,u,l);let e={...p,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),X(e,f,c)}else{Y(n,p,d,u,l);let e={type:`context`,lines:n===`deletions`?p.deletions:n===`additions`?p.additions:p.deletions+p.additions,deletionLineIndex:f.nextDeletionLineIndex,additionLineIndex:f.nextAdditionLineIndex};c.hunkContent.push(e),X(e,f,c)}if(t===r&&p){let e=n===`deletions`?s.noEOFCRDeletions:s.noEOFCRAdditions;c.noEOFCRAdditions=e,c.noEOFCRDeletions=e}c.additionCount===0&&(c.additionStart--,e.isPartial||c.additionLineIndex--),c.deletionCount===0&&(c.deletionStart--,e.isPartial||c.deletionLineIndex--),d.hunks.push(c)}let h=c.at(-1);if(h!=null&&!e.isPartial){let e=b(h.deletionStart,h.deletionCount),t=b(h.additionStart,h.additionCount),n=Math.min(u.length-e,l.length-t);K(d,u,l,e,t,n),f.splitLineCount+=n,f.unifiedLineCount+=n}return d.splitLineCount=f.splitLineCount,d.unifiedLineCount=f.unifiedLineCount,d}function K(e,t,n,r,i,a){for(let o=0;o<a;o++){let a=t[r+o],s=n[i+o];if(a==null||s==null)throw Error(`pushCollapsedContextLines: missing collapsed context line`);e.deletionLines.push(a),e.additionLines.push(s)}}function q(e,t,n,r,i,a,o){a<=0||(o&&(K(t,e.deletionLines,e.additionLines,r,i,a),n.nextAdditionLineIndex+=a,n.nextDeletionLineIndex+=a),n.nextAdditionStart+=a,n.nextDeletionStart+=a,n.splitLineCount+=a,n.unifiedLineCount+=a)}function J(e,t,n,r){if(e.type===`context`)for(let n=0;n<e.lines;n++){let i=r[e.additionLineIndex+n];if(i==null)throw console.error({additionLines:r,content:e,i:n}),Error(`pushContentLinesToDiff: Context line does not exist`);t.deletionLines.push(i),t.additionLines.push(i)}else{let i=Math.max(e.deletions,e.additions);for(let a=0;a<i;a++){if(a<e.deletions){let r=n[e.deletionLineIndex+a];if(r==null)throw console.error({deletionLines:n,content:e,i:a}),Error(`pushContentLinesToDiff: Deletion line does not exist`);t.deletionLines.push(r)}if(a<e.additions){let n=r[e.additionLineIndex+a];if(n==null)throw console.error({additionLines:r,content:e,i:a}),Error(`pushContentLinesToDiff: Addition line does not exist`);t.additionLines.push(n)}}}}function Y(e,t,n,r,i){if(e===`deletions`||e===`both`)for(let e=0;e<t.deletions;e++){let i=r[t.deletionLineIndex+e];if(i==null)throw console.error({deletionLines:r,content:t,i:e}),Error(`pushResolveLinesToDiff: Deletion line does not exist`);n.deletionLines.push(i),n.additionLines.push(i)}if(e===`additions`||e===`both`)for(let e=0;e<t.additions;e++){let r=i[t.additionLineIndex+e];if(r==null)throw console.error({additionLines:i,content:t,i:e}),Error(`pushResolveLinesToDiff: Addition line does not exist`);n.deletionLines.push(r),n.additionLines.push(r)}}function X(e,t,n){e.type===`context`?(t.nextAdditionLineIndex+=e.lines,t.nextDeletionLineIndex+=e.lines,t.nextAdditionStart+=e.lines,t.nextDeletionStart+=e.lines,t.splitLineCount+=e.lines,t.unifiedLineCount+=e.lines,n.additionCount+=e.lines,n.deletionCount+=e.lines,n.splitLineCount+=e.lines,n.unifiedLineCount+=e.lines):(t.nextAdditionLineIndex+=e.additions,t.nextDeletionLineIndex+=e.deletions,t.nextAdditionStart+=e.additions,t.nextDeletionStart+=e.deletions,t.splitLineCount+=Math.max(e.deletions,e.additions),t.unifiedLineCount+=e.deletions+e.additions,n.deletionCount+=e.deletions,n.deletionLines+=e.deletions,n.additionCount+=e.additions,n.additionLines+=e.additions,n.splitLineCount+=Math.max(e.deletions,e.additions),n.unifiedLineCount+=e.deletions+e.additions)}function ie(e,t,n){return G(e,{resolution:W(n),hunkIndex:t.hunkIndex,startContentIndex:t.startContentIndex,endContentIndex:t.endContentIndex,indexesToDelete:ae(t)})}function ae(e){let t=new Set;return e.baseContentIndex!=null&&t.add(e.baseContentIndex),e.endMarkerContentIndex!==e.endContentIndex&&t.add(e.endMarkerContentIndex),t}var oe=-1,se=class extends s{options;__id=`unresolved-file:${++oe}`;type=`unresolved-file`;computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0};conflictActions=[];markerRows=[];conflictActionCache=new Map;constructor(e={theme:m},t,n=!1){super(void 0,t,n),this.options=e,this.setOptions(e)}setOptions(e){if(e!=null){if(e.onMergeConflictAction!=null&&e.onMergeConflictResolve!=null)throw Error(`UnresolvedFile: onMergeConflictAction and onMergeConflictResolve are mutually exclusive. Use only one callback.`);this.options=e,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions()}}syncInteractionOptions(){this.interactionManager.setOptions(_(this.options,typeof this.options.hunkSeparators==`function`||(this.options.hunkSeparators??`line-info`)===`line-info`||this.options.hunkSeparators===`line-info-basic`?this.handleExpandHunk:void 0,this.getLineIndex,this.handleMergeConflictActionClick))}createHunksRenderer(e){return new F(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getHunksRendererOptions(e){return ge(e,this.options)}applyPreNodeAttributes(e,t){super.applyPreNodeAttributes(e,t,{"data-has-merge-conflict":``})}cleanUp(){this.emitPostRender(!0),this.clearMergeConflictActionCache(),this.computedCache={file:void 0,fileDiff:void 0,actions:void 0,markerRows:void 0},this.conflictActions=[],super.cleanUp()}getOrComputeDiff({file:e,fileDiff:t,actions:n,markerRows:r}){let{maxContextLines:a,onMergeConflictAction:o}=this.options;wrapper:if(o!=null){let o=t!=null;if(o!==(n!=null)||o!==(r!=null))throw Error(`UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows must be passed together`);if(t!=null&&n!=null&&r!=null){this.computedCache={file:e??this.computedCache.file,fileDiff:t,actions:n,markerRows:r};break wrapper}if(e!=null||this.computedCache.file!=null){if(e!=null&&this.computedCache.file!=null&&!D(e,this.computedCache.file)&&this.computedCache.fileDiff!=null&&this.computedCache.actions!=null)throw Error(`UnresolvedFile.getOrComputeDiff: file can only be used to initialize unresolved state once. Pass fileDiff and actions for subsequent updates.`);if(e??=this.computedCache.file,e==null)throw Error(`UnresolvedFile.getOrComputeDiff: file is null, should be impossible`);if(!D(e,this.computedCache.file)||this.computedCache.fileDiff==null||this.computedCache.actions==null){let t=i(e,a);this.computedCache={file:e,fileDiff:t.fileDiff,actions:t.actions,markerRows:t.markerRows}}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}else{if(t!=null||n!=null||r!=null)throw Error("UnresolvedFile.getOrComputeDiff: fileDiff, actions, and markerRows are only usable in controlled mode, you must pass in `onMergeConflictAction`");if(e!=null&&this.computedCache.file!=null&&!D(e,this.computedCache.file))throw Error(`UnresolvedFile.getOrComputeDiff: uncontrolled unresolved files parse the file only once. Later updates must come from the cached diff state.`);if(this.computedCache.file??=e,this.computedCache.fileDiff==null&&this.computedCache.file!=null){let e=i(this.computedCache.file,a);this.computedCache.fileDiff=e.fileDiff,this.computedCache.actions=e.actions,this.computedCache.markerRows=e.markerRows}t=this.computedCache.fileDiff,n=this.computedCache.actions,r=this.computedCache.markerRows;break wrapper}if(t!=null&&n!=null&&r!=null)return{fileDiff:t,actions:n,markerRows:r}}hydrate(e){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,fileContainer:o,prerenderedHTML:s,preventEmit:c=!1}=e,l=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});l!=null&&(this.hydrateElements(o,s),this.setActiveMergeConflictState(l.actions,l.markerRows),me(this.pre,l.fileDiff,this.options.collapsed)||he(this.headerElement,l.fileDiff,this.options.disableFileHeader)?this.render({...e,preventEmit:!0}):(this.hydrationSetup({fileDiff:l.fileDiff,lineAnnotations:a}),this.pre!=null&&this.renderMergeConflictActionSlots()),c||this.emitPostRender())}rerender(){this.enabled&&this.fileDiff!=null&&this.render({forceRender:!0,renderRange:this.renderRange})}render(e={}){let{file:t,fileDiff:n,actions:r,markerRows:i,lineAnnotations:a,preventEmit:o=!1,...s}=e,c=this.getOrComputeDiff({file:t,fileDiff:n,actions:r,markerRows:i});if(c==null)return!1;this.setActiveMergeConflictState(c.actions,c.markerRows);let l=super.render({...s,fileDiff:c.fileDiff,lineAnnotations:a,preventEmit:!0});return l&&(this.renderMergeConflictActionSlots(),o||this.emitPostRender()),l}resolveConflict(e,t,n=this.computedCache.fileDiff){let r=this.conflictActions[e];if(n==null||r==null)return;if(r.conflictIndex!==e)throw console.error({conflictIndex:e,action:r}),Error(`UnresolvedFile.resolveConflict: conflictIndex and conflictAction don't match`);let i=ie(n,r,t),a=this.computedCache.file,{file:o,actions:s,markerRows:c}=ce({fileDiff:i,previousActions:this.conflictActions,resolvedConflictIndex:e,previousFile:a,resolution:t});return{file:o,fileDiff:i,actions:s,markerRows:c}}resolveConflictAndRender(e,t){let n=this.conflictActions[e];if(n==null)return;if(n.conflictIndex!==e)throw console.error({conflictIndex:e,action:n}),Error(`UnresolvedFile.resolveConflictAndRender: conflictIndex and conflictAction don't match`);let r={resolution:t,conflict:n.conflict},{file:i,fileDiff:a,actions:o,markerRows:s}=this.resolveConflict(e,t)??{};i!=null&&a!=null&&o!=null&&s!=null&&(this.computedCache={file:i,fileDiff:a,actions:o,markerRows:s},this.setActiveMergeConflictState(o,s),this.workerManager==null?this.render({forceRender:!0}):this.hunksRenderer.renderDiff(a),this.options.onMergeConflictResolve?.(i,r))}setActiveMergeConflictState(e=this.conflictActions,t=this.markerRows){this.conflictActions=e,this.markerRows=t,this.computedCache.fileDiff!=null&&this.hunksRenderer instanceof F&&this.hunksRenderer.setConflictState(this.options.mergeConflictActionsType===`none`?[]:e,t,this.computedCache.fileDiff)}handleMergeConflictActionClick=e=>{let t=this.conflictActions[e.conflictIndex];if(t==null)return;if(t.conflictIndex!==e.conflictIndex)throw console.error({conflictIndex:e.conflictIndex,action:t}),Error(`UnresolvedFile.handleMergeConflictActionClick: conflictIndex and conflictAction don't match`);let n={resolution:e.resolution,conflict:t.conflict};this.options.onMergeConflictAction==null?this.resolveConflictAndRender(e.conflictIndex,e.resolution):this.options.onMergeConflictAction(n,this)};renderMergeConflictActionSlots(){let{fileDiff:e}=this.computedCache;if(this.isContainerManaged||this.fileContainer==null||typeof this.options.mergeConflictActionsType!=`function`||this.conflictActions.length===0||e==null){this.clearMergeConflictActionCache();return}let t=new Map(this.conflictActionCache);for(let n=0;n<this.conflictActions.length;n++){let r=this.conflictActions[n];if(r==null)continue;if(r.conflictIndex!==n)throw console.error({conflictIndex:n,action:r}),Error(`UnresolvedFile.renderMergeConflictActionSlots: conflictIndex and conflictAction don't match`);let i=u(r,e);if(i==null)continue;let a=r.conflictIndex,s=o({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),c=`${n}-${s}`,l=this.conflictActionCache.get(c);if(l==null||!H(l.action,r)){l?.element.remove();let e=this.renderMergeConflictAction(r);if(e==null)continue;let t=v(s);t.appendChild(e),this.fileContainer.appendChild(t),l={element:t,action:r},this.conflictActionCache.set(c,l)}t.delete(c)}for(let[e,{element:n}]of t.entries())this.conflictActionCache.delete(e),n.remove()}renderMergeConflictAction(e){if(typeof this.options.mergeConflictActionsType!=`function`)return;let t=this.options.mergeConflictActionsType(e,this);if(t!=null){if(t instanceof HTMLElement)return t;if(typeof DocumentFragment<`u`&&t instanceof DocumentFragment){let e=document.createElement(`div`);return e.style.display=`contents`,e.appendChild(t),e}}}clearMergeConflictActionCache(){for(let{element:e}of this.conflictActionCache.values())e.remove();this.conflictActionCache.clear()}};function ce({fileDiff:e,previousActions:t,resolvedConflictIndex:n,previousFile:r,resolution:i}){let a=t[n];if(a==null)throw Error(`rebuildFileAndActions: missing resolved action for unresolved file rebuild`);let o=de(t,n,a,i),s=c(e,o);return{file:le({fileDiff:e,resolvedAction:a,resolvedConflictIndex:n,previousFile:r,resolution:i}),actions:o,markerRows:s}}function le({resolvedAction:e,resolvedConflictIndex:t,previousFile:n,fileDiff:r,resolution:i}){let o=n?.contents??``,s=a(o),{conflict:c}=e,l=ue(s,c,i),u=[...s.slice(0,c.startLineIndex),...l,...s.slice(c.endLineIndex+1)].join(``);return{name:n?.name??r.name,contents:u,cacheKey:n?.cacheKey==null?void 0:`${n.cacheKey}:mc-${t}-${i}`}}function ue(e,t,n){let r=e.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),i=e.slice(t.separatorLineIndex+1,t.endLineIndex);return n===`current`?r:n===`incoming`?i:[...r,...i]}function de(e,t,n,r){let i=fe(n.conflict,r);return e.map((e,r)=>{if(r!==t&&e!=null)return e.conflict.startLineIndex>n.conflict.endLineIndex?{...e,conflict:pe(e.conflict,i)}:e})}function fe(e,t){let n=(e.baseMarkerLineIndex??e.separatorLineIndex)-e.startLineIndex-1,r=e.endLineIndex-e.separatorLineIndex-1;return(t===`current`?n:t===`incoming`?r:n+r)-(e.endLineIndex-e.startLineIndex+1)}function pe(e,t){return{...e,startLineIndex:e.startLineIndex+t,startLineNumber:e.startLineNumber+t,separatorLineIndex:e.separatorLineIndex+t,separatorLineNumber:e.separatorLineNumber+t,endLineIndex:e.endLineIndex+t,endLineNumber:e.endLineNumber+t,baseMarkerLineIndex:e.baseMarkerLineIndex==null?void 0:e.baseMarkerLineIndex+t,baseMarkerLineNumber:e.baseMarkerLineNumber==null?void 0:e.baseMarkerLineNumber+t}}function me(e,t,n=!1){return!n&&e==null&&t!=null}function he(e,t,n=!1){return e==null&&t!=null&&!n}function ge(e,t){let n={...t,...e};return{...n,useTokenTransformer:w(n),hunkSeparators:typeof e?.hunkSeparators==`function`?`custom`:e?.hunkSeparators,mergeConflictActionsType:typeof e?.mergeConflictActionsType==`function`?`custom`:e?.mergeConflictActionsType}}var Z=e(t(),1),_e=typeof window>`u`?Z.useEffect:Z.useLayoutEffect;function ve({file:e,options:t,lineAnnotations:n,selectedLines:r,prerenderedHTML:a,hasConflictUtility:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l}){let[{fileDiff:u,actions:d,markerRows:f},p]=(0,Z.useState)(()=>{let{fileDiff:n,actions:r,markerRows:a}=i(e,t?.maxContextLines);return{fileDiff:n,actions:r,markerRows:a}}),m=P((e,t)=>{p(n=>{let{fileDiff:r,actions:i,markerRows:a}=t.resolveConflict(e.conflict.conflictIndex,e.resolution,n.fileDiff)??{};return r==null||i==null||a==null?n:{fileDiff:r,actions:i,markerRows:a}})}),h=r!==void 0,g=(0,Z.useContext)(C),_=(0,Z.useRef)(null),v=P(e=>{if(e!=null){if(_.current!=null)throw Error(`useUnresolvedFileInstance: An instance should not already exist when a node is created`);_.current=new se(Q({controlledSelection:h,hasConflictUtility:o,hasCustomHeader:c,hasGutterRenderUtility:s,onMergeConflictAction:m,options:t}),l?void 0:g,!0),_.current.hydrate({fileDiff:u,actions:d,markerRows:f,fileContainer:e,lineAnnotations:n,prerenderedHTML:a})}else{if(_.current==null)throw Error(`useUnresolvedFileInstance: A UnresolvedFile instance should exist when unmounting`);_.current.cleanUp(),_.current=null}});return _e(()=>{if(_.current==null)return;let e=_.current,i=Q({controlledSelection:h,hasConflictUtility:o,hasCustomHeader:c,hasGutterRenderUtility:s,onMergeConflictAction:m,options:t}),a=i!==void 0&&!ee(e.options,i);e.setOptions(i),e.render({fileDiff:u,actions:d,markerRows:f,lineAnnotations:n,forceRender:a}),r!==void 0&&e.setSelectedLines(r)}),{ref:v,getHoveredLine:(0,Z.useCallback)(()=>_.current?.getHoveredLine(),[]),fileDiff:u,actions:d,markerRows:f,getInstance:(0,Z.useCallback)(()=>_.current??void 0,[])}}function Q({options:e,controlledSelection:t,onMergeConflictAction:n,hasConflictUtility:r,hasCustomHeader:i,hasGutterRenderUtility:a}){return{...e,controlledSelection:t,onMergeConflictAction:n,hunkSeparators:e?.hunkSeparators===`custom`?x:e?.hunkSeparators,mergeConflictActionsType:r||e?.mergeConflictActionsType===`custom`?x:e?.mergeConflictActionsType,renderCustomHeader:i?x:void 0,renderGutterUtility:a?x:void 0}}var $=n();function ye({file:e,options:t,lineAnnotations:n,selectedLines:i,className:a,style:o,prerenderedHTML:s,renderAnnotation:c,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderGutterUtility:p,renderMergeConflictUtility:m,disableWorkerPool:h=!1}){let{ref:_,getHoveredLine:v,fileDiff:y,actions:b,getInstance:x}=ve({file:e,options:t,lineAnnotations:n,selectedLines:i,prerenderedHTML:s,hasConflictUtility:m!=null,hasGutterRenderUtility:p!=null,hasCustomHeader:l!=null,disableWorkerPool:h}),S=r({fileDiff:y,renderCustomHeader:l,renderHeaderPrefix:u,renderHeaderFilenameSuffix:d,renderHeaderMetadata:f,renderAnnotation:c,renderGutterUtility:p,lineAnnotations:n,getHoveredLine:v,actions:b,renderMergeConflictUtility:m,getInstance:x});return(0,$.jsx)(g,{ref:_,className:a,style:o,children:E(S,s)})}function be(e){return{draft:e,persistedContent:e,revision:0}}function xe(e,t){return t===e.draft?e:{...e,draft:t,revision:e.revision+1}}function Se(e,t){return e.persistedContent===t?e:{...e,persistedContent:t}}function Ce(e,t){return t===e.persistedContent?e:{draft:t,persistedContent:t,revision:e.revision+1}}function we(e){return(0,$.jsx)(j,{children:(0,$.jsx)(`div`,{className:`viewer-transition`,children:e.kind===`diff`?(0,$.jsx)(Te,{...e}):(0,$.jsx)(Ee,{file:e.file,themeType:e.themeType,overflow:e.overflow,onUpdate:e.onUpdate,onResolve:e.onResolve},e.file.path)},e.contentKey)})}function Te({contentKey:e,value:t,diffView:n,themeType:r,wrapLines:i,initiallyCollapsed:a,compact:o,scopeControl:s,onDiffViewChange:c,onWrapLinesChange:l,onClose:u}){return(0,$.jsx)(d,{contentKey:e,diff:t,diffView:n,themeType:r,wrapLines:i,initiallyCollapsed:a,compact:o,scopeControl:s,onDiffViewChange:c,onWrapLinesChange:l,onClose:u},e)}function Ee({file:e,themeType:t,overflow:n,onUpdate:r,onResolve:i}){let[a,o]=(0,Z.useState)(()=>be(e.content)),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(!1),d=a.draft,m=a.revision,h=De(d);(0,Z.useEffect)(()=>{o(t=>Ce(t,e.content))},[e.content]);let g=async(t,n)=>{if(s)return;c(!0);let i=a,l=Oe(d,t,n);o(e=>xe(e,l));try{await r(e.path,l)?o(e=>Se(e,l)):o(e=>e.draft===l?i:e)}finally{c(!1)}},_=async()=>{if(!(h>0||l)){u(!0);try{await i(e.path,d)}finally{u(!1)}}};return(0,$.jsxs)(`div`,{className:`conflict-viewer`,children:[(0,$.jsxs)(`div`,{className:`conflict-viewer-toolbar`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Conflict resolution`}),(0,$.jsx)(`span`,{children:h>0?`${h} ${h===1?`pending block`:`pending blocks`}`:`All blocks are resolved`})]}),(0,$.jsx)(p,{size:`sm`,disabled:h>0||l,onClick:()=>void _(),children:l?(0,$.jsx)(f,{text:`Saving…`}):`Mark as resolved`})]}),(0,$.jsx)(A,{className:`viewer-scroll`,contentClassName:`viewer-content`,children:h>0?(0,$.jsx)(ye,{file:{name:e.path,lang:O(e.path),contents:d,cacheKey:`${e.path}:conflict:${m}`},disableWorkerPool:d.length>5e5,options:{themeType:t,theme:T,diffIndicators:`classic`,overflow:n,mergeConflictActionsType:`none`,unsafeCSS:k},renderMergeConflictUtility:e=>(0,$.jsxs)(`div`,{className:`conflict-actions`,children:[(0,$.jsx)(p,{size:`xs`,variant:`outline`,disabled:s,onClick:()=>void g(e.conflict,`current`),children:`Accept current`}),(0,$.jsx)(p,{size:`xs`,variant:`outline`,disabled:s,onClick:()=>void g(e.conflict,`incoming`),children:`Accept incoming`}),(0,$.jsx)(p,{size:`xs`,variant:`outline`,disabled:s,onClick:()=>void g(e.conflict,`both`),children:`Accept both`})]})},`${e.path}:${m}`):(0,$.jsx)(te,{file:{name:e.path,lang:O(e.path),contents:d,cacheKey:`${e.path}:resolved:${m}`},options:{themeType:t,theme:T,overflow:n,unsafeCSS:k}})})]})}function De(e){return e.split(/\r?\n/).filter(e=>/^<{7}(?: |$)/.test(e)).length}function Oe(e,t,n){let r=e.match(/[^\n]*\n|[^\n]+$/g)??[],i=r.slice(t.startLineIndex+1,t.baseMarkerLineIndex??t.separatorLineIndex),a=r.slice(t.separatorLineIndex+1,t.endLineIndex),o=n===`current`?i:n===`incoming`?a:[...i,...a];return[...r.slice(0,t.startLineIndex),...o,...r.slice(t.endLineIndex+1)].join(``)}export{we as default};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{l as r}from"./tanstack-CYi5knVJ.js";import{t as i}from"./DiffWorkspace-BMtV4MMc.js";import{a,i as o,n as s,o as c,t as l}from"./select-pZpCy7qn.js";import{t as u}from"./IconLoader4-Bk6G4Bls.js";import{O as d,T as f,g as p,h as m,l as h,n as g,v as _}from"./index-CoZCJqTQ.js";import{t as v}from"./PierreWorkerPool-DMFigp0u.js";import{Pt as y}from"./App-DEIZhWJG.js";var b=e(t()),x=n();function S({diff:e,prNumber:t,repositoryId:n,commits:S,diffView:w,themeType:T,wrapLines:E,onDiffViewChange:D,onWrapLinesChange:O,onClose:k}){let[A,j]=(0,b.useState)(`all`),[M,N]=(0,b.useState)(S[0]?.oid??``),P=(0,b.useMemo)(()=>S.find(e=>e.oid===M)??S[0]??null,[S,M]),F=r({queryKey:g.pullRequestCommitDiff(n,P?.oid??``),queryFn:()=>h.github.getPullRequestCommitDiff(n,P.oid),enabled:A===`commit`&&P!==null}),I=F.error instanceof Error?F.error.message:F.error?`Could not load the commit diff.`:null,L=(0,x.jsxs)(`div`,{className:`pr-code-scope`,children:[(0,x.jsxs)(`div`,{className:`pr-code-mode`,role:`group`,"aria-label":`Pull request code grouping`,children:[(0,x.jsx)(f,{type:`button`,variant:A===`all`?`secondary`:`ghost`,size:`xs`,"aria-pressed":A===`all`,onClick:()=>j(`all`),children:`All changes`}),(0,x.jsx)(f,{type:`button`,variant:A===`commit`?`secondary`:`ghost`,size:`xs`,"aria-pressed":A===`commit`,disabled:S.length===0,onClick:()=>j(`commit`),children:`By commit`})]}),A===`commit`&&P&&(0,x.jsxs)(l,{value:P.oid,onValueChange:e=>{e&&N(e)},children:[(0,x.jsxs)(m,{children:[(0,x.jsx)(_,{render:(0,x.jsx)(a,{className:`pr-commit-select`,size:`sm`,"aria-label":`Commit`}),children:(0,x.jsxs)(c,{children:[P.oid.slice(0,7),` · `,P.messageHeadline||`(no commit message)`]})}),(0,x.jsxs)(p,{children:[P.oid.slice(0,7),` · `,P.messageHeadline||`(no commit message)`]})]}),(0,x.jsx)(s,{align:`start`,alignItemWithTrigger:!1,className:`pr-commit-menu`,children:S.map(e=>(0,x.jsxs)(o,{value:e.oid,label:`${e.oid.slice(0,7)} ${e.messageHeadline||`(no commit message)`}`,children:[(0,x.jsx)(`span`,{className:`shrink-0 self-start font-mono text-xs text-muted-foreground`,children:e.oid.slice(0,7)}),(0,x.jsx)(`span`,{className:`min-w-0 whitespace-normal break-words`,children:e.messageHeadline||`(no commit message)`})]},e.oid))})]})]}),R=A===`all`?e:F.data??null;return A===`commit`&&I?(0,x.jsxs)(C,{scopeControl:L,children:[(0,x.jsx)(`p`,{className:`text-destructive`,children:I}),(0,x.jsxs)(f,{variant:`outline`,size:`sm`,onClick:()=>void F.refetch(),children:[(0,x.jsx)(y,{}),` Try again`]})]}):R?R.patch?(0,x.jsx)(v,{children:(0,x.jsx)(i,{contentKey:A===`all`?`pull:${t}:all`:`pull:${t}:commit:${P?.oid??``}`,diff:R,diffView:w,themeType:T,wrapLines:E,initiallyCollapsed:!0,scopeControl:L,onDiffViewChange:D,onWrapLinesChange:O,onClose:k})}):(0,x.jsx)(C,{scopeControl:L,children:`No differences to show.`}):(0,x.jsxs)(C,{scopeControl:L,children:[(0,x.jsx)(u,{className:`spinner`}),` `,(0,x.jsx)(d,{text:`Loading commit diff…`})]})}function C({scopeControl:e,children:t}){return(0,x.jsxs)(`div`,{className:`diff-workspace`,children:[(0,x.jsx)(`div`,{className:`diff-workspace-toolbar`,children:(0,x.jsx)(`div`,{className:`diff-workspace-scope`,children:e})}),(0,x.jsx)(`div`,{className:`viewer-message flex-col gap-3`,children:t})]})}export{S as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-C17JA4ko.js","assets/rolldown-runtime-C0FnF6B9.js","assets/base-ui-DDpgJXgO.js","assets/tanstack-CYi5knVJ.js","assets/DiffWorkspace-BMtV4MMc.js","assets/createReactComponent-BfrD_oQK.js","assets/IconChevronDown-C3FplJL8.js","assets/index-CoZCJqTQ.js","assets/react-BlQ_XOQu.js","assets/index-DUERTTRS.css","assets/color-C1Sk4dBL.js","assets/cloneFileDiffMetadata-zVRGqYgv.js","assets/PierreWorkerPool-DMFigp0u.js","assets/esm-C-5CJumt.js","assets/string-TLTPtCPs-SBynuHAV.js","assets/dist-B8XHAue7.js","assets/App-DEIZhWJG.js","assets/IconAlertTriangle-C1OX2bTH.js","assets/IconPlus-DUFNSK_i.js","assets/IconCheck-BPhxw_LS.js","assets/select-pZpCy7qn.js","assets/IconSelector-BGwY84R8.js","assets/IconLoader4-Bk6G4Bls.js","assets/IconSearch-ZL3YVslZ.js","assets/shortcuts-BzIlT01I.js","assets/EditContext-rlYgrfe2.js","assets/render-markdown-DF9Fy7MD.js"])))=>i.map(i=>d[i]);
2
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{l as r}from"./tanstack-CYi5knVJ.js";import{t as i}from"./createReactComponent-BfrD_oQK.js";import{i as a,n as o,r as s,t as c}from"./GitHubAvatar-RiePq1Yf.js";import{t as l}from"./IconLoader4-Bk6G4Bls.js";import{O as u,T as d,g as f,h as p,l as m,n as h,t as g,v as _}from"./index-CoZCJqTQ.js";import{Ct as v,Ht as y,Pt as b,Vt as x,Xt as S,_ as C,g as w,qt as T,v as E,xt as D}from"./App-DEIZhWJG.js";import{n as O,r as k,t as A}from"./viewer-tabs-MMNrJqGE.js";/* empty css */var j=i(`outline`,`tag`,`Tag`,[[`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`}]]),M=e(t()),N=n(),P=(0,M.lazy)(()=>g(()=>import(`./PullRequestDiff-C17JA4ko.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])));function F({repositoryId:e,prNumber:t,diffView:n,themeType:i,wrapLines:a,onDiffViewChange:s,onWrapLinesChange:S,onClose:F,onSelectPullRequest:L}){let[R,z]=(0,M.useState)(`summary`),B=r({queryKey:h.pullRequest(e,t),queryFn:async()=>{let n=await m.github.getPullRequest(e,t);return{details:n,bodyHtml:n.body.trim()?await g(async()=>{let{renderMarkdown:e}=await import(`./render-markdown-DF9Fy7MD.js`);return{renderMarkdown:e}},__vite__mapDeps([26,7,1,2,8,3,5,9,14,15,16,17,18,19,20,6,21,22,23,24])).then(({renderMarkdown:e})=>e(n.body)).catch(()=>`<p>Could not render the description.</p>`):``}}}),V=B.data?.details??null,H=B.data?.bodyHtml??``,U=B.error instanceof Error?B.error.message:B.error?`Could not load the pull request.`:null,W=r({queryKey:h.pullRequestDiff(e,t),queryFn:()=>m.github.getPullRequestDiff(e,t),enabled:R===`diff`&&V!==null}),G=W.data??null,K=W.error instanceof Error?W.error.message:W.error?`Could not load the diff.`:null;if(U)return(0,N.jsxs)(`div`,{className:`viewer-message flex-col gap-3`,children:[(0,N.jsx)(`p`,{className:`text-destructive`,children:U}),(0,N.jsxs)(d,{variant:`outline`,size:`sm`,onClick:()=>void B.refetch(),children:[(0,N.jsx)(b,{}),` Try again`]})]});if(!V)return(0,N.jsxs)(`div`,{className:`viewer-message`,children:[(0,N.jsx)(l,{className:`spinner`}),` `,(0,N.jsx)(u,{text:`Loading pull request #${t}…`})]});let q=C(V),J=E(V.reviewDecision);return(0,N.jsxs)(A,{value:R,onValueChange:e=>z(e),className:`pr-viewer`,children:[(0,N.jsxs)(`header`,{className:`pr-viewer-header`,children:[(0,N.jsxs)(`div`,{className:`pr-viewer-overview`,children:[(0,N.jsxs)(`div`,{className:`pr-viewer-title`,children:[(0,N.jsx)(D,{variant:V.state===`OPEN`&&!V.isDraft?`default`:`secondary`,className:`pr-state-badge ${q.toLowerCase().replace(/\s+/g,`-`)}`,children:q}),(0,N.jsxs)(`h2`,{children:[V.title||`(no title)`,` `,(0,N.jsxs)(`span`,{className:`pr-number`,children:[`#`,V.number]})]})]}),(0,N.jsxs)(`div`,{className:`pr-viewer-meta`,children:[(0,N.jsxs)(`span`,{className:`pr-author-with-avatar`,children:[(0,N.jsx)(c,{src:V.authorAvatarUrl,className:`pr-author-avatar`},V.authorAvatarUrl),(0,N.jsx)(`span`,{className:`pr-author`,children:V.author})]}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,N.jsxs)(`span`,{children:[`updated `,(0,N.jsx)(`time`,{dateTime:V.updatedAt,children:v(V.updatedAt)})]}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,N.jsxs)(`span`,{className:`pr-branches`,children:[(0,N.jsx)(y,{"aria-hidden":`true`}),` `,V.headRefName,` → `,V.baseRefName]}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,N.jsxs)(`span`,{className:`pr-counters`,children:[V.changedFiles,` `,V.changedFiles===1?`file`:`files`,` `,(0,N.jsxs)(`span`,{className:`add`,children:[`+`,V.additions]}),` `,(0,N.jsxs)(`span`,{className:`del`,children:[`−`,V.deletions]})]}),(0,N.jsx)(I,{state:V.checksState}),J&&(0,N.jsx)(D,{variant:`outline`,className:`pr-review-badge`,children:J}),V.stack&&(0,N.jsx)(o,{repositoryId:e,number:t,membership:V.stack,onSelect:L}),(0,N.jsx)(`span`,{className:`pr-viewer-actions`,children:(0,N.jsxs)(d,{variant:`outline`,size:`xs`,onClick:()=>w(V.url),children:[(0,N.jsx)(T,{}),` Open on GitHub`]})})]}),V.labels.length>0&&(0,N.jsxs)(`div`,{className:`pr-labels`,"aria-label":`Pull request labels`,children:[(0,N.jsx)(j,{"aria-hidden":`true`}),V.labels.map(e=>(0,N.jsx)(`span`,{className:`pr-label`,style:{borderColor:`#${e.color}`,backgroundColor:`#${e.color}22`},children:e.name},`${e.name}-${e.color}`))]})]}),(0,N.jsx)(O,{label:`Pull request view`,className:`markdown-viewer-tabs pr-viewer-tabs`,items:[{value:`summary`,label:`Summary`},{value:`timeline`,label:`Timeline`},{value:`diff`,label:`Code`}]})]}),(0,N.jsx)(k,{value:`summary`,className:`markdown-preview-scroll pr-description-scroll`,children:(0,N.jsx)(`section`,{className:`pr-summary-section`,children:H?(0,N.jsx)(`div`,{className:`markdown-prose`,dangerouslySetInnerHTML:{__html:H}}):(0,N.jsx)(`p`,{className:`pr-empty-description`,children:`This pull request has no description.`})})}),(0,N.jsx)(k,{value:`timeline`,className:`markdown-preview-scroll pr-description-scroll`,children:(0,N.jsxs)(`section`,{className:`pr-timeline standalone`,"aria-label":`Commit timeline`,children:[(0,N.jsxs)(`h3`,{children:[(0,N.jsx)(x,{"aria-hidden":`true`}),` Commits `,(0,N.jsx)(`span`,{children:V.commits.length})]}),V.commits.length?V.commits.map(e=>(0,N.jsxs)(`article`,{className:`pr-timeline-item`,children:[(0,N.jsx)(`span`,{className:`pr-timeline-rail`,children:(0,N.jsx)(`span`,{})}),(0,N.jsx)(c,{src:e.authorAvatarUrl,className:`pr-commit-avatar`}),(0,N.jsxs)(`span`,{className:`pr-commit-content`,children:[(0,N.jsx)(`strong`,{children:e.messageHeadline||`(no commit message)`}),(0,N.jsxs)(`span`,{children:[(0,N.jsx)(`b`,{children:e.author}),` committed `,(0,N.jsx)(`time`,{dateTime:e.authoredAt,children:v(e.authoredAt)})]})]}),(0,N.jsxs)(p,{children:[(0,N.jsx)(_,{render:(0,N.jsx)(`code`,{}),children:e.oid.slice(0,7)}),(0,N.jsx)(f,{children:e.oid})]})]},e.oid)):(0,N.jsx)(`p`,{className:`pr-empty-description`,children:`No commits were returned by GitHub.`})]})}),(0,N.jsx)(k,{value:`diff`,className:`pr-diff-panel`,children:K?(0,N.jsx)(`div`,{className:`viewer-message text-destructive`,children:K}):G?(0,N.jsx)(M.Suspense,{fallback:(0,N.jsxs)(`div`,{className:`viewer-message`,children:[(0,N.jsx)(l,{className:`spinner`}),` `,(0,N.jsx)(u,{text:`Loading diff viewer…`})]}),children:(0,N.jsx)(P,{diff:G,prNumber:V.number,repositoryId:e,commits:V.commits,diffView:n,themeType:i,wrapLines:a,onDiffViewChange:s,onWrapLinesChange:S,onClose:F})}):(0,N.jsxs)(`div`,{className:`viewer-message`,children:[(0,N.jsx)(l,{className:`spinner`}),` `,(0,N.jsx)(u,{text:`Loading diff…`})]})})]})}function I({state:e}){if(e===`NONE`)return null;let t=e===`PASSING`?a:e===`FAILING`?s:S,n=e===`PASSING`?`Checks passing`:e===`FAILING`?`Checks failing`:`Checks pending`;return(0,N.jsxs)(`span`,{className:`pr-checks ${e.toLowerCase()}`,children:[(0,N.jsx)(t,{"aria-hidden":`true`}),` `,n]})}export{F as PullRequestViewer};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{C as t,Ct as n,S as r,b as i,w as a,x as o,xt as s}from"./base-ui-DDpgJXgO.js";import{o as c}from"./tanstack-CYi5knVJ.js";import{t as l}from"./createReactComponent-BfrD_oQK.js";import{n as u,t as d}from"./IconPlus-DUFNSK_i.js";import{i as f,n as p,r as m,t as h}from"./GitHubAvatar-RiePq1Yf.js";import{t as g}from"./IconLoader4-Bk6G4Bls.js";import{O as _,T as v,g as y,h as b,v as x,w as S}from"./index-CoZCJqTQ.js";import{Bt as C,Pt as w,St as T,Xt as E,g as D,qt as O,zt as k}from"./App-DEIZhWJG.js";import{t as A}from"./checkbox-MDl2t9_3.js";var j=l(`outline`,`filter`,`Filter`,[[`path`,{d:`M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227`,key:`svg-0`}]]),M=e(n()),N=s();function P(e){return e.info===null?(0,N.jsxs)(`div`,{className:`view-loading`,role:`status`,children:[(0,N.jsx)(g,{className:`spinner`}),` `,(0,N.jsx)(_,{text:`Checking repository…`})]}):e.info.isGitHub?e.account?.state===`error`||e.error&&e.ghStatus===null?(0,N.jsxs)(V,{icon:(0,N.jsx)(u,{}),title:`GitHub account unavailable`,children:[e.account?.message??e.error,(0,N.jsxs)(`span`,{className:`pulls-notice-actions`,children:[(0,N.jsx)(v,{variant:`outline`,size:`sm`,onClick:e.onOpenGitHubSettings,children:`Open GitHub settings`}),(0,N.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:e.onRefresh,children:[(0,N.jsx)(w,{}),` Check again`]})]})]}):e.ghStatus===null?(0,N.jsxs)(`div`,{className:`view-loading`,role:`status`,children:[(0,N.jsx)(g,{className:`spinner`}),` `,(0,N.jsx)(_,{text:`Checking GitHub CLI…`})]}):e.ghStatus.installed?e.ghStatus.authStatus===`unauthenticated`?(0,N.jsxs)(V,{icon:(0,N.jsx)(u,{}),title:`Sign in to GitHub CLI`,children:[`Run `,(0,N.jsx)(`code`,{children:`gh auth login`}),` in a terminal to authenticate, then check again.`,(0,N.jsxs)(`span`,{className:`pulls-notice-actions`,children:[(0,N.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>e.onCopyCommand(`gh auth login`),children:[(0,N.jsx)(S,{}),` Copy command`]}),(0,N.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:e.onRefresh,children:[(0,N.jsx)(w,{}),` Check again`]})]})]}):(0,N.jsx)(F,{...e,nameWithOwner:e.info.nameWithOwner??``}):(0,N.jsxs)(V,{icon:(0,N.jsx)(u,{}),title:`GitHub CLI is required`,children:[`OpenTig uses your local `,(0,N.jsx)(`code`,{children:`gh`}),` session to read and create pull requests. It does not copy or store credentials.`,(0,N.jsxs)(`span`,{className:`pulls-notice-actions`,children:[(0,N.jsxs)(v,{variant:`outline`,size:`sm`,onClick:()=>e.onCopyCommand(`winget install GitHub.cli`),children:[(0,N.jsx)(S,{}),` Copy install command`]}),(0,N.jsxs)(v,{variant:`ghost`,size:`sm`,onClick:e.onRefresh,children:[(0,N.jsx)(w,{}),` Check again`]})]}),(0,N.jsx)(`small`,{children:`Download from cli.github.com, then check again.`})]}):(0,N.jsxs)(V,{icon:(0,N.jsx)(u,{}),title:`Not a GitHub repository`,children:[`The `,(0,N.jsx)(`code`,{children:`origin`}),` remote does not point to github.com, so pull requests are unavailable here.`]})}function F(e){let n=(0,M.useRef)(null),s=e.pulls,l=c({count:s?.length??0,getScrollElement:()=>n.current,estimateSize:()=>68,getItemKey:e=>s?.[e]?.number??e,overscan:8});return(0,N.jsxs)(`div`,{className:`pulls-view`,children:[(0,N.jsxs)(`div`,{className:`pulls-toolbar`,children:[(0,N.jsxs)(b,{children:[(0,N.jsxs)(x,{render:(0,N.jsx)(`span`,{className:`pulls-repo`}),children:[(0,N.jsx)(u,{"aria-hidden":`true`}),` `,e.nameWithOwner]}),(0,N.jsx)(y,{children:e.nameWithOwner})]}),(0,N.jsxs)(b,{children:[(0,N.jsx)(x,{render:(0,N.jsx)(v,{variant:`ghost`,size:`icon-xs`,className:`change-action-button`,disabled:e.loading,onClick:e.onRefresh,"aria-label":`Refresh pull requests`}),children:e.loading?(0,N.jsx)(g,{className:`animate-spin`}):(0,N.jsx)(w,{})}),(0,N.jsx)(y,{children:`Refresh pull requests`})]}),e.account?.login&&(0,N.jsxs)(b,{children:[(0,N.jsxs)(x,{render:(0,N.jsx)(v,{variant:`ghost`,size:`xs`,className:`github-pulls-account`,onClick:e.onOpenGitHubSettings}),children:[(0,N.jsx)(u,{}),` @`,e.account.login]}),(0,N.jsx)(y,{children:`Account used for this repository · open GitHub settings`})]}),(0,N.jsxs)(a,{children:[(0,N.jsx)(t,{render:(0,N.jsx)(v,{variant:B(e.states)?`ghost`:`secondary`,size:`icon-xs`,className:`change-action-button`,"aria-label":`Filter pull requests`,"aria-pressed":!B(e.states)}),children:(0,N.jsx)(j,{})}),(0,N.jsx)(r,{children:(0,N.jsx)(o,{side:`bottom`,align:`end`,sideOffset:4,className:`isolate z-50 outline-none`,children:(0,N.jsxs)(i,{className:`pulls-filter-popup`,children:[(0,N.jsx)(`span`,{className:`pulls-filter-title`,children:`State`}),[`OPEN`,`CLOSED`,`MERGED`].map(t=>(0,N.jsxs)(`label`,{htmlFor:`pulls-state-${t.toLowerCase()}`,className:`pulls-filter-option`,children:[(0,N.jsx)(A,{id:`pulls-state-${t.toLowerCase()}`,checked:e.states.includes(t),onCheckedChange:n=>e.onStateChange(t,n===!0)}),(0,N.jsx)(L,{state:t,className:t.toLowerCase()}),(0,N.jsx)(`span`,{children:t===`OPEN`?`Open`:t===`CLOSED`?`Closed`:`Merged`})]},t))]})})})]}),(0,N.jsxs)(b,{children:[(0,N.jsxs)(x,{render:(0,N.jsx)(v,{variant:`outline`,size:`xs`,disabled:!!e.createDisabledReason||e.loading,onClick:e.onCreate,"aria-label":`Create pull request`}),children:[(0,N.jsx)(d,{}),` New`]}),(0,N.jsx)(y,{children:e.createDisabledReason??`Create a pull request from the current branch`})]})]}),e.error&&(0,N.jsxs)(`div`,{className:`pulls-error`,role:`alert`,children:[(0,N.jsx)(`span`,{children:e.error}),(0,N.jsx)(v,{variant:`ghost`,size:`xs`,onClick:e.onRefresh,children:`Retry`})]}),(0,N.jsx)(`div`,{ref:n,className:`pulls-scroll`,role:`list`,"aria-label":`${e.states.map(z).join(`, `)||`No`} pull requests`,children:s===null&&!e.error?(0,N.jsxs)(`div`,{className:`view-loading`,role:`status`,children:[(0,N.jsx)(g,{className:`spinner`}),` `,(0,N.jsx)(_,{text:`Loading pull requests…`})]}):s!==null&&s.length===0?(0,N.jsx)(`p`,{className:`empty-list`,children:e.states.length?`No ${e.states.map(e=>z(e).toLowerCase()).join(`, `)} pull requests.`:`Select at least one PR state.`}):s!==null&&(0,N.jsx)(`div`,{className:`virtual-list`,style:{height:l.getTotalSize()},children:l.getVirtualItems().map(t=>{let n=s[t.index];return(0,N.jsx)(`div`,{ref:l.measureElement,"data-index":t.index,className:`virtual-row`,style:{transform:`translateY(${t.start}px)`},children:(0,N.jsx)(I,{repositoryId:e.repositoryId,pr:n,active:e.activeNumber===n.number,onSelect:e.onSelect})},t.key)})})})]})}function I({repositoryId:e,pr:t,active:n,onSelect:r}){let i=t.state.toLowerCase();return(0,N.jsxs)(`div`,{className:`pull-item ${n?`active`:``}`,role:`listitem`,children:[(0,N.jsxs)(`button`,{className:`pull-main`,onClick:()=>r(t.number),"aria-label":`View pull request #${t.number}`,children:[(0,N.jsx)(`span`,{className:`pull-state-icon ${i}${t.isDraft?` draft`:``}`,"aria-label":t.isDraft?`Draft`:z(t.state),children:(0,N.jsx)(L,{state:t.state})}),(0,N.jsxs)(`span`,{className:`pull-content`,children:[(0,N.jsx)(`span`,{className:`pull-title`,children:t.title||`(no title)`}),(0,N.jsxs)(`span`,{className:`pull-meta`,children:[(0,N.jsxs)(`span`,{className:`pull-number`,children:[`#`,t.number]}),(0,N.jsx)(h,{src:t.authorAvatarUrl,className:`pull-avatar`}),(0,N.jsx)(`span`,{className:`pull-author`,children:t.author}),(0,N.jsx)(R,{state:t.checksState}),t.isDraft&&(0,N.jsx)(`span`,{className:`pull-draft-label`,children:`Draft`})]})]}),(0,N.jsxs)(`span`,{className:`pull-row-aside`,children:[(0,N.jsx)(`time`,{dateTime:t.updatedAt,children:T(t.updatedAt)}),(0,N.jsxs)(`span`,{className:`pull-line-stats`,children:[(0,N.jsxs)(`span`,{className:`add`,children:[`+`,t.additions]}),` `,(0,N.jsxs)(`span`,{className:`del`,children:[`−`,t.deletions]})]})]})]}),t.stack&&(0,N.jsx)(p,{repositoryId:e,number:t.number,membership:t.stack,onSelect:r}),(0,N.jsxs)(b,{children:[(0,N.jsx)(x,{render:(0,N.jsx)(v,{variant:`ghost`,size:`icon-xs`,className:`change-action-button pull-open-external`,onClick:()=>D(t.url),"aria-label":`Open #${t.number} on GitHub`}),children:(0,N.jsx)(O,{})}),(0,N.jsx)(y,{children:`Open on GitHub`})]})]})}function L({state:e,className:t}){return e===`MERGED`?(0,N.jsx)(C,{"aria-hidden":`true`,className:t}):(0,N.jsx)(k,{"aria-hidden":`true`,className:t})}function R({state:e}){if(e===`NONE`)return null;let t=e===`PASSING`?`Checks passing`:e===`FAILING`?`Checks failing`:`Checks pending`,n=e===`PASSING`?f:e===`FAILING`?m:E;return(0,N.jsx)(`span`,{className:`pull-checks ${e.toLowerCase()}`,"aria-label":t,children:(0,N.jsx)(n,{"aria-hidden":`true`})})}function z(e){return e===`OPEN`?`Open`:e===`CLOSED`?`Closed`:`Merged`}function B(e){return e.length===1&&e[0]===`OPEN`}function V({icon:e,title:t,children:n}){return(0,N.jsxs)(`div`,{className:`pulls-notice`,children:[(0,N.jsx)(`span`,{className:`pulls-notice-icon`,"aria-hidden":`true`,children:e}),(0,N.jsx)(`strong`,{children:t}),(0,N.jsx)(`p`,{children:n})]})}export{P as PullRequestsView};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$ as t,Ct as n,c as r,l as i,tt as a,xt as o}from"./base-ui-DDpgJXgO.js";import{t as s}from"./createReactComponent-BfrD_oQK.js";import{t as c}from"./IconLoader4-Bk6G4Bls.js";import{t as l}from"./IconSearch-ZL3YVslZ.js";import{O as u}from"./index-CoZCJqTQ.js";import{Dt as d,Ot as f,Tt as p,at as m,d as h,dt as g,kt as _}from"./App-DEIZhWJG.js";var v=s(`outline`,`file-search`,`FileSearch`,[[`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`}]]),y=e(n());function b(e,t){let n=[],r=e=>{for(let t of e)t.type===`directory`?r(t.children):n.push({path:t.path,name:t.name,parentPath:g(t.path)})};return r(t?e:m(e)),n}function x(e,t,{includeIgnored:n,activePath:r=null,limit:i=100}){let a=b(e,n),o=T(t).trim(),s=Math.max(0,Math.floor(i));if(!o)return a.sort((e,t)=>e.path===r?-1:t.path===r?1:D(e.path,t.path)).slice(0,s);let c=o.replace(/\s+/g,``);return a.map(e=>{let t=S(T(e.name),T(e.path),o,c);return t?{...e,rank:t}:null}).filter(e=>e!==null).sort((e,t)=>w(e.rank,t.rank)||E(e.path)-E(t.path)||D(e.path,t.path)).slice(0,s).map(e=>({path:e.path,name:e.name,parentPath:e.parentPath}))}function S(e,t,n,r){if(e===n)return[0,0,0,0];if(e.startsWith(n))return[1,0,e.length-n.length,0];let i=e.indexOf(n);if(i>=0)return[2,i,e.length-n.length,0];let a=t.indexOf(n);if(a>=0)return[3,a,t.length-n.length,0];let o=C(e,r);if(o)return[4,...o];let s=C(t,r);return s?[5,...s]:null}function C(e,t){if(!t)return null;let n=-1,r=-1,i=0,a=0;for(let o of t){let t=e.indexOf(o,n+1);if(t<0)return null;r<0&&(r=t),n>=0&&(i+=t-n-1,t===n+1&&(a+=1)),n=t}return[i,-a,r,e.length-t.length]}function w(e,t){for(let n=0;n<Math.max(e.length,t.length);n+=1){let r=(e[n]??0)-(t[n]??0);if(r!==0)return r}return 0}function T(e){return e.replace(/\\/g,`/`).toLocaleLowerCase()}function E(e){return e.split(`/`).length}function D(e,t){return e.localeCompare(t,void 0,{sensitivity:`base`})||e.localeCompare(t)}var O=o();function k({open:e,files:n,includeIgnored:o,activePath:s,onOpenChange:m,onOpenFile:g}){let[b,S]=(0,y.useState)(``),C=(0,y.useRef)(null),w=(0,y.useMemo)(()=>n?x(n,b,{includeIgnored:o,activePath:s,limit:100}):[],[s,n,o,b]);(0,y.useEffect)(()=>{e&&(S(``),window.requestAnimationFrame(()=>C.current?.focus()))},[e]);let T=e=>{g(e)&&m(!1)},E=b.trim();return(0,O.jsx)(p,{open:e,onOpenChange:m,children:(0,O.jsxs)(f,{className:`quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0`,children:[(0,O.jsx)(_,{className:`sr-only`,children:`Open file`}),(0,O.jsx)(d,{className:`sr-only`,children:`Search files in the current repository.`}),(0,O.jsxs)(i,{items:w,value:b,onValueChange:S,itemToStringValue:e=>e.path,mode:`none`,inline:!0,open:e,autoHighlight:`always`,onOpenChange:(e,t)=>{!e&&t.reason!==`item-press`&&m(!1)},children:[(0,O.jsxs)(`div`,{className:`quick-open-input-shell`,children:[(0,O.jsx)(l,{"aria-hidden":`true`}),(0,O.jsx)(a,{ref:C,"aria-label":`Search files by name or path`,autoComplete:`off`,spellCheck:!1,placeholder:`Search files by name or path`})]}),(0,O.jsx)(t,{"aria-label":`Repository files`,className:`quick-open-results`,children:n===null?(0,O.jsxs)(`div`,{className:`quick-open-status loading`,role:`status`,children:[(0,O.jsx)(c,{className:`spinner`,"aria-hidden":`true`}),` `,(0,O.jsx)(u,{text:`Loading files…`})]}):w.length===0?(0,O.jsxs)(`div`,{className:`quick-open-status`,role:`status`,children:[(0,O.jsx)(v,{"aria-hidden":`true`}),(0,O.jsx)(`strong`,{children:`No matching files`}),(0,O.jsx)(`p`,{children:E?(0,O.jsxs)(O.Fragment,{children:[`Nothing matches `,(0,O.jsx)(`em`,{children:E}),` in this repository.`]}):`This repository has no files to open.`})]}):w.map((e,t)=>(0,O.jsxs)(r,{value:e,index:t,className:`quick-open-result`,onClick:()=>T(e.path),children:[(0,O.jsx)(`img`,{className:`quick-open-icon`,src:h(e.path),alt:``,"aria-hidden":`true`,draggable:!1}),(0,O.jsx)(`span`,{className:`quick-open-name`,children:e.name}),(0,O.jsx)(`span`,{className:`quick-open-parent`,children:e.parentPath||`Repository root`})]},e.path))})]}),(0,O.jsxs)(`footer`,{className:`quick-open-footer`,children:[(0,O.jsxs)(`span`,{className:`quick-open-hints`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`kbd`,{children:`↑`}),(0,O.jsx)(`kbd`,{children:`↓`}),` navigate`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`kbd`,{children:`↵`}),` open`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`kbd`,{children:`Esc`}),` close`]})]}),n!==null&&(0,O.jsx)(`span`,{className:`quick-open-count`,children:w.length===100?`Top 100 matches`:`${w.length} ${w.length===1?`file`:`files`}`})]})]})})}export{k as QuickOpenDialog};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{t as r}from"./createReactComponent-BfrD_oQK.js";import{t as i}from"./IconAlertTriangle-C1OX2bTH.js";import{n as a,t as o}from"./IconFolderSymlink-BNWI0eXB.js";import{t as s}from"./IconLoader4-Bk6G4Bls.js";import{T as c,g as l,h as u,l as d,v as f}from"./index-CoZCJqTQ.js";import{$ as p,At as m,B as h,Dt as g,E as ee,Et as _,H as v,It as te,J as y,K as b,Ot as ne,Q as x,Qt as S,T as re,Tt as ie,U as C,Ut as w,V as T,W as E,_t as ae,b as oe,en as D,et as O,jt as k,kt as se,q as A,r as ce,w as le,wt as ue}from"./App-DEIZhWJG.js";var j=r(`outline`,`grip-vertical`,`GripVertical`,[[`path`,{d:`M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}],[`path`,{d:`M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-3`}],[`path`,{d:`M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-4`}],[`path`,{d:`M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-5`}]]),M=e(t()),N=n();function P({items:e,onMove:t,draggable:n=!0,children:r}){let i=p(x(A,{activationConstraint:{distance:6}}),x(b,{coordinateGetter:T}));if(!n)return r;let a=t=>e.find(e=>e.id===t)?.label??`Item`;return(0,N.jsx)(E,{sensors:i,collisionDetection:y,accessibility:{announcements:{onDragStart:({active:e})=>`Picked up ${a(e.id)}.`,onDragOver:({active:t,over:n})=>n?`${a(t.id)} at position ${e.findIndex(e=>e.id===n.id)+1}.`:void 0,onDragEnd:({active:t,over:n})=>n?`Placed ${a(t.id)} at position ${e.findIndex(e=>e.id===n.id)+1}.`:`Reordering cancelled.`,onDragCancel:()=>`Reordering cancelled.`}},onDragEnd:({active:n,over:r})=>{if(!r||n.id===r.id)return;let i=e.findIndex(e=>e.id===r.id);i>=0&&t(String(n.id),i)},children:(0,N.jsx)(h,{items:e.map(e=>e.id),strategy:C,children:r})})}function F(e){return e.draggable===!1?(0,N.jsx)(`div`,{className:e.className,"data-order-row":``,"aria-busy":e.busy||void 0,children:e.children}):(0,N.jsx)(I,{...e})}function I({id:e,label:t,className:n,disabled:r,busy:i,children:a}){let{attributes:o,listeners:s,setNodeRef:d,setActivatorNodeRef:p,transform:m,transition:h,isDragging:g}=v({id:e,disabled:r});return(0,N.jsxs)(`div`,{ref:d,className:n,"data-order-row":``,"aria-busy":i||void 0,"data-dragging":g||void 0,style:{transform:O.Transform.toString(m),transition:h},children:[(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,className:`repository-order-handle`,ref:p,...o,...s,"aria-label":`Reorder ${t}`,disabled:r}),children:(0,N.jsx)(j,{})}),(0,N.jsx)(l,{children:`Drag to reorder · Space and arrow keys also work`})]}),a]})}function L({label:e,index:t,count:n,disabled:r,onMove:i}){return(0,N.jsxs)(`span`,{className:`repository-order-buttons`,children:[(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move ${e} up`,disabled:r||t===0,onClick:e=>i(t-1,e.currentTarget)}),children:(0,N.jsx)(S,{})}),(0,N.jsx)(l,{children:`Move up`})]}),(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Move ${e} down`,disabled:r||t===n-1,onClick:e=>i(t+1,e.currentTarget)}),children:(0,N.jsx)(D,{})}),(0,N.jsx)(l,{children:`Move down`})]})]})}var R=`__opentig_no_project__`;function z({open:e,projects:t,repositories:n,onOpenChange:r,onOrganizationChange:p,onForgetRepository:h,onRelocateRepository:v}){let y=oe(),b=(0,M.useRef)(null),x=(0,M.useRef)(null),[S,C]=(0,M.useState)(null),[T,E]=(0,M.useState)(null),[D,O]=(0,M.useState)(``),[A,j]=(0,M.useState)(null),[I,z]=(0,M.useState)(``),[V,H]=(0,M.useState)(null),[U,W]=(0,M.useState)(null),[G,K]=(0,M.useState)(null),de=(0,M.useMemo)(()=>new Map(t.flatMap(e=>e.repositoryKeys.map(t=>[t,e.id]))),[t]),q=(0,M.useMemo)(()=>le(n.map(e=>e.recent),t),[n,t]),fe=[...q.projectSections,{id:R,name:`No project`,repositories:q.unassigned}].filter(e=>e.repositories.length>0),J=new Map(re(q).map((e,t)=>[e.key,t+1])),Y=!!(U||A||V||S);(0,M.useLayoutEffect)(()=>{if(U||!x.current)return;let t=x.current;x.current=null;let n=b.current;e&&n&&(n.scrollTop=t.scrollTop,(t.focused?.isConnected&&!t.focused.matches(`:disabled`)?t.focused:t.row?.querySelector(`.repository-order-buttons button:not(:disabled)`))?.focus({preventScroll:!0}),t.saved&&t.row?.isConnected&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches&&t.row.animate?.([{boxShadow:`inset 0 0 0 2px var(--ring)`},{boxShadow:`inset 0 0 0 2px transparent`}],{duration:350}))},[U,t,n,e]),(0,M.useEffect)(()=>{e||(C(null),E(null),j(null),H(null),K(null))},[e]);let X=async(e,t)=>{W(e),K(null);try{return p(await t()),!0}catch(e){return K(B(e)),!1}finally{W(null)}},pe=async e=>{e.preventDefault();let t=D.trim();t&&!U&&await X(`create`,()=>d.projects.create(t))&&O(``)},me=async e=>{e.preventDefault();let t=I.trim();A&&t&&!U&&await X(`rename:${A}`,()=>d.projects.rename(A,t))&&j(null)},he=async e=>{U||await X(`remove:${e}`,()=>d.projects.remove(e))&&H(null)},ge=async(e,t)=>{U||await X(`assign:${e}`,()=>d.projects.assign(e,t))},Z=async(e,t,n)=>{if(Y)return;let r=n??(document.activeElement instanceof HTMLElement&&b.current?.contains(document.activeElement)?document.activeElement:null),i=y&&b.current?{scrollTop:b.current.scrollTop,focused:r,row:r?.closest(`[data-order-row]`)??null,saved:!1}:null;x.current=i,await X(e,async()=>{try{let e=await t();return i&&(i.saved=!0),e}finally{i&&b.current&&(i.scrollTop=b.current.scrollTop)}})},Q=(e,t,n)=>Z(`move-project:${e}`,()=>d.projects.moveProject(e,t),n),$=(e,t,n)=>Z(`move-repository:${e}`,()=>d.projects.moveRepository(e,t),n),_e=async e=>{if(!U){if(K(null),!window.opentigDesktop)E(e);else{W(`relocate:${e.key}`);try{let t=await d.repository.select(`Relocate ${e.name}`);t&&await v(e,t)}catch(e){K(B(e))}finally{W(null)}}}};return(0,N.jsxs)(ie,{open:e,onOpenChange:e=>{U||r(e)},children:[(0,N.jsxs)(ne,{className:`repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]`,"data-mobile":y||void 0,onKeyDown:e=>{e.key.startsWith(`Arrow`)&&e.target instanceof Element&&e.target.closest(`.repository-order-handle`)&&e.preventBaseUIHandler()},children:[(0,N.jsxs)(`header`,{className:`repository-projects-header`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(se,{children:`Manage projects`}),(0,N.jsxs)(g,{children:[y?`Use the up and down arrows to reorder projects and repositories.`:`Drag projects and repositories or use the arrows to set their order.`,` The selector and number shortcuts follow this saved order. Files stay on disk.`]})]}),(0,N.jsx)(_,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close project management`,disabled:!!U}),children:(0,N.jsx)(m,{})})]}),(0,N.jsxs)(`div`,{className:`repository-projects-body`,ref:b,children:[G&&(0,N.jsxs)(`div`,{className:`repository-projects-error`,role:`alert`,children:[(0,N.jsx)(i,{"aria-hidden":`true`}),(0,N.jsx)(`span`,{children:G})]}),(0,N.jsxs)(`section`,{className:`repository-projects-section`,"aria-labelledby":`projects-heading`,children:[(0,N.jsxs)(`div`,{className:`repository-projects-section-heading`,children:[(0,N.jsxs)(`h3`,{id:`projects-heading`,children:[`Projects `,(0,N.jsx)(`span`,{children:t.length})]}),(0,N.jsxs)(`form`,{className:`repository-project-create`,onSubmit:e=>void pe(e),children:[(0,N.jsx)(`label`,{className:`sr-only`,htmlFor:`new-project-name`,children:`Project name`}),(0,N.jsx)(`input`,{id:`new-project-name`,value:D,maxLength:60,onChange:e=>O(e.target.value),placeholder:`New project name`,disabled:!!U}),(0,N.jsxs)(c,{type:`submit`,size:`sm`,disabled:!D.trim()||!!U,children:[U===`create`?(0,N.jsx)(s,{className:`animate-spin`}):(0,N.jsx)(a,{}),` Create`]})]})]}),(0,N.jsx)(P,{draggable:!y,items:t.map(e=>({id:e.id,label:e.name})),onMove:(e,t)=>void Q(e,t),children:(0,N.jsxs)(`div`,{className:`repository-project-list`,children:[t.length===0&&(0,N.jsx)(`p`,{className:`repository-projects-empty`,children:`No projects yet. Create one to group related repositories.`}),t.map((e,n)=>{let r=e.repositoryKeys.length,a=U===`rename:${e.id}`||U===`remove:${e.id}`||U===`move-project:${e.id}`;return(0,N.jsx)(F,{draggable:!y,className:`repository-project-row`,id:e.id,label:`project ${e.name}`,disabled:Y,busy:a,children:A===e.id?(0,N.jsxs)(`form`,{className:`repository-inline-form`,onSubmit:e=>void me(e),onKeyDown:e=>{e.key===`Escape`&&j(null)},children:[(0,N.jsxs)(`label`,{className:`sr-only`,htmlFor:`rename-project-${e.id}`,children:[`Rename `,e.name]}),(0,N.jsx)(`input`,{id:`rename-project-${e.id}`,autoFocus:!0,value:I,maxLength:60,onChange:e=>z(e.target.value),disabled:!!U}),(0,N.jsx)(c,{type:`submit`,size:`xs`,disabled:!I.trim()||!!U,children:`Save`}),(0,N.jsx)(c,{type:`button`,variant:`ghost`,size:`xs`,onClick:()=>j(null),disabled:!!U,children:`Cancel`})]}):V===e.id?(0,N.jsxs)(`div`,{className:`repository-project-confirm`,role:`alert`,children:[(0,N.jsx)(i,{"aria-hidden":`true`}),(0,N.jsxs)(`span`,{children:[`Delete `,(0,N.jsx)(`strong`,{children:e.name}),`? Its repositories stay available, just ungrouped.`]}),(0,N.jsx)(c,{variant:`destructive`,size:`xs`,disabled:!!U,onClick:()=>void he(e.id),children:`Delete`}),(0,N.jsx)(c,{variant:`ghost`,size:`xs`,disabled:!!U,onClick:()=>H(null),children:`Cancel`})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`repository-project-icon`,"aria-hidden":`true`,children:(0,N.jsx)(w,{})}),(0,N.jsxs)(`span`,{className:`repository-project-copy`,children:[(0,N.jsx)(`strong`,{children:e.name}),(0,N.jsxs)(`small`,{children:[r,` `,r===1?`repository`:`repositories`]})]}),(0,N.jsxs)(`span`,{className:`repository-row-actions`,children:[(0,N.jsx)(L,{label:`project ${e.name}`,index:n,count:t.length,disabled:Y,onMove:(t,n)=>void Q(e.id,t,n)}),(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Rename ${e.name}`,disabled:!!U,onClick:()=>{j(e.id),z(e.name),H(null)},children:(0,N.jsx)(te,{})}),(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,className:`repository-row-delete`,"aria-label":`Delete ${e.name}`,disabled:!!U,onClick:()=>{H(e.id),j(null)},children:(0,N.jsx)(k,{})})]})]})},e.id)})]})})]}),(0,N.jsxs)(`section`,{className:`repository-projects-section`,"aria-labelledby":`repository-assignments-heading`,children:[(0,N.jsxs)(`div`,{className:`repository-projects-section-heading`,children:[(0,N.jsxs)(`h3`,{id:`repository-assignments-heading`,children:[`Repositories `,(0,N.jsx)(`span`,{children:n.length})]}),(0,N.jsx)(`p`,{children:`Reorder within each group`})]}),n.length===0&&(0,N.jsx)(`p`,{className:`repository-projects-empty`,children:`No repositories added yet.`}),fe.map(e=>(0,N.jsxs)(`div`,{className:`repository-assignment-group`,children:[(0,N.jsx)(`h4`,{children:e.name}),(0,N.jsx)(P,{draggable:!y,items:e.repositories.map(e=>({id:e.key,label:e.name})),onMove:(e,t)=>void $(e,t),children:(0,N.jsx)(`div`,{className:`repository-assignment-list`,children:e.repositories.map((n,r)=>{let a=de.get(n.key)??R,d=U?.endsWith(`:${n.key}`);return(0,N.jsx)(F,{draggable:!y,className:`repository-assignment-row`,id:n.key,label:`repository ${n.name}`,disabled:Y,busy:d,children:S===n.key?(0,N.jsxs)(`div`,{className:`repository-project-confirm`,role:`alert`,children:[(0,N.jsx)(i,{"aria-hidden":`true`}),(0,N.jsxs)(`span`,{children:[`Remove `,(0,N.jsx)(`strong`,{children:n.name}),` and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later.`]}),(0,N.jsx)(c,{variant:`destructive`,size:`xs`,disabled:!!U,onClick:()=>{X(`forget:${n.key}`,()=>h(n)).then(e=>{e&&C(null)})},children:`Remove`}),(0,N.jsx)(c,{variant:`ghost`,size:`xs`,disabled:!!U,onClick:()=>C(null),children:`Cancel`})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ae,{className:`repository-order-number`,"aria-label":`Repository shortcut ${J.get(n.key)}`,children:J.get(n.key)}),(0,N.jsxs)(`span`,{className:`repository-assignment-copy`,children:[(0,N.jsx)(`strong`,{children:n.name}),(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(`small`,{}),children:ee(n.rootPath,4)}),(0,N.jsx)(l,{children:n.rootPath})]})]}),d&&(0,N.jsx)(s,{className:`repository-assignment-busy animate-spin`,"aria-hidden":`true`}),(0,N.jsx)(ue,{groups:[{id:`none`,label:``,items:[{value:R,label:`No project`,pinned:!0}]},{id:`projects`,label:`Projects`,items:t.map(e=>({value:e.id,label:e.name,icon:(0,N.jsx)(w,{})}))}],value:a,onValueChange:e=>void ge(n.key,e===R?null:e),label:`Project for ${n.name}`,triggerLabel:t.find(e=>e.id===a)?.name??`No project`,placeholder:`Search projects…`,disabled:!!U}),(0,N.jsxs)(`span`,{className:`repository-management-actions`,children:[(0,N.jsx)(L,{label:`repository ${n.name}`,index:r,count:e.repositories.length,disabled:Y,onMove:(e,t)=>void $(n.key,e,t)}),(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Relocate ${n.name}`,disabled:!!U,onClick:()=>void _e(n)}),children:(0,N.jsx)(o,{})}),(0,N.jsx)(l,{children:`Relocate repository`})]}),(0,N.jsxs)(u,{children:[(0,N.jsx)(f,{render:(0,N.jsx)(c,{variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${n.name} from OpenTig`,disabled:!!U,onClick:()=>{C(n.key),K(null)}}),children:(0,N.jsx)(k,{})}),(0,N.jsx)(l,{children:`Remove from OpenTig`})]})]})]})},n.key)})})})]},e.id))]})]}),(0,N.jsx)(`footer`,{className:`repository-projects-footer`,children:(0,N.jsx)(_,{render:(0,N.jsx)(c,{variant:`outline`,size:`sm`,disabled:!!U}),children:`Done`})})]}),(0,N.jsx)(ce,{open:T!==null,onOpenChange:e=>{e||E(null)},title:`Relocate repository`,description:`Choose the existing server folder for ${T?.name??`this repository`}. This updates its saved location; it does not move files.`,confirmLabel:`Use this folder`,initialPath:T?.recent.path,recent:n.map(e=>e.recent),onBrowse:d.repository.browseDirectories,onOpen:async e=>{T&&await v(T,e)}})]})}function B(e){return e instanceof Error?e.message:String(e)}export{z as RepositoryProjectsDialog};