@opentig/cli 0.2.0 → 0.2.1
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/dist/bin.mjs +1 -1
- package/dist/chunks/{cli-Bi6ET5UT.mjs → cli-B6JTojx_.mjs} +1 -1
- package/dist/client/assets/App-Dfm5F199.js +74 -0
- package/dist/client/assets/CreatePullRequestDialog-CAeykZ72.js +2 -0
- package/dist/client/assets/{DiffWorkspace-RDG_Y70N.js → DiffWorkspace-BRicWHvw.js} +13 -13
- package/dist/client/assets/{EditableFileViewer-CsbifqBO.js → EditableFileViewer-DWeSDnZn.js} +1 -1
- package/dist/client/assets/{File-CHjvYpb2.js → File-D65shwRR.js} +1 -1
- package/dist/client/assets/FilesView-EfoU7sF-.js +1 -0
- package/dist/client/assets/GitHubAvatar-C8R3iNoM.js +1 -0
- package/dist/client/assets/HistoryView-C6T2dsBC.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-h8ULU8Gy.js → HtmlFileViewer-JXLHTNPm.js} +1 -1
- package/dist/client/assets/{IconEdit-Cg8S2wqW.js → IconEdit-3fgBTCQ4.js} +1 -1
- package/dist/client/assets/{IconFolderSymlink-BZSLX1ez.js → IconFolderSymlink-C4ydD1eS.js} +1 -1
- package/dist/client/assets/{ImageFileViewer-Cjw58ckv.js → ImageFileViewer-YH2xhkkk.js} +1 -1
- package/dist/client/assets/LocalRefsDialog--1NiYKYj.js +1 -0
- package/dist/client/assets/{MarkdownFileViewer-kLiduag6.js → MarkdownFileViewer-BsB8WkIH.js} +2 -2
- package/dist/client/assets/PairingPage-DXRyAYHn.js +1 -0
- package/dist/client/assets/{PierreDiffViewer-eAcugmoF.js → PierreDiffViewer-DoV3V0IW.js} +1 -1
- package/dist/client/assets/{PierreEditBoundary-DlGd1pqO.js → PierreEditBoundary-BnYZbHfi.js} +1 -1
- package/dist/client/assets/{PierreWorkerPool-Col4k7qz.js → PierreWorkerPool-Cg9zdxiI.js} +1 -1
- package/dist/client/assets/PullRequestDiff-D6QG5Anx.js +1 -0
- package/dist/client/assets/PullRequestViewer-jC3LVmiO.js +2 -0
- package/dist/client/assets/PullRequestsView-GStKxG7k.js +1 -0
- package/dist/client/assets/{QuickOpenDialog-BFDDZVCL.js → QuickOpenDialog-HvslpGQl.js} +1 -1
- package/dist/client/assets/{RepositoryProjectsDialog-CvB8KcFp.js → RepositoryProjectsDialog-Biqv5GO_.js} +1 -1
- package/dist/client/assets/SearchView-D5XB6wdu.js +1 -0
- package/dist/client/assets/SettingsDialog-DWAunOQB.js +72 -0
- package/dist/client/assets/{Viewer-o1hDU33O.js → Viewer-Gfy3Ejyo.js} +3 -3
- package/dist/client/assets/{abnfDiagram-N423BO3Z-BvrnK_R-.js → abnfDiagram-N423BO3Z-DdAfHevw.js} +1 -1
- package/dist/client/assets/{arc-DLa3_7ua.js → arc-C43uoeEi.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-BexwhnyX.js → architectureDiagram-T3A2C74G-C7q0hhRO.js} +1 -1
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-CoOttUUo.js → blockDiagram-VBNYF7ZC-C1x9Iap4.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-Bgp6ppUh.js → c4Diagram-5PPSVZJV-BmKaVW6q.js} +1 -1
- package/dist/client/assets/channel-Diwpee6E.js +1 -0
- package/dist/client/assets/checkbox-XfIUFPxh.js +1 -0
- package/dist/client/assets/{chunk-2GRJ4B5K-C_kzp38w.js → chunk-2GRJ4B5K-kzy_H3BQ.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-CysYnRkJ.js → chunk-2Q5K7J3B-BMj-FT4X.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-oMS6x_ag.js → chunk-5RXB4S5H-DmPGiCCb.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-C5-dW5wf.js → chunk-5VM5RSS4-DYFL8__L.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-DxahInnA.js → chunk-6Q2QTUOP-CI98oVdT.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-D7V-3eRg.js → chunk-GF5L2VYU-D9JiiMlX.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BrLmjbVP.js → chunk-JWPE2WC7-D0THYpZl.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-CyOvijwM.js → chunk-KBJHAD2P-Z1tJfyAr.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-BvEjVjQs.js → chunk-RYQCIY6F-31aS4cD3.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C_IY9A64.js → chunk-XXDRQBXY-ClWDHmEp.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BDuo9kiS.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BDuo9kiS.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Cu7qZi7h.js → cose-bilkent-JH36ORCC-Btg2MYLh.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-B4M1t9lL.js → cynefin-VYW2F7L2-Cbh4Pk6j.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-CAosOLmT.js → cynefinDiagram-MW4NZA55-BBqorl0u.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-q354V538.js → dagre-VZM6K2ZE-DugEItZ0.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-C_CzkBPt.js → diagram-7IWD3JNH-Biu7dmH8.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-VvvYHE9c.js → diagram-B4RE2ZJO-UDm4DXFS.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-D8vRQwb5.js → diagram-LBJQPF4R-Bcku4gb-.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-Bul4aDKg.js → diagram-Q27KOJAE-DFRjglV-.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-DNadEE58.js → diagram-UB23O5K3-CgfMWtd0.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-Bf-68MMZ.js → ebnfDiagram-BXEA7PRR-CZzYOqs0.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-CJ-jHFsf.js → erDiagram-JOGREHBK-Cdlbxgs6.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-DMOdinBU.js → flowDiagram-UKHOOZJN-BgImDwpP.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-DzezS3Zy.js → ganttDiagram-PKOTCBZU-SFhtiyL4.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-Dftpvns8.js → gitGraphDiagram-DS77QQ5N-Bkm5ueys.js} +1 -1
- package/dist/client/assets/{index-DAUK3rnz.js → index-B5RC4THs.js} +4 -4
- package/dist/client/assets/index-Dc9xVluy.css +1 -0
- package/dist/client/assets/{infoDiagram-6WML65LV-DmgUBq17.js → infoDiagram-6WML65LV-pCYc-VX2.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-CL0PQhpQ.js → ishikawaDiagram-WSZJBQD7-BtNbG3Y6.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-Ck4pQx_A.js → journeyDiagram-NVQOT4AX-CPW2qT3y.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-DuRZxBql.js → kanban-definition-27J2QSJJ-wD6JXQFs.js} +1 -1
- package/dist/client/assets/{linear-C2JDCaz4.js → linear-sj8MOkmS.js} +1 -1
- package/dist/client/assets/{mermaid.core-9dt2ugQA.js → mermaid.core-CGJtfmwb.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-vy0fdDF0.js → mindmap-definition-FAOFIHXS-BQwLHBVs.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-DjVJy-Gm.js → pegDiagram-VL7TDLO6-DtDsb-Z8.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-ATbd_8vw.js → pieDiagram-7S7Q4E2Y-B3WhqNuS.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-C8o6ofcl.js → quadrantDiagram-CIZ2JOQS-CPi38pp_.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-Qvij9Ubo.js → railroadDiagram-AXF67PYL-Btac44Ux.js} +1 -1
- package/dist/client/assets/{render-markdown-BtCybfvQ.js → render-markdown-hAIWRfn0.js} +6 -6
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-yLfrba2h.js → requirementDiagram-LRYGKXZP-CHJgDNdg.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-BTXRtTyG.js → sankeyDiagram-W5VNT64P-OYJHfmtd.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BN1CCZIX.js → sequenceDiagram-SI44F4Z6-9ypa9W08.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-BfXjBBYo.js → sizeCapture-X5ZJPWSS-5ZDUTERI.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-DMAWiBsP.js → stateDiagram-OKZ733FA-nGHE1hN7.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CkCpE1Yu.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-BD20m5cw.js → swimlanes-SLNWSIFB-BZFv9Zp8.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-Dxlb7bju.js +8 -0
- package/dist/client/assets/tanstack-CcfAJoQ7.js +1 -0
- package/dist/client/assets/{timeline-definition-Z64GVDOM-gtc0-AHB.js → timeline-definition-Z64GVDOM-pUIcaCIE.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-Cdr4AXTp.js → vennDiagram-T6HMQDX7-D6dEIJmP.js} +1 -1
- package/dist/client/assets/{viewer-tabs-D-T0xQaq.js → viewer-tabs-BjG3oKQ9.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-BcU4vxO8.js → wardleyDiagram-T6FBY63Y-DZ8ro_-y.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-B3Zuadj8.js → xychartDiagram-ELKLHX3M-WJ2Zfmlk.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/dev.mjs +2 -2
- package/dist/manifest.json +2 -2
- package/dist/server.mjs +1616 -473
- package/dist/utility.mjs +11 -5
- package/package.json +1 -1
- package/dist/client/assets/App-BXZLGT86.js +0 -74
- package/dist/client/assets/CreatePullRequestDialog-DFonMYEx.js +0 -2
- package/dist/client/assets/FilesView-Dl8QFbFA.js +0 -1
- package/dist/client/assets/GitHubAvatar-CnBaloV0.js +0 -1
- package/dist/client/assets/HistoryView-BgCZU2JO.js +0 -1
- package/dist/client/assets/LocalRefsDialog-DNgrd7Qp.js +0 -1
- package/dist/client/assets/PairingPage-C97sv-8s.js +0 -1
- package/dist/client/assets/PullRequestDiff-DhKTXyIF.js +0 -1
- package/dist/client/assets/PullRequestViewer-BgI8HFMe.js +0 -2
- package/dist/client/assets/PullRequestsView-PYWLy8We.js +0 -1
- package/dist/client/assets/SearchView-BwF_MsxK.js +0 -1
- package/dist/client/assets/SettingsDialog-DIcLmXSE.js +0 -9
- package/dist/client/assets/channel-1k1AYpyV.js +0 -1
- package/dist/client/assets/checkbox-BRH0ZNIC.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-ChyNFpay.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-ChyNFpay.js +0 -1
- package/dist/client/assets/index-BfA4tAc1.css +0 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D_ofZeaa.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-CF9m5JSB.js +0 -8
- package/dist/client/assets/tanstack-B0Sf7wNU.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/render-markdown-BtCybfvQ.js","assets/App-BXZLGT86.js","assets/index-DAUK3rnz.js","assets/react-rd22PHbN.js","assets/tanstack-B0Sf7wNU.js","assets/base-ui-CJ8ZIx3d.js","assets/index-BfA4tAc1.css","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as W,_ as $,o as j,B as g,s as x}from"./index-DAUK3rnz.js";import{r,j as a}from"./react-rd22PHbN.js";import{C as Q}from"./checkbox-BRH0ZNIC.js";import{D as Y,c as J,d as K,Y as L,e as X,k as P,S as Z,h as ee,_ as ae,$ as te,a0 as se,Q as ne,x as re,a1 as ie,a2 as le}from"./App-BXZLGT86.js";import{V as ce,a as oe,b as O}from"./viewer-tabs-D-T0xQaq.js";/* empty css */import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";const de=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],M=W("outline","upload","Upload",de);function ye(e){const[n,u]=r.useState(""),[c,C]=r.useState(""),[o,B]=r.useState(""),[y,I]=r.useState(!1),[w,_]=r.useState("edit"),[H,T]=r.useState(""),[i,S]=r.useState(!1),[l,q]=r.useState(null),h=r.useRef(null),N=r.useRef(0),v=e.status?.branch??null,b=e.preferences.commitMessageHarness,E=e.preferences.commitMessageModels[b]??"default",V=he(e.aiProviders,b,E),m=r.useMemo(()=>e.branches.filter(t=>t.remote&&!t.fullName.endsWith("/HEAD")&&t.name!==`origin/${v??""}`).map(t=>t.name),[v,e.branches]);r.useEffect(()=>{e.open&&B(t=>t&&m.includes(t)?t:ue(m))},[m,e.open]),r.useEffect(()=>{if(!e.open||w!=="preview")return;const t=++N.current;$(async()=>{const{renderMarkdown:s}=await import("./render-markdown-BtCybfvQ.js").then(p=>p.a);return{renderMarkdown:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(({renderMarkdown:s})=>s(c||"_No description._")).then(s=>{t===N.current&&T(s)}).catch(()=>{t===N.current&&T("<p>Could not render the preview.</p>")})},[c,w,e.open]),r.useEffect(()=>{if(e.open)return;const t=h.current;t&&j.github.cancelDraft(t).catch(()=>{})},[e.open]);const k=e.status!==null&&!e.status.upstream,D=e.status!==null&&!!e.status.upstream&&e.status.ahead>0,f=e.status!==null&&(e.status.detached||e.status.unborn||!e.status.branch),d=e.status===null||k||D||f||m.length===0,F=async()=>{const t=h.current;t&&await j.github.cancelDraft(t).catch(()=>{})},U=async()=>{if(d||l||i||!o)return;const t=crypto.randomUUID();h.current=t,q(t);try{const s=await j.github.generateDraft({repositoryId:e.repositoryId,base:o,harness:b,model:E,requestId:t});if(h.current!==t)return;u(s.title),C(s.body),_("edit"),x.success({title:`Draft generated with ${G(s.harness)}`,description:s.contextWasTruncated?"A truncated version of the branch diff was used. Review before publishing.":"Review and edit before publishing."})}catch(s){const p=me(s);p?.code==="AI_CANCELLED"?x.info({title:"Generation canceled"}):x.error({title:"Could not generate the draft",description:p?.message??A(s),duration:1e4})}finally{h.current===t&&(h.current=null),q(s=>s===t?null:s)}},z=async()=>{if(!(d||i||l||!n.trim()||!o)){S(!0);try{const t=await j.github.createPullRequest({repositoryId:e.repositoryId,title:n.trim(),body:c,base:o,draft:y});u(""),C(""),I(!1),x.success({title:y?"Draft pull request created":"Pull request created",description:t.url,button:{title:"Open",onClick:()=>re(t.url)}}),e.onCreated(t.number)}catch(t){const s=ie(t);x.error({title:le(s),description:s?.message??A(t),duration:1e4})}finally{S(!1)}}};return a.jsx(Y,{open:e.open,onOpenChange:t=>{i||e.onOpenChange(t)},children:a.jsxs(J,{className:"create-pr-dialog",children:[a.jsxs("div",{className:"create-pr-content",children:[a.jsxs(K,{children:[a.jsx(L,{"aria-hidden":"true"})," Create pull request"]}),a.jsx(X,{children:v?a.jsxs(a.Fragment,{children:["From ",a.jsx("code",{children:v})," into the selected base branch on GitHub."]}):"Check out a branch to create a pull request."}),k&&a.jsxs("div",{className:"create-pr-notice",children:[a.jsx("span",{children:f?"Check out a branch with at least one commit before publishing.":"Publish this branch before creating a pull request."}),a.jsxs(g,{variant:"outline",size:"xs",disabled:e.pushBusy||f||!!e.status?.readOnly,onClick:e.onPush,children:[e.pushBusy?a.jsx(P,{className:"animate-spin"}):a.jsx(M,{})," Publish branch"]})]}),D&&a.jsxs("div",{className:"create-pr-notice",children:[a.jsxs("span",{children:["The branch has ",e.status?.ahead," unpushed ",e.status?.ahead===1?"commit":"commits",". Push them so the pull request includes your work."]}),a.jsxs(g,{variant:"outline",size:"xs",disabled:e.pushBusy,onClick:e.onPush,children:[e.pushBusy?a.jsx(P,{className:"animate-spin"}):a.jsx(M,{})," Push"]})]}),!k&&!D&&f&&a.jsx("div",{className:"create-pr-notice",children:a.jsx("span",{children:"Pull requests need a checked-out branch with commits."})}),m.length===0&&!f&&a.jsx("div",{className:"create-pr-notice",children:a.jsx("span",{children:"No remote branches are available to use as a base. Fetch the remote first."})}),a.jsxs("div",{className:"create-pr-base-row",children:[a.jsxs("div",{className:"create-pr-field",children:[a.jsx("label",{htmlFor:"create-pr-base",children:"Base branch"}),a.jsx(Z,{groups:[{id:"branches",label:"",items:m.map(t=>({value:t,label:R(t),search:t,icon:a.jsx(ee,{})}))}],value:o,onValueChange:B,label:"Base branch",triggerId:"create-pr-base",triggerLabel:o?R(o):"Select a base",triggerClassName:"create-pr-base",size:"default",align:"start",placeholder:"Search base branches…",disabled:d||i||!!l})]}),a.jsxs("label",{className:"create-pr-draft",children:[a.jsx(Q,{checked:y,onCheckedChange:t=>I(t===!0),disabled:d||i||!!l}),a.jsx("span",{children:"Create as draft"})]})]}),a.jsxs("div",{className:"create-pr-field",children:[a.jsx("label",{htmlFor:"create-pr-title",children:"Title"}),a.jsx("input",{id:"create-pr-title",className:"create-pr-title",value:n,maxLength:300,placeholder:"Pull request title",disabled:d||i||!!l,onChange:t=>u(t.target.value)})]}),a.jsxs(ce,{value:w,onValueChange:t=>_(t),className:"create-pr-field create-pr-body-field",children:[a.jsxs("div",{className:"create-pr-body-header",children:[a.jsx("label",{htmlFor:"create-pr-body",children:"Description"}),a.jsx(oe,{label:"Description view",className:"markdown-viewer-tabs",items:[{value:"edit",label:"Edit"},{value:"preview",label:"Preview"}]})]}),a.jsx(O,{value:"edit",className:"create-pr-body-panel",children:a.jsx(ae,{id:"create-pr-body",value:c,rows:10,placeholder:"Describe the change (GitHub Markdown)",disabled:d||i||!!l,onChange:t=>C(t.target.value)})}),a.jsx(O,{value:"preview",className:"create-pr-preview markdown-prose",dangerouslySetInnerHTML:{__html:H}})]})]}),a.jsxs("div",{className:"create-pr-actions",children:[a.jsxs(g,{variant:"outline",className:"create-pr-generate commit-composer-generate",disabled:d||i,"aria-label":l?"Cancel generation":void 0,onClick:()=>l?void F():void U(),children:[l?a.jsx(te,{className:"text-destructive"}):a.jsx(se,{harness:b}),l?a.jsx(ne,{text:"Generating draft…"}):a.jsxs("span",{className:"commit-composer-provider",children:["Generate with ",a.jsx("span",{className:"commit-composer-harness",children:G(b)}),a.jsx("span",{"aria-hidden":"true",children:"·"}),a.jsx("span",{className:"commit-composer-model",children:V})]})]}),a.jsxs("div",{className:"create-pr-submit-actions",children:[a.jsx(g,{variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:i,children:"Cancel"}),a.jsxs(g,{onClick:()=>{z()},disabled:d||i||!!l||!n.trim()||!o,children:[i?a.jsx(P,{className:"animate-spin"}):a.jsx(L,{})," ",i?"Creating…":"Create pull request"]})]})]})]})})}function ue(e){return e.find(n=>n==="origin/main")??e.find(n=>n==="origin/master")??e[0]??""}function R(e){return e.replace(/^origin\//,"")}function G(e){return e==="codex"?"Codex":e==="claude"?"Claude Code":"OpenCode"}function he(e,n,u){return e?.find(c=>c.id===n)?.models.find(c=>c.id===u)?.label??(u==="default"?"Default (CLI)":u)}function me(e){if(!(e instanceof Error)||!("detail"in e)||!e.detail||typeof e.detail!="object")return null;const n=e.detail;return typeof n.code=="string"&&n.code.startsWith("AI_")&&typeof n.message=="string"?n:null}function A(e){return e instanceof Error?e.message:"An unexpected error occurred."}export{ye as CreatePullRequestDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as a,a as Ut}from"./react-rd22PHbN.js";import{a as dt}from"./tanstack-B0Sf7wNU.js";import{ae as W,D as Bt,c as Vt,d as Yt,e as qt,al as Me,am as Le,an as ut,ao as Gt,k as nt,ap as He,a9 as ye,aq as st,ar as $e,j as _e,F as at,A as Xt,ac as ht,C as Ae,v as ft,a5 as mt,ag as Qt,as as Wt,at as it,au as Zt,av as Jt,aw as en,ad as tn,ax as nn,ay as sn,az as an,aA as on,aB as q,Q as ln,aC as rn,aD as cn,aE as ot,aF as dn,aG as un,aH as Ue,aI as hn,aJ as fn,aK as mn,aL as xn,aM as pn,aN as gn}from"./App-BXZLGT86.js";import{c as re,d as Be,B as R,I as be}from"./index-DAUK3rnz.js";import{m as jn,n as bn,M as yn,o as vn,p as Cn,q as kn,S as Nn}from"./base-ui-CJ8ZIx3d.js";import{a as lt,I as Ve}from"./IconFolderSymlink-BZSLX1ez.js";import{I as xt}from"./IconEdit-Cg8S2wqW.js";const wn=[["path",{d:"M9 14l-4 -4l4 -4",key:"svg-0"}],["path",{d:"M5 10h11a4 4 0 1 1 0 8h-1",key:"svg-1"}]],pt=re("outline","arrow-back-up","ArrowBackUp",wn);const Dn=[["path",{d:"M15 14l4 -4l-4 -4",key:"svg-0"}],["path",{d:"M19 10h-11a4 4 0 1 0 0 8h1",key:"svg-1"}]],gt=re("outline","arrow-forward-up","ArrowForwardUp",Dn);const Sn=[["path",{d:"M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2",key:"svg-0"}],["path",{d:"M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2",key:"svg-1"}]],Re=re("outline","clipboard","Clipboard",Sn);const Mn=[["path",{d:"M3 4a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v16a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-16",key:"svg-0"}],["path",{d:"M12 3v18",key:"svg-1"}]],jt=re("outline","columns-2","Columns2",Mn);const Rn=[["path",{d:"M4 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-0"}],["path",{d:"M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M9.15 14.85l8.85 -10.85",key:"svg-2"}],["path",{d:"M6 4l8.85 10.85",key:"svg-3"}]],Oe=re("outline","cut","Cut",Rn);const En=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2",key:"svg-1"}],["path",{d:"M12 11l0 6",key:"svg-2"}],["path",{d:"M9 14l6 0",key:"svg-3"}]],Ee=re("outline","file-plus","FilePlus",En),Fn=jn,In=bn;function zn({className:t,children:i,...f}){return e.jsx(yn,{children:e.jsx(vn,{className:"isolate z-50 outline-none",children:e.jsx(Cn,{"data-slot":"context-menu-content",className:Be("min-w-44 origin-(--transform-origin) rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...f,children:i})})})}function P({className:t,...i}){return e.jsx(kn,{"data-slot":"context-menu-item",className:Be("flex h-8 cursor-default items-center gap-2 rounded-md px-2 text-xs outline-none select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-45 [&_svg]:size-3.5 [&_svg]:shrink-0",t),...i})}function je({className:t,...i}){return e.jsx(Nn,{"data-slot":"context-menu-separator",className:Be("mx-1 my-1 h-px bg-border",t),...i})}function bt({state:t,onClose:i,onRename:f,onCreate:g}){const[p,o]=a.useState("");if(a.useEffect(()=>{t&&o(t.mode==="rename"?t.entry.name:"")},[t]),!t)return null;const h=t.mode==="rename",d=t.mode==="new-folder"?"directory":"file",M=t.entry.type==="directory"?t.entry.path:W(t.entry.path),D=h?"Rename":d==="directory"?"New Folder":"New File",k=p.trim(),T=k.length>0&&!/[\\/]/.test(k)&&!(h&&k===t.entry.name),z=()=>{T&&(h?f(t.entry,k):g(M,k,d),i())};return e.jsx(Bt,{open:!0,onOpenChange:y=>{y||i()},children:e.jsx(Vt,{className:"name-dialog",children:e.jsxs("form",{className:"name-dialog-content",onSubmit:y=>{y.preventDefault(),z()},children:[e.jsx(Yt,{children:D}),e.jsx(qt,{children:h?e.jsxs(e.Fragment,{children:["Enter a new name for ",e.jsx("code",{children:t.entry.name}),"."]}):e.jsxs(e.Fragment,{children:["Create a new ",d==="directory"?"folder":"file"," in ",e.jsx("code",{children:M||"the repository root"}),"."]})}),e.jsx("input",{autoFocus:!0,className:"name-dialog-input",value:p,maxLength:255,placeholder:h?"New name":d==="directory"?"Folder name":"File name",onChange:y=>o(y.target.value),onFocus:y=>{if(!h)return;const w=t.entry.name.lastIndexOf(".");y.target.setSelectionRange(0,w>0?w:t.entry.name.length)}}),e.jsxs("div",{className:"name-dialog-actions",children:[e.jsx(R,{type:"button",variant:"ghost",onClick:i,children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!T,children:h?"Rename":"Create"})]})]})})})}function yt(t,i,f,g=!0){const[p,o]=a.useState(null);a.useEffect(()=>{if(!g)return;let d=!1;return f(t).then(M=>{d||o({path:t,revision:i,entries:M,failed:!1})},()=>{d||o({path:t,revision:i,entries:[],failed:!0})}),()=>{d=!0}},[t,i,f,g]);const h=g&&p?.path===t;return{entries:h?p.entries:null,failed:h&&p.failed,refreshing:!h||p.revision!==i}}function Pn({entries:t,initialDirectory:i,revision:f,readOnly:g,onLoadDirectory:p,onMove:o,onClose:h}){const[d,M]=a.useState(i),[D,k]=a.useState(!1),{entries:T,failed:z,refreshing:y}=yt(d,f,p),w=t.map(j=>j.path),L=T?.filter(j=>j.type==="directory"&&!w.some(te=>Me(te,j.path)))??[],O=!g&&!D&&!y&&T!==null&&!z&&Le(w,d),G=async()=>{if(O){k(!0);try{await o(t,d),h()}finally{k(!1)}}};return e.jsxs(ut,{open:!0,onOpenChange:j=>{!j&&!D&&h()},title:"Move to…",description:`${t.length} selected ${t.length===1?"item":"items"}. Choose a destination folder.`,children:[e.jsxs("div",{className:"mobile-folder-location",children:[d&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Parent folder",disabled:D,onClick:()=>M(W(d)),children:e.jsx(Gt,{})}),e.jsx("span",{children:d||"Repository root"})]}),e.jsx("div",{className:"mobile-destination-list",children:T===null?e.jsxs("p",{className:"mobile-list-message",role:"status",children:[e.jsx(nt,{className:"animate-spin"})," Loading folders…"]}):z?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):L.length===0?e.jsx("p",{className:"mobile-list-message",children:"No subfolders. You can choose this folder below."}):L.map(j=>e.jsxs("button",{className:"mobile-sheet-action",disabled:D,onClick:()=>M(j.path),children:[e.jsx("img",{src:He(j.path,!1),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{children:j.name}),e.jsx(ye,{})]},j.path))}),e.jsxs("div",{className:"mobile-sheet-footer",children:[e.jsx(R,{variant:"ghost",disabled:D,onClick:h,children:"Cancel"}),e.jsxs(R,{disabled:!O,onClick:()=>{G()},children:[D&&e.jsx(nt,{className:"animate-spin"})," Move here"]})]})]})}const Tn=56;function Ln(t){const[i,f]=a.useState(()=>W(t.activePath??"")),[g,p]=a.useState(""),[o,h]=a.useState(!1),[d,M]=a.useState(new Map),[D,k]=a.useState(null),[T,z]=a.useState(null),[y,w]=a.useState(null),L=a.useRef(null),O=a.useRef(new Map),G=a.useRef(t.activePath),{entries:j,failed:te}=yt(i,t.filesSnapshotRevision,t.onLoadDirectory,t.active),K=a.useMemo(()=>(j??[]).filter(u=>(t.showDotEnvFiles||!u.ignored)&&u.name.toLocaleLowerCase().includes(g.toLocaleLowerCase())),[j,t.showDotEnvFiles,g]),ne=dt({count:K.length,enabled:t.active&&j!==null,getScrollElement:()=>L.current,estimateSize:()=>Tn,getItemKey:u=>K[u].path,overscan:8,paddingEnd:12});a.useEffect(()=>{t.activePath!==G.current&&(G.current=t.activePath,t.activePath&&(f(W(t.activePath)),p("")))},[t.activePath]),a.useEffect(()=>{if(!j)return;const u=new Set(j.map(x=>x.path));M(x=>{const b=new Map([...x].filter(([H])=>u.has(H)));return b.size===x.size?x:b})},[j]),a.useEffect(()=>{j&&L.current&&(L.current.scrollTop=O.current.get(i)??0)},[i,j]),a.useEffect(()=>{if(!t.files||!i||st(t.files,i)!=="missing")return;let u=W(i);for(;u&&st(t.files,u)==="missing";)u=W(u);f(u),p(""),M(new Map)},[t.files,i]);const X=u=>{f(u),p(""),M(new Map)},ce=u=>M(x=>{const b=new Map(x);return b.has(u.path)?b.delete(u.path):b.set(u.path,u),b}),se={type:"directory",path:i,name:i.split("/").pop()??"",children:[]},Q=[...d.values()],v=D&&D!=="tools"?D:null,C=u=>{k(null),u()};return e.jsxs("div",{className:"mobile-files-view",children:[e.jsxs("div",{className:"mobile-view-heading",children:[e.jsxs("h2",{children:[o?"Select items":"Files",o&&e.jsx("small",{children:d.size})]}),e.jsxs("div",{children:[e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":o,onClick:()=>{h(!o),M(new Map)},children:o?"Cancel":"Select"}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"File browser actions",onClick:()=>k("tools"),children:e.jsx($e,{})})]})]}),e.jsxs("label",{className:"mobile-file-filter",children:[e.jsx(_e,{"aria-hidden":"true"}),e.jsx("input",{type:"search",value:g,placeholder:"Filter this folder…","aria-label":"Filter this folder",onChange:u=>{p(u.target.value),O.current.set(i,0),L.current?.scrollTo({top:0})}})]}),e.jsxs("nav",{className:"mobile-file-breadcrumb","aria-label":"Folder location",children:[e.jsxs("button",{onClick:()=>X(""),"aria-current":i===""?"location":void 0,children:[e.jsx(at,{"aria-hidden":"true"})," Root"]}),i.split("/").filter(Boolean).map((u,x,b)=>{const H=b.slice(0,x+1).join("/");return e.jsxs("span",{children:[e.jsx(ye,{"aria-hidden":"true"}),e.jsx("button",{"aria-current":H===i?"location":void 0,onClick:()=>X(H),children:u})]},H)})]}),e.jsx("div",{className:"mobile-files-scroll",ref:L,onScroll:u=>O.current.set(i,u.currentTarget.scrollTop),children:j===null?e.jsx("p",{className:"mobile-list-message",role:"status",children:"Loading files…"}):te?e.jsx("p",{className:"mobile-list-message",role:"alert",children:"Could not read this folder."}):K.length===0?e.jsx("p",{className:"mobile-list-message",children:g?"No matching files in this folder.":"This folder is empty."}):e.jsx("div",{className:"virtual-list",role:"list","aria-label":"Files in this folder",style:{height:ne.getTotalSize()},children:ne.getVirtualItems().map(u=>{const x=K[u.index],b=d.has(x.path);return e.jsxs("div",{role:"listitem",className:`mobile-file-row ${b?"selected":""}`,style:{height:u.size,transform:`translateY(${u.start}px)`},children:[e.jsxs("button",{className:"mobile-file-open","aria-pressed":o?b:void 0,"aria-current":t.activePath===x.path?"true":void 0,onClick:()=>o?ce(x):x.type==="directory"?X(x.path):t.onOpenFile(x.path),children:[o?e.jsx("span",{className:`mobile-file-check ${b?"checked":""}`,children:b&&e.jsx(Xt,{"aria-hidden":"true"})}):e.jsx("img",{src:x.type==="directory"?He(x.path,!1):ht(x.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsxs("span",{className:"mobile-file-copy",children:[e.jsx("strong",{children:x.name}),e.jsx("small",{children:x.type==="directory"?x.ignored?"Ignored folder":"Folder":`${x.ignored?"Ignored · ":""}${Math.max(1,Math.ceil(x.size/1024))} KB`})]}),!o&&x.type==="directory"&&e.jsx(ye,{"aria-hidden":"true"})]}),!o&&e.jsx(R,{variant:"ghost",size:"icon",className:"mobile-file-menu","aria-label":`Actions for ${x.name}`,onClick:()=>k(x),children:e.jsx($e,{})})]},x.path)})})}),o&&e.jsxs("div",{className:"mobile-file-selection-actions",children:[e.jsxs(R,{variant:"ghost",size:"sm",disabled:t.readOnly||d.size===0,onClick:()=>w(Q),children:[e.jsx(lt,{})," Move to…"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:d.size===0,onClick:()=>{t.fileClipboardAvailable?t.onCopyEntries(Q):t.onCopyPath(Q)},children:[e.jsx(be,{})," ",t.fileClipboardAvailable?"Copy":"Copy paths"]}),t.fileClipboardAvailable&&e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Cut selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onCutEntries(Q)},children:e.jsx(Oe,{})}),e.jsx(R,{variant:"ghost",size:"icon","aria-label":"Delete selected items",disabled:t.readOnly||d.size===0,onClick:()=>{t.onDeleteEntries(Q)},children:e.jsx(Ae,{})})]}),e.jsx(ut,{open:D!==null,onOpenChange:u=>{u||k(null)},title:v?.name??"File browser actions",description:v?.path??"Actions for the current folder.",children:v?e.jsxs(e.Fragment,{children:[v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>t.onOpenFile(v.path,"pinned")),children:[e.jsx(Ee,{}),e.jsx("span",{children:"Keep file open"})]}),v.type==="directory"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>X(v.path)),children:[e.jsx(at,{}),e.jsx("span",{children:"Open folder"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>w([v])),children:[e.jsx(lt,{}),e.jsx("span",{children:"Move to…"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"rename",entry:v})),children:[e.jsx(xt,{}),e.jsx("span",{children:"Rename"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyEntries([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onCutEntries([v])}),children:[e.jsx(Oe,{}),e.jsx("span",{children:"Cut"})]}),e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyPath([v])}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy path"})]}),v.type==="file"&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onCopyContents(v)}),children:[e.jsx(be,{}),e.jsx("span",{children:"Copy contents"})]}),t.revealAvailable&&e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(()=>{t.onReveal(v)}),children:[e.jsx(ft,{}),e.jsx("span",{children:"Reveal in file manager"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(v.type==="directory"?v.path:W(v.path))}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action destructive",disabled:t.readOnly,onClick:()=>C(()=>{t.onDeleteEntries([v])}),children:[e.jsx(Ae,{}),e.jsx("span",{children:"Delete"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"mobile-sheet-action",onClick:()=>C(t.onQuickOpen),children:[e.jsx(_e,{}),e.jsx("span",{children:"Find file in repository"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"new-file",entry:se})),children:[e.jsx(Ee,{}),e.jsx("span",{children:"New file"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>z({mode:"new-folder",entry:se})),children:[e.jsx(Ve,{}),e.jsx("span",{children:"New folder"})]}),t.fileClipboardAvailable&&e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly,onClick:()=>C(()=>{t.onPaste(i)}),children:[e.jsx(Re,{}),e.jsx("span",{children:"Paste here"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canUndo,onClick:()=>C(()=>{t.onUndo()}),children:[e.jsx(pt,{}),e.jsx("span",{children:t.historyState.undoLabel?`Undo ${t.historyState.undoLabel}`:"Undo"})]}),e.jsxs("button",{className:"mobile-sheet-action",disabled:t.readOnly||!t.historyState.canRedo,onClick:()=>C(()=>{t.onRedo()}),children:[e.jsx(gt,{}),e.jsx("span",{children:t.historyState.redoLabel?`Redo ${t.historyState.redoLabel}`:"Redo"})]})]})}),e.jsx(bt,{state:T,onClose:()=>z(null),onRename:t.onRename,onCreate:t.onCreate}),y&&e.jsx(Pn,{entries:y,initialDirectory:i,revision:t.filesSnapshotRevision,readOnly:t.readOnly,onLoadDirectory:t.onLoadDirectory,onMove:t.onMoveEntries,onClose:()=>{w(null),M(new Map)}})]})}function es(t){return mt()?e.jsx(Ln,{...t}):e.jsx(Hn,{...t})}const $n=29,Se=6,vt="files-tree-root-drop",_n=550,An={duration:160,easing:"cubic-bezier(0.2, 0, 0, 1)"},rt=6,On=t=>{const i=dn(t),f=i.length>0?i:un(t),g=f.find(p=>p.id!==vt);return g?[g]:f.slice(0,1)};function Ct(t,i,f=0){const g=[];for(const p of t)g.push({entry:p,depth:f}),p.type==="directory"&&i.has(p.path)&&g.push(...Ct(p.children,i,f+1));return g}function Kn(t,i,f){const g=t.findIndex(d=>d.entry.path===i),p=t.findIndex(d=>d.entry.path===f);if(g===-1||p===-1)return[f];const[o,h]=g<=p?[g,p]:[p,g];return t.slice(o,h+1).map(d=>d.entry.path)}function Ke(t){return t.type==="directory"?t.path:W(t.path)}function Hn({active:t,initialExpandedPaths:i,files:f,filesSnapshotRevision:g,showDotEnvFiles:p,activePath:o,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onQuickOpen:k,onUndo:T,onRedo:z,onOpenFile:y,onLoadDirectory:w,onPersistExpandedPaths:L,onCopyPath:O,onCopyEntries:G,onCutEntries:j,onCopyContents:te,onPaste:K,onMoveEntries:ne,onDeleteEntries:X,onReveal:ce,onRename:se,onCreate:Q}){const v=Qt(),C=mt(),[u,x]=a.useState(!1),b=C?44:$n,H=a.useRef(null),ae=a.useRef(null),[S,U]=a.useState(new Set),[ve,ie]=a.useState(o),[oe,Z]=a.useState(o),[A,de]=a.useState(()=>new Set(i)),[Ce,ue]=a.useState([]),[$,J]=a.useState(null),[he,Fe]=a.useState(null),[qe,kt]=a.useState(null),[Nt,wt]=a.useState(!1),[Dt,ee]=a.useState(null),[ke,St]=a.useState(0),[B,Ne]=a.useState(new Map),Mt=Wt(it(Jt,{activationConstraint:{distance:5}}),it(Zt)),Ge=a.useRef(B),fe=a.useRef(new Set),Xe=a.useRef(0),V=a.useRef(null),me=a.useRef(null),Qe=a.useRef(i.join("\0")),we=a.useMemo(()=>new Set(B.keys()),[B]),Y=a.useMemo(()=>f===null?null:en(f,B),[f,B]),N=a.useMemo(()=>Y===null?null:p?Y:tn(Y),[Y,p]);a.useEffect(()=>{Ge.current=B},[B]),a.useEffect(()=>{kt(document.getElementById(nn))},[o]),a.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>wt(n.matches);return s(),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[]),a.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),a.useEffect(()=>{const n=++Xe.current,s=[...Ge.current.keys()];s.length!==0&&Promise.all(s.map(async l=>({path:l,children:await w(l)}))).then(l=>{if(n!==Xe.current)return;const r=new Map(l.map(({path:m,children:c})=>[m,c]));Ne(m=>sn(m,r))})},[g,w]),a.useEffect(()=>{if(!Y){fe.current.clear(),Ne(n=>n.size===0?n:new Map);return}de(n=>{const s=new Set(an(Y,n,we).retained);return ct(n,s)?n:s})},[we,Y]),a.useEffect(()=>{if(!Y)return;const n=on(Y,A,we),s=n.join("\0");s!==Qe.current&&(Qe.current=s,L(n))},[A,we,Y,L]),a.useEffect(()=>{if(!t||!N)return;let n=Math.max(0,2-fe.current.size);for(const s of A){if(n===0)break;const l=q(N,s);!l||l.type!=="directory"||l.ignored!==!0||l.children.length>0||B.has(s)||fe.current.has(s)||(fe.current.add(s),n-=1,w(s).catch(()=>[]).then(r=>{Ne(m=>new Map(m).set(s,r))}).finally(()=>{fe.current.delete(s)}))}},[t,A,B,w,N]),a.useEffect(()=>{t||(ee(null),ue([]),J(null),Fe(null),V.current&&clearTimeout(V.current),V.current=null,me.current=null)},[t]),a.useEffect(()=>{N&&(U(n=>{if(n.size===0)return n;const s=new Set([...n].filter(l=>q(N,l)));return s.size===n.size?n:s}),ie(n=>n&&q(N,n)?n:null),Z(n=>n&&q(N,n)?n:o&&q(N,o)?o:null))},[o,N]);const E=a.useMemo(()=>N?Ct(N,A):[],[A,N]),le=dt({enabled:t,count:E.length,getScrollElement:()=>H.current,estimateSize:()=>b,getItemKey:n=>E[n]?.entry.path??n,overscan:12,paddingStart:Se,paddingEnd:12});a.useEffect(()=>{le.measure()},[le,b]),a.useEffect(()=>{!t||!o||!N||!q(N,o)||de(n=>{const s=new Set(n);let l=!1;const r=o.split("/");let m="";for(let c=0;c<r.length-1;c+=1)m=m?`${m}/${r[c]}`:r[c],s.has(m)||(s.add(m),l=!0);return l?s:n})},[t,o,N]),a.useEffect(()=>{if(!t)return;if(!o){ae.current=null;return}if(ae.current===o)return;const n=E.findIndex(s=>s.entry.path===o);n>=0&&(le.scrollToIndex(n,{align:"auto"}),ae.current=o)},[t,o,E]);const We=a.useMemo(()=>{const n=new Map;for(const s of E)n.set(s.entry.path,s);return n},[E]),xe=a.useMemo(()=>{const n={headers:[],push:0};if(E.length===0||!o)return n;const s=new Set,l=o.split("/");let r="";for(let I=0;I<l.length-1;I+=1)r=r?`${r}/${l[I]}`:l[I],s.add(r);if(s.size===0)return n;const m=Math.min(E.length-1,Math.max(0,Math.floor((ke-Se)/b))),c=E[m];if(!c)return n;const F=c.entry.path.split("/"),_=[];let ge="";for(let I=0;I<F.length-1;I+=1){if(ge=ge?`${ge}/${F[I]}`:F[I],!s.has(ge))continue;const Te=We.get(ge);Te&&Te.entry.type==="directory"&&_.push(Te)}if(_.length>rt&&_.splice(0,_.length-rt),_.length===0)return n;const Ot=_[_.length-1],et=_.length*b;let tt=1/0;const Kt=Math.ceil((ke+et-Se)/b)+2;for(let I=m;I<E.length&&I<=Kt;I+=1)if(E[I].depth<=Ot.depth){tt=Se+I*b;break}const Ht=Math.max(0,Math.min(b,et-(tt-ke)));return{headers:_,push:Ht}},[E,We,ke,o,b]);if(N===null)return e.jsx("div",{className:"view-loading",role:"status",hidden:!t,children:e.jsx(ln,{text:"Loading files…"})});const Rt=u||S.size>0?S:o?new Set([o]):new Set,Et=S.size>0?[...S]:o?[o]:[],Ie=n=>{const s=[];for(const l of n){const r=q(N,l);r&&s.push(r)}return s},ze=n=>{U(new Set([n])),ie(n),Z(n)},Ft=n=>{const s=E.findIndex(l=>l.entry.path===n.path);s>=0&&le.scrollToIndex(s,{align:"start"})},It=(n,s)=>{if(C&&u){U(l=>{const r=new Set(l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r});return}if(s.shift&&(ve||oe)){const l=Kn(E,ve??oe,n.path);U(new Set(l)),Z(n.path);return}if(s.ctrl){U(l=>{const r=new Set(l.size===0&&o?[o]:l);return r.has(n.path)?r.delete(n.path):r.add(n.path),r}),ie(n.path),Z(n.path),n.type==="file"&&y(n.path,"pinned");return}ze(n.path),n.type==="file"?y(n.path):Ze(n.path)},zt=n=>{!(C&&u)&&n.type==="file"&&y(n.path,"pinned")},Pt=n=>{S.has(n.path)||ze(n.path)},De=n=>S.has(n.path)&&S.size>0?Ie(S):[n],Tt=n=>{if(hn(n.target))return;const s=fn(n.nativeEvent,v);if(s==="undo"&&D.canUndo&&!h){n.preventDefault(),n.repeat||T();return}if(s==="redo"&&D.canRedo&&!h){n.preventDefault(),n.repeat||z();return}const l=(n.ctrlKey||n.metaKey)&&!n.altKey,r=n.key.toLowerCase();if(l&&r==="a"){n.preventDefault(),U(new Set(E.map(F=>F.entry.path)));return}const m=Ie(Et),c=oe?q(N,oe):null;if(l&&r==="c"&&m.length){n.preventDefault(),G(m);return}if(l&&r==="x"&&m.length&&!h){n.preventDefault(),j(m);return}if(l&&r==="v"&&!h&&d){n.preventDefault();const F=c?Ke(c):W(m[0]?.path??"");K(F);return}if(n.key==="F2"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h){if(S.size===1){const F=q(N,[...S][0]);F&&(n.preventDefault(),ee({mode:"rename",entry:F}))}return}n.key==="Delete"&&!n.ctrlKey&&!n.metaKey&&!n.altKey&&!n.shiftKey&&!h&&m.length&&(n.preventDefault(),X(m))},Lt=async(n,s)=>{const l=Ie(n);l.length&&await ne(l,s)},Ze=(n,s=!1)=>{const l=!s&&A.has(n),r=l&&q(N??[],n)?.ignored===!0;de(m=>{const c=new Set(m);if(s||!c.has(n)){if(c.has(n))return m;c.add(n)}else if(r)for(const F of c)Me(n,F)&&c.delete(F);else c.delete(n);return ct(m,c)?m:c}),l&&Ne(m=>{const c=[...m.keys()].filter(_=>Me(n,_));if(c.length===0)return m;const F=new Map(m);for(const _ of c)F.delete(_);return F})},pe=()=>{V.current&&clearTimeout(V.current),V.current=null,me.current=null},Je=()=>{pe(),ue([]),J(null),Fe(null)},Pe=n=>{const s=n.active.data.current;return s?.entry&&Array.isArray(s.sourcePaths)?{entry:s.entry,sourcePaths:s.sourcePaths}:null},$t=n=>{const s=Pe(n);s&&(S.has(s.entry.path)||ze(s.entry.path),ue(s.sourcePaths),Fe({entry:s.entry,sourcePaths:s.sourcePaths,count:s.sourcePaths.length}))},_t=n=>{const s=Pe(n);if(n.over?.data.current?.openPinned===!0){J(null),pe();return}const l=n.over?.data.current?.targetDirectory;if(!s||typeof l!="string"||!Le(s.sourcePaths,l)){J(null),pe();return}J(l);const r=n.over?.data.current?.expandPath;if(typeof r!="string"||A.has(r)){pe();return}me.current!==r&&(pe(),me.current=r,V.current=setTimeout(()=>{Ze(r,!0),V.current=null,me.current=null},_n))},At=n=>{const s=Pe(n),l=n.over?.data.current?.openPinned===!0,r=n.over?.data.current?.targetDirectory;if(Je(),s&&l&&ot(s.entry,s.sourcePaths)){y(s.entry.path,"pinned");return}s&&typeof r=="string"&&Le(s.sourcePaths,r)&&Lt(s.sourcePaths,r)};return e.jsxs(rn,{sensors:Mt,collisionDetection:On,autoScroll:{enabled:!0,threshold:{x:.1,y:.16},acceleration:12},onDragStart:$t,onDragOver:_t,onDragCancel:Je,onDragEnd:At,children:[e.jsxs("div",{className:"files-mobile-tools",children:[e.jsxs(R,{variant:"ghost",size:"sm",onClick:k,children:[e.jsx(_e,{})," Find file"]}),e.jsx(R,{variant:"ghost",size:"sm","aria-pressed":u,onClick:()=>{x(!u),U(new Set)},children:u?`Done (${S.size})`:"Select"}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-file",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Ee,{})," New file"]}),e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>ee({mode:"new-folder",entry:{type:"directory",path:"",name:"",children:[]}}),children:[e.jsx(Ve,{})," Folder"]}),d&&e.jsxs(R,{variant:"ghost",size:"sm",disabled:h,onClick:()=>{K("")},children:[e.jsx(Re,{})," Paste"]})]}),e.jsxs("div",{ref:H,className:"files-view virtual-scroll",hidden:!t,onScroll:n=>St(n.currentTarget.scrollTop),children:[xe.headers.length>0&&e.jsx("div",{className:"files-sticky",children:xe.headers.map((n,s)=>{const l=s===xe.headers.length-1;return e.jsxs("button",{type:"button",className:"file-tree-row files-sticky-row","aria-label":`Scroll to ${n.entry.path}`,style:{top:s*b-(l?xe.push:0),paddingLeft:12+n.depth*14,zIndex:xe.headers.length-s},onClick:()=>Ft(n.entry),children:[e.jsx(ye,{className:"folder-chevron open"}),e.jsx(Ye,{path:n.entry.path,type:"directory",expanded:!0}),e.jsx("span",{children:n.entry.name})]},n.entry.path)})}),N.length?e.jsx(Un,{role:"tree","aria-label":"Files",className:`files-tree ${$===""&&Ce.length>0?"root-drop-target":""}`,style:{height:le.getTotalSize()},tabIndex:0,onKeyDown:Tt,onPointerDown:n=>{n.target.closest(".file-tree-row, .file-touch-actions")||(U(new Set),ie(null),Z(null),n.currentTarget.focus())},children:le.getVirtualItems().map(n=>{const{entry:s,depth:l}=E[n.index],r=s.type==="directory"&&A.has(s.path),m=S.has(s.path)&&S.size>1;return e.jsx("div",{className:"virtual-row",style:{height:n.size,transform:`translateY(${n.start}px)`},children:e.jsx(Yn,{entry:s,depth:l,expanded:r,pendingChildren:s.type==="directory"&&s.ignored===!0&&s.children.length===0&&!B.has(s.path),selected:Rt.has(s.path),active:o===s.path,multiSelected:m,readOnly:h,fileClipboardAvailable:d,revealAvailable:M,historyState:D,onUndo:T,onRedo:z,draggedPaths:Ce,dropTargetPath:$,onFocus:Z,onRowClick:It,onRowDoubleClick:zt,onRowContextMenu:Pt,onOpen:c=>y(c.path),onOpenPinned:c=>y(c.path,"pinned"),onCopy:c=>{G(De(c))},onCut:c=>{j(De(c))},onPasteInto:c=>{K(Ke(c))},onCopyPath:c=>{O(De(c))},onCopyContents:te,onRename:c=>ee({mode:"rename",entry:c}),onNewFile:c=>ee({mode:"new-file",entry:c}),onNewFolder:c=>ee({mode:"new-folder",entry:c}),onReveal:ce,onDelete:c=>{X(De(c))},dragPaths:S.has(s.path)&&S.size>0?[...S]:[s.path]})},n.key)})}):e.jsx("p",{className:"empty-list",children:"No files."}),e.jsx(bt,{state:Dt,onClose:()=>ee(null),onRename:se,onCreate:Q})]}),e.jsx(cn,{dropAnimation:Nt?null:An,children:he&&e.jsx(Vn,{preview:he})}),qe&&Ut.createPortal(e.jsx(Bn,{visible:!!(he&&ot(he.entry,he.sourcePaths))}),qe)]})}function Un(t){const{setNodeRef:i}=Ue({id:vt,data:{targetDirectory:"",expandPath:null}});return e.jsx("div",{ref:i,...t})}function Bn({visible:t}){const{isOver:i,setNodeRef:f}=Ue({id:"files-open-pinned-drop",data:{openPinned:!0}});return e.jsxs("div",{ref:f,className:`open-files-drop-target ${t?"visible":""} ${t&&i?"over":""}`,"aria-hidden":"true",children:[e.jsx(jt,{}),e.jsx("span",{children:"Drop to open beside"})]})}function Vn({preview:t}){return e.jsxs("div",{className:"file-drag-overlay",children:[e.jsx(Ye,{path:t.entry.path,type:t.entry.type,expanded:!1}),e.jsx("span",{children:t.entry.name}),t.count>1&&e.jsx("strong",{children:t.count})]})}function ct(t,i){if(t.size!==i.size)return!1;for(const f of t)if(!i.has(f))return!1;return!0}function Yn({entry:t,depth:i,expanded:f,pendingChildren:g,selected:p,active:o,multiSelected:h,readOnly:d,fileClipboardAvailable:M,revealAvailable:D,historyState:k,onUndo:T,onRedo:z,draggedPaths:y,dropTargetPath:w,onFocus:L,onRowClick:O,onRowDoubleClick:G,onRowContextMenu:j,onOpen:te,onOpenPinned:K,onCopy:ne,onCut:X,onPasteInto:ce,onCopyPath:se,onCopyContents:Q,onRename:v,onNewFile:C,onNewFolder:u,onReveal:x,onDelete:b,dragPaths:H}){const ae=a.useRef(null),S=Ke(t),{attributes:U,listeners:ve,setNodeRef:ie,isDragging:oe}=mn({id:`file-drag:${t.path}`,data:{sourcePaths:H,entry:t},disabled:d}),{setNodeRef:Z}=Ue({id:`file-drop:${t.path}`,data:{targetDirectory:S,expandPath:t.type==="directory"?t.path:null}}),A=$=>{ae.current=$,ie($),Z($)},de=y.length>0&&t.type==="directory"&&w===t.path,Ce=y.length>0&&w!==null&&w!==""&&w!==t.path&&Me(w,t.path),ue=e.jsxs("button",{type:"button",ref:A,...U,role:"treeitem","aria-selected":p,"aria-current":o?"true":void 0,"aria-expanded":t.type==="directory"?f:void 0,className:["file-tree-row",t.ignored?"ignored-file":"",y.includes(t.path)||oe?"dragging":"",de?"drop-target":"",Ce?"drop-target-region":""].filter(Boolean).join(" "),style:{paddingLeft:12+i*14},...ve,onClick:$=>O(t,{ctrl:$.ctrlKey||$.metaKey,shift:$.shiftKey}),onDoubleClick:()=>G(t),onFocus:()=>L(t.path),onContextMenu:()=>j(t),children:[t.type==="directory"?e.jsx(ye,{className:`folder-chevron ${f?"open":""} ${t.children.length===0&&!g?"empty":""}`}):e.jsx("span",{className:"tree-spacer"}),e.jsx(Ye,{path:t.path,type:t.type,expanded:f}),e.jsx("span",{children:t.name})]});return e.jsxs(Fn,{children:[e.jsx(In,{render:ue}),e.jsx("button",{type:"button",className:"file-touch-actions","aria-label":`Actions for ${t.name}`,"aria-haspopup":"menu",onClick:$=>{$.stopPropagation();const J=$.currentTarget.getBoundingClientRect();ae.current?.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,clientX:J.left,clientY:J.bottom}))},children:e.jsx($e,{})}),e.jsxs(zn,{children:[t.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsxs(P,{onClick:()=>te(t),children:[e.jsx(xn,{"aria-hidden":"true"})," Open"]}),e.jsxs(P,{onClick:()=>K(t),children:[e.jsx(jt,{"aria-hidden":"true"})," Open to the Side ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Click"})]}),e.jsx(je,{})]}),e.jsxs(P,{disabled:d||!k.canUndo,onClick:()=>{T()},children:[e.jsx(pt,{"aria-hidden":"true"})," ",k.undoLabel?`Undo ${k.undoLabel}`:"Undo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Z"})]}),e.jsxs(P,{disabled:d||!k.canRedo,onClick:()=>{z()},children:[e.jsx(gt,{"aria-hidden":"true"})," ",k.redoLabel?`Redo ${k.redoLabel}`:"Redo"," ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+Shift+Z"})]}),e.jsx(je,{}),e.jsxs(P,{onClick:()=>ne(t),children:[e.jsx(pn,{"aria-hidden":"true"})," Copy ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+C"})]}),e.jsxs(P,{disabled:d,onClick:()=>X(t),children:[e.jsx(Oe,{"aria-hidden":"true"})," Cut ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+X"})]}),M&&e.jsxs(P,{disabled:d,onClick:()=>ce(t),children:[e.jsx(Re,{"aria-hidden":"true"})," Paste ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Ctrl+V"})]}),e.jsx(je,{}),e.jsxs(P,{disabled:d||h,onClick:()=>v(t),children:[e.jsx(xt,{"aria-hidden":"true"})," Rename ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"F2"})]}),e.jsxs(P,{disabled:d||h,onClick:()=>C(t),children:[e.jsx(Ee,{"aria-hidden":"true"})," New File…"]}),e.jsxs(P,{disabled:d||h,onClick:()=>u(t),children:[e.jsx(Ve,{"aria-hidden":"true"})," New Folder…"]}),e.jsx(je,{}),e.jsxs(P,{onClick:()=>se(t),children:[e.jsx(gn,{"aria-hidden":"true"})," Copy path"]}),e.jsxs(P,{disabled:t.type!=="file"||h,onClick:()=>{Q(t)},children:[e.jsx(be,{"aria-hidden":"true"})," Copy contents"]}),D&&e.jsxs(P,{disabled:h,onClick:()=>{x(t)},children:[e.jsx(ft,{"aria-hidden":"true"})," Reveal in File Explorer"]}),e.jsx(je,{}),e.jsxs(P,{className:"text-destructive data-highlighted:text-destructive",disabled:d,onClick:()=>b(t),children:[e.jsx(Ae,{"aria-hidden":"true"})," Delete ",e.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Del"})]})]})]})}function Ye({path:t,type:i,expanded:f=!1}){const g=i==="file"?ht(t):He(t,f);return e.jsx("img",{className:"vscode-tree-icon",src:g,alt:"","aria-hidden":"true"})}export{es as FilesView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as i,T as g,a as x,b as j,B as m,o as M,q as N}from"./index-DAUK3rnz.js";import{r as v,j as e}from"./react-rd22PHbN.js";import{u as C}from"./tanstack-B0Sf7wNU.js";import{Y as b,A as y}from"./App-BXZLGT86.js";import{P,b as R,c as S,d as E,e as _}from"./base-ui-CJ8ZIx3d.js";const q=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]],K=i("outline","circle-check","CircleCheck",q);const I=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M10 10l4 4m0 -4l-4 4",key:"svg-1"}]],U=i("outline","circle-x","CircleX",I);const $=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],T=i("outline","git-merge","GitMerge",$);const G=[["path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4",key:"svg-0"}],["path",{d:"M4 12l8 4l8 -4",key:"svg-1"}],["path",{d:"M4 16l8 4l8 -4",key:"svg-2"}]],F=i("outline","stack-2","Stack2",G);const O=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 10a3 3 0 1 0 6 0a3 3 0 1 0 -6 0",key:"svg-1"}],["path",{d:"M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855",key:"svg-2"}]],z=i("outline","user-circle","UserCircle",O);function X({repositoryId:n,number:r,membership:c,onSelect:l}){const[d,k]=v.useState(!1),a=C({queryKey:N.pullRequestStack(n,r),queryFn:()=>M.github.getPullRequestStack(n,r),enabled:d,staleTime:0}),t=a.data,h=t?t.layers.findIndex(s=>s.number===r)+1:c.position,u=t?.layers.length??c.size,o=t?.number??c.number;return a.isSuccess&&t===null&&!d?null:e.jsxs(P,{open:d,onOpenChange:k,children:[e.jsxs(g,{children:[e.jsxs(x,{render:e.jsx(R,{render:e.jsx("button",{className:"pr-stack-trigger","aria-label":`Stack ${o}, layer ${h} of ${u}`})}),children:[e.jsx(F,{"aria-hidden":"true"})," ",h,"/",u]}),e.jsxs(j,{children:["View stack #",o," · layer ",h," of ",u]})]}),e.jsx(S,{children:e.jsx(E,{side:"bottom",align:"start",sideOffset:6,className:"isolate z-50 outline-none",children:e.jsxs(_,{className:"pr-stack-popup","aria-label":`Stack #${o}`,children:[e.jsxs("div",{className:"pr-stack-heading",children:[e.jsxs("strong",{children:["Stack #",o]}),e.jsx(m,{variant:"ghost",size:"xs",disabled:a.isFetching,onClick:()=>{a.refetch()},children:"Refresh"})]}),a.isFetching&&e.jsx("p",{className:"pr-stack-notice",role:"status",children:t?"Refreshing stack…":"Loading stack…"}),a.isError&&e.jsxs("div",{className:"pr-stack-notice",role:"status",children:[e.jsx("p",{children:t?"Could not refresh. Showing saved layers.":"Could not load the stack."}),e.jsx(m,{variant:"outline",size:"xs",onClick:()=>{a.refetch()},children:"Retry"})]}),t===null&&!a.isFetching&&!a.isError&&e.jsx("p",{className:"pr-stack-notice",children:"This PR is no longer in a stack, or stack data is unavailable."}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"pr-stack-layers",children:[...t.layers].reverse().map(s=>{const p=s.isDraft&&s.state==="OPEN"?"Draft":s.state==="MERGED"?"Merged":s.state==="CLOSED"?"Closed":"Open",f=s.state==="MERGED"?T:b;return e.jsxs(g,{children:[e.jsxs(x,{render:e.jsx("button",{className:"pr-stack-layer","aria-current":s.number===r?"true":void 0,onClick:()=>{k(!1),l(s.number)}}),children:[e.jsx(f,{className:`pr-stack-state ${p.toLowerCase()}`,"aria-hidden":"true"}),e.jsxs("span",{className:"pr-stack-layer-text",children:[e.jsx("strong",{children:s.title}),e.jsxs("small",{children:["#",s.number," · ",s.headRefName," · ",p]})]}),s.number===r&&e.jsx(y,{"aria-hidden":"true"})]}),e.jsxs(j,{children:[s.title," · ",s.headRefName," · ",p]})]},s.number)})}),e.jsxs("div",{className:"pr-stack-base",children:["↳ ",t.base]})]})]})})})]})}function H({src:n,className:r}){const[c,l]=v.useState(!1);return e.jsx("span",{className:r,"aria-hidden":"true",children:n&&!c?e.jsx("img",{src:n,alt:"",onError:()=>l(!0)}):e.jsx(z,{})})}export{H as G,T as I,X as P,K as a,U as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as w,j as e}from"./react-rd22PHbN.js";import{a5 as ne,k as J,Q as Z,j as ae,a6 as re,a7 as oe,a8 as ie,a9 as le,Y as ce,p as de,u as he,aa as ue,ab as me,ac as pe}from"./App-BXZLGT86.js";import{a as xe}from"./tanstack-B0Sf7wNU.js";import{T as N,a as C,b as v,B as U,o as je,w as fe,s as X}from"./index-DAUK3rnz.js";import"./base-ui-CJ8ZIx3d.js";function ge(s){let n=[],a=s.some(r=>r.color!==void 0)?3:0,t=1;const o=new Map,j=[],i=new Map(s.map(r=>[r.oid,r])),u=new Set;let d=s[0];for(;d&&!u.has(d.oid);)u.add(d.oid),d.color!==void 0&&o.set(d.oid,d.color),d=i.get(d.parentOids[0]??"");for(const r of s){let h=n.indexOf(r.oid);const p=h>=0;h<0&&(h=n.length,n=[...n,r.oid]);const f=n,$=be(o,r.oid,()=>r.color??a++),x=$<3?r.color??$:$;o.set(r.oid,x);const y=f.filter((g,l)=>l!==h);let P=Math.min(h,y.length);r.parentOids.forEach((g,l)=>{o.has(g)||o.set(g,l===0?x:a++),!y.includes(g)&&(y.splice(P,0,g),P+=1)});const E=[];f.forEach((g,l)=>{if(l===h){p&&E.push({fromLane:l,from:"top",toLane:h,to:"node",color:$});return}const I=y.indexOf(g);I>=0&&E.push({fromLane:l,from:"top",toLane:I,to:"bottom",color:o.get(g)??0})}),r.parentOids.forEach(g=>{const l=y.indexOf(g);l>=0&&E.push({fromLane:h,from:"node",toLane:l,to:"bottom",color:o.get(g)??x})}),t=Math.max(t,f.length,y.length),j.push({lane:h,color:x,segments:E,continuations:y.map((g,l)=>({lane:l,color:o.get(g)??0}))}),n=y}return{rows:j,laneCount:t}}function be(s,n,a){const t=s.get(n);if(t!==void 0)return t;const o=a();return s.set(n,o),o}function ye(s){const n=s.parentCount>1&&/^Merge pull request #(\d+)\b/i.exec(s.subject),a=/\(#(\d+)\)\s*$/.exec(s.subject),t=n||a;if(!t)return null;const o=Number(t[1]);return Number.isSafeInteger(o)&&o>0?{number:o,source:n?"merge":"subject"}:null}function Ne(s){if(s.upstreamState==="local-only")return 0;if(s.baseState==="included")return 2;if(s.upstreamState==="published")return 1}function Ce(s,n){if(!n)return s.map(i=>({commit:i,parentOids:i.parentOids,grouped:[]}));const a=new Map(s.map(i=>[i.oid,i])),t=new Map;s.forEach(i=>i.parentOids.forEach(u=>{const d=t.get(u)??new Set;d.add(i.oid),t.set(u,d)}));const o=new Set,j=[];for(const i of s){if(o.has(i.oid))continue;const u={commit:i,parentOids:i.parentOids,grouped:[]};if(j.push(u),i.parentOids.length!==2)continue;const d=new Set;let r=a.get(i.parentOids[0]);for(;r&&!d.has(r.oid);)d.add(r.oid),r=a.get(r.parentOids[0]??"");let h=i.parentOids[1];const p=[],f=new Set;for(;!d.has(h);){const x=a.get(h);if(!x||f.has(h)||o.has(h)||x.isHead||x.parentOids.length!==1)break;f.add(h),p.push(x),h=x.parentOids[0]}if(!d.has(h)||p.length===0)continue;const $=new Set([i.oid,...p.map(x=>x.oid)]);p.some(x=>[...t.get(x.oid)??[]].some(y=>!$.has(y)))||p.some(x=>j.some(y=>y.commit.oid===x.oid))||(u.grouped=p,u.parentOids=[i.parentOids[0]],p.forEach(x=>o.add(x.oid)))}return j}function Q(s,n){const a=n.trim().toLocaleLowerCase();return a.length>0&&[s.subject,s.author,s.oid,...s.decorations].some(t=>t.toLocaleLowerCase().includes(a))}function Fe({repositoryId:s,upstream:n,readOnly:a,operation:t,canPublish:o,pushBusy:j,onPublish:i,commits:u,nextCursor:d,loading:r,undoing:h,baseRef:p,activeOid:f,onSelectReference:$,onSelectCommit:x,onSelectFile:y,onUndo:P,onMore:E}){const g=ne(),l=w.useRef(null),[I,L]=w.useState(new Set),[M,T]=w.useState(!0),[O,G]=w.useState(!1),[S,R]=w.useState(""),[q,z]=w.useState(-1),c=g?52:M?42:56,b=w.useMemo(()=>Ce(u??[],O&&!S.trim()),[u,O,S]),_=w.useMemo(()=>ge(b.map(({commit:m,parentOids:k})=>({oid:m.oid,parentOids:k,color:Ne(m)}))),[b]),F=w.useMemo(()=>b.flatMap(({commit:m},k)=>Q(m,S)?[k]:[]),[b,S]),se=$e(_.laneCount),H=xe({count:b.length,getScrollElement:()=>l.current,estimateSize:()=>c,getItemKey:m=>b[m].commit.oid,overscan:8});w.useEffect(()=>{H.measure()},[H,M,O,S,g]);const K=()=>{if(!F.length)return;const m=(q+1)%F.length;z(m),H.scrollToIndex(F[m],{align:"center"})};if(u===null)return e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Z,{text:"Loading history…"})]});const V=u.filter(m=>m.upstreamState==="local-only").length;return e.jsxs("div",{className:"history-list",style:{"--history-row-height":`${c}px`},children:[e.jsxs("div",{className:"history-toolbar",children:[e.jsxs("label",{className:"history-search",children:[e.jsx(ae,{"aria-hidden":"true"}),e.jsx("input",{type:"search","aria-label":"Search loaded commits",placeholder:"Find commit…",value:S,onChange:m=>{R(m.target.value),z(-1)},onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),K())}})]}),S&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-next-match",onClick:K,disabled:!F.length,"aria-label":"Next matching commit"}),children:e.jsx(re,{})}),e.jsx(v,{children:"Next match in loaded history (Enter)"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":O,disabled:!u.some(m=>m.parentCount>1),onClick:()=>G(!O)}),children:"Group merges"}),e.jsx(v,{children:"Collapse complete merge branches. Searching reveals their commits."})]}),!g&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"history-option","aria-pressed":M,onClick:()=>T(!M)}),children:M?"Compact":"Comfortable"}),e.jsx(v,{children:"Change row density without moving the diff viewer"})]})]}),!n&&u.length>0&&e.jsxs("div",{className:"history-upstream-notice",role:"status",children:[e.jsx("span",{children:"Publish this branch to configure an upstream and distinguish local from published commits."}),o&&e.jsx(U,{variant:"outline",size:"xs",disabled:j||a||!!t,onClick:i,children:j?"Publishing…":"Publish branch"})]}),n&&V>0&&e.jsxs("div",{className:"history-local-summary",children:["↑ ",V," ",V===1?"local commit":"local commits"," in loaded history"]}),e.jsx("div",{ref:l,className:"history-scroll",role:"list","aria-label":"Commit history",children:b.length===0?e.jsx("p",{className:"empty-list",children:"This repository has no commits yet."}):e.jsxs("div",{className:"virtual-list",style:{height:H.getTotalSize()+(d?52:0)},children:[H.getVirtualItems().map(m=>{const{commit:k,grouped:W}=b[m.index];return e.jsx("div",{ref:H.measureElement,"data-index":m.index,className:"virtual-row",style:{transform:`translateY(${m.start}px)`},children:e.jsx(ve,{repositoryId:s,upstream:n,baseRef:p,commit:k,graphRow:_.rows[m.index],graphWidth:se,rowHeight:c,active:f===k.oid||W.some(Y=>Y.oid===f),match:Q(k,S),groupedCount:W.length,onRevealGroup:()=>G(!1),onSelectReference:$,expanded:I.has(k.oid),onExpandedChange:Y=>L(te=>{const B=new Set(te);return Y?B.add(k.oid):B.delete(k.oid),B}),canUndo:!a&&!t&&!h&&k.upstreamState==="local-only"&&k.isHead&&k.parentCount===1,onSelectCommit:x,onSelectFile:y,onUndo:P})},m.key)}),d&&e.jsx(U,{variant:"ghost",className:"history-more",style:{top:H.getTotalSize()},disabled:r,onClick:E,children:r?"Loading…":"Load more"})]})}),u.length>0&&e.jsxs("div",{className:"history-legend",children:[e.jsxs("span",{children:[e.jsx("i",{"data-color":"local"}),"Local"]}),e.jsxs("span",{children:[e.jsx("i",{"data-color":"published"}),"Published"]}),p&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"history-base-label"}),children:[e.jsx("i",{"data-color":"base"}),p]}),e.jsxs(v,{children:["Primary-line commits reachable from ",p,", using the latest known local refs. Side branches use the published color."]})]}),e.jsx("span",{className:"history-count",role:"status",children:S?`${F.length} matches in ${u.length} loaded`:`${u.length} loaded`})]})]})}function ve({repositoryId:s,upstream:n,baseRef:a,commit:t,graphRow:o,graphWidth:j,rowHeight:i,active:u,match:d,groupedCount:r,onRevealGroup:h,onSelectReference:p,expanded:f,onExpandedChange:$,canUndo:x,onSelectCommit:y,onSelectFile:P,onUndo:E}){const g=`${s}:${t.oid}`,[l,I]=w.useState(()=>oe(g)??null),[L,M]=w.useState(null);w.useEffect(()=>{if(!f||l||L)return;let c=!0;return je.commits.files(s,t.oid).then(b=>{c&&(ie(g,b),I(b))}).catch(b=>{c&&M(Me(b))}),()=>{c=!1}},[g,t.oid,f,l,L,s]);const T=ye(t),O=Ee(t.decorations),G=O.slice(0,3),S=O.slice(3),R=l?.reduce((c,b)=>c+b.additions,0)??0,q=l?.reduce((c,b)=>c+b.deletions,0)??0,z=async()=>{try{await fe(t.oid),X.success({title:"Hash copied",description:t.oid})}catch{X.error({title:"Could not copy hash"})}};return e.jsxs("div",{className:`commit-item${u?" active":""}${d?" search-match":""}`,role:"listitem",children:[e.jsxs("div",{className:"commit-header",children:[e.jsx(Se,{graph:o,width:j,height:i,merge:t.parentCount>1,head:t.isHead}),e.jsx("button",{className:"commit-expand","aria-expanded":f,"aria-label":f?"Collapse commit":"Expand commit",onClick:()=>$(!f),children:e.jsx(le,{className:`folder-chevron ${f?"open":""}`})}),e.jsxs("div",{className:"commit-main",children:[e.jsxs("span",{className:"commit-title-row",children:[e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-subject","aria-pressed":u,onClick:()=>y(t)}),children:t.subject||"(no subject)"}),e.jsxs(v,{side:"right",children:[t.subject||"(no subject)",e.jsx("br",{}),"Open the full commit diff"]})]}),T&&e.jsxs(N,{children:[e.jsxs(C,{render:p?e.jsx("button",{className:"ref-chip commit-pr",onClick:()=>p(T.number),"aria-label":`Open pull request #${T.number}`}):e.jsx("span",{className:"ref-chip commit-pr"}),children:[e.jsx(ce,{"aria-hidden":"true"}),"#",T.number]}),e.jsxs(v,{children:[T.source==="merge"?"Pull request reference from the merge message.":"Reference from the commit subject; it may identify a pull request or issue.",p?" Open as a pull request in the right-hand viewer.":""," No merge method is inferred from the number."]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("time",{className:"commit-date",dateTime:t.date}),children:de(t.date)}),e.jsx(v,{children:he(t.date)})]})]}),e.jsxs("span",{className:"commit-meta",children:[(O.length>0||t.parentCount>1||t.upstreamState==="local-only")&&e.jsxs("span",{className:"commit-refs",children:[t.upstreamState==="local-only"&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"ref-chip local-only"}),children:"Local"}),e.jsx(v,{children:t.isHead?`Not in ${n??"the upstream"} according to the latest known remote state.`:"Not published. To avoid rewriting multiple commits, only the latest can be undone."})]}),t.parentCount>1&&e.jsx("span",{className:"ref-chip merge",children:"merge"}),G.map(c=>e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:`ref-chip ${c.kind}`,"data-base":c.label===a||c.label.endsWith("/HEAD")&&t.baseState==="included"}),children:c.label}),e.jsx(v,{children:c.label})]},`${c.kind}:${c.label}`)),S.length>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("span",{className:"ref-chip more"}),children:["+",S.length]}),e.jsx(v,{children:S.map(c=>c.label).join(" · ")})]})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("button",{className:"commit-oid",onClick:()=>{z()},"aria-label":`Copiar hash ${t.shortOid}`}),children:t.shortOid}),e.jsx(v,{children:"Copy full hash"})]}),e.jsxs(N,{children:[e.jsx(C,{render:e.jsx("span",{className:"commit-author"}),children:t.author}),e.jsx(v,{children:t.author})]}),r>0&&e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-group-count",onClick:h}),children:[r," grouped"]}),e.jsxs(v,{children:["Show the ",r," commits in this merge branch"]})]})]})]}),x&&e.jsxs(N,{children:[e.jsx(C,{render:e.jsx(U,{variant:"ghost",size:"icon-xs",className:"change-action-button commit-undo",onClick:c=>{c.stopPropagation(),E(t)},"aria-label":`Undo commit ${t.shortOid}`}),children:e.jsx(ue,{})}),e.jsx(v,{children:"Undo commit and keep its changes staged"})]})]}),f&&o.continuations.length>0&&e.jsx(ke,{graph:o,width:j}),f&&e.jsxs("div",{className:"commit-files",style:{paddingLeft:j+31},children:[t.body&&e.jsx("p",{className:"commit-description",children:t.body}),L&&e.jsx("div",{className:"commit-files-message error",children:L}),!l&&!L&&e.jsxs("div",{className:"commit-files-message",children:[e.jsx(J,{className:"spinner"})," ",e.jsx(Z,{text:"Loading files…"})]}),l&&l.length===0&&e.jsx("div",{className:"commit-files-message",children:"This commit does not modify its own files (merge)."}),l&&l.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"commit-files-summary",children:[l.length," ",l.length===1?"file":"files",(R>0||q>0)&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"add",children:["+",R]})," ",e.jsxs("span",{className:"del",children:["−",q]})]})]}),l.map(c=>e.jsx(Oe,{file:c,onSelect:()=>P(t.oid,c)},c.path))]})]})]})}const ee=14,we=["var(--history-local)","var(--history-published)","var(--history-base)"];function $e(s){return 14+Math.max(0,s-1)*ee}function A(s){return 7+s*ee}function D(s){return we[s]??"var(--history-published)"}function Se({graph:s,width:n,height:a,merge:t,head:o}){const j=a/2;return e.jsxs("svg",{className:"commit-graph",width:n,height:a,viewBox:`0 0 ${n} ${a}`,"aria-hidden":"true",children:[s.segments.map((i,u)=>{const d=A(i.fromLane),r=A(i.toLane),h=i.from==="top"?0:j,p=i.to==="node"?j:a,f=(h+p)/2,$=d===r?`M ${d} ${h} L ${r} ${p}`:`M ${d} ${h} C ${d} ${f}, ${r} ${f}, ${r} ${p}`;return e.jsx("path",{d:$,stroke:D(i.color)},`${u}:${$}`)}),e.jsx("circle",{cx:A(s.lane),cy:j,r:t||o?4.5:3,fill:t||o?"var(--sidebar)":D(s.color),stroke:D(s.color)}),t&&e.jsx("circle",{cx:A(s.lane),cy:j,r:"1.6",fill:D(s.color)})]})}function ke({graph:s,width:n}){return e.jsx("svg",{className:"commit-graph-continuation",width:n,viewBox:`0 0 ${n} 100`,preserveAspectRatio:"none","aria-hidden":"true",children:s.continuations.map(a=>e.jsx("line",{x1:A(a.lane),y1:"0",x2:A(a.lane),y2:"100",stroke:D(a.color)},a.lane))})}function Oe({file:s,onSelect:n}){const a=w.useRef(null),t=s.path.lastIndexOf("/"),o=t<0?s.path:s.path.slice(t+1),j=s.oldPath?.split("/").pop();return e.jsxs("div",{ref:a,className:"commit-file-row",children:[e.jsxs(N,{children:[e.jsxs(C,{render:e.jsx("button",{className:"commit-file-label",onClick:n,"aria-label":`Ver el diff de ${s.path}`}),children:[e.jsx(Le,{path:s.path,type:"file"}),e.jsxs("span",{className:"commit-file-text",children:[e.jsx("span",{children:o}),j&&e.jsxs("small",{className:"commit-file-rename",children:[j," →"]})]})]}),e.jsx(v,{anchor:a,side:"right",sideOffset:10,children:s.oldPath?`${s.oldPath} → ${s.path}`:s.path})]}),e.jsx("span",{className:"commit-file-stats",children:s.binary?e.jsx("span",{className:"binary",children:"bin"}):e.jsxs(e.Fragment,{children:[s.additions>0&&e.jsxs("span",{className:"add",children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{className:"del",children:["−",s.deletions]})]})}),e.jsx("span",{className:"status-code","data-kind":s.kind,children:me(s.kind)})]})}function Ee(s){return s.map(n=>n.startsWith("tag: ")?{label:n.slice(5),kind:"tag"}:n.startsWith("HEAD -> ")?{label:n.slice(8),kind:"head"}:n==="HEAD"?{label:"HEAD",kind:"head"}:{label:n,kind:n.includes("/")?"remote":"branch"})}function Le({path:s}){return e.jsx("img",{className:"vscode-tree-icon",src:pe(s),alt:"","aria-hidden":"true",draggable:!1})}function Me(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{Fe as HistoryView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e}from"./react-rd22PHbN.js";import{f as ve,a as Ne,b as B,w as F,n as ce,D as Ce,c as De,d as Te,e as Be,g as ie,I as he,h as M,i as se,j as Fe,k as H,l as Se,m as O,o as Ee,p as Re,q as U,r as me,B as Ie,s as Ae,t as Ge,u as ue,v as be,x as Pe,y as Oe,z as Le,A as $e,C as de,E as ze}from"./App-BXZLGT86.js";import{u as W}from"./tanstack-B0Sf7wNU.js";import{q as K,B as f,T as X,a as J,b as V,I as qe,w as We,o as S}from"./index-DAUK3rnz.js";import{C as Ke}from"./checkbox-BRH0ZNIC.js";import"./base-ui-CJ8ZIx3d.js";function rr(r){const{open:n,tab:a,repositoryId:t,onMutated:b,onBusyChange:j}=r,[o,p]=l.useState(""),[k,c]=l.useState(!1),[i,g]=l.useState(null),[w,E]=l.useState(null),[v,x]=l.useState(null),[d,R]=l.useState(null),[L,N]=l.useState(null),[fe,$]=l.useState(!1),ae=l.useRef(null);l.useEffect(()=>{c(!1)},[n,t]);const D=W({queryKey:K.localRefs(t),queryFn:()=>S.refs.localRefsSnapshot(t),enabled:n}),m=D.data??null,z=D.isFetching,ne=D.error?Q(D.error):null,Z=l.useMemo(()=>ve(m?.branches??[],o),[m,o]),_=l.useMemo(()=>Ne(m?.worktrees??[],o),[m,o]),I=Z.find(s=>B(s)===i)??null,A=_.find(s=>F(s)===w)??null,le=W({queryKey:K.branchDetails(t,I?.fullName??""),queryFn:()=>S.refs.branchDetails({repositoryId:t,fullName:I.fullName}),enabled:n&&a==="branches"&&I!==null}),y=le.data??null,je=W({queryKey:K.branchPullRequest(t,y?.name??""),queryFn:()=>S.github.findPullRequestForBranch(t,y.name),enabled:n&&a==="branches"&&y!==null&&(y.deletion==="unknown"||y.deletion==="unmerged")}).data??null,te=W({queryKey:K.worktreeDetails(t,A?.path??""),queryFn:()=>S.refs.worktreeDetails({repositoryId:t,path:A.path}),enabled:n&&a==="worktrees"&&A!==null}),C=te.data??null,ee=a==="branches"?le:te,q=ee.isFetching,G=ee.error?Q(ee.error):null,P=l.useCallback(async()=>{await D.refetch()},[D]);l.useEffect(()=>{if(!m)return;const s=ae.current;ae.current=m,g(h=>ce(m.branches.map(B),(s?.branches??[]).map(B),h)),E(h=>ce(m.worktrees.map(F),(s?.worktrees??[]).map(F),h))},[m]),l.useEffect(()=>{n||(p(""),x(null),N(null),$(!1))},[n]),l.useEffect(()=>{x(null),N(null),$(!1)},[a,i,w]);const oe=async(s,h)=>{R(s),j(!0),N(null);try{await h()&&x(null)}catch(T){N(Q(T))}finally{R(null),j(!1)}},pe=(s,h)=>oe("delete-branch",async()=>{const T=await S.refs.deleteBranch({repositoryId:t,fullName:s.fullName,expectedOid:s.oid,force:h});return T.status!=="deleted"?(N(Me(T.status)),await P(),!1):(b(null),await P(),!0)}),ge=(s,h,T)=>oe("remove-worktree",async()=>{const re=await S.refs.removeWorktree({repositoryId:t,path:s.path,expectedOid:s.oid,force:h,deleteBranch:T});return re.status!=="removed"?(N(Ue(re.status)),await P(),!1):(b(re.recentRepositories),await P(),!0)}),we=async s=>{try{await We(s),$(!0),window.setTimeout(()=>$(!1),1600)}catch(h){N(Q(h))}},ke={branches:m?.branches.length??0,worktrees:m?.worktrees.length??0},ye=a==="branches"?Z.length===0:_.length===0;return e.jsx(Ce,{open:n,onOpenChange:r.onOpenChange,children:e.jsxs(De,{className:"local-refs-dialog",children:[e.jsxs("header",{className:"local-refs-header",children:[e.jsxs("div",{children:[e.jsx(Te,{children:"Local branches and worktrees"}),e.jsx(Be,{children:"Inspect what this repository holds locally, and retire what Git can safely remove."})]}),e.jsx(ie,{render:e.jsx(f,{variant:"ghost",size:"icon-sm","aria-label":"Close the local refs manager"}),children:e.jsx(he,{})})]}),e.jsxs("div",{className:"local-refs-toolbar",children:[e.jsx("div",{className:"local-refs-tabs",role:"tablist","aria-label":"Local refs",children:["branches","worktrees"].map(s=>e.jsxs("button",{type:"button",role:"tab",id:`local-refs-tab-${s}`,"aria-selected":a===s,"aria-controls":`local-refs-panel-${s}`,className:"local-refs-tab",onClick:()=>{r.onTabChange(s),c(!1)},children:[s==="branches"?e.jsx(M,{"aria-hidden":"true"}):e.jsx(se,{"aria-hidden":"true"}),e.jsx("span",{children:s==="branches"?"Branches":"Worktrees"}),e.jsx("small",{children:ke[s]})]},s))}),e.jsxs("div",{className:"local-refs-search",children:[e.jsx(Fe,{"aria-hidden":"true"}),e.jsxs("label",{className:"sr-only",htmlFor:"local-refs-search-input",children:["Search ",a]}),e.jsx("input",{id:"local-refs-search-input",value:o,onChange:s=>p(s.target.value),placeholder:a==="branches"?"Search branches…":"Search worktrees…",autoComplete:"off",spellCheck:!1}),o&&e.jsx(f,{variant:"ghost",size:"icon-xs","aria-label":"Clear search",onClick:()=>p(""),children:e.jsx(he,{})})]}),e.jsxs(f,{variant:"outline",size:"sm",onClick:()=>{P()},disabled:z||!!d,children:[z?e.jsx(H,{className:"animate-spin"}):e.jsx(Se,{})," Refresh"]})]}),ne&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:ne})]}),k&&e.jsxs("button",{type:"button",className:"local-refs-mobile-back",onClick:()=>c(!1),children:["← Back to ",a]}),e.jsxs("div",{className:"local-refs-body","data-mobile-detail":k,role:"tabpanel",id:`local-refs-panel-${a}`,"aria-labelledby":`local-refs-tab-${a}`,children:[e.jsxs("div",{className:"local-refs-list",role:"listbox","aria-label":a==="branches"?"Local branches":"Worktrees",tabIndex:-1,children:[z&&!m&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(H,{className:"animate-spin","aria-hidden":"true"})," Reading the repository…"]}),!z&&ye&&e.jsx("p",{className:"local-refs-placeholder",children:o?"No matches for this search.":`This repository has no ${a==="branches"?"local branches":"worktrees"}.`}),a==="branches"&&Z.map(s=>e.jsxs(X,{children:[e.jsxs(J,{render:e.jsx("button",{type:"button",role:"option","aria-selected":B(s)===i,className:"local-refs-row",onClick:()=>{g(B(s)),c(!0)}}),children:[e.jsxs("span",{className:"local-refs-row-head",children:[e.jsx(M,{"aria-hidden":"true"}),e.jsx("strong",{children:s.name}),e.jsx(Y,{badges:Ee(s)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("code",{children:s.shortOid}),s.subject&&e.jsx("span",{children:s.subject}),s.date&&e.jsx("time",{dateTime:s.date,children:Re(s.date)})]})]}),e.jsxs(V,{children:[s.name,s.subject?` — ${s.subject}`:""]})]},B(s))),a==="worktrees"&&_.map(s=>e.jsxs(X,{children:[e.jsxs(J,{render:e.jsx("button",{type:"button",role:"option","aria-selected":F(s)===w,className:"local-refs-row",onClick:()=>{E(F(s)),c(!0)}}),children:[e.jsxs("span",{className:"local-refs-row-head",children:[e.jsx(se,{"aria-hidden":"true"}),e.jsx("strong",{children:U(s.path)}),e.jsx(Y,{badges:me(s)})]}),e.jsxs("small",{className:"local-refs-row-meta",children:[e.jsx("span",{className:"local-refs-row-branch",children:s.branch?`${s.branch}`:"Detached HEAD"}),e.jsx("span",{children:s.path})]})]}),e.jsxs(V,{children:[U(s.path)," — ",s.path]})]},F(s)))]}),e.jsxs("div",{className:"local-refs-detail",children:[G&&e.jsxs("div",{className:"local-refs-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:G})]}),q&&e.jsxs("p",{className:"local-refs-placeholder",children:[e.jsx(H,{className:"animate-spin","aria-hidden":"true"})," Loading details…"]}),!q&&!G&&a==="branches"&&y&&I&&e.jsx(Qe,{details:y,pullRequest:je,busy:d==="delete-branch",anyBusy:!!d,confirming:v==="delete-branch",actionError:L,onConfirm:()=>x("delete-branch"),onCancel:()=>x(null),onDelete:s=>{pe(y,s)}}),!q&&!G&&a==="worktrees"&&C&&A&&e.jsx(He,{details:C,busy:d==="remove-worktree",anyBusy:!!d,confirming:v==="remove-worktree",actionError:L,copied:fe,onConfirm:()=>x("remove-worktree"),onCancel:()=>x(null),onRemove:(s,h)=>{ge(C,s,h)},onCopyPath:()=>{we(C.path)},onOpen:()=>r.onOpenWorktree(C.path),onShowBranch:()=>{C.branch&&(g(`refs/heads/${C.branch}`),r.onTabChange("branches"))}}),!q&&!G&&!I&&!A&&e.jsxs("p",{className:"local-refs-placeholder",children:["Select a ",a==="branches"?"branch":"worktree"," to see its details."]})]})]},a),e.jsxs("footer",{className:"local-refs-footer",children:[e.jsx("small",{children:"Deleting a branch and removing a worktree are separate actions. A worktree removes its branch only when explicitly selected."}),e.jsx(ie,{render:e.jsx(f,{variant:"outline",size:"sm",disabled:!!d}),children:"Done"})]})]})})}function Qe({details:r,pullRequest:n,busy:a,anyBusy:t,confirming:b,actionError:j,onConfirm:o,onCancel:p,onDelete:k}){const c=Ae(r,n),i=c.forceAllowed===!0,g=c.allowed||i;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(M,{"aria-hidden":"true"}),e.jsxs(X,{children:[e.jsx(J,{render:e.jsx("span",{}),children:r.name}),e.jsx(V,{children:r.name})]})]}),e.jsx(Y,{badges:Ge(r)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(u,{label:"Full ref",children:e.jsx("code",{className:"local-refs-selectable",children:r.fullName})}),e.jsxs(u,{label:"Tip",children:[e.jsx("code",{children:r.shortOid})," ",r.subject]}),e.jsx(u,{label:"Author",children:r.author||"—"}),e.jsx(u,{label:"Last commit",children:r.date?ue(r.date):"—"}),e.jsx(u,{label:"Upstream",children:r.upstream?`${r.upstream} · ↑${r.ahead} ↓${r.behind}`:"Not configured"}),e.jsx(u,{label:"Compared with",children:r.comparisonBase??"Not compared"}),n&&e.jsx(u,{label:"GitHub PR",children:e.jsxs("button",{type:"button",className:"local-refs-pr-link",onClick:()=>Pe(n.url),children:["#",n.number," · ",n.state==="MERGED"?`Merged into ${n.baseRefName}`:n.state==="OPEN"?"Open":"Closed"," ",e.jsx(be,{"aria-hidden":"true"})]})})]}),e.jsx(xe,{tone:c.allowed?"ready":"blocked",reason:c.reason,actionError:j,confirming:b,busy:a,anyBusy:t,actionLabel:i?"Force delete branch":"Delete branch",confirmLabel:a?"Deleting…":i?"Permanently delete":"Delete branch",allowed:g,confirmation:i?e.jsxs(e.Fragment,{children:["Force-delete the local branch ",e.jsx("strong",{children:r.name}),"? This keeps any remote branch and pull request, but commits found only on this local branch may become inaccessible. ",n?.state==="MERGED"?e.jsxs(e.Fragment,{children:["GitHub reports PR ",e.jsxs("strong",{children:["#",n.number]})," as merged into ",e.jsx("strong",{children:n.baseRefName}),", although local Git cannot verify the ancestry."]}):null]}):e.jsxs(e.Fragment,{children:["Delete the local branch ",e.jsx("strong",{children:r.name}),"? This removes only the local branch, keeping every worktree and any remote copy. Git confirmed it is fully merged into ",e.jsx("strong",{children:r.comparisonBase}),"."]}),onConfirm:o,onCancel:p,onAct:()=>k(i)})]})}function He({details:r,busy:n,anyBusy:a,confirming:t,actionError:b,copied:j,onConfirm:o,onCancel:p,onRemove:k,onCopyPath:c,onOpen:i,onShowBranch:g}){const[w,E]=l.useState(!1),v=Oe(r),x=Le(r),d=v.forceAllowed===!0,R=v.allowed||d;return l.useEffect(()=>E(!1),[r.path]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"local-refs-detail-head",children:[e.jsxs("h3",{children:[e.jsx(se,{"aria-hidden":"true"}),e.jsxs(X,{children:[e.jsx(J,{render:e.jsx("span",{}),children:U(r.path)}),e.jsx(V,{children:U(r.path)})]})]}),e.jsx(Y,{badges:me(r)})]}),e.jsxs("dl",{className:"local-refs-facts",children:[e.jsx(u,{label:"Folder",children:e.jsx("span",{className:"local-refs-path local-refs-selectable",children:r.path})}),e.jsx(u,{label:"Branch",children:r.branch??"Detached HEAD"}),e.jsx(u,{label:"HEAD",children:r.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{children:r.lastCommit.shortOid})," ",r.lastCommit.subject]}):e.jsx("code",{children:r.oid?r.oid.slice(0,7):"—"})}),e.jsx(u,{label:"Committed",children:r.lastCommit?.date?ue(r.lastCommit.date):"—"}),e.jsx(u,{label:"Local changes",children:r.available?x??"None":"Not readable"})]}),e.jsxs("div",{className:"local-refs-detail-actions",children:[e.jsxs(f,{variant:"outline",size:"sm",onClick:c,disabled:a,children:[j?e.jsx($e,{}):e.jsx(qe,{})," ",j?"Copied":"Copy path"]}),!r.current&&r.available&&!r.locked&&e.jsxs(f,{variant:"outline",size:"sm",onClick:i,disabled:a,children:[e.jsx(be,{})," Open worktree"]}),r.branch&&e.jsxs(f,{variant:"ghost",size:"sm",onClick:g,disabled:a,children:[e.jsx(M,{})," Show branch"]})]}),r.branch&&R&&e.jsxs("label",{htmlFor:"remove-worktree-delete-branch",className:"local-refs-delete-branch",children:[e.jsx(Ke,{id:"remove-worktree-delete-branch",checked:w,onCheckedChange:L=>E(L===!0),disabled:a}),e.jsxs("span",{children:["Also delete branch ",e.jsx("strong",{children:r.branch})]})]}),e.jsx(xe,{tone:v.allowed?"ready":"blocked",reason:v.reason,actionError:b,confirming:t,busy:n,anyBusy:a,actionLabel:d?"Force remove worktree":"Remove worktree",confirmLabel:n?"Removing…":d?"Permanently remove":"Remove worktree",allowed:R,confirmation:e.jsxs(e.Fragment,{children:[d?e.jsxs(e.Fragment,{children:["Permanently remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:r.path}),"? ",e.jsx("strong",{children:x??`The ${r.operation??"current Git operation"}`})," and every uncommitted file will be lost. The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}):e.jsxs(e.Fragment,{children:["Remove the worktree at ",e.jsx("strong",{className:"local-refs-path",children:r.path}),"? The folder is deleted from disk and is ",e.jsx("strong",{children:"not"})," moved to system Trash. "]}),w&&r.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:r.branch})," will also be force-deleted. Commits found only on that branch may become inaccessible."]}):r.branch?e.jsxs(e.Fragment,{children:["The branch ",e.jsx("strong",{children:r.branch})," and its commits stay in the repository."]}):"No branch is deleted."]}),onConfirm:o,onCancel:p,onAct:()=>k(d,w)})]})}function xe({tone:r,reason:n,actionError:a,confirming:t,busy:b,anyBusy:j,allowed:o,actionLabel:p,confirmLabel:k,confirmation:c,onConfirm:i,onCancel:g,onAct:w}){return e.jsxs("div",{className:`local-refs-danger ${r}`,children:[a&&e.jsxs("p",{className:"local-refs-danger-error",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:a})]}),t&&o?e.jsxs("div",{className:"local-refs-confirm",role:"alert",children:[e.jsx(O,{"aria-hidden":"true"}),e.jsx("p",{children:c}),e.jsxs("span",{className:"local-refs-confirm-actions",children:[e.jsxs(f,{variant:"destructive",size:"sm",onClick:w,disabled:b,children:[b?e.jsx(H,{className:"animate-spin"}):e.jsx(de,{})," ",k]}),e.jsx(f,{variant:"ghost",size:"sm",onClick:g,disabled:b,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"local-refs-reason",children:[r==="ready"?e.jsx(ze,{"aria-hidden":"true"}):e.jsx(O,{"aria-hidden":"true"}),e.jsx("span",{children:n})]}),o&&e.jsxs(f,{variant:"destructive",size:"sm",onClick:i,disabled:j,children:[e.jsx(de,{})," ",p]})]})]})}function Y({badges:r}){return r.length===0?null:e.jsx("span",{className:"local-refs-badges",children:r.map(n=>e.jsx(Ie,{variant:n.tone==="current"?"default":n.tone==="warning"?"destructive":"outline",children:n.label},n.label))})}function u({label:r,children:n}){return e.jsxs("div",{className:"local-refs-fact",children:[e.jsx("dt",{children:r}),e.jsx("dd",{children:n})]})}function Me(r){switch(r){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 Ue(r){switch(r){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 Q(r){return r instanceof Error?r.message:String(r)}export{rr as LocalRefsDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e}from"./react-rd22PHbN.js";import{B as g,e as b,P as w}from"./index-DAUK3rnz.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";async function v(a,i=fetch){try{const t=await i("/api/auth/descriptor",{credentials:"include",cache:"no-store",signal:a});if(!t.ok)return"unavailable";const n=await t.json();return!n||typeof n!="object"||!("authenticated"in n)?"unavailable":n.authenticated===!0?"authenticated":n.authenticated===!1?"unpaired":"unavailable"}catch{return"unavailable"}}function y(a,i){const t=a.hash;return i.replaceState(null,"",`${a.pathname}${a.search}`),new URLSearchParams(t.startsWith("#")?t.slice(1):t).get("token")??""}async function j(a,i,t=fetch){try{return(await t("/api/auth/pair",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:a,clientName:i})})).ok?"paired":"rejected"}catch{return"unavailable"}}function k(a){const i=[[/Edg\//,"Edge"],[/Firefox\//,"Firefox"],[/OPR\//,"Opera"],[/Chrome\//,"Chrome"],[/Safari\//,"Safari"]].find(([n])=>n.test(a))?.[1]??"Browser",t=[[/Windows NT/,"Windows"],[/Android/,"Android"],[/(?:iPhone|iPod)/,"iPhone"],[/iPad/,"iPad"],[/CrOS/,"ChromeOS"],[/Macintosh|Mac OS X/,"Mac"],[/Linux/,"Linux"]].find(([n])=>n.test(a))?.[1];return t?`${i} on ${t}`:i}const N={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."};function O(){const[a,i]=o.useState(()=>y(window.location,window.history)),[t,n]=o.useState(()=>k(window.navigator.userAgent)),[c,m]=o.useState("idle"),[u,h]=o.useState("checking"),[p,f]=o.useState(0);o.useEffect(()=>{const r=new AbortController;let s=!0;const d=window.setTimeout(()=>r.abort(),1e4);return v(r.signal).then(l=>{s&&(l==="authenticated"&&window.location.replace("/"),h(l))}).finally(()=>window.clearTimeout(d)),()=>{s=!1,r.abort(),window.clearTimeout(d)}},[p]);const x=async r=>{r.preventDefault();const s=t.trim(),d=a.trim();if(!s||!d||s.length>64)return;m("pairing");const l=await j(d,s);l==="paired"?window.location.replace("/"):m(l)};return u!=="unpaired"?e.jsx("main",{className:"access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground",children:e.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[e.jsx("h1",{className:"text-lg font-semibold",children:u==="unavailable"?"Could not check this browser":"Checking this browser…"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",role:"status",children:u==="unavailable"?"Could not verify your saved session. Check your connection and try again.":"Checking your saved session before asking you to pair again."}),u==="unavailable"&&e.jsx(g,{className:"mt-5",onClick:()=>{h("checking"),f(r=>r+1)},children:"Try again"})]})}):e.jsx("main",{className:"access-page pairing-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground",children:e.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[e.jsx("h1",{className:"text-lg font-semibold",children:"Pair this browser"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Enter the one-use code shown by the ",b," desktop app or generated with the command below on the server. It expires after five minutes."]}),e.jsx(w,{}),e.jsxs("form",{className:"mt-5 grid gap-4",onSubmit:r=>{x(r)},children:[e.jsxs("label",{className:"grid gap-1.5 text-sm",htmlFor:"pairing-code",children:[e.jsx("span",{className:"font-medium",children:"Pairing code"}),e.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:a,onChange:r=>i(r.target.value),autoComplete:"off",spellCheck:!1,required:!0})]}),e.jsxs("label",{className:"grid gap-1.5 text-sm",htmlFor:"device-name",children:[e.jsx("span",{className:"font-medium",children:"Device name"}),e.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:t,onChange:r=>n(r.target.value),maxLength:64,autoComplete:"off",required:!0})]}),e.jsx(g,{type:"submit",disabled:c==="pairing"||!a.trim()||!t.trim(),children:c==="pairing"?"Pairing…":"Pair browser"})]}),(c==="rejected"||c==="unavailable")&&e.jsx("p",{className:"mt-4 text-sm text-destructive",role:"alert",children:N[c]}),e.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."}),e.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."})]})})}export{O as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as e}from"./react-rd22PHbN.js";import{u as b}from"./tanstack-B0Sf7wNU.js";import{q as S,B as m,T,a as q,b as w,o as D}from"./index-DAUK3rnz.js";import{J as P,K as R,L as $,N as z,P as E,l as H,k as K,Q as L}from"./App-BXZLGT86.js";import{D as B}from"./DiffWorkspace-RDG_Y70N.js";import{P as I}from"./PierreWorkerPool-Col4k7qz.js";import"./base-ui-CJ8ZIx3d.js";import"./platform-Bqt97_Jr.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";import"./EditContext-CvJWfVl1.js";import"./index-CtEztN1P.js";function Z({diff:n,prNumber:r,repositoryId:u,commits:l,diffView:g,themeType:j,wrapLines:v,onDiffViewChange:y,onWrapLinesChange:C,onClose:N}){const[o,p]=d.useState("all"),[x,k]=d.useState(l[0]?.oid??""),i=d.useMemo(()=>l.find(s=>s.oid===x)??l[0]??null,[l,x]),a=b({queryKey:S.pullRequestCommitDiff(u,i?.oid??""),queryFn:()=>D.github.getPullRequestCommitDiff(u,i.oid),enabled:o==="commit"&&i!==null}),h=a.error instanceof Error?a.error.message:a.error?"Could not load the commit diff.":null,t=e.jsxs("div",{className:"pr-code-scope",children:[e.jsxs("div",{className:"pr-code-mode",role:"group","aria-label":"Pull request code grouping",children:[e.jsx(m,{type:"button",variant:o==="all"?"secondary":"ghost",size:"xs","aria-pressed":o==="all",onClick:()=>p("all"),children:"All changes"}),e.jsx(m,{type:"button",variant:o==="commit"?"secondary":"ghost",size:"xs","aria-pressed":o==="commit",disabled:l.length===0,onClick:()=>p("commit"),children:"By commit"})]}),o==="commit"&&i&&e.jsxs(P,{value:i.oid,onValueChange:s=>{s&&k(s)},children:[e.jsxs(T,{children:[e.jsx(q,{render:e.jsx($,{className:"pr-commit-select",size:"sm","aria-label":"Commit"}),children:e.jsxs(R,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})}),e.jsxs(w,{children:[i.oid.slice(0,7)," · ",i.messageHeadline||"(no commit message)"]})]}),e.jsx(z,{align:"start",alignItemWithTrigger:!1,className:"pr-commit-menu",children:l.map(s=>e.jsxs(E,{value:s.oid,label:`${s.oid.slice(0,7)} ${s.messageHeadline||"(no commit message)"}`,children:[e.jsx("span",{className:"shrink-0 self-start font-mono text-xs text-muted-foreground",children:s.oid.slice(0,7)}),e.jsx("span",{className:"min-w-0 whitespace-normal break-words",children:s.messageHeadline||"(no commit message)"})]},s.oid))})]})]}),c=o==="all"?n:a.data??null;return o==="commit"&&h?e.jsxs(f,{scopeControl:t,children:[e.jsx("p",{className:"text-destructive",children:h}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>{a.refetch()},children:[e.jsx(H,{})," Try again"]})]}):c?c.patch?e.jsx(I,{children:e.jsx(B,{contentKey:o==="all"?`pull:${r}:all`:`pull:${r}:commit:${i?.oid??""}`,diff:c,diffView:g,themeType:j,wrapLines:v,initiallyCollapsed:!0,scopeControl:t,onDiffViewChange:y,onWrapLinesChange:C,onClose:N})}):e.jsx(f,{scopeControl:t,children:"No differences to show."}):e.jsxs(f,{scopeControl:t,children:[e.jsx(K,{className:"spinner"})," ",e.jsx(L,{text:"Loading commit diff…"})]})}function f({scopeControl:n,children:r}){return e.jsxs("div",{className:"diff-workspace",children:[e.jsx("div",{className:"diff-workspace-toolbar",children:e.jsx("div",{className:"diff-workspace-scope",children:n})}),e.jsx("div",{className:"viewer-message flex-col gap-3",children:r})]})}export{Z as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PullRequestDiff-DhKTXyIF.js","assets/react-rd22PHbN.js","assets/tanstack-B0Sf7wNU.js","assets/base-ui-CJ8ZIx3d.js","assets/index-DAUK3rnz.js","assets/index-BfA4tAc1.css","assets/App-BXZLGT86.js","assets/DiffWorkspace-RDG_Y70N.js","assets/PierreWorkerPool-Col4k7qz.js","assets/platform-Bqt97_Jr.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-CtEztN1P.js","assets/EditContext-CvJWfVl1.js","assets/render-markdown-BtCybfvQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as H,B as b,T as D,a as V,b as $,_ as q,o as g,q as w}from"./index-DAUK3rnz.js";import{r as u,j as e}from"./react-rd22PHbN.js";import{l as F,k as o,Q as d,a3 as O,a4 as B,B as y,u as k,h as M,v as Q,x as z,E as K,Z as U}from"./App-BXZLGT86.js";import{G as C,P as X,a as Z,b as J}from"./GitHubAvatar-CnBaloV0.js";import{u as T}from"./tanstack-B0Sf7wNU.js";import{V as W,a as Y,b as m}from"./viewer-tabs-D-T0xQaq.js";/* empty css */import"./base-ui-CJ8ZIx3d.js";const ee=[["path",{d:"M6.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M3 6v5.172a2 2 0 0 0 .586 1.414l7.71 7.71a2.41 2.41 0 0 0 3.408 0l5.592 -5.592a2.41 2.41 0 0 0 0 -3.408l-7.71 -7.71a2 2 0 0 0 -1.414 -.586h-5.172a3 3 0 0 0 -3 3",key:"svg-1"}]],se=H("outline","tag","Tag",ee),ae=u.lazy(()=>q(()=>import("./PullRequestDiff-DhKTXyIF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function ue({repositoryId:r,prNumber:i,diffView:t,themeType:_,wrapLines:L,onDiffViewChange:P,onWrapLinesChange:R,onClose:A,onSelectPullRequest:E}){const[h,I]=u.useState("summary"),l=T({queryKey:w.pullRequest(r,i),queryFn:async()=>{const a=await g.github.getPullRequest(r,i),S=a.body.trim()?await q(async()=>{const{renderMarkdown:c}=await import("./render-markdown-BtCybfvQ.js").then(G=>G.a);return{renderMarkdown:c}},__vite__mapDeps([14,6,4,1,2,3,5,10,11])).then(({renderMarkdown:c})=>c(a.body)).catch(()=>"<p>Could not render the description.</p>"):"";return{details:a,bodyHtml:S}}}),s=l.data?.details??null,p=l.data?.bodyHtml??"",x=l.error instanceof Error?l.error.message:l.error?"Could not load the pull request.":null,n=T({queryKey:w.pullRequestDiff(r,i),queryFn:()=>g.github.getPullRequestDiff(r,i),enabled:h==="diff"&&s!==null}),j=n.data??null,v=n.error instanceof Error?n.error.message:n.error?"Could not load the diff.":null;if(x)return e.jsxs("div",{className:"viewer-message flex-col gap-3",children:[e.jsx("p",{className:"text-destructive",children:x}),e.jsxs(b,{variant:"outline",size:"sm",onClick:()=>{l.refetch()},children:[e.jsx(F,{})," Try again"]})]});if(!s)return e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:`Loading pull request #${i}…`})]});const f=O(s),N=B(s.reviewDecision);return e.jsxs(W,{value:h,onValueChange:a=>I(a),className:"pr-viewer",children:[e.jsxs("header",{className:"pr-viewer-header",children:[e.jsxs("div",{className:"pr-viewer-overview",children:[e.jsxs("div",{className:"pr-viewer-title",children:[e.jsx(y,{variant:s.state==="OPEN"&&!s.isDraft?"default":"secondary",className:`pr-state-badge ${f.toLowerCase().replace(/\s+/g,"-")}`,children:f}),e.jsxs("h2",{children:[s.title||"(no title)"," ",e.jsxs("span",{className:"pr-number",children:["#",s.number]})]})]}),e.jsxs("div",{className:"pr-viewer-meta",children:[e.jsxs("span",{className:"pr-author-with-avatar",children:[e.jsx(C,{src:s.authorAvatarUrl,className:"pr-author-avatar"},s.authorAvatarUrl),e.jsx("span",{className:"pr-author",children:s.author})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{children:["updated ",e.jsx("time",{dateTime:s.updatedAt,children:k(s.updatedAt)})]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-branches",children:[e.jsx(M,{"aria-hidden":"true"})," ",s.headRefName," → ",s.baseRefName]}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsxs("span",{className:"pr-counters",children:[s.changedFiles," ",s.changedFiles===1?"file":"files"," ",e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]}),e.jsx(re,{state:s.checksState}),N&&e.jsx(y,{variant:"outline",className:"pr-review-badge",children:N}),s.stack&&e.jsx(X,{repositoryId:r,number:i,membership:s.stack,onSelect:E}),e.jsx("span",{className:"pr-viewer-actions",children:e.jsxs(b,{variant:"outline",size:"xs",onClick:()=>z(s.url),children:[e.jsx(Q,{})," Open on GitHub"]})})]}),s.labels.length>0&&e.jsxs("div",{className:"pr-labels","aria-label":"Pull request labels",children:[e.jsx(se,{"aria-hidden":"true"}),s.labels.map(a=>e.jsx("span",{className:"pr-label",style:{borderColor:`#${a.color}`,backgroundColor:`#${a.color}22`},children:a.name},`${a.name}-${a.color}`))]})]}),e.jsx(Y,{label:"Pull request view",className:"markdown-viewer-tabs pr-viewer-tabs",items:[{value:"summary",label:"Summary"},{value:"timeline",label:"Timeline"},{value:"diff",label:"Code"}]})]}),e.jsx(m,{value:"summary",className:"markdown-preview-scroll pr-description-scroll",children:e.jsx("section",{className:"pr-summary-section",children:p?e.jsx("div",{className:"markdown-prose",dangerouslySetInnerHTML:{__html:p}}):e.jsx("p",{className:"pr-empty-description",children:"This pull request has no description."})})}),e.jsx(m,{value:"timeline",className:"markdown-preview-scroll pr-description-scroll",children:e.jsxs("section",{className:"pr-timeline standalone","aria-label":"Commit timeline",children:[e.jsxs("h3",{children:[e.jsx(K,{"aria-hidden":"true"})," Commits ",e.jsx("span",{children:s.commits.length})]}),s.commits.length?s.commits.map(a=>e.jsxs("article",{className:"pr-timeline-item",children:[e.jsx("span",{className:"pr-timeline-rail",children:e.jsx("span",{})}),e.jsx(C,{src:a.authorAvatarUrl,className:"pr-commit-avatar"}),e.jsxs("span",{className:"pr-commit-content",children:[e.jsx("strong",{children:a.messageHeadline||"(no commit message)"}),e.jsxs("span",{children:[e.jsx("b",{children:a.author})," committed ",e.jsx("time",{dateTime:a.authoredAt,children:k(a.authoredAt)})]})]}),e.jsxs(D,{children:[e.jsx(V,{render:e.jsx("code",{}),children:a.oid.slice(0,7)}),e.jsx($,{children:a.oid})]})]},a.oid)):e.jsx("p",{className:"pr-empty-description",children:"No commits were returned by GitHub."})]})}),e.jsx(m,{value:"diff",className:"pr-diff-panel",children:v?e.jsx("div",{className:"viewer-message text-destructive",children:v}):j?e.jsx(u.Suspense,{fallback:e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:"Loading diff viewer…"})]}),children:e.jsx(ae,{diff:j,prNumber:s.number,repositoryId:r,commits:s.commits,diffView:t,themeType:_,wrapLines:L,onDiffViewChange:P,onWrapLinesChange:R,onClose:A})}):e.jsxs("div",{className:"viewer-message",children:[e.jsx(o,{className:"spinner"})," ",e.jsx(d,{text:"Loading diff…"})]})})]})}function re({state:r}){if(r==="NONE")return null;const i=r==="PASSING"?Z:r==="FAILING"?J:U,t=r==="PASSING"?"Checks passing":r==="FAILING"?"Checks failing":"Checks pending";return e.jsxs("span",{className:`pr-checks ${r.toLowerCase()}`,children:[e.jsx(i,{"aria-hidden":"true"})," ",t]})}export{ue as PullRequestViewer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as b}from"./react-rd22PHbN.js";import{k as h,Q as m,W as c,l as j,X as v,Y as p,p as k,v as I,x as P,Z as S}from"./App-BXZLGT86.js";import{I as G,G as R,P as w,a as y,b as L}from"./GitHubAvatar-CnBaloV0.js";import{a as O}from"./tanstack-B0Sf7wNU.js";import{c as E,B as t,I as N,T as o,a as u,b as d}from"./index-DAUK3rnz.js";import{C as q}from"./checkbox-BRH0ZNIC.js";import{P as D,b as z,c as T,d as $,e as H}from"./base-ui-CJ8ZIx3d.js";const A=[["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"}]],F=E("outline","filter","Filter",A);function Z(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(m,{text:"Checking repository…"})]}):s.info.isGitHub?s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(m,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(x,{icon:e.jsx(c,{}),title:"Sign in to GitHub CLI",children:["Run ",e.jsx("code",{children:"gh auth login"})," in a terminal to authenticate, then check again.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("gh auth login"),children:[e.jsx(N,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]})]}):e.jsx(M,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(x,{icon:e.jsx(c,{}),title:"GitHub CLI is required",children:["OpenTig uses your local ",e.jsx("code",{children:"gh"})," session to read and create pull requests. It does not copy or store credentials.",e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsxs(t,{variant:"outline",size:"sm",onClick:()=>s.onCopyCommand("winget install GitHub.cli"),children:[e.jsx(N,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(x,{icon:e.jsx(c,{}),title:"Not a GitHub repository",children:["The ",e.jsx("code",{children:"origin"})," remote does not point to github.com, so pull requests are unavailable here."]})}function M(s){const a=b.useRef(null),n=s.pulls,i=O({count:n?.length??0,getScrollElement:()=>a.current,estimateSize:()=>68,getItemKey:l=>n?.[l]?.number??l,overscan:8});return e.jsxs("div",{className:"pulls-view",children:[e.jsxs("div",{className:"pulls-toolbar",children:[e.jsxs(o,{children:[e.jsxs(u,{render:e.jsx("span",{className:"pulls-repo"}),children:[e.jsx(c,{"aria-hidden":"true"})," ",s.nameWithOwner]}),e.jsx(d,{children:s.nameWithOwner})]}),e.jsxs(o,{children:[e.jsx(u,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button",disabled:s.loading,onClick:s.onRefresh,"aria-label":"Refresh pull requests"}),children:s.loading?e.jsx(h,{className:"animate-spin"}):e.jsx(j,{})}),e.jsx(d,{children:"Refresh pull requests"})]}),e.jsxs(D,{children:[e.jsx(z,{render:e.jsx(t,{variant:f(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!f(s.states)}),children:e.jsx(F,{})}),e.jsx(T,{children:e.jsx($,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs(H,{className:"pulls-filter-popup",children:[e.jsx("span",{className:"pulls-filter-title",children:"State"}),["OPEN","CLOSED","MERGED"].map(l=>e.jsxs("label",{htmlFor:`pulls-state-${l.toLowerCase()}`,className:"pulls-filter-option",children:[e.jsx(q,{id:`pulls-state-${l.toLowerCase()}`,checked:s.states.includes(l),onCheckedChange:r=>s.onStateChange(l,r===!0)}),e.jsx(C,{state:l,className:l.toLowerCase()}),e.jsx("span",{children:l==="OPEN"?"Open":l==="CLOSED"?"Closed":"Merged"})]},l))]})})})]}),e.jsxs(o,{children:[e.jsxs(u,{render:e.jsx(t,{variant:"outline",size:"xs",disabled:!!s.createDisabledReason||s.loading,onClick:s.onCreate,"aria-label":"Create pull request"}),children:[e.jsx(v,{})," New"]}),e.jsx(d,{children:s.createDisabledReason??"Create a pull request from the current branch"})]})]}),s.error&&e.jsxs("div",{className:"pulls-error",role:"alert",children:[e.jsx("span",{children:s.error}),e.jsx(t,{variant:"ghost",size:"xs",onClick:s.onRefresh,children:"Retry"})]}),e.jsx("div",{ref:a,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:n===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(m,{text:"Loading pull requests…"})]}):n!==null&&n.length===0?e.jsx("p",{className:"empty-list",children:s.states.length?`No ${s.states.map(l=>g(l).toLowerCase()).join(", ")} pull requests.`:"Select at least one PR state."}):n!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(l=>{const r=n[l.index];return e.jsx("div",{ref:i.measureElement,"data-index":l.index,className:"virtual-row",style:{transform:`translateY(${l.start}px)`},children:e.jsx(W,{repositoryId:s.repositoryId,pr:r,active:s.activeNumber===r.number,onSelect:s.onSelect})},l.key)})})})]})}function W({repositoryId:s,pr:a,active:n,onSelect:i}){const l=a.state.toLowerCase();return e.jsxs("div",{className:`pull-item ${n?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>i(a.number),"aria-label":`View pull request #${a.number}`,children:[e.jsx("span",{className:`pull-state-icon ${l}${a.isDraft?" draft":""}`,"aria-label":a.isDraft?"Draft":g(a.state),children:e.jsx(C,{state:a.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:a.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",a.number]}),e.jsx(R,{src:a.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:a.author}),e.jsx(B,{state:a.checksState}),a.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[e.jsx("time",{dateTime:a.updatedAt,children:k(a.updatedAt)}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",a.additions]})," ",e.jsxs("span",{className:"del",children:["−",a.deletions]})]})]})]}),a.stack&&e.jsx(w,{repositoryId:s,number:a.number,membership:a.stack,onSelect:i}),e.jsxs(o,{children:[e.jsx(u,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>P(a.url),"aria-label":`Open #${a.number} on GitHub`}),children:e.jsx(I,{})}),e.jsx(d,{children:"Open on GitHub"})]})]})}function C({state:s,className:a}){return s==="MERGED"?e.jsx(G,{"aria-hidden":"true",className:a}):e.jsx(p,{"aria-hidden":"true",className:a})}function B({state:s}){if(s==="NONE")return null;const a=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",n=s==="PASSING"?y:s==="FAILING"?L:S;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":a,children:e.jsx(n,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function f(s){return s.length===1&&s[0]==="OPEN"}function x({icon:s,title:a,children:n}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:a}),e.jsx("p",{children:n})]})}export{Z as PullRequestsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as e}from"./react-rd22PHbN.js";import{a5 as pe,ai as A,a9 as P,j as fe,Q as Y,k as me}from"./App-BXZLGT86.js";import{u as xe,a as ve}from"./tanstack-B0Sf7wNU.js";import{c as x,B as k,T as W,a as D,b as O,s as m,o as J,q as je}from"./index-DAUK3rnz.js";import"./base-ui-CJ8ZIx3d.js";const ye=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],X=x("outline","eye-off","EyeOff",ye);const ke=[["path",{d:"M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0 -7 0",key:"svg-0"}],["path",{d:"M3 19v-10.5a3.5 3.5 0 0 1 7 0v10.5",key:"svg-1"}],["path",{d:"M3 13h7",key:"svg-2"}],["path",{d:"M21 12v7",key:"svg-3"}]],Me=x("outline","letter-case","LetterCase",ke);const Ne=[["path",{d:"M6.5 15a2.5 2.5 0 1 1 0 5a2.5 2.5 0 0 1 0 -5",key:"svg-0"}],["path",{d:"M17 7.875l3 -1.687",key:"svg-1"}],["path",{d:"M17 7.875v3.375",key:"svg-2"}],["path",{d:"M17 7.875l-3 -1.687",key:"svg-3"}],["path",{d:"M17 7.875l3 1.688",key:"svg-4"}],["path",{d:"M17 4.5v3.375",key:"svg-5"}],["path",{d:"M17 7.875l-3 1.688",key:"svg-6"}]],be=x("outline","regex","Regex",Ne);const we=[["path",{d:"M3 4a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M15 16a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-1"}],["path",{d:"M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3",key:"svg-2"}],["path",{d:"M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3",key:"svg-3"}]],Z=x("outline","replace","Replace",we);const Se=[["path",{d:"M4 6l10 0",key:"svg-0"}],["path",{d:"M4 18l10 0",key:"svg-1"}],["path",{d:"M4 12h17l-3 -3m0 6l3 -3",key:"svg-2"}]],$e=x("outline","text-wrap-disabled","TextWrapDisabled",Se);const Re=[["path",{d:"M8 2h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-0"}],["path",{d:"M20 14h-4a2 2 0 0 0 -2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2 -2v-4a2 2 0 0 0 -2 -2z",key:"svg-1"}],["path",{d:"M16.707 2.293a1 1 0 0 1 .083 1.32l-.083 .094l-1.293 1.293h3.586a3 3 0 0 1 2.995 2.824l.005 .176v3a1 1 0 0 1 -1.993 .117l-.007 -.117v-3a1 1 0 0 0 -.883 -.993l-.117 -.007h-3.585l1.292 1.293a1 1 0 0 1 -1.32 1.497l-.094 -.083l-3 -3a.98 .98 0 0 1 -.28 -.872l.036 -.146l.04 -.104c.058 -.126 .14 -.24 .245 -.334l2.959 -2.958a1 1 0 0 1 1.414 0z",key:"svg-2"}],["path",{d:"M3 12a1 1 0 0 1 .993 .883l.007 .117v3a1 1 0 0 0 .883 .993l.117 .007h3.585l-1.292 -1.293a1 1 0 0 1 -.083 -1.32l.083 -.094a1 1 0 0 1 1.32 -.083l.094 .083l3 3a.98 .98 0 0 1 .28 .872l-.036 .146l-.04 .104a1.02 1.02 0 0 1 -.245 .334l-2.959 2.958a1 1 0 0 1 -1.497 -1.32l.083 -.094l1.291 -1.293h-3.584a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-3a1 1 0 0 1 1 -1z",key:"svg-3"}]],ee=x("filled","replace-filled","ReplaceFilled",Re);function Ce(l){return l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ie(l){if(!l.query)return null;const c=l.regex?l.query:Ce(l.query),i=l.wholeWord?`\\b(?:${c})\\b`:c;try{return new RegExp(i,l.matchCase?"g":"gi")}catch{return null}}const Te=250,Ee=28,_e=24;function He({repositoryId:l,active:c,revision:i,onOpenFile:h,unsavedPathsAmong:g,onReplaced:o}){const B=pe(),[f,ae]=t.useState(""),[M,se]=t.useState(!1),[N,te]=t.useState(!1),[b,le]=t.useState(!1),[p,ne]=t.useState(!1),[H,re]=t.useState(""),[w,ce]=t.useState(!1),[S,ie]=t.useState(!1),[$,Q]=t.useState(!1),[oe,he]=t.useState(0),[L,G]=t.useState(()=>new Set),K=t.useRef(null),V=t.useRef(null),R=t.useMemo(()=>({query:f,matchCase:M,wholeWord:N,regex:b,includeIgnored:w}),[f,M,N,b,w]),de=t.useMemo(()=>Ie(R),[R]),v=f.trim(),C=ze(v,Te),d=xe({queryKey:je.search(l,{query:C,matchCase:M,wholeWord:N,regex:b,includeIgnored:w,revision:i,replaceRevision:oe}),queryFn:()=>J.repository.search(l,{...R,query:C}),enabled:c&&C.length>0,placeholderData:(a,s)=>s?.queryKey[1]===l?a:void 0}),n=v?d.data??null:null,z=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&K.current?.focus()},[c]),t.useEffect(()=>{d.data&&G(new Set(d.data.files.filter(a=>a.ignored).map(a=>a.path)))},[d.data]);const I=t.useMemo(()=>{if(!n)return[];const a=[];for(const s of n.files){const u=!L.has(s.path);if(a.push({kind:"file",file:s,open:u}),u)for(const E of s.matches)a.push({kind:"match",file:s,match:E})}return a},[L,n]),T=ve({count:I.length,getScrollElement:()=>V.current,estimateSize:a=>B?44:I[a]?.kind==="file"?Ee:_e,getItemKey:a=>{const s=I[a];return s?s.kind==="file"?`file:${s.file.path}`:`match:${s.file.path}:${s.match.line}:${s.match.column??1}`:a},overscan:12});t.useEffect(()=>{T.measure()},[T,B]);const ue=a=>G(s=>{const u=new Set(s);return u.delete(a)||u.add(a),u}),j=n?.files.filter(a=>a.ignored).length??0,y=n?.files.filter(a=>!!a.revision&&(S||!a.ignored))??[],q=async a=>{if(!n||$)return;const s=a==="all"?{kind:"all",files:y.map(r=>({path:r.path,revision:r.revision}))}:"match"in a?{kind:"match",path:a.file.path,revision:a.file.revision,line:a.match.line,column:a.match.column}:{kind:"file",path:a.path,revision:a.revision};if(s.kind==="all"){if(n.truncated){m.info({title:"Narrow the search before replacing all",description:"The current result set is truncated."});return}const r=y.reduce((F,ge)=>F+ge.matches.length,0);if(!r||!window.confirm(`Replace ${r} ${r===1?"occurrence":"occurrences"} in ${y.length} ${y.length===1?"file":"files"}?`))return}else if(s.kind==="file"&&a!=="all"&&!("match"in a)&&a.truncatedMatches&&!window.confirm(`${a.path} has more matches than the ${a.matches.length} listed. Replace every occurrence in the file?`))return;const u=s.kind==="all"?s.files.map(r=>r.path):[s.path],E=g(u);if(E.length>0){m.error({title:"Save open files before replacing in them",description:E.join(", "),duration:1e4});return}Q(!0);try{const r=await J.repository.replaceSearch(l,{options:{...R,query:f.trim()},replacement:H,scope:s});r.status==="stale"?m.error({title:"Files changed before replacement",description:"Search results were refreshed without overwriting anything."}):r.status==="no-match"?m.info({title:"No matching text to replace"}):(m.success({title:`Replaced ${r.replacements} ${r.replacements===1?"occurrence":"occurrences"}`,description:`${r.files.length} ${r.files.length===1?"file":"files"} changed`}),o(r.files)),he(F=>F+1)}catch(r){m.error({title:"Could not replace search results",description:r instanceof Error?r.message:"Unknown error",duration:1e4})}finally{Q(!1)}};return e.jsxs("div",{className:"search-view",children:[e.jsxs("div",{className:"search-controls",children:[e.jsxs("div",{className:"search-query-row",children:[e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-toggle","aria-label":p?"Hide replace":"Show replace","aria-expanded":p,onClick:()=>ne(a=>!a),children:p?e.jsx(A,{}):e.jsx(P,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:K,type:"text",value:f,spellCheck:!1,placeholder:"Search in repository","aria-label":"Search in repository",onChange:a=>ae(a.target.value)}),e.jsxs("span",{className:"search-toggles",children:[e.jsx(_,{label:"Match case",active:M,onToggle:()=>se(a=>!a),children:e.jsx(Me,{})}),e.jsx(_,{label:"Match whole word",active:N,onToggle:()=>te(a=>!a),children:e.jsx($e,{})}),e.jsx(_,{label:"Use regular expression",active:b,onToggle:()=>le(a=>!a),children:e.jsx(be,{})}),e.jsx(_,{label:"Search Git-ignored files",active:w,onToggle:()=>ce(a=>!a),children:e.jsx(X,{})})]})]})]}),p&&e.jsxs("div",{className:"search-replace-row",children:[e.jsx(Z,{"aria-hidden":"true"}),e.jsx("input",{value:H,spellCheck:!1,placeholder:"Replace","aria-label":"Replace with",onChange:a=>re(a.target.value)}),e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",disabled:$||y.length===0||!!n?.truncated,"aria-label":"Replace all search results",onClick:()=>{q("all")}}),children:e.jsx(ee,{})}),e.jsx(O,{children:n?.truncated?"Narrow the search to replace all":"Replace all"})]})]}),p&&j>0&&e.jsxs("label",{className:"search-include-ignored",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:a=>ie(a.target.checked)})," Include ignored files when replacing"]}),f.trim()!==""&&(n!==null||!z)&&e.jsx("div",{className:"search-summary",children:z?e.jsx(Y,{text:"Searching…"}):U?e.jsx("span",{className:"search-error",children:U}):n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n.totalMatches===0?"No results":`${n.totalMatches-n.ignoredMatches}${n.truncated?"+":""} ${n.totalMatches-n.ignoredMatches===1?"result":"results"} in ${n.files.length-j} ${n.files.length-j===1?"file":"files"}`}),n.ignoredMatches>0&&e.jsxs("span",{className:"search-summary-ignored",children:["· ",n.ignoredMatches," in ",j," ignored ",j===1?"file":"files"]})]})})]}),e.jsxs("div",{ref:V,className:"search-results",children:[z&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(Y,{text:"Searching…"})]}),e.jsx("div",{className:"search-rows virtual-list",style:{height:T.getTotalSize()},children:T.getVirtualItems().map(a=>{const s=I[a.index];return s?e.jsx("div",{className:"virtual-row",style:{height:a.size,transform:`translateY(${a.start}px)`},children:s.kind==="file"?e.jsxs("div",{className:`search-file-heading ${s.file.ignored?"ignored":""}`,children:[e.jsxs("button",{className:"search-file-toggle",onClick:()=>ue(s.file.path),"aria-expanded":s.open,children:[s.open?e.jsx(A,{}):e.jsx(P,{}),e.jsx("span",{className:"search-file-name",children:s.file.path}),s.file.ignored&&e.jsxs(W,{children:[e.jsx(D,{render:e.jsx("span",{className:"search-file-ignored-badge"}),children:e.jsx(X,{})}),e.jsx(O,{children:"Ignored by Git"})]}),e.jsx("span",{className:"search-file-count",children:s.file.matches.length})]}),p&&s.file.revision&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace all in ${s.file.path}`,onClick:()=>{q(s.file)},children:e.jsx(ee,{})})]}):e.jsxs("div",{className:"search-match",children:[e.jsxs("button",{className:"search-match-open",onClick:()=>h(s.file.path),children:[e.jsxs("span",{className:"search-match-line",children:[s.match.line,":",s.match.column??1]}),e.jsx("span",{className:"search-match-text",children:qe(s.match.text,de)})]}),p&&s.file.revision&&s.match.column&&(!s.file.ignored||S)&&e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-replace-action",disabled:$,"aria-label":`Replace match on line ${s.match.line}`,onClick:()=>{q({file:s.file,match:s.match})},children:e.jsx(Z,{})})]})},a.key):null})})]})]})}function ze(l,c){const[i,h]=t.useState(l);return t.useEffect(()=>{const g=window.setTimeout(()=>h(l),c);return()=>window.clearTimeout(g)},[c,l]),i}function _({label:l,active:c,onToggle:i,children:h}){return e.jsxs(W,{children:[e.jsx(D,{render:e.jsx(k,{variant:"ghost",size:"icon-xs",className:"search-toggle","aria-label":l,"aria-pressed":c,onClick:i}),children:h}),e.jsx(O,{children:l})]})}function qe(l,c){const i=l.replace(/^\s+/,"");if(!c)return i;c.lastIndex=0;const h=[];let g=0;for(let o=c.exec(i);o!==null;o=c.exec(i)){if(o[0]===""){c.lastIndex+=1;continue}h.push(e.jsx(t.Fragment,{children:i.slice(g,o.index)},`${o.index}-plain`),e.jsx("mark",{children:o[0]},`${o.index}-hit`)),g=o.index+o[0].length}return h.length===0?i:(h.push(e.jsx(t.Fragment,{children:i.slice(g)},"tail")),h)}export{He as SearchView};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as u,j as e}from"./react-rd22PHbN.js";import{M as Os,i as fe,u as ns,g as as,h as Ps,j as Ls,L as Fs,k as _s,l as zs,p as Ds,c as $,d as B,B as v,o as oe,s as M,T as _,a as z,b as D,I as Le,w as Fe,m as _e}from"./index-DAUK3rnz.js";import{ai as Bs,aO as ae,D as Y,c as X,d as J,e as Z,k as ee,l as ce,C as Ne,g as Q,I as Ce,Q as Se,B as ie,u as me,aP as is,F as ze,i as Us,J as Me,L as Ee,K as Ae,N as Re,P as le,aQ as De,aR as Be,aS as Ue,A as Hs,aT as Vs,aU as xe,aV as He,aa as rs,aW as ls,aX as os,aY as Gs,aZ as Ve,a_ as Ws,a$ as Ks,m as Ie,b0 as qs,b1 as Ys,b2 as Xs,a0 as Js,S as Zs,b3 as Qs}from"./App-BXZLGT86.js";import{r as et,s as st,t as tt,u as nt,v as at}from"./base-ui-CJ8ZIx3d.js";import{b as cs,t as ds,c as hs,r as us,d as gs}from"./tanstack-B0Sf7wNU.js";import{I as it}from"./IconEdit-Cg8S2wqW.js";function Ge(s,t){if(typeof s=="function")return s(t);s!=null&&(s.current=t)}function rt(...s){return t=>{let n=!1;const a=s.map(i=>{const r=Ge(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<a.length;i++){const r=a[i];typeof r=="function"?r():Ge(s[i],null)}}}}function lt(...s){return u.useCallback(rt(...s),s)}class ot extends u.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(fe(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=n.offsetParent,i=fe(a)&&a.offsetWidth||0,r=fe(a)&&a.offsetHeight||0,l=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(l.height),c.width=parseFloat(l.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=i-c.width-c.left,c.bottom=r-c.height-c.top,c.direction=l.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function ct({children:s,isPresent:t,anchorX:n,anchorY:a,root:i,pop:r}){const l=u.useId(),c=u.useRef(null),d=u.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:p}=u.useContext(Os),h=r!==!1?s.props?.ref??s?.ref:void 0,m=lt(c,h);return u.useInsertionEffect(()=>{const{width:o,height:x,top:f,left:b,right:y,bottom:E,direction:P}=d.current;if(t||r===!1||!c.current||!o||!x)return;const w=P==="rtl",C=n==="left"?w?`right: ${y}`:`left: ${b}`:w?`left: ${b}`:`right: ${y}`,S=a==="bottom"?`bottom: ${E}`:`top: ${f}`;c.current.dataset.motionPopId=l;const A=document.createElement("style");p&&(A.nonce=p);const O=i??document.head;return O.appendChild(A),A.sheet&&A.sheet.insertRule(`
|
|
2
|
-
[data-motion-pop-id="${l}"] {
|
|
3
|
-
position: absolute !important;
|
|
4
|
-
width: ${o}px !important;
|
|
5
|
-
height: ${x}px !important;
|
|
6
|
-
${C}px !important;
|
|
7
|
-
${S}px !important;
|
|
8
|
-
}
|
|
9
|
-
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),O.contains(A)&&O.removeChild(A)}},[t]),e.jsx(ot,{isPresent:t,childRef:c,sizeRef:d,pop:r,children:r===!1?s:u.cloneElement(s,{ref:m})})}const dt=({children:s,initial:t,isPresent:n,onExitComplete:a,custom:i,presenceAffectsLayout:r,mode:l,anchorX:c,anchorY:d,root:p})=>{const h=ns(ht),m=u.useId(),o=u.useRef(n),x=u.useRef(a);as(()=>{o.current=n,x.current=a});let f=!0,b=u.useMemo(()=>(f=!1,{id:m,initial:t,isPresent:n,custom:i,onExitComplete:y=>{h.set(y,!0);for(const E of h.values())if(!E)return;a&&a()},register:y=>(h.set(y,!1),()=>{h.delete(y),!o.current&&!h.size&&x.current?.()})}),[n,h,a]);return r&&f&&(b={...b}),u.useMemo(()=>{h.forEach((y,E)=>h.set(E,!1))},[n]),u.useEffect(()=>{!n&&!h.size&&a&&a()},[n]),s=e.jsx(ct,{pop:l==="popLayout",isPresent:n,anchorX:c,anchorY:d,root:p,children:s}),e.jsx(Ps.Provider,{value:b,children:s})};function ht(){return new Map}const de=s=>s.key||"";function We(s){const t=[];return u.Children.forEach(s,n=>{u.isValidElement(n)&&t.push(n)}),t}const Ke=({children:s,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:r="sync",propagate:l=!1,anchorX:c="left",anchorY:d="top",root:p})=>{const[h,m]=Ls(l),o=u.useMemo(()=>We(s),[s]),x=l&&!h?[]:o.map(de),f=u.useRef(!0),b=u.useRef(o),y=ns(()=>new Map),E=u.useRef(new Set),[P,w]=u.useState(o),[C,S]=u.useState(o);as(()=>{f.current=!1,b.current=o;for(let R=0;R<C.length;R++){const N=de(C[R]);x.includes(N)?(y.delete(N),E.current.delete(N)):y.get(N)!==!0&&y.set(N,!1)}},[C,x.length,x.join("-")]);const A=[];if(o!==P){let R=[...o];for(let N=0;N<C.length;N++){const L=C[N],K=de(L);x.includes(K)||(R.splice(N,0,L),A.push(L))}return r==="wait"&&A.length&&(R=A),S(We(R)),w(o),null}const{forceRender:O}=u.useContext(Fs);return e.jsx(e.Fragment,{children:C.map(R=>{const N=de(R),L=l&&!h?!1:o===C||x.includes(N),K=()=>{if(E.current.has(N))return;if(y.has(N))E.current.add(N),y.set(N,!0);else return;let j=!0;y.forEach(k=>{k||(j=!1)}),j&&(O?.(),S(b.current),l&&m?.(),a&&a())};return e.jsx(dt,{isPresent:L,initial:!f.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:r,root:p,onExitComplete:L?void 0:K,anchorX:c,anchorY:d,children:R},N)})})};function ut(){!_s.current&&zs();const[s]=u.useState(Ds.current);return s}const gt=[["path",{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M6 4v4",key:"svg-1"}],["path",{d:"M6 12v8",key:"svg-2"}],["path",{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-3"}],["path",{d:"M12 4v10",key:"svg-4"}],["path",{d:"M12 18v2",key:"svg-5"}],["path",{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M18 4v1",key:"svg-7"}],["path",{d:"M18 9v11",key:"svg-8"}]],mt=$("outline","adjustments","Adjustments",gt);const pt=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],ms=$("outline","arrows-sort","ArrowsSort",pt);const ft=[["path",{d:"M4 8h16",key:"svg-0"}],["path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12",key:"svg-1"}],["path",{d:"M8 4v4",key:"svg-2"}]],xt=$("outline","browser","Browser",ft);const jt=[["path",{d:"M2 8a2 2 0 0 1 2 -2h16a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-16a2 2 0 0 1 -2 -2l0 -8",key:"svg-0"}],["path",{d:"M6 10l0 .01",key:"svg-1"}],["path",{d:"M10 10l0 .01",key:"svg-2"}],["path",{d:"M14 10l0 .01",key:"svg-3"}],["path",{d:"M18 10l0 .01",key:"svg-4"}],["path",{d:"M6 14l0 .01",key:"svg-5"}],["path",{d:"M18 14l0 .01",key:"svg-6"}],["path",{d:"M10 14l4 .01",key:"svg-7"}]],bt=$("outline","keyboard","Keyboard",jt);const vt=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],yt=$("outline","link","Link",vt);const wt=[["path",{d:"M9 6l11 0",key:"svg-0"}],["path",{d:"M9 12l11 0",key:"svg-1"}],["path",{d:"M9 18l11 0",key:"svg-2"}],["path",{d:"M5 6l0 .01",key:"svg-3"}],["path",{d:"M5 12l0 .01",key:"svg-4"}],["path",{d:"M5 18l0 .01",key:"svg-5"}]],kt=$("outline","list","List",wt);const Nt=[["path",{d:"M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008",key:"svg-0"}]],Ct=$("outline","moon","Moon",Nt);const St=[["path",{d:"M6 9a6 6 0 1 0 12 0a6 6 0 0 0 -12 0",key:"svg-0"}],["path",{d:"M12 3c1.333 .333 2 2.333 2 6s-.667 5.667 -2 6",key:"svg-1"}],["path",{d:"M12 3c-1.333 .333 -2 2.333 -2 6s.667 5.667 2 6",key:"svg-2"}],["path",{d:"M6 9h12",key:"svg-3"}],["path",{d:"M3 20h7",key:"svg-4"}],["path",{d:"M14 20h7",key:"svg-5"}],["path",{d:"M10 20a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M12 15v3",key:"svg-7"}]],Mt=$("outline","network","Network",St);const Et=[["path",{d:"M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-0"}],["path",{d:"M7 17l0 .01",key:"svg-1"}],["path",{d:"M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-2"}],["path",{d:"M7 7l0 .01",key:"svg-3"}],["path",{d:"M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4",key:"svg-4"}],["path",{d:"M17 7l0 .01",key:"svg-5"}],["path",{d:"M14 14l3 0",key:"svg-6"}],["path",{d:"M20 14l0 .01",key:"svg-7"}],["path",{d:"M14 14l0 3",key:"svg-8"}],["path",{d:"M14 20l3 0",key:"svg-9"}],["path",{d:"M17 17l3 0",key:"svg-10"}],["path",{d:"M20 17l0 3",key:"svg-11"}]],At=$("outline","qrcode","Qrcode",Et);const Rt=[["path",{d:"M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3",key:"svg-0"}],["path",{d:"M11 11a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M12 12l0 2.5",key:"svg-2"}]],qe=$("outline","shield-lock","ShieldLock",Rt);const It=[["path",{d:"M4 6l7 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l9 0",key:"svg-2"}],["path",{d:"M15 9l3 -3l3 3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],ps=$("outline","sort-ascending","SortAscending",It);const Tt=[["path",{d:"M4 6l9 0",key:"svg-0"}],["path",{d:"M4 12l7 0",key:"svg-1"}],["path",{d:"M4 18l7 0",key:"svg-2"}],["path",{d:"M15 15l3 3l3 -3",key:"svg-3"}],["path",{d:"M18 6l0 12",key:"svg-4"}]],fs=$("outline","sort-descending","SortDescending",Tt);const $t=[["path",{d:"M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",key:"svg-0"}]],xs=$("outline","sparkles","Sparkles",$t);const Ot=[["path",{d:"M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0",key:"svg-0"}],["path",{d:"M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7",key:"svg-1"}]],js=$("outline","sun","Sun",Ot);const Pt=[["path",{d:"M4 20l3 0",key:"svg-0"}],["path",{d:"M14 20l7 0",key:"svg-1"}],["path",{d:"M6.9 15l6.9 0",key:"svg-2"}],["path",{d:"M10.2 6.3l5.8 13.7",key:"svg-3"}],["path",{d:"M5 20l6 -16l2 0l7 16",key:"svg-4"}]],Lt=$("outline","typography","Typography",Pt);function Ft({className:s,...t}){return e.jsx(et,{"data-slot":"accordion",className:B("w-full overflow-hidden rounded-xl border border-border",s),...t})}function _t({className:s,...t}){return e.jsx(st,{"data-slot":"accordion-item",className:B("not-last:border-b",s),...t})}function zt({className:s,children:t,...n}){return e.jsx(tt,{className:"flex",children:e.jsxs(nt,{"data-slot":"accordion-trigger",className:B("group flex flex-1 items-center justify-between gap-4 rounded-lg p-4 text-left text-xs font-semibold outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring aria-disabled:pointer-events-none aria-disabled:opacity-50",s),...n,children:[t,e.jsx(Bs,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-transform group-aria-expanded:rotate-180 motion-reduce:transition-none"})]})})}function Dt({className:s,children:t,...n}){return e.jsx(at,{"data-slot":"accordion-content",className:"accordion-content",...n,children:e.jsx("div",{className:B("px-4 pb-4",s),children:t})})}function Bt({harness:s,preferences:t,status:n,onPreference:a}){const i=t.aiExecutablePaths[s]??"",[r,l]=u.useState(i),[c,d]=u.useState(!1),p=async h=>{d(!0);try{await a({aiExecutablePaths:{...t.aiExecutablePaths,[s]:h}})!==!1&&l(h)}finally{d(!1)}};return e.jsx(Ft,{className:"ai-executable-settings",children:e.jsxs(_t,{value:"cli-detection",children:[e.jsx(zt,{className:"ai-executable-trigger",children:e.jsxs("span",{className:"ai-executable-heading",children:[e.jsx(mt,{"aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Advanced CLI detection"}),e.jsx("small",{children:"Executable path and diagnostics"})]})]})}),e.jsx(Dt,{className:"ai-executable-content",children:e.jsxs("div",{className:"settings-field",children:[e.jsxs("label",{className:"settings-field-label",htmlFor:"ai-executable-path",children:[e.jsxs("strong",{children:[ae(s)," executable"]}),e.jsx("span",{children:"Leave on Automatic, or enter an absolute executable path without arguments. For web access, use a path on the server."})]}),e.jsxs("div",{className:"ai-executable-editor",children:[e.jsx("input",{className:"ai-executable-input",id:"ai-executable-path",value:r,onChange:h=>l(h.target.value),placeholder:"Automatic",maxLength:4096,spellCheck:!1,autoComplete:"off",disabled:c}),e.jsxs("div",{className:"ai-executable-actions",children:[e.jsx(v,{size:"sm",onClick:()=>{p(r)},disabled:c||r===i,children:"Save path"}),e.jsx(v,{size:"sm",variant:"outline",onClick:()=>{p("")},disabled:c||!i&&!r,children:"Reset to Automatic"})]})]}),n?.executablePath&&e.jsxs("div",{className:"ai-executable-diagnostic",children:[e.jsx("strong",{children:"Detected executable"}),e.jsx("code",{children:n.executablePath}),e.jsxs("span",{children:["Source: ",Ut(n.executableSource)]})]}),n?.discoveryWarning&&e.jsx("p",{className:"ai-login-hint",children:n.discoveryWarning})]})})]})})}function Ut(s){return s==="configured"?"Configured path":s==="process-path"?"Inherited PATH":s==="user-path"?"Refreshed user PATH":"Known installation location"}function bs({className:s,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full",children:e.jsx("table",{"data-slot":"table",className:B("w-full caption-bottom text-xs",s),...t})})}function vs({className:s,...t}){return e.jsx("thead",{"data-slot":"table-header",className:B("[&_tr]:border-b",s),...t})}function ys({className:s,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:B("[&_tr:last-child]:border-0",s),...t})}function pe({className:s,...t}){return e.jsx("tr",{"data-slot":"table-row",className:B("border-b border-border transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted",s),...t})}function ws({className:s,...t}){return e.jsx("th",{"data-slot":"table-head",className:B("h-8 whitespace-nowrap px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...t})}function ks({className:s,...t}){return e.jsx("td",{"data-slot":"table-cell",className:B("px-2 py-1.5 align-middle [&:has([role=checkbox])]:pr-0",s),...t})}const Ht={"commit-message":"commit message","pull-request-draft":"pull request draft"};function V({column:s,label:t}){const n=s.getIsSorted();return e.jsxs("button",{type:"button",className:"ai-log-sort-button",onClick:()=>s.toggleSorting(n==="asc"),children:[t,n==="asc"&&e.jsx(ps,{size:13}),n==="desc"&&e.jsx(fs,{size:13}),!n&&e.jsx(ms,{size:13,className:"ai-log-sort-idle"})]})}const Vt=ds({rowSortingFeature:us,sortedRowModel:gs()}),F=hs(),Gt=F.columns([F.accessor("status",{header:({column:s})=>e.jsx(V,{column:s,label:"Status"}),cell:({getValue:s})=>{const t=s();return e.jsx(ie,{variant:t==="success"?"secondary":t==="cancelled"?"outline":"destructive",children:t})}}),F.accessor("harness",{header:({column:s})=>e.jsx(V,{column:s,label:"Harness"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),F.accessor("model",{header:({column:s})=>e.jsx(V,{column:s,label:"Model"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})}),F.accessor("operation",{header:({column:s})=>e.jsx(V,{column:s,label:"Task"}),cell:({getValue:s})=>Ht[s()]}),F.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(V,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:me(s.original.at,{seconds:!0})})}),F.accessor("durationMs",{header:({column:s})=>e.jsx(V,{column:s,label:"Duration"}),cell:({getValue:s})=>`${(s()/1e3).toFixed(1)}s`}),F.accessor(s=>(s.usage.inputTokens??0)+(s.usage.outputTokens??0),{id:"usage",header:({column:s})=>e.jsx(V,{column:s,label:"Usage"}),cell:({row:s})=>qt(s.original)}),F.accessor("stagedFileCount",{header:({column:s})=>e.jsx(V,{column:s,label:"Staged"}),cell:({getValue:s})=>s()??"—"}),F.display({id:"notes",header:"Notes",cell:({row:s})=>{const t=s.original,n=[];return t.errorCode&&n.push({key:"error",text:t.errorCode,tone:"error"}),t.errorMessage&&n.push({key:"error-message",text:t.errorMessage,tone:"error",detail:t.errorMessage}),t.splitOffered===!0&&n.push({key:"split",text:`split: ${t.splitGroups} commits`}),t.splitRejectedReason&&n.push({key:"rejected",text:`split refused: ${t.splitRejectedReason}`,tone:"warn",detail:t.splitRejectedReason}),t.splitBlockedReason&&n.push({key:"blocked",text:`no split: ${t.splitBlockedReason}`,detail:t.splitBlockedReason}),t.contextTruncated===!0&&n.push({key:"truncated",text:"context trimmed"}),n.length===0?null:e.jsx("div",{className:"ai-log-row-notes",children:n.map(a=>e.jsx(Kt,{text:a.text,tone:a.tone,detail:a.detail},a.key))})}})]);function Wt({open:s,onOpenChange:t}){const[n,a]=u.useState([]),[i,r]=u.useState(!1),[l,c]=u.useState([]),d=u.useCallback(async()=>{r(!0);try{a(await oe.ai.log())}catch(o){M.error({title:"Could not read the AI history",description:Xe(o)})}finally{r(!1)}},[]);u.useEffect(()=>{s&&d()},[d,s]);const p=u.useMemo(()=>{const o=n.filter(x=>x.status==="failed").length;return{runs:n.length,failed:o,tokens:n.reduce((x,f)=>x+(f.usage.inputTokens??0)+(f.usage.outputTokens??0),0),cost:n.reduce((x,f)=>x+(f.usage.costUsd??0),0),costed:n.filter(x=>x.usage.costUsd!==null).length}},[n]),h=cs({features:Vt,data:n,columns:Gt,onSortingChange:c,state:{sorting:l}}),m=async()=>{if(window.confirm("Delete the whole AI history? This cannot be undone."))try{await oe.ai.clearLog(),a([])}catch(o){M.error({title:"Could not clear the AI history",description:Xe(o)})}};return e.jsx(Y,{open:s,onOpenChange:t,children:e.jsxs(X,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(J,{children:"AI history"}),e.jsx(Z,{children:"Recent generations on this machine. Prompts and file contents are never recorded."})]}),e.jsxs("div",{className:"ai-log-header-actions",children:[e.jsxs(v,{variant:"outline",size:"sm",disabled:i,onClick:()=>{d()},children:[i?e.jsx(ee,{className:"animate-spin"}):e.jsx(ce,{})," Refresh"]}),e.jsxs(v,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[e.jsx(Ne,{})," Clear"]}),e.jsx(Q,{render:e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":"Close AI history"}),children:e.jsx(Ce,{})})]})]}),n.length>0&&e.jsxs("div",{className:"ai-log-totals",children:[e.jsxs("span",{children:[e.jsx("strong",{children:p.runs})," runs"]}),e.jsxs("span",{children:[e.jsx("strong",{children:p.failed})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:ye(p.tokens)})," tokens"]}),p.costed>0&&e.jsxs("span",{children:[e.jsxs("strong",{children:["$",p.cost.toFixed(4)]})," reported by ",p.costed," of ",p.runs]})]}),e.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(ee,{className:"spinner"})," ",e.jsx(Se,{text:"Reading history…"})]}),!i&&n.length===0&&e.jsx("p",{className:"ai-log-empty",children:"No generations recorded yet. Generate a commit message and it will show up here."}),n.length>0&&e.jsx("div",{className:"ai-log-table-wrap",children:e.jsxs(bs,{children:[e.jsx(vs,{children:h.getHeaderGroups().map(o=>e.jsx(pe,{children:o.headers.map(x=>e.jsx(ws,{children:x.isPlaceholder?null:e.jsx(h.FlexRender,{header:x})},x.id))},o.id))}),e.jsx(ys,{children:h.getRowModel().rows.map(o=>e.jsx(pe,{className:o.original.status==="failed"?"ai-log-row-failed":void 0,children:o.getAllCells().map(x=>e.jsx(ks,{children:e.jsx(h.FlexRender,{cell:x})},x.id))},o.id))})]})})]})]})})}const Ye=140;function Kt({text:s,tone:t,detail:n}){const[a,i]=u.useState(!1),r=s.length>Ye?`${s.slice(0,Ye-1)}…`:s,l=`ai-log-note ${t??""}`;return n?e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[e.jsx(z,{render:e.jsx("button",{type:"button",className:l,onClick:()=>i(!0),"aria-label":"Read generation details"}),children:r}),e.jsx(D,{className:"max-w-md",children:n})]}),e.jsx(Y,{open:a,onOpenChange:i,children:e.jsx(X,{className:"name-dialog",children:e.jsxs("div",{className:"name-dialog-content",children:[e.jsx(J,{children:"Generation details"}),e.jsx(Z,{className:"whitespace-pre-wrap break-words",children:n}),e.jsx("div",{className:"name-dialog-actions",children:e.jsx(Q,{render:e.jsx(v,{variant:"outline"}),children:"Close"})})]})})})]}):e.jsx("span",{className:l,children:r})}function qt(s){const{inputTokens:t,outputTokens:n,costUsd:a}=s.usage;if(t===null&&n===null)return"no usage reported";const i=`${ye(t??0)} in · ${ye(n??0)} out`;return a===null?i:`${i} · $${a.toFixed(4)}`}function ye(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function Xe(s){return s instanceof Error?s.message:"An unexpected error occurred."}const Yt=[{value:"system",label:"System",icon:is},{value:"light",label:"Light",icon:js},{value:"dark",label:"Dark",icon:Ct}],Xt=[{value:"tree",label:"Tree",icon:Us},{value:"list",label:"List",icon:kt}],Jt=[{value:"geist",label:"Geist",family:"'Geist Variable', sans-serif"},{value:"plus-jakarta-sans",label:"Plus Jakarta Sans",family:"'Plus Jakarta Sans Variable', sans-serif"},{value:"space-grotesk",label:"Space Grotesk",family:"'Space Grotesk Variable', sans-serif"}],Zt=[{value:"geist-mono",label:"Geist Mono",family:"'Geist Mono Variable', ui-monospace, monospace"},{value:"jetbrains-mono",label:"JetBrains Mono",family:"'JetBrains Mono Variable', ui-monospace, monospace"},{value:"inconsolata",label:"Inconsolata",family:"'Inconsolata Variable', ui-monospace, monospace"},{value:"departure",label:"Departure Mono",family:"'Departure Mono', ui-monospace, monospace"},{value:"space-grotesk",label:"Space Grotesk",family:"'Space Grotesk Variable', sans-serif"}],je=[0,15,30,60,120,300];function G({label:s,description:t,children:n,toggle:a=!1}){return e.jsxs("div",{className:`settings-general-row${a?" settings-general-toggle":""}`,children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:s}),e.jsx("span",{children:t})]}),e.jsx("div",{className:"settings-general-control",children:n})]})}function Je({label:s,options:t,value:n,onChange:a}){return e.jsx("div",{className:"settings-theme-options",role:"radiogroup","aria-label":s,children:t.map(({value:i,label:r,icon:l},c)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":n===i,tabIndex:n===i?0:-1,className:`settings-theme-option${n===i?" active":""}`,onClick:()=>a(i),onKeyDown:d=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(d.key))return;d.preventDefault();const p=d.key==="Home"?0:d.key==="End"?t.length-1:(c+(["ArrowLeft","ArrowUp"].includes(d.key)?-1:1)+t.length)%t.length,h=t[p];h&&(a(h.value),d.currentTarget.parentElement?.querySelectorAll("button")[p]?.focus())},children:[e.jsx(l,{"aria-hidden":"true"}),e.jsx("span",{children:r})]},i))})}function Ze({label:s,options:t,value:n,onChange:a}){const i=t.find(r=>r.value===n);return e.jsxs(Me,{value:n,onValueChange:r=>{const l=t.find(c=>c.value===r);l&&a(l.value)},children:[e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(Ee,{className:"settings-general-select w-[220px] text-[11px] font-normal","aria-label":s,style:{fontFamily:i?.family}}),children:e.jsx(Ae,{children:i?.label??n})}),e.jsx(D,{children:i?.label})]}),e.jsx(Re,{align:"end",alignItemWithTrigger:!1,className:"settings-general-font-menu min-w-[14rem]",children:t.map(r=>e.jsx(le,{value:r.value,className:"min-h-8 text-xs font-normal",children:e.jsx("span",{style:{fontFamily:r.family},children:r.label})},r.value))})]})}function be(s){return s===0?"Off":s>=60&&s%60===0?`${s/60} ${s===60?"minute":"minutes"}`:`${s} seconds`}function Qt({preferences:s,onPreference:t}){const n=u.useId(),a=u.useRef(null),[i,r]=u.useState(null),[l,c]=u.useState(!1),[d,p]=u.useState(!1),[h,m]=u.useState(!1),o=s.remoteFetchIntervalSeconds,x=()=>{r(null),c(!1),a.current?.focus()};return e.jsxs("div",{className:"settings-general",children:[e.jsxs("div",{className:"settings-general-content",children:[e.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-appearance`,children:[e.jsxs("h3",{id:`${n}-appearance`,children:[e.jsx(js,{"aria-hidden":"true"}),"Appearance"]}),e.jsx(G,{label:"Theme",description:"Follow your system or choose a theme.",children:e.jsx(Je,{label:"Theme",options:Yt,value:s.theme,onChange:f=>t({theme:f})})}),e.jsx(G,{label:"Interface font",description:"Menus, labels and navigation.",children:e.jsx(Ze,{label:"Interface font",options:Jt,value:s.uiFont,onChange:f=>t({uiFont:f})})}),e.jsx(G,{label:"Code font",description:"Code, diffs and the file viewer.",children:e.jsx(Ze,{label:"Code font",options:Zt,value:s.monoFont,onChange:f=>t({monoFont:f})})}),e.jsx(G,{label:"Interface size",description:"Scale text, icons and controls.",children:e.jsxs("div",{className:"settings-zoom-control",children:[e.jsx("input",{type:"range",min:"80",max:"130",step:"10",value:s.uiZoom,onChange:f=>t({uiZoom:Number(f.target.value)}),"aria-label":"Interface zoom"}),e.jsxs("output",{"aria-live":"off",children:[s.uiZoom,"%"]})]})}),h&&e.jsxs("div",{id:`${n}-preview`,className:"settings-general-preview",children:[e.jsxs("span",{children:[e.jsx(ze,{"aria-hidden":"true"}),"src / components / Button.tsx"]}),e.jsxs("code",{children:[e.jsx("span",{children:"const"})," changes = files.filter(isModified);"]})]})]}),e.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-files`,children:[e.jsxs("h3",{id:`${n}-files`,children:[e.jsx(ze,{"aria-hidden":"true"}),"Files & viewer"]}),e.jsx(G,{label:"Changes layout",description:"Folders or a flat list.",children:e.jsx(Je,{label:"Changes layout",options:Xt,value:s.changesLayout,onChange:f=>t({changesLayout:f})})}),e.jsxs(G,{label:"Wrap long lines",description:"Fit lines to the viewer width.",toggle:!0,children:[e.jsx("span",{className:"settings-general-switch-state","aria-hidden":"true",children:s.wrapLines?"On":"Off"}),e.jsx("button",{type:"button",role:"switch","aria-label":"Wrap long lines","aria-checked":s.wrapLines,className:"settings-switch",onClick:()=>t({wrapLines:!s.wrapLines}),children:e.jsx("span",{})})]}),e.jsxs(G,{label:"Show ignored files",description:e.jsxs(e.Fragment,{children:["Include files excluded by ",e.jsx("code",{children:".gitignore"}),"."]}),toggle:!0,children:[e.jsx("span",{className:"settings-general-switch-state","aria-hidden":"true",children:s.showDotEnvFiles?"On":"Off"}),e.jsx("button",{type:"button",role:"switch","aria-label":"Show ignored files","aria-checked":s.showDotEnvFiles,className:"settings-switch",onClick:()=>t({showDotEnvFiles:!s.showDotEnvFiles}),children:e.jsx("span",{})})]})]}),e.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-sync`,children:[e.jsxs("h3",{id:`${n}-sync`,children:[e.jsx(ce,{"aria-hidden":"true"}),"Repository sync"]}),e.jsx(G,{label:"Remote check interval",description:"Keep ahead / behind counts current.",children:e.jsxs(Me,{value:String(o),onValueChange:f=>{c(!1),f==="custom"?r(String(o||30)):f!==null&&je.includes(Number(f))&&(r(null),t({remoteFetchIntervalSeconds:Number(f)}))},children:[e.jsx(Ee,{ref:a,className:"settings-general-select settings-general-interval w-[174px] text-[11px] font-normal","aria-label":"Remote check interval",children:e.jsx(Ae,{children:be(o)})}),e.jsxs(Re,{align:"end",alignItemWithTrigger:!1,className:"min-w-[14rem]",children:[je.map(f=>e.jsxs(le,{value:String(f),className:"min-h-8 text-xs font-normal",children:[be(f),f===30&&e.jsx("small",{className:"settings-general-option-note",children:"Default"})]},f)),!je.includes(o)&&e.jsxs(le,{value:String(o),className:"min-h-8 text-xs font-normal",children:[be(o),e.jsx("small",{className:"settings-general-option-note",children:"Custom"})]}),e.jsxs(le,{value:"custom",className:"min-h-8 text-xs font-normal",children:["Custom…",e.jsx("small",{className:"settings-general-option-note",children:"5–300 seconds"})]})]})]})}),e.jsxs("div",{className:"settings-general-help",children:[e.jsx("span",{children:o===0?"Periodic fetch is off.":`Checks every ${o} seconds.`}),e.jsx("button",{type:"button","aria-expanded":d,"aria-controls":`${n}-interval-help`,onClick:()=>p(!d),children:"What does Off do?"})]}),d&&e.jsx("p",{id:`${n}-interval-help`,className:"settings-general-help-detail",children:"Off disables periodic fetch. Remote checks still run when you pull or push."}),i!==null&&e.jsxs("form",{className:"settings-general-custom",noValidate:!0,onSubmit:f=>{f.preventDefault();const b=Number(i);if(!Number.isFinite(b)||b<Ue||b>Be||b%De!==0){c(!0);return}t({remoteFetchIntervalSeconds:b}),x()},children:[e.jsxs("div",{className:"settings-general-custom-controls",children:[e.jsx("label",{htmlFor:`${n}-custom-interval`,children:"Every"}),e.jsx("input",{id:`${n}-custom-interval`,type:"number",min:Ue,max:Be,step:De,required:!0,autoFocus:!0,value:i,"aria-label":"Custom interval in seconds","aria-invalid":l,"aria-describedby":`${n}-interval-range`,onChange:f=>{r(f.target.value),c(!1)},onKeyDown:f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),x())}}),e.jsx("span",{children:"seconds"}),e.jsx(v,{type:"submit",variant:"outline",size:"sm",children:"Apply"}),e.jsx(v,{type:"button",variant:"ghost",size:"sm",onClick:x,children:"Cancel"})]}),e.jsx("p",{id:`${n}-interval-range`,className:l?"settings-general-error":"settings-general-help-detail",role:l?"alert":void 0,children:"Choose 5–300 seconds, in steps of 5."})]})]})]}),e.jsxs("footer",{className:"settings-general-footer",children:[e.jsxs("span",{children:[e.jsx(Hs,{"aria-hidden":"true"}),"Changes apply immediately"]}),e.jsxs("button",{type:"button","aria-expanded":h,"aria-controls":`${n}-preview`,onClick:()=>m(!h),children:[e.jsx(Lt,{"aria-hidden":"true"}),"Text preview"]})]})]})}function re({column:s,label:t}){const n=s.getIsSorted();return e.jsxs("button",{type:"button",className:"ai-log-sort-button",onClick:()=>s.toggleSorting(n==="asc"),children:[t,n==="asc"&&e.jsx(ps,{size:13}),n==="desc"&&e.jsx(fs,{size:13}),!n&&e.jsx(ms,{size:13,className:"ai-log-sort-idle"})]})}const en=ds({rowSortingFeature:us,sortedRowModel:gs()}),ne=hs(),sn=ne.columns([ne.accessor("level",{header:({column:s})=>e.jsx(re,{column:s,label:"Level"}),cell:({getValue:s})=>{const t=s();return e.jsx(ie,{variant:t==="warn"?"outline":"destructive",children:t})}}),ne.accessor("operation",{header:({column:s})=>e.jsx(re,{column:s,label:"Operation"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),ne.accessor("code",{header:({column:s})=>e.jsx(re,{column:s,label:"Code"}),cell:({getValue:s})=>s()??"—"}),ne.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(re,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:me(s.original.at,{seconds:!0})})}),ne.accessor("message",{header:({column:s})=>e.jsx(re,{column:s,label:"Message"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})})]);function Qe(s){return s instanceof Error?s.message:"An unexpected error occurred."}function tn({open:s,onOpenChange:t}){const[n,a]=u.useState([]),[i,r]=u.useState(!1),[l,c]=u.useState([]),d=u.useCallback(async()=>{r(!0);try{a(await oe.diagnostics.list())}catch(o){M.error({title:"Could not read local problems",description:Qe(o)})}finally{r(!1)}},[]);u.useEffect(()=>{s&&d()},[d,s]);const p=u.useMemo(()=>({all:n.length,errors:n.filter(o=>o.level==="error").length}),[n]),h=cs({features:en,data:n,columns:sn,onSortingChange:c,state:{sorting:l}}),m=async()=>{if(window.confirm("Delete the local problem history? This cannot be undone."))try{await oe.diagnostics.clear(),a([])}catch(o){M.error({title:"Could not clear local problems",description:Qe(o)})}};return e.jsx(Y,{open:s,onOpenChange:t,children:e.jsxs(X,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(J,{children:"Problem history"}),e.jsx(Z,{children:"Recent local failures on this machine. Prompts and file contents are never recorded."})]}),e.jsxs("div",{className:"ai-log-header-actions",children:[e.jsxs(v,{variant:"outline",size:"sm",disabled:i,onClick:()=>{d()},children:[i?e.jsx(ee,{className:"animate-spin"}):e.jsx(ce,{})," Refresh"]}),e.jsxs(v,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[e.jsx(Ne,{})," Clear"]}),e.jsx(Q,{render:e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":"Close problem history"}),children:e.jsx(Ce,{})})]})]}),n.length>0&&e.jsxs("div",{className:"ai-log-totals",children:[e.jsxs("span",{children:[e.jsx("strong",{children:p.all})," recorded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:p.errors})," errors"]})]}),e.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(ee,{className:"spinner"})," ",e.jsx(Se,{text:"Reading problems…"})]}),!i&&n.length===0&&e.jsx("p",{className:"ai-log-empty",children:"No local problems recorded yet. Failed Git, file, and network operations will show up here."}),n.length>0&&e.jsx("div",{className:"ai-log-table-wrap",children:e.jsxs(bs,{children:[e.jsx(vs,{children:h.getHeaderGroups().map(o=>e.jsx(pe,{children:o.headers.map(x=>e.jsx(ws,{children:x.isPlaceholder?null:e.jsx(h.FlexRender,{header:x})},x.id))},o.id))}),e.jsx(ys,{children:h.getRowModel().rows.map(o=>e.jsx(pe,{className:o.original.level==="error"?"ai-log-row-failed":void 0,children:o.getAllCells().map(x=>e.jsx(ks,{children:e.jsx(h.FlexRender,{cell:x})},x.id))},o.id))})]})})]})]})})}const nn=new Set(["Control","Shift","Alt","Meta"]);function an({preferences:s,onPreference:t}){const n=u.useMemo(()=>Vs(s.shortcutOverrides),[s.shortcutOverrides]),[a,i]=u.useState(null),r=Object.keys(s.shortcutOverrides).length>0,l=u.useMemo(()=>["General","Commit","Editor","Tabs"].map(m=>({category:m,definitions:xe.filter(o=>o.category===m)})),[]),c=u.useMemo(()=>[...new Set(He.map(m=>m.category))].map(m=>({category:m,items:He.filter(o=>o.category===m)})),[]),d=(h,m)=>{if(m===n[h]){i(null);return}const o=Gs(h,m,n);if(o){const b=o==="reserved"?`${Ve(m)} is reserved for a fixed shortcut.`:`${Ve(m)} is already used by "${xe.find(y=>y.id===o).label}".`;i({id:h,message:b});return}i(null);const x=xe.find(b=>b.id===h),f={...s.shortcutOverrides};m===x.defaultCombo?delete f[h]:f[h]=m,t({shortcutOverrides:f})},p=h=>{i(null);const m={...s.shortcutOverrides};delete m[h],t({shortcutOverrides:m})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-field settings-toggle-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Show and focus from anywhere"}),e.jsx("span",{children:"Double-tap Control to bring OpenTig to the front, even while another app is focused."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"Show and focus from anywhere","aria-checked":s.doubleControlShortcutEnabled,className:"settings-switch",onClick:()=>t({doubleControlShortcutEnabled:!s.doubleControlShortcutEnabled}),children:e.jsx("span",{})})]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Keyboard shortcuts"}),e.jsx("span",{children:"Click a shortcut, then press a new key combination. Press Escape to cancel."})]}),r&&e.jsxs(v,{variant:"outline",size:"sm",className:"shortcuts-reset-all",onClick:()=>{i(null),t({shortcutOverrides:{}})},children:[e.jsx(rs,{})," Reset all to defaults"]}),l.map(({category:h,definitions:m})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:h}),m.map(o=>e.jsxs("div",{className:"shortcuts-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:o.label}),e.jsx("span",{children:o.description})]}),e.jsx(rn,{combo:n[o.id],allowBare:o.allowBare,isCustom:s.shortcutOverrides[o.id]!==void 0,error:a?.id===o.id?a.message:null,onCapture:x=>d(o.id,x),onReset:()=>p(o.id)})]},o.id))]},h))]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Fixed shortcuts"}),e.jsx("span",{children:"These follow platform and file-manager conventions and cannot be changed."})]}),c.map(({category:h,items:m})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:h}),m.map(o=>e.jsxs("div",{className:"shortcuts-fixed-row",children:[e.jsx("span",{children:o.label}),e.jsx(ls,{children:o.combo.split(" / ").flatMap((x,f)=>[...f>0?[e.jsx("span",{className:"shortcuts-fixed-sep",children:" / "},`sep-${x}`)]:[],...x.split(" + ").map((b,y)=>e.jsx(os,{children:b},`${x}-${y}`))])})]},o.combo+o.label))]},h))]})]})}function rn({combo:s,allowBare:t,isCustom:n,error:a,onCapture:i,onReset:r}){const[l,c]=u.useState(!1);return u.useEffect(()=>{if(!l)return;const d=p=>{if(p.preventDefault(),p.stopPropagation(),p.key==="Escape"){c(!1);return}if(nn.has(p.key))return;const h=Ws(p);c(!1),h&&Ks(h,t)&&i(h)};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[l,t,i]),e.jsxs("div",{className:"shortcut-recorder",children:[a&&e.jsx("span",{className:"shortcut-recorder-error",children:a}),e.jsx("button",{type:"button",className:`shortcut-recorder-button ${l?"listening":""} ${a?"error":""}`,onClick:()=>c(!0),onBlur:()=>c(!1),children:l?"Press a key…":e.jsx(ls,{children:s.split("+").map(d=>e.jsx(os,{children:d},d))})}),n&&e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(v,{variant:"ghost",size:"icon-xs","aria-label":"Reset to default",onClick:r}),children:e.jsx(rs,{})}),e.jsx(D,{children:"Reset to default"})]})]})}var q=(s=>(s[s.Border=-1]="Border",s[s.Data=0]="Data",s[s.Function=1]="Function",s[s.Position=2]="Position",s[s.Timing=3]="Timing",s[s.Alignment=4]="Alignment",s))(q||{});const ln=[0,1],Ns=[1,0],Cs=[2,3],Ss=[3,2],on={L:ln,M:Ns,Q:Cs,H:Ss},cn=/^\d*$/,dn=/^[A-Z0-9 $%*+./:-]*$/,ve="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Te=1,$e=40,es=3,hn=3,he=40,un=10,Ms=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Es=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]];class gn{constructor(t,n,a,i){if(this.version=t,this.ecc=n,t<Te||t>$e)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const r=Array.from({length:this.size}).fill(!1);for(let c=0;c<this.size;c++)this.modules.push(r.slice()),this.types.push(r.map(()=>0));this.drawFunctionPatterns();const l=this.addEccAndInterleave(a);if(this.drawCodewords(l),i===-1){let c=1e9;for(let d=0;d<8;d++){this.applyMask(d),this.drawFormatBits(d);const p=this.getPenaltyScore();p<c&&(i=d,c=p),this.applyMask(d)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}size;mask;modules=[];types=[];getModule(t,n){return t>=0&&t<this.size&&n>=0&&n<this.size&&this.modules[n][t]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2===0,q.Timing),this.setFunctionModule(a,6,a%2===0,q.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),n=t.length;for(let a=0;a<n;a++)for(let i=0;i<n;i++)a===0&&i===0||a===0&&i===n-1||a===n-1&&i===0||this.drawAlignmentPattern(t[a],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const n=this.ecc[1]<<3|t;let a=n;for(let r=0;r<10;r++)a=a<<1^(a>>>9)*1335;const i=(n<<10|a)^21522;for(let r=0;r<=5;r++)this.setFunctionModule(8,r,U(i,r));this.setFunctionModule(8,7,U(i,6)),this.setFunctionModule(8,8,U(i,7)),this.setFunctionModule(7,8,U(i,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,U(i,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,U(i,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,U(i,r));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let a=0;a<12;a++)t=t<<1^(t>>>11)*7973;const n=this.version<<12|t;for(let a=0;a<18;a++){const i=U(n,a),r=this.size-11+a%3,l=Math.floor(a/3);this.setFunctionModule(r,l,i),this.setFunctionModule(l,r,i)}}drawFinderPattern(t,n){for(let a=-4;a<=4;a++)for(let i=-4;i<=4;i++){const r=Math.max(Math.abs(i),Math.abs(a)),l=t+i,c=n+a;l>=0&&l<this.size&&c>=0&&c<this.size&&this.setFunctionModule(l,c,r!==2&&r!==4,q.Position)}}drawAlignmentPattern(t,n){for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,n+a,Math.max(Math.abs(i),Math.abs(a))!==1,q.Alignment)}setFunctionModule(t,n,a,i=q.Function){this.modules[n][t]=a,this.types[n][t]=i}addEccAndInterleave(t){const n=this.version,a=this.ecc;if(t.length!==ge(n,a))throw new RangeError("Invalid argument");const i=Es[a[0]][n],r=Ms[a[0]][n],l=Math.floor(we(n)/8),c=i-l%i,d=Math.floor(l/i),p=[],h=wn(r);for(let o=0,x=0;o<i;o++){const f=t.slice(x,x+d-r+(o<c?0:1));x+=f.length;const b=kn(f,h);o<c&&f.push(0),p.push(f.concat(b))}const m=[];for(let o=0;o<p[0].length;o++)p.forEach((x,f)=>{(o!==d-r||f>=c)&&m.push(x[o])});return m}drawCodewords(t){if(t.length!==Math.floor(we(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let a=this.size-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<this.size;i++)for(let r=0;r<2;r++){const l=a-r,d=(a+1&2)===0?this.size-1-i:i;!this.types[d][l]&&n<t.length*8&&(this.modules[d][l]=U(t[n>>>3],7-(n&7)),n++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let a=0;a<this.size;a++){let i;switch(t){case 0:i=(a+n)%2===0;break;case 1:i=n%2===0;break;case 2:i=a%3===0;break;case 3:i=(a+n)%3===0;break;case 4:i=(Math.floor(a/3)+Math.floor(n/2))%2===0;break;case 5:i=a*n%2+a*n%3===0;break;case 6:i=(a*n%2+a*n%3)%2===0;break;case 7:i=((a+n)%2+a*n%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[n][a]&&i&&(this.modules[n][a]=!this.modules[n][a])}}getPenaltyScore(){let t=0;for(let r=0;r<this.size;r++){let l=!1,c=0;const d=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[r][p]===l?(c++,c===5?t+=es:c>5&&t++):(this.finderPenaltyAddHistory(c,d),l||(t+=this.finderPenaltyCountPatterns(d)*he),l=this.modules[r][p],c=1);t+=this.finderPenaltyTerminateAndCount(l,c,d)*he}for(let r=0;r<this.size;r++){let l=!1,c=0;const d=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][r]===l?(c++,c===5?t+=es:c>5&&t++):(this.finderPenaltyAddHistory(c,d),l||(t+=this.finderPenaltyCountPatterns(d)*he),l=this.modules[p][r],c=1);t+=this.finderPenaltyTerminateAndCount(l,c,d)*he}for(let r=0;r<this.size-1;r++)for(let l=0;l<this.size-1;l++){const c=this.modules[r][l];c===this.modules[r][l+1]&&c===this.modules[r+1][l]&&c===this.modules[r+1][l+1]&&(t+=hn)}let n=0;for(const r of this.modules)n=r.reduce((l,c)=>l+(c?1:0),n);const a=this.size*this.size,i=Math.ceil(Math.abs(n*20-a*10)/a)-1;return t+=i*un,t}getAlignmentPatternPositions(){if(this.version===1)return[];{const t=Math.floor(this.version/7)+2,n=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,a=[6];for(let i=this.size-7;a.length<t;i-=n)a.splice(1,0,i);return a}}finderPenaltyCountPatterns(t){const n=t[1],a=n>0&&t[2]===n&&t[3]===n*3&&t[4]===n&&t[5]===n;return(a&&t[0]>=n*4&&t[6]>=n?1:0)+(a&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,a){return t&&(this.finderPenaltyAddHistory(n,a),n=0),n+=this.size,this.finderPenaltyAddHistory(n,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(t,n){n[0]===0&&(t+=this.size),n.pop(),n.unshift(t)}}function H(s,t,n){if(t<0||t>31||s>>>t)throw new RangeError("Value out of range");for(let a=t-1;a>=0;a--)n.push(s>>>a&1)}function U(s,t){return(s>>>t&1)!==0}class Oe{constructor(t,n,a){if(this.mode=t,this.numChars=n,this.bitData=a,n<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}getData(){return this.bitData.slice()}}const mn=[1,10,12,14],pn=[2,9,11,13],fn=[4,8,16,16];function As(s,t){return s[Math.floor((t+7)/17)+1]}function Rs(s){const t=[];for(const n of s)H(n,8,t);return new Oe(fn,s.length,t)}function xn(s){if(!Is(s))throw new RangeError("String contains non-numeric characters");const t=[];for(let n=0;n<s.length;){const a=Math.min(s.length-n,3);H(Number.parseInt(s.substring(n,n+a),10),a*3+1,t),n+=a}return new Oe(mn,s.length,t)}function jn(s){if(!Ts(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let n;for(n=0;n+2<=s.length;n+=2){let a=ve.indexOf(s.charAt(n))*45;a+=ve.indexOf(s.charAt(n+1)),H(a,11,t)}return n<s.length&&H(ve.indexOf(s.charAt(n)),6,t),new Oe(pn,s.length,t)}function bn(s){return s===""?[]:Is(s)?[xn(s)]:Ts(s)?[jn(s)]:[Rs(yn(s))]}function Is(s){return cn.test(s)}function Ts(s){return dn.test(s)}function vn(s,t){let n=0;for(const a of s){const i=As(a.mode,t);if(a.numChars>=1<<i)return Number.POSITIVE_INFINITY;n+=4+i+a.bitData.length}return n}function yn(s){s=encodeURI(s);const t=[];for(let n=0;n<s.length;n++)s.charAt(n)!=="%"?t.push(s.charCodeAt(n)):(t.push(Number.parseInt(s.substring(n+1,n+3),16)),n+=2);return t}function we(s){if(s<Te||s>$e)throw new RangeError("Version number out of range");let t=(16*s+128)*s+64;if(s>=2){const n=Math.floor(s/7)+2;t-=(25*n-10)*n-55,s>=7&&(t-=36)}return t}function ge(s,t){return Math.floor(we(s)/8)-Ms[t[0]][s]*Es[t[0]][s]}function wn(s){if(s<1||s>255)throw new RangeError("Degree out of range");const t=[];for(let a=0;a<s-1;a++)t.push(0);t.push(1);let n=1;for(let a=0;a<s;a++){for(let i=0;i<t.length;i++)t[i]=ke(t[i],n),i+1<t.length&&(t[i]^=t[i+1]);n=ke(n,2)}return t}function kn(s,t){const n=t.map(a=>0);for(const a of s){const i=a^n.shift();n.push(0),t.forEach((r,l)=>n[l]^=ke(r,i))}return n}function ke(s,t){if(s>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let a=7;a>=0;a--)n=n<<1^(n>>>7)*285,n^=(t>>>a&1)*s;return n}function Nn(s,t,n=1,a=40,i=-1,r=!0){if(!(Te<=n&&n<=a&&a<=$e)||i<-1||i>7)throw new RangeError("Invalid value");let l,c;for(l=n;;l++){const m=ge(l,t)*8,o=vn(s,l);if(o<=m){c=o;break}if(l>=a)throw new RangeError("Data too long")}for(const m of[Ns,Cs,Ss])r&&c<=ge(l,m)*8&&(t=m);const d=[];for(const m of s){H(m.mode[0],4,d),H(m.numChars,As(m.mode,l),d);for(const o of m.getData())d.push(o)}const p=ge(l,t)*8;H(0,Math.min(4,p-d.length),d),H(0,(8-d.length%8)%8,d);for(let m=236;d.length<p;m^=253)H(m,8,d);const h=Array.from({length:Math.ceil(d.length/8)},()=>0);return d.forEach((m,o)=>h[o>>>3]|=m<<7-(o&7)),new gn(l,t,h,i)}function Cn(s,t){const{ecc:n="L",boostEcc:a=!1,minVersion:i=1,maxVersion:r=40,maskPattern:l=-1,border:c=1}=t||{},d=typeof s=="string"?bn(s):Array.isArray(s)?[Rs(s)]:void 0;if(!d)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof s}`);const p=Nn(d,on[n],i,r,l,a),h=Sn({version:p.version,maskPattern:p.mask,size:p.size,data:p.modules,types:p.types},c);return t?.invert&&(h.data=h.data.map(m=>m.map(o=>!o))),t?.onEncoded?.(h),h}function Sn(s,t=1){if(!t)return s;const{size:n}=s,a=n+t*2;s.size=a,s.data.forEach(r=>{for(let l=0;l<t;l++)r.unshift(!1),r.push(!1)});for(let r=0;r<t;r++)s.data.unshift(Array.from({length:a},l=>!1)),s.data.push(Array.from({length:a},l=>!1));const i=q.Border;s.types.forEach(r=>{for(let l=0;l<t;l++)r.unshift(i),r.push(i)});for(let r=0;r<t;r++)s.types.unshift(Array.from({length:a},l=>i)),s.types.push(Array.from({length:a},l=>i));return s}function ss(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Mn(s,t={}){const n=Cn(s,t),{pixelSize:a=10,whiteColor:i="white",blackColor:r="black"}=t,l=n.size*a,c=n.size*a;let d=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c} ${l}">`;const p=[];for(let h=0;h<n.size;h++)for(let m=0;m<n.size;m++){const o=m*a,x=h*a;n.data[h][m]&&p.push(`M${o},${x}h${a}v${a}h-${a}z`)}return d+=`<rect fill="${ss(i)}" width="${c}" height="${l}"/>`,d+=`<path fill="${ss(r)}" d="${p.join("")}"/>`,d+="</svg>",d}async function En(){const s=await fetch("/api/auth/sessions",{credentials:"include"});if(!s.ok)throw new Error(await Pe(s,"Could not load owner sessions."));const t=await s.json();if(!Array.isArray(t.sessions))throw new Error("OpenTig returned an invalid session list.");return t.sessions}async function An(s){return $s("/api/auth/sessions/revoke",{sessionId:s})}async function Rn(){return $s("/api/auth/sessions/revoke-all",{})}async function In(s,t){const n=await fetch("/api/auth/sessions/rename",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s,clientName:t})});if(!n.ok)throw new Error(await Pe(n,"Could not rename the browser session."))}async function $s(s,t){const n=await fetch(s,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await Pe(n,"Could not revoke the browser session."));const a=await n.json();if(!Number.isSafeInteger(a.revokedCount)||Number(a.revokedCount)<0)throw new Error("OpenTig returned an invalid revocation result.");return Number(a.revokedCount)}async function Pe(s,t){try{const n=await s.json();return typeof n.error=="string"?n.error:t}catch{return t}}const Tn={starting:"Starting",ready:"Ready",restarting:"Restarting",failed:"Failed",stopped:"Stopped"};function $n(){const s=window.opentigDesktop?.webAccess,[t,n]=u.useState(null),[a,i]=u.useState([]),[r,l]=u.useState(null),[c,d]=u.useState(""),[p,h]=u.useState(!0),[m,o]=u.useState(null),[x,f]=u.useState(!1),[b,y]=u.useState(null),[E,P]=u.useState(null),[w,C]=u.useState(""),S=u.useCallback(async(g=!0)=>{const I=await Promise.allSettled([s?.getStatus()??Promise.resolve(null),En()]);I[0].status==="fulfilled"?n(I[0].value):g&&M.error({title:"Could not read web access status",description:W(I[0].reason)}),I[1].status==="fulfilled"?i(I[1].value):g&&M.error({title:"Could not read owner sessions",description:W(I[1].reason)}),h(!1)},[s]);u.useEffect(()=>{S();const g=window.setInterval(()=>{S(!1)},2e3);return()=>window.clearInterval(g)},[S]),u.useEffect(()=>{t&&(t.pairingEndpoints.length?t.pairingEndpoints.includes(c)||d(t.pairingEndpoints[0]):d(""))},[c,t]);const A=u.useMemo(()=>r?`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(Mn(r.url,{ecc:"M",border:2}))}`:null,[r]),O=u.useMemo(()=>r?new URLSearchParams(new URL(r.url).hash.slice(1)).get("token")??"":"",[r]);if(p&&(!s||!t)&&a.length===0)return e.jsxs("div",{className:"web-access-loading",role:"status",children:[e.jsx(ee,{className:"animate-spin"})," Loading web access…"]});const R=async g=>{if(s){o("toggle"),l(null);try{n(await s.setEnabled(g)),M.success({title:g?"LAN access enabled":"LAN access disabled"})}catch(I){M.error({title:"Could not restart web access",description:W(I)}),await S(!1)}finally{o(null),f(!1)}}},N=async()=>{if(s){o("pair");try{l(await s.createPairingLink(c))}catch(g){M.error({title:"Could not create pairing link",description:W(g)})}finally{o(null)}}},L=async()=>{if(r)try{await Fe(r.url),M.success({title:"Pairing link copied"})}catch(g){M.error({title:"Could not copy pairing link",description:W(g)})}},K=async()=>{if(O)try{await Fe(O),M.success({title:"Pairing code copied"})}catch(g){M.error({title:"Could not copy pairing code",description:W(g)})}},j=async()=>{const g=E,I=w.trim();if(!(!g||!I||I.length>64)){o(`rename:${g.id}`);try{await In(g.id,I),M.success({title:"Device renamed"}),await S(!1),P(null)}catch(te){M.error({title:"Could not rename device",description:W(te)})}finally{o(null)}}},k=async()=>{const g=b;if(!g)return;const I=g==="all"?"revoke-all":`revoke:${g.id}`;o(I);try{const te=g==="all"?await Rn():await An(g.id);l(null),M.success({title:`${te} browser ${te===1?"session":"sessions"} revoked`}),await S(!1)}catch(te){M.error({title:"Could not revoke session",description:W(te)})}finally{o(null),y(null)}},T=t?.serverState==="ready",se=a.filter(g=>g.kind!=="desktop");return e.jsxs("div",{className:"web-access-settings",children:[s&&t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"web-access-summary",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"LAN access"}),e.jsx("span",{children:"Listen on this computer's network interfaces for trusted local devices."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"LAN access","aria-checked":t.enabled,className:"settings-switch",disabled:m==="toggle"||!T,onClick:()=>t.enabled?void R(!1):f(!0),children:e.jsx("span",{})})]}),e.jsxs("div",{className:"web-access-facts","aria-live":"polite",children:[e.jsx(ue,{label:"Server status",children:e.jsx(ie,{variant:T?"secondary":"outline",children:Tn[t.serverState]})}),e.jsx(ue,{label:"Actual port",children:e.jsx("code",{children:t.actualPort??"Unavailable"})}),e.jsx(ue,{label:"Local endpoint",children:e.jsx(ts,{value:t.localEndpoint})}),e.jsx(ue,{label:"LAN endpoints",children:e.jsx("div",{className:"web-access-endpoints",children:t.networkEndpoints.length===0?e.jsx("span",{children:"None detected"}):t.networkEndpoints.map(g=>e.jsx(ts,{value:g,muted:!t.enabled},g))})})]}),t.restartError&&e.jsxs("div",{className:"web-access-error",role:"alert",children:[e.jsx(Ie,{})," ",e.jsx("span",{children:t.restartError})]}),e.jsxs("div",{className:"web-access-actions settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Pair a browser"}),e.jsx("span",{children:"Create a five-minute, one-use link for this computer or a LAN device. The pairing code also works through a same-machine HTTPS tunnel."})]}),e.jsxs(v,{size:"sm",onClick:()=>{N()},disabled:!T||!c||m!==null,children:[m==="pair"?e.jsx(ee,{className:"animate-spin"}):e.jsx(yt,{})," Create pairing link"]})]}),t.pairingEndpoints.length>0&&e.jsxs("div",{className:"web-access-endpoint-select",children:[e.jsx("label",{htmlFor:"web-access-endpoint",children:"Address to place in the pairing link"}),e.jsxs(Me,{value:c,onValueChange:g=>{g&&(d(g),l(null))},disabled:m!==null,children:[e.jsx(Ee,{id:"web-access-endpoint",className:"w-full",children:e.jsx(Ae,{children:c})}),e.jsx(Re,{alignItemWithTrigger:!1,children:e.jsx(qs,{children:t.pairingEndpoints.map(g=>e.jsx(le,{value:g,children:g},g))})})]})]}),r&&e.jsxs("div",{className:"web-access-pairing",role:"status",children:[e.jsxs("div",{className:"web-access-pairing-copy",children:[e.jsx(At,{"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Pairing link ready"}),e.jsxs("span",{children:["Expires ",me(r.expiresAt,{seconds:!0}),"."]})]})]}),A&&e.jsx("img",{src:A,alt:"QR code for the one-use OpenTig pairing link"}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(_,{children:[e.jsx(z,{render:e.jsx("code",{className:"web-access-link"}),children:r.url}),e.jsx(D,{side:"bottom",children:"One-use link; do not share publicly"})]}),e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(v,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing link",onClick:()=>{L()}}),children:e.jsx(Le,{})}),e.jsx(D,{children:"Copy pairing link"})]})]}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(_,{children:[e.jsx(z,{render:e.jsx("code",{className:"web-access-link"}),children:O}),e.jsx(D,{side:"bottom",children:"Paste this code on any /pair page served by this OpenTig instance"})]}),e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(v,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing code",onClick:()=>{K()}}),children:e.jsx(Le,{})}),e.jsx(D,{children:"Copy pairing code"})]})]})]})]}),e.jsxs("div",{className:`web-access-session-heading ${s?"settings-field-separated":""}`,children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Owner sessions"}),e.jsx("span",{children:"Desktop authentication stays private. Paired browsers can be disconnected individually."})]}),e.jsxs(v,{variant:"destructive",size:"sm",onClick:()=>y("all"),disabled:se.length===0||m!==null,children:[e.jsx(qe,{})," Revoke browsers"]})]}),e.jsx("div",{className:"web-access-session-list","aria-live":"polite",children:a.length===0?e.jsx("div",{className:"web-access-empty-session",children:"No owner sessions found."}):a.map(g=>e.jsxs("div",{className:"web-access-session",children:[e.jsx("div",{className:`web-access-session-icon ${g.connected?"connected":""}`,children:g.kind==="desktop"?e.jsx(is,{}):e.jsx(xt,{})}),e.jsxs("div",{className:"web-access-session-copy",children:[e.jsxs("div",{children:[e.jsx("strong",{children:g.clientName}),g.current&&e.jsx(ie,{variant:"secondary",children:"This session"}),g.kind==="desktop"&&e.jsx(ie,{variant:"outline",children:"Desktop"})]}),e.jsxs("span",{children:[g.connected?`Connected${g.connectionCount>1?` (${g.connectionCount} tabs)`:""}`:g.lastConnectedAt?`Last connected ${me(g.lastConnectedAt,{seconds:!0})}`:"Not yet connected"," · ",g.browser&&g.os?`${g.browser} on ${g.os}`:g.browser??g.os??On(g.deviceType),g.viaProxy?" · Via proxy":"",g.remoteAddress?` · ${g.remoteAddress}`:""]})]}),g.kind!=="desktop"&&e.jsxs("div",{className:"web-access-session-controls",children:[e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${g.clientName}`,onClick:()=>{P(g),C(g.clientName)},disabled:m!==null}),children:e.jsx(it,{})}),e.jsx(D,{children:"Rename this device"})]}),e.jsxs(_,{children:[e.jsx(z,{render:e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":`Revoke ${g.clientName} session`,onClick:()=>y(g),disabled:m!==null}),children:e.jsx(Ne,{})}),e.jsx(D,{children:"Revoke this browser session"})]})]})]},g.id))}),!s&&e.jsx("p",{className:"web-access-hint",children:"Listener addresses and new pairing links are controlled by the OpenTig desktop app or CLI running the server."}),e.jsx(Y,{open:x,onOpenChange:f,children:e.jsxs(X,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(J,{children:"Enable owner-level LAN access?"}),e.jsx(Z,{children:"Any paired browser can edit or delete files and act with your OS user permissions. Use only a trusted LAN or VPN."})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(Q,{render:e.jsx(v,{variant:"ghost"}),children:"Cancel"}),e.jsx(v,{onClick:()=>{R(!0)},disabled:m!==null,children:"Enable LAN access"})]})]})}),e.jsx(Y,{open:b!==null,onOpenChange:g=>{g||y(null)},children:e.jsxs(X,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(J,{children:b==="all"?"Revoke all browser sessions?":"Revoke this browser session?"}),e.jsx(Z,{children:b==="all"?"Every paired browser disconnects immediately. The private desktop session remains signed in.":b?.current?"This browser will disconnect immediately and require a new pairing link.":"That browser disconnects immediately and will require a new pairing link."}),b&&b!=="all"&&e.jsx("div",{className:"undo-commit-summary",children:e.jsx("strong",{children:b.clientName})})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(Q,{render:e.jsx(v,{variant:"ghost"}),children:"Cancel"}),e.jsxs(v,{variant:"destructive",onClick:()=>{k()},disabled:m!==null,children:[e.jsx(qe,{})," Revoke"]})]})]})}),e.jsx(Y,{open:E!==null,onOpenChange:g=>{g||P(null)},children:e.jsxs(X,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(J,{children:"Rename paired device"}),e.jsx(Z,{children:"Use a name that makes this browser easy to identify later."}),e.jsx("input",{className:"web-access-rename-input",value:w,onChange:g=>C(g.target.value),maxLength:64,"aria-label":"Device name",autoComplete:"off"})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(Q,{render:e.jsx(v,{variant:"ghost"}),children:"Cancel"}),e.jsx(v,{onClick:()=>{j()},disabled:m!==null||!w.trim(),children:"Save"})]})]})})]})}function ue({label:s,children:t}){return e.jsxs("div",{className:"web-access-fact",children:[e.jsx("span",{children:s}),e.jsx("div",{children:t})]})}function ts({value:s,muted:t=!1}){return s?e.jsxs(_,{children:[e.jsx(z,{render:e.jsx("code",{className:t?"muted":void 0}),children:s}),e.jsx(D,{side:"bottom",children:t?"Enable LAN access to use this endpoint":s})]}):e.jsx("span",{children:"Unavailable"})}function On(s){return s==="desktop"?"Desktop browser":s==="mobile"?"Mobile browser":s==="tablet"?"Tablet browser":s==="bot"?"Automated client":"Unknown browser"}function W(s){return s instanceof Error?s.message:String(s)}const Pn=[{id:"general",label:"General",icon:Ys},{id:"updates",label:"Updates",icon:ce},{id:"shortcuts",label:"Shortcuts",icon:bt},{id:"ai",label:"AI assistance",icon:xs},{id:"diagnostics",label:"Diagnostics",icon:Ie},{id:"webAccess",label:"Web access",icon:Mt}],Ln={updates:{title:"Updates",description:"Check, download, and install new OpenTig releases."},general:{title:"General",description:"Appearance, files and repository behavior."},shortcuts:{title:"Shortcuts",description:"Rebind commands or review the shortcuts that stay fixed."},ai:{title:"AI assistance",description:"Local harness and model used to suggest commit messages and pull-request drafts."},diagnostics:{title:"Diagnostics",description:"Recent local failures on this machine. Prompts and file contents are never recorded."}};function Kn({preferences:s,onPreference:t,open:n,onOpenChange:a,section:i,onSectionChange:r}){const[l,c]=u.useState([]),[d,p]=u.useState(!1),[h,m]=u.useState(!1),[o,x]=u.useState(!1),f=u.useRef(null),b=ut(),y=b?{duration:0}:{duration:.16,ease:[.22,1,.36,1]},E=u.useRef(0),P=u.useCallback(async(j=!1)=>{const k=++E.current;p(!0);try{const T=await oe.ai.statuses(j);k===E.current&&c(T)}catch(T){M.error({title:"Could not check local AI",description:Dn(T)})}finally{k===E.current&&p(!1)}},[]);u.useEffect(()=>{n&&i==="ai"&&P();const j=E;return()=>{j.current++}},[P,n,i,s.aiExecutablePaths]),u.useLayoutEffect(()=>{n&&f.current&&(f.current.scrollTop=0)},[n,i]);const w=s.commitMessageHarness,C=l.find(j=>j.id===w),S=s.commitMessageModels[w]??"default",A=C?.models??[{id:"default",label:"Default (CLI)"}],O=A.some(j=>j.id===S)?A:[...A,{id:S,label:`${S} (unavailable)`}],R=[];for(const j of O){const k=w==="opencode"?j.id.indexOf("/"):-1,T=k>0?j.id.slice(0,k):w,se=j.id==="default"?"default":`provider:${T}`;let g=R.find(I=>I.id===se);g||(g={id:se,label:j.id==="default"?"":k>0?T:ae(w),items:[]},R.push(g)),g.items.push({value:j.id,label:k>0&&j.label===j.id?j.id.slice(k+1):j.label,search:j.id,tooltip:j.id==="default"||j.label===j.id?j.label:`${j.label} · ${j.id}`,pinned:j.id==="default",icon:e.jsx(xs,{})})}const N=O.find(j=>j.id===S)?.label??S,{title:L,description:K}=i==="webAccess"?{title:"Web access",description:window.opentigDesktop?"Connect trusted browsers locally, over your LAN, or through an HTTPS tunnel.":"Review and disconnect browsers authorised to use this OpenTig server."}:Ln[i];return e.jsx(Y,{open:n,onOpenChange:a,children:e.jsx(X,{className:`settings-dialog${i==="general"?" settings-dialog-general":i==="ai"?" settings-dialog-ai w-[min(1000px,calc((100vw-48px)/var(--settings-ui-scale,1)))]":""}`,style:{"--settings-ui-scale":window.opentigDesktop||window.matchMedia("(max-width: 767px)").matches?1:s.uiZoom/100},children:e.jsxs("div",{className:"settings-shell",children:[e.jsxs("aside",{className:"settings-nav",children:[e.jsx("div",{className:"settings-nav-title",children:"Settings"}),Pn.map(({id:j,label:k,icon:T})=>e.jsxs("button",{className:`settings-nav-item ${i===j?"active":""}`,onClick:()=>r(j),"aria-current":i===j,children:[e.jsx(T,{})," ",k]},j))]}),e.jsxs("section",{className:"settings-panel",children:[e.jsxs("header",{className:"settings-panel-header",children:[e.jsx(Ke,{initial:!1,mode:"wait",children:e.jsxs(_e.div,{initial:b?!1:{opacity:0,y:4},animate:{opacity:1,y:0},exit:b?{opacity:1}:{opacity:0,y:-3},transition:y,children:[e.jsx(J,{children:L}),e.jsx(Z,{children:K})]},i)}),e.jsx(Q,{render:e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":"Close settings"}),children:e.jsx(Ce,{})})]}),e.jsx("div",{ref:f,className:`settings-panel-body${i==="general"?" settings-panel-body-general":""}`,children:e.jsx(Ke,{initial:!1,mode:"wait",children:e.jsx(_e.div,{className:`settings-panel-section${i==="general"?" settings-panel-section-general":""}`,initial:b?!1:{opacity:0,y:7},animate:{opacity:1,y:0},exit:b?{opacity:1}:{opacity:0,y:-5},transition:y,children:i==="general"?e.jsx(Qt,{preferences:s,onPreference:t}):i==="updates"?e.jsx(Xs,{}):i==="shortcuts"?e.jsx(an,{preferences:s,onPreference:t}):i==="webAccess"?e.jsx($n,{}):i==="diagnostics"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-field",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Problem history"}),e.jsx("span",{children:"Failed Git, file, and network operations recorded locally. Prompts and file contents are never stored."})]}),e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>x(!0),children:[e.jsx(Ie,{})," View problems"]})]}),e.jsx(tn,{open:o,onOpenChange:x})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ai-settings-heading",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Local harness"}),e.jsx("span",{children:"OpenTig uses the selected CLI session. It does not copy or store credentials."})]}),e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>{P(!0)},disabled:d,children:[d?e.jsx(ee,{className:"animate-spin"}):e.jsx(ce,{})," ",d?e.jsx(Se,{text:"Checking…"}):"Check again"]})]}),e.jsx("div",{className:"ai-harness-list",role:"radiogroup","aria-label":"Harness for AI assistance",children:["codex","claude","opencode","grok"].map(j=>{const k=l.find(se=>se.id===j),T=w===j;return e.jsxs("button",{type:"button",role:"radio","aria-checked":T,className:`ai-harness-card ${T?"active":""}`,onClick:()=>t({commitMessageHarness:j}),children:[e.jsxs("span",{className:"ai-harness-card-main",children:[e.jsx(Js,{harness:j}),e.jsxs("span",{className:"ai-harness-card-copy",children:[e.jsx("strong",{children:ae(j)}),e.jsx("small",{children:d?"Checking…":k?.version||(k?k.installationStatus==="inspection-failed"?"Inspection unavailable":k.installed?"Version unavailable":"Executable not found":"Status not checked")})]})]}),e.jsx(ie,{variant:_n(k),className:`ai-status-badge ${k?.availability??"unknown"}`,children:Fn(k)}),k?.message&&e.jsx("span",{className:"ai-harness-message",children:k.message})]},j)})}),e.jsxs("div",{className:"settings-field settings-field-separated ai-model-field",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsxs("strong",{children:[ae(w)," model"]}),e.jsx("span",{children:w==="grok"?"Default uses Grok’s built-in default. Custom CLI models and configuration are not loaded.":"Default lets the CLI choose. OpenTig remembers a separate selection for each harness."})]}),e.jsx(Zs,{groups:R,value:S,onValueChange:j=>t({commitMessageModels:{...s.commitMessageModels,[w]:j}}),label:`${ae(w)} model`,triggerLabel:N,triggerClassName:"ai-model-select",contentClassName:"ai-model-picker",size:"default",align:"end",placeholder:"Search models…"},w),C?.authStatus==="unauthenticated"&&e.jsxs("p",{className:"ai-login-hint",children:["Sign in from a terminal with ",e.jsx("code",{children:zn(w,C.cliName)})," and check again."]}),C&&!C.installed&&C.installationStatus!=="inspection-failed"&&e.jsxs("p",{className:"ai-login-hint",children:["Install ",ae(w)," and check its availability again."]})]}),e.jsx(Bt,{harness:w,preferences:s,status:C,onPreference:t},w),e.jsxs("div",{className:"settings-field settings-field-separated ai-history-field",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Generation history"}),e.jsx("span",{children:"Outcome, duration, tokens, and cost of recent runs, kept locally for diagnostics."})]}),e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>m(!0),children:[e.jsx(Qs,{})," View history"]})]}),e.jsx("p",{className:"ai-privacy-note",children:"Only the staged diff, its summary, the branch, and recent subjects are sent to the selected harness. The generated message always remains pending your review, and the history records metadata only."}),e.jsx(Wt,{open:h,onOpenChange:m})]})},i)})})]})]})})})}function Fn(s){return s?s.installationStatus==="inspection-failed"?"Check failed":s.installationStatus==="not-executable"?"Cannot run":s.installationStatus==="incompatible"?"Incompatible":s.installed?s.authStatus==="unauthenticated"?"Not authenticated":s.availability==="ready"?"Available":"Check":"Not found":"Not checked"}function _n(s){return s?!s.installed||s.authStatus==="unauthenticated"||s.availability==="error"?"destructive":s.availability==="ready"?"default":"secondary":"outline"}function zn(s,t){return s==="codex"?"codex login":s==="claude"?"claude auth login":s==="grok"?"grok login":t==="opencode2"?"opencode2 auth login":"opencode auth login"}function Dn(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{Kn as SettingsDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-9dt2ugQA.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./react-rd22PHbN.js";import{d as a}from"./index-DAUK3rnz.js";import{A as t}from"./App-BXZLGT86.js";import{C as o,a as d}from"./base-ui-CJ8ZIx3d.js";function b({className:e,...i}){return r.jsx(o,{"data-slot":"checkbox",className:a("peer relative flex size-3.5 shrink-0 items-center justify-center rounded-[4px] border border-transparent bg-input/90 transition-shadow outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",e),...i,children:r.jsx(d,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3",children:r.jsx(t,{})})})}export{b as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as t,a as s,C as i}from"./chunk-GF5L2VYU-D7V-3eRg.js";import{_ as e}from"./mermaid.core-9dt2ugQA.js";import"./chunk-5VM5RSS4-C5-dW5wf.js";import"./chunk-XXDRQBXY-C_IY9A64.js";import"./chunk-KBJHAD2P-CyOvijwM.js";import"./chunk-2GRJ4B5K-C_kzp38w.js";import"./render-markdown-BtCybfvQ.js";import"./App-BXZLGT86.js";import"./index-DAUK3rnz.js";import"./react-rd22PHbN.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v={parser:s,get db(){return new i},renderer:t,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{v as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as t,a as s,C as i}from"./chunk-GF5L2VYU-D7V-3eRg.js";import{_ as e}from"./mermaid.core-9dt2ugQA.js";import"./chunk-5VM5RSS4-C5-dW5wf.js";import"./chunk-XXDRQBXY-C_IY9A64.js";import"./chunk-KBJHAD2P-CyOvijwM.js";import"./chunk-2GRJ4B5K-C_kzp38w.js";import"./render-markdown-BtCybfvQ.js";import"./App-BXZLGT86.js";import"./index-DAUK3rnz.js";import"./react-rd22PHbN.js";import"./tanstack-B0Sf7wNU.js";import"./base-ui-CJ8ZIx3d.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v={parser:s,get db(){return new i},renderer:t,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{v as diagram};
|