@opentig/cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +2 -1
- package/dist/chunks/{cli-B6JTojx_.mjs → cli-DNzGBqmL.mjs} +1 -1
- package/dist/client/assets/App-BbT5H97Z.js +138 -0
- package/dist/client/assets/{CreatePullRequestDialog-CAeykZ72.js → CreatePullRequestDialog-DRLeMY4e.js} +2 -2
- package/dist/client/assets/{DiffWorkspace-BRicWHvw.js → DiffWorkspace-DJX00otP.js} +1 -1
- package/dist/client/assets/{EditableFileViewer-DWeSDnZn.js → EditableFileViewer-Cmbomx5y.js} +1 -1
- package/dist/client/assets/{File-D65shwRR.js → File-4o4egqlz.js} +1 -1
- package/dist/client/assets/FilesView-TmUF-VLr.js +1 -0
- package/dist/client/assets/{GitHubAvatar-C8R3iNoM.js → GitHubAvatar-azKPrTMv.js} +1 -1
- package/dist/client/assets/HistoryView-Go6rXO0P.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-JXLHTNPm.js → HtmlFileViewer-WpYnLdMW.js} +1 -1
- package/dist/client/assets/{IconEdit-3fgBTCQ4.js → IconEdit-B8LZHB8l.js} +1 -1
- package/dist/client/assets/{IconFolderSymlink-C4ydD1eS.js → IconFolderSymlink-D29EhQPC.js} +1 -1
- package/dist/client/assets/{ImageFileViewer-YH2xhkkk.js → ImageFileViewer-1ObUacJu.js} +1 -1
- package/dist/client/assets/LocalRefsDialog-VcrlFgxR.js +1 -0
- package/dist/client/assets/{MarkdownFileViewer-BsB8WkIH.js → MarkdownFileViewer-CvsKPnvF.js} +2 -2
- package/dist/client/assets/{PairingPage-DXRyAYHn.js → PairingPage-cSoKZi8t.js} +1 -1
- package/dist/client/assets/{PierreDiffViewer-DoV3V0IW.js → PierreDiffViewer-DVTrOwX4.js} +1 -1
- package/dist/client/assets/{PierreEditBoundary-BnYZbHfi.js → PierreEditBoundary-DPtaTiUB.js} +1 -1
- package/dist/client/assets/{PierreWorkerPool-Cg9zdxiI.js → PierreWorkerPool-BxP-s6jD.js} +1 -1
- package/dist/client/assets/PullRequestDiff-DeQznd9n.js +1 -0
- package/dist/client/assets/PullRequestViewer-IhGZZs_A.js +2 -0
- package/dist/client/assets/{PullRequestsView-GStKxG7k.js → PullRequestsView-BG0xrok4.js} +1 -1
- package/dist/client/assets/QuickOpenDialog-DpmcAzTx.js +1 -0
- package/dist/client/assets/RepositoryProjectsDialog-DAzbUB3X.js +1 -0
- package/dist/client/assets/{SearchView-D5XB6wdu.js → SearchView-HoiWKG8z.js} +1 -1
- package/dist/client/assets/SettingsDialog-pmJKOaiK.js +9 -0
- package/dist/client/assets/{Viewer-Gfy3Ejyo.js → Viewer-BCk8FHrc.js} +3 -3
- package/dist/client/assets/{abnfDiagram-N423BO3Z-DdAfHevw.js → abnfDiagram-N423BO3Z-BvfKOanh.js} +1 -1
- package/dist/client/assets/{arc-C43uoeEi.js → arc-DB2nIH2Y.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-C7q0hhRO.js → architectureDiagram-T3A2C74G-Bqh4uY3R.js} +1 -1
- package/dist/client/assets/base-ui-DIP2rZxz.js +1 -0
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-C1x9Iap4.js → blockDiagram-VBNYF7ZC-DMW415Ms.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-BmKaVW6q.js → c4Diagram-5PPSVZJV-BSNPes7l.js} +1 -1
- package/dist/client/assets/channel-VcDernYy.js +1 -0
- package/dist/client/assets/{checkbox-XfIUFPxh.js → checkbox-Dta4gqy2.js} +1 -1
- package/dist/client/assets/{chunk-2GRJ4B5K-kzy_H3BQ.js → chunk-2GRJ4B5K-D-86JbWu.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-BMj-FT4X.js → chunk-2Q5K7J3B-BNI-SD-k.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-DmPGiCCb.js → chunk-5RXB4S5H-OFFYyML8.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-DYFL8__L.js → chunk-5VM5RSS4-DpE1dtnL.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-CI98oVdT.js → chunk-6Q2QTUOP-DxAnzBXJ.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-D9JiiMlX.js → chunk-GF5L2VYU-DNrTNRgr.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-D0THYpZl.js → chunk-JWPE2WC7-D-jfKyIh.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-Z1tJfyAr.js → chunk-KBJHAD2P-CIyQl_ts.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-31aS4cD3.js → chunk-RYQCIY6F-CgCYQccM.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-ClWDHmEp.js → chunk-XXDRQBXY-B31oXtqU.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-CUuEGRCt.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-CUuEGRCt.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Btg2MYLh.js → cose-bilkent-JH36ORCC-CrX-LDNw.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-Cbh4Pk6j.js → cynefin-VYW2F7L2-DnkWlsqW.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-BBqorl0u.js → cynefinDiagram-MW4NZA55-bUDQ9ElF.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-DugEItZ0.js → dagre-VZM6K2ZE-BW5Kni4n.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-Biu7dmH8.js → diagram-7IWD3JNH-1EXGwguC.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-UDm4DXFS.js → diagram-B4RE2ZJO-CzpH5ieN.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-Bcku4gb-.js → diagram-LBJQPF4R-BnKszJ_B.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-DFRjglV-.js → diagram-Q27KOJAE-DbQlD3OM.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-CgfMWtd0.js → diagram-UB23O5K3-BqZ-RSlm.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-CZzYOqs0.js → ebnfDiagram-BXEA7PRR-B2iPWDvr.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-Cdlbxgs6.js → erDiagram-JOGREHBK-aMqHrKCk.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-BgImDwpP.js → flowDiagram-UKHOOZJN-ivrTsn4D.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-SFhtiyL4.js → ganttDiagram-PKOTCBZU-IMfIqkXw.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-Bkm5ueys.js → gitGraphDiagram-DS77QQ5N-BNURRh2N.js} +1 -1
- package/dist/client/assets/{index-B5RC4THs.js → index-B3QJsvjR.js} +4 -4
- package/dist/client/assets/index-Cx9LaJW8.css +1 -0
- package/dist/client/assets/{infoDiagram-6WML65LV-pCYc-VX2.js → infoDiagram-6WML65LV-BKEENkUQ.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BtNbG3Y6.js → ishikawaDiagram-WSZJBQD7-HrCSmiTr.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-CPW2qT3y.js → journeyDiagram-NVQOT4AX-CQIuWA6F.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-wD6JXQFs.js → kanban-definition-27J2QSJJ-h4fSAkel.js} +1 -1
- package/dist/client/assets/{linear-sj8MOkmS.js → linear-BAdz-uC9.js} +1 -1
- package/dist/client/assets/{mermaid.core-CGJtfmwb.js → mermaid.core-vLn7mMZB.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-BQwLHBVs.js → mindmap-definition-FAOFIHXS-DOrZl827.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-DtDsb-Z8.js → pegDiagram-VL7TDLO6-_Vs7p633.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-B3WhqNuS.js → pieDiagram-7S7Q4E2Y-7qbB_Z16.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-CPi38pp_.js → quadrantDiagram-CIZ2JOQS-DNH8SosA.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-Btac44Ux.js → railroadDiagram-AXF67PYL-Ctazrrpa.js} +1 -1
- package/dist/client/assets/{render-markdown-hAIWRfn0.js → render-markdown-dvHhHbC0.js} +1 -1
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-CHJgDNdg.js → requirementDiagram-LRYGKXZP-BAH8dYer.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-OYJHfmtd.js → sankeyDiagram-W5VNT64P-CuffrpdF.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-9ypa9W08.js → sequenceDiagram-SI44F4Z6-CaO4fJnS.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-5ZDUTERI.js → sizeCapture-X5ZJPWSS-B_LramBU.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-nGHE1hN7.js → stateDiagram-OKZ733FA-bc7zBYHn.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-C-UGmA2d.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-BZFv9Zp8.js → swimlanes-SLNWSIFB-DQzg1IPn.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DnopIiWa.js +8 -0
- package/dist/client/assets/{tanstack-CcfAJoQ7.js → tanstack-BysN2Oew.js} +1 -1
- package/dist/client/assets/{timeline-definition-Z64GVDOM-pUIcaCIE.js → timeline-definition-Z64GVDOM-CtbuIB6K.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-D6dEIJmP.js → vennDiagram-T6HMQDX7-pYJ0ZfFS.js} +1 -1
- package/dist/client/assets/{viewer-tabs-BjG3oKQ9.js → viewer-tabs-Cnfyd6rg.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-DZ8ro_-y.js → wardleyDiagram-T6FBY63Y-DYl_Oi-Y.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-WJ2Zfmlk.js → xychartDiagram-ELKLHX3M-Cj5YUfP5.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/dev.mjs +2 -1
- package/dist/manifest.json +1 -1
- package/dist/server.mjs +779 -211
- package/dist/utility.mjs +1 -0
- package/package.json +1 -1
- package/dist/client/assets/App-Dfm5F199.js +0 -74
- package/dist/client/assets/FilesView-EfoU7sF-.js +0 -1
- package/dist/client/assets/HistoryView-C6T2dsBC.js +0 -1
- package/dist/client/assets/LocalRefsDialog--1NiYKYj.js +0 -1
- package/dist/client/assets/PullRequestDiff-D6QG5Anx.js +0 -1
- package/dist/client/assets/PullRequestViewer-jC3LVmiO.js +0 -2
- package/dist/client/assets/QuickOpenDialog-HvslpGQl.js +0 -1
- package/dist/client/assets/RepositoryProjectsDialog-Biqv5GO_.js +0 -1
- package/dist/client/assets/SettingsDialog-DWAunOQB.js +0 -72
- package/dist/client/assets/base-ui-CJ8ZIx3d.js +0 -1
- package/dist/client/assets/channel-Diwpee6E.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BDuo9kiS.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BDuo9kiS.js +0 -1
- package/dist/client/assets/index-Dc9xVluy.css +0 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CkCpE1Yu.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-Dxlb7bju.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as
|
|
1
|
+
import{j as e,r as C}from"./react-rd22PHbN.js";import{f as m,g as j,m as r,e as x,n as v,o as k,p as I,q as S,r as p,s as G,t as P}from"./App-BbT5H97Z.js";import{G as O,P as R,I as y,a as w}from"./GitHubAvatar-azKPrTMv.js";import{a as L}from"./tanstack-BysN2Oew.js";import{c as z,B as t,I as N,T as c,b as o,d as u}from"./index-B3QJsvjR.js";import{C as E}from"./checkbox-Dta4gqy2.js";import{P as q,b as D,c as H,d as T,e as $}from"./base-ui-DIP2rZxz.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=z("outline","filter","Filter",A);function Q(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Checking repository…"})]}):s.info.isGitHub?s.account?.state==="error"||s.error&&s.ghStatus===null?e.jsxs(h,{icon:e.jsx(r,{}),title:"GitHub account unavailable",children:[s.account?.message??s.error,e.jsxs("span",{className:"pulls-notice-actions",children:[e.jsx(t,{variant:"outline",size:"sm",onClick:s.onOpenGitHubSettings,children:"Open GitHub settings"}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(x,{})," Check again"]})]})]}):s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(h,{icon:e.jsx(r,{}),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(x,{})," Check again"]})]})]}):e.jsx(M,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(h,{icon:e.jsx(r,{}),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(x,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(h,{icon:e.jsx(r,{}),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 n=C.useRef(null),l=s.pulls,i=L({count:l?.length??0,getScrollElement:()=>n.current,estimateSize:()=>68,getItemKey:a=>l?.[a]?.number??a,overscan:8});return e.jsxs("div",{className:"pulls-view",children:[e.jsxs("div",{className:"pulls-toolbar",children:[e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx("span",{className:"pulls-repo"}),children:[e.jsx(r,{"aria-hidden":"true"})," ",s.nameWithOwner]}),e.jsx(u,{children:s.nameWithOwner})]}),e.jsxs(c,{children:[e.jsx(o,{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(m,{className:"animate-spin"}):e.jsx(x,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),s.account?.login&&e.jsxs(c,{children:[e.jsxs(o,{render:e.jsx(t,{variant:"ghost",size:"xs",className:"github-pulls-account",onClick:s.onOpenGitHubSettings}),children:[e.jsx(r,{})," @",s.account.login]}),e.jsx(u,{children:"Account used for this repository · open GitHub settings"})]}),e.jsxs(q,{children:[e.jsx(D,{render:e.jsx(t,{variant:b(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!b(s.states)}),children:e.jsx(F,{})}),e.jsx(H,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs($,{className:"pulls-filter-popup",children:[e.jsx("span",{className:"pulls-filter-title",children:"State"}),["OPEN","CLOSED","MERGED"].map(a=>e.jsxs("label",{htmlFor:`pulls-state-${a.toLowerCase()}`,className:"pulls-filter-option",children:[e.jsx(E,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:d=>s.onStateChange(a,d===!0)}),e.jsx(f,{state:a,className:a.toLowerCase()}),e.jsx("span",{children:a==="OPEN"?"Open":a==="CLOSED"?"Closed":"Merged"})]},a))]})})})]}),e.jsxs(c,{children:[e.jsxs(o,{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(u,{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:n,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:l===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(m,{className:"spinner"})," ",e.jsx(j,{text:"Loading pull requests…"})]}):l!==null&&l.length===0?e.jsx("p",{className:"empty-list",children:s.states.length?`No ${s.states.map(a=>g(a).toLowerCase()).join(", ")} pull requests.`:"Select at least one PR state."}):l!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const d=l[a.index];return e.jsx("div",{ref:i.measureElement,"data-index":a.index,className:"virtual-row",style:{transform:`translateY(${a.start}px)`},children:e.jsx(B,{repositoryId:s.repositoryId,pr:d,active:s.activeNumber===d.number,onSelect:s.onSelect})},a.key)})})})]})}function B({repositoryId:s,pr:n,active:l,onSelect:i}){const a=n.state.toLowerCase();return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>i(n.number),"aria-label":`View pull request #${n.number}`,children:[e.jsx("span",{className:`pull-state-icon ${a}${n.isDraft?" draft":""}`,"aria-label":n.isDraft?"Draft":g(n.state),children:e.jsx(f,{state:n.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:n.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",n.number]}),e.jsx(O,{src:n.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:n.author}),e.jsx(V,{state:n.checksState}),n.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[e.jsx("time",{dateTime:n.updatedAt,children:S(n.updatedAt)}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",n.additions]})," ",e.jsxs("span",{className:"del",children:["−",n.deletions]})]})]})]}),n.stack&&e.jsx(R,{repositoryId:s,number:n.number,membership:n.stack,onSelect:i}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>G(n.url),"aria-label":`Open #${n.number} on GitHub`}),children:e.jsx(p,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function f({state:s,className:n}){return s==="MERGED"?e.jsx(k,{"aria-hidden":"true",className:n}):e.jsx(I,{"aria-hidden":"true",className:n})}function V({state:s}){if(s==="NONE")return null;const n=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",l=s==="PASSING"?y:s==="FAILING"?w:P;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":n,children:e.jsx(l,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function b(s){return s.length===1&&s[0]==="OPEN"}function h({icon:s,title:n,children:l}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:n}),e.jsx("p",{children:l})]})}export{Q as PullRequestsView};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as f,j as e}from"./react-rd22PHbN.js";import{V as v,W as y,D as N,v as R,w as C,x as D,L as F,f as S,g as b,U as I}from"./App-BbT5H97Z.js";import{c as M}from"./index-B3QJsvjR.js";import{A as q,j as w,k as L,l as z}from"./base-ui-DIP2rZxz.js";import"./tanstack-BysN2Oew.js";const O=[["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-0"}],["path",{d:"M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",key:"svg-1"}],["path",{d:"M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",key:"svg-2"}],["path",{d:"M18.5 19.5l2.5 2.5",key:"svg-3"}]],Q=M("outline","file-search","FileSearch",O);function E(t,s){const n=[],r=c=>{for(const i of c)i.type==="directory"?r(i.children):n.push({path:i.path,name:i.name,parentPath:y(i.path)})};return r(s?t:v(t)),n}function T(t,s,{includeIgnored:n,activePath:r=null,limit:c=100}){const i=E(t,n),h=x(s).trim(),l=Math.max(0,Math.floor(c));if(!h)return i.sort((a,p)=>a.path===r?-1:p.path===r?1:k(a.path,p.path)).slice(0,l);const u=h.replace(/\s+/g,"");return i.map(a=>{const p=x(a.name),m=x(a.path),o=A(p,m,h,u);return o?{...a,rank:o}:null}).filter(a=>a!==null).sort((a,p)=>V(a.rank,p.rank)||j(a.path)-j(p.path)||k(a.path,p.path)).slice(0,l).map(a=>({path:a.path,name:a.name,parentPath:a.parentPath}))}function A(t,s,n,r){if(t===n)return[0,0,0,0];if(t.startsWith(n))return[1,0,t.length-n.length,0];const c=t.indexOf(n);if(c>=0)return[2,c,t.length-n.length,0];const i=s.indexOf(n);if(i>=0)return[3,i,s.length-n.length,0];const h=g(t,r);if(h)return[4,...h];const l=g(s,r);return l?[5,...l]:null}function g(t,s){if(!s)return null;let n=-1,r=-1,c=0,i=0;for(const h of s){const l=t.indexOf(h,n+1);if(l<0)return null;r<0&&(r=l),n>=0&&(c+=l-n-1,l===n+1&&(i+=1)),n=l}return[c,-i,r,t.length-s.length]}function V(t,s){for(let n=0;n<Math.max(t.length,s.length);n+=1){const r=(t[n]??0)-(s[n]??0);if(r!==0)return r}return 0}function x(t){return t.replace(/\\/g,"/").toLocaleLowerCase()}function j(t){return t.split("/").length}function k(t,s){return t.localeCompare(s,void 0,{sensitivity:"base"})||t.localeCompare(s)}function H({open:t,files:s,includeIgnored:n,activePath:r,onOpenChange:c,onOpenFile:i}){const[h,l]=f.useState(""),u=f.useRef(null),a=f.useMemo(()=>s?T(s,h,{includeIgnored:n,activePath:r,limit:100}):[],[r,s,n,h]);f.useEffect(()=>{t&&(l(""),window.requestAnimationFrame(()=>u.current?.focus()))},[t]);const p=o=>{i(o)&&c(!1)},m=h.trim();return e.jsx(N,{open:t,onOpenChange:c,children:e.jsxs(R,{className:"quick-open-dialog top-[max(64px,12vh)] w-[min(640px,calc(100vw-2.5rem))] -translate-y-0",children:[e.jsx(C,{className:"sr-only",children:"Open file"}),e.jsx(D,{className:"sr-only",children:"Search files in the current repository."}),e.jsxs(q,{items:a,value:h,onValueChange:l,itemToStringValue:o=>o.path,mode:"none",inline:!0,open:t,autoHighlight:"always",onOpenChange:(o,d)=>{!o&&d.reason!=="item-press"&&c(!1)},children:[e.jsxs("div",{className:"quick-open-input-shell",children:[e.jsx(F,{"aria-hidden":"true"}),e.jsx(w,{ref:u,"aria-label":"Search files by name or path",autoComplete:"off",spellCheck:!1,placeholder:"Search files by name or path"})]}),e.jsx(L,{"aria-label":"Repository files",className:"quick-open-results",children:s===null?e.jsxs("div",{className:"quick-open-status loading",role:"status",children:[e.jsx(S,{className:"spinner","aria-hidden":"true"})," ",e.jsx(b,{text:"Loading files…"})]}):a.length===0?e.jsxs("div",{className:"quick-open-status",role:"status",children:[e.jsx(Q,{"aria-hidden":"true"}),e.jsx("strong",{children:"No matching files"}),e.jsx("p",{children:m?e.jsxs(e.Fragment,{children:["Nothing matches ",e.jsx("em",{children:m})," in this repository."]}):"This repository has no files to open."})]}):a.map((o,d)=>e.jsxs(z,{value:o,index:d,className:"quick-open-result",onClick:()=>p(o.path),children:[e.jsx("img",{className:"quick-open-icon",src:I(o.path),alt:"","aria-hidden":"true",draggable:!1}),e.jsx("span",{className:"quick-open-name",children:o.name}),e.jsx("span",{className:"quick-open-parent",children:o.parentPath||"Repository root"})]},o.path))})]}),e.jsxs("footer",{className:"quick-open-footer",children:[e.jsxs("span",{className:"quick-open-hints",children:[e.jsxs("span",{children:[e.jsx("kbd",{children:"↑"}),e.jsx("kbd",{children:"↓"})," navigate"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"↵"})," open"]}),e.jsxs("span",{children:[e.jsx("kbd",{children:"Esc"})," close"]})]}),s!==null&&e.jsx("span",{className:"quick-open-count",children:a.length===100?"Top 100 matches":`${a.length} ${a.length===1?"file":"files"}`})]})]})})}export{H as QuickOpenDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as h}from"./react-rd22PHbN.js";import{X as ue,Y as J,Z as he,_ as pe,$ as ge,a0 as je,a1 as xe,a2 as ye,a3 as fe,a4 as be,M as ve,a5 as we,a6 as Ne,K as ke,a7 as Re,a8 as Ce,D as Se,v as $e,w as De,x as Te,a9 as W,aa as Me,ab as L,ac as Y,f as q,ad as Z,ae as Be,af as Q,ag as Pe,ah as Ie,y as Ee,ai as Oe}from"./App-BbT5H97Z.js";import{c as ze,T as C,b as S,B as m,d as $,o as f}from"./index-B3QJsvjR.js";import{I as _e,a as Le}from"./IconFolderSymlink-D29EhQPC.js";import"./tanstack-BysN2Oew.js";import"./base-ui-DIP2rZxz.js";const Fe=[["path",{d:"M8 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M8 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-1"}],["path",{d:"M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-2"}],["path",{d:"M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-3"}],["path",{d:"M14 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-4"}],["path",{d:"M14 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-5"}]],Ae=ze("outline","grip-vertical","GripVertical",Fe);function ee({items:r,onMove:o,draggable:p=!0,children:j}){const x=ue(J(ge,{activationConstraint:{distance:6}}),J(pe,{coordinateGetter:he}));if(!p)return j;const g=t=>r.find(i=>i.id===t)?.label??"Item";return e.jsx(je,{sensors:x,collisionDetection:xe,accessibility:{announcements:{onDragStart:({active:t})=>`Picked up ${g(t.id)}.`,onDragOver:({active:t,over:i})=>i?`${g(t.id)} at position ${r.findIndex(c=>c.id===i.id)+1}.`:void 0,onDragEnd:({active:t,over:i})=>i?`Placed ${g(t.id)} at position ${r.findIndex(c=>c.id===i.id)+1}.`:"Reordering cancelled.",onDragCancel:()=>"Reordering cancelled."}},onDragEnd:({active:t,over:i})=>{if(!i||t.id===i.id)return;const c=r.findIndex(y=>y.id===i.id);c>=0&&o(String(t.id),c)},children:e.jsx(ye,{items:r.map(t=>t.id),strategy:fe,children:j})})}function se(r){return r.draggable===!1?e.jsx("div",{className:r.className,"data-order-row":"","aria-busy":r.busy||void 0,children:r.children}):e.jsx(Ke,{...r})}function Ke({id:r,label:o,className:p,disabled:j,busy:x,children:g}){const{attributes:t,listeners:i,setNodeRef:c,setActivatorNodeRef:y,transform:B,transition:w,isDragging:b}=we({id:r,disabled:j});return e.jsxs("div",{ref:c,className:p,"data-order-row":"","aria-busy":x||void 0,"data-dragging":b||void 0,style:{transform:Ne.Transform.toString(B),transition:w},children:[e.jsxs(C,{children:[e.jsx(S,{render:e.jsx(m,{variant:"ghost",size:"icon-sm",className:"repository-order-handle",ref:y,...t,...i,"aria-label":`Reorder ${o}`,disabled:j}),children:e.jsx(Ae,{})}),e.jsx($,{children:"Drag to reorder · Space and arrow keys also work"})]}),g]})}function ae({label:r,index:o,count:p,disabled:j,onMove:x}){return e.jsxs("span",{className:"repository-order-buttons",children:[e.jsxs(C,{children:[e.jsx(S,{render:e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":`Move ${r} up`,disabled:j||o===0,onClick:g=>x(o-1,g.currentTarget)}),children:e.jsx(be,{})}),e.jsx($,{children:"Move up"})]}),e.jsxs(C,{children:[e.jsx(S,{render:e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":`Move ${r} down`,disabled:j||o===p-1,onClick:g=>x(o+1,g.currentTarget)}),children:e.jsx(ve,{})}),e.jsx($,{children:"Move down"})]})]})}const I="__opentig_no_project__";function We({open:r,projects:o,repositories:p,onOpenChange:j,onOrganizationChange:x,onForgetRepository:g,onRelocateRepository:t}){const i=ke(),c=h.useRef(null),y=h.useRef(null),[B,w]=h.useState(null),[b,E]=h.useState(null),[O,F]=h.useState(""),[D,N]=h.useState(null),[z,A]=h.useState(""),[K,T]=h.useState(null),[n,P]=h.useState(null),[G,k]=h.useState(null),re=h.useMemo(()=>new Map(o.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[o]),_=h.useMemo(()=>Re(p.map(s=>s.recent),o),[p,o]),oe=[..._.projectSections,{id:I,name:"No project",repositories:_.unassigned}].filter(s=>s.repositories.length>0),U=new Map(Ce(_).map((s,a)=>[s.key,a+1])),M=!!(n||D||K||B);h.useLayoutEffect(()=>{if(n||!y.current)return;const s=y.current;y.current=null;const a=c.current;if(!r||!a)return;a.scrollTop=s.scrollTop,(s.focused?.isConnected&&!s.focused.matches(":disabled")?s.focused:s.row?.querySelector(".repository-order-buttons button:not(:disabled)"))?.focus({preventScroll:!0}),s.saved&&s.row?.isConnected&&!window.matchMedia("(prefers-reduced-motion: reduce)").matches&&s.row.animate?.([{boxShadow:"inset 0 0 0 2px var(--ring)"},{boxShadow:"inset 0 0 0 2px transparent"}],{duration:350})},[n,o,p,r]),h.useEffect(()=>{r||(w(null),E(null),N(null),T(null),k(null))},[r]);const R=async(s,a)=>{P(s),k(null);try{const l=await a();return x(l),!0}catch(l){return k(ne(l)),!1}finally{P(null)}},ie=async s=>{s.preventDefault();const a=O.trim();!a||n||await R("create",()=>f.projects.create(a))&&F("")},te=async s=>{s.preventDefault();const a=z.trim();!D||!a||n||await R(`rename:${D}`,()=>f.projects.rename(D,a))&&N(null)},le=async s=>{n||await R(`remove:${s}`,()=>f.projects.remove(s))&&T(null)},ce=async(s,a)=>{n||await R(`assign:${s}`,()=>f.projects.assign(s,a))},H=async(s,a,l)=>{if(M)return;const v=l??(document.activeElement instanceof HTMLElement&&c.current?.contains(document.activeElement)?document.activeElement:null),d=i&&c.current?{scrollTop:c.current.scrollTop,focused:v,row:v?.closest("[data-order-row]")??null,saved:!1}:null;y.current=d,await R(s,async()=>{try{const u=await a();return d&&(d.saved=!0),u}finally{d&&c.current&&(d.scrollTop=c.current.scrollTop)}})},V=(s,a,l)=>H(`move-project:${s}`,()=>f.projects.moveProject(s,a),l),X=(s,a,l)=>H(`move-repository:${s}`,()=>f.projects.moveRepository(s,a),l),de=async s=>{if(!n){if(k(null),!window.opentigDesktop){E(s);return}P(`relocate:${s.key}`);try{const a=await f.repository.select(`Relocate ${s.name}`);a&&await t(s,a)}catch(a){k(ne(a))}finally{P(null)}}};return e.jsxs(Se,{open:r,onOpenChange:s=>{n||j(s)},children:[e.jsxs($e,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]","data-mobile":i||void 0,onKeyDown:s=>{s.key.startsWith("Arrow")&&s.target instanceof Element&&s.target.closest(".repository-order-handle")&&s.preventBaseUIHandler()},children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(De,{children:"Manage projects"}),e.jsxs(Te,{children:[i?"Use the up and down arrows to reorder projects and repositories.":"Drag projects and repositories or use the arrows to set their order."," The selector and number shortcuts follow this saved order. Files stay on disk."]})]}),e.jsx(W,{render:e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(Me,{})})]}),e.jsxs("div",{className:"repository-projects-body",ref:c,children:[G&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsx("span",{children:G})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:o.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{ie(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:O,maxLength:Y,onChange:s=>F(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(m,{type:"submit",size:"sm",disabled:!O.trim()||!!n,children:[n==="create"?e.jsx(q,{className:"animate-spin"}):e.jsx(_e,{})," Create"]})]})]}),e.jsx(ee,{draggable:!i,items:o.map(s=>({id:s.id,label:s.name})),onMove:(s,a)=>{V(s,a)},children:e.jsxs("div",{className:"repository-project-list",children:[o.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),o.map((s,a)=>{const l=s.repositoryKeys.length,v=n===`rename:${s.id}`||n===`remove:${s.id}`||n===`move-project:${s.id}`;return e.jsx(se,{draggable:!i,className:"repository-project-row",id:s.id,label:`project ${s.name}`,disabled:M,busy:v,children:D===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:d=>{te(d)},onKeyDown:d=>{d.key==="Escape"&&N(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:z,maxLength:Y,onChange:d=>A(d.target.value),disabled:!!n}),e.jsx(m,{type:"submit",size:"xs",disabled:!z.trim()||!!n,children:"Save"}),e.jsx(m,{type:"button",variant:"ghost",size:"xs",onClick:()=>N(null),disabled:!!n,children:"Cancel"})]}):K===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(m,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{le(s.id)},children:"Delete"}),e.jsx(m,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>T(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(Z,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[l," ",l===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(ae,{label:`project ${s.name}`,index:a,count:o.length,disabled:M,onMove:(d,u)=>{V(s.id,d,u)}}),e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{N(s.id),A(s.name),T(null)},children:e.jsx(Be,{})}),e.jsx(m,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{T(s.id),N(null)},children:e.jsx(Q,{})})]})]})},s.id)})]})})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:p.length})]}),e.jsx("p",{children:"Reorder within each group"})]}),p.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No repositories added yet."}),oe.map(s=>e.jsxs("div",{className:"repository-assignment-group",children:[e.jsx("h4",{children:s.name}),e.jsx(ee,{draggable:!i,items:s.repositories.map(a=>({id:a.key,label:a.name})),onMove:(a,l)=>{X(a,l)},children:e.jsx("div",{className:"repository-assignment-list",children:s.repositories.map((a,l)=>{const v=re.get(a.key)??I,d=n?.endsWith(`:${a.key}`);return e.jsx(se,{draggable:!i,className:"repository-assignment-row",id:a.key,label:`repository ${a.name}`,disabled:M,busy:d,children:B===a.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(L,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:a.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(m,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{R(`forget:${a.key}`,()=>g(a)).then(u=>{u&&w(null)})},children:"Remove"}),e.jsx(m,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>w(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{className:"repository-order-number","aria-label":`Repository shortcut ${U.get(a.key)}`,children:U.get(a.key)}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:a.name}),e.jsxs(C,{children:[e.jsx(S,{render:e.jsx("small",{}),children:Ie(a.rootPath,4)}),e.jsx($,{children:a.rootPath})]})]}),d&&e.jsx(q,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsx(Ee,{groups:[{id:"none",label:"",items:[{value:I,label:"No project",pinned:!0}]},{id:"projects",label:"Projects",items:o.map(u=>({value:u.id,label:u.name,icon:e.jsx(Z,{})}))}],value:v,onValueChange:u=>{ce(a.key,u===I?null:u)},label:`Project for ${a.name}`,triggerLabel:o.find(u=>u.id===v)?.name??"No project",placeholder:"Search projects…",disabled:!!n}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsx(ae,{label:`repository ${a.name}`,index:l,count:s.repositories.length,disabled:M,onMove:(u,me)=>{X(a.key,u,me)}}),e.jsxs(C,{children:[e.jsx(S,{render:e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${a.name}`,disabled:!!n,onClick:()=>{de(a)}}),children:e.jsx(Le,{})}),e.jsx($,{children:"Relocate repository"})]}),e.jsxs(C,{children:[e.jsx(S,{render:e.jsx(m,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${a.name} from OpenTig`,disabled:!!n,onClick:()=>{w(a.key),k(null)}}),children:e.jsx(Q,{})}),e.jsx($,{children:"Remove from OpenTig"})]})]})]})},a.key)})})})]},s.id))]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(W,{render:e.jsx(m,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(Oe,{open:b!==null,onOpenChange:s=>{s||E(null)},title:"Relocate repository",description:`Choose the existing server folder for ${b?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",initialPath:b?.recent.path,recent:p.map(s=>s.recent),onBrowse:f.repository.browseDirectories,onOpen:async s=>{b&&await t(b,s)}})]})}function ne(r){return r instanceof Error?r.message:String(r)}export{We as RepositoryProjectsDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,j as e}from"./react-rd22PHbN.js";import{V as pe,ak as A,_ as P,W as fe,q as Y,g as me}from"./App-Dfm5F199.js";import{u as xe,a as ve}from"./tanstack-CcfAJoQ7.js";import{c as x,B as k,T as W,b as D,d as O,s as m,o as J,q as je}from"./index-B5RC4THs.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),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[Q,V]=t.useState(()=>new Set),G=t.useRef(null),K=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=qe(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,q=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&G.current?.focus()},[c]),t.useEffect(()=>{d.data&&V(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=!Q.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},[Q,n]),T=ve({count:I.length,getScrollElement:()=>K.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=>V(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))??[],z=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}L(!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{L(!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:G,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:()=>{z("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||!q)&&e.jsx("div",{className:"search-summary",children:q?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:K,className:"search-results",children:[q&&!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:()=>{z(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:ze(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:()=>{z({file:s.file,match:s.match})},children:e.jsx(Z,{})})]})},a.key):null})})]})]})}function qe(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 ze(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
|
+
import{r as t,j as e}from"./react-rd22PHbN.js";import{K as pe,az as P,P as A,L as fe,g as Y,f as me}from"./App-BbT5H97Z.js";import{u as xe,a as ve}from"./tanstack-BysN2Oew.js";import{c as x,B as k,T as W,b as D,d as O,s as m,o as J,q as je}from"./index-B3QJsvjR.js";import"./base-ui-DIP2rZxz.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),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[K,Q]=t.useState(()=>new Set),G=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&&G.current?.focus()},[c]),t.useEffect(()=>{d.data&&Q(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=!K.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},[K,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=>Q(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}L(!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{L(!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(P,{}):e.jsx(A,{})}),e.jsxs("div",{className:"search-input",children:[e.jsx(fe,{"aria-hidden":"true"}),e.jsx("input",{ref:G,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(P,{}):e.jsx(A,{}),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};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{r as u,j as e}from"./react-rd22PHbN.js";import{az as mt,a_ as he,D as ie,v as ae,w as re,x as le,f as se,e as je,af as Be,a9 as oe,aa as Ee,g as He,H as X,l as be,a$ as Ss,ad as is,ao as ft,S as Ue,b as Ge,a as Ve,c as qe,d as xe,b0 as as,b1 as rs,b2 as ls,I as xt,b3 as bt,b4 as Oe,b5 as os,Q as Es,b6 as Ms,ag as As,b7 as jt,b8 as cs,b9 as vt,ba as wt,ab as We,bb as yt,bc as kt,m as Nt,bd as Ct,be as St,B as Et,y as Mt,bf as At}from"./App-BbT5H97Z.js";import{M as Rt,i as Ie,u as Rs,g as Ts,h as Tt,j as Ot,L as It,k as Pt,l as $t,p as Lt,c as P,a as q,B as j,o as ge,s as A,T as B,b as H,d as U,I as ds,w as us,q as hs,m as gs}from"./index-B3QJsvjR.js";import{r as Ft,s as zt,t as Dt,u as _t,v as Bt}from"./base-ui-DIP2rZxz.js";import{c as Os,t as Is,d as Ps,r as $s,e as Ls,b as Ht,u as Ut,k as Gt}from"./tanstack-BysN2Oew.js";import{I as ps}from"./IconEdit-B8LZHB8l.js";function ms(s,t){if(typeof s=="function")return s(t);s!=null&&(s.current=t)}function Vt(...s){return t=>{let n=!1;const i=s.map(a=>{const r=ms(a,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let a=0;a<i.length;a++){const r=i[a];typeof r=="function"?r():ms(s[a],null)}}}}function qt(...s){return u.useCallback(Vt(...s),s)}class Wt extends u.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Ie(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=n.offsetParent,a=Ie(i)&&i.offsetWidth||0,r=Ie(i)&&i.offsetHeight||0,o=getComputedStyle(n),l=this.props.sizeRef.current;l.height=parseFloat(o.height),l.width=parseFloat(o.width),l.top=n.offsetTop,l.left=n.offsetLeft,l.right=a-l.width-l.left,l.bottom=r-l.height-l.top,l.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function Kt({children:s,isPresent:t,anchorX:n,anchorY:i,root:a,pop:r}){const o=u.useId(),l=u.useRef(null),h=u.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:p}=u.useContext(Rt),g=r!==!1?s.props?.ref??s?.ref:void 0,m=qt(l,g);return u.useInsertionEffect(()=>{const{width:c,height:x,top:f,left:v,right:w,bottom:R,direction:O}=h.current;if(t||r===!1||!l.current||!c||!x)return;const G=O==="rtl",I=n==="left"?G?`right: ${w}`:`left: ${v}`:G?`left: ${v}`:`right: ${w}`,W=i==="bottom"?`bottom: ${R}`:`top: ${f}`;l.current.dataset.motionPopId=o;const y=document.createElement("style");p&&(y.nonce=p);const M=a??document.head;return M.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${o}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${c}px !important;
|
|
5
|
+
height: ${x}px !important;
|
|
6
|
+
${I}px !important;
|
|
7
|
+
${W}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{l.current?.removeAttribute("data-motion-pop-id"),M.contains(y)&&M.removeChild(y)}},[t]),e.jsx(Wt,{isPresent:t,childRef:l,sizeRef:h,pop:r,children:r===!1?s:u.cloneElement(s,{ref:m})})}const Yt=({children:s,initial:t,isPresent:n,onExitComplete:i,custom:a,presenceAffectsLayout:r,mode:o,anchorX:l,anchorY:h,root:p})=>{const g=Rs(Xt),m=u.useId(),c=u.useRef(n),x=u.useRef(i);Ts(()=>{c.current=n,x.current=i});let f=!0,v=u.useMemo(()=>(f=!1,{id:m,initial:t,isPresent:n,custom:a,onExitComplete:w=>{g.set(w,!0);for(const R of g.values())if(!R)return;i&&i()},register:w=>(g.set(w,!1),()=>{g.delete(w),!c.current&&!g.size&&x.current?.()})}),[n,g,i]);return r&&f&&(v={...v}),u.useMemo(()=>{g.forEach((w,R)=>g.set(R,!1))},[n]),u.useEffect(()=>{!n&&!g.size&&i&&i()},[n]),s=e.jsx(Kt,{pop:o==="popLayout",isPresent:n,anchorX:l,anchorY:h,root:p,children:s}),e.jsx(Tt.Provider,{value:v,children:s})};function Xt(){return new Map}const ke=s=>s.key||"";function fs(s){const t=[];return u.Children.forEach(s,n=>{u.isValidElement(n)&&t.push(n)}),t}const xs=({children:s,custom:t,initial:n=!0,onExitComplete:i,presenceAffectsLayout:a=!0,mode:r="sync",propagate:o=!1,anchorX:l="left",anchorY:h="top",root:p})=>{const[g,m]=Ot(o),c=u.useMemo(()=>fs(s),[s]),x=o&&!g?[]:c.map(ke),f=u.useRef(!0),v=u.useRef(c),w=Rs(()=>new Map),R=u.useRef(new Set),[O,G]=u.useState(c),[I,W]=u.useState(c);Ts(()=>{f.current=!1,v.current=c;for(let E=0;E<I.length;E++){const C=ke(I[E]);x.includes(C)?(w.delete(C),R.current.delete(C)):w.get(C)!==!0&&w.set(C,!1)}},[I,x.length,x.join("-")]);const y=[];if(c!==O){let E=[...c];for(let C=0;C<I.length;C++){const T=I[C],D=ke(T);x.includes(D)||(E.splice(C,0,T),y.push(T))}return r==="wait"&&y.length&&(E=y),W(fs(E)),G(c),null}const{forceRender:M}=u.useContext(It);return e.jsx(e.Fragment,{children:I.map(E=>{const C=ke(E),T=o&&!g?!1:c===I||x.includes(C),D=()=>{if(R.current.has(C))return;if(w.has(C))R.current.add(C),w.set(C,!0);else return;let F=!0;w.forEach(pe=>{pe||(F=!1)}),F&&(M?.(),W(v.current),o&&m?.(),i&&i())};return e.jsx(Yt,{isPresent:T,initial:!f.current||n?void 0:!1,custom:t,presenceAffectsLayout:a,mode:r,root:p,onExitComplete:T?void 0:D,anchorX:l,anchorY:h,children:E},C)})})};function Jt(){!Pt.current&&$t();const[s]=u.useState(Lt.current);return s}const Qt=[["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"}]],Zt=P("outline","adjustments","Adjustments",Qt);const en=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],Fs=P("outline","arrows-sort","ArrowsSort",en);const sn=[["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"}]],tn=P("outline","browser","Browser",sn);const nn=[["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"}]],an=P("outline","keyboard","Keyboard",nn);const rn=[["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"}]],ln=P("outline","link","Link",rn);const on=[["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"}]],cn=P("outline","list","List",on);const dn=[["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"}]],un=P("outline","moon","Moon",dn);const hn=[["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"}]],gn=P("outline","network","Network",hn);const pn=[["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"}]],mn=P("outline","qrcode","Qrcode",pn);const fn=[["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"}]],bs=P("outline","shield-lock","ShieldLock",fn);const xn=[["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"}]],zs=P("outline","sort-ascending","SortAscending",xn);const bn=[["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"}]],Ds=P("outline","sort-descending","SortDescending",bn);const jn=[["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"}]],_s=P("outline","sparkles","Sparkles",jn);const vn=[["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"}]],Bs=P("outline","sun","Sun",vn);const wn=[["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"}]],yn=P("outline","typography","Typography",wn);function kn({className:s,...t}){return e.jsx(Ft,{"data-slot":"accordion",className:q("w-full overflow-hidden rounded-xl border border-border",s),...t})}function Nn({className:s,...t}){return e.jsx(zt,{"data-slot":"accordion-item",className:q("not-last:border-b",s),...t})}function Cn({className:s,children:t,...n}){return e.jsx(Dt,{className:"flex",children:e.jsxs(_t,{"data-slot":"accordion-trigger",className:q("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(mt,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-transform group-aria-expanded:rotate-180 motion-reduce:transition-none"})]})})}function Sn({className:s,children:t,...n}){return e.jsx(Bt,{"data-slot":"accordion-content",className:"accordion-content",...n,children:e.jsx("div",{className:q("px-4 pb-4",s),children:t})})}function En({harness:s,preferences:t,status:n,onPreference:i}){const a=t.aiExecutablePaths[s]??"",[r,o]=u.useState(a),[l,h]=u.useState(!1),p=async g=>{h(!0);try{await i({aiExecutablePaths:{...t.aiExecutablePaths,[s]:g}})!==!1&&o(g)}finally{h(!1)}};return e.jsx(kn,{className:"ai-executable-settings",children:e.jsxs(Nn,{value:"cli-detection",children:[e.jsx(Cn,{className:"ai-executable-trigger",children:e.jsxs("span",{className:"ai-executable-heading",children:[e.jsx(Zt,{"aria-hidden":"true"}),e.jsxs("span",{children:[e.jsx("strong",{children:"Advanced CLI detection"}),e.jsx("small",{children:"Executable path and diagnostics"})]})]})}),e.jsx(Sn,{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:[he(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:g=>o(g.target.value),placeholder:"Automatic",maxLength:4096,spellCheck:!1,autoComplete:"off",disabled:l}),e.jsxs("div",{className:"ai-executable-actions",children:[e.jsx(j,{size:"sm",onClick:()=>{p(r)},disabled:l||r===a,children:"Save path"}),e.jsx(j,{size:"sm",variant:"outline",onClick:()=>{p("")},disabled:l||!a&&!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: ",Mn(n.executableSource)]})]}),n?.discoveryWarning&&e.jsx("p",{className:"ai-login-hint",children:n.discoveryWarning})]})})]})})}function Mn(s){return s==="configured"?"Configured path":s==="process-path"?"Inherited PATH":s==="user-path"?"Refreshed user PATH":"Known installation location"}function An(s){return JSON.stringify(["codex","claude","opencode","grok"].map(t=>s[t]??""))}function Hs({className:s,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full",children:e.jsx("table",{"data-slot":"table",className:q("w-full caption-bottom text-xs",s),...t})})}function Us({className:s,...t}){return e.jsx("thead",{"data-slot":"table-header",className:q("[&_tr]:border-b",s),...t})}function Gs({className:s,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:q("[&_tr:last-child]:border-0",s),...t})}function Se({className:s,...t}){return e.jsx("tr",{"data-slot":"table-row",className:q("border-b border-border transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted",s),...t})}function Vs({className:s,...t}){return e.jsx("th",{"data-slot":"table-head",className:q("h-8 whitespace-nowrap px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...t})}function qs({className:s,...t}){return e.jsx("td",{"data-slot":"table-cell",className:q("px-2 py-1.5 align-middle [&:has([role=checkbox])]:pr-0",s),...t})}const Rn={"commit-message":"commit message","pull-request-draft":"pull request draft"};function Z({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(zs,{size:13}),n==="desc"&&e.jsx(Ds,{size:13}),!n&&e.jsx(Fs,{size:13,className:"ai-log-sort-idle"})]})}const Tn=Is({rowSortingFeature:$s,sortedRowModel:Ls()}),V=Ps(),On=V.columns([V.accessor("status",{header:({column:s})=>e.jsx(Z,{column:s,label:"Status"}),cell:({getValue:s})=>{const t=s();return e.jsx(X,{variant:t==="success"?"secondary":t==="cancelled"?"outline":"destructive",children:t})}}),V.accessor("harness",{header:({column:s})=>e.jsx(Z,{column:s,label:"Harness"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),V.accessor("model",{header:({column:s})=>e.jsx(Z,{column:s,label:"Model"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})}),V.accessor("operation",{header:({column:s})=>e.jsx(Z,{column:s,label:"Task"}),cell:({getValue:s})=>Rn[s()]}),V.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(Z,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:be(s.original.at,{seconds:!0})})}),V.accessor("durationMs",{header:({column:s})=>e.jsx(Z,{column:s,label:"Duration"}),cell:({getValue:s})=>`${(s()/1e3).toFixed(1)}s`}),V.accessor(s=>(s.usage.inputTokens??0)+(s.usage.outputTokens??0),{id:"usage",header:({column:s})=>e.jsx(Z,{column:s,label:"Usage"}),cell:({row:s})=>$n(s.original)}),V.accessor("stagedFileCount",{header:({column:s})=>e.jsx(Z,{column:s,label:"Staged"}),cell:({getValue:s})=>s()??"—"}),V.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(i=>e.jsx(Pn,{text:i.text,tone:i.tone,detail:i.detail},i.key))})}})]);function In({open:s,onOpenChange:t}){const[n,i]=u.useState([]),[a,r]=u.useState(!1),[o,l]=u.useState([]),h=u.useCallback(async()=>{r(!0);try{i(await ge.ai.log())}catch(c){A.error({title:"Could not read the AI history",description:vs(c)})}finally{r(!1)}},[]);u.useEffect(()=>{s&&h()},[h,s]);const p=u.useMemo(()=>{const c=n.filter(x=>x.status==="failed").length;return{runs:n.length,failed:c,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]),g=Os({features:Tn,data:n,columns:On,onSortingChange:l,state:{sorting:o}}),m=async()=>{if(window.confirm("Delete the whole AI history? This cannot be undone."))try{await ge.ai.clearLog(),i([])}catch(c){A.error({title:"Could not clear the AI history",description:vs(c)})}};return e.jsx(ie,{open:s,onOpenChange:t,children:e.jsxs(ae,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(re,{children:"AI history"}),e.jsx(le,{children:"Recent generations on this machine. Prompts and file contents are never recorded."})]}),e.jsxs("div",{className:"ai-log-header-actions",children:[e.jsxs(j,{variant:"outline",size:"sm",disabled:a,onClick:()=>{h()},children:[a?e.jsx(se,{className:"animate-spin"}):e.jsx(je,{})," Refresh"]}),e.jsxs(j,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[e.jsx(Be,{})," Clear"]}),e.jsx(oe,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":"Close AI history"}),children:e.jsx(Ee,{})})]})]}),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:ze(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:[a&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(se,{className:"spinner"})," ",e.jsx(He,{text:"Reading history…"})]}),!a&&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(Hs,{children:[e.jsx(Us,{children:g.getHeaderGroups().map(c=>e.jsx(Se,{children:c.headers.map(x=>e.jsx(Vs,{children:x.isPlaceholder?null:e.jsx(g.FlexRender,{header:x})},x.id))},c.id))}),e.jsx(Gs,{children:g.getRowModel().rows.map(c=>e.jsx(Se,{className:c.original.status==="failed"?"ai-log-row-failed":void 0,children:c.getAllCells().map(x=>e.jsx(qs,{children:e.jsx(g.FlexRender,{cell:x})},x.id))},c.id))})]})})]})]})})}const js=140;function Pn({text:s,tone:t,detail:n}){const[i,a]=u.useState(!1),r=s.length>js?`${s.slice(0,js-1)}…`:s,o=`ai-log-note ${t??""}`;return n?e.jsxs(e.Fragment,{children:[e.jsxs(B,{children:[e.jsx(H,{render:e.jsx("button",{type:"button",className:o,onClick:()=>a(!0),"aria-label":"Read generation details"}),children:r}),e.jsx(U,{className:"max-w-md",children:n})]}),e.jsx(ie,{open:i,onOpenChange:a,children:e.jsx(ae,{className:"name-dialog",children:e.jsxs("div",{className:"name-dialog-content",children:[e.jsx(re,{children:"Generation details"}),e.jsx(le,{className:"whitespace-pre-wrap break-words",children:n}),e.jsx("div",{className:"name-dialog-actions",children:e.jsx(oe,{render:e.jsx(j,{variant:"outline"}),children:"Close"})})]})})})]}):e.jsx("span",{className:o,children:r})}function $n(s){const{inputTokens:t,outputTokens:n,costUsd:i}=s.usage;if(t===null&&n===null)return"no usage reported";const a=`${ze(t??0)} in · ${ze(n??0)} out`;return i===null?a:`${a} · $${i.toFixed(4)}`}function ze(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function vs(s){return s instanceof Error?s.message:"An unexpected error occurred."}const Ln=[{value:"system",label:"System",icon:Ss},{value:"light",label:"Light",icon:Bs},{value:"dark",label:"Dark",icon:un}],Fn=[{value:"tree",label:"Tree",icon:ft},{value:"list",label:"List",icon:cn}],zn=[{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"}],Dn=[{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"}],Pe=[0,15,30,60,120,300];function ee({label:s,description:t,children:n,toggle:i=!1}){return e.jsxs("div",{className:`settings-general-row${i?" 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 ws({label:s,options:t,value:n,onChange:i}){return e.jsx("div",{className:"settings-theme-options",role:"radiogroup","aria-label":s,children:t.map(({value:a,label:r,icon:o},l)=>e.jsxs("button",{type:"button",role:"radio","aria-checked":n===a,tabIndex:n===a?0:-1,className:`settings-theme-option${n===a?" active":""}`,onClick:()=>i(a),onKeyDown:h=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(h.key))return;h.preventDefault();const p=h.key==="Home"?0:h.key==="End"?t.length-1:(l+(["ArrowLeft","ArrowUp"].includes(h.key)?-1:1)+t.length)%t.length,g=t[p];g&&(i(g.value),h.currentTarget.parentElement?.querySelectorAll("button")[p]?.focus())},children:[e.jsx(o,{"aria-hidden":"true"}),e.jsx("span",{children:r})]},a))})}function ys({label:s,options:t,value:n,onChange:i}){const a=t.find(r=>r.value===n);return e.jsxs(Ue,{value:n,onValueChange:r=>{const o=t.find(l=>l.value===r);o&&i(o.value)},children:[e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(Ge,{className:"settings-general-select w-[220px] text-[11px] font-normal","aria-label":s,style:{fontFamily:a?.family}}),children:e.jsx(Ve,{children:a?.label??n})}),e.jsx(U,{children:a?.label})]}),e.jsx(qe,{align:"end",alignItemWithTrigger:!1,className:"settings-general-font-menu min-w-[14rem]",children:t.map(r=>e.jsx(xe,{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 $e(s){return s===0?"Off":s>=60&&s%60===0?`${s/60} ${s===60?"minute":"minutes"}`:`${s} seconds`}function _n({preferences:s,onPreference:t}){const n=u.useId(),i=u.useRef(null),[a,r]=u.useState(null),[o,l]=u.useState(!1),[h,p]=u.useState(!1),[g,m]=u.useState(!1),c=s.remoteFetchIntervalSeconds,x=()=>{r(null),l(!1),i.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(Bs,{"aria-hidden":"true"}),"Appearance"]}),e.jsx(ee,{label:"Theme",description:"Follow your system or choose a theme.",children:e.jsx(ws,{label:"Theme",options:Ln,value:s.theme,onChange:f=>t({theme:f})})}),e.jsx(ee,{label:"Interface font",description:"Menus, labels and navigation.",children:e.jsx(ys,{label:"Interface font",options:zn,value:s.uiFont,onChange:f=>t({uiFont:f})})}),e.jsx(ee,{label:"Code font",description:"Code, diffs and the file viewer.",children:e.jsx(ys,{label:"Code font",options:Dn,value:s.monoFont,onChange:f=>t({monoFont:f})})}),e.jsx(ee,{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,"%"]})]})}),g&&e.jsxs("div",{id:`${n}-preview`,className:"settings-general-preview",children:[e.jsxs("span",{children:[e.jsx(is,{"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(is,{"aria-hidden":"true"}),"Files & viewer"]}),e.jsx(ee,{label:"Changes layout",description:"Folders or a flat list.",children:e.jsx(ws,{label:"Changes layout",options:Fn,value:s.changesLayout,onChange:f=>t({changesLayout:f})})}),e.jsxs(ee,{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(ee,{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(je,{"aria-hidden":"true"}),"Repository sync"]}),e.jsx(ee,{label:"Remote check interval",description:"Keep ahead / behind counts current.",children:e.jsxs(Ue,{value:String(c),onValueChange:f=>{l(!1),f==="custom"?r(String(c||30)):f!==null&&Pe.includes(Number(f))&&(r(null),t({remoteFetchIntervalSeconds:Number(f)}))},children:[e.jsx(Ge,{ref:i,className:"settings-general-select settings-general-interval w-[174px] text-[11px] font-normal","aria-label":"Remote check interval",children:e.jsx(Ve,{children:$e(c)})}),e.jsxs(qe,{align:"end",alignItemWithTrigger:!1,className:"min-w-[14rem]",children:[Pe.map(f=>e.jsxs(xe,{value:String(f),className:"min-h-8 text-xs font-normal",children:[$e(f),f===30&&e.jsx("small",{className:"settings-general-option-note",children:"Default"})]},f)),!Pe.includes(c)&&e.jsxs(xe,{value:String(c),className:"min-h-8 text-xs font-normal",children:[$e(c),e.jsx("small",{className:"settings-general-option-note",children:"Custom"})]}),e.jsxs(xe,{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:c===0?"Periodic fetch is off.":`Checks every ${c} seconds.`}),e.jsx("button",{type:"button","aria-expanded":h,"aria-controls":`${n}-interval-help`,onClick:()=>p(!h),children:"What does Off do?"})]}),h&&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."}),a!==null&&e.jsxs("form",{className:"settings-general-custom",noValidate:!0,onSubmit:f=>{f.preventDefault();const v=Number(a);if(!Number.isFinite(v)||v<ls||v>rs||v%as!==0){l(!0);return}t({remoteFetchIntervalSeconds:v}),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:ls,max:rs,step:as,required:!0,autoFocus:!0,value:a,"aria-label":"Custom interval in seconds","aria-invalid":o,"aria-describedby":`${n}-interval-range`,onChange:f=>{r(f.target.value),l(!1)},onKeyDown:f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),x())}}),e.jsx("span",{children:"seconds"}),e.jsx(j,{type:"submit",variant:"outline",size:"sm",children:"Apply"}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:x,children:"Cancel"})]}),e.jsx("p",{id:`${n}-interval-range`,className:o?"settings-general-error":"settings-general-help-detail",role:o?"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(xt,{"aria-hidden":"true"}),"Changes apply immediately"]}),e.jsxs("button",{type:"button","aria-expanded":g,"aria-controls":`${n}-preview`,onClick:()=>m(!g),children:[e.jsx(yn,{"aria-hidden":"true"}),"Text preview"]})]})]})}function fe({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(zs,{size:13}),n==="desc"&&e.jsx(Ds,{size:13}),!n&&e.jsx(Fs,{size:13,className:"ai-log-sort-idle"})]})}const Bn=Is({rowSortingFeature:$s,sortedRowModel:Ls()}),ue=Ps(),Hn=ue.columns([ue.accessor("level",{header:({column:s})=>e.jsx(fe,{column:s,label:"Level"}),cell:({getValue:s})=>{const t=s();return e.jsx(X,{variant:t==="warn"?"outline":"destructive",children:t})}}),ue.accessor("operation",{header:({column:s})=>e.jsx(fe,{column:s,label:"Operation"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),ue.accessor("code",{header:({column:s})=>e.jsx(fe,{column:s,label:"Code"}),cell:({getValue:s})=>s()??"—"}),ue.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(fe,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:be(s.original.at,{seconds:!0})})}),ue.accessor("message",{header:({column:s})=>e.jsx(fe,{column:s,label:"Message"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})})]);function ks(s){return s instanceof Error?s.message:"An unexpected error occurred."}function Un({open:s,onOpenChange:t}){const[n,i]=u.useState([]),[a,r]=u.useState(!1),[o,l]=u.useState([]),h=u.useCallback(async()=>{r(!0);try{i(await ge.diagnostics.list())}catch(c){A.error({title:"Could not read local problems",description:ks(c)})}finally{r(!1)}},[]);u.useEffect(()=>{s&&h()},[h,s]);const p=u.useMemo(()=>({all:n.length,errors:n.filter(c=>c.level==="error").length}),[n]),g=Os({features:Bn,data:n,columns:Hn,onSortingChange:l,state:{sorting:o}}),m=async()=>{if(window.confirm("Delete the local problem history? This cannot be undone."))try{await ge.diagnostics.clear(),i([])}catch(c){A.error({title:"Could not clear local problems",description:ks(c)})}};return e.jsx(ie,{open:s,onOpenChange:t,children:e.jsxs(ae,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(re,{children:"Problem history"}),e.jsx(le,{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(j,{variant:"outline",size:"sm",disabled:a,onClick:()=>{h()},children:[a?e.jsx(se,{className:"animate-spin"}):e.jsx(je,{})," Refresh"]}),e.jsxs(j,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[e.jsx(Be,{})," Clear"]}),e.jsx(oe,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":"Close problem history"}),children:e.jsx(Ee,{})})]})]}),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:[a&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(se,{className:"spinner"})," ",e.jsx(He,{text:"Reading problems…"})]}),!a&&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(Hs,{children:[e.jsx(Us,{children:g.getHeaderGroups().map(c=>e.jsx(Se,{children:c.headers.map(x=>e.jsx(Vs,{children:x.isPlaceholder?null:e.jsx(g.FlexRender,{header:x})},x.id))},c.id))}),e.jsx(Gs,{children:g.getRowModel().rows.map(c=>e.jsx(Se,{className:c.original.level==="error"?"ai-log-row-failed":void 0,children:c.getAllCells().map(x=>e.jsx(qs,{children:e.jsx(g.FlexRender,{cell:x})},x.id))},c.id))})]})})]})]})})}const Gn=new Set(["Control","Shift","Alt","Meta"]);function Vn({preferences:s,onPreference:t}){const n=u.useMemo(()=>bt(s.shortcutOverrides),[s.shortcutOverrides]),[i,a]=u.useState(null),r=Object.keys(s.shortcutOverrides).length>0,o=u.useMemo(()=>["General","Commit","Editor","Tabs"].map(m=>({category:m,definitions:Oe.filter(c=>c.category===m)})),[]),l=u.useMemo(()=>[...new Set(os.map(m=>m.category))].map(m=>({category:m,items:os.filter(c=>c.category===m)})),[]),h=(g,m)=>{if(m===n[g]){a(null);return}const c=jt(g,m,n);if(c){const v=c==="reserved"?`${cs(m)} is reserved for a fixed shortcut.`:`${cs(m)} is already used by "${Oe.find(w=>w.id===c).label}".`;a({id:g,message:v});return}a(null);const x=Oe.find(v=>v.id===g),f={...s.shortcutOverrides};m===x.defaultCombo?delete f[g]:f[g]=m,t({shortcutOverrides:f})},p=g=>{a(null);const m={...s.shortcutOverrides};delete m[g],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(j,{variant:"outline",size:"sm",className:"shortcuts-reset-all",onClick:()=>{a(null),t({shortcutOverrides:{}})},children:[e.jsx(Es,{})," Reset all to defaults"]}),o.map(({category:g,definitions:m})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:g}),m.map(c=>e.jsxs("div",{className:"shortcuts-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:c.label}),e.jsx("span",{children:c.description})]}),e.jsx(qn,{combo:n[c.id],allowBare:c.allowBare,isCustom:s.shortcutOverrides[c.id]!==void 0,error:i?.id===c.id?i.message:null,onCapture:x=>h(c.id,x),onReset:()=>p(c.id)})]},c.id))]},g))]}),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."})]}),l.map(({category:g,items:m})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:g}),m.map(c=>e.jsxs("div",{className:"shortcuts-fixed-row",children:[e.jsx("span",{children:c.label}),e.jsx(Ms,{children:c.combo.split(" / ").flatMap((x,f)=>[...f>0?[e.jsx("span",{className:"shortcuts-fixed-sep",children:" / "},`sep-${x}`)]:[],...x.split(" + ").map((v,w)=>e.jsx(As,{children:v},`${x}-${w}`))])})]},c.combo+c.label))]},g))]})]})}function qn({combo:s,allowBare:t,isCustom:n,error:i,onCapture:a,onReset:r}){const[o,l]=u.useState(!1);return u.useEffect(()=>{if(!o)return;const h=p=>{if(p.preventDefault(),p.stopPropagation(),p.key==="Escape"){l(!1);return}if(Gn.has(p.key))return;const g=vt(p);l(!1),g&&wt(g,t)&&a(g)};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[o,t,a]),e.jsxs("div",{className:"shortcut-recorder",children:[i&&e.jsx("span",{className:"shortcut-recorder-error",children:i}),e.jsx("button",{type:"button",className:`shortcut-recorder-button ${o?"listening":""} ${i?"error":""}`,onClick:()=>l(!0),onBlur:()=>l(!1),children:o?"Press a key…":e.jsx(Ms,{children:s.split("+").map(h=>e.jsx(As,{children:h},h))})}),n&&e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"ghost",size:"icon-xs","aria-label":"Reset to default",onClick:r}),children:e.jsx(Es,{})}),e.jsx(U,{children:"Reset to default"})]})]})}function Wn(s){const t=s.trim();if(!t||t.length>2048||/[\s\\]/.test(t)||!/^https?:\/\/[^/?#]+\/?$/i.test(t))throw new Error("Enter an HTTP or HTTPS address without a path, query, fragment, or credentials.");const n=new URL(t);if(n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.pathname!=="/"||n.search||n.hash)throw new Error("Enter an HTTP or HTTPS address without a path, query, fragment, or credentials.");return n.origin}var ne=(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))(ne||{});const Kn=[0,1],Ws=[1,0],Ks=[2,3],Ys=[3,2],Yn={L:Kn,M:Ws,Q:Ks,H:Ys},Xn=/^\d*$/,Jn=/^[A-Z0-9 $%*+./:-]*$/,Le="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ke=1,Ye=40,Ns=3,Qn=3,Ne=40,Zn=10,Xs=[[-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]],Js=[[-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 ei{constructor(t,n,i,a){if(this.version=t,this.ecc=n,t<Ke||t>Ye)throw new RangeError("Version value out of range");if(a<-1||a>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 l=0;l<this.size;l++)this.modules.push(r.slice()),this.types.push(r.map(()=>0));this.drawFunctionPatterns();const o=this.addEccAndInterleave(i);if(this.drawCodewords(o),a===-1){let l=1e9;for(let h=0;h<8;h++){this.applyMask(h),this.drawFormatBits(h);const p=this.getPenaltyScore();p<l&&(a=h,l=p),this.applyMask(h)}}this.mask=a,this.applyMask(a),this.drawFormatBits(a)}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 i=0;i<this.size;i++)this.setFunctionModule(6,i,i%2===0,ne.Timing),this.setFunctionModule(i,6,i%2===0,ne.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 i=0;i<n;i++)for(let a=0;a<n;a++)i===0&&a===0||i===0&&a===n-1||i===n-1&&a===0||this.drawAlignmentPattern(t[i],t[a]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const n=this.ecc[1]<<3|t;let i=n;for(let r=0;r<10;r++)i=i<<1^(i>>>9)*1335;const a=(n<<10|i)^21522;for(let r=0;r<=5;r++)this.setFunctionModule(8,r,K(a,r));this.setFunctionModule(8,7,K(a,6)),this.setFunctionModule(8,8,K(a,7)),this.setFunctionModule(7,8,K(a,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,K(a,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,K(a,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,K(a,r));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let i=0;i<12;i++)t=t<<1^(t>>>11)*7973;const n=this.version<<12|t;for(let i=0;i<18;i++){const a=K(n,i),r=this.size-11+i%3,o=Math.floor(i/3);this.setFunctionModule(r,o,a),this.setFunctionModule(o,r,a)}}drawFinderPattern(t,n){for(let i=-4;i<=4;i++)for(let a=-4;a<=4;a++){const r=Math.max(Math.abs(a),Math.abs(i)),o=t+a,l=n+i;o>=0&&o<this.size&&l>=0&&l<this.size&&this.setFunctionModule(o,l,r!==2&&r!==4,ne.Position)}}drawAlignmentPattern(t,n){for(let i=-2;i<=2;i++)for(let a=-2;a<=2;a++)this.setFunctionModule(t+a,n+i,Math.max(Math.abs(a),Math.abs(i))!==1,ne.Alignment)}setFunctionModule(t,n,i,a=ne.Function){this.modules[n][t]=i,this.types[n][t]=a}addEccAndInterleave(t){const n=this.version,i=this.ecc;if(t.length!==Ce(n,i))throw new RangeError("Invalid argument");const a=Js[i[0]][n],r=Xs[i[0]][n],o=Math.floor(De(n)/8),l=a-o%a,h=Math.floor(o/a),p=[],g=ci(r);for(let c=0,x=0;c<a;c++){const f=t.slice(x,x+h-r+(c<l?0:1));x+=f.length;const v=di(f,g);c<l&&f.push(0),p.push(f.concat(v))}const m=[];for(let c=0;c<p[0].length;c++)p.forEach((x,f)=>{(c!==h-r||f>=l)&&m.push(x[c])});return m}drawCodewords(t){if(t.length!==Math.floor(De(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let i=this.size-1;i>=1;i-=2){i===6&&(i=5);for(let a=0;a<this.size;a++)for(let r=0;r<2;r++){const o=i-r,h=(i+1&2)===0?this.size-1-a:a;!this.types[h][o]&&n<t.length*8&&(this.modules[h][o]=K(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 i=0;i<this.size;i++){let a;switch(t){case 0:a=(i+n)%2===0;break;case 1:a=n%2===0;break;case 2:a=i%3===0;break;case 3:a=(i+n)%3===0;break;case 4:a=(Math.floor(i/3)+Math.floor(n/2))%2===0;break;case 5:a=i*n%2+i*n%3===0;break;case 6:a=(i*n%2+i*n%3)%2===0;break;case 7:a=((i+n)%2+i*n%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[n][i]&&a&&(this.modules[n][i]=!this.modules[n][i])}}getPenaltyScore(){let t=0;for(let r=0;r<this.size;r++){let o=!1,l=0;const h=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[r][p]===o?(l++,l===5?t+=Ns:l>5&&t++):(this.finderPenaltyAddHistory(l,h),o||(t+=this.finderPenaltyCountPatterns(h)*Ne),o=this.modules[r][p],l=1);t+=this.finderPenaltyTerminateAndCount(o,l,h)*Ne}for(let r=0;r<this.size;r++){let o=!1,l=0;const h=[0,0,0,0,0,0,0];for(let p=0;p<this.size;p++)this.modules[p][r]===o?(l++,l===5?t+=Ns:l>5&&t++):(this.finderPenaltyAddHistory(l,h),o||(t+=this.finderPenaltyCountPatterns(h)*Ne),o=this.modules[p][r],l=1);t+=this.finderPenaltyTerminateAndCount(o,l,h)*Ne}for(let r=0;r<this.size-1;r++)for(let o=0;o<this.size-1;o++){const l=this.modules[r][o];l===this.modules[r][o+1]&&l===this.modules[r+1][o]&&l===this.modules[r+1][o+1]&&(t+=Qn)}let n=0;for(const r of this.modules)n=r.reduce((o,l)=>o+(l?1:0),n);const i=this.size*this.size,a=Math.ceil(Math.abs(n*20-i*10)/i)-1;return t+=a*Zn,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,i=[6];for(let a=this.size-7;i.length<t;a-=n)i.splice(1,0,a);return i}}finderPenaltyCountPatterns(t){const n=t[1],i=n>0&&t[2]===n&&t[3]===n*3&&t[4]===n&&t[5]===n;return(i&&t[0]>=n*4&&t[6]>=n?1:0)+(i&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,i){return t&&(this.finderPenaltyAddHistory(n,i),n=0),n+=this.size,this.finderPenaltyAddHistory(n,i),this.finderPenaltyCountPatterns(i)}finderPenaltyAddHistory(t,n){n[0]===0&&(t+=this.size),n.pop(),n.unshift(t)}}function J(s,t,n){if(t<0||t>31||s>>>t)throw new RangeError("Value out of range");for(let i=t-1;i>=0;i--)n.push(s>>>i&1)}function K(s,t){return(s>>>t&1)!==0}class Xe{constructor(t,n,i){if(this.mode=t,this.numChars=n,this.bitData=i,n<0)throw new RangeError("Invalid argument");this.bitData=i.slice()}getData(){return this.bitData.slice()}}const si=[1,10,12,14],ti=[2,9,11,13],ni=[4,8,16,16];function Qs(s,t){return s[Math.floor((t+7)/17)+1]}function Zs(s){const t=[];for(const n of s)J(n,8,t);return new Xe(ni,s.length,t)}function ii(s){if(!et(s))throw new RangeError("String contains non-numeric characters");const t=[];for(let n=0;n<s.length;){const i=Math.min(s.length-n,3);J(Number.parseInt(s.substring(n,n+i),10),i*3+1,t),n+=i}return new Xe(si,s.length,t)}function ai(s){if(!st(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 i=Le.indexOf(s.charAt(n))*45;i+=Le.indexOf(s.charAt(n+1)),J(i,11,t)}return n<s.length&&J(Le.indexOf(s.charAt(n)),6,t),new Xe(ti,s.length,t)}function ri(s){return s===""?[]:et(s)?[ii(s)]:st(s)?[ai(s)]:[Zs(oi(s))]}function et(s){return Xn.test(s)}function st(s){return Jn.test(s)}function li(s,t){let n=0;for(const i of s){const a=Qs(i.mode,t);if(i.numChars>=1<<a)return Number.POSITIVE_INFINITY;n+=4+a+i.bitData.length}return n}function oi(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 De(s){if(s<Ke||s>Ye)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 Ce(s,t){return Math.floor(De(s)/8)-Xs[t[0]][s]*Js[t[0]][s]}function ci(s){if(s<1||s>255)throw new RangeError("Degree out of range");const t=[];for(let i=0;i<s-1;i++)t.push(0);t.push(1);let n=1;for(let i=0;i<s;i++){for(let a=0;a<t.length;a++)t[a]=_e(t[a],n),a+1<t.length&&(t[a]^=t[a+1]);n=_e(n,2)}return t}function di(s,t){const n=t.map(i=>0);for(const i of s){const a=i^n.shift();n.push(0),t.forEach((r,o)=>n[o]^=_e(r,a))}return n}function _e(s,t){if(s>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let i=7;i>=0;i--)n=n<<1^(n>>>7)*285,n^=(t>>>i&1)*s;return n}function ui(s,t,n=1,i=40,a=-1,r=!0){if(!(Ke<=n&&n<=i&&i<=Ye)||a<-1||a>7)throw new RangeError("Invalid value");let o,l;for(o=n;;o++){const m=Ce(o,t)*8,c=li(s,o);if(c<=m){l=c;break}if(o>=i)throw new RangeError("Data too long")}for(const m of[Ws,Ks,Ys])r&&l<=Ce(o,m)*8&&(t=m);const h=[];for(const m of s){J(m.mode[0],4,h),J(m.numChars,Qs(m.mode,o),h);for(const c of m.getData())h.push(c)}const p=Ce(o,t)*8;J(0,Math.min(4,p-h.length),h),J(0,(8-h.length%8)%8,h);for(let m=236;h.length<p;m^=253)J(m,8,h);const g=Array.from({length:Math.ceil(h.length/8)},()=>0);return h.forEach((m,c)=>g[c>>>3]|=m<<7-(c&7)),new ei(o,t,g,a)}function hi(s,t){const{ecc:n="L",boostEcc:i=!1,minVersion:a=1,maxVersion:r=40,maskPattern:o=-1,border:l=1}=t||{},h=typeof s=="string"?ri(s):Array.isArray(s)?[Zs(s)]:void 0;if(!h)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof s}`);const p=ui(h,Yn[n],a,r,o,i),g=gi({version:p.version,maskPattern:p.mask,size:p.size,data:p.modules,types:p.types},l);return t?.invert&&(g.data=g.data.map(m=>m.map(c=>!c))),t?.onEncoded?.(g),g}function gi(s,t=1){if(!t)return s;const{size:n}=s,i=n+t*2;s.size=i,s.data.forEach(r=>{for(let o=0;o<t;o++)r.unshift(!1),r.push(!1)});for(let r=0;r<t;r++)s.data.unshift(Array.from({length:i},o=>!1)),s.data.push(Array.from({length:i},o=>!1));const a=ne.Border;s.types.forEach(r=>{for(let o=0;o<t;o++)r.unshift(a),r.push(a)});for(let r=0;r<t;r++)s.types.unshift(Array.from({length:i},o=>a)),s.types.push(Array.from({length:i},o=>a));return s}function Cs(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function pi(s,t={}){const n=hi(s,t),{pixelSize:i=10,whiteColor:a="white",blackColor:r="black"}=t,o=n.size*i,l=n.size*i;let h=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${l} ${o}">`;const p=[];for(let g=0;g<n.size;g++)for(let m=0;m<n.size;m++){const c=m*i,x=g*i;n.data[g][m]&&p.push(`M${c},${x}h${i}v${i}h-${i}z`)}return h+=`<rect fill="${Cs(a)}" width="${l}" height="${o}"/>`,h+=`<path fill="${Cs(r)}" d="${p.join("")}"/>`,h+="</svg>",h}async function mi(){const s=await fetch("/api/auth/sessions",{credentials:"include"});if(!s.ok)throw new Error(await Je(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 fi(s){return tt("/api/auth/sessions/revoke",{sessionId:s})}async function xi(){return tt("/api/auth/sessions/revoke-all",{})}async function bi(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 Je(n,"Could not rename the browser session."))}async function tt(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 Je(n,"Could not revoke the browser session."));const i=await n.json();if(!Number.isSafeInteger(i.revokedCount)||Number(i.revokedCount)<0)throw new Error("OpenTig returned an invalid revocation result.");return Number(i.revokedCount)}async function Je(s,t){try{const n=await s.json();return typeof n.error=="string"?n.error:t}catch{return t}}class ji{generation=0;pending=!1;begin(){return this.pending?null:(this.pending=!0,++this.generation)}dismiss(){this.generation++}isCurrent(t){return t===this.generation}finish(t){return this.pending=!1,this.isCurrent(t)}}async function vi(){return nt("/api/auth/web-access")}async function wi(){return nt("/api/auth/pairing-link","POST")}async function nt(s,t="GET"){const n=await fetch(s,{method:t,credentials:"include"}),i=await n.json();if(!n.ok)throw new Error(typeof i?.error=="string"?i.error:"Could not read web access information.");return i}const yi={starting:"Starting",ready:"Ready",restarting:"Restarting",failed:"Failed",stopped:"Stopped"};function ki(){const s=window.opentigDesktop?.webAccess,[t,n]=u.useState(null),[i,a]=u.useState(null),[r,o]=u.useState([]),[l,h]=u.useState(null),[p,g]=u.useState("local"),[m,c]=u.useState(""),[x,f]=u.useState(!1),[v,w]=u.useState(""),[R,O]=u.useState(null),G=u.useRef(null),[I,W]=u.useState(!1),[y,M]=u.useState(!1),[E,C]=u.useState(null),T=u.useRef(new ji),D=u.useRef(null),F=u.useRef(!0),[pe,Me]=u.useState(!0),[b,k]=u.useState(null),[$,Q]=u.useState(null),[z,ce]=u.useState(null),[Qe,Ae]=u.useState(null),[Re,Ze]=u.useState(""),es=t?.webAccessEnabled&&t.listeningOnLan?t.networkEndpoints.filter(d=>t.pairingEndpoints.includes(d)):[],me=s?p==="public"?t?.publicOrigin??"":p==="lan"?m:t?.localEndpoint??"":window.location.origin,ve=p==="public"&&(!t?.publicOrigin||x),de=s?t?.webAccessEnabled:i?.webAccessEnabled,ss=de&&(s?t?.serverState==="ready"&&t.pairingEndpoints.includes(me)&&!ve:i?.ready)&&b===null&&!I,it=[{value:"local",label:"Local"},...es.length?[{value:"lan",label:"LAN"}]:[],{value:"public",label:"My domain"}],L=u.useCallback(()=>{T.current.dismiss(),D.current=null,h(null),M(!1)},[]);u.useEffect(()=>{const d=T.current;return F.current=!0,()=>{F.current=!1,d.dismiss()}},[]),u.useEffect(()=>{w(t?.publicOrigin??"")},[t?.publicOrigin]),u.useEffect(()=>{de===!1&&(L(),f(!1),O(null),w(t?.publicOrigin??""))},[de,t?.publicOrigin,L]),u.useEffect(()=>{de&&ve&&G.current?.focus()},[de,ve]),u.useEffect(()=>{L()},[me,L]),u.useEffect(()=>{if(!l||E===null)return;const d=window.setTimeout(()=>{T.current.isCurrent(E)&&L()},Math.max(0,Date.parse(l.expiresAt)-Date.now()));return()=>window.clearTimeout(d)},[l,E,L]);const te=u.useCallback(async(d=!0)=>{const S=D.current,N=await Promise.allSettled([s?s.getStatus().then(ye=>{F.current&&n(ye)}):vi().then(ye=>{F.current&&(a(ye),!ye.pairingAvailable&&S!==null&&T.current.isCurrent(S)&&L())}),mi()]);F.current&&(N[0].status==="rejected"&&d&&A.error({title:"Could not read web access status",description:_(N[0].reason)}),N[1].status==="fulfilled"?o(N[1].value):d&&A.error({title:"Could not read owner sessions",description:_(N[1].reason)}),Me(!1))},[s,L]);u.useEffect(()=>{te();const d=window.setInterval(()=>{te(!1)},2e3);return()=>window.clearInterval(d)},[te]),u.useEffect(()=>{if(!t)return;const d=t.listeningOnLan?t.networkEndpoints.filter(S=>t.pairingEndpoints.includes(S)):[];d.includes(m)||c(d[0]??""),p==="lan"&&d.length===0&&g("local")},[m,p,t]);const ts=u.useMemo(()=>l?`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(pi(l.url,{ecc:"M",border:2}))}`:null,[l]),Te=u.useMemo(()=>l?new URLSearchParams(new URL(l.url).hash.slice(1)).get("token")??"":"",[l]);if(pe&&!(s?t:i)&&r.length===0)return e.jsxs("div",{className:"web-access-loading",role:"status",children:[e.jsx(se,{className:"animate-spin"})," Loading web access…"]});const at=async d=>{if(s){k("toggle"),L();try{n(await s.setEnabled(d)),A.success({title:d?"Web access enabled":"Web access paused; paired devices saved"})}catch(S){A.error({title:"Could not change web access",description:_(S)}),await te(!1)}finally{k(null),Q(null)}}},rt=async d=>{if(s){k("lan"),L();try{n(await s.setLanEnabled(d))}catch(S){A.error({title:"Could not change LAN access",description:_(S)}),await te(!1)}finally{k(null)}}},ns=async(d=!1)=>{if(!s)return;O(null);let S;try{const N=v.trim();S=d?"":Wn(N&&!N.includes("://")?`https://${N}`:N)}catch(N){O(_(N));return}k("origin"),L();try{const N=await s.setPublicOrigin(S);n(N),w(N.publicOrigin??""),f(!1),g(N.publicOrigin?"public":"local")}catch(N){O(_(N))}finally{k(null)}},lt=d=>{L(),g(d),f(!1),w(t?.publicOrigin??""),O(null)},ot=()=>{w(t?.publicOrigin??""),O(null),f(!1),t?.publicOrigin||g("local")},ct=async()=>{if(!ss)return;const d=T.current.begin();if(d!==null){h(null),C(d),M(!0),W(!0);try{const S=await(s?s.createPairingLink(me):wi());F.current&&T.current.isCurrent(d)&&(D.current=d,h(S))}catch(S){F.current&&T.current.isCurrent(d)&&(M(!1),A.error({title:"Could not create pairing link",description:_(S)}))}finally{T.current.finish(d),F.current&&W(!1)}}},dt=async()=>{if(l)try{await us(l.url),A.success({title:"Pairing link copied"})}catch(d){A.error({title:"Could not copy pairing link",description:_(d)})}},ut=async()=>{if(Te)try{await us(Te),A.success({title:"Pairing code copied"})}catch(d){A.error({title:"Could not copy pairing code",description:_(d)})}},ht=async()=>{const d=Qe,S=Re.trim();if(!(!d||!S||S.length>64)){k(`rename:${d.id}`);try{await bi(d.id,S),A.success({title:"Device renamed"}),await te(!1),Ae(null)}catch(N){A.error({title:"Could not rename device",description:_(N)})}finally{k(null)}}},gt=async()=>{const d=z;if(!d)return;const S=d==="all"?"revoke-all":`revoke:${d.id}`;k(S);try{const N=d==="all"?await xi():await fi(d.id);h(null),A.success({title:`${N} browser ${N===1?"session":"sessions"} revoked`}),await te(!1)}catch(N){A.error({title:"Could not revoke session",description:_(N)})}finally{k(null),ce(null)}},we=t?.serverState==="ready",pt=r.filter(d=>d.kind!=="desktop");return e.jsxs("div",{className:"web-access-settings",children:[!s&&i&&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:"Web access"}),e.jsx("span",{children:i.webAccessEnabled?"Browser access is enabled on this server.":"Browser access is paused on this server."})]}),e.jsx(X,{variant:"secondary",children:i.webAccessEnabled?"On":"Off"})]}),e.jsxs("div",{className:"web-access-server-network settings-field-separated",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:"Direct connections from other devices on the server's network."})]}),e.jsx(X,{variant:"outline",children:i.listeningOnLan?"On":"Off"})]}),e.jsx("p",{className:"web-access-hint",children:i.listeningOnLan?"Direct LAN connections are allowed. Browsers still need pairing; tunnel access remains available.":"Direct LAN access is off. You can still connect and pair browsers through your tunnel."}),e.jsxs("details",{className:"web-access-connection-details",children:[e.jsxs("summary",{children:["Connection details ",e.jsx("span",{children:"Managed on the server"})]}),e.jsxs("div",{className:"web-access-facts",children:[e.jsx(Y,{label:"Server status",children:e.jsx(X,{variant:"secondary",children:i.ready?"Ready":"Starting"})}),e.jsx(Y,{label:"Listening on",children:e.jsx("span",{children:i.listeningOnLan?i.listenerHost:"This server only (loopback)"})}),e.jsx(Y,{label:"Actual port",children:e.jsx("code",{children:i.actualPort})}),e.jsx(Y,{label:"Browser address",children:e.jsx(Fe,{value:me})})]}),e.jsx("p",{className:"web-access-hint",children:"LAN access is configured on the server."})]})]})]}),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:"Web access"}),e.jsx("span",{children:"Allow paired browsers to use OpenTig. Turning this off disconnects browsers but keeps paired devices. Enable it again to restore their access; the desktop stays connected."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"Web access","aria-checked":t.webAccessEnabled,className:"settings-switch",disabled:b!==null||!we,onClick:()=>Q(t.webAccessEnabled?"disable":"enable"),children:e.jsx("span",{})})]}),e.jsxs("div",{className:"web-access-facts","aria-live":"polite",children:[e.jsx(Y,{label:"Server status",children:e.jsx(X,{variant:we?"secondary":"outline",children:yi[t.serverState]})}),e.jsx(Y,{label:"Actual port",children:e.jsx("code",{children:t.actualPort??"Unavailable"})}),e.jsx(Y,{label:"Listening on",children:e.jsx("span",{children:t.listeningOnLan?"All network interfaces":"This computer (loopback)"})}),e.jsx(Y,{label:"Local endpoint",children:e.jsx(Fe,{value:t.localEndpoint})}),e.jsxs("div",{className:"web-access-summary web-access-network-settings",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"LAN access"}),e.jsx("span",{children:"Allow direct connections from this computer's network. Cloudflare Tunnel on this PC works with LAN access off. Changing LAN access restarts the listener."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"LAN access","aria-checked":t.listeningOnLan,className:"settings-switch",disabled:!t.webAccessEnabled||b!==null||!we,onClick:()=>{rt(!t.listeningOnLan)},children:e.jsx("span",{})})]}),e.jsx(Y,{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(d=>e.jsx(Fe,{value:d,muted:!t.webAccessEnabled||!t.listeningOnLan},d))})})]}),t.restartError&&e.jsxs("div",{className:"web-access-error",role:"alert",children:[e.jsx(We,{})," ",e.jsx("span",{children:t.restartError})]}),!t.webAccessEnabled&&e.jsx("p",{className:"web-access-hint",children:"Browser access is paused, including through tunnels. Paired devices are saved; the private desktop session stays connected."})]}),de&&e.jsxs(e.Fragment,{children:[e.jsx("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:s?"Choose where to open your five-minute, one-use link.":"Create a five-minute, one-use link for another browser."})]})}),e.jsxs("div",{className:"web-access-pairing-options",children:[s&&t?e.jsxs(e.Fragment,{children:[e.jsxs("fieldset",{className:"web-access-destinations",disabled:b!==null,children:[e.jsx("legend",{className:"sr-only",children:"Pairing destination"}),it.map(({value:d,label:S})=>e.jsxs("label",{children:[e.jsx("input",{type:"radio",name:"web-access-destination",value:d,checked:p===d,onChange:()=>lt(d)}),S]},d))]}),p==="public"?e.jsx("div",{className:"web-access-domain",children:ve?e.jsxs("form",{onSubmit:d=>{d.preventDefault(),ns()},children:[e.jsx("label",{htmlFor:"web-access-public-origin",children:"Your domain"}),e.jsx("input",{ref:G,id:"web-access-public-origin",className:"web-access-rename-input",value:v,onChange:d=>{w(d.target.value),O(null)},placeholder:"https://git.example.com","aria-invalid":R!==null,"aria-describedby":`web-access-origin-help${R?" web-access-origin-error":""}`,maxLength:2048,disabled:b!==null,autoComplete:"off",spellCheck:!1,inputMode:"url"}),e.jsx("p",{id:"web-access-origin-help",className:"web-access-hint",children:"Your tunnel address, without a path. It will be used in the link and QR. Point your tunnel at the local endpoint shown above."}),R&&e.jsx("p",{id:"web-access-origin-error",className:"web-access-error",role:"alert",children:R}),e.jsxs("div",{className:"web-access-domain-actions",children:[e.jsx(j,{type:"submit",size:"sm",disabled:b!==null||!v.trim(),children:"Save and use"}),e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:ot,disabled:b!==null,children:"Cancel"}),t.publicOrigin&&e.jsx(j,{type:"button",variant:"ghost",size:"sm",onClick:()=>{ns(!0)},disabled:b!==null,children:"Remove"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"web-access-saved-domain",children:[e.jsx("code",{children:t.publicOrigin}),e.jsxs(j,{variant:"ghost",size:"sm",onClick:()=>{L(),f(!0)},disabled:b!==null,children:[e.jsx(ps,{})," Edit"]})]}),e.jsx("p",{className:"web-access-hint",children:"Saved and selected for this link and QR."})]})}):p==="lan"?e.jsxs("div",{className:"web-access-endpoint-select",children:[e.jsx("label",{htmlFor:"web-access-endpoint",children:"Network address"}),e.jsxs(Ue,{value:m,onValueChange:d=>{d&&c(d)},disabled:b!==null,children:[e.jsx(Ge,{id:"web-access-endpoint",className:"w-full",children:e.jsx(Ve,{children:m})}),e.jsx(qe,{alignItemWithTrigger:!1,children:e.jsx(yt,{children:es.map(d=>e.jsx(xe,{value:d,children:d},d))})})]})]}):e.jsx("p",{className:"web-access-hint",children:"For a browser on this computer."})]}):e.jsx("p",{className:"web-access-hint",children:"The link and QR use this browser's address, including when you connect through a tunnel. Creating a new link replaces any unused link."}),e.jsxs("div",{className:"web-access-link-destination",children:[e.jsx("span",{children:"Address for the link and QR"}),e.jsx("code",{children:me||(p==="public"?"Add your domain above":"Unavailable")})]}),e.jsxs(j,{size:"sm",onClick:()=>{ct()},disabled:!ss,children:[I?e.jsx(se,{className:"animate-spin"}):e.jsx(ln,{})," Create pairing link"]})]}),y&&e.jsxs("div",{className:"web-access-pairing",role:"status",children:[e.jsxs("div",{className:"web-access-pairing-copy",children:[l?e.jsx(mn,{"aria-hidden":"true"}):e.jsx(se,{className:"animate-spin","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("strong",{children:l?"Pairing link ready":"Creating pairing link…"}),e.jsx("span",{children:l?`Expires ${be(l.expiresAt,{seconds:!0})}.`:"You can close this while the link is being created."})]}),e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":"Close pairing link",onClick:L}),children:e.jsx(Ee,{})}),e.jsx(U,{children:"Close pairing link"})]})]}),l&&e.jsxs(e.Fragment,{children:[ts&&e.jsx("img",{src:ts,alt:"QR code for the one-use OpenTig pairing link"}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(B,{children:[e.jsx(H,{render:e.jsx("code",{className:"web-access-link"}),children:l.url}),e.jsx(U,{side:"bottom",children:"One-use link; do not share publicly"})]}),e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing link",onClick:()=>{dt()}}),children:e.jsx(ds,{})}),e.jsx(U,{children:"Copy pairing link"})]})]}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(B,{children:[e.jsx(H,{render:e.jsx("code",{className:"web-access-link"}),children:Te}),e.jsx(U,{side:"bottom",children:"Paste this code on any /pair page served by this OpenTig instance"})]}),e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing code",onClick:()=>{ut()}}),children:e.jsx(ds,{})}),e.jsx(U,{children:"Copy pairing code"})]})]}),e.jsx("p",{className:"web-access-hint",children:"Closing hides this code. A copied code remains valid until used, replaced, or expired. Turning off Web access invalidates it."})]})]})]}),e.jsxs("div",{className:"web-access-session-heading settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Owner sessions"}),e.jsxs("span",{children:[s?"Desktop authentication stays private. ":"","Paired browsers can be renamed or disconnected individually."]})]}),e.jsxs(j,{variant:"destructive",size:"sm",onClick:()=>ce("all"),disabled:pt.length===0||b!==null,children:[e.jsx(bs,{})," Revoke browsers"]})]}),e.jsx("div",{className:"web-access-session-list","aria-live":"polite",children:r.length===0?e.jsx("div",{className:"web-access-empty-session",children:"No owner sessions found."}):r.map(d=>e.jsxs("div",{className:"web-access-session",children:[e.jsx("div",{className:`web-access-session-icon ${d.connected?"connected":""}`,children:d.kind==="desktop"?e.jsx(Ss,{}):e.jsx(tn,{})}),e.jsxs("div",{className:"web-access-session-copy",children:[e.jsxs("div",{children:[e.jsx("strong",{children:d.clientName}),d.current&&e.jsx(X,{variant:"secondary",children:"This session"}),d.kind==="desktop"&&e.jsx(X,{variant:"outline",children:"Desktop"})]}),e.jsxs("span",{children:[d.connected?`Connected${d.connectionCount>1?` (${d.connectionCount} tabs)`:""}`:d.lastConnectedAt?`Last connected ${be(d.lastConnectedAt,{seconds:!0})}`:"Not yet connected"," · ",d.browser&&d.os?`${d.browser} on ${d.os}`:d.browser??d.os??Ni(d.deviceType),d.viaProxy?" · Via proxy":"",d.remoteAddress?` · ${d.remoteAddress}`:""]})]}),d.kind!=="desktop"&&e.jsxs("div",{className:"web-access-session-controls",children:[e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${d.clientName}`,onClick:()=>{Ae(d),Ze(d.clientName)},disabled:b!==null}),children:e.jsx(ps,{})}),e.jsx(U,{children:"Rename this device"})]}),e.jsxs(B,{children:[e.jsx(H,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":`Revoke ${d.clientName} session`,onClick:()=>ce(d),disabled:b!==null}),children:e.jsx(Be,{})}),e.jsx(U,{children:"Revoke this browser session"})]})]})]},d.id))}),e.jsx(ie,{open:$!==null,onOpenChange:d=>{d||Q(null)},children:e.jsxs(ae,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(re,{children:$==="disable"?"Disable Web access?":"Enable browser access?"}),e.jsx(le,{children:$==="disable"?"Connected browsers will disconnect and cannot access OpenTig until Web access is enabled again. Paired devices stay saved and can reconnect with their valid sessions. The desktop stays connected.":"Paired browsers can edit or delete files and act with your OS user permissions. Saved paired devices can reconnect. Use only devices you trust. LAN exposure is configured separately."})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(oe,{render:e.jsx(j,{variant:"ghost"}),children:"Cancel"}),e.jsx(j,{variant:$==="disable"?"destructive":"default",onClick:()=>{at($==="enable")},disabled:b!==null||!we,children:$==="disable"?"Disable Web access":"Enable Web access"})]})]})}),e.jsx(ie,{open:z!==null,onOpenChange:d=>{d||ce(null)},children:e.jsxs(ae,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(re,{children:z==="all"?"Revoke all browser sessions?":"Revoke this browser session?"}),e.jsx(le,{children:z==="all"?"Every paired browser disconnects immediately. The private desktop session remains signed in.":z?.current?"This browser will disconnect immediately and require a new pairing link.":"That browser disconnects immediately and will require a new pairing link."}),z&&z!=="all"&&e.jsx("div",{className:"undo-commit-summary",children:e.jsx("strong",{children:z.clientName})})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(oe,{render:e.jsx(j,{variant:"ghost"}),children:"Cancel"}),e.jsxs(j,{variant:"destructive",onClick:()=>{gt()},disabled:b!==null,children:[e.jsx(bs,{})," Revoke"]})]})]})}),e.jsx(ie,{open:Qe!==null,onOpenChange:d=>{d||Ae(null)},children:e.jsxs(ae,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(re,{children:"Rename paired device"}),e.jsx(le,{children:"Use a name that makes this browser easy to identify later."}),e.jsx("input",{className:"web-access-rename-input",value:Re,onChange:d=>Ze(d.target.value),maxLength:64,"aria-label":"Device name",autoComplete:"off"})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(oe,{render:e.jsx(j,{variant:"ghost"}),children:"Cancel"}),e.jsx(j,{onClick:()=>{ht()},disabled:b!==null||!Re.trim(),children:"Save"})]})]})})]})}function Y({label:s,children:t}){return e.jsxs("div",{className:"web-access-fact",children:[e.jsx("span",{children:s}),e.jsx("div",{children:t})]})}function Fe({value:s,muted:t=!1}){return s?e.jsxs(B,{children:[e.jsx(H,{render:e.jsx("code",{className:t?"muted":void 0}),children:s}),e.jsx(U,{side:"bottom",children:t?"Enable Web access and LAN access to use this endpoint":s})]}):e.jsx("span",{children:"Unavailable"})}function Ni(s){return s==="desktop"?"Desktop browser":s==="mobile"?"Mobile browser":s==="tablet"?"Tablet browser":s==="bot"?"Automated client":"Unknown browser"}function _(s){return s instanceof Error?s.message:String(s)}const Ci=[{id:"general",label:"General",icon:kt},{id:"updates",label:"Updates",icon:je},{id:"shortcuts",label:"Shortcuts",icon:an},{id:"github",label:"GitHub",icon:Nt},{id:"ai",label:"AI assistance",icon:_s},{id:"diagnostics",label:"Diagnostics",icon:We},{id:"webAccess",label:"Web access",icon:gn}],Si={github:{title:"GitHub",description:"Separate settings for this repository and the OpenTig instance."},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 Fi({preferences:s,onPreference:t,open:n,onOpenChange:i,section:a,onSectionChange:r,repository:o=null}){const l=Ht(),h=An(s.aiExecutablePaths),p=hs.aiStatuses(h),g=Ut({queryKey:p,queryFn:()=>ge.ai.statuses(!1),enabled:n&&a==="ai",staleTime:1/0,gcTime:1/0,placeholderData:Gt}),m=g.data??[],c=g.isFetching,[x,f]=u.useState(!1),[v,w]=u.useState(!1),R=u.useRef(null),O=Jt(),G=O?{duration:0}:{duration:.16,ease:[.22,1,.36,1]},I=u.useRef(h);u.useEffect(()=>{I.current!==h&&(l.removeQueries({queryKey:hs.aiStatuses(I.current),exact:!0}),I.current=h)},[h,l]),u.useEffect(()=>{g.error&&A.error({title:"Could not check local AI",description:Ri(g.error)})},[g.error]);const W=()=>l.fetchQuery({queryKey:p,queryFn:()=>ge.ai.statuses(!0),staleTime:0}).catch(()=>{});u.useLayoutEffect(()=>{n&&R.current&&(R.current.scrollTop=0)},[n,a]);const y=s.commitMessageHarness,M=m.find(b=>b.id===y),E=s.commitMessageModels[y]??"default",C=M?.models??[{id:"default",label:"Default (CLI)"}],T=C.some(b=>b.id===E)?C:[...C,{id:E,label:`${E} (unavailable)`}],D=[];for(const b of T){const k=y==="opencode"?b.id.indexOf("/"):-1,$=k>0?b.id.slice(0,k):y,Q=b.id==="default"?"default":`provider:${$}`;let z=D.find(ce=>ce.id===Q);z||(z={id:Q,label:b.id==="default"?"":k>0?$:he(y),items:[]},D.push(z)),z.items.push({value:b.id,label:k>0&&b.label===b.id?b.id.slice(k+1):b.label,search:b.id,tooltip:b.id==="default"||b.label===b.id?b.label:`${b.label} · ${b.id}`,pinned:b.id==="default",icon:e.jsx(_s,{})})}const F=T.find(b=>b.id===E)?.label??E,{title:pe,description:Me}=a==="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."}:Si[a];return e.jsx(ie,{open:n,onOpenChange:i,children:e.jsx(ae,{className:`settings-dialog${a==="github"||a==="general"?" settings-dialog-general":""}${a==="github"?" settings-dialog-github":""}${a==="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"}),Ci.map(({id:b,label:k,icon:$})=>e.jsxs("button",{className:`settings-nav-item ${a===b?"active":""}`,onClick:()=>r(b),"aria-current":a===b,children:[e.jsx($,{})," ",k]},b))]}),e.jsxs("section",{className:"settings-panel",children:[e.jsxs("header",{className:"settings-panel-header",children:[e.jsx(xs,{initial:!1,mode:"wait",children:e.jsxs(gs.div,{initial:O?!1:{opacity:0,y:4},animate:{opacity:1,y:0},exit:O?{opacity:1}:{opacity:0,y:-3},transition:G,children:[e.jsx(re,{children:pe}),e.jsx(le,{children:Me})]},a)}),e.jsx(oe,{render:e.jsx(j,{variant:"ghost",size:"icon-sm","aria-label":"Close settings"}),children:e.jsx(Ee,{})})]}),e.jsx("div",{ref:R,className:`settings-panel-body${a==="general"||a==="github"?" settings-panel-body-general":""}`,children:e.jsx(xs,{initial:!1,mode:"wait",children:e.jsx(gs.div,{className:`settings-panel-section${a==="general"||a==="github"?" settings-panel-section-general":""}`,initial:O?!1:{opacity:0,y:7},animate:{opacity:1,y:0},exit:O?{opacity:1}:{opacity:0,y:-5},transition:G,children:a==="github"?e.jsx(Ct,{repository:o},o?.id):a==="general"?e.jsx(_n,{preferences:s,onPreference:t}):a==="updates"?e.jsx(St,{}):a==="shortcuts"?e.jsx(Vn,{preferences:s,onPreference:t}):a==="webAccess"?e.jsx(ki,{}):a==="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(j,{variant:"outline",size:"sm",onClick:()=>w(!0),children:[e.jsx(We,{})," View problems"]})]}),e.jsx(Un,{open:v,onOpenChange:w})]}):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."}),M&&e.jsxs("span",{children:["Last checked: ",be(M.checkedAt,{seconds:!0})]})]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>{W()},disabled:c,children:[c?e.jsx(se,{className:"animate-spin"}):e.jsx(je,{})," ",c?e.jsx(He,{text:m.length?"Checking…":"Loading…"}):"Check again"]})]}),e.jsx("div",{className:"ai-harness-list",role:"radiogroup","aria-label":"Harness for AI assistance",children:["codex","claude","opencode","grok"].map(b=>{const k=m.find(Q=>Q.id===b),$=y===b;return e.jsxs("button",{type:"button",role:"radio","aria-checked":$,className:`ai-harness-card ${$?"active":""}`,onClick:()=>t({commitMessageHarness:b}),children:[e.jsxs("span",{className:"ai-harness-card-main",children:[e.jsx(Et,{harness:b}),e.jsxs("span",{className:"ai-harness-card-copy",children:[e.jsx("strong",{children:he(b)}),e.jsx("small",{children:k?.version||(k?k.installationStatus==="inspection-failed"?"Inspection unavailable":k.installed?"Version unavailable":"Executable not found":c?"Loading…":"Status not checked")})]})]}),e.jsx(X,{variant:Mi(k),className:`ai-status-badge ${k?.availability??"unknown"}`,children:Ei(k)}),k?.message&&e.jsx("span",{className:"ai-harness-message",children:k.message})]},b)})}),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:[he(y)," model"]}),e.jsx("span",{children:y==="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(Mt,{groups:D,value:E,onValueChange:b=>t({commitMessageModels:{...s.commitMessageModels,[y]:b}}),label:`${he(y)} model`,triggerLabel:F,triggerClassName:"ai-model-select",contentClassName:"ai-model-picker",size:"default",align:"end",placeholder:"Search models…"},y),M?.authStatus==="unauthenticated"&&e.jsxs("p",{className:"ai-login-hint",children:["Sign in from a terminal with ",e.jsx("code",{children:Ai(y,M.cliName)})," and check again."]}),M&&!M.installed&&M.installationStatus!=="inspection-failed"&&e.jsxs("p",{className:"ai-login-hint",children:["Install ",he(y)," and check its availability again."]})]}),e.jsx(En,{harness:y,preferences:s,status:M,onPreference:t},y),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(j,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[e.jsx(At,{})," 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(In,{open:x,onOpenChange:f})]})},a)})})]})]})})})}function Ei(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 Mi(s){return s?!s.installed||s.authStatus==="unauthenticated"||s.availability==="error"?"destructive":s.availability==="ready"?"default":"secondary":"outline"}function Ai(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 Ri(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{Fi as SettingsDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-
|
|
2
|
-
import{o as _,B as G,_ as
|
|
3
|
-
`).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!f?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":f,onClick:()=>
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-DVTrOwX4.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-BxP-s6jD.js","assets/platform-Bqt97_Jr.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-B3QJsvjR.js","assets/tanstack-BysN2Oew.js","assets/base-ui-DIP2rZxz.js","assets/index-Cx9LaJW8.css","assets/index-CtEztN1P.js","assets/File-4o4egqlz.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-DJX00otP.js","assets/App-BbT5H97Z.js","assets/PierreEditBoundary-DPtaTiUB.js","assets/edit-ready-context-D77R8XU8.js","assets/MarkdownFileViewer-CvsKPnvF.js","assets/viewer-tabs-Cnfyd6rg.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-Cmbomx5y.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-dvHhHbC0.js","assets/markdown-BpzjXclZ.css","assets/PullRequestViewer-IhGZZs_A.js","assets/GitHubAvatar-azKPrTMv.js","assets/HtmlFileViewer-WpYnLdMW.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-1ObUacJu.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as _,B as G,_ as x,T as ae,b as ne,d as le}from"./index-B3QJsvjR.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{i as re,h as oe,j as ue,f as F,k as fe,g as Z,l as J}from"./App-BbT5H97Z.js";import"./tanstack-BysN2Oew.js";import"./base-ui-DIP2rZxz.js";class de{constructor(e){if(this.options=e,!Number.isInteger(e.maxEntries)||e.maxEntries<1)throw new RangeError("maxEntries must be a positive integer.");if(!Number.isFinite(e.maxBytes)||e.maxBytes<1)throw new RangeError("maxBytes must be a positive number.")}options;entries=new Map;totalBytes=0;get size(){return this.entries.size}get bytes(){return this.totalBytes}get(e){const o=this.entries.get(e);if(o)return this.entries.delete(e),this.entries.set(e,o),o.value}set(e,o){const f=ce(this.options.sizeOf(o)),v=this.entries.get(e);return v&&(this.entries.delete(e),this.totalBytes-=v.bytes),f>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:f}),this.totalBytes+=f,this.evictToBudget(),this.entries.has(e))}delete(e){const o=this.entries.get(e);return o?(this.entries.delete(e),this.totalBytes-=o.bytes,!0):!1}clear(){this.entries.clear(),this.totalBytes=0}evictToBudget(){for(;this.entries.size>this.options.maxEntries||this.totalBytes>this.options.maxBytes;){const e=this.entries.keys().next();if(e.done)break;this.delete(e.value)}}}function ce(i){if(!Number.isFinite(i)||i<0)throw new RangeError("sizeOf must return a finite, non-negative number.");return Math.ceil(i)}const Q=n.lazy(()=>x(()=>import("./PierreDiffViewer-DVTrOwX4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),me=n.lazy(()=>x(()=>import("./PierreEditBoundary-DPtaTiUB.js"),__vite__mapDeps([15,6,1,7,8,9,12,16])).then(i=>({default:i.PierreEditBoundary}))),he=n.lazy(()=>x(()=>import("./MarkdownFileViewer-CvsKPnvF.js"),__vite__mapDeps([17,1,6,7,8,9,14,18,19,20,2,3,4,5,10,11,12,16,21,22,23])).then(i=>({default:i.MarkdownFileViewer}))),pe=n.lazy(()=>x(()=>import("./PullRequestViewer-IhGZZs_A.js"),__vite__mapDeps([24,6,1,7,8,9,14,25,18,19,23])).then(i=>({default:i.PullRequestViewer}))),xe=n.lazy(()=>x(()=>import("./EditableFileViewer-Cmbomx5y.js").then(i=>i.E),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,16,14,21])).then(i=>({default:i.EditableFileViewer}))),ve=n.lazy(()=>x(()=>import("./HtmlFileViewer-WpYnLdMW.js"),__vite__mapDeps([26,1,18,6,7,8,9,19,20,2,3,4,5,10,11,12,16,14,21,27])).then(i=>({default:i.HtmlFileViewer}))),ye=n.lazy(()=>x(()=>import("./ImageFileViewer-1ObUacJu.js"),__vite__mapDeps([28,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,16,14,21,29])).then(i=>({default:i.ImageFileViewer}))),ge=n.lazy(()=>x(()=>import("./ImageFileViewer-1ObUacJu.js"),__vite__mapDeps([28,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,16,14,21,29])).then(i=>({default:i.SvgFileViewer}))),R=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let X=null;function ke({repositoryId:i,selection:e,diffView:o,wrapLines:f,theme:v,revision:y,readOnly:g,commits:$,draftFor:E,onSelect:C,onOpenFile:W,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:A,onUpdateConflict:I,onResolveConflict:ee}){const[a,w]=n.useState(null),[te,D]=n.useState(!1),[P,q]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),N=n.useRef(!1),c=we(i,e);n.useEffect(()=>{H(!1),N.current=!1},[e]),n.useEffect(()=>{X!==i&&(R.clear(),X=i);const s=++b.current;if(q(null),!e||e.type==="pull-request"){w(null),D(!1);return}D(!0),(async()=>{try{if(e.type==="file"||e.type==="conflict"){if(e.type==="file"&&fe(e.path)){const l=await _.repository.readImage(i,e.path);if(s!==b.current)return;w({docKey:c,type:"image",value:l});return}const u=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:c,type:"conflict",value:u});return}w(l=>l&&l.docKey===c&&l.type==="file"&&N.current||l&&l.docKey===c&&l.type==="file"&&l.value.content===u.content&&l.value.size===u.size&&l.value.binary===u.binary&&l.value.tooLarge===u.tooLarge?l:{docKey:c,type:"file",value:u})}else{const u=e.type!=="diff";let l=u?R.get(c):void 0;if(l||(l=e.type==="commit"?await _.diff.getCommit(i,e.oid):e.type==="commit-file"?await _.diff.getCommitFile(i,e.oid,e.path,e.oldPath):await _.diff.get({repositoryId:i,path:e.path,kind:e.kind}),u&&R.set(c,l)),s!==b.current)return;const p=l;w(d=>d&&d.docKey===c&&d.type==="diff"&&d.value.patch===p.patch&&d.value.binary===p.binary?d:{docKey:c,type:"diff",value:p})}}catch(u){s===b.current&&q(u instanceof Error?u.message:"Could not load the viewer.")}finally{s===b.current&&D(!1)}})()},[V,c,i,y,e]);const j=v==="system"?"system":v,ie=f?"wrap":"scroll",B=n.useCallback(s=>{N.current=s},[]),k=n.useCallback(async(s,h,u)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??u);return p.status==="saved"&&(N.current=!1,A(s),w(d=>d?.type==="file"&&d.value.path===s?{...d,value:{...d.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:d)),p},[E,A,i]),S=n.useCallback(s=>s.path,[]),T=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),se=te&&a!==null&&!P;let r,L=null;if(!e)r=t.jsx(be,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{repositoryId:i,prNumber:e.number,onSelectPullRequest:s=>C({type:"pull-request",number:s}),diffView:o,themeType:j,wrapLines:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>C(null)},`${i}:${e.number}`)});else if(P)r=t.jsx("div",{className:"viewer-message text-destructive",children:P});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(F,{className:"spinner"})," ",t.jsx(Z,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ye,{image:a.value},`${a.value.path}:${a.value.mtimeMs}`)});else if(a.type!=="diff"&&a.value.binary)r=t.jsxs("div",{className:"viewer-message",children:["Binary file · ",Y(a.value.size)]});else if(a.type==="file"&&a.value.tooLarge&&!V)r=t.jsxs("div",{className:"viewer-message flex-col gap-3",children:[t.jsxs("p",{children:["The file is ",Y(a.value.size),". Preview is limited to protect performance."]}),t.jsx(G,{variant:"outline",onClick:()=>H(!0),children:"Load preview"})]});else if(a.type==="file"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The file exceeds the built-in editor's 8 MB safety limit."});else if(a.type==="conflict"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The conflicted file exceeds the viewer's safe limit. Open it in an external editor to resolve it."});else if(a.type==="conflict")r=null,L=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(Q,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:ie,onUpdate:I,onResolve:ee})});else if(a.type==="file"&&re(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,file:s,initialContent:T(s),revision:y,themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onOpenFile:W,onDirtyChange:B,onDraftChange:z(s),onSave:k},S(s))})}else if(a.type==="file"&&oe(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ge,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onDirtyChange:B,onDraftChange:z(s),onSave:k},S(s))})}else if(a.type==="file"&&ue(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onDirtyChange:B,onDraftChange:z(s),onSave:k},S(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(xe,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g,onDirtyChange:B,onDraftChange:z(s),onSave:k},S(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?$.find(l=>l.oid===s.oid):void 0,u=e.type==="commit-file"?t.jsx(G,{type:"button",variant:"outline",size:"xs",onClick:()=>C({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,L=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(je,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(Q,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:f,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:u,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>C(null)})})]})}else a.type==="diff"?r=t.jsx("div",{className:"viewer-message",children:"No differences to show."}):r=t.jsx("div",{className:"viewer-message",children:"This file cannot be edited."});const U=t.jsxs(t.Fragment,{children:[L??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:c),se&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(F,{className:"spinner"})})]});return a?.type!=="file"?U:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{enabled:!0,children:U})})}function je({commit:i,fallbackSubject:e}){const o=i?.date,[f,v]=n.useState(!1),y=i?.body??"",g=y.length>240||y.split(`
|
|
3
|
+
`).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!f?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":f,onClick:()=>v($=>!$),children:f?"Show less":"Show full description"})]}),t.jsxs("div",{className:"commit-diff-meta",children:[t.jsx("code",{children:i?.shortOid??"commit"}),i?.author&&t.jsxs("span",{children:[i.author,i.email?` <${i.email}>`:""]}),o&&Number.isFinite(new Date(o).getTime())&&t.jsxs(ae,{children:[t.jsx(ne,{render:t.jsx("time",{dateTime:i?.date}),children:J(o,{seconds:!0})}),t.jsx(le,{children:J(o,{seconds:!0})})]}),i?.parentCount&&i.parentCount>1?t.jsx("span",{children:"Merge commit"}):null,i?.upstreamState==="local-only"&&t.jsx("span",{className:"commit-local-label",children:"Local only"})]})]})}function we(i,e){return e?e.type==="pull-request"?`${i}:pull:${e.number}`:e.type==="commit"?`${i}:commit:${e.oid}`:e.type==="commit-file"?`${i}:commit-file:${e.oid}:${e.oldPath??""}:${e.path}`:e.type==="diff"?`${i}:diff:${e.kind}:${e.path}`:`${i}:${e.type}:${e.path}`:`${i}:empty`}function m(){return t.jsxs("div",{className:"viewer-message",children:[t.jsx(F,{className:"spinner"})," ",t.jsx(Z,{text:"Loading viewer…"})]})}function be(){return t.jsxs("div",{className:"viewer-empty",children:[t.jsx("h2",{children:"Nothing selected"}),t.jsx("p",{children:"Select a change, file, commit, or pull request."})]})}function Y(i){return i?i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(1)} MB`:"unknown size"}export{ke as default};
|
package/dist/client/assets/{abnfDiagram-N423BO3Z-DdAfHevw.js → abnfDiagram-N423BO3Z-BvfKOanh.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-DxAnzBXJ.js";import{p as f}from"./chunk-JWPE2WC7-D-jfKyIh.js";import{_ as n,l as s}from"./mermaid.core-vLn7mMZB.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-DnkWlsqW.js";import"./index-B3QJsvjR.js";import"./react-rd22PHbN.js";import"./tanstack-BysN2Oew.js";import"./base-ui-DIP2rZxz.js";import"./render-markdown-dvHhHbC0.js";import"./App-BbT5H97Z.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,o]=e.split("*"),m=t?parseInt(t,10):0,l=o?parseInt(o,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:o}=b(e.repeat);return t===0&&o===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:o}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),s.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;s.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),s.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},$={parser:R,db:a,renderer:u,styles:p};export{$ as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-
|
|
1
|
+
import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-vLn7mMZB.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function W(l,h,q,O,v,R,K){var u=l-q,D=h-O,i=(K?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,L=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),G=(P*g-m*E)/A,H=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=G-L,e=H-t,r=w-L,M=p-t;return x*x+e*e>r*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(L<un)if(S=pn(Q,V,X,Y,F,U,B,C)){var Z=Q-S[0],$=V-S[1],k=F-S[0],b=U-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(Q,V),u.arc(0,0,s,m,g,!t)):u.moveTo(Q,V),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[N(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:J(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:J(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:J(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:J(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:J(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:J(+n),i):R},i.padAngle=function(n){return arguments.length?(K=typeof n=="function"?n:J(+n),i):K},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
|