@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.
- package/LICENSE +1 -1
- package/README.md +14 -14
- package/dist/bin.mjs +25 -10
- package/dist/chunks/{cli-L6lvCZdX.mjs → cli-gyjD1t0O.mjs} +611 -268
- package/dist/chunks/network-settings-CdFeKFRB.mjs +142 -0
- package/dist/chunks/{server-Cz0gvydn.mjs → server-DMk8-Xxt.mjs} +557 -105
- package/dist/chunks/{service-manager-Jyx-MWo-.mjs → service-manager-BxSmV_8Z.mjs} +88 -14
- package/dist/client/assets/App-Bfw_TX8q.js +132 -0
- package/dist/client/assets/CreatePullRequestDialog-DyPd6SKH.js +2 -0
- package/dist/client/assets/DiffWorkspace-DCo89dF1.js +7 -0
- package/dist/client/assets/EditableFileViewer-Dotntfij.js +1 -0
- package/dist/client/assets/EditableFileViewer-svutjHZv.css +1 -0
- package/dist/client/assets/ExternalLink-jdtpN_yL.js +1 -0
- package/dist/client/assets/{File-BPxtFxHC.js → File-DHnVtIhS.js} +1 -1
- package/dist/client/assets/FilesView-D6f1hPVy.js +1 -0
- package/dist/client/assets/GitHubAvatar-B6vyoVlh.js +1 -0
- package/dist/client/assets/HistoryView-D9RhzCPY.js +1 -0
- package/dist/client/assets/HtmlFileViewer-Bwmj5umg.js +2 -0
- package/dist/client/assets/{IconAlertTriangle-C1OX2bTH.js → IconAlertTriangle-B9iDJKvP.js} +1 -1
- package/dist/client/assets/IconCheck-C-G-IA13.js +1 -0
- package/dist/client/assets/IconChevronDown-DU5i40lD.js +1 -0
- package/dist/client/assets/{IconEdit-BP5Emwzw.js → IconEdit-CZe-EJxX.js} +1 -1
- package/dist/client/assets/{IconFolderSymlink-BNWI0eXB.js → IconFolderSymlink-DkLEuUb6.js} +1 -1
- package/dist/client/assets/IconGitMerge-D9KEj1cE.js +1 -0
- package/dist/client/assets/IconGitPullRequest-ClaUqyVa.js +1 -0
- package/dist/client/assets/{IconLoader4-Bk6G4Bls.js → IconLoader4-D2VN7u1V.js} +1 -1
- package/dist/client/assets/{IconPlus-DUFNSK_i.js → IconPlus-DJCoD3wt.js} +1 -1
- package/dist/client/assets/{IconSearch-ZL3YVslZ.js → IconSearch-1VQ4P4kW.js} +1 -1
- package/dist/client/assets/{IconSelector-BGwY84R8.js → IconSelector-BVMU1PEt.js} +1 -1
- package/dist/client/assets/ImageFileViewer-3izbFVTw.css +1 -0
- package/dist/client/assets/ImageFileViewer-CdFLl_in.js +1 -0
- package/dist/client/assets/LinkedMarkdown-Bnc2OA63.js +1 -0
- package/dist/client/assets/LinkedText-BD6K3d1t.js +1 -0
- package/dist/client/assets/LocalRefsDialog-Bl-fddap.js +1 -0
- package/dist/client/assets/MarkdownFileViewer-NUAoQmv5.js +2 -0
- package/dist/client/assets/PairingPage-CqrxpC3_.js +1 -0
- package/dist/client/assets/PierreDiffViewer-CDfQ32e0.js +1 -0
- package/dist/client/assets/{PierreEditBoundary-Bt0q7SXc.js → PierreEditBoundary-DAdYNYZ3.js} +1 -1
- package/dist/client/assets/{PierreWorkerPool-DMFigp0u.js → PierreWorkerPool-mIDzTMB9.js} +3 -3
- package/dist/client/assets/PullRequestDiff-n1NZFHKN.js +1 -0
- package/dist/client/assets/PullRequestViewer-u89zl169.js +2 -0
- package/dist/client/assets/PullRequestsView-D6BqvB4E.js +1 -0
- package/dist/client/assets/QuickOpenDialog-BbEifGRi.js +1 -0
- package/dist/client/assets/RepositoryProjectsDialog-EGAsXL-Z.js +1 -0
- package/dist/client/assets/{SearchView-BYz1K1Ta.js → SearchView-BMz7qOdc.js} +1 -1
- package/dist/client/assets/SettingsDialog-DmD7HvhX.js +9 -0
- package/dist/client/assets/Viewer-CDj_vo6w.js +3 -0
- package/dist/client/assets/{abnfDiagram-YUKMZFIV-CpKAN_8n.js → abnfDiagram-YUKMZFIV-It6tW-4v.js} +1 -1
- package/dist/client/assets/{architecture-WOLXFQ4H-DrizVopY.js → architecture-WOLXFQ4H-CaOaChND.js} +1 -1
- package/dist/client/assets/{architectureDiagram-47P4ROYG-gvUijB3H.js → architectureDiagram-47P4ROYG-COtncecA.js} +1 -1
- package/dist/client/assets/{blockDiagram-E7TT5TSB-CdcXmnf_.js → blockDiagram-E7TT5TSB-NU4wFrfP.js} +1 -1
- package/dist/client/assets/{c4Diagram-CRA5TL53-DtoD1jKt.js → c4Diagram-CRA5TL53-0xzM4S8q.js} +1 -1
- package/dist/client/assets/channel-QED-4ACa.js +1 -0
- package/dist/client/assets/checkbox-Dh4T0bCe.js +1 -0
- package/dist/client/assets/{chunk-2BW5OAIV-Bxqf2dFQ.js → chunk-2BW5OAIV-BQMxlSNI.js} +1 -1
- package/dist/client/assets/{chunk-3YJQHVM4-BhzXJiq0.js → chunk-3YJQHVM4-CdP15KtA.js} +1 -1
- package/dist/client/assets/{chunk-4EA7E6EY-CvEILf8c.js → chunk-4EA7E6EY-xRPCCZLU.js} +1 -1
- package/dist/client/assets/{chunk-7TKQ45FW-pTEdzVz3.js → chunk-7TKQ45FW-Cr_UAObV.js} +1 -1
- package/dist/client/assets/{chunk-AW2ZBBNX-LVROkcXk.js → chunk-AW2ZBBNX-DBqqxF2h.js} +1 -1
- package/dist/client/assets/{chunk-DBDB3WZW-FCGrB-q8.js → chunk-DBDB3WZW-BonEIRP2.js} +1 -1
- package/dist/client/assets/{chunk-E2ZNV5FY-B3rGXPn-.js → chunk-E2ZNV5FY-DnKvxSiA.js} +1 -1
- package/dist/client/assets/{chunk-EU5HNXII-D6a_Ly_W.js → chunk-EU5HNXII-DLK0K3sR.js} +1 -1
- package/dist/client/assets/{chunk-FVRAUYC3-B5hy0Ket.js → chunk-FVRAUYC3-DmjKoYAh.js} +1 -1
- package/dist/client/assets/{chunk-HJ2JQQFS-CKHFz1Wl.js → chunk-HJ2JQQFS-AF4phse0.js} +1 -1
- package/dist/client/assets/{chunk-HTAEGDNF-CtwDuO27.js → chunk-HTAEGDNF-CG4pBnUZ.js} +1 -1
- package/dist/client/assets/{chunk-KQW6MTUR-BN3uxLYf.js → chunk-KQW6MTUR-Dd87yj5r.js} +1 -1
- package/dist/client/assets/{chunk-NTY3LDVX-CfXSvyIC.js → chunk-NTY3LDVX-OolU2PaP.js} +1 -1
- package/dist/client/assets/{chunk-VPRB5NB3-LAggcSji.js → chunk-VPRB5NB3-Dnr3edxV.js} +3 -3
- package/dist/client/assets/{chunk-XC4XBNZT-BksIPWQU.js → chunk-XC4XBNZT-CIqGRxkD.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-K4WV4PDN-DH78Maqm.js → classDiagram-v2-K4WV4PDN-CPGawm8n.js} +1 -1
- package/dist/client/assets/createReactComponent-Ctub7J3a.js +1 -0
- package/dist/client/assets/{cynefin-EF2NZ3EQ-DozKlDV1.js → cynefin-EF2NZ3EQ-OA2R9WCH.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-3GCD6N5R-A1yS7NKN.js → cynefinDiagram-3GCD6N5R-DqCVtoKt.js} +1 -1
- package/dist/client/assets/{dagre-W4DXFKR2-DRJ1mmbe.js → dagre-W4DXFKR2-kc3-tkAQ.js} +1 -1
- package/dist/client/assets/{diagram-2UJZ2QOL-B1sI2b2o.js → diagram-2UJZ2QOL-DoBZKT3s.js} +1 -1
- package/dist/client/assets/{diagram-OVF4WLC6-DLE1o4-P.js → diagram-OVF4WLC6-DGkyha_F.js} +1 -1
- package/dist/client/assets/{diagram-PFPMY2P6-UtIEsv14.js → diagram-PFPMY2P6-DpRDDgdV.js} +1 -1
- package/dist/client/assets/{diagram-UMYRVEAY-BwTyzVap.js → diagram-UMYRVEAY-DlsfhYv3.js} +1 -1
- package/dist/client/assets/{diagram-YEKJPTXX-DNPUQqu0.js → diagram-YEKJPTXX-BIhRZzBM.js} +1 -1
- package/dist/client/assets/{diagram-ZIFT7M5P-ClXykQ3I.js → diagram-ZIFT7M5P-mweJcgBZ.js} +1 -1
- package/dist/client/assets/diff-parse.worker-C1IFRYY9.js +13 -0
- package/dist/client/assets/{ebnfDiagram-VR2GEFS7-Dm8VAviu.js → ebnfDiagram-VR2GEFS7-Dn5zyIbZ.js} +1 -1
- package/dist/client/assets/{elk-IJKZMXRS-CEEoPARn.js → elk-IJKZMXRS-eBPlf1-o.js} +1 -1
- package/dist/client/assets/{erDiagram-O2IAPWRE-CaDE4obX.js → erDiagram-O2IAPWRE-WEE519yZ.js} +1 -1
- package/dist/client/assets/{eventmodeling-K75KTNOO-PjYgMkPC.js → eventmodeling-K75KTNOO-BgE_VmNy.js} +1 -1
- package/dist/client/assets/external-url-IUS7RmYD.js +1 -0
- package/dist/client/assets/flowDiagram-OXPTDLAJ-CHQYfkMg.js +1 -0
- package/dist/client/assets/{ganttDiagram-R7TSEDQI-CmkBarBi.js → ganttDiagram-R7TSEDQI-D_1KyJZU.js} +1 -1
- package/dist/client/assets/{gitGraph-VSP46ZUC-DeotTdHj.js → gitGraph-VSP46ZUC-CEbT7DA4.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-XJZIOB7I-uV1hPaZT.js → gitGraphDiagram-XJZIOB7I-QQyYc1gM.js} +1 -1
- package/dist/client/assets/index-DsKvWsTs.js +47 -0
- package/dist/client/assets/index-kyWCnbkb.css +2 -0
- package/dist/client/assets/{info-OHQRW6UA-BQDsGvSl.js → info-OHQRW6UA-ChHAnveo.js} +1 -1
- package/dist/client/assets/{infoDiagram-5W2HQ5XZ-CDfEPsgZ.js → infoDiagram-5W2HQ5XZ-BaxAE7UA.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-K3B6WC7H-Bb7PQGe6.js → ishikawaDiagram-K3B6WC7H-vhUflBE_.js} +1 -1
- package/dist/client/assets/{journeyDiagram-COXZFDF6-BDythglw.js → journeyDiagram-COXZFDF6-C8WWosVa.js} +1 -1
- package/dist/client/assets/{kanban-definition-P3RFRI5V-CvY5kXhh.js → kanban-definition-P3RFRI5V-CU6W9Yi3.js} +1 -1
- package/dist/client/assets/katex-CQfTPFh0.js +1 -0
- package/dist/client/assets/{line-99p2yFnB.js → line-Axq4vVX-.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-BjZYtoJ8.js → mermaid-parser.core-DNeaCX12.js} +3 -3
- package/dist/client/assets/{mermaid.core-DRcXnUox.js → mermaid.core-Dtt7rXw0.js} +4 -4
- package/dist/client/assets/{mindmap-definition-LZFPQGKD-t9LoCpnW.js → mindmap-definition-LZFPQGKD-D_8ZqQot.js} +1 -1
- package/dist/client/assets/{packet-JDAUHWVQ-BlR-5V7K.js → packet-JDAUHWVQ-6z7ujmGF.js} +1 -1
- package/dist/client/assets/{pegDiagram-BGZESJAR-CWeGI-T9.js → pegDiagram-BGZESJAR-3ujyk-bt.js} +1 -1
- package/dist/client/assets/{pie-XZMESJXO-BkvYHWgl.js → pie-XZMESJXO-DvpLy2DB.js} +1 -1
- package/dist/client/assets/{pieDiagram-CAPJLFHJ-CY5PPIr3.js → pieDiagram-CAPJLFHJ-BPMPWyc7.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-GDMTTRAM-kqj-z271.js → quadrantDiagram-GDMTTRAM-BVUCR_lf.js} +1 -1
- package/dist/client/assets/{radar-ABXABTNO-DuEtYatv.js → radar-ABXABTNO-lu14X99R.js} +1 -1
- package/dist/client/assets/{railroad-I3PHUGI6-CVlnj2j9.js → railroad-I3PHUGI6-DI_WtDmt.js} +1 -1
- package/dist/client/assets/{railroad-abnf-LNEFI6M7-9Qiczw4d.js → railroad-abnf-LNEFI6M7-CmWAKZ2T.js} +1 -1
- package/dist/client/assets/{railroad-ebnf-DWYD2UWJ-BNL7TMEg.js → railroad-ebnf-DWYD2UWJ-BWKFU_UH.js} +1 -1
- package/dist/client/assets/{railroad-peg-JR7BVNR7-DdpRxgk6.js → railroad-peg-JR7BVNR7-9wkgzxMB.js} +1 -1
- package/dist/client/assets/{railroadDiagram-SM67HX2B-CDXvYNqW.js → railroadDiagram-SM67HX2B-4JnRbxl_.js} +1 -1
- package/dist/client/assets/{render-markdown-DF9Fy7MD.js → render-markdown-CQi2yKYQ.js} +2 -2
- package/dist/client/assets/{requirementDiagram-X7JNWC4A-BDdhqnZA.js → requirementDiagram-X7JNWC4A-CVJiZZsi.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-UM26HJRW-Rkyk5oEf.js → sankeyDiagram-UM26HJRW-BmlWQdkv.js} +1 -1
- package/dist/client/assets/select-Dq3KDX2O.js +1 -0
- package/dist/client/assets/{sequenceDiagram-ZO4K6R2Y-Coj9ap7h.js → sequenceDiagram-ZO4K6R2Y-zUx3LmPj.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-TBUQTH76-BucWlahR.js → stateDiagram-v2-TBUQTH76-o_ci-2bu.js} +1 -1
- package/dist/client/assets/{swimlanes-N4OXWK64-tEECcFP9.js → swimlanes-N4OXWK64-BlI0GC5-.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-K3J5GTZL-BEeJLN8d.js +8 -0
- package/dist/client/assets/tanstack-CVAt_k_T.js +1 -0
- package/dist/client/assets/{timeline-definition-YOQAKGHF-XvIbGO4d.js → timeline-definition-YOQAKGHF-DLnvF__o.js} +1 -1
- package/dist/client/assets/{treeView-D4JQ5SDB-DuhJpfXe.js → treeView-D4JQ5SDB-DPuMLQhB.js} +1 -1
- package/dist/client/assets/{treemap-SAJKECNS-CLiUWfZh.js → treemap-SAJKECNS-DjxqxJ8-.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-VIAY4XPW-BuwkpV9w.js → usecaseDiagram-VIAY4XPW-BtnFNltN.js} +1 -1
- package/dist/client/assets/utils-D0T3A-kS.js +1 -0
- package/dist/client/assets/{vennDiagram-BLWOH2XV-kfza5Rxq.js → vennDiagram-BLWOH2XV-CAiF2FKz.js} +1 -1
- package/dist/client/assets/viewer-tabs-DkkqN9MD.js +1 -0
- package/dist/client/assets/{wardley-7MLQ67FV-CcbU_Ykg.js → wardley-7MLQ67FV-DAWySamq.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YMQ3BMBF-DnxlEg3a.js → wardleyDiagram-YMQ3BMBF-DiBCclEL.js} +1 -1
- package/dist/client/assets/{xychartDiagram-TAQBALBS-BzgtwtvK.js → xychartDiagram-TAQBALBS-B0NgfXz6.js} +1 -1
- package/dist/client/index.html +6 -4
- package/dist/dev.mjs +6 -6
- package/dist/manifest.json +1 -1
- package/dist/server.mjs +1 -1
- package/dist/service-update.mjs +11 -3
- package/dist/utility.mjs +25 -4
- package/package.json +4 -4
- package/dist/client/assets/App-DEIZhWJG.js +0 -132
- package/dist/client/assets/CreatePullRequestDialog-BceOUbYK.js +0 -2
- package/dist/client/assets/DiffWorkspace-BMtV4MMc.js +0 -6
- package/dist/client/assets/EditableFileViewer-B44TSuFu.css +0 -1
- package/dist/client/assets/EditableFileViewer-BE3AsnVa.js +0 -1
- package/dist/client/assets/FilesView-DoVhRfi1.js +0 -1
- package/dist/client/assets/GitHubAvatar-RiePq1Yf.js +0 -1
- package/dist/client/assets/HistoryView-Dl8uqmKe.js +0 -1
- package/dist/client/assets/HtmlFileViewer-xfjY1Swc.js +0 -2
- package/dist/client/assets/IconCheck-BPhxw_LS.js +0 -1
- package/dist/client/assets/IconChevronDown-C3FplJL8.js +0 -1
- package/dist/client/assets/ImageFileViewer-BJBOmpsf.css +0 -1
- package/dist/client/assets/ImageFileViewer-DXaIo7_d.js +0 -1
- package/dist/client/assets/LocalRefsDialog-C5J3kgTe.js +0 -1
- package/dist/client/assets/MarkdownFileViewer-18mvm0f2.js +0 -2
- package/dist/client/assets/PairingPage-BEUj3t0V.js +0 -1
- package/dist/client/assets/PierreDiffViewer-p29h7lW_.js +0 -1
- package/dist/client/assets/PullRequestDiff-C17JA4ko.js +0 -1
- package/dist/client/assets/PullRequestViewer-DaMtkESD.js +0 -2
- package/dist/client/assets/PullRequestsView-44f03VLC.js +0 -1
- package/dist/client/assets/QuickOpenDialog-Bi-L68PU.js +0 -1
- package/dist/client/assets/RepositoryProjectsDialog-DFGn74fe.js +0 -1
- package/dist/client/assets/SettingsDialog-CruoIiyN.js +0 -9
- package/dist/client/assets/Viewer-3WKpwRzo.js +0 -3
- package/dist/client/assets/channel-BqKQxg-1.js +0 -1
- package/dist/client/assets/checkbox-MDl2t9_3.js +0 -1
- package/dist/client/assets/createReactComponent-BfrD_oQK.js +0 -1
- package/dist/client/assets/flowDiagram-OXPTDLAJ-DSokwYKA.js +0 -1
- package/dist/client/assets/index-CoZCJqTQ.js +0 -47
- package/dist/client/assets/index-DUERTTRS.css +0 -2
- package/dist/client/assets/katex-C6e6EqXB.js +0 -1
- package/dist/client/assets/select-pZpCy7qn.js +0 -1
- package/dist/client/assets/swimlanesDiagram-K3J5GTZL-DEFKR6Vf.js +0 -8
- package/dist/client/assets/tanstack-CYi5knVJ.js +0 -1
- package/dist/client/assets/viewer-tabs-MMNrJqGE.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{d as r,g as i}from"./tanstack-CVAt_k_T.js";import{n as a,t as o}from"./createReactComponent-Ctub7J3a.js";import{t as s}from"./IconAlertTriangle-B9iDJKvP.js";import{t as c}from"./IconCheck-C-G-IA13.js";import{t as l}from"./IconGitMerge-D9KEj1cE.js";import{t as u}from"./IconGitPullRequest-ClaUqyVa.js";import{t as d}from"./IconLoader4-D2VN7u1V.js";import{t as f}from"./IconSearch-1VQ4P4kW.js";import{S as p,T as m,g as h,h as ee,l as g,n as _,v as te,w as v}from"./index-DsKvWsTs.js";import{At as y,B as b,Dt as x,Et as ne,F as re,Ft as S,H as C,Ht as ie,I as ae,L as w,M as T,Mt as oe,N as se,Nt as ce,Ot as le,P as E,Pt as ue,R as de,Rt as fe,Tt as D,Ut as O,V as pe,Wt as k,Yt as A,j as me,jt as he,kt as ge,v as j,y as _e,z as ve}from"./App-Bfw_TX8q.js";import{t as M}from"./checkbox-Dh4T0bCe.js";var ye=o(`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`}]]),N=o(`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`}]]),P=e(t()),F=n();function be(e){let{details:t,pullRequest:n,anyBusy:r}=e,i=t.remoteState===`missing`,[o,c]=(0,P.useState)(!1),[f,p]=(0,P.useState)(t.branchName);return(0,P.useEffect)(()=>{c(!1),p(t.branchName)},[t.fullName,t.branchName]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,F.jsxs)(`h3`,{children:[(0,F.jsx)(ye,{"aria-hidden":`true`}),(0,F.jsxs)(`span`,{children:[t.remote,`/`,t.branchName]})]}),(0,F.jsx)(`small`,{className:`local-refs-remote-label`,children:i?`Deleted on remote · Cached reference`:`Remote branch${t.defaultBranch===t.branchName?` · Default`:``}`})]}),(0,F.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Remote`}),(0,F.jsx)(`dd`,{children:t.remote})]}),(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Full ref`}),(0,F.jsx)(`dd`,{children:(0,F.jsx)(`code`,{className:`local-refs-selectable`,children:t.fullName})})]}),(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Fetched tip`}),(0,F.jsxs)(`dd`,{children:[(0,F.jsx)(`code`,{children:t.shortOid}),` `,t.subject]})]}),(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Author`}),(0,F.jsx)(`dd`,{children:t.author||`—`})]}),(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Last commit`}),(0,F.jsx)(`dd`,{children:t.date?x(t.date):`—`})]}),(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`Local branches`}),(0,F.jsxs)(`dd`,{children:[t.localBranches.length?t.localBranches.map(t=>(0,F.jsxs)(`button`,{type:`button`,className:`local-refs-local-link`,disabled:r,onClick:()=>e.onShowLocal(t.fullName),children:[(0,F.jsx)(k,{"aria-hidden":`true`}),t.name,t.worktreePath?` · In a worktree`:``]},t.fullName)):`No local tracking branch`,!i&&!o&&(0,F.jsxs)(`div`,{className:`local-refs-tracking-action`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`local-refs-local-link`,disabled:r,onClick:()=>c(!0),children:[(0,F.jsx)(k,{"aria-hidden":`true`}),t.localBranches.length?`Create another local tracking branch…`:`Create local tracking branch…`]}),(0,F.jsx)(`small`,{children:`Work on this branch locally without switching your checkout.`})]})]})]}),n&&(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:`GitHub PR`}),(0,F.jsx)(`dd`,{children:(0,F.jsxs)(`button`,{type:`button`,className:`local-refs-pr-link ${n.state.toLowerCase()}${n.state===`OPEN`&&n.isDraft?` draft`:``}`,onClick:()=>j(n.url),children:[n.state===`MERGED`?(0,F.jsx)(l,{"aria-hidden":`true`}):n.state===`CLOSED`?(0,F.jsx)(N,{"aria-hidden":`true`}):(0,F.jsx)(u,{"aria-hidden":`true`}),`#`,n.number,` · `,n.state===`MERGED`?`Merged into ${n.baseRefName}`:_e(n),(0,F.jsx)(A,{"aria-hidden":`true`})]})})]})]}),o&&!i&&(0,F.jsxs)(`form`,{className:`local-refs-create-branch`,onSubmit:t=>{t.preventDefault(),!r&&f.trim()&&e.onCreate(f.trim())},children:[(0,F.jsx)(`label`,{htmlFor:`tracking-branch-name`,children:`Local branch name`}),(0,F.jsx)(`input`,{id:`tracking-branch-name`,value:f,onChange:e=>p(e.target.value),disabled:r,autoFocus:!0,autoComplete:`off`,spellCheck:!1}),(0,F.jsx)(`p`,{children:`Creates a tracking branch at the fetched tip. Your checkout and uncommitted changes stay intact.`}),(0,F.jsxs)(`div`,{className:`local-refs-detail-actions`,children:[(0,F.jsxs)(m,{type:`submit`,variant:`outline`,size:`sm`,disabled:r||!f.trim(),children:[e.creating?(0,F.jsx)(d,{className:`animate-spin`}):(0,F.jsx)(k,{}),` `,e.creating?(0,F.jsx)(a,{text:`Creating…`}):`Create local branch`]}),(0,F.jsx)(m,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,onClick:()=>c(!1),children:`Cancel`})]})]}),(0,F.jsx)(`div`,{className:`local-refs-danger ${t.deletionBlockedReason?`blocked`:`ready`}`,children:t.deletionBlockedReason?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`local-refs-reason`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.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,F.jsxs)(m,{variant:`outline`,size:`sm`,disabled:r,onClick:e.onFetch,children:[e.fetching?(0,F.jsx)(d,{className:`animate-spin`}):(0,F.jsx)(fe,{}),e.fetching?(0,F.jsx)(a,{text:`Fetching…`}):`Fetch and clean up`]})]}):e.confirming?(0,F.jsxs)(`div`,{className:`local-refs-confirm`,role:`alert`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsxs)(`p`,{children:[`Delete `,(0,F.jsx)(`strong`,{children:t.branchName}),` from `,(0,F.jsx)(`strong`,{children:t.remote}),`? This removes the branch on the remote server. Your local branches, commits and worktrees stay intact.`]}),(0,F.jsxs)(`span`,{className:`local-refs-confirm-actions`,children:[(0,F.jsxs)(m,{variant:`destructive`,size:`sm`,disabled:r,onClick:e.onDelete,children:[e.deleting?(0,F.jsx)(d,{className:`animate-spin`}):(0,F.jsx)(S,{}),e.deleting?(0,F.jsx)(a,{text:`Deleting…`}):`Delete from ${t.remote}`]}),(0,F.jsx)(m,{variant:`ghost`,size:`sm`,disabled:r,onClick:e.onCancel,children:`Cancel`})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`local-refs-reason`,children:[(0,F.jsx)(ye,{"aria-hidden":`true`}),(0,F.jsxs)(`span`,{children:[`Delete only this branch from `,t.remote,`. Local branches and worktrees are kept.`]})]}),(0,F.jsxs)(m,{variant:`destructive`,size:`sm`,disabled:r,onClick:e.onConfirm,children:[(0,F.jsx)(S,{}),`Delete from `,t.remote]})]})})]})}function I(e){let{open:t,tab:n,repositoryId:o,onMutated:c,onBusyChange:l}=e,u=i(),[v,x]=(0,P.useState)(``),[S,C]=(0,P.useState)(`all`),[w,T]=(0,P.useState)(``),[se,D]=(0,P.useState)(!1),[O,A]=(0,P.useState)(null),[j,_e]=(0,P.useState)(null),[M,N]=(0,P.useState)(null),[I,L]=(0,P.useState)(null),[z,V]=(0,P.useState)(null),[Ee,De]=(0,P.useState)(!1),Oe=(0,P.useRef)(null);(0,P.useEffect)(()=>{D(!1)},[t,o]);let H=r({queryKey:_.localRefs(o),queryFn:()=>g.refs.localRefsSnapshot(o),enabled:t}),U=H.data??null,ke=H.isFetching,Ae=H.error?B(H.error):null,W=(0,P.useMemo)(()=>re(U?.branches??[],v).filter(e=>(S===`all`||e.remote===(S===`remote`))&&(!e.remote||!w||e.remoteName===w)),[U,v,S,w]),je=(0,P.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,P.useMemo)(()=>ae(U?.worktrees??[],v),[U,v]),G=W.find(e=>E(e)===O)??null,K=Me.find(e=>b(e)===j)??null,Ne=r({queryKey:_.branchDetails(o,G?.fullName??``),queryFn:()=>g.refs.branchDetails({repositoryId:o,fullName:G.fullName}),enabled:t&&n===`branches`&&G!==null&&!G.remote}),q=Ne.data??null,Pe=r({queryKey:_.remoteBranchDetails(o,G?.fullName??``),queryFn:()=>g.refs.remoteBranchDetails({repositoryId:o,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:_.branchPullRequest(o,Fe??``),queryFn:()=>g.github.findPullRequestForBranch(o,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:_.worktreeDetails(o,K?.path??``),queryFn:()=>g.refs.worktreeDetails({repositoryId:o,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?B(ze.error):null,Q=(0,P.useCallback)(async()=>{await H.refetch(),await Promise.all([u.invalidateQueries({queryKey:[`repository`,o,`branch-details`]}),u.invalidateQueries({queryKey:[`repository`,o,`remote-branch-details`]}),u.invalidateQueries({queryKey:[`repository`,o,`worktree-details`]}),u.invalidateQueries({queryKey:[`repository`,o,`branch-pull-request`]})])},[u,o,H]);(0,P.useEffect)(()=>{if(!U)return;let e=Oe.current;Oe.current=U,A(t=>de(W.map(E),(e?.branches??[]).map(E),t)),_e(t=>de(U.worktrees.map(b),(e?.worktrees??[]).map(b),t))},[U,W]),(0,P.useEffect)(()=>{t||(x(``),C(`all`),T(``),N(null),V(null),De(!1))},[t]),(0,P.useEffect)(()=>{N(null),V(null),De(!1)},[n,O,j]);let $=async(e,t)=>{L(e),l(!0),V(null);try{await t()&&N(null)}catch(e){V(B(e))}finally{L(null),l(!1)}},Be=(e,t)=>$(`delete-branch`,async()=>{let n=await g.refs.deleteBranch({repositoryId:o,fullName:e.fullName,expectedOid:e.oid,force:t});return n.status===`deleted`?(c(null),await Q(),!0):(V(Ce(n.status)),await Q(),!1)}),Ve=e=>$(`delete-remote-branch`,async()=>{let t=await g.refs.deleteRemoteBranch({repositoryId:o,fullName:e.fullName,expectedOid:e.oid,destinationId:e.destinationId});if(t.status!==`deleted`)return V(t.status===`rejected`?t.message:we(t.status)),await Q(),!1;let n=await g.refs.fetchBranches(o);return c(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 g.refs.createTrackingBranch({repositoryId:o,fullName:e.fullName,expectedOid:e.oid,localName:t});return n.status===`created`?(c(null),await Q(),x(``),C(`local`),T(``),A(n.fullName),!0):(V(n.status===`exists`?`That local branch already exists. Choose another name.`:we(n.status)),await Q(),!1)}),Ue=()=>$(`fetch-branches`,async()=>{let e=await g.refs.fetchBranches(o);return c(null),await Q(),e.status===`failed`&&V(e.message),e.status===`success`}),We=(e,t,n)=>$(`remove-worktree`,async()=>{let r=await g.refs.removeWorktree({repositoryId:o,path:e.path,expectedOid:e.oid,force:t,deleteBranch:n});return r.status===`removed`?(c(r.recentRepositories),await Q(),!0):(V(Te(r.status)),await Q(),!1)}),Ge=async e=>{try{await p(e),De(!0),window.setTimeout(()=>De(!1),1600)}catch(e){V(B(e))}},Ke={branches:U?.branches.length??0,worktrees:U?.worktrees.length??0},qe=n===`branches`?W.length===0:Me.length===0;return(0,F.jsx)(ge,{open:t,onOpenChange:t=>{I||e.onOpenChange(t)},children:(0,F.jsxs)(oe,{className:`local-refs-dialog`,children:[(0,F.jsxs)(`header`,{className:`local-refs-header`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(ce,{children:`Branches and worktrees`}),(0,F.jsx)(he,{children:`Inspect local and remote branches, and manage this repository’s worktrees.`})]}),(0,F.jsx)(y,{render:(0,F.jsx)(m,{variant:`ghost`,size:`icon-sm`,"aria-label":`Close the refs manager`,disabled:!!I}),children:(0,F.jsx)(ue,{})})]}),(0,F.jsxs)(`div`,{className:`local-refs-toolbar`,children:[(0,F.jsx)(`div`,{className:`local-refs-tabs`,role:`tablist`,"aria-label":`Branches and worktrees`,children:[`branches`,`worktrees`].map(t=>(0,F.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:!!I,onClick:()=>{e.onTabChange(t),D(!1)},children:[t===`branches`?(0,F.jsx)(k,{"aria-hidden":`true`}):(0,F.jsx)(ie,{"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:t===`branches`?`Branches`:`Worktrees`}),(0,F.jsx)(`small`,{children:Ke[t]})]},t))}),(0,F.jsxs)(`div`,{className:`local-refs-search`,children:[(0,F.jsx)(f,{"aria-hidden":`true`}),(0,F.jsxs)(`label`,{className:`sr-only`,htmlFor:`local-refs-search-input`,children:[`Search `,n]}),(0,F.jsx)(`input`,{id:`local-refs-search-input`,value:v,disabled:!!I,onChange:e=>x(e.target.value),placeholder:n===`branches`?`Search branches…`:`Search worktrees…`,autoComplete:`off`,spellCheck:!1}),v&&(0,F.jsx)(m,{variant:`ghost`,size:`icon-xs`,"aria-label":`Clear search`,disabled:!!I,onClick:()=>x(``),children:(0,F.jsx)(ue,{})})]}),(0,F.jsxs)(ee,{children:[(0,F.jsxs)(te,{render:(0,F.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>n===`branches`?void Ue():void Q(),disabled:ke||!!I}),children:[ke||I===`fetch-branches`?(0,F.jsx)(d,{className:`animate-spin`}):(0,F.jsx)(fe,{}),` `,n===`branches`?`Fetch`:`Refresh`]}),(0,F.jsx)(h,{children:n===`branches`?`Fetch branches from all remotes and remove obsolete remote references`:`Refresh local worktrees`})]})]}),n===`branches`&&(0,F.jsxs)(`div`,{className:`local-refs-branch-filters`,children:[(0,F.jsx)(`div`,{className:`local-refs-tabs`,role:`group`,"aria-label":`Branch scope`,children:[`all`,`local`,`remote`].map(e=>(0,F.jsx)(`button`,{type:`button`,className:`local-refs-tab`,"aria-pressed":S===e,disabled:!!I,onClick:()=>{C(e),D(!1)},children:e===`all`?`All`:e===`local`?`Local`:`Remote`},e))}),S!==`local`&&(0,F.jsx)(le,{label:`Filter by remote`,placeholder:`Search remotes…`,value:w,triggerLabel:w||`All remotes`,onValueChange:e=>{T(e),D(!1)},disabled:!!I,groups:[{id:`remotes`,label:`Remotes`,items:[{value:``,label:`All remotes`,pinned:!0},...(U?.remotes??[]).map(e=>({value:e,label:e}))]}]}),(0,F.jsx)(`small`,{children:`Remote refs reflect the last fetch.`})]}),(Ae||z)&&(0,F.jsxs)(`div`,{className:`local-refs-error`,role:`alert`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:Ae??z})]}),se&&(0,F.jsxs)(`button`,{type:`button`,className:`local-refs-mobile-back`,onClick:()=>D(!1),children:[`← Back to `,n]}),(0,F.jsxs)(`div`,{className:`local-refs-body`,"data-mobile-detail":se,role:`tabpanel`,id:`local-refs-panel-${n}`,"aria-labelledby":`local-refs-tab-${n}`,children:[(0,F.jsxs)(`div`,{className:`local-refs-list`,role:`listbox`,"aria-label":n===`branches`?`Branches`:`Worktrees`,tabIndex:-1,children:[ke&&!U&&(0,F.jsxs)(`p`,{className:`local-refs-placeholder`,children:[(0,F.jsx)(d,{className:`animate-spin`,"aria-hidden":`true`}),(0,F.jsx)(a,{text:`Reading the repository…`})]}),!ke&&qe&&(0,F.jsx)(`p`,{className:`local-refs-placeholder`,children:v||w?`No matches for these filters.`:`This repository has no ${n===`branches`?`${S===`all`?``:`${S} `}branches`:`worktrees`}.`}),n===`branches`&&je.map(e=>(0,F.jsxs)(`div`,{className:`local-refs-branch-group`,role:`group`,"aria-label":e.label,children:[(0,F.jsxs)(`div`,{className:`local-refs-group-heading`,children:[(0,F.jsx)(`span`,{children:e.label}),(0,F.jsx)(`small`,{children:e.branches.length})]}),e.branches.map(e=>(0,F.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":E(e)===O,className:`local-refs-row`,disabled:!!I,onClick:()=>{A(E(e)),D(!0)},children:[(0,F.jsxs)(`span`,{className:`local-refs-row-head`,children:[e.remote?(0,F.jsx)(ye,{"aria-hidden":`true`}):(0,F.jsx)(k,{"aria-hidden":`true`}),(0,F.jsx)(`strong`,{children:e.remoteBranchName??e.name}),(0,F.jsx)(R,{badges:me(e)})]}),(0,F.jsxs)(`small`,{className:`local-refs-row-meta`,children:[(0,F.jsx)(`code`,{children:e.shortOid}),e.subject&&(0,F.jsx)(`span`,{children:e.subject}),e.date&&(0,F.jsx)(`time`,{dateTime:e.date,children:ne(e.date)})]})]},E(e)))]},e.label)),n===`worktrees`&&Me.map(e=>(0,F.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":b(e)===j,className:`local-refs-row`,disabled:!!I,onClick:()=>{_e(b(e)),D(!0)},children:[(0,F.jsxs)(`span`,{className:`local-refs-row-head`,children:[(0,F.jsx)(ie,{"aria-hidden":`true`}),(0,F.jsx)(`strong`,{children:pe(e.path)}),(0,F.jsx)(R,{badges:ve(e)})]}),(0,F.jsxs)(`small`,{className:`local-refs-row-meta`,children:[(0,F.jsx)(`span`,{className:`local-refs-row-branch`,children:e.branch?`${e.branch}`:`Detached HEAD`}),(0,F.jsx)(`span`,{children:e.path})]})]},b(e)))]}),(0,F.jsxs)(`div`,{className:`local-refs-detail`,children:[Z&&(0,F.jsxs)(`div`,{className:`local-refs-error`,role:`alert`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:Z})]}),X&&(0,F.jsxs)(`p`,{className:`local-refs-placeholder`,children:[(0,F.jsx)(d,{className:`animate-spin`,"aria-hidden":`true`}),(0,F.jsx)(a,{text:`Loading details…`})]}),!X&&!Z&&n===`branches`&&J&&G?.remote&&(0,F.jsx)(be,{details:J,pullRequest:Le,anyBusy:!!I,deleting:I===`delete-remote-branch`,creating:I===`create-tracking-branch`,confirming:M===`delete-remote-branch`,onConfirm:()=>N(`delete-remote-branch`),onCancel:()=>N(null),onDelete:()=>void Ve(J),onCreate:e=>void He(J,e),onFetch:()=>void Ue(),fetching:I===`fetch-branches`,onShowLocal:e=>{x(``),C(`local`),T(``),A(e)}}),!X&&!Z&&n===`branches`&&q&&G&&!G.remote&&(0,F.jsx)(xe,{details:q,pullRequest:Le,busy:I===`delete-branch`,anyBusy:!!I,confirming:M===`delete-branch`,actionError:z,onConfirm:()=>N(`delete-branch`),onCancel:()=>N(null),onDelete:e=>void Be(q,e)}),!X&&!Z&&n===`worktrees`&&Y&&K&&(0,F.jsx)(Se,{details:Y,busy:I===`remove-worktree`,anyBusy:!!I,confirming:M===`remove-worktree`,actionError:z,copied:Ee,onConfirm:()=>N(`remove-worktree`),onCancel:()=>N(null),onRemove:(e,t)=>void We(Y,e,t),onCopyPath:()=>void Ge(Y.path),onOpen:()=>e.onOpenWorktree(Y.path),onShowBranch:()=>{Y.branch&&(A(`refs/heads/${Y.branch}`),x(``),C(`local`),T(``),e.onTabChange(`branches`))}}),!X&&!Z&&!G&&!K&&(0,F.jsxs)(`p`,{className:`local-refs-placeholder`,children:[`Select a `,n===`branches`?`branch`:`worktree`,` to see its details.`]})]})]},n),(0,F.jsxs)(`footer`,{className:`local-refs-footer`,children:[(0,F.jsx)(`small`,{children:`Deleting a remote branch keeps local branches and worktrees. Removing a worktree deletes its branch only when explicitly selected.`}),(0,F.jsx)(y,{render:(0,F.jsx)(m,{variant:`outline`,size:`sm`,disabled:!!I}),children:`Done`})]})]})})}function xe({details:e,pullRequest:t,busy:n,anyBusy:r,confirming:i,actionError:a,onConfirm:o,onCancel:s,onDelete:c}){let l=T(e,t),u=l.forceAllowed===!0,d=l.allowed||u;return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,F.jsxs)(`h3`,{children:[(0,F.jsx)(k,{"aria-hidden":`true`}),(0,F.jsxs)(ee,{children:[(0,F.jsx)(te,{render:(0,F.jsx)(`span`,{}),children:e.name}),(0,F.jsx)(h,{children:e.name})]})]}),(0,F.jsx)(R,{badges:se(e)})]}),(0,F.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,F.jsx)(z,{label:`Full ref`,children:(0,F.jsx)(`code`,{className:`local-refs-selectable`,children:e.fullName})}),(0,F.jsxs)(z,{label:`Tip`,children:[(0,F.jsx)(`code`,{children:e.shortOid}),` `,e.subject]}),(0,F.jsx)(z,{label:`Author`,children:e.author||`—`}),(0,F.jsx)(z,{label:`Last commit`,children:e.date?x(e.date):`—`}),(0,F.jsx)(z,{label:`Upstream`,children:e.upstream?`${e.upstream} · ↑${e.ahead} ↓${e.behind}`:`Not configured`}),(0,F.jsx)(z,{label:`Compared with`,children:e.comparisonBase??`Not compared`}),t&&(0,F.jsx)(z,{label:`GitHub PR`,children:(0,F.jsxs)(`button`,{type:`button`,className:`local-refs-pr-link`,onClick:()=>j(t.url),children:[`#`,t.number,` · `,t.state===`MERGED`?`Merged into ${t.baseRefName}`:t.state===`OPEN`?`Open`:`Closed`,` `,(0,F.jsx)(A,{"aria-hidden":`true`})]})})]}),(0,F.jsx)(L,{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,F.jsxs)(F.Fragment,{children:[`Force-delete the local branch `,(0,F.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,F.jsxs)(F.Fragment,{children:[`GitHub reports PR `,(0,F.jsxs)(`strong`,{children:[`#`,t.number]}),` as merged into `,(0,F.jsx)(`strong`,{children:t.baseRefName}),`, although local Git cannot verify the ancestry.`]}):null]}):(0,F.jsxs)(F.Fragment,{children:[`Delete the local branch `,(0,F.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,F.jsx)(`strong`,{children:e.comparisonBase}),`.`]}),onConfirm:o,onCancel:s,onAct:()=>c(u)})]})}function Se({details:e,busy:t,anyBusy:n,confirming:r,actionError:i,copied:a,onConfirm:o,onCancel:s,onRemove:l,onCopyPath:u,onOpen:d,onShowBranch:f}){let[p,g]=(0,P.useState)(!1),_=C(e),y=w(e),b=_.forceAllowed===!0,ne=_.allowed||b;return(0,P.useEffect)(()=>g(!1),[e.path]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`local-refs-detail-head`,children:[(0,F.jsxs)(`h3`,{children:[(0,F.jsx)(ie,{"aria-hidden":`true`}),(0,F.jsxs)(ee,{children:[(0,F.jsx)(te,{render:(0,F.jsx)(`span`,{}),children:pe(e.path)}),(0,F.jsx)(h,{children:pe(e.path)})]})]}),(0,F.jsx)(R,{badges:ve(e)})]}),(0,F.jsxs)(`dl`,{className:`local-refs-facts`,children:[(0,F.jsx)(z,{label:`Folder`,children:(0,F.jsx)(`span`,{className:`local-refs-path local-refs-selectable`,children:e.path})}),(0,F.jsx)(z,{label:`Branch`,children:e.branch??`Detached HEAD`}),(0,F.jsx)(z,{label:`HEAD`,children:e.lastCommit?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`code`,{children:e.lastCommit.shortOid}),` `,e.lastCommit.subject]}):(0,F.jsx)(`code`,{children:e.oid?e.oid.slice(0,7):`—`})}),(0,F.jsx)(z,{label:`Committed`,children:e.lastCommit?.date?x(e.lastCommit.date):`—`}),(0,F.jsx)(z,{label:`Local changes`,children:e.available?y??`None`:`Not readable`})]}),(0,F.jsxs)(`div`,{className:`local-refs-detail-actions`,children:[(0,F.jsxs)(m,{variant:`outline`,size:`sm`,onClick:u,disabled:n,children:[a?(0,F.jsx)(c,{}):(0,F.jsx)(v,{}),` `,a?`Copied`:`Copy path`]}),!e.current&&e.available&&!e.locked&&(0,F.jsxs)(m,{variant:`outline`,size:`sm`,onClick:d,disabled:n,children:[(0,F.jsx)(A,{}),` Open worktree`]}),e.branch&&(0,F.jsxs)(m,{variant:`ghost`,size:`sm`,onClick:f,disabled:n,children:[(0,F.jsx)(k,{}),` Show branch`]})]}),e.branch&&ne&&(0,F.jsxs)(`label`,{htmlFor:`remove-worktree-delete-branch`,className:`local-refs-delete-branch`,children:[(0,F.jsx)(M,{id:`remove-worktree-delete-branch`,checked:p,onCheckedChange:e=>g(e===!0),disabled:n}),(0,F.jsxs)(`span`,{children:[`Also delete branch `,(0,F.jsx)(`strong`,{children:e.branch})]})]}),(0,F.jsx)(L,{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:ne,confirmation:(0,F.jsxs)(F.Fragment,{children:[b?(0,F.jsxs)(F.Fragment,{children:[`Permanently remove the worktree at `,(0,F.jsx)(`strong`,{className:`local-refs-path`,children:e.path}),`? `,(0,F.jsx)(`strong`,{children:y??`The ${e.operation??`current Git operation`}`}),` and every uncommitted file will be lost. The folder is deleted from disk and is `,(0,F.jsx)(`strong`,{children:`not`}),` moved to system Trash. `]}):(0,F.jsxs)(F.Fragment,{children:[`Remove the worktree at `,(0,F.jsx)(`strong`,{className:`local-refs-path`,children:e.path}),`? The folder is deleted from disk and is `,(0,F.jsx)(`strong`,{children:`not`}),` moved to system Trash. `]}),p&&e.branch?(0,F.jsxs)(F.Fragment,{children:[`The branch `,(0,F.jsx)(`strong`,{children:e.branch}),` will also be force-deleted. Commits found only on that branch may become inaccessible.`]}):e.branch?(0,F.jsxs)(F.Fragment,{children:[`The branch `,(0,F.jsx)(`strong`,{children:e.branch}),` and its commits stay in the repository.`]}):`No branch is deleted.`]}),onConfirm:o,onCancel:s,onAct:()=>l(b,p)})]})}function L({tone:e,reason:t,actionError:n,confirming:r,busy:i,anyBusy:o,allowed:c,actionLabel:l,confirmLabel:u,confirmation:f,onConfirm:p,onCancel:h,onAct:ee}){return(0,F.jsxs)(`div`,{className:`local-refs-danger ${e}`,children:[n&&(0,F.jsxs)(`p`,{className:`local-refs-danger-error`,role:`alert`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:n})]}),r&&c?(0,F.jsxs)(`div`,{className:`local-refs-confirm`,role:`alert`,children:[(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsx)(`p`,{children:f}),(0,F.jsxs)(`span`,{className:`local-refs-confirm-actions`,children:[(0,F.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:ee,disabled:i,children:[i?(0,F.jsx)(d,{className:`animate-spin`}):(0,F.jsx)(S,{}),` `,i?(0,F.jsx)(a,{text:u}):u]}),(0,F.jsx)(m,{variant:`ghost`,size:`sm`,onClick:h,disabled:i,children:`Cancel`})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`local-refs-reason`,children:[e===`ready`?(0,F.jsx)(O,{"aria-hidden":`true`}):(0,F.jsx)(s,{"aria-hidden":`true`}),(0,F.jsx)(`span`,{children:t})]}),c&&(0,F.jsxs)(m,{variant:`destructive`,size:`sm`,onClick:p,disabled:o,children:[(0,F.jsx)(S,{}),` `,l]})]})]})}function R({badges:e}){return e.length===0?null:(0,F.jsx)(`span`,{className:`local-refs-badges`,children:e.map(e=>(0,F.jsx)(D,{variant:e.tone===`current`?`default`:e.tone===`warning`?`destructive`:`outline`,children:e.label},e.label))})}function z({label:e,children:t}){return(0,F.jsxs)(`div`,{className:`local-refs-fact`,children:[(0,F.jsx)(`dt`,{children:e}),(0,F.jsx)(`dd`,{children:t})]})}function Ce(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 we(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 Te(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 B(e){return e instanceof Error?e.message:String(e)}export{I as LocalRefsDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Dtt7rXw0.js","assets/index-DsKvWsTs.js","assets/rolldown-runtime-C0FnF6B9.js","assets/base-ui-DDpgJXgO.js","assets/react-BlQ_XOQu.js","assets/tanstack-CVAt_k_T.js","assets/utils-D0T3A-kS.js","assets/createReactComponent-Ctub7J3a.js","assets/external-url-IUS7RmYD.js","assets/index-kyWCnbkb.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-JH1jZ6Eh.js","assets/chunk-VPRB5NB3-Dnr3edxV.js","assets/render-markdown-CQi2yKYQ.js","assets/string-TLTPtCPs-SBynuHAV.js","assets/dist-B8XHAue7.js","assets/App-Bfw_TX8q.js","assets/IconAlertTriangle-B9iDJKvP.js","assets/IconPlus-DJCoD3wt.js","assets/IconCheck-C-G-IA13.js","assets/select-Dq3KDX2O.js","assets/IconChevronDown-DU5i40lD.js","assets/IconSelector-BVMU1PEt.js","assets/IconGitMerge-D9KEj1cE.js","assets/IconGitPullRequest-ClaUqyVa.js","assets/IconLoader4-D2VN7u1V.js","assets/IconSearch-1VQ4P4kW.js","assets/shortcuts-BzIlT01I.js","assets/chunk-3YJQHVM4-CdP15KtA.js","assets/dist-Cz2MTljl.js","assets/chunk-HJ2JQQFS-AF4phse0.js","assets/chunk-E2ZNV5FY-DnKvxSiA.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-4EA7E6EY-xRPCCZLU.js","assets/chunk-XC4XBNZT-CIqGRxkD.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DBDB3WZW-BonEIRP2.js","assets/chunk-2BW5OAIV-BQMxlSNI.js","assets/line-Axq4vVX-.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/chunk-NTY3LDVX-OolU2PaP.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{n as i,t as a}from"./createReactComponent-Ctub7J3a.js";import{t as o}from"./IconLoader4-D2VN7u1V.js";import{S as s,b as c,g as l,h as u,k as ee,l as d,t as f,v as p}from"./index-DsKvWsTs.js";import{d as m}from"./App-Bfw_TX8q.js";import{n as h,r as g,t as _}from"./viewer-tabs-DkkqN9MD.js";import{FileSaveControls as v,FileViewerChrome as y,SourceCodeEditor as b,n as x,t as S}from"./EditableFileViewer-Dotntfij.js";import{renderMarkdown as te}from"./render-markdown-CQi2yKYQ.js";/* empty css */var ne=a(`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`}]]),re=a(`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()),ie=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-Dtt7rXw0.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,39,40,41,42]));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,ae={conflictTitle:`Markdown was changed outside OpenTig`,successTitle:`Markdown saved`,errorTitle:`Could not save Markdown`};function N(){try{return window.localStorage.getItem(j)===`fit`?`fit`:`reading`}catch{return`reading`}}function P({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:a,wrapLines:d,readOnly:f,onOpenFile:m,onDirtyChange:T,onDraftChange:E,onSave:D}){let[O,k]=(0,C.useState)(`preview`),[F,oe]=(0,C.useState)(N),[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:se,dirty:Z,saving:Q,save:ce}=S({file:t,initialContent:n,readOnly:f,messages:ae,onDirtyChange:T,onDraftChange:E,onSave:D});(0,C.useEffect)(()=>{Y.current?.(),J.current=null,k(`preview`)},[t.path]);let le=(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=x({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;te(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,a]),(0,C.useEffect)(()=>()=>{G.current&&window.clearTimeout(G.current.timer)},[]);let ue=(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 s(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{ee.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{c(a)}catch{}return}let o=w(t.path,a);o&&m(o)},[t.path,m]),de=(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=>{oe(e);try{window.localStorage.setItem(j,e)}catch{}};return(0,A.jsxs)(_,{value:O,onValueChange:e=>le(e),className:`markdown-viewer`,"data-content-width":F,children:[(0,A.jsx)(y,{save:(0,A.jsx)(v,{dirty:Z,saving:Q,readOnly:f,onSave:()=>void ce()}),children:(0,A.jsxs)(`div`,{className:`file-viewer-pill markdown-viewer-toolbar`,children:[(0,A.jsx)(h,{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.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)(ne,{"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)(re,{"aria-hidden":`true`})}),(0,A.jsx)(l,{children:`Fit to width`})]})]})]})}),(0,A.jsxs)(g,{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)(o,{className:`spinner`,"aria-hidden":`true`}),(0,A.jsx)(i,{text:`Rendering Markdown…`})]}):(0,A.jsx)(P,{repositoryId:e,markdownPath:t.path,html:I,onClick:e=>void ue(e),onLinkHover:de},`${e}:${t.path}:${r}`),(0,A.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:B?`Code copied`:``}),H?(0,ie.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)(g,{value:`code`,className:`markdown-code-view`,"data-theme":a,children:(0,A.jsx)(b,{ref:q,path:t.path,cacheKey:t.path,value:X,themeType:a,wrapLines:d,readOnly:f||Q,onChange:se})})]})}export{F as MarkdownFileViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{n as r}from"./createReactComponent-Ctub7J3a.js";import{t as i}from"./IconLoader4-D2VN7u1V.js";import{T as a,f as o,p as s}from"./index-DsKvWsTs.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 from the desktop app, or run the recovery command below on the server and restart this instance. Previously paired browsers can then resume their saved sessions; new devices need a pairing link. For a custom CLI home, add --home to the recovery command.`};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)(o,{recovery:!0}),(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)(r,{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)(i,{className:`size-5 animate-spin text-primary`,"aria-hidden":`true`}),(0,p.jsx)(r,{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)(r,{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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{n as r}from"./createReactComponent-Ctub7J3a.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./DiffWorkspace-DCo89dF1.js";import{T as p}from"./index-DsKvWsTs.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-mIDzTMB9.js";import{r as P}from"./EditContext-rlYgrfe2.js";import{t as te}from"./File-DHnVtIhS.js";var F=class extends u{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:d(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:s({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 c{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:i,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=a(e,i);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=a(this.computedCache.file,i);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=d(r,e);if(i==null)continue;let a=r.conflictIndex,o=s({hunkIndex:i.hunkIndex,lineIndex:i.lineIndex,conflictIndex:a}),c=`${n}-${o}`,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(o);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=l(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 a=n?.contents??``,s=o(a),{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:i,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:i}=a(e,t?.maxContextLines);return{fileDiff:n,actions:r,markerRows:i}}),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:i})}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:r,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:r,prerenderedHTML:s,hasConflictUtility:m!=null,hasGutterRenderUtility:p!=null,hasCustomHeader:l!=null,disableWorkerPool:h}),S=i({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)(f,{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:i,onResolve:a}){let[o,s]=(0,Z.useState)(()=>be(e.content)),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(!1),f=o.draft,m=o.revision,h=De(f);(0,Z.useEffect)(()=>{s(t=>Ce(t,e.content))},[e.content]);let g=async(t,n)=>{if(c)return;l(!0);let r=o,a=Oe(f,t,n);s(e=>xe(e,a));try{await i(e.path,a)?s(e=>Se(e,a)):s(e=>e.draft===a?r:e)}finally{l(!1)}},_=async()=>{if(!(h>0||u)){d(!0);try{await a(e.path,f)}finally{d(!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||u,onClick:()=>void _(),children:u?(0,$.jsx)(r,{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:f,cacheKey:`${e.path}:conflict:${m}`},disableWorkerPool:f.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:c,onClick:()=>void g(e.conflict,`current`),children:`Accept current`}),(0,$.jsx)(p,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void g(e.conflict,`incoming`),children:`Accept incoming`}),(0,$.jsx)(p,{size:`xs`,variant:`outline`,disabled:c,onClick:()=>void g(e.conflict,`both`),children:`Accept both`})]})},`${e.path}:${m}`):(0,$.jsx)(te,{file:{name:e.path,lang:O(e.path),contents:f,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};
|
package/dist/client/assets/{PierreEditBoundary-Bt0q7SXc.js → PierreEditBoundary-DAdYNYZ3.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/edit-BBjrev4P.js","assets/rolldown-runtime-C0FnF6B9.js","assets/color-C1Sk4dBL.js","assets/cloneFileDiffMetadata-zVRGqYgv.js","assets/dist-B8XHAue7.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{
|
|
2
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{Ct as t,xt as n}from"./base-ui-DDpgJXgO.js";import{k as r,t as i,x as a}from"./index-DsKvWsTs.js";import{t as o}from"./EditContext-rlYgrfe2.js";import{t as s}from"./edit-ready-context-MO-PrQZN.js";var c=e(t()),l=n();function u({enabled:e,children:t}){let[n,u]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!e||n)return;let t=!0;return i(()=>import(`./edit-BBjrev4P.js`).then(e=>{t&&u(()=>e.Editor)}),__vite__mapDeps([0,1,2,3,4])).catch(e=>{t&&r.error({title:`Could not load the code editor`,description:e instanceof Error?e.message:`Unknown error`})}),()=>{t=!1}},[n,e]);let d=(0,c.useCallback)((e,t,r)=>{if(!n)throw Error(`Pierre edit mode has not loaded.`);return new n(e,{clipboard:{readText:()=>a()},...t},r)},[n]);return n?(0,l.jsx)(o,{createEditor:d,children:(0,l.jsx)(s.Provider,{value:!0,children:t})}):(0,l.jsx)(s.Provider,{value:!1,children:t})}export{u as PierreEditBoundary};
|