@opentig/cli 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/chunks/{cli-D_aggpu2.mjs → cli-ABzC6-gR.mjs} +1 -1
- package/dist/client/assets/App-CBetJ5ZN.js +74 -0
- package/dist/client/assets/CreatePullRequestDialog-W82oHjYm.js +2 -0
- package/dist/client/assets/{DiffWorkspace-CeYQ0YtE.js → DiffWorkspace-BWkTIl5n.js} +1 -1
- package/dist/client/assets/{EditableFileViewer-BhwE-QMO.js → EditableFileViewer-Cv3aNJBN.js} +1 -1
- package/dist/client/assets/{File-C10_BxOu.js → File-DiOOsHOl.js} +1 -1
- package/dist/client/assets/{FilesView-BT4eHbFo.js → FilesView-DIqPfRbv.js} +1 -1
- package/dist/client/assets/{GitHubAvatar-Ch_PaCv3.js → GitHubAvatar-DBc3Vxnk.js} +1 -1
- package/dist/client/assets/HistoryView-DYxWYYVx.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-Cufzaec9.js → HtmlFileViewer-BsewwJtM.js} +1 -1
- package/dist/client/assets/{IconEdit-RxH71_V-.js → IconEdit-CxvzMyLV.js} +1 -1
- package/dist/client/assets/{IconFolderPlus-DSSB-ikf.js → IconFolderPlus-1vLDIzhC.js} +1 -1
- package/dist/client/assets/{ImageFileViewer-CFUkcXLH.js → ImageFileViewer-CoQZkgET.js} +1 -1
- package/dist/client/assets/{LocalRefsDialog-B2jUCKTx.js → LocalRefsDialog-sw-ROjfe.js} +1 -1
- package/dist/client/assets/{MarkdownFileViewer-BLfJ-Vof.js → MarkdownFileViewer-BedKCXTI.js} +2 -2
- package/dist/client/assets/{PairingPage-C5Ggk-Z_.js → PairingPage-CYJXzBZC.js} +1 -1
- package/dist/client/assets/{PierreDiffViewer-DYj1ZThr.js → PierreDiffViewer-uhTsb-F7.js} +1 -1
- package/dist/client/assets/PierreEditBoundary-Bb4dONIq.js +2 -0
- package/dist/client/assets/{PierreWorkerPool-7EVoquIB.js → PierreWorkerPool-BuBzE8K1.js} +9 -9
- package/dist/client/assets/{PullRequestDiff-DxLTcm6L.js → PullRequestDiff-CgY4QIHC.js} +1 -1
- package/dist/client/assets/{PullRequestViewer-CyW39MuF.js → PullRequestViewer-KZl0osME.js} +2 -2
- package/dist/client/assets/PullRequestsView-DkN3pW33.js +1 -0
- package/dist/client/assets/{QuickOpenDialog-CasQU7pk.js → QuickOpenDialog-Cn-aQRAS.js} +1 -1
- package/dist/client/assets/RepositoryProjectsDialog-F-EctLXx.js +1 -0
- package/dist/client/assets/SearchView-BtKBEJ7e.js +1 -0
- package/dist/client/assets/SettingsDialog-wfWhEzZY.js +9 -0
- package/dist/client/assets/Viewer-D-oFua7K.js +3 -0
- package/dist/client/assets/{abnfDiagram-N423BO3Z-DrlQwm7W.js → abnfDiagram-N423BO3Z-DLBLFOdy.js} +1 -1
- package/dist/client/assets/{arc-B9cXI-QL.js → arc-D-Yei3Vr.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-DZz7ZXbI.js → architectureDiagram-T3A2C74G-BOgBvzWh.js} +1 -1
- package/dist/client/assets/{base-ui-D4MeJpa3.js → base-ui-qeHDA5zu.js} +1 -1
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-DZFMT63B.js → blockDiagram-VBNYF7ZC-BQXRJDyR.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-BnHIZMZp.js → c4Diagram-5PPSVZJV-DTZseD56.js} +1 -1
- package/dist/client/assets/channel-DrMuSkDK.js +1 -0
- package/dist/client/assets/{checkbox-BpmQTxn7.js → checkbox-BwbxYGgK.js} +1 -1
- package/dist/client/assets/{chunk-2GRJ4B5K-CJOlpI9g.js → chunk-2GRJ4B5K-spRCgfPY.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-DhsnoUrJ.js → chunk-2Q5K7J3B-CLVClH0M.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-Nwsk3OIu.js → chunk-5RXB4S5H-CuQ5tYjB.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-Dk9FYU9b.js → chunk-5VM5RSS4-DyOEOe90.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-C8lX8T87.js → chunk-6Q2QTUOP-CgMtuJIx.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-DWHvTG6c.js → chunk-GF5L2VYU-BH63P4Vv.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BLu2-FJl.js → chunk-JWPE2WC7-BANDbaPq.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-CEOb10I1.js → chunk-KBJHAD2P-Bfty2upo.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-BcdMrb_e.js → chunk-RYQCIY6F-Cvu8BZS9.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-CzPimvfs.js → chunk-XXDRQBXY-bnohf1yd.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BKiL0hkR.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BKiL0hkR.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-BYfzHUkR.js → cose-bilkent-JH36ORCC-DCTEAZwO.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-B4mEAleX.js → cynefin-VYW2F7L2-Bp2wXvdt.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-CioMvT6V.js → cynefinDiagram-MW4NZA55-DRRWzuF0.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-DWPgHi5i.js → dagre-VZM6K2ZE-DDvsotRK.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-94i9EwB_.js → diagram-7IWD3JNH-CMqhRNRq.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-BRgMOgy8.js → diagram-B4RE2ZJO-D_PYI1ut.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-DHaXTl1T.js → diagram-LBJQPF4R-BSUx7mMM.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-DtLuyYm1.js → diagram-Q27KOJAE-C8O3g6WT.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-D8R3grCW.js → diagram-UB23O5K3-C5-NDsgC.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-voe5GU7W.js → ebnfDiagram-BXEA7PRR-D71hx4Ww.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-BShMJhmY.js → erDiagram-JOGREHBK-yd9B5d8I.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-DASXB2wV.js → flowDiagram-UKHOOZJN-CWU5VVbw.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-Da1ElnJN.js → ganttDiagram-PKOTCBZU-D2siVjfa.js} +1 -1
- package/dist/client/assets/{gh-utils-D00lyruw.js → gh-utils-B0Nlmxep.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-DoGRli0p.js → gitGraphDiagram-DS77QQ5N-CIvIFcxR.js} +1 -1
- package/dist/client/assets/index-BOPi2b1j.js +47 -0
- package/dist/client/assets/index-CryuKDT3.css +1 -0
- package/dist/client/assets/{infoDiagram-6WML65LV-CxkxF5pn.js → infoDiagram-6WML65LV-DRvl8KfO.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-l6dk2-PS.js → ishikawaDiagram-WSZJBQD7-H5EQq6uE.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-wJY4ZF5o.js → journeyDiagram-NVQOT4AX-CCwLmD-U.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-CIcwUmJo.js → kanban-definition-27J2QSJJ-DS--XHEu.js} +1 -1
- package/dist/client/assets/{linear-Tf-dXwQ9.js → linear-Q3JNM6CR.js} +1 -1
- package/dist/client/assets/{mermaid.core-DnaJSnLe.js → mermaid.core-EwS_m22C.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-jFdJ2bLh.js → mindmap-definition-FAOFIHXS-D15nrwfe.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-vq0WE66k.js → pegDiagram-VL7TDLO6-DOG19gxx.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-3edKDMpI.js → pieDiagram-7S7Q4E2Y-Bstdr7Wh.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-B6M8U4XV.js → quadrantDiagram-CIZ2JOQS-DfKs4qZW.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-C-d5-0YS.js → railroadDiagram-AXF67PYL-DJKxyuhV.js} +1 -1
- package/dist/client/assets/{render-markdown-GXIpf9CM.js → render-markdown-C7X2TwRk.js} +1 -1
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-FVzmEbFu.js → requirementDiagram-LRYGKXZP-SGJWVmBV.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-B-qcUamt.js → sankeyDiagram-W5VNT64P-CpZFct0O.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-DgFXRLSt.js → sequenceDiagram-SI44F4Z6-B7plRik9.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-CWi_pMb2.js → sizeCapture-X5ZJPWSS-CNbK285t.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-amQwzlgU.js → stateDiagram-OKZ733FA-BIHk9QCC.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-Cqw0H5cq.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-L88WlaUb.js → swimlanes-SLNWSIFB-7g_XCosC.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BzKpdiGK.js +8 -0
- package/dist/client/assets/{tanstack-Bsd5UOY4.js → tanstack-B8_amOz8.js} +1 -1
- package/dist/client/assets/{timeline-definition-Z64GVDOM-D4TJxxc3.js → timeline-definition-Z64GVDOM-B-cgSggY.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-ClJWOyzQ.js → vennDiagram-T6HMQDX7-Bt5-8VZ2.js} +1 -1
- package/dist/client/assets/{viewer-tabs-Cp_MC_J3.js → viewer-tabs-DxCOe0ut.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-Cxfjpd6V.js → wardleyDiagram-T6FBY63Y-B5Imx6zh.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-BYqbTvmt.js → xychartDiagram-ELKLHX3M-CDaY4xFS.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/dev.mjs +1 -1
- package/dist/manifest.json +1 -1
- package/dist/server.mjs +54 -3
- package/package.json +1 -1
- package/dist/client/assets/App-CeDVj5Hh.js +0 -118
- package/dist/client/assets/CreatePullRequestDialog-DMHY_u8X.js +0 -2
- package/dist/client/assets/HistoryView-CivGwdxV.js +0 -1
- package/dist/client/assets/PierreEditBoundary-UfvbKDbd.js +0 -2
- package/dist/client/assets/PullRequestsView-BHcnarLS.js +0 -1
- package/dist/client/assets/RepositoryProjectsDialog-VAiZrDlA.js +0 -1
- package/dist/client/assets/SearchView-Bv4bA4UJ.js +0 -1
- package/dist/client/assets/SettingsDialog-D33V9Fry.js +0 -9
- package/dist/client/assets/Viewer-I1lC_oJU.js +0 -3
- package/dist/client/assets/channel-CE-pdA-6.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-2elbt6qi.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-2elbt6qi.js +0 -1
- package/dist/client/assets/index-BdjG_WtS.js +0 -3
- package/dist/client/assets/index-Uku28hIV.css +0 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-TdV8eIV2.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-AWimqvIC.js +0 -8
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/render-markdown-GXIpf9CM.js","assets/App-CeDVj5Hh.js","assets/index-BdjG_WtS.js","assets/react-rd22PHbN.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-Uku28hIV.css","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as W,_ as $,o as p,B as v}from"./index-BdjG_WtS.js";import{r as n,j as e}from"./react-rd22PHbN.js";import{D as z,c as X,d as J,U as q,e as K,k as L,S as Q,E as Y,C as Z,F as ee,G as te,V as ae,W as se,X as re,H as ne,A as g}from"./App-CeDVj5Hh.js";import{C as ie}from"./checkbox-BpmQTxn7.js";import{V as le,a as ce,b as M}from"./viewer-tabs-Cp_MC_J3.js";import{o as oe,g as de,a as ue}from"./gh-utils-D00lyruw.js";/* empty css */import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";const he=[["path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2",key:"svg-0"}],["path",{d:"M7 9l5 -5l5 5",key:"svg-1"}],["path",{d:"M12 4l0 12",key:"svg-2"}]],me=W("outline","upload","Upload",he);function ke(t){const[r,u]=n.useState(""),[c,j]=n.useState(""),[o,P]=n.useState(""),[C,T]=n.useState(!1),[y,I]=n.useState("edit"),[G,S]=n.useState(""),[i,B]=n.useState(!1),[l,E]=n.useState(null),h=n.useRef(null),w=n.useRef(0),f=t.status?.branch??null,b=t.preferences.commitMessageHarness,_=t.preferences.commitMessageModels[b]??"default",H=be(t.aiProviders,b,_),m=n.useMemo(()=>t.branches.filter(a=>a.remote&&!a.fullName.endsWith("/HEAD")&&a.name!==`origin/${f??""}`).map(a=>a.name),[f,t.branches]);n.useEffect(()=>{t.open&&P(a=>a&&m.includes(a)?a:fe(m))},[m,t.open]),n.useEffect(()=>{if(!t.open||y!=="preview")return;const a=++w.current;$(async()=>{const{renderMarkdown:s}=await import("./render-markdown-GXIpf9CM.js").then(x=>x.a);return{renderMarkdown:s}},__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(({renderMarkdown:s})=>s(c||"_No description._")).then(s=>{a===w.current&&S(s)}).catch(()=>{a===w.current&&S("<p>Could not render the preview.</p>")})},[c,y,t.open]),n.useEffect(()=>{if(t.open)return;const a=h.current;a&&p.github.cancelDraft(a).catch(()=>{})},[t.open]);const N=t.status!==null&&!t.status.upstream,D=t.status!==null&&!!t.status.upstream&&t.status.ahead>0,k=t.status!==null&&(t.status.detached||t.status.unborn||!t.status.branch),d=t.status===null||N||D||k||m.length===0,V=async()=>{const a=h.current;a&&await p.github.cancelDraft(a).catch(()=>{})},F=async()=>{if(d||l||i||!o)return;const a=crypto.randomUUID();h.current=a,E(a);try{const s=await p.github.generateDraft({repositoryId:t.repositoryId,base:o,harness:b,model:_,requestId:a});if(h.current!==a)return;u(s.title),j(s.body),I("edit"),g.success({title:`Draft generated with ${R(s.harness)}`,description:s.contextWasTruncated?"A truncated version of the branch diff was used. Review before publishing.":"Review and edit before publishing."})}catch(s){const x=ge(s);x?.code==="AI_CANCELLED"?g.info({title:"Generation canceled"}):g.error({title:"Could not generate the draft",description:x?.message??A(s),duration:1e4})}finally{h.current===a&&(h.current=null),E(s=>s===a?null:s)}},U=async()=>{if(!(d||i||l||!r.trim()||!o)){B(!0);try{const a=await p.github.createPullRequest({repositoryId:t.repositoryId,title:r.trim(),body:c,base:o,draft:C});u(""),j(""),T(!1),g.success({title:C?"Draft pull request created":"Pull request created",description:a.url,button:{title:"Open",onClick:()=>oe(a.url)}}),t.onCreated(a.number)}catch(a){const s=de(a);g.error({title:ue(s),description:s?.message??A(a),duration:1e4})}finally{B(!1)}}};return e.jsx(z,{open:t.open,onOpenChange:a=>{i||t.onOpenChange(a)},children:e.jsxs(X,{className:"create-pr-dialog",children:[e.jsxs("div",{className:"create-pr-content",children:[e.jsxs(J,{children:[e.jsx(q,{"aria-hidden":"true"})," Create pull request"]}),e.jsx(K,{children:f?e.jsxs(e.Fragment,{children:["From ",e.jsx("code",{children:f})," into the selected base branch on GitHub."]}):"Check out a branch to create a pull request."}),N&&e.jsx("div",{className:"create-pr-notice",children:e.jsxs("span",{children:["The branch has no upstream. Publish it to origin (for example ",e.jsxs("code",{children:["git push -u origin ",f??"HEAD"]}),") and refresh."]})}),D&&e.jsxs("div",{className:"create-pr-notice",children:[e.jsxs("span",{children:["The branch has ",t.status?.ahead," unpushed ",t.status?.ahead===1?"commit":"commits",". Push them so the pull request includes your work."]}),e.jsxs(v,{variant:"outline",size:"xs",disabled:t.pushBusy,onClick:t.onPush,children:[t.pushBusy?e.jsx(L,{className:"animate-spin"}):e.jsx(me,{})," Push"]})]}),!N&&!D&&k&&e.jsx("div",{className:"create-pr-notice",children:e.jsx("span",{children:"Pull requests need a checked-out branch with commits."})}),m.length===0&&!k&&e.jsx("div",{className:"create-pr-notice",children:e.jsx("span",{children:"No remote branches are available to use as a base. Fetch the remote first."})}),e.jsxs("div",{className:"create-pr-base-row",children:[e.jsxs("div",{className:"create-pr-field",children:[e.jsx("label",{htmlFor:"create-pr-base",children:"Base branch"}),e.jsxs(Q,{value:o,onValueChange:a=>P(a??""),children:[e.jsx(Y,{id:"create-pr-base",className:"create-pr-base",disabled:d||i||!!l,children:e.jsx(Z,{children:o?O(o):"Select a base"})}),e.jsx(ee,{alignItemWithTrigger:!1,children:m.map(a=>e.jsx(te,{value:a,children:O(a)},a))})]})]}),e.jsxs("label",{className:"create-pr-draft",children:[e.jsx(ie,{checked:C,onCheckedChange:a=>T(a===!0),disabled:d||i||!!l}),e.jsx("span",{children:"Create as draft"})]})]}),e.jsxs("div",{className:"create-pr-field",children:[e.jsx("label",{htmlFor:"create-pr-title",children:"Title"}),e.jsx("input",{id:"create-pr-title",className:"create-pr-title",value:r,maxLength:300,placeholder:"Pull request title",disabled:d||i||!!l,onChange:a=>u(a.target.value)})]}),e.jsxs(le,{value:y,onValueChange:a=>I(a),className:"create-pr-field create-pr-body-field",children:[e.jsxs("div",{className:"create-pr-body-header",children:[e.jsx("label",{htmlFor:"create-pr-body",children:"Description"}),e.jsx(ce,{label:"Description view",className:"markdown-viewer-tabs",items:[{value:"edit",label:"Edit"},{value:"preview",label:"Preview"}]})]}),e.jsx(M,{value:"edit",className:"create-pr-body-panel",children:e.jsx(ae,{id:"create-pr-body",value:c,rows:10,placeholder:"Describe the change (GitHub Markdown)",disabled:d||i||!!l,onChange:a=>j(a.target.value)})}),e.jsx(M,{value:"preview",className:"create-pr-preview markdown-prose",dangerouslySetInnerHTML:{__html:G}})]})]}),e.jsxs("div",{className:"create-pr-actions",children:[e.jsxs(v,{variant:"outline",className:"create-pr-generate commit-composer-generate",disabled:d||i,"aria-label":l?"Cancel generation":void 0,onClick:()=>l?void V():void F(),children:[l?e.jsx(se,{className:"text-destructive"}):e.jsx(re,{harness:b}),l?e.jsx(ne,{text:"Generating draft…"}):e.jsxs("span",{className:"commit-composer-provider",children:["Generate with ",e.jsx("span",{className:"commit-composer-harness",children:R(b)}),e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{className:"commit-composer-model",children:H})]})]}),e.jsxs("div",{className:"create-pr-submit-actions",children:[e.jsx(v,{variant:"ghost",onClick:()=>t.onOpenChange(!1),disabled:i,children:"Cancel"}),e.jsxs(v,{onClick:()=>{U()},disabled:d||i||!!l||!r.trim()||!o,children:[i?e.jsx(L,{className:"animate-spin"}):e.jsx(q,{})," ",i?"Creating…":"Create pull request"]})]})]})]})})}function fe(t){return t.find(r=>r==="origin/main")??t.find(r=>r==="origin/master")??t[0]??""}function O(t){return t.replace(/^origin\//,"")}function R(t){return t==="codex"?"Codex":t==="claude"?"Claude Code":"OpenCode"}function be(t,r,u){return t?.find(c=>c.id===r)?.models.find(c=>c.id===u)?.label??(u==="default"?"Default (CLI)":u)}function ge(t){if(!(t instanceof Error)||!("detail"in t)||!t.detail||typeof t.detail!="object")return null;const r=t.detail;return typeof r.code=="string"&&r.code.startsWith("AI_")&&typeof r.message=="string"?r:null}function A(t){return t instanceof Error?t.message:"An unexpected error occurred."}export{ke as CreatePullRequestDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as w,j as e}from"./react-rd22PHbN.js";import{a as P}from"./tanstack-Bsd5UOY4.js";import{k as O,H as D,N as V,O as _,P as G,Q as z,A as H,R as U,T as Y}from"./App-CeDVj5Hh.js";import{B as I,o as B,T as C,a as v,b as $,w as W}from"./index-BdjG_WtS.js";import"./base-ui-D4MeJpa3.js";function X(s){let n=[],t=0,l=1;const a=new Map,i=[];for(const m of s){let d=n.indexOf(m.oid);const j=d>=0;d<0&&(d=n.length,n=[...n,m.oid]);const p=n,g=K(a,m.oid,()=>t++),u=p.filter((r,h)=>h!==d);let c=Math.min(d,u.length);m.parentOids.forEach((r,h)=>{a.has(r)||a.set(r,h===0?g:t++),!u.includes(r)&&(u.splice(c,0,r),c+=1)});const N=[];p.forEach((r,h)=>{if(h===d){j&&N.push({fromLane:h,from:"top",toLane:d,to:"node",color:a.get(r)??g});return}const b=u.indexOf(r);b>=0&&N.push({fromLane:h,from:"top",toLane:b,to:"bottom",color:a.get(r)??0})}),m.parentOids.forEach(r=>{const h=u.indexOf(r);h>=0&&N.push({fromLane:d,from:"node",toLane:h,to:"bottom",color:a.get(r)??g})}),l=Math.max(l,p.length,u.length),i.push({lane:d,color:g,segments:N,continuations:u.map((r,h)=>({lane:h,color:a.get(r)??0}))}),n=u}return{rows:i,laneCount:l}}function K(s,n,t){const l=s.get(n);if(l!==void 0)return l;const a=t();return s.set(n,a),a}function ue({repositoryId:s,upstream:n,readOnly:t,operation:l,commits:a,nextCursor:i,loading:m,undoing:d,onSelectCommit:j,onSelectFile:p,onUndo:g,onMore:u}){const c=w.useRef(null),[N,r]=w.useState(new Set),h=w.useMemo(()=>X(a??[]),[a]),b=q(h.laneCount),E=P({count:a?.length??0,getScrollElement:()=>c.current,estimateSize:()=>52,getItemKey:x=>a?.[x]?.oid??x,overscan:8});return a===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(O,{className:"spinner"})," ",e.jsx(D,{text:"Loading history…"})]}):e.jsxs("div",{className:"history-list",children:[!n&&a.length>0&&e.jsx("div",{className:"history-upstream-notice",role:"status",children:"Configure an upstream to distinguish local from published commits."}),e.jsx("div",{ref:c,className:"history-scroll",role:"list","aria-label":"Commit history",children:a.length===0?e.jsx("p",{className:"empty-list",children:"This repository has no commits yet."}):e.jsxs("div",{className:"virtual-list",style:{height:E.getTotalSize()+(i?52:0)},children:[E.getVirtualItems().map(x=>{const f=a[x.index];return e.jsx("div",{ref:E.measureElement,"data-index":x.index,className:"virtual-row",style:{transform:`translateY(${x.start}px)`},children:e.jsx(Q,{repositoryId:s,upstream:n,commit:f,graphRow:h.rows[x.index],graphWidth:b,expanded:N.has(f.oid),onExpandedChange:k=>r(R=>{const o=new Set(R);return k?o.add(f.oid):o.delete(f.oid),o}),canUndo:!t&&!l&&!d&&f.upstreamState==="local-only"&&f.isHead&&f.parentCount===1,onSelectCommit:j,onSelectFile:p,onUndo:g})},x.key)}),i&&e.jsx(I,{variant:"ghost",className:"history-more",style:{top:E.getTotalSize()},disabled:m,onClick:u,children:m?"Loading…":"Load more"})]})})]})}function Q({repositoryId:s,upstream:n,commit:t,graphRow:l,graphWidth:a,expanded:i,onExpandedChange:m,canUndo:d,onSelectCommit:j,onSelectFile:p,onUndo:g}){const u=`${s}:${t.oid}`,[c,N]=w.useState(()=>V(u)??null),[r,h]=w.useState(null);w.useEffect(()=>{if(!i||c||r)return;let o=!0;return B.commits.files(s,t.oid).then(y=>{o&&(_(u,y),N(y))}).catch(y=>{o&&h(re(y))}),()=>{o=!1}},[u,t.oid,i,c,r,s]);const b=se(t.decorations),E=b.slice(0,3),x=b.slice(3),f=c?.reduce((o,y)=>o+y.additions,0)??0,k=c?.reduce((o,y)=>o+y.deletions,0)??0,R=async()=>{try{await W(t.oid),H.success({title:"Hash copied",description:t.oid})}catch{H.error({title:"Could not copy hash"})}};return e.jsxs("div",{className:"commit-item",role:"listitem",children:[e.jsxs("div",{className:"commit-header",children:[e.jsx(J,{graph:l,width:a}),e.jsx("button",{className:"commit-expand","aria-expanded":i,"aria-label":i?"Collapse commit":"Expand commit",onClick:()=>m(!i),children:e.jsx(G,{className:`folder-chevron ${i?"open":""}`})}),e.jsxs("div",{className:"commit-main",children:[e.jsxs("span",{className:"commit-title-row",children:[e.jsxs(C,{children:[e.jsx(v,{render:e.jsx("button",{className:"commit-subject",onClick:()=>j(t)}),children:t.subject||"(no subject)"}),e.jsx($,{side:"right",children:"View the full commit diff"})]}),e.jsxs(C,{children:[e.jsx(v,{render:e.jsx("span",{className:"commit-date"}),children:ae(t.date)}),e.jsx($,{children:oe(t.date)})]})]}),e.jsxs("span",{className:"commit-meta",children:[e.jsxs(C,{children:[e.jsx(v,{render:e.jsx("button",{className:"commit-oid",onClick:()=>{R()},"aria-label":`Copiar hash ${t.shortOid}`}),children:t.shortOid}),e.jsx($,{children:"Copy full hash"})]}),e.jsx("span",{className:"commit-author",children:t.author}),(b.length>0||t.parentCount>1||t.upstreamState==="local-only")&&e.jsxs("span",{className:"commit-refs",children:[t.upstreamState==="local-only"&&e.jsxs(C,{children:[e.jsx(v,{render:e.jsx("span",{className:"ref-chip local-only"}),children:"Local"}),e.jsx($,{children:t.isHead?`Not in ${n??"the upstream"} according to the latest known remote state.`:"Not published. To avoid rewriting multiple commits, only the latest can be undone."})]}),t.parentCount>1&&e.jsx("span",{className:"ref-chip merge",children:"merge"}),E.map(o=>e.jsx("span",{className:`ref-chip ${o.kind}`,children:o.label},`${o.kind}:${o.label}`)),x.length>0&&e.jsxs(C,{children:[e.jsxs(v,{render:e.jsx("span",{className:"ref-chip more"}),children:["+",x.length]}),e.jsx($,{children:x.map(o=>o.label).join(" · ")})]})]})]})]}),d&&e.jsxs(C,{children:[e.jsx(v,{render:e.jsx(I,{variant:"ghost",size:"icon-xs",className:"change-action-button commit-undo",onClick:o=>{o.stopPropagation(),g(t)},"aria-label":`Undo commit ${t.shortOid}`}),children:e.jsx(z,{})}),e.jsx($,{children:"Undo commit and keep its changes staged"})]})]}),i&&l.continuations.length>0&&e.jsx(Z,{graph:l,width:a}),i&&e.jsxs("div",{className:"commit-files",style:{paddingLeft:a+31},children:[t.body&&e.jsx("p",{className:"commit-description",children:t.body}),r&&e.jsx("div",{className:"commit-files-message error",children:r}),!c&&!r&&e.jsxs("div",{className:"commit-files-message",children:[e.jsx(O,{className:"spinner"})," ",e.jsx(D,{text:"Loading files…"})]}),c&&c.length===0&&e.jsx("div",{className:"commit-files-message",children:"This commit does not modify its own files (merge)."}),c&&c.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"commit-files-summary",children:[c.length," ",c.length===1?"file":"files",(f>0||k>0)&&e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"add",children:["+",f]})," ",e.jsxs("span",{className:"del",children:["−",k]})]})]}),c.map(o=>e.jsx(ee,{file:o,onSelect:()=>p(t.oid,o)},o.path))]})]})]})}const M=10,S=26,A=52,F=["var(--primary)","var(--chart-2)","var(--chart-3)","var(--chart-4)","var(--chart-5)"];function q(s){return 14+Math.max(0,s-1)*M}function T(s){return 7+s*M}function L(s){return F[s%F.length]}function J({graph:s,width:n}){return e.jsxs("svg",{className:"commit-graph",width:n,height:A,viewBox:`0 0 ${n} ${A}`,"aria-hidden":"true",children:[s.segments.map((t,l)=>{const a=T(t.fromLane),i=T(t.toLane),m=t.from==="top"?0:S,d=t.to==="node"?S:A,j=(m+d)/2,p=a===i?`M ${a} ${m} L ${i} ${d}`:`M ${a} ${m} C ${a} ${j}, ${i} ${j}, ${i} ${d}`;return e.jsx("path",{d:p,stroke:L(t.color)},`${l}:${p}`)}),e.jsx("circle",{cx:T(s.lane),cy:S,r:"4",fill:"var(--sidebar)",stroke:L(s.color)}),e.jsx("circle",{cx:T(s.lane),cy:S,r:"1.5",fill:L(s.color)})]})}function Z({graph:s,width:n}){return e.jsx("svg",{className:"commit-graph-continuation",width:n,viewBox:`0 0 ${n} 100`,preserveAspectRatio:"none","aria-hidden":"true",children:s.continuations.map(t=>e.jsx("line",{x1:T(t.lane),y1:"0",x2:T(t.lane),y2:"100",stroke:L(t.color)},t.lane))})}function ee({file:s,onSelect:n}){const t=w.useRef(null),l=s.path.lastIndexOf("/"),a=l<0?s.path:s.path.slice(l+1),i=s.oldPath?.split("/").pop();return e.jsxs("div",{ref:t,className:"commit-file-row",children:[e.jsxs(C,{children:[e.jsxs(v,{render:e.jsx("button",{className:"commit-file-label",onClick:n,"aria-label":`Ver el diff de ${s.path}`}),children:[e.jsx(ie,{path:s.path,type:"file"}),e.jsxs("span",{className:"commit-file-text",children:[e.jsx("span",{children:a}),i&&e.jsxs("small",{className:"commit-file-rename",children:[i," →"]})]})]}),e.jsx($,{anchor:t,side:"right",sideOffset:10,children:s.oldPath?`${s.oldPath} → ${s.path}`:s.path})]}),e.jsx("span",{className:"commit-file-stats",children:s.binary?e.jsx("span",{className:"binary",children:"bin"}):e.jsxs(e.Fragment,{children:[s.additions>0&&e.jsxs("span",{className:"add",children:["+",s.additions]}),s.deletions>0&&e.jsxs("span",{className:"del",children:["−",s.deletions]})]})}),e.jsx("span",{className:"status-code","data-kind":s.kind,children:U(s.kind)})]})}function se(s){return s.map(n=>n.startsWith("tag: ")?{label:n.slice(5),kind:"tag"}:n.startsWith("HEAD -> ")?{label:n.slice(8),kind:"head"}:n==="HEAD"?{label:"HEAD",kind:"head"}:{label:n,kind:n.includes("/")?"remote":"branch"})}const te=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),ne=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function ae(s){const n=new Date(s);if(Number.isNaN(n.getTime()))return s;const t=Math.round((n.getTime()-Date.now())/1e3);for(const[l,a]of ne)if(Math.abs(t)>=a)return te.format(Math.trunc(t/a),l);return"right now"}function oe(s){const n=new Date(s);return Number.isNaN(n.getTime())?s:new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"}).format(n)}function ie({path:s}){return e.jsx("img",{className:"vscode-tree-icon",src:Y(s),alt:"","aria-hidden":"true",draggable:!1})}function re(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{ue as HistoryView};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DDbUjVD9.js","assets/platform-BMNQ8V5r.js","assets/index-BgLrS_2D.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as l,r as f}from"./index-BdjG_WtS.js";import{r as o,j as i}from"./react-rd22PHbN.js";import{E as m}from"./EditContext-CvJWfVl1.js";import{A as E}from"./App-CeDVj5Hh.js";import{E as d}from"./edit-ready-context-D77R8XU8.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";function h({enabled:a,children:s}){const[r,n]=o.useState(null);o.useEffect(()=>{if(!a||r)return;let t=!0;return l(()=>import("./index-DDbUjVD9.js"),__vite__mapDeps([0,1,2])).then(e=>{t&&n(()=>e.Editor)}).catch(e=>{t&&E.error({title:"Could not load the code editor",description:e instanceof Error?e.message:"Unknown error"})}),()=>{t=!1}},[r,a]);const u=o.useCallback(t=>{if(!r)throw new Error("Pierre edit mode has not loaded.");return new r({clipboard:{readText:()=>f()},...t})},[r]);return r?i.jsx(m,{createEditor:u,children:i.jsx(d.Provider,{value:!0,children:s})}):i.jsx(d.Provider,{value:!1,children:s})}export{h as PierreEditBoundary};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as b}from"./react-rd22PHbN.js";import{a as p}from"./tanstack-Bsd5UOY4.js";import{c as N,B as t,I as f,T as c,a as o,b as u}from"./index-BdjG_WtS.js";import{C as k}from"./checkbox-BpmQTxn7.js";import{k as h,H as x,l as j,a2 as I,U as y,t as S}from"./App-CeDVj5Hh.js";import{o as w}from"./gh-utils-D00lyruw.js";import{G as P,I as R,a as E,b as G}from"./GitHubAvatar-Ch_PaCv3.js";import{P as L,i as O,j as D,k as T,l as M}from"./base-ui-D4MeJpa3.js";const z=[["path",{d:"M9 19c-4.3 1.4 -4.3 -2.5 -6 -3m12 5v-3.5c0 -1 .1 -1.4 -.5 -2c2.8 -.3 5.5 -1.4 5.5 -6a4.6 4.6 0 0 0 -1.3 -3.2a4.2 4.2 0 0 0 -.1 -3.2s-1.1 -.3 -3.5 1.3a12.3 12.3 0 0 0 -6.2 0c-2.4 -1.6 -3.5 -1.3 -3.5 -1.3a4.2 4.2 0 0 0 -.1 3.2a4.6 4.6 0 0 0 -1.3 3.2c0 4.6 2.7 5.7 5.5 6c-.6 .6 -.6 1.2 -.5 2v3.5",key:"svg-0"}]],d=N("outline","brand-github","BrandGithub",z);const q=[["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"}]],$=N("outline","filter","Filter",q);const H=[["path",{d:"M5 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 12a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-2"}],["path",{d:"M7 8l0 8",key:"svg-3"}],["path",{d:"M7 8a4 4 0 0 0 4 4h4",key:"svg-4"}]],A=N("outline","git-merge","GitMerge",H);function ae(s){return s.info===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking repository…"})]}):s.info.isGitHub?s.ghStatus===null?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Checking GitHub CLI…"})]}):s.ghStatus.installed?s.ghStatus.authStatus==="unauthenticated"?e.jsxs(m,{icon:e.jsx(d,{}),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(f,{})," Copy command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]})]}):e.jsx(F,{...s,nameWithOwner:s.info.nameWithOwner??""}):e.jsxs(m,{icon:e.jsx(d,{}),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(f,{})," Copy install command"]}),e.jsxs(t,{variant:"ghost",size:"sm",onClick:s.onRefresh,children:[e.jsx(j,{})," Check again"]})]}),e.jsx("small",{children:"Download from cli.github.com, then check again."})]}):e.jsxs(m,{icon:e.jsx(d,{}),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 F(s){const l=b.useRef(null),n=s.pulls,i=p({count:n?.length??0,getScrollElement:()=>l.current,estimateSize:()=>68,getItemKey:a=>n?.[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(d,{"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(h,{className:"animate-spin"}):e.jsx(j,{})}),e.jsx(u,{children:"Refresh pull requests"})]}),e.jsxs(L,{children:[e.jsx(O,{render:e.jsx(t,{variant:v(s.states)?"ghost":"secondary",size:"icon-xs",className:"change-action-button","aria-label":"Filter pull requests","aria-pressed":!v(s.states)}),children:e.jsx($,{})}),e.jsx(D,{children:e.jsx(T,{side:"bottom",align:"end",sideOffset:4,className:"isolate z-50 outline-none",children:e.jsxs(M,{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(k,{id:`pulls-state-${a.toLowerCase()}`,checked:s.states.includes(a),onCheckedChange:r=>s.onStateChange(a,r===!0)}),e.jsx(C,{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(I,{})," 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:l,className:"pulls-scroll",role:"list","aria-label":`${s.states.map(g).join(", ")||"No"} pull requests`,children:n===null&&!s.error?e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(h,{className:"spinner"})," ",e.jsx(x,{text:"Loading pull requests…"})]}):n!==null&&n.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."}):n!==null&&e.jsx("div",{className:"virtual-list",style:{height:i.getTotalSize()},children:i.getVirtualItems().map(a=>{const r=n[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(_,{pr:r,active:s.activeNumber===r.number,onSelect:s.onSelect})},a.key)})})})]})}function _({pr:s,active:l,onSelect:n}){const i=s.state.toLowerCase(),a=W(s.updatedAt);return e.jsxs("div",{className:`pull-item ${l?"active":""}`,role:"listitem",children:[e.jsxs("button",{className:"pull-main",onClick:()=>n(s),"aria-label":`View pull request #${s.number}`,children:[e.jsx("span",{className:`pull-state-icon ${i}${s.isDraft?" draft":""}`,"aria-label":s.isDraft?"Draft":g(s.state),children:e.jsx(C,{state:s.state})}),e.jsxs("span",{className:"pull-content",children:[e.jsx("span",{className:"pull-title",children:s.title||"(no title)"}),e.jsxs("span",{className:"pull-meta",children:[e.jsxs("span",{className:"pull-number",children:["#",s.number]}),e.jsx(P,{src:s.authorAvatarUrl,className:"pull-avatar"}),e.jsx("span",{className:"pull-author",children:s.author}),e.jsx(V,{state:s.checksState}),s.isDraft&&e.jsx("span",{className:"pull-draft-label",children:"Draft"})]})]}),e.jsxs("span",{className:"pull-row-aside",children:[a&&e.jsx("span",{children:a}),e.jsxs("span",{className:"pull-line-stats",children:[e.jsxs("span",{className:"add",children:["+",s.additions]})," ",e.jsxs("span",{className:"del",children:["−",s.deletions]})]})]})]}),e.jsxs(c,{children:[e.jsx(o,{render:e.jsx(t,{variant:"ghost",size:"icon-xs",className:"change-action-button pull-open-external",onClick:()=>w(s.url),"aria-label":`Open #${s.number} on GitHub`}),children:e.jsx(S,{})}),e.jsx(u,{children:"Open on GitHub"})]})]})}function C({state:s,className:l}){return s==="MERGED"?e.jsx(A,{"aria-hidden":"true",className:l}):e.jsx(y,{"aria-hidden":"true",className:l})}function V({state:s}){if(s==="NONE")return null;const l=s==="PASSING"?"Checks passing":s==="FAILING"?"Checks failing":"Checks pending",n=s==="PASSING"?R:s==="FAILING"?E:G;return e.jsx("span",{className:`pull-checks ${s.toLowerCase()}`,"aria-label":l,children:e.jsx(n,{"aria-hidden":"true"})})}function g(s){return s==="OPEN"?"Open":s==="CLOSED"?"Closed":"Merged"}function v(s){return s.length===1&&s[0]==="OPEN"}function m({icon:s,title:l,children:n}){return e.jsxs("div",{className:"pulls-notice",children:[e.jsx("span",{className:"pulls-notice-icon","aria-hidden":"true",children:s}),e.jsx("strong",{children:l}),e.jsx("p",{children:n})]})}const B=new Intl.RelativeTimeFormat("en",{numeric:"auto"}),U=[["year",31536e3],["month",2592e3],["week",604800],["day",86400],["hour",3600],["minute",60]];function W(s){const l=new Date(s);if(Number.isNaN(l.getTime()))return null;const n=Math.round((l.getTime()-Date.now())/1e3);for(const[i,a]of U)if(Math.abs(n)>=a)return B.format(Math.trunc(n/a),i);return"right now"}export{ae as PullRequestsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as e}from"./react-rd22PHbN.js";import{D as q,c as Q,d as Z,e as ee,g as I,I as se,m as k,_ as P,k as z,$ as _,y as E,a0 as ne,S as ae,E as ie,C as re,F as oe,G as O,a1 as te}from"./App-CeDVj5Hh.js";import{c as M,B as r,T as w,a as C,b as R,o as h}from"./index-BdjG_WtS.js";import{I as le}from"./IconFolderPlus-DSSB-ikf.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";const ce=[["path",{d:"M3 21v-4a3 3 0 0 1 3 -3h5",key:"svg-0"}],["path",{d:"M8 17l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M3 11v-5a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8",key:"svg-2"}]],de=M("outline","folder-symlink","FolderSymlink",ce);const me=[["path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4",key:"svg-0"}],["path",{d:"M13.5 6.5l4 4",key:"svg-1"}]],he=M("outline","pencil","Pencil",me),B="__opentig_no_project__";function ve({open:l,projects:c,repositories:v,onOpenChange:L,onOrganizationChange:A,onForgetRepository:G,onRelocateRepository:S}){const[J,u]=o.useState(null),[x,f]=o.useState(null),[N,D]=o.useState(""),[g,d]=o.useState(null),[b,T]=o.useState(""),[K,p]=o.useState(null),[n,y]=o.useState(null),[$,m]=o.useState(null),V=o.useMemo(()=>new Map(c.flatMap(s=>s.repositoryKeys.map(a=>[a,s.id]))),[c]);o.useEffect(()=>{l||(u(null),f(null),d(null),p(null),m(null))},[l]);const j=async(s,a)=>{y(s),m(null);try{const t=await a();return A(t),!0}catch(t){return m(F(t)),!1}finally{y(null)}},W=async s=>{s.preventDefault();const a=N.trim();!a||n||await j("create",()=>h.projects.create(a))&&D("")},X=async s=>{s.preventDefault();const a=b.trim();!g||!a||n||await j(`rename:${g}`,()=>h.projects.rename(g,a))&&d(null)},H=async s=>{n||await j(`remove:${s}`,()=>h.projects.remove(s))&&p(null)},U=async(s,a)=>{n||await j(`assign:${s}`,()=>h.projects.assign(s,a))},Y=async s=>{if(!n){if(m(null),!window.opentigDesktop){f(s);return}y(`relocate:${s.key}`);try{const a=await h.repository.select(`Relocate ${s.name}`);a&&await S(s,a)}catch(a){m(F(a))}finally{y(null)}}};return e.jsxs(q,{open:l,onOpenChange:s=>{n||L(s)},children:[e.jsxs(Q,{className:"repository-projects-dialog w-[min(660px,calc(100vw-2.5rem))]",children:[e.jsxs("header",{className:"repository-projects-header",children:[e.jsxs("div",{children:[e.jsx(Z,{children:"Manage projects"}),e.jsx(ee,{children:"Group repositories, update their locations, or remove them from OpenTig. Files stay on disk."})]}),e.jsx(I,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":"Close project management",disabled:!!n}),children:e.jsx(se,{})})]}),e.jsxs("div",{className:"repository-projects-body",children:[$&&e.jsxs("div",{className:"repository-projects-error",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsx("span",{children:$})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"projects-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"projects-heading",children:["Projects ",e.jsx("span",{children:c.length})]}),e.jsxs("form",{className:"repository-project-create",onSubmit:s=>{W(s)},children:[e.jsx("label",{className:"sr-only",htmlFor:"new-project-name",children:"Project name"}),e.jsx("input",{id:"new-project-name",value:N,maxLength:P,onChange:s=>D(s.target.value),placeholder:"New project name",disabled:!!n}),e.jsxs(r,{type:"submit",size:"sm",disabled:!N.trim()||!!n,children:[n==="create"?e.jsx(z,{className:"animate-spin"}):e.jsx(le,{})," Create"]})]})]}),e.jsxs("div",{className:"repository-project-list",children:[c.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No projects yet. Create one to group related repositories."}),c.map(s=>{const a=s.repositoryKeys.length,t=n===`rename:${s.id}`||n===`remove:${s.id}`;return e.jsx("div",{className:"repository-project-row","aria-busy":t||void 0,children:g===s.id?e.jsxs("form",{className:"repository-inline-form",onSubmit:i=>{X(i)},onKeyDown:i=>{i.key==="Escape"&&d(null)},children:[e.jsxs("label",{className:"sr-only",htmlFor:`rename-project-${s.id}`,children:["Rename ",s.name]}),e.jsx("input",{id:`rename-project-${s.id}`,autoFocus:!0,value:b,maxLength:P,onChange:i=>T(i.target.value),disabled:!!n}),e.jsx(r,{type:"submit",size:"xs",disabled:!b.trim()||!!n,children:"Save"}),e.jsx(r,{type:"button",variant:"ghost",size:"xs",onClick:()=>d(null),disabled:!!n,children:"Cancel"})]}):K===s.id?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Delete ",e.jsx("strong",{children:s.name}),"? Its repositories stay available, just ungrouped."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{H(s.id)},children:"Delete"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>p(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"repository-project-icon","aria-hidden":"true",children:e.jsx(_,{})}),e.jsxs("span",{className:"repository-project-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs("small",{children:[a," ",a===1?"repository":"repositories"]})]}),e.jsxs("span",{className:"repository-row-actions",children:[e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${s.name}`,disabled:!!n,onClick:()=>{d(s.id),T(s.name),p(null)},children:e.jsx(he,{})}),e.jsx(r,{variant:"ghost",size:"icon-sm",className:"repository-row-delete","aria-label":`Delete ${s.name}`,disabled:!!n,onClick:()=>{p(s.id),d(null)},children:e.jsx(E,{})})]})]})},s.id)})]})]}),e.jsxs("section",{className:"repository-projects-section","aria-labelledby":"repository-assignments-heading",children:[e.jsxs("div",{className:"repository-projects-section-heading",children:[e.jsxs("h3",{id:"repository-assignments-heading",children:["Repositories ",e.jsx("span",{children:v.length})]}),e.jsx("p",{children:"One project per repository"})]}),e.jsxs("div",{className:"repository-assignment-list",children:[v.length===0&&e.jsx("p",{className:"repository-projects-empty",children:"No recent repositories to assign yet."}),v.map(s=>{const a=V.get(s.key)??B,t=n?.endsWith(`:${s.key}`);return e.jsx("div",{className:"repository-assignment-row","aria-busy":t||void 0,children:J===s.key?e.jsxs("div",{className:"repository-project-confirm",role:"alert",children:[e.jsx(k,{"aria-hidden":"true"}),e.jsxs("span",{children:["Remove ",e.jsx("strong",{children:s.name})," and its worktrees from OpenTig? Their folders and files stay on disk. You can open them again later."]}),e.jsx(r,{variant:"destructive",size:"xs",disabled:!!n,onClick:()=>{j(`forget:${s.key}`,()=>G(s)).then(i=>{i&&u(null)})},children:"Remove"}),e.jsx(r,{variant:"ghost",size:"xs",disabled:!!n,onClick:()=>u(null),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{"aria-hidden":"true"}),e.jsxs("span",{className:"repository-assignment-copy",children:[e.jsx("strong",{children:s.name}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx("small",{}),children:ne(s.rootPath,4)}),e.jsx(R,{children:s.rootPath})]})]}),t&&e.jsx(z,{className:"repository-assignment-busy animate-spin","aria-hidden":"true"}),e.jsxs(ae,{value:a,onValueChange:i=>{U(s.key,i===B?null:i)},disabled:!!n,children:[e.jsx(ie,{size:"sm","aria-label":`Project for ${s.name}`,children:e.jsx(re,{children:c.find(i=>i.id===a)?.name??"No project"})}),e.jsxs(oe,{align:"end",alignItemWithTrigger:!1,children:[e.jsx(O,{value:B,children:"No project"}),c.map(i=>e.jsx(O,{value:i.id,children:i.name},i.id))]})]}),e.jsxs("span",{className:"repository-management-actions",children:[e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Relocate ${s.name}`,disabled:!!n,onClick:()=>{Y(s)}}),children:e.jsx(de,{})}),e.jsx(R,{children:"Relocate repository"})]}),e.jsxs(w,{children:[e.jsx(C,{render:e.jsx(r,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.name} from OpenTig`,disabled:!!n,onClick:()=>{u(s.key),m(null)}}),children:e.jsx(E,{})}),e.jsx(R,{children:"Remove from OpenTig"})]})]})]})},s.key)})]})]})]}),e.jsx("footer",{className:"repository-projects-footer",children:e.jsx(I,{render:e.jsx(r,{variant:"outline",size:"sm",disabled:!!n}),children:"Done"})})]}),e.jsx(te,{open:x!==null,onOpenChange:s=>{s||f(null)},title:"Relocate repository",description:`Choose the existing server folder for ${x?.name??"this repository"}. This updates its saved location; it does not move files.`,confirmLabel:"Use this folder",onBrowse:h.repository.browseDirectories,onOpen:async s=>{x&&await S(x,s)}})]})}function F(l){return l instanceof Error?l.message:String(l)}export{ve as RepositoryProjectsDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as e}from"./react-rd22PHbN.js";import{a6 as pe,a7 as A,P,j as fe,H as Y,k as me,A as m}from"./App-CeDVj5Hh.js";import{u as xe,a as ve}from"./tanstack-Bsd5UOY4.js";import{c as x,B as k,T as W,a as D,b as H,o as J,q as je}from"./index-BdjG_WtS.js";import"./base-ui-D4MeJpa3.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 Be({repositoryId:l,active:c,revision:i,onOpenFile:h,unsavedPathsAmong:g,onReplaced:o}){const O=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),[B,re]=t.useState(""),[w,ce]=t.useState(!1),[S,ie]=t.useState(!1),[$,L]=t.useState(!1),[oe,he]=t.useState(0),[Q,G]=t.useState(()=>new Set),K=t.useRef(null),V=t.useRef(null),R=t.useMemo(()=>({query:f,matchCase:M,wholeWord:N,regex:b,includeIgnored:w}),[f,M,N,b,w]),de=t.useMemo(()=>Ie(R),[R]),v=f.trim(),C=ze(v,Te),d=xe({queryKey:je.search(l,{query:C,matchCase:M,wholeWord:N,regex:b,includeIgnored:w,revision:i,replaceRevision:oe}),queryFn:()=>J.repository.search(l,{...R,query:C}),enabled:c&&C.length>0,placeholderData:(a,s)=>s?.queryKey[1]===l?a:void 0}),n=v?d.data??null:null,z=!!v&&(C!==v||d.isFetching),U=v&&d.error?d.error instanceof Error?d.error.message:"The search failed.":null;t.useEffect(()=>{c&&K.current?.focus()},[c]),t.useEffect(()=>{d.data&&G(new Set(d.data.files.filter(a=>a.ignored).map(a=>a.path)))},[d.data]);const I=t.useMemo(()=>{if(!n)return[];const a=[];for(const s of n.files){const u=!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:()=>V.current,estimateSize:a=>O?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,O]);const ue=a=>G(s=>{const u=new Set(s);return u.delete(a)||u.add(a),u}),j=n?.files.filter(a=>a.ignored).length??0,y=n?.files.filter(a=>!!a.revision&&(S||!a.ignored))??[],q=async a=>{if(!n||$)return;const s=a==="all"?{kind:"all",files:y.map(r=>({path:r.path,revision:r.revision}))}:"match"in a?{kind:"match",path:a.file.path,revision:a.file.revision,line:a.match.line,column:a.match.column}:{kind:"file",path:a.path,revision:a.revision};if(s.kind==="all"){if(n.truncated){m.info({title:"Narrow the search before replacing all",description:"The current result set is truncated."});return}const r=y.reduce((F,ge)=>F+ge.matches.length,0);if(!r||!window.confirm(`Replace ${r} ${r===1?"occurrence":"occurrences"} in ${y.length} ${y.length===1?"file":"files"}?`))return}else if(s.kind==="file"&&a!=="all"&&!("match"in a)&&a.truncatedMatches&&!window.confirm(`${a.path} has more matches than the ${a.matches.length} listed. Replace every occurrence in the file?`))return;const u=s.kind==="all"?s.files.map(r=>r.path):[s.path],E=g(u);if(E.length>0){m.error({title:"Save open files before replacing in them",description:E.join(", "),duration:1e4});return}L(!0);try{const r=await J.repository.replaceSearch(l,{options:{...R,query:f.trim()},replacement:B,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:K,type:"text",value:f,spellCheck:!1,placeholder:"Search in repository","aria-label":"Search in repository",onChange:a=>ae(a.target.value)}),e.jsxs("span",{className:"search-toggles",children:[e.jsx(_,{label:"Match case",active:M,onToggle:()=>se(a=>!a),children:e.jsx(Me,{})}),e.jsx(_,{label:"Match whole word",active:N,onToggle:()=>te(a=>!a),children:e.jsx($e,{})}),e.jsx(_,{label:"Use regular expression",active:b,onToggle:()=>le(a=>!a),children:e.jsx(be,{})}),e.jsx(_,{label:"Search Git-ignored files",active:w,onToggle:()=>ce(a=>!a),children:e.jsx(X,{})})]})]})]}),p&&e.jsxs("div",{className:"search-replace-row",children:[e.jsx(Z,{"aria-hidden":"true"}),e.jsx("input",{value:B,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(H,{children:n?.truncated?"Narrow the search to replace all":"Replace all"})]})]}),p&&j>0&&e.jsxs("label",{className:"search-include-ignored",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:a=>ie(a.target.checked)})," Include ignored files when replacing"]}),f.trim()!==""&&(n!==null||!z)&&e.jsx("div",{className:"search-summary",children:z?e.jsx(Y,{text:"Searching…"}):U?e.jsx("span",{className:"search-error",children:U}):n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n.totalMatches===0?"No results":`${n.totalMatches-n.ignoredMatches}${n.truncated?"+":""} ${n.totalMatches-n.ignoredMatches===1?"result":"results"} in ${n.files.length-j} ${n.files.length-j===1?"file":"files"}`}),n.ignoredMatches>0&&e.jsxs("span",{className:"search-summary-ignored",children:["· ",n.ignoredMatches," in ",j," ignored ",j===1?"file":"files"]})]})})]}),e.jsxs("div",{ref:V,className:"search-results",children:[z&&!n&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(me,{className:"spinner"})," ",e.jsx(Y,{text:"Searching…"})]}),e.jsx("div",{className:"search-rows virtual-list",style:{height:T.getTotalSize()},children:T.getVirtualItems().map(a=>{const s=I[a.index];return s?e.jsx("div",{className:"virtual-row",style:{height:a.size,transform:`translateY(${a.start}px)`},children:s.kind==="file"?e.jsxs("div",{className:`search-file-heading ${s.file.ignored?"ignored":""}`,children:[e.jsxs("button",{className:"search-file-toggle",onClick:()=>ue(s.file.path),"aria-expanded":s.open,children:[s.open?e.jsx(A,{}):e.jsx(P,{}),e.jsx("span",{className:"search-file-name",children:s.file.path}),s.file.ignored&&e.jsxs(W,{children:[e.jsx(D,{render:e.jsx("span",{className:"search-file-ignored-badge"}),children:e.jsx(X,{})}),e.jsx(H,{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(H,{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{Be as SearchView};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as m,j as e}from"./react-rd22PHbN.js";import{ay as Ns,az as fe,aA as Ke,aB as Xe,aC as Cs,aD as Ss,aE as Ms,aF as Es,aG as Rs,aH as As,A as N,D as H,c as V,d as W,e as Y,k as X,l as ge,y as Ce,g as K,I as Se,H as Me,B as Q,aI as Is,aJ as xe,aK as Oe,Q as qe,aL as Je,aM as Ze,aN as Ts,aO as Le,aP as Os,aQ as Ls,m as Ee,S as re,E as oe,C as le,F as ce,aR as Ps,G as de,aS as $s,aT as Pe,i as Fs,aU as zs,aV as _s,aW as Ds,aX as Bs,X as Us,aY as je,aZ as Gs}from"./App-CeDVj5Hh.js";import{c as O,d as ee,o as te,B as w,T as F,a as z,b as _,I as $e,w as Fe}from"./index-BdjG_WtS.js";import{b as Qe,t as es,c as ss,r as ts,d as ns}from"./tanstack-Bsd5UOY4.js";import{I as Hs}from"./IconEdit-RxH71_V-.js";import"./base-ui-D4MeJpa3.js";const Vs=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],as=O("outline","arrows-sort","ArrowsSort",Vs);const Ws=[["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"}]],Ys=O("outline","browser","Browser",Ws);const Ks=[["path",{d:"M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10",key:"svg-0"}],["path",{d:"M7 20h10",key:"svg-1"}],["path",{d:"M9 16v4",key:"svg-2"}],["path",{d:"M15 16v4",key:"svg-3"}]],is=O("outline","device-desktop","DeviceDesktop",Ks);const Xs=[["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"}]],qs=O("outline","keyboard","Keyboard",Xs);const Js=[["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"}]],Zs=O("outline","link","Link",Js);const Qs=[["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"}]],et=O("outline","list","List",Qs);const st=[["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"}]],tt=O("outline","moon","Moon",st);const nt=[["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"}]],at=O("outline","network","Network",nt);const it=[["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"}]],rt=O("outline","qrcode","Qrcode",it);const ot=[["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"}]],ze=O("outline","shield-lock","ShieldLock",ot);const lt=[["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"}]],rs=O("outline","sort-ascending","SortAscending",lt);const ct=[["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"}]],os=O("outline","sort-descending","SortDescending",ct);const dt=[["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"}]],ht=O("outline","sparkles","Sparkles",dt);const ut=[["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"}]],gt=O("outline","sun","Sun",ut);function _e(s,t){if(typeof s=="function")return s(t);s!=null&&(s.current=t)}function mt(...s){return t=>{let n=!1;const a=s.map(i=>{const r=_e(i,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<a.length;i++){const r=a[i];typeof r=="function"?r():_e(s[i],null)}}}}function pt(...s){return m.useCallback(mt(...s),s)}class ft extends m.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(fe(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=n.offsetParent,i=fe(a)&&a.offsetWidth||0,r=fe(a)&&a.offsetHeight||0,o=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(o.height),c.width=parseFloat(o.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=i-c.width-c.left,c.bottom=r-c.height-c.top,c.direction=o.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function xt({children:s,isPresent:t,anchorX:n,anchorY:a,root:i,pop:r}){const o=m.useId(),c=m.useRef(null),h=m.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:f}=m.useContext(Ns),p=r!==!1?s.props?.ref??s?.ref:void 0,u=pt(c,p);return m.useInsertionEffect(()=>{const{width:l,height:x,top:j,left:v,right:y,bottom:S,direction:M}=h.current;if(t||r===!1||!c.current||!l||!x)return;const I=M==="rtl",C=n==="left"?I?`right: ${y}`:`left: ${v}`:I?`left: ${v}`:`right: ${y}`,E=a==="bottom"?`bottom: ${S}`:`top: ${j}`;c.current.dataset.motionPopId=o;const R=document.createElement("style");f&&(R.nonce=f);const L=i??document.head;return L.appendChild(R),R.sheet&&R.sheet.insertRule(`
|
|
2
|
-
[data-motion-pop-id="${o}"] {
|
|
3
|
-
position: absolute !important;
|
|
4
|
-
width: ${l}px !important;
|
|
5
|
-
height: ${x}px !important;
|
|
6
|
-
${C}px !important;
|
|
7
|
-
${E}px !important;
|
|
8
|
-
}
|
|
9
|
-
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),L.contains(R)&&L.removeChild(R)}},[t]),e.jsx(ft,{isPresent:t,childRef:c,sizeRef:h,pop:r,children:r===!1?s:m.cloneElement(s,{ref:u})})}const jt=({children:s,initial:t,isPresent:n,onExitComplete:a,custom:i,presenceAffectsLayout:r,mode:o,anchorX:c,anchorY:h,root:f})=>{const p=Ke(vt),u=m.useId(),l=m.useRef(n),x=m.useRef(a);Xe(()=>{l.current=n,x.current=a});let j=!0,v=m.useMemo(()=>(j=!1,{id:u,initial:t,isPresent:n,custom:i,onExitComplete:y=>{p.set(y,!0);for(const S of p.values())if(!S)return;a&&a()},register:y=>(p.set(y,!1),()=>{p.delete(y),!l.current&&!p.size&&x.current?.()})}),[n,p,a]);return r&&j&&(v={...v}),m.useMemo(()=>{p.forEach((y,S)=>p.set(S,!1))},[n]),m.useEffect(()=>{!n&&!p.size&&a&&a()},[n]),s=e.jsx(xt,{pop:o==="popLayout",isPresent:n,anchorX:c,anchorY:h,root:f,children:s}),e.jsx(Cs.Provider,{value:v,children:s})};function vt(){return new Map}const ne=s=>s.key||"";function De(s){const t=[];return m.Children.forEach(s,n=>{m.isValidElement(n)&&t.push(n)}),t}const Be=({children:s,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:i=!0,mode:r="sync",propagate:o=!1,anchorX:c="left",anchorY:h="top",root:f})=>{const[p,u]=Ss(o),l=m.useMemo(()=>De(s),[s]),x=o&&!p?[]:l.map(ne),j=m.useRef(!0),v=m.useRef(l),y=Ke(()=>new Map),S=m.useRef(new Set),[M,I]=m.useState(l),[C,E]=m.useState(l);Xe(()=>{j.current=!1,v.current=l;for(let A=0;A<C.length;A++){const d=ne(C[A]);x.includes(d)?(y.delete(d),S.current.delete(d)):y.get(d)!==!0&&y.set(d,!1)}},[C,x.length,x.join("-")]);const R=[];if(l!==M){let A=[...l];for(let d=0;d<C.length;d++){const b=C[d],k=ne(b);x.includes(k)||(A.splice(d,0,b),R.push(b))}return r==="wait"&&R.length&&(A=R),E(De(A)),I(l),null}const{forceRender:L}=m.useContext(Ms);return e.jsx(e.Fragment,{children:C.map(A=>{const d=ne(A),b=o&&!p?!1:l===C||x.includes(d),k=()=>{if(S.current.has(d))return;if(y.has(d))S.current.add(d),y.set(d,!0);else return;let q=!0;y.forEach(me=>{me||(q=!1)}),q&&(L?.(),E(v.current),o&&u?.(),a&&a())};return e.jsx(jt,{isPresent:b,initial:!j.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:r,root:f,onExitComplete:b?void 0:k,anchorX:c,anchorY:h,children:A},d)})})};function bt(){!Es.current&&Rs();const[s]=m.useState(As.current);return s}function ls({className:s,...t}){return e.jsx("div",{"data-slot":"table-container",className:"relative w-full",children:e.jsx("table",{"data-slot":"table",className:ee("w-full caption-bottom text-xs",s),...t})})}function cs({className:s,...t}){return e.jsx("thead",{"data-slot":"table-header",className:ee("[&_tr]:border-b",s),...t})}function ds({className:s,...t}){return e.jsx("tbody",{"data-slot":"table-body",className:ee("[&_tr:last-child]:border-0",s),...t})}function ue({className:s,...t}){return e.jsx("tr",{"data-slot":"table-row",className:ee("border-b border-border transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted",s),...t})}function hs({className:s,...t}){return e.jsx("th",{"data-slot":"table-head",className:ee("h-8 whitespace-nowrap px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...t})}function us({className:s,...t}){return e.jsx("td",{"data-slot":"table-cell",className:ee("px-2 py-1.5 align-middle [&:has([role=checkbox])]:pr-0",s),...t})}const yt={"commit-message":"commit message","pull-request-draft":"pull request draft"};function B({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(rs,{size:13}),n==="desc"&&e.jsx(os,{size:13}),!n&&e.jsx(as,{size:13,className:"ai-log-sort-idle"})]})}const wt=es({rowSortingFeature:ts,sortedRowModel:ns()}),P=ss(),kt=P.columns([P.accessor("status",{header:({column:s})=>e.jsx(B,{column:s,label:"Status"}),cell:({getValue:s})=>{const t=s();return e.jsx(Q,{variant:t==="success"?"secondary":t==="cancelled"?"outline":"destructive",children:t})}}),P.accessor("harness",{header:({column:s})=>e.jsx(B,{column:s,label:"Harness"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),P.accessor("model",{header:({column:s})=>e.jsx(B,{column:s,label:"Model"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})}),P.accessor("operation",{header:({column:s})=>e.jsx(B,{column:s,label:"Task"}),cell:({getValue:s})=>yt[s()]}),P.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(B,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:new Date(s.original.at).toLocaleString()})}),P.accessor("durationMs",{header:({column:s})=>e.jsx(B,{column:s,label:"Duration"}),cell:({getValue:s})=>`${(s()/1e3).toFixed(1)}s`}),P.accessor(s=>(s.usage.inputTokens??0)+(s.usage.outputTokens??0),{id:"usage",header:({column:s})=>e.jsx(B,{column:s,label:"Usage"}),cell:({row:s})=>St(s.original)}),P.accessor("stagedFileCount",{header:({column:s})=>e.jsx(B,{column:s,label:"Staged"}),cell:({getValue:s})=>s()??"—"}),P.display({id:"notes",header:"Notes",cell:({row:s})=>{const t=s.original,n=[];return t.errorCode&&n.push({key:"error",text:t.errorCode,tone:"error"}),t.errorMessage&&n.push({key:"error-message",text:t.errorMessage,tone:"error",detail:t.errorMessage}),t.splitOffered===!0&&n.push({key:"split",text:`split: ${t.splitGroups} commits`}),t.splitRejectedReason&&n.push({key:"rejected",text:`split refused: ${t.splitRejectedReason}`,tone:"warn",detail:t.splitRejectedReason}),t.splitBlockedReason&&n.push({key:"blocked",text:`no split: ${t.splitBlockedReason}`,detail:t.splitBlockedReason}),t.contextTruncated===!0&&n.push({key:"truncated",text:"context trimmed"}),n.length===0?null:e.jsx("div",{className:"ai-log-row-notes",children:n.map(a=>e.jsx(Ct,{text:a.text,tone:a.tone,detail:a.detail},a.key))})}})]);function Nt({open:s,onOpenChange:t}){const[n,a]=m.useState([]),[i,r]=m.useState(!1),[o,c]=m.useState([]),h=m.useCallback(async()=>{r(!0);try{a(await te.ai.log())}catch(l){N.error({title:"Could not read the AI history",description:Ge(l)})}finally{r(!1)}},[]);m.useEffect(()=>{s&&h()},[h,s]);const f=m.useMemo(()=>{const l=n.filter(x=>x.status==="failed").length;return{runs:n.length,failed:l,tokens:n.reduce((x,j)=>x+(j.usage.inputTokens??0)+(j.usage.outputTokens??0),0),cost:n.reduce((x,j)=>x+(j.usage.costUsd??0),0),costed:n.filter(x=>x.usage.costUsd!==null).length}},[n]),p=Qe({features:wt,data:n,columns:kt,onSortingChange:c,state:{sorting:o}}),u=async()=>{if(window.confirm("Delete the whole AI history? This cannot be undone."))try{await te.ai.clearLog(),a([])}catch(l){N.error({title:"Could not clear the AI history",description:Ge(l)})}};return e.jsx(H,{open:s,onOpenChange:t,children:e.jsxs(V,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(W,{children:"AI history"}),e.jsx(Y,{children:"Recent generations on this machine. Prompts and file contents are never recorded."})]}),e.jsxs("div",{className:"ai-log-header-actions",children:[e.jsxs(w,{variant:"outline",size:"sm",disabled:i,onClick:()=>{h()},children:[i?e.jsx(X,{className:"animate-spin"}):e.jsx(ge,{})," Refresh"]}),e.jsxs(w,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{u()},children:[e.jsx(Ce,{})," Clear"]}),e.jsx(K,{render:e.jsx(w,{variant:"ghost",size:"icon-sm","aria-label":"Close AI history"}),children:e.jsx(Se,{})})]})]}),n.length>0&&e.jsxs("div",{className:"ai-log-totals",children:[e.jsxs("span",{children:[e.jsx("strong",{children:f.runs})," runs"]}),e.jsxs("span",{children:[e.jsx("strong",{children:f.failed})," failed"]}),e.jsxs("span",{children:[e.jsx("strong",{children:we(f.tokens)})," tokens"]}),f.costed>0&&e.jsxs("span",{children:[e.jsxs("strong",{children:["$",f.cost.toFixed(4)]})," reported by ",f.costed," of ",f.runs]})]}),e.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(X,{className:"spinner"})," ",e.jsx(Me,{text:"Reading history…"})]}),!i&&n.length===0&&e.jsx("p",{className:"ai-log-empty",children:"No generations recorded yet. Generate a commit message and it will show up here."}),n.length>0&&e.jsx("div",{className:"ai-log-table-wrap",children:e.jsxs(ls,{children:[e.jsx(cs,{children:p.getHeaderGroups().map(l=>e.jsx(ue,{children:l.headers.map(x=>e.jsx(hs,{children:x.isPlaceholder?null:e.jsx(p.FlexRender,{header:x})},x.id))},l.id))}),e.jsx(ds,{children:p.getRowModel().rows.map(l=>e.jsx(ue,{className:l.original.status==="failed"?"ai-log-row-failed":void 0,children:l.getAllCells().map(x=>e.jsx(us,{children:e.jsx(p.FlexRender,{cell:x})},x.id))},l.id))})]})})]})]})})}const Ue=140;function Ct({text:s,tone:t,detail:n}){const[a,i]=m.useState(!1),r=s.length>Ue?`${s.slice(0,Ue-1)}…`:s,o=`ai-log-note ${t??""}`;return n?e.jsxs(e.Fragment,{children:[e.jsxs(F,{children:[e.jsx(z,{render:e.jsx("button",{type:"button",className:o,onClick:()=>i(!0),"aria-label":"Read generation details"}),children:r}),e.jsx(_,{className:"max-w-md",children:n})]}),e.jsx(H,{open:a,onOpenChange:i,children:e.jsx(V,{className:"name-dialog",children:e.jsxs("div",{className:"name-dialog-content",children:[e.jsx(W,{children:"Generation details"}),e.jsx(Y,{className:"whitespace-pre-wrap break-words",children:n}),e.jsx("div",{className:"name-dialog-actions",children:e.jsx(K,{render:e.jsx(w,{variant:"outline"}),children:"Close"})})]})})})]}):e.jsx("span",{className:o,children:r})}function St(s){const{inputTokens:t,outputTokens:n,costUsd:a}=s.usage;if(t===null&&n===null)return"no usage reported";const i=`${we(t??0)} in · ${we(n??0)} out`;return a===null?i:`${i} · $${a.toFixed(4)}`}function we(s){return s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function Ge(s){return s instanceof Error?s.message:"An unexpected error occurred."}function se({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(rs,{size:13}),n==="desc"&&e.jsx(os,{size:13}),!n&&e.jsx(as,{size:13,className:"ai-log-sort-idle"})]})}const Mt=es({rowSortingFeature:ts,sortedRowModel:ns()}),Z=ss(),Et=Z.columns([Z.accessor("level",{header:({column:s})=>e.jsx(se,{column:s,label:"Level"}),cell:({getValue:s})=>{const t=s();return e.jsx(Q,{variant:t==="warn"?"outline":"destructive",children:t})}}),Z.accessor("operation",{header:({column:s})=>e.jsx(se,{column:s,label:"Operation"}),cell:({getValue:s})=>e.jsx("strong",{children:s()})}),Z.accessor("code",{header:({column:s})=>e.jsx(se,{column:s,label:"Code"}),cell:({getValue:s})=>s()??"—"}),Z.accessor(s=>new Date(s.at).getTime(),{id:"at",header:({column:s})=>e.jsx(se,{column:s,label:"Date"}),cell:({row:s})=>e.jsx("time",{dateTime:s.original.at,children:new Date(s.original.at).toLocaleString()})}),Z.accessor("message",{header:({column:s})=>e.jsx(se,{column:s,label:"Message"}),cell:({getValue:s})=>e.jsx("span",{className:"ai-log-model",children:s()})})]);function He(s){return s instanceof Error?s.message:"An unexpected error occurred."}function Rt({open:s,onOpenChange:t}){const[n,a]=m.useState([]),[i,r]=m.useState(!1),[o,c]=m.useState([]),h=m.useCallback(async()=>{r(!0);try{a(await te.diagnostics.list())}catch(l){N.error({title:"Could not read local problems",description:He(l)})}finally{r(!1)}},[]);m.useEffect(()=>{s&&h()},[h,s]);const f=m.useMemo(()=>({all:n.length,errors:n.filter(l=>l.level==="error").length}),[n]),p=Qe({features:Mt,data:n,columns:Et,onSortingChange:c,state:{sorting:o}}),u=async()=>{if(window.confirm("Delete the local problem history? This cannot be undone."))try{await te.diagnostics.clear(),a([])}catch(l){N.error({title:"Could not clear local problems",description:He(l)})}};return e.jsx(H,{open:s,onOpenChange:t,children:e.jsxs(V,{className:"ai-log-dialog",children:[e.jsxs("header",{className:"ai-log-header",children:[e.jsxs("div",{children:[e.jsx(W,{children:"Problem history"}),e.jsx(Y,{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(w,{variant:"outline",size:"sm",disabled:i,onClick:()=>{h()},children:[i?e.jsx(X,{className:"animate-spin"}):e.jsx(ge,{})," Refresh"]}),e.jsxs(w,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{u()},children:[e.jsx(Ce,{})," Clear"]}),e.jsx(K,{render:e.jsx(w,{variant:"ghost",size:"icon-sm","aria-label":"Close problem history"}),children:e.jsx(Se,{})})]})]}),n.length>0&&e.jsxs("div",{className:"ai-log-totals",children:[e.jsxs("span",{children:[e.jsx("strong",{children:f.all})," recorded"]}),e.jsxs("span",{children:[e.jsx("strong",{children:f.errors})," errors"]})]}),e.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&e.jsxs("div",{className:"view-loading",role:"status",children:[e.jsx(X,{className:"spinner"})," ",e.jsx(Me,{text:"Reading problems…"})]}),!i&&n.length===0&&e.jsx("p",{className:"ai-log-empty",children:"No local problems recorded yet. Failed Git, file, and network operations will show up here."}),n.length>0&&e.jsx("div",{className:"ai-log-table-wrap",children:e.jsxs(ls,{children:[e.jsx(cs,{children:p.getHeaderGroups().map(l=>e.jsx(ue,{children:l.headers.map(x=>e.jsx(hs,{children:x.isPlaceholder?null:e.jsx(p.FlexRender,{header:x})},x.id))},l.id))}),e.jsx(ds,{children:p.getRowModel().rows.map(l=>e.jsx(ue,{className:l.original.level==="error"?"ai-log-row-failed":void 0,children:l.getAllCells().map(x=>e.jsx(us,{children:e.jsx(p.FlexRender,{cell:x})},x.id))},l.id))})]})})]})]})})}const At=new Set(["Control","Shift","Alt","Meta"]);function It({preferences:s,onPreference:t}){const n=m.useMemo(()=>Is(s.shortcutOverrides),[s.shortcutOverrides]),[a,i]=m.useState(null),r=Object.keys(s.shortcutOverrides).length>0,o=m.useMemo(()=>["General","Commit","Editor","Tabs"].map(u=>({category:u,definitions:xe.filter(l=>l.category===u)})),[]),c=m.useMemo(()=>[...new Set(Oe.map(u=>u.category))].map(u=>({category:u,items:Oe.filter(l=>l.category===u)})),[]),h=(p,u)=>{if(u===n[p]){i(null);return}const l=Ts(p,u,n);if(l){const v=l==="reserved"?`${Le(u)} is reserved for a fixed shortcut.`:`${Le(u)} is already used by "${xe.find(y=>y.id===l).label}".`;i({id:p,message:v});return}i(null);const x=xe.find(v=>v.id===p),j={...s.shortcutOverrides};u===x.defaultCombo?delete j[p]:j[p]=u,t({shortcutOverrides:j})},f=p=>{i(null);const u={...s.shortcutOverrides};delete u[p],t({shortcutOverrides:u})};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(w,{variant:"outline",size:"sm",className:"shortcuts-reset-all",onClick:()=>{i(null),t({shortcutOverrides:{}})},children:[e.jsx(qe,{})," Reset all to defaults"]}),o.map(({category:p,definitions:u})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:p}),u.map(l=>e.jsxs("div",{className:"shortcuts-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:l.label}),e.jsx("span",{children:l.description})]}),e.jsx(Tt,{combo:n[l.id],allowBare:l.allowBare,isCustom:s.shortcutOverrides[l.id]!==void 0,error:a?.id===l.id?a.message:null,onCapture:x=>h(l.id,x),onReset:()=>f(l.id)})]},l.id))]},p))]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Fixed shortcuts"}),e.jsx("span",{children:"These follow platform and file-manager conventions and cannot be changed."})]}),c.map(({category:p,items:u})=>e.jsxs("div",{className:"shortcuts-group",children:[e.jsx("div",{className:"shortcuts-group-heading",children:p}),u.map(l=>e.jsxs("div",{className:"shortcuts-fixed-row",children:[e.jsx("span",{children:l.label}),e.jsx(Je,{children:l.combo.split(" / ").flatMap((x,j)=>[...j>0?[e.jsx("span",{className:"shortcuts-fixed-sep",children:" / "},`sep-${x}`)]:[],...x.split(" + ").map((v,y)=>e.jsx(Ze,{children:v},`${x}-${y}`))])})]},l.combo+l.label))]},p))]})]})}function Tt({combo:s,allowBare:t,isCustom:n,error:a,onCapture:i,onReset:r}){const[o,c]=m.useState(!1);return m.useEffect(()=>{if(!o)return;const h=f=>{if(f.preventDefault(),f.stopPropagation(),f.key==="Escape"){c(!1);return}if(At.has(f.key))return;const p=Os(f);c(!1),p&&Ls(p,t)&&i(p)};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[o,t,i]),e.jsxs("div",{className:"shortcut-recorder",children:[a&&e.jsx("span",{className:"shortcut-recorder-error",children:a}),e.jsx("button",{type:"button",className:`shortcut-recorder-button ${o?"listening":""} ${a?"error":""}`,onClick:()=>c(!0),onBlur:()=>c(!1),children:o?"Press a key…":e.jsx(Je,{children:s.split("+").map(h=>e.jsx(Ze,{children:h},h))})}),n&&e.jsxs(F,{children:[e.jsx(z,{render:e.jsx(w,{variant:"ghost",size:"icon-xs","aria-label":"Reset to default",onClick:r}),children:e.jsx(qe,{})}),e.jsx(_,{children:"Reset to default"})]})]})}var G=(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))(G||{});const Ot=[0,1],gs=[1,0],ms=[2,3],ps=[3,2],Lt={L:Ot,M:gs,Q:ms,H:ps},Pt=/^\d*$/,$t=/^[A-Z0-9 $%*+./:-]*$/,ve="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Re=1,Ae=40,Ve=3,Ft=3,ae=40,zt=10,fs=[[-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]],xs=[[-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 _t{constructor(t,n,a,i){if(this.version=t,this.ecc=n,t<Re||t>Ae)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;const r=Array.from({length:this.size}).fill(!1);for(let c=0;c<this.size;c++)this.modules.push(r.slice()),this.types.push(r.map(()=>0));this.drawFunctionPatterns();const o=this.addEccAndInterleave(a);if(this.drawCodewords(o),i===-1){let c=1e9;for(let h=0;h<8;h++){this.applyMask(h),this.drawFormatBits(h);const f=this.getPenaltyScore();f<c&&(i=h,c=f),this.applyMask(h)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}size;mask;modules=[];types=[];getModule(t,n){return t>=0&&t<this.size&&n>=0&&n<this.size&&this.modules[n][t]}drawFunctionPatterns(){for(let a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2===0,G.Timing),this.setFunctionModule(a,6,a%2===0,G.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const t=this.getAlignmentPatternPositions(),n=t.length;for(let a=0;a<n;a++)for(let i=0;i<n;i++)a===0&&i===0||a===0&&i===n-1||a===n-1&&i===0||this.drawAlignmentPattern(t[a],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const n=this.ecc[1]<<3|t;let a=n;for(let r=0;r<10;r++)a=a<<1^(a>>>9)*1335;const i=(n<<10|a)^21522;for(let r=0;r<=5;r++)this.setFunctionModule(8,r,$(i,r));this.setFunctionModule(8,7,$(i,6)),this.setFunctionModule(8,8,$(i,7)),this.setFunctionModule(7,8,$(i,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,$(i,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,$(i,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,$(i,r));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let a=0;a<12;a++)t=t<<1^(t>>>11)*7973;const n=this.version<<12|t;for(let a=0;a<18;a++){const i=$(n,a),r=this.size-11+a%3,o=Math.floor(a/3);this.setFunctionModule(r,o,i),this.setFunctionModule(o,r,i)}}drawFinderPattern(t,n){for(let a=-4;a<=4;a++)for(let i=-4;i<=4;i++){const r=Math.max(Math.abs(i),Math.abs(a)),o=t+i,c=n+a;o>=0&&o<this.size&&c>=0&&c<this.size&&this.setFunctionModule(o,c,r!==2&&r!==4,G.Position)}}drawAlignmentPattern(t,n){for(let a=-2;a<=2;a++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,n+a,Math.max(Math.abs(i),Math.abs(a))!==1,G.Alignment)}setFunctionModule(t,n,a,i=G.Function){this.modules[n][t]=a,this.types[n][t]=i}addEccAndInterleave(t){const n=this.version,a=this.ecc;if(t.length!==he(n,a))throw new RangeError("Invalid argument");const i=xs[a[0]][n],r=fs[a[0]][n],o=Math.floor(ke(n)/8),c=i-o%i,h=Math.floor(o/i),f=[],p=Kt(r);for(let l=0,x=0;l<i;l++){const j=t.slice(x,x+h-r+(l<c?0:1));x+=j.length;const v=Xt(j,p);l<c&&j.push(0),f.push(j.concat(v))}const u=[];for(let l=0;l<f[0].length;l++)f.forEach((x,j)=>{(l!==h-r||j>=c)&&u.push(x[l])});return u}drawCodewords(t){if(t.length!==Math.floor(ke(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let a=this.size-1;a>=1;a-=2){a===6&&(a=5);for(let i=0;i<this.size;i++)for(let r=0;r<2;r++){const o=a-r,h=(a+1&2)===0?this.size-1-i:i;!this.types[h][o]&&n<t.length*8&&(this.modules[h][o]=$(t[n>>>3],7-(n&7)),n++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let n=0;n<this.size;n++)for(let a=0;a<this.size;a++){let i;switch(t){case 0:i=(a+n)%2===0;break;case 1:i=n%2===0;break;case 2:i=a%3===0;break;case 3:i=(a+n)%3===0;break;case 4:i=(Math.floor(a/3)+Math.floor(n/2))%2===0;break;case 5:i=a*n%2+a*n%3===0;break;case 6:i=(a*n%2+a*n%3)%2===0;break;case 7:i=((a+n)%2+a*n%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[n][a]&&i&&(this.modules[n][a]=!this.modules[n][a])}}getPenaltyScore(){let t=0;for(let r=0;r<this.size;r++){let o=!1,c=0;const h=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[r][f]===o?(c++,c===5?t+=Ve:c>5&&t++):(this.finderPenaltyAddHistory(c,h),o||(t+=this.finderPenaltyCountPatterns(h)*ae),o=this.modules[r][f],c=1);t+=this.finderPenaltyTerminateAndCount(o,c,h)*ae}for(let r=0;r<this.size;r++){let o=!1,c=0;const h=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][r]===o?(c++,c===5?t+=Ve:c>5&&t++):(this.finderPenaltyAddHistory(c,h),o||(t+=this.finderPenaltyCountPatterns(h)*ae),o=this.modules[f][r],c=1);t+=this.finderPenaltyTerminateAndCount(o,c,h)*ae}for(let r=0;r<this.size-1;r++)for(let o=0;o<this.size-1;o++){const c=this.modules[r][o];c===this.modules[r][o+1]&&c===this.modules[r+1][o]&&c===this.modules[r+1][o+1]&&(t+=Ft)}let n=0;for(const r of this.modules)n=r.reduce((o,c)=>o+(c?1:0),n);const a=this.size*this.size,i=Math.ceil(Math.abs(n*20-a*10)/a)-1;return t+=i*zt,t}getAlignmentPatternPositions(){if(this.version===1)return[];{const t=Math.floor(this.version/7)+2,n=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,a=[6];for(let i=this.size-7;a.length<t;i-=n)a.splice(1,0,i);return a}}finderPenaltyCountPatterns(t){const n=t[1],a=n>0&&t[2]===n&&t[3]===n*3&&t[4]===n&&t[5]===n;return(a&&t[0]>=n*4&&t[6]>=n?1:0)+(a&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,a){return t&&(this.finderPenaltyAddHistory(n,a),n=0),n+=this.size,this.finderPenaltyAddHistory(n,a),this.finderPenaltyCountPatterns(a)}finderPenaltyAddHistory(t,n){n[0]===0&&(t+=this.size),n.pop(),n.unshift(t)}}function D(s,t,n){if(t<0||t>31||s>>>t)throw new RangeError("Value out of range");for(let a=t-1;a>=0;a--)n.push(s>>>a&1)}function $(s,t){return(s>>>t&1)!==0}class Ie{constructor(t,n,a){if(this.mode=t,this.numChars=n,this.bitData=a,n<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}getData(){return this.bitData.slice()}}const Dt=[1,10,12,14],Bt=[2,9,11,13],Ut=[4,8,16,16];function js(s,t){return s[Math.floor((t+7)/17)+1]}function vs(s){const t=[];for(const n of s)D(n,8,t);return new Ie(Ut,s.length,t)}function Gt(s){if(!bs(s))throw new RangeError("String contains non-numeric characters");const t=[];for(let n=0;n<s.length;){const a=Math.min(s.length-n,3);D(Number.parseInt(s.substring(n,n+a),10),a*3+1,t),n+=a}return new Ie(Dt,s.length,t)}function Ht(s){if(!ys(s))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let n;for(n=0;n+2<=s.length;n+=2){let a=ve.indexOf(s.charAt(n))*45;a+=ve.indexOf(s.charAt(n+1)),D(a,11,t)}return n<s.length&&D(ve.indexOf(s.charAt(n)),6,t),new Ie(Bt,s.length,t)}function Vt(s){return s===""?[]:bs(s)?[Gt(s)]:ys(s)?[Ht(s)]:[vs(Yt(s))]}function bs(s){return Pt.test(s)}function ys(s){return $t.test(s)}function Wt(s,t){let n=0;for(const a of s){const i=js(a.mode,t);if(a.numChars>=1<<i)return Number.POSITIVE_INFINITY;n+=4+i+a.bitData.length}return n}function Yt(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 ke(s){if(s<Re||s>Ae)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 he(s,t){return Math.floor(ke(s)/8)-fs[t[0]][s]*xs[t[0]][s]}function Kt(s){if(s<1||s>255)throw new RangeError("Degree out of range");const t=[];for(let a=0;a<s-1;a++)t.push(0);t.push(1);let n=1;for(let a=0;a<s;a++){for(let i=0;i<t.length;i++)t[i]=Ne(t[i],n),i+1<t.length&&(t[i]^=t[i+1]);n=Ne(n,2)}return t}function Xt(s,t){const n=t.map(a=>0);for(const a of s){const i=a^n.shift();n.push(0),t.forEach((r,o)=>n[o]^=Ne(r,i))}return n}function Ne(s,t){if(s>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let a=7;a>=0;a--)n=n<<1^(n>>>7)*285,n^=(t>>>a&1)*s;return n}function qt(s,t,n=1,a=40,i=-1,r=!0){if(!(Re<=n&&n<=a&&a<=Ae)||i<-1||i>7)throw new RangeError("Invalid value");let o,c;for(o=n;;o++){const u=he(o,t)*8,l=Wt(s,o);if(l<=u){c=l;break}if(o>=a)throw new RangeError("Data too long")}for(const u of[gs,ms,ps])r&&c<=he(o,u)*8&&(t=u);const h=[];for(const u of s){D(u.mode[0],4,h),D(u.numChars,js(u.mode,o),h);for(const l of u.getData())h.push(l)}const f=he(o,t)*8;D(0,Math.min(4,f-h.length),h),D(0,(8-h.length%8)%8,h);for(let u=236;h.length<f;u^=253)D(u,8,h);const p=Array.from({length:Math.ceil(h.length/8)},()=>0);return h.forEach((u,l)=>p[l>>>3]|=u<<7-(l&7)),new _t(o,t,p,i)}function Jt(s,t){const{ecc:n="L",boostEcc:a=!1,minVersion:i=1,maxVersion:r=40,maskPattern:o=-1,border:c=1}=t||{},h=typeof s=="string"?Vt(s):Array.isArray(s)?[vs(s)]:void 0;if(!h)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof s}`);const f=qt(h,Lt[n],i,r,o,a),p=Zt({version:f.version,maskPattern:f.mask,size:f.size,data:f.modules,types:f.types},c);return t?.invert&&(p.data=p.data.map(u=>u.map(l=>!l))),t?.onEncoded?.(p),p}function Zt(s,t=1){if(!t)return s;const{size:n}=s,a=n+t*2;s.size=a,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:a},o=>!1)),s.data.push(Array.from({length:a},o=>!1));const i=G.Border;s.types.forEach(r=>{for(let o=0;o<t;o++)r.unshift(i),r.push(i)});for(let r=0;r<t;r++)s.types.unshift(Array.from({length:a},o=>i)),s.types.push(Array.from({length:a},o=>i));return s}function We(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qt(s,t={}){const n=Jt(s,t),{pixelSize:a=10,whiteColor:i="white",blackColor:r="black"}=t,o=n.size*a,c=n.size*a;let h=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c} ${o}">`;const f=[];for(let p=0;p<n.size;p++)for(let u=0;u<n.size;u++){const l=u*a,x=p*a;n.data[p][u]&&f.push(`M${l},${x}h${a}v${a}h-${a}z`)}return h+=`<rect fill="${We(i)}" width="${c}" height="${o}"/>`,h+=`<path fill="${We(r)}" d="${f.join("")}"/>`,h+="</svg>",h}async function en(){const s=await fetch("/api/auth/sessions",{credentials:"include"});if(!s.ok)throw new Error(await Te(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 sn(s){return ws("/api/auth/sessions/revoke",{sessionId:s})}async function tn(){return ws("/api/auth/sessions/revoke-all",{})}async function nn(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 Te(n,"Could not rename the browser session."))}async function ws(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 Te(n,"Could not revoke the browser session."));const a=await n.json();if(!Number.isSafeInteger(a.revokedCount)||Number(a.revokedCount)<0)throw new Error("OpenTig returned an invalid revocation result.");return Number(a.revokedCount)}async function Te(s,t){try{const n=await s.json();return typeof n.error=="string"?n.error:t}catch{return t}}const an={starting:"Starting",ready:"Ready",restarting:"Restarting",failed:"Failed",stopped:"Stopped"};function rn(){const s=window.opentigDesktop?.webAccess,[t,n]=m.useState(null),[a,i]=m.useState([]),[r,o]=m.useState(null),[c,h]=m.useState(""),[f,p]=m.useState(!0),[u,l]=m.useState(null),[x,j]=m.useState(!1),[v,y]=m.useState(null),[S,M]=m.useState(null),[I,C]=m.useState(""),E=m.useCallback(async(g=!0)=>{const T=await Promise.allSettled([s?.getStatus()??Promise.resolve(null),en()]);T[0].status==="fulfilled"?n(T[0].value):g&&N.error({title:"Could not read web access status",description:U(T[0].reason)}),T[1].status==="fulfilled"?i(T[1].value):g&&N.error({title:"Could not read owner sessions",description:U(T[1].reason)}),p(!1)},[s]);m.useEffect(()=>{E();const g=window.setInterval(()=>{E(!1)},2e3);return()=>window.clearInterval(g)},[E]),m.useEffect(()=>{t&&(t.pairingEndpoints.length?t.pairingEndpoints.includes(c)||h(t.pairingEndpoints[0]):h(""))},[c,t]);const R=m.useMemo(()=>r?`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(Qt(r.url,{ecc:"M",border:2}))}`:null,[r]),L=m.useMemo(()=>r?new URLSearchParams(new URL(r.url).hash.slice(1)).get("token")??"":"",[r]);if(f&&(!s||!t)&&a.length===0)return e.jsxs("div",{className:"web-access-loading",role:"status",children:[e.jsx(X,{className:"animate-spin"})," Loading web access…"]});const A=async g=>{if(s){l("toggle"),o(null);try{n(await s.setEnabled(g)),N.success({title:g?"LAN access enabled":"LAN access disabled"})}catch(T){N.error({title:"Could not restart web access",description:U(T)}),await E(!1)}finally{l(null),j(!1)}}},d=async()=>{if(s){l("pair");try{o(await s.createPairingLink(c))}catch(g){N.error({title:"Could not create pairing link",description:U(g)})}finally{l(null)}}},b=async()=>{if(r)try{await Fe(r.url),N.success({title:"Pairing link copied"})}catch(g){N.error({title:"Could not copy pairing link",description:U(g)})}},k=async()=>{if(L)try{await Fe(L),N.success({title:"Pairing code copied"})}catch(g){N.error({title:"Could not copy pairing code",description:U(g)})}},q=async()=>{const g=S,T=I.trim();if(!(!g||!T||T.length>64)){l(`rename:${g.id}`);try{await nn(g.id,T),N.success({title:"Device renamed"}),await E(!1),M(null)}catch(J){N.error({title:"Could not rename device",description:U(J)})}finally{l(null)}}},me=async()=>{const g=v;if(!g)return;const T=g==="all"?"revoke-all":`revoke:${g.id}`;l(T);try{const J=g==="all"?await tn():await sn(g.id);o(null),N.success({title:`${J} browser ${J===1?"session":"sessions"} revoked`}),await E(!1)}catch(J){N.error({title:"Could not revoke session",description:U(J)})}finally{l(null),y(null)}},pe=t?.serverState==="ready",ks=a.filter(g=>g.kind!=="desktop");return e.jsxs("div",{className:"web-access-settings",children:[s&&t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"web-access-summary",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"LAN access"}),e.jsx("span",{children:"Listen on this computer's network interfaces for trusted local devices."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"LAN access","aria-checked":t.enabled,className:"settings-switch",disabled:u==="toggle"||!pe,onClick:()=>t.enabled?void A(!1):j(!0),children:e.jsx("span",{})})]}),e.jsxs("div",{className:"web-access-facts","aria-live":"polite",children:[e.jsx(ie,{label:"Server status",children:e.jsx(Q,{variant:pe?"secondary":"outline",children:an[t.serverState]})}),e.jsx(ie,{label:"Actual port",children:e.jsx("code",{children:t.actualPort??"Unavailable"})}),e.jsx(ie,{label:"Local endpoint",children:e.jsx(Ye,{value:t.localEndpoint})}),e.jsx(ie,{label:"LAN endpoints",children:e.jsx("div",{className:"web-access-endpoints",children:t.networkEndpoints.length===0?e.jsx("span",{children:"None detected"}):t.networkEndpoints.map(g=>e.jsx(Ye,{value:g,muted:!t.enabled},g))})})]}),t.restartError&&e.jsxs("div",{className:"web-access-error",role:"alert",children:[e.jsx(Ee,{})," ",e.jsx("span",{children:t.restartError})]}),e.jsxs("div",{className:"web-access-actions settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Pair a browser"}),e.jsx("span",{children:"Create a five-minute, one-use link for this computer or a LAN device. The pairing code also works through a same-machine HTTPS tunnel."})]}),e.jsxs(w,{size:"sm",onClick:()=>{d()},disabled:!pe||!c||u!==null,children:[u==="pair"?e.jsx(X,{className:"animate-spin"}):e.jsx(Zs,{})," Create pairing link"]})]}),t.pairingEndpoints.length>0&&e.jsxs("div",{className:"web-access-endpoint-select",children:[e.jsx("label",{htmlFor:"web-access-endpoint",children:"Address to place in the pairing link"}),e.jsxs(re,{value:c,onValueChange:g=>{g&&(h(g),o(null))},disabled:u!==null,children:[e.jsx(oe,{id:"web-access-endpoint",className:"w-full",children:e.jsx(le,{children:c})}),e.jsx(ce,{alignItemWithTrigger:!1,children:e.jsx(Ps,{children:t.pairingEndpoints.map(g=>e.jsx(de,{value:g,children:g},g))})})]})]}),r&&e.jsxs("div",{className:"web-access-pairing",role:"status",children:[e.jsxs("div",{className:"web-access-pairing-copy",children:[e.jsx(rt,{"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Pairing link ready"}),e.jsxs("span",{children:["Expires ",new Date(r.expiresAt).toLocaleString(),"."]})]})]}),R&&e.jsx("img",{src:R,alt:"QR code for the one-use OpenTig pairing link"}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(F,{children:[e.jsx(z,{render:e.jsx("code",{className:"web-access-link"}),children:r.url}),e.jsx(_,{side:"bottom",children:"One-use link; do not share publicly"})]}),e.jsxs(F,{children:[e.jsx(z,{render:e.jsx(w,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing link",onClick:()=>{b()}}),children:e.jsx($e,{})}),e.jsx(_,{children:"Copy pairing link"})]})]}),e.jsxs("div",{className:"web-access-link-row",children:[e.jsxs(F,{children:[e.jsx(z,{render:e.jsx("code",{className:"web-access-link"}),children:L}),e.jsx(_,{side:"bottom",children:"Paste this code on any /pair page served by this OpenTig instance"})]}),e.jsxs(F,{children:[e.jsx(z,{render:e.jsx(w,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing code",onClick:()=>{k()}}),children:e.jsx($e,{})}),e.jsx(_,{children:"Copy pairing code"})]})]})]})]}),e.jsxs("div",{className:`web-access-session-heading ${s?"settings-field-separated":""}`,children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Owner sessions"}),e.jsx("span",{children:"Desktop authentication stays private. Paired browsers can be disconnected individually."})]}),e.jsxs(w,{variant:"destructive",size:"sm",onClick:()=>y("all"),disabled:ks.length===0||u!==null,children:[e.jsx(ze,{})," Revoke browsers"]})]}),e.jsx("div",{className:"web-access-session-list","aria-live":"polite",children:a.length===0?e.jsx("div",{className:"web-access-empty-session",children:"No owner sessions found."}):a.map(g=>e.jsxs("div",{className:"web-access-session",children:[e.jsx("div",{className:`web-access-session-icon ${g.connected?"connected":""}`,children:g.kind==="desktop"?e.jsx(is,{}):e.jsx(Ys,{})}),e.jsxs("div",{className:"web-access-session-copy",children:[e.jsxs("div",{children:[e.jsx("strong",{children:g.clientName}),g.current&&e.jsx(Q,{variant:"secondary",children:"This session"}),g.kind==="desktop"&&e.jsx(Q,{variant:"outline",children:"Desktop"})]}),e.jsxs("span",{children:[g.connected?`Connected${g.connectionCount>1?` (${g.connectionCount} tabs)`:""}`:g.lastConnectedAt?`Last connected ${on(g.lastConnectedAt)}`:"Not yet connected"," · ",g.browser&&g.os?`${g.browser} on ${g.os}`:g.browser??g.os??ln(g.deviceType),g.viaProxy?" · Via proxy":"",g.remoteAddress?` · ${g.remoteAddress}`:""]})]}),g.kind!=="desktop"&&e.jsxs("div",{className:"web-access-session-controls",children:[e.jsxs(F,{children:[e.jsx(z,{render:e.jsx(w,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${g.clientName}`,onClick:()=>{M(g),C(g.clientName)},disabled:u!==null}),children:e.jsx(Hs,{})}),e.jsx(_,{children:"Rename this device"})]}),e.jsxs(F,{children:[e.jsx(z,{render:e.jsx(w,{variant:"ghost",size:"icon-sm","aria-label":`Revoke ${g.clientName} session`,onClick:()=>y(g),disabled:u!==null}),children:e.jsx(Ce,{})}),e.jsx(_,{children:"Revoke this browser session"})]})]})]},g.id))}),!s&&e.jsx("p",{className:"web-access-hint",children:"Listener addresses and new pairing links are controlled by the OpenTig desktop app or CLI running the server."}),e.jsx(H,{open:x,onOpenChange:j,children:e.jsxs(V,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(W,{children:"Enable owner-level LAN access?"}),e.jsx(Y,{children:"Any paired browser can edit or delete files and act with your OS user permissions. Use only a trusted LAN or VPN."})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(K,{render:e.jsx(w,{variant:"ghost"}),children:"Cancel"}),e.jsx(w,{onClick:()=>{A(!0)},disabled:u!==null,children:"Enable LAN access"})]})]})}),e.jsx(H,{open:v!==null,onOpenChange:g=>{g||y(null)},children:e.jsxs(V,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(W,{children:v==="all"?"Revoke all browser sessions?":"Revoke this browser session?"}),e.jsx(Y,{children:v==="all"?"Every paired browser disconnects immediately. The private desktop session remains signed in.":v?.current?"This browser will disconnect immediately and require a new pairing link.":"That browser disconnects immediately and will require a new pairing link."}),v&&v!=="all"&&e.jsx("div",{className:"undo-commit-summary",children:e.jsx("strong",{children:v.clientName})})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(K,{render:e.jsx(w,{variant:"ghost"}),children:"Cancel"}),e.jsxs(w,{variant:"destructive",onClick:()=>{me()},disabled:u!==null,children:[e.jsx(ze,{})," Revoke"]})]})]})}),e.jsx(H,{open:S!==null,onOpenChange:g=>{g||M(null)},children:e.jsxs(V,{className:"undo-commit-dialog",children:[e.jsxs("div",{className:"undo-commit-content",children:[e.jsx(W,{children:"Rename paired device"}),e.jsx(Y,{children:"Use a name that makes this browser easy to identify later."}),e.jsx("input",{className:"web-access-rename-input",value:I,onChange:g=>C(g.target.value),maxLength:64,"aria-label":"Device name",autoComplete:"off"})]}),e.jsxs("div",{className:"undo-commit-actions",children:[e.jsx(K,{render:e.jsx(w,{variant:"ghost"}),children:"Cancel"}),e.jsx(w,{onClick:()=>{q()},disabled:u!==null||!I.trim(),children:"Save"})]})]})})]})}function ie({label:s,children:t}){return e.jsxs("div",{className:"web-access-fact",children:[e.jsx("span",{children:s}),e.jsx("div",{children:t})]})}function Ye({value:s,muted:t=!1}){return s?e.jsxs(F,{children:[e.jsx(z,{render:e.jsx("code",{className:t?"muted":void 0}),children:s}),e.jsx(_,{side:"bottom",children:t?"Enable LAN access to use this endpoint":s})]}):e.jsx("span",{children:"Unavailable"})}function on(s){const t=new Date(s);return Number.isNaN(t.getTime())?"unknown":t.toLocaleString()}function ln(s){return s==="desktop"?"Desktop browser":s==="mobile"?"Mobile browser":s==="tablet"?"Tablet browser":s==="bot"?"Automated client":"Unknown browser"}function U(s){return s instanceof Error?s.message:String(s)}const cn=[{id:"general",label:"General",icon:$s},{id:"updates",label:"Updates",icon:ge},{id:"shortcuts",label:"Shortcuts",icon:qs},{id:"ai",label:"AI assistance",icon:ht},{id:"diagnostics",label:"Diagnostics",icon:Ee},{id:"webAccess",label:"Web access",icon:at}],dn={updates:{title:"Updates",description:"Check, download, and install new OpenTig releases."},general:{title:"General",description:"OpenTig appearance and 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."}},hn=[{value:"system",label:"System",icon:is},{value:"light",label:"Light",icon:gt},{value:"dark",label:"Dark",icon:tt}],be=[{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"}],ye=[{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"}],un=[{value:"tree",label:"Tree",icon:Fs},{value:"list",label:"List",icon:et}];function kn({preferences:s,onPreference:t,open:n,onOpenChange:a,section:i,onSectionChange:r}){const[o,c]=m.useState([]),[h,f]=m.useState(!1),[p,u]=m.useState(!1),[l,x]=m.useState(!1),j=m.useRef(null),v=bt(),y=v?{duration:0}:{duration:.16,ease:[.22,1,.36,1]},S=m.useCallback(async(d=!1)=>{f(!0);try{c(await te.ai.statuses(d))}catch(b){N.error({title:"Could not check local AI",description:fn(b)})}finally{f(!1)}},[]);m.useEffect(()=>{n&&i==="ai"&&o.length===0&&S()},[S,n,i,o.length]),m.useLayoutEffect(()=>{n&&j.current&&(j.current.scrollTop=0)},[n,i]);const M=s.commitMessageHarness,I=o.find(d=>d.id===M),C=s.commitMessageModels[M]??"default",E=I?.models??[{id:"default",label:"Default (CLI)"}],R=E.some(d=>d.id===C)?E:[...E,{id:C,label:`${C} (unavailable)`}],{title:L,description:A}=i==="webAccess"?{title:"Web access",description:window.opentigDesktop?"Connect trusted browsers locally, over your LAN, or through an HTTPS tunnel.":"Review and disconnect browsers authorised to use this OpenTig server."}:dn[i];return e.jsx(H,{open:n,onOpenChange:a,children:e.jsx(V,{className:"settings-dialog",children:e.jsxs("div",{className:"settings-shell",children:[e.jsxs("aside",{className:"settings-nav",children:[e.jsx("div",{className:"settings-nav-title",children:"Settings"}),cn.map(({id:d,label:b,icon:k})=>e.jsxs("button",{className:`settings-nav-item ${i===d?"active":""}`,onClick:()=>r(d),"aria-current":i===d,children:[e.jsx(k,{})," ",b]},d))]}),e.jsxs("section",{className:"settings-panel",children:[e.jsxs("header",{className:"settings-panel-header",children:[e.jsx(Be,{initial:!1,mode:"wait",children:e.jsxs(Pe.div,{initial:v?!1:{opacity:0,y:4},animate:{opacity:1,y:0},exit:v?{opacity:1}:{opacity:0,y:-3},transition:y,children:[e.jsx(W,{children:L}),e.jsx(Y,{children:A})]},i)}),e.jsx(K,{render:e.jsx(w,{variant:"ghost",size:"icon-sm","aria-label":"Close settings"}),children:e.jsx(Se,{})})]}),e.jsx("div",{ref:j,className:"settings-panel-body",children:e.jsx(Be,{initial:!1,mode:"wait",children:e.jsx(Pe.div,{className:"settings-panel-section",initial:v?!1:{opacity:0,y:7},animate:{opacity:1,y:0},exit:v?{opacity:1}:{opacity:0,y:-5},transition:y,children:i==="general"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-field",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Theme"}),e.jsx("span",{children:"Choose a light, dark, or system appearance."})]}),e.jsx("div",{className:"settings-theme-options",role:"radiogroup","aria-label":"Theme",children:hn.map(({value:d,label:b,icon:k})=>e.jsxs("button",{type:"button",role:"radio","aria-checked":s.theme===d,className:`settings-theme-option ${s.theme===d?"active":""}`,onClick:()=>t({theme:d}),children:[e.jsx(k,{})," ",e.jsx("span",{children:b})]},d))})]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Fonts"}),e.jsx("span",{children:"Interface chrome and code, chosen independently. Space Grotesk appears in both lists."})]}),e.jsxs("div",{className:"settings-font-pickers",children:[e.jsxs("label",{className:"settings-font-picker",children:[e.jsx("span",{children:"Interface"}),e.jsxs(re,{value:s.uiFont,onValueChange:d=>{const b=be.find(k=>k.value===d);b&&t({uiFont:b.value})},children:[e.jsx(oe,{className:"settings-font-select","aria-label":"Interface font",style:{fontFamily:be.find(d=>d.value===s.uiFont)?.family},children:e.jsx(le,{})}),e.jsx(ce,{align:"start",alignItemWithTrigger:!1,className:"w-max min-w-[16rem]",children:be.map(d=>e.jsx(de,{value:d.value,children:e.jsx("span",{style:{fontFamily:d.family},children:d.label})},d.value))})]})]}),e.jsxs("label",{className:"settings-font-picker",children:[e.jsx("span",{children:"Code"}),e.jsxs(re,{value:s.monoFont,onValueChange:d=>{const b=ye.find(k=>k.value===d);b&&t({monoFont:b.value})},children:[e.jsx(oe,{className:"settings-font-select","aria-label":"Code font",style:{fontFamily:ye.find(d=>d.value===s.monoFont)?.family},children:e.jsx(le,{})}),e.jsx(ce,{align:"start",alignItemWithTrigger:!1,className:"w-max min-w-[16rem]",children:ye.map(d=>e.jsx(de,{value:d.value,children:e.jsx("span",{style:{fontFamily:d.family},children:d.label})},d.value))})]})]})]})]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Interface size"}),e.jsx("span",{children:"Adjust the zoom for text, icons, and the rest of the application."})]}),e.jsxs("div",{className:"settings-zoom-control",children:[e.jsx("input",{type:"range",min:"80",max:"130",step:"10",value:s.uiZoom,onChange:d=>t({uiZoom:Number(d.target.value)}),"aria-label":"Interface zoom"}),e.jsxs("output",{children:[s.uiZoom,"%"]})]})]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Changes layout"}),e.jsx("span",{children:"Group changed files by folder or show them as a flat list."})]}),e.jsx("div",{className:"settings-theme-options",role:"radiogroup","aria-label":"Changes layout",children:un.map(({value:d,label:b,icon:k})=>e.jsxs("button",{type:"button",role:"radio","aria-checked":s.changesLayout===d,className:`settings-theme-option ${s.changesLayout===d?"active":""}`,onClick:()=>t({changesLayout:d}),children:[e.jsx(k,{})," ",e.jsx("span",{children:b})]},d))})]}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Remote check interval"}),e.jsx("span",{children:"How often OpenTig fetches remotes so ahead and behind counts stay current. Set to Off to check only when you pull or push."})]}),e.jsxs("div",{className:"settings-zoom-control",children:[e.jsx("input",{type:"range",min:"0",max:_s,step:zs,value:s.remoteFetchIntervalSeconds,onChange:d=>t({remoteFetchIntervalSeconds:Number(d.target.value)}),"aria-label":"Remote check interval"}),e.jsx("output",{children:Ds(s.remoteFetchIntervalSeconds)})]})]}),e.jsxs("div",{className:"settings-field settings-field-separated settings-toggle-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Wrap lines in viewer"}),e.jsx("span",{children:"Wrap long lines to fit the available width."})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"Wrap lines in viewer","aria-checked":s.wrapLines,className:"settings-switch",onClick:()=>t({wrapLines:!s.wrapLines}),children:e.jsx("span",{})})]}),e.jsxs("div",{className:"settings-field settings-field-separated settings-toggle-row",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Show files ignored by Git"}),e.jsxs("span",{children:["Include files excluded by ",e.jsx("code",{children:".gitignore"})," rules in the Files view."]})]}),e.jsx("button",{type:"button",role:"switch","aria-label":"Show files ignored by Git","aria-checked":s.showDotEnvFiles,className:"settings-switch",onClick:()=>t({showDotEnvFiles:!s.showDotEnvFiles}),children:e.jsx("span",{})})]})]}):i==="updates"?e.jsx(Bs,{}):i==="shortcuts"?e.jsx(It,{preferences:s,onPreference:t}):i==="webAccess"?e.jsx(rn,{}):i==="diagnostics"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"settings-field",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Problem history"}),e.jsx("span",{children:"Failed Git, file, and network operations recorded locally. Prompts and file contents are never stored."})]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>x(!0),children:[e.jsx(Ee,{})," View problems"]})]}),e.jsx(Rt,{open:l,onOpenChange:x})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"ai-settings-heading",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsx("strong",{children:"Local harness"}),e.jsx("span",{children:"OpenTig uses the selected CLI session. It does not copy or store credentials."})]}),e.jsxs(w,{variant:"outline",size:"sm",onClick:()=>{S(!0)},disabled:h,children:[h?e.jsx(X,{className:"animate-spin"}):e.jsx(ge,{})," ",h?e.jsx(Me,{text:"Checking…"}):"Check again"]})]}),e.jsx("div",{className:"ai-harness-list",role:"radiogroup","aria-label":"Harness for AI assistance",children:["codex","claude","opencode"].map(d=>{const b=o.find(q=>q.id===d),k=M===d;return e.jsxs("button",{type:"button",role:"radio","aria-checked":k,className:`ai-harness-card ${k?"active":""}`,onClick:()=>t({commitMessageHarness:d}),children:[e.jsxs("span",{className:"ai-harness-card-main",children:[e.jsx(Us,{harness:d}),e.jsxs("span",{className:"ai-harness-card-copy",children:[e.jsx("strong",{children:je(d)}),e.jsx("small",{children:h?"Checking…":b?.version||(b?b.installed?"Version unavailable":"Executable not found":"Status not checked")})]})]}),e.jsx(Q,{variant:mn(b),className:`ai-status-badge ${b?.availability??"unknown"}`,children:gn(b)}),b?.message&&e.jsx("span",{className:"ai-harness-message",children:b.message})]},d)})}),e.jsxs("div",{className:"settings-field settings-field-separated",children:[e.jsxs("div",{className:"settings-field-label",children:[e.jsxs("strong",{children:[je(M)," model"]}),e.jsx("span",{children:"Default lets the CLI choose. OpenTig remembers a separate selection for each harness."})]}),e.jsxs(re,{value:C,onValueChange:d=>t({commitMessageModels:{...s.commitMessageModels,[M]:d}}),children:[e.jsx(oe,{className:"ai-model-select",children:e.jsx(le,{})}),e.jsx(ce,{children:R.map(d=>e.jsx(de,{value:d.id,children:d.label},d.id))})]}),I?.authStatus==="unauthenticated"&&e.jsxs("p",{className:"ai-login-hint",children:["Sign in from a terminal with ",e.jsx("code",{children:pn(M,I.cliName)})," and check again."]}),I&&!I.installed&&e.jsxs("p",{className:"ai-login-hint",children:["Install ",je(M)," and check its availability again."]})]}),e.jsxs("div",{className:"settings-field settings-field-separated",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(w,{variant:"outline",size:"sm",onClick:()=>u(!0),children:[e.jsx(Gs,{})," 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(Nt,{open:p,onOpenChange:u})]})},i)})})]})]})})})}function gn(s){return s?s.installed?s.authStatus==="unauthenticated"?"Not authenticated":s.availability==="ready"?"Available":"Check":"Not installed":"Not checked"}function mn(s){return s?!s.installed||s.authStatus==="unauthenticated"||s.availability==="error"?"destructive":s.availability==="ready"?"default":"secondary":"outline"}function pn(s,t){return s==="codex"?"codex login":s==="claude"?"claude auth login":t==="opencode2"?"opencode2 auth login":"opencode auth login"}function fn(s){return s instanceof Error?s.message:"An unexpected error occurred."}export{kn as SettingsDialog};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-DYj1ZThr.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-7EVoquIB.js","assets/platform-BMNQ8V5r.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-BdjG_WtS.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/index-Uku28hIV.css","assets/index-CtEztN1P.js","assets/App-CeDVj5Hh.js","assets/File-C10_BxOu.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-CeYQ0YtE.js","assets/PierreEditBoundary-UfvbKDbd.js","assets/edit-ready-context-D77R8XU8.js","assets/MarkdownFileViewer-BLfJ-Vof.js","assets/viewer-tabs-Cp_MC_J3.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-BhwE-QMO.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-GXIpf9CM.js","assets/markdown-BpzjXclZ.css","assets/PullRequestViewer-CyW39MuF.js","assets/gh-utils-D00lyruw.js","assets/GitHubAvatar-Ch_PaCv3.js","assets/HtmlFileViewer-Cufzaec9.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-CFUkcXLH.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as _,B as U,_ as x,T as se,a as ae,b as ne}from"./index-BdjG_WtS.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{J as le,K as re,L as oe,k as R,M as fe,H as Y}from"./App-CeDVj5Hh.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.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 d=ce(this.options.sizeOf(o)),v=this.entries.get(e);return v&&(this.entries.delete(e),this.totalBytes-=v.bytes),d>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:d}),this.totalBytes+=d,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 G=n.lazy(()=>x(()=>import("./PierreDiffViewer-DYj1ZThr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),ue=n.lazy(()=>x(()=>import("./PierreEditBoundary-UfvbKDbd.js"),__vite__mapDeps([15,6,1,7,8,9,13,11,16])).then(i=>({default:i.PierreEditBoundary}))),me=n.lazy(()=>x(()=>import("./MarkdownFileViewer-BLfJ-Vof.js"),__vite__mapDeps([17,1,11,6,7,8,9,18,19,20,2,3,4,5,10,12,13,16,21,22,23])).then(i=>({default:i.MarkdownFileViewer}))),he=n.lazy(()=>x(()=>import("./PullRequestViewer-CyW39MuF.js"),__vite__mapDeps([24,6,1,7,8,9,11,18,19,25,26,23])).then(i=>({default:i.PullRequestViewer}))),pe=n.lazy(()=>x(()=>import("./EditableFileViewer-BhwE-QMO.js").then(i=>i.E),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,13,16,21])).then(i=>({default:i.EditableFileViewer}))),xe=n.lazy(()=>x(()=>import("./HtmlFileViewer-Cufzaec9.js"),__vite__mapDeps([27,1,18,6,7,8,9,19,20,2,3,4,5,10,11,12,13,16,21,28])).then(i=>({default:i.HtmlFileViewer}))),ve=n.lazy(()=>x(()=>import("./ImageFileViewer-CFUkcXLH.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.ImageFileViewer}))),ye=n.lazy(()=>x(()=>import("./ImageFileViewer-CFUkcXLH.js"),__vite__mapDeps([29,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,13,16,21,30])).then(i=>({default:i.SvgFileViewer}))),F=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let Q=null;function Se({repositoryId:i,selection:e,diffView:o,wrapLines:d,theme:v,revision:y,readOnly:g,commits:T,draftFor:E,onSelect:$,onOpenFile:Z,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:A,onUpdateConflict:W,onResolveConflict:I}){const[a,w]=n.useState(null),[ee,L]=n.useState(!1),[D,q]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),C=n.useRef(!1),u=je(i,e);n.useEffect(()=>{H(!1),C.current=!1},[e]),n.useEffect(()=>{Q!==i&&(F.clear(),Q=i);const s=++b.current;if(q(null),!e||e.type==="pull-request"){w(null),L(!1);return}L(!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:u,type:"image",value:l});return}const f=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:u,type:"conflict",value:f});return}w(l=>l&&l.docKey===u&&l.type==="file"&&C.current||l&&l.docKey===u&&l.type==="file"&&l.value.content===f.content&&l.value.size===f.size&&l.value.binary===f.binary&&l.value.tooLarge===f.tooLarge?l:{docKey:u,type:"file",value:f})}else{const f=e.type!=="diff";let l=f?F.get(u):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}),f&&F.set(u,l)),s!==b.current)return;const p=l;w(c=>c&&c.docKey===u&&c.type==="diff"&&c.value.patch===p.patch&&c.value.binary===p.binary?c:{docKey:u,type:"diff",value:p})}}catch(f){s===b.current&&q(f instanceof Error?f.message:"Could not load the viewer.")}finally{s===b.current&&L(!1)}})()},[V,u,i,y,e]);const j=v==="system"?"system":v,te=d?"wrap":"scroll",N=n.useCallback(s=>{C.current=s},[]),S=n.useCallback(async(s,h,f)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??f);return p.status==="saved"&&(C.current=!1,A(s),w(c=>c?.type==="file"&&c.value.path===s?{...c,value:{...c.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:c)),p},[E,A,i]),B=n.useCallback(s=>s.path,[]),k=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),ie=ee&&a!==null&&!D;let r,P=null;if(!e)r=t.jsx(we,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,prNumber:e.number,diffView:o,themeType:j,wrapLines:d,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(null)},`${i}:${e.number}`)});else if(D)r=t.jsx("div",{className:"viewer-message text-destructive",children:D});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{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 · ",X(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 ",X(a.value.size),". Preview is limited to protect performance."]}),t.jsx(U,{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,P=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:te,onUpdate:W,onResolve:I})});else if(a.type==="file"&&le(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{file:s,initialContent:k(s),revision:y,themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onOpenFile:Z,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}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(ye,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(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(xe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g||s.tooLarge,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{file:s,initialContent:k(s),themeType:j,wrapLines:d,readOnly:g,onDirtyChange:N,onDraftChange:z(s),onSave:S},B(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?T.find(l=>l.oid===s.oid):void 0,f=e.type==="commit-file"?t.jsx(U,{type:"button",variant:"outline",size:"xs",onClick:()=>$({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,P=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(ge,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(G,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:d,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>$(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 J=t.jsxs(t.Fragment,{children:[P??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:u),ie&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(R,{className:"spinner"})})]});return a?.type!=="file"?J:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ue,{enabled:!0,children:J})})}function ge({commit:i,fallbackSubject:e}){const o=i?.date?new Date(i.date):null,[d,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&&!d?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":d,onClick:()=>v(T=>!T),children:d?"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(o.getTime())&&t.jsxs(se,{children:[t.jsx(ae,{render:t.jsx("time",{dateTime:i?.date}),children:o.toLocaleString()}),t.jsx(ne,{children:o.toLocaleString()})]}),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 je(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(R,{className:"spinner"})," ",t.jsx(Y,{text:"Loading viewer…"})]})}function we(){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 X(i){return i?i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(1)} MB`:"unknown size"}export{Se as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as a,C as n}from"./mermaid.core-DnaJSnLe.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as t,a as s,C as i}from"./chunk-GF5L2VYU-DWHvTG6c.js";import{_ as e}from"./mermaid.core-DnaJSnLe.js";import"./chunk-5VM5RSS4-Dk9FYU9b.js";import"./chunk-XXDRQBXY-CzPimvfs.js";import"./chunk-KBJHAD2P-CEOb10I1.js";import"./chunk-2GRJ4B5K-CJOlpI9g.js";import"./render-markdown-GXIpf9CM.js";import"./App-CeDVj5Hh.js";import"./index-BdjG_WtS.js";import"./react-rd22PHbN.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v={parser:s,get db(){return new i},renderer:t,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{v as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as t,a as s,C as i}from"./chunk-GF5L2VYU-DWHvTG6c.js";import{_ as e}from"./mermaid.core-DnaJSnLe.js";import"./chunk-5VM5RSS4-Dk9FYU9b.js";import"./chunk-XXDRQBXY-CzPimvfs.js";import"./chunk-KBJHAD2P-CEOb10I1.js";import"./chunk-2GRJ4B5K-CJOlpI9g.js";import"./render-markdown-GXIpf9CM.js";import"./App-CeDVj5Hh.js";import"./index-BdjG_WtS.js";import"./react-rd22PHbN.js";import"./tanstack-Bsd5UOY4.js";import"./base-ui-D4MeJpa3.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v={parser:s,get db(){return new i},renderer:t,styles:a,init:e(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{v as diagram};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-CeDVj5Hh.js","assets/react-rd22PHbN.js","assets/tanstack-Bsd5UOY4.js","assets/base-ui-D4MeJpa3.js","assets/PairingPage-C5Ggk-Z_.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as T,j as f,d as at}from"./react-rd22PHbN.js";import{Q as lt,e as ct}from"./tanstack-Bsd5UOY4.js";import{B as dt,r as ut,s as pt,t as mt,u as ft,v as ht,x as gt,y as bt}from"./base-ui-D4MeJpa3.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const s of l.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function o(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=o(a);fetch(a.href,l)}})();const Ge="opentig.theme";function yt(e){try{const t=e?.getItem(Ge);return t==="light"||t==="dark"||t==="system"?t:null}catch{return null}}function io(e,t=globalThis.localStorage){try{t?.setItem(Ge,e)}catch{}}function vt(e,t){return e==="light"?!1:e==="dark"?!0:t}function wt(e={}){const t=e.root??(typeof document>"u"?null:document.documentElement);if(!t)return!1;const o=e.storage??(typeof localStorage>"u"?null:localStorage),n=e.prefersDark??(typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches),a=vt(yt(o),n);return t.classList.toggle("dark",a),t.classList.toggle("light",!a),a}wt();const xt="modulepreload",kt=function(e){return"/"+e},Pe={},qe=function(t,o,n){let a=Promise.resolve();if(o&&o.length>0){let b=function(r){return Promise.all(r.map(i=>Promise.resolve(i).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),p=s?.nonce||s?.getAttribute("nonce");a=b(o.map(r=>{if(r=kt(r),r in Pe)return;Pe[r]=!0;const i=r.endsWith(".css"),m=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${m}`))return;const y=document.createElement("link");if(y.rel=i?"stylesheet":xt,i||(y.as="script"),y.crossOrigin="",y.href=r,p&&y.setAttribute("nonce",p),document.head.appendChild(y),i)return new Promise((x,O)=>{y.addEventListener("load",x),y.addEventListener("error",()=>O(new Error(`Unable to preload CSS for ${r}`)))})}))}function l(s){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=s,window.dispatchEvent(p),!p.defaultPrevented)throw s}return a.then(s=>{for(const p of s||[])p.status==="rejected"&&l(p.reason);return t().catch(l)})};function Ct(){return T.useEffect(()=>{const e=window.visualViewport;if(!e)return;const t=()=>{Math.abs(e.scale-1)>.01||(document.documentElement.style.setProperty("--mobile-viewport-height",`${e.height}px`),document.documentElement.style.setProperty("--mobile-viewport-top",`${e.offsetTop}px`))};return t(),e.addEventListener("resize",t),e.addEventListener("scroll",t),()=>{e.removeEventListener("resize",t),e.removeEventListener("scroll",t)}},[]),null}function St(){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 117.9 128","aria-hidden":"true",children:[f.jsx("path",{fill:"currentColor",d:"m113.9 42.6c-3.7-11.3-10.8-21.2-20.1-28.6-7.4-5.7-16.1-10-25.4-11.5-6.5-0.9-9.4-1.1-15.9-0.3-7.4 0.9-14.3 3.4-20.7 7-15.4 9.1-27.6 26.2-29.8 44.5-0.3 2.9-0.4 5.8-0.2 8.7 0.7 15.5 9.7 33.2 27.2 44.1l3.9 2.2c1.5 1.3 2.9 1.8 5.1 1.3 3.5-0.9 5.1-6.1 0.1-8.6-7.3-3.5-13.7-8.7-18.1-14.6-5-7-9-15.8-9.3-26.9-0.2-10 3.5-21.4 11.6-31.3 4.5-5.2 10.5-9.8 16.4-12.7 10.1-4.9 20.5-6.6 31.2-3.8 13.2 3.5 25.6 13.1 32.3 26.5 2.3 4.9 4.2 10.7 4.9 17.4 0.9 9.9-1.4 19.2-6.9 27.4-4.3 6.5-9.2 11-16.1 15.8l-4.1 2.1c-4.4 2.4-3.2 9.4 2.8 9 1.2 0 2.5-0.8 3.6-1.4 3.9-2 7.5-4.3 10.8-7 9.4-8 17.6-20.3 19.1-36.8 0.6-7.4-0.4-15.6-2.4-22.5z"}),f.jsx("path",{fill:"#2266ea",d:"m88.1 42.8c-3.6 0.3-7.4 2.9-9 7.3-5.5 0.8-14.1 3.6-20.3 12-4.3-6.3-11.6-10.7-19.7-12-1.1-3.8-5-7.5-10.2-7.2-4.1 0.4-8.7 3.8-8.7 9.7 0.2 6 5.7 10.3 11.1 9.3 2.8-0.3 5.2-2 6.6-4.3 6.7 1 14.9 4.7 17.3 14.1v36.7c-3.2 1.5-5.5 4.7-5.5 8.4 0 4.8 3.7 9.3 9.4 9.3s9.5-4.5 9.4-9.1c0.1-3.6-2.3-7.3-5.8-8.7v-36.4c1-5.6 5.9-10.9 13.3-13.3l3.9-1c1.8 2.9 4.9 4.6 8.6 4.5 4.6-0.2 9.3-3.6 9.3-9.5 0-5.6-4.9-10-9.7-9.8z"})]})}function Tt({heading:e,detail:t,busy:o=!0}){return f.jsxs("div",{className:"splash",children:[f.jsx(St,{}),f.jsxs("div",{className:"splash-copy",children:[f.jsx("strong",{children:e}),f.jsx("span",{role:"status","aria-live":"polite",children:t??""})]}),o?f.jsx("div",{className:"splash-mark","aria-hidden":"true"}):null]})}function Be(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(o=Be(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function We(){for(var e,t,o=0,n="",a=arguments.length;o<a;o++)(e=arguments[o])&&(t=Be(e))&&(n&&(n+=" "),n+=t);return n}const Re=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,je=We,Et=(e,t)=>o=>{var n;if(t?.variants==null)return je(e,o?.class,o?.className);const{variants:a,defaultVariants:l}=t,s=Object.keys(a).map(r=>{const i=o?.[r],m=l?.[r];if(i===null)return null;const y=Re(i)||Re(m);return a[r][y]}),p=o&&Object.entries(o).reduce((r,i)=>{let[m,y]=i;return y===void 0||(r[m]=y),r},{}),b=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((r,i)=>{let{class:m,className:y,...x}=i;return Object.entries(x).every(O=>{let[S,E]=O;return Array.isArray(E)?E.includes({...l,...p}[S]):{...l,...p}[S]===E})?[...r,m,y]:r},[]);return je(e,s,b,o?.class,o?.className)},Pt=(e,t)=>{const o=new Array(e.length+t.length);for(let n=0;n<e.length;n++)o[n]=e[n];for(let n=0;n<t.length;n++)o[e.length+n]=t[n];return o},Rt=(e,t)=>({classGroupId:e,validator:t}),Ve=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o}),ie="-",Ae=[],jt="arbitrary..",At=e=>{const t=zt(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return Ot(s);const p=s.split(ie),b=p[0]===""&&p.length>1?1:0;return Ue(p,b,t)},getConflictingClassGroupIds:(s,p)=>{if(p){const b=n[s],r=o[s];return b?r?Pt(r,b):b:r||Ae}return o[s]||Ae}}},Ue=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;const a=e[t],l=o.nextPart.get(a);if(l){const r=Ue(e,t+1,l);if(r)return r}const s=o.validators;if(s===null)return;const p=t===0?e.join(ie):e.slice(t).join(ie),b=s.length;for(let r=0;r<b;r++){const i=s[r];if(i.validator(p))return i.classGroupId}},Ot=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),o=t.indexOf(":"),n=t.slice(0,o);return n?jt+n:void 0})(),zt=e=>{const{theme:t,classGroups:o}=e;return Mt(o,t)},Mt=(e,t)=>{const o=Ve();for(const n in e){const a=e[n];be(a,o,n,t)}return o},be=(e,t,o,n)=>{const a=e.length;for(let l=0;l<a;l++){const s=e[l];Lt(s,t,o,n)}},Lt=(e,t,o,n)=>{if(typeof e=="string"){It(e,t,o);return}if(typeof e=="function"){Nt(e,t,o,n);return}Ft(e,t,o,n)},It=(e,t,o)=>{const n=e===""?t:$e(t,e);n.classGroupId=o},Nt=(e,t,o,n)=>{if(_t(e)){be(e(n),t,o,n);return}t.validators===null&&(t.validators=[]),t.validators.push(Rt(o,e))},Ft=(e,t,o,n)=>{const a=Object.entries(e),l=a.length;for(let s=0;s<l;s++){const[p,b]=a[s];be(b,$e(t,p),o,n)}},$e=(e,t)=>{let o=e;const n=t.split(ie),a=n.length;for(let l=0;l<a;l++){const s=n[l];let p=o.nextPart.get(s);p||(p=Ve(),o.nextPart.set(s,p)),o=p}return o},_t=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Dt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),n=Object.create(null);const a=(l,s)=>{o[l]=s,t++,t>e&&(t=0,n=o,o=Object.create(null))};return{get(l){let s=o[l];if(s!==void 0)return s;if((s=n[l])!==void 0)return a(l,s),s},set(l,s){l in o?o[l]=s:a(l,s)}}},ge="!",Oe=":",Gt=[],ze=(e,t,o,n,a)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:n,isExternal:a}),qt=e=>{const{prefix:t,experimentalParseClassName:o}=e;let n=a=>{const l=[];let s=0,p=0,b=0,r;const i=a.length;for(let S=0;S<i;S++){const E=a[S];if(s===0&&p===0){if(E===Oe){l.push(a.slice(b,S)),b=S+1;continue}if(E==="/"){r=S;continue}}E==="["?s++:E==="]"?s--:E==="("?p++:E===")"&&p--}const m=l.length===0?a:a.slice(b);let y=m,x=!1;m.endsWith(ge)?(y=m.slice(0,-1),x=!0):m.startsWith(ge)&&(y=m.slice(1),x=!0);const O=r&&r>b?r-b:void 0;return ze(l,x,y,O)};if(t){const a=t+Oe,l=n;n=s=>s.startsWith(a)?l(s.slice(a.length)):ze(Gt,!1,s,void 0,!0)}if(o){const a=n;n=l=>o({className:l,parseClassName:a})}return n},Bt=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((o,n)=>{t.set(o,1e6+n)}),o=>{const n=[];let a=[];for(let l=0;l<o.length;l++){const s=o[l],p=s[0]==="[",b=t.has(s);p||b?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(s)):a.push(s)}return a.length>0&&(a.sort(),n.push(...a)),n}},Wt=e=>({cache:Dt(e.cacheSize),parseClassName:qt(e),sortModifiers:Bt(e),postfixLookupClassGroupIds:Vt(e),...At(e)}),Vt=e=>{const t=Object.create(null),o=e.postfixLookupClassGroups;if(o)for(let n=0;n<o.length;n++)t[o[n]]=!0;return t},Ut=/\s+/,$t=(e,t)=>{const{parseClassName:o,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:l,postfixLookupClassGroupIds:s}=t,p=[],b=e.trim().split(Ut);let r="";for(let i=b.length-1;i>=0;i-=1){const m=b[i],{isExternal:y,modifiers:x,hasImportantModifier:O,baseClassName:S,maybePostfixModifierPosition:E}=o(m);if(y){r=m+(r.length>0?" "+r:r);continue}let _=!!E,j;if(_){const L=S.substring(0,E);j=n(L);const h=j&&s[j]?n(S):void 0;h&&h!==j&&(j=h,_=!1)}else j=n(S);if(!j){if(!_){r=m+(r.length>0?" "+r:r);continue}if(j=n(S),!j){r=m+(r.length>0?" "+r:r);continue}_=!1}const K=x.length===0?"":x.length===1?x[0]:l(x).join(":"),W=O?K+ge:K,V=W+j;if(p.indexOf(V)>-1)continue;p.push(V);const U=a(j,_);for(let L=0;L<U.length;++L){const h=U[L];p.push(W+h)}r=m+(r.length>0?" "+r:r)}return r},Ht=(...e)=>{let t=0,o,n,a="";for(;t<e.length;)(o=e[t++])&&(n=He(o))&&(a&&(a+=" "),a+=n);return a},He=e=>{if(typeof e=="string")return e;let t,o="";for(let n=0;n<e.length;n++)e[n]&&(t=He(e[n]))&&(o&&(o+=" "),o+=t);return o},Yt=(e,...t)=>{let o,n,a,l;const s=b=>{const r=t.reduce((i,m)=>m(i),e());return o=Wt(r),n=o.cache.get,a=o.cache.set,l=p,p(b)},p=b=>{const r=n(b);if(r)return r;const i=$t(b,o);return a(b,i),i};return l=s,(...b)=>l(Ht(...b))},Kt=[],w=e=>{const t=o=>o[e]||Kt;return t.isThemeGetter=!0,t},Ye=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ke=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Qt=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Jt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Zt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,er=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tr=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,N=e=>Qt.test(e),v=e=>!!e&&!Number.isNaN(Number(e)),M=e=>!!e&&Number.isInteger(Number(e)),me=e=>e.endsWith("%")&&v(e.slice(0,-1)),I=e=>Jt.test(e),Qe=()=>!0,rr=e=>Xt.test(e)&&!Zt.test(e),ye=()=>!1,or=e=>er.test(e),sr=e=>tr.test(e),nr=e=>!d(e)&&!u(e),ir=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),ar=e=>F(e,Ze,ye),d=e=>Ye.test(e),G=e=>F(e,et,rr),Me=e=>F(e,hr,v),lr=e=>F(e,rt,Qe),cr=e=>F(e,tt,ye),Le=e=>F(e,Je,ye),dr=e=>F(e,Xe,sr),re=e=>F(e,ot,or),u=e=>Ke.test(e),Q=e=>B(e,et),ur=e=>B(e,tt),Ie=e=>B(e,Je),pr=e=>B(e,Ze),mr=e=>B(e,Xe),oe=e=>B(e,ot,!0),fr=e=>B(e,rt,!0),F=(e,t,o)=>{const n=Ye.exec(e);return n?n[1]?t(n[1]):o(n[2]):!1},B=(e,t,o=!1)=>{const n=Ke.exec(e);return n?n[1]?t(n[1]):o:!1},Je=e=>e==="position"||e==="percentage",Xe=e=>e==="image"||e==="url",Ze=e=>e==="length"||e==="size"||e==="bg-size",et=e=>e==="length",hr=e=>e==="number",tt=e=>e==="family-name",rt=e=>e==="number"||e==="weight",ot=e=>e==="shadow",gr=()=>{const e=w("color"),t=w("font"),o=w("text"),n=w("font-weight"),a=w("tracking"),l=w("leading"),s=w("breakpoint"),p=w("container"),b=w("spacing"),r=w("radius"),i=w("shadow"),m=w("inset-shadow"),y=w("text-shadow"),x=w("drop-shadow"),O=w("blur"),S=w("perspective"),E=w("aspect"),_=w("ease"),j=w("animate"),K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],V=()=>[...W(),u,d],U=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],h=()=>[u,d,b],A=()=>[N,"full","auto",...h()],ve=()=>[M,"none","subgrid",u,d],we=()=>["auto",{span:["full",M,u,d]},M,u,d],J=()=>[M,"auto",u,d],xe=()=>["auto","min","max","fr",u,d],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...h()],D=()=>[N,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...h()],ce=()=>[N,"screen","full","dvw","lvw","svw","min","max","fit",...h()],de=()=>[N,"screen","full","lh","dvh","lvh","svh","min","max","fit",...h()],g=()=>[e,u,d],ke=()=>[...W(),Ie,Le,{position:[u,d]}],Ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Se=()=>["auto","cover","contain",pr,ar,{size:[u,d]}],ue=()=>[me,Q,G],P=()=>["","none","full",r,u,d],R=()=>["",v,Q,G],X=()=>["solid","dashed","dotted","double"],Te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>[v,me,Ie,Le],Ee=()=>["","none",O,u,d],Z=()=>["none",v,u,d],ee=()=>["none",v,u,d],pe=()=>[v,u,d],te=()=>[N,"full",...h()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[I],breakpoint:[I],color:[Qe],container:[I],"drop-shadow":[I],ease:["in","out","in-out"],font:[nr],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[I],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[I],shadow:[I],spacing:["px",v],text:[I],"text-shadow":[I],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",N,d,u,E]}],container:["container"],"container-type":[{"@container":["","normal","size",u,d]}],"container-named":[ir],columns:[{columns:[v,d,u,p]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:V()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{"inset-s":A(),start:A()}],end:[{"inset-e":A(),end:A()}],"inset-bs":[{"inset-bs":A()}],"inset-be":[{"inset-be":A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[M,"auto",u,d]}],basis:[{basis:[N,"full","auto",p,...h()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[v,N,"auto","initial","none",d]}],grow:[{grow:["",v,u,d]}],shrink:[{shrink:["",v,u,d]}],order:[{order:[M,"first","last","none",u,d]}],"grid-cols":[{"grid-cols":ve()}],"col-start-end":[{col:we()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":ve()}],"row-start-end":[{row:we()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":xe()}],"auto-rows":[{"auto-rows":xe()}],gap:[{gap:h()}],"gap-x":[{"gap-x":h()}],"gap-y":[{"gap-y":h()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:h()}],px:[{px:h()}],py:[{py:h()}],ps:[{ps:h()}],pe:[{pe:h()}],pbs:[{pbs:h()}],pbe:[{pbe:h()}],pt:[{pt:h()}],pr:[{pr:h()}],pb:[{pb:h()}],pl:[{pl:h()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":h()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":h()}],"space-y-reverse":["space-y-reverse"],size:[{size:D()}],"inline-size":[{inline:["auto",...ce()]}],"min-inline-size":[{"min-inline":["auto",...ce()]}],"max-inline-size":[{"max-inline":["none",...ce()]}],"block-size":[{block:["auto",...de()]}],"min-block-size":[{"min-block":["auto",...de()]}],"max-block-size":[{"max-block":["none",...de()]}],w:[{w:[p,"screen",...D()]}],"min-w":[{"min-w":[p,"screen","none",...D()]}],"max-w":[{"max-w":[p,"screen","none","prose",{screen:[s]},...D()]}],h:[{h:["screen","lh",...D()]}],"min-h":[{"min-h":["screen","lh","none",...D()]}],"max-h":[{"max-h":["screen","lh",...D()]}],"font-size":[{text:["base",o,Q,G]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,fr,lr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",me,d]}],"font-family":[{font:[ur,cr,t]}],"font-features":[{"font-features":[d]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,u,d]}],"line-clamp":[{"line-clamp":[v,"none",u,Me]}],leading:[{leading:[l,...h()]}],"list-image":[{"list-image":["none",u,d]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",u,d]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:g()}],"text-color":[{text:g()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[v,"from-font","auto",u,G]}],"text-decoration-color":[{decoration:g()}],"underline-offset":[{"underline-offset":[v,"auto",u,d]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:h()}],"tab-size":[{tab:[M,u,d]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",u,d]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",u,d]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ke()}],"bg-repeat":[{bg:Ce()}],"bg-size":[{bg:Se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},M,u,d],radial:["",u,d],conic:[M,u,d]},mr,dr]}],"bg-color":[{bg:g()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:g()}],"gradient-via":[{via:g()}],"gradient-to":[{to:g()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:R()}],"border-w-x":[{"border-x":R()}],"border-w-y":[{"border-y":R()}],"border-w-s":[{"border-s":R()}],"border-w-e":[{"border-e":R()}],"border-w-bs":[{"border-bs":R()}],"border-w-be":[{"border-be":R()}],"border-w-t":[{"border-t":R()}],"border-w-r":[{"border-r":R()}],"border-w-b":[{"border-b":R()}],"border-w-l":[{"border-l":R()}],"divide-x":[{"divide-x":R()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":R()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:g()}],"border-color-x":[{"border-x":g()}],"border-color-y":[{"border-y":g()}],"border-color-s":[{"border-s":g()}],"border-color-e":[{"border-e":g()}],"border-color-bs":[{"border-bs":g()}],"border-color-be":[{"border-be":g()}],"border-color-t":[{"border-t":g()}],"border-color-r":[{"border-r":g()}],"border-color-b":[{"border-b":g()}],"border-color-l":[{"border-l":g()}],"divide-color":[{divide:g()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[v,u,d]}],"outline-w":[{outline:["",v,Q,G]}],"outline-color":[{outline:g()}],shadow:[{shadow:["","none",i,oe,re]}],"shadow-color":[{shadow:g()}],"inset-shadow":[{"inset-shadow":["none",m,oe,re]}],"inset-shadow-color":[{"inset-shadow":g()}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:g()}],"ring-offset-w":[{"ring-offset":[v,G]}],"ring-offset-color":[{"ring-offset":g()}],"inset-ring-w":[{"inset-ring":R()}],"inset-ring-color":[{"inset-ring":g()}],"text-shadow":[{"text-shadow":["none",y,oe,re]}],"text-shadow-color":[{"text-shadow":g()}],opacity:[{opacity:[v,u,d]}],"mix-blend":[{"mix-blend":[...Te(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Te()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[v]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":g()}],"mask-image-linear-to-color":[{"mask-linear-to":g()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":g()}],"mask-image-t-to-color":[{"mask-t-to":g()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":g()}],"mask-image-r-to-color":[{"mask-r-to":g()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":g()}],"mask-image-b-to-color":[{"mask-b-to":g()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":g()}],"mask-image-l-to-color":[{"mask-l-to":g()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":g()}],"mask-image-x-to-color":[{"mask-x-to":g()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":g()}],"mask-image-y-to-color":[{"mask-y-to":g()}],"mask-image-radial":[{"mask-radial":[u,d]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":g()}],"mask-image-radial-to-color":[{"mask-radial-to":g()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":W()}],"mask-image-conic-pos":[{"mask-conic":[v]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":g()}],"mask-image-conic-to-color":[{"mask-conic-to":g()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ke()}],"mask-repeat":[{mask:Ce()}],"mask-size":[{mask:Se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",u,d]}],filter:[{filter:["","none",u,d]}],blur:[{blur:Ee()}],brightness:[{brightness:[v,u,d]}],contrast:[{contrast:[v,u,d]}],"drop-shadow":[{"drop-shadow":["","none",x,oe,re]}],"drop-shadow-color":[{"drop-shadow":g()}],grayscale:[{grayscale:["",v,u,d]}],"hue-rotate":[{"hue-rotate":[v,u,d]}],invert:[{invert:["",v,u,d]}],saturate:[{saturate:[v,u,d]}],sepia:[{sepia:["",v,u,d]}],"backdrop-filter":[{"backdrop-filter":["","none",u,d]}],"backdrop-blur":[{"backdrop-blur":Ee()}],"backdrop-brightness":[{"backdrop-brightness":[v,u,d]}],"backdrop-contrast":[{"backdrop-contrast":[v,u,d]}],"backdrop-grayscale":[{"backdrop-grayscale":["",v,u,d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v,u,d]}],"backdrop-invert":[{"backdrop-invert":["",v,u,d]}],"backdrop-opacity":[{"backdrop-opacity":[v,u,d]}],"backdrop-saturate":[{"backdrop-saturate":[v,u,d]}],"backdrop-sepia":[{"backdrop-sepia":["",v,u,d]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":h()}],"border-spacing-x":[{"border-spacing-x":h()}],"border-spacing-y":[{"border-spacing-y":h()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",u,d]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[v,"initial",u,d]}],ease:[{ease:["linear","initial",_,u,d]}],delay:[{delay:[v,u,d]}],animate:[{animate:["none",j,u,d]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,u,d]}],"perspective-origin":[{"perspective-origin":V()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:ee()}],"scale-x":[{"scale-x":ee()}],"scale-y":[{"scale-y":ee()}],"scale-z":[{"scale-z":ee()}],"scale-3d":["scale-3d"],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[u,d,"","none","gpu","cpu"]}],"transform-origin":[{origin:V()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:te()}],"translate-x":[{"translate-x":te()}],"translate-y":[{"translate-y":te()}],"translate-z":[{"translate-z":te()}],"translate-none":["translate-none"],zoom:[{zoom:[M,u,d]}],accent:[{accent:g()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:g()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",u,d]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":g()}],"scrollbar-track-color":[{"scrollbar-track":g()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":h()}],"scroll-mx":[{"scroll-mx":h()}],"scroll-my":[{"scroll-my":h()}],"scroll-ms":[{"scroll-ms":h()}],"scroll-me":[{"scroll-me":h()}],"scroll-mbs":[{"scroll-mbs":h()}],"scroll-mbe":[{"scroll-mbe":h()}],"scroll-mt":[{"scroll-mt":h()}],"scroll-mr":[{"scroll-mr":h()}],"scroll-mb":[{"scroll-mb":h()}],"scroll-ml":[{"scroll-ml":h()}],"scroll-p":[{"scroll-p":h()}],"scroll-px":[{"scroll-px":h()}],"scroll-py":[{"scroll-py":h()}],"scroll-ps":[{"scroll-ps":h()}],"scroll-pe":[{"scroll-pe":h()}],"scroll-pbs":[{"scroll-pbs":h()}],"scroll-pbe":[{"scroll-pbe":h()}],"scroll-pt":[{"scroll-pt":h()}],"scroll-pr":[{"scroll-pr":h()}],"scroll-pb":[{"scroll-pb":h()}],"scroll-pl":[{"scroll-pl":h()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",u,d]}],fill:[{fill:["none",...g()]}],"stroke-w":[{stroke:[v,Q,G,Me]}],stroke:[{stroke:["none",...g()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},br=Yt(gr);function st(...e){return br(We(e))}const yr=Et("group/button inline-flex cursor-pointer shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-semibold whitespace-nowrap transition-[background-color,border-color,color,box-shadow,opacity,transform] duration-150 outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/25 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-45 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm shadow-primary/15 hover:bg-primary/90 hover:shadow-md hover:shadow-primary/20",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-transparent dark:hover:bg-input/30",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5",xs:"h-6 gap-1 px-2.5 text-xs has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 px-3 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",lg:"h-10 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-9","icon-xs":"size-6 [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function vr({className:e,variant:t="default",size:o="default",...n}){return f.jsx(dt,{"data-slot":"button","data-size":o,className:st(yr({variant:t,size:o,className:e})),...n})}var wr={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const xr=(e,t,o,n)=>{const a=T.forwardRef(({color:l="currentColor",size:s=24,stroke:p=2,title:b,className:r,children:i,...m},y)=>T.createElement("svg",{ref:y,...wr[e],width:s,height:s,className:["tabler-icon",`tabler-icon-${t}`,r].join(" "),...e==="filled"?{fill:l}:{strokeWidth:p,stroke:l},...m},[b&&T.createElement("title",{key:"svg-title"},b),...n.map(([x,O])=>T.createElement(x,O)),...Array.isArray(i)?i:[i]]));return a.displayName=`${o}`,a};const kr=[["path",{d:"M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],Cr=xr("outline","copy","Copy",kr),Sr=new Set(["https:","http:","mailto:"]);function Tr(e){const t=e.startsWith("//")?`https:${e}`:e;let o;try{o=new URL(t)}catch{return null}return Sr.has(o.protocol)?o.toString():null}let Y=null;async function ao(){if(!navigator.clipboard?.readText)throw new Error("Text clipboard access is unavailable.");return navigator.clipboard.readText()}async function Er(e){if(!navigator.clipboard?.writeText)throw new Error("Text clipboard access is unavailable.");await navigator.clipboard.writeText(e),Y=null}async function lo(e,t){if(!navigator.clipboard?.writeText)throw new Error("Text clipboard access is unavailable.");await navigator.clipboard.writeText(e.join(`\r
|
|
3
|
-
`)),Y=t?{paths:[...e],transferId:t}:null}function co(e){return!Y||!Pr(Y.paths,e)?(Y=null,null):Y.transferId}function uo(e){const t=Tr(e);if(!t)throw new Error("Only web or mail links can be opened.");window.open(t,"_blank","noopener,noreferrer")}function Pr(e,t){return e.length===t.length&&e.every((o,n)=>o===t[n])}const Rr=600;function po({delay:e=Rr,...t}){return f.jsx(ut,{"data-slot":"tooltip-provider",delay:e,...t})}function jr({...e}){return f.jsx(pt,{"data-slot":"tooltip",...e})}function Ar({...e}){return f.jsx(mt,{"data-slot":"tooltip-trigger",...e})}function Or({className:e,side:t="top",sideOffset:o=4,align:n="center",alignOffset:a=0,anchor:l,children:s,...p}){return f.jsx(ft,{children:f.jsx(ht,{align:n,alignOffset:a,anchor:l,side:t,sideOffset:o,className:"isolate z-50",children:f.jsxs(gt,{"data-slot":"tooltip-content",className:st("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-xl bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-lg data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...p,children:[s,f.jsx(bt,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:translate-x-[1.5px] data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:translate-x-[-1.5px] data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:translate-x-[-1.5px] data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:translate-x-[1.5px] data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}function zr({value:e,label:t="Copy",onCopied:o,onError:n}){const[a,l]=T.useState(!1);T.useEffect(()=>{if(!a)return;const p=window.setTimeout(()=>l(!1),2e3);return()=>window.clearTimeout(p)},[a]);const s=async()=>{try{await Er(e),l(!0),o?.()}catch{l(!1),n?.()}};return f.jsxs(f.Fragment,{children:[f.jsxs(jr,{children:[f.jsxs(Ar,{render:f.jsx("button",{type:"button",className:"copy-button","aria-label":a?"Copied":t,"data-copy-state":a?"copied":void 0,onClick:()=>{s()}}),children:[f.jsx(Cr,{className:"copy-button-icon","aria-hidden":"true"}),f.jsx("span",{className:"copy-button-check","aria-hidden":"true",children:"✓"})]}),f.jsx(Or,{children:a?"Copied":t})]}),f.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:a?"Copied":""})]})}const nt=document.documentElement.dataset.opentigProfile==="dev",mo=nt?"OpenTig Dev":"OpenTig";function Mr(){const e=nt?"npm run pair:web:dev":"opentig pair",[t,o]=T.useState(!1);return f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("code",{className:"min-w-0 select-text break-words text-sm",children:e}),f.jsx(zr,{value:e,label:"Copy command",onCopied:()=>o(!1),onError:()=>o(!0)})]}),t&&f.jsx("p",{className:"mt-2 text-sm text-destructive",role:"alert",children:"Could not copy. Select and copy the command manually."})]})}const Lr=3600*1e3,Ir=60*1e3,Nr=10*1e3;function Fr({request:e=fetch,page:t=document,lifecycle:o=window}={}){let n=!1,a=null,l,s;const p=()=>{n||(l=setTimeout(()=>{b()},Ir))},b=async()=>{if(n||a||t.visibilityState!=="visible")return;clearTimeout(l);const m=new AbortController;a=m,s=setTimeout(()=>m.abort(),Nr);try{const y=await e("/api/auth/renew",{method:"POST",credentials:"include",cache:"no-store",signal:m.signal});!y.ok&&y.status!==401&&y.status!==403&&p()}catch{p()}finally{clearTimeout(s),a=null}},r=()=>{b()},i=setInterval(r,Lr);return t.addEventListener("visibilitychange",r),o.addEventListener("focus",r),o.addEventListener("online",r),r(),()=>{n=!0,clearInterval(i),clearTimeout(l),clearTimeout(s),a?.abort(),t.removeEventListener("visibilitychange",r),o.removeEventListener("focus",r),o.removeEventListener("online",r)}}const c={bootstrap:"app:bootstrap",capabilities:"app:capabilities",preferences:"app:preferences",filesTreeStateUpdate:"app:files-tree-state",openFilesStateUpdate:"app:open-files-state",projectCreate:"projects:create",projectRename:"projects:rename",projectRemove:"projects:remove",projectAssign:"projects:assign",repositoryOpenPath:"repository:open-path",repositoryBrowseDirectories:"repository:browse-directories",repositoryOpenRecent:"repository:open-recent",repositoryRelocateRecent:"repository:relocate-recent",repositoryForget:"repository:forget",repositoryStatus:"repository:status",repositoryFiles:"repository:files",repositoryDirectoryEntries:"repository:directory-entries",repositoryReadFile:"repository:read-file",repositoryGetFavicon:"repository:favicon",repositoryWriteFile:"repository:write-file",repositoryAbsolutePath:"repository:absolute-path",repositoryCopyEntries:"repository:copy-entries",repositoryCutEntries:"repository:cut-entries",repositoryPasteEntries:"repository:paste-entries",repositoryMoveEntry:"repository:move-entry",repositoryDeleteEntry:"repository:delete-entry",repositoryMoveEntries:"repository:move-entries",repositoryDeleteEntries:"repository:delete-entries",repositoryRenameEntry:"repository:rename-entry",repositoryCreateEntry:"repository:create-entry",repositoryFileHistoryState:"repository:file-history-state",repositoryUndoFileOperation:"repository:undo-file-operation",repositoryRedoFileOperation:"repository:redo-file-operation",repositorySearch:"repository:search",repositoryReplaceSearch:"repository:replace-search",diffGet:"diff:get",diffCommit:"diff:commit",diffCommitFile:"diff:commit-file",indexStage:"index:stage",indexUnstage:"index:unstage",indexDiscard:"index:discard",indexStageAll:"index:stage-all",indexUnstageAll:"index:unstage-all",indexPrepareCommitGroup:"index:prepare-commit-group",indexUpdateConflict:"index:update-conflict",indexResolveConflict:"index:resolve-conflict",commitCreate:"commit:create",commitUndoLatest:"commit:undo-latest",commitsList:"commits:list",commitsFiles:"commits:files",branchesList:"refs:branches",branchSwitch:"refs:switch",worktreesList:"refs:worktrees",worktreeSelect:"refs:select-worktree",refsPull:"refs:pull",refsPush:"refs:push",refsFetch:"refs:fetch",localRefsSnapshot:"refs:local-snapshot",branchDetails:"refs:branch-details",worktreeDetails:"refs:worktree-details",branchDelete:"refs:delete-branch",worktreeRemove:"refs:remove-worktree",aiStatuses:"ai:statuses",aiGenerateCommitMessage:"ai:generate-commit-message",aiCancelGeneration:"ai:cancel-generation",aiLog:"ai:log",aiClearLog:"ai:clear-log",diagnosticsList:"diagnostics:list",diagnosticsClear:"diagnostics:clear",diagnosticsRecord:"diagnostics:record",githubStatus:"github:status",githubRepositoryInfo:"github:repository-info",githubPrForBranch:"github:pr-for-branch",githubPrList:"github:pr-list",githubPrView:"github:pr-view",githubPrDiff:"github:pr-diff",githubPrCommitDiff:"github:pr-commit-diff",githubPrCreate:"github:pr-create",githubPrDraft:"github:pr-draft",githubPrDraftCancel:"github:pr-draft-cancel"},_r=9*6e4,Dr=_r+3e4,Ne=Dr+3e4,Gr=1,qr={protocolVersion:Gr},Br=qr.protocolVersion,fe=1;class ae extends Error{}class H extends ae{}class Fe extends ae{}class he extends ae{}class _e extends ae{}class Wr{url;createSocket;requestTimeoutMs;heartbeatMs;reconnectBaseMs;reconnectMaxMs;offlineAfterAttempts;random;pending=new Map;connectionWaiters=new Set;stateListeners=new Set;eventListeners=new Set;reconnectListeners=new Set;socket=null;state="connecting";requestSequence=0;socketGeneration=0;reconnectAttempts=0;reconnectTimer=null;heartbeatTimer=null;awaitingPong=!1;started=!1;stopped=!1;connectedBefore=!1;constructor(t={}){this.url=t.url??Ur(),this.createSocket=t.createSocket??(o=>new WebSocket(o)),this.requestTimeoutMs=t.requestTimeoutMs??3e4,this.heartbeatMs=t.heartbeatMs??2e4,this.reconnectBaseMs=t.reconnectBaseMs??250,this.reconnectMaxMs=t.reconnectMaxMs??5e3,this.offlineAfterAttempts=t.offlineAfterAttempts??5,this.random=t.random??Math.random}getState=()=>this.state;subscribeState=t=>(this.stateListeners.add(t),this.start(),()=>this.stateListeners.delete(t));onEvent(t){return this.eventListeners.add(t),this.start(),()=>this.eventListeners.delete(t)}onReconnect(t){return this.reconnectListeners.add(t),()=>this.reconnectListeners.delete(t)}async request(t,o,n={}){const a=n.timeoutMs??this.requestTimeoutMs,l=Date.now();if(this.start(),await this.waitForConnection(a,n.signal),n.signal?.aborted)throw se();const s=this.socket;if(!s||s.readyState!==fe)throw new H("OpenTig server disconnected.");const p=`${Date.now().toString(36)}-${(++this.requestSequence).toString(36)}`,b=Math.max(1,a-(Date.now()-l));return new Promise((r,i)=>{const m={resolve:r,reject:i,timer:setTimeout(()=>{this.finishPending(p),i(new _e(`Server request timed out: ${String(t)}`))},b),...n.signal?{signal:n.signal}:{}};n.signal&&(m.abort=()=>{this.finishPending(p),i(se())},n.signal.addEventListener("abort",m.abort,{once:!0})),this.pending.set(p,m);try{const y=[...o];for(;y.length>0&&y.at(-1)===void 0;)y.pop();s.send(JSON.stringify({type:"request",id:p,command:t,args:y}))}catch{this.finishPending(p),i(new H("Could not send request to the OpenTig server."))}})}markIncompatible(){this.stopped=!0,this.clearReconnect(),this.setState("incompatible-version"),this.rejectConnectionWaiters(new he("OpenTig server protocol is incompatible.")),this.rejectPending(new he("OpenTig server protocol is incompatible.")),this.socket?.close(1e3,"Incompatible protocol")}close(){this.stopped=!0,this.clearReconnect(),this.clearHeartbeat(),this.rejectConnectionWaiters(new H("OpenTig server connection closed.")),this.rejectPending(new H("OpenTig server connection closed.")),this.socket?.close(1e3,"Client closing"),this.socket=null}start(){this.started||this.stopped||(this.started=!0,this.connect())}connect(){if(this.stopped)return;this.clearReconnect();const t=++this.socketGeneration;let o;try{o=this.createSocket(this.url)}catch{this.disconnected(t,0);return}this.socket=o,o.onopen=()=>{if(t!==this.socketGeneration||this.stopped)return;const n=this.connectedBefore;if(this.connectedBefore=!0,this.reconnectAttempts=0,this.setState("connected"),this.resolveConnectionWaiters(),this.startHeartbeat(),n)for(const a of this.reconnectListeners)Promise.resolve(a()).catch(()=>{})},o.onmessage=n=>this.message(t,n.data),o.onerror=()=>{},o.onclose=n=>this.disconnected(t,n.code)}message(t,o){if(t!==this.socketGeneration||typeof o!="string")return;let n;try{n=JSON.parse(o)}catch{return}if(n.type==="pong"){this.awaitingPong=!1;return}if(n.type==="event"){for(const l of this.eventListeners)l(n.event);return}if(n.type!=="result")return;const a=this.pending.get(n.id);a&&(this.finishPending(n.id),Vr(a,n.result))}disconnected(t,o){if(t!==this.socketGeneration||(this.socket=null,this.clearHeartbeat(),this.rejectPending(new H("OpenTig server disconnected before the request completed.")),this.stopped))return;if(o===1008){this.stopped=!0,this.setState("auth-required"),this.rejectConnectionWaiters(new Fe("Authentication required."));return}this.reconnectAttempts+=1,this.setState(this.reconnectAttempts>=this.offlineAfterAttempts?"offline":"reconnecting");const n=Math.min(this.reconnectMaxMs,this.reconnectBaseMs*2**(this.reconnectAttempts-1)),a=Math.max(0,Math.round(n*(.5+this.random())));this.reconnectTimer=setTimeout(()=>this.connect(),a)}waitForConnection(t,o){return this.state==="connected"&&this.socket?.readyState===fe?Promise.resolve():this.state==="auth-required"?Promise.reject(new Fe("Authentication required.")):this.state==="incompatible-version"?Promise.reject(new he("OpenTig server protocol is incompatible.")):this.stopped?Promise.reject(new H("OpenTig server connection is closed.")):o?.aborted?Promise.reject(se()):new Promise((n,a)=>{const l={resolve:n,reject:a,timer:setTimeout(()=>{this.removeConnectionWaiter(l),a(new _e("Timed out waiting for the OpenTig server."))},t),...o?{signal:o}:{}};o&&(l.abort=()=>{this.removeConnectionWaiter(l),a(se())},o.addEventListener("abort",l.abort,{once:!0})),this.connectionWaiters.add(l)})}resolveConnectionWaiters(){for(const t of[...this.connectionWaiters])this.removeConnectionWaiter(t),t.resolve()}rejectConnectionWaiters(t){for(const o of[...this.connectionWaiters])this.removeConnectionWaiter(o),o.reject(t)}removeConnectionWaiter(t){clearTimeout(t.timer),t.signal&&t.abort&&t.signal.removeEventListener("abort",t.abort),this.connectionWaiters.delete(t)}finishPending(t){const o=this.pending.get(t);o&&(clearTimeout(o.timer),o.signal&&o.abort&&o.signal.removeEventListener("abort",o.abort),this.pending.delete(t))}rejectPending(t){for(const[o,n]of[...this.pending])this.finishPending(o),n.reject(t)}startHeartbeat(){this.clearHeartbeat(),this.heartbeatTimer=setInterval(()=>{const t=this.socket;if(!(!t||t.readyState!==fe)){if(this.awaitingPong){t.close(4e3,"Heartbeat timeout");return}this.awaitingPong=!0,t.send(JSON.stringify({type:"ping"}))}},this.heartbeatMs)}clearHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=null,this.awaitingPong=!1}clearReconnect(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null}setState(t){if(this.state!==t){this.state=t;for(const o of this.stateListeners)o()}}}function Vr(e,t){if(t.ok){e.resolve(t.value);return}const o=new Error(t.error.message);o.detail=t.error,e.reject(o)}function Ur(){const e=new URL("/ws",window.location.href);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.href}function se(){return new DOMException("The request was cancelled.","AbortError")}function $r(e={}){const t=e.transport??new Wr,o=e.httpOrigin??globalThis.location?.origin??"http://127.0.0.1",n=e.fetch??fetch,a=new Set,l=new Set,s=(r,...i)=>t.request(r,i),b={app:{bootstrap:async()=>{const r=await t.request(c.bootstrap,[]);if(!r.server||r.server.protocolVersion!==Br)throw t.markIncompatible(),new Error("This OpenTig client is incompatible with the server.");return r},capabilities:()=>s(c.capabilities),setPreferences:r=>s(c.preferences,r),setFilesTreeExpandedPaths:(r,i)=>s(c.filesTreeStateUpdate,r,i),setOpenFilesState:(r,i,m,y)=>s(c.openFilesStateUpdate,r,i,m,y)},projects:{create:r=>s(c.projectCreate,r),rename:(r,i)=>s(c.projectRename,r,i),remove:r=>s(c.projectRemove,r),assign:(r,i)=>s(c.projectAssign,r,i)},repository:{openPath:r=>s(c.repositoryOpenPath,r),browseDirectories:r=>r===void 0?s(c.repositoryBrowseDirectories):s(c.repositoryBrowseDirectories,r),openRecent:r=>s(c.repositoryOpenRecent,r),forget:r=>s(c.repositoryForget,r),relocateRecent:(r,i)=>s(c.repositoryRelocateRecent,r,i),getStatus:(r,i)=>s(c.repositoryStatus,r,i),getFiles:r=>s(c.repositoryFiles,r),getDirectoryEntries:(r,i)=>s(c.repositoryDirectoryEntries,r,i),readFile:(r,i,m)=>s(c.repositoryReadFile,r,i,m),readImage:(r,i)=>Yr(n,o,r,i),getFavicon:r=>s(c.repositoryGetFavicon,r),writeFile:(r,i,m,y)=>s(c.repositoryWriteFile,r,i,m,y),getAbsolutePath:(r,i)=>s(c.repositoryAbsolutePath,r,i),copyEntries:(r,i)=>s(c.repositoryCopyEntries,r,i),cutEntries:(r,i)=>s(c.repositoryCutEntries,r,i),pasteEntries:(r,i,m,y,x)=>s(c.repositoryPasteEntries,r,i,m,y,x),moveEntry:(r,i,m)=>s(c.repositoryMoveEntry,r,i,m),moveEntries:(r,i,m)=>s(c.repositoryMoveEntries,r,i,m),deleteEntry:(r,i)=>s(c.repositoryDeleteEntry,r,i),deleteEntries:(r,i)=>s(c.repositoryDeleteEntries,r,i),renameEntry:(r,i,m)=>s(c.repositoryRenameEntry,r,i,m),createEntry:(r,i,m,y)=>s(c.repositoryCreateEntry,r,i,m,y),search:(r,i)=>s(c.repositorySearch,r,i),replaceSearch:(r,i)=>s(c.repositoryReplaceSearch,r,i),fileHistoryState:r=>s(c.repositoryFileHistoryState,r),undoFileOperation:r=>s(c.repositoryUndoFileOperation,r),redoFileOperation:r=>s(c.repositoryRedoFileOperation,r)},diff:{get:r=>s(c.diffGet,r),getCommit:(r,i)=>s(c.diffCommit,r,i),getCommitFile:(r,i,m,y)=>s(c.diffCommitFile,r,i,m,y)},index:{stage:(r,i)=>s(c.indexStage,r,i),unstage:(r,i)=>s(c.indexUnstage,r,i),discard:(r,i)=>s(c.indexDiscard,r,i),stageAll:r=>s(c.indexStageAll,r),unstageAll:r=>s(c.indexUnstageAll,r),prepareCommitGroup:r=>s(c.indexPrepareCommitGroup,r),updateConflict:(r,i,m)=>s(c.indexUpdateConflict,r,i,m),resolveConflict:(r,i,m)=>s(c.indexResolveConflict,r,i,m)},commits:{create:(r,i)=>s(c.commitCreate,r,i),undoLatest:(r,i)=>s(c.commitUndoLatest,r,i),list:(r,i)=>s(c.commitsList,r,i),files:(r,i)=>s(c.commitsFiles,r,i)},refs:{listBranches:r=>s(c.branchesList,r),switchBranch:(r,i,m)=>s(c.branchSwitch,r,i,m),listWorktrees:r=>s(c.worktreesList,r),selectWorktree:(r,i)=>s(c.worktreeSelect,r,i),pull:r=>s(c.refsPull,r),push:r=>s(c.refsPush,r),fetch:r=>s(c.refsFetch,r),localRefsSnapshot:r=>s(c.localRefsSnapshot,r),branchDetails:r=>s(c.branchDetails,r),worktreeDetails:r=>s(c.worktreeDetails,r),deleteBranch:r=>s(c.branchDelete,r),removeWorktree:r=>s(c.worktreeRemove,r)},ai:{statuses:r=>s(c.aiStatuses,r),generateCommitMessage:r=>t.request(c.aiGenerateCommitMessage,[r],{timeoutMs:Ne}),cancelGeneration:r=>s(c.aiCancelGeneration,r),log:()=>s(c.aiLog),clearLog:()=>s(c.aiClearLog)},github:{status:r=>s(c.githubStatus,r),repositoryInfo:r=>s(c.githubRepositoryInfo,r),findPullRequestForBranch:(r,i)=>s(c.githubPrForBranch,r,i),listPullRequests:(r,i)=>s(c.githubPrList,r,i),getPullRequest:(r,i)=>s(c.githubPrView,r,i),getPullRequestDiff:(r,i)=>s(c.githubPrDiff,r,i),getPullRequestCommitDiff:(r,i)=>s(c.githubPrCommitDiff,r,i),createPullRequest:r=>s(c.githubPrCreate,r),generateDraft:r=>t.request(c.githubPrDraft,[r],{timeoutMs:Ne}),cancelDraft:r=>s(c.githubPrDraftCancel,r)},diagnostics:{list:()=>s(c.diagnosticsList),clear:()=>s(c.diagnosticsClear),record:r=>s(c.diagnosticsRecord,r)},events:{onRepositoryChanged:r=>De(a,r),onActiveRepositoryChanged:r=>De(l,r)}};return t.onEvent(r=>Hr(r,a,l)),t.onReconnect(async()=>{const r=await b.app.bootstrap();if(r.activeRepository){for(const i of l)i(r.activeRepository);for(const i of a)i(r.activeRepository.id,"unknown")}}),{api:b,transport:t}}function De(e,t){return e.add(t),()=>e.delete(t)}function Hr(e,t,o){if(e.type==="repository.changed")for(const n of t)n(e.repositoryId,e.scope);else for(const n of o)n(e.repository)}async function Yr(e,t,o,n){const a=n.split("/").map(encodeURIComponent).join("/"),l=new URL(`/api/image/${encodeURIComponent(o)}/${a}`,t),s=await e(l,{credentials:"include"});if(s.status===413||s.status===415)return s.json();if(!s.ok)throw new Error(s.status===401?"Authentication required.":"Could not load image preview.");const p=s.headers.get("content-type");if(!p?.startsWith("image/"))throw new Error("Server returned an invalid image preview.");const b=new Uint8Array(await s.arrayBuffer());return{status:"ready",path:n,mimeType:p,data:b,size:Number(s.headers.get("content-length")??b.byteLength),mtimeMs:Number(s.headers.get("x-opentig-mtime-ms")??0)}}const ne=$r(),C=window.opentigDesktop,q=ne.api,fo={...q,app:{...q.app,bootstrap:async()=>{const e=await q.app.bootstrap();return await C?.app.preferencesChanged(e.preferences),e},capabilities:async()=>{const e=await q.app.capabilities();return{...e,runtimeMode:C?"desktop":e.runtimeMode,nativePicker:!!C,fileClipboard:!!C,revealInFileManager:!!C}},setPreferences:async e=>{const t=await q.app.setPreferences(e);return await C?.app.preferencesChanged(t),t},setZoomFactor:e=>{C?C.app.setZoomFactor(e):document.documentElement.style.zoom=String(Math.max(.8,Math.min(1.3,Number(e)||1)))},setTitleBarTheme:e=>C?.app.setTitleBarTheme(e)??Promise.resolve()},clipboard:{readFilePaths:()=>C?.clipboard.readFilePaths()??Promise.resolve([]),readImagePng:()=>C?.clipboard.readImagePng()??Promise.resolve(null)},repository:{...q.repository,select:async e=>C?C.repository.select(e):window.prompt(e??"Repository path on the OpenTig server")?.trim()||null,selectRelocation:async(e,t)=>C?C.repository.selectRelocation(e,t):window.prompt(`New server path for ${e}`,t)?.trim()||null,revealEntry:async(e,t)=>{if(!C)throw new Error("Reveal in file manager is available only in the desktop app.");const o=await q.repository.getAbsolutePath(e,t);await C.repository.revealEntry(o)}}},Kr={connecting:"Connecting to OpenTig server…",connected:"Server connected",reconnecting:"Reconnecting to OpenTig server…","auth-required":"Authentication required","incompatible-version":"Client and server versions are incompatible",offline:"OpenTig server is offline"};function Qr({children:e}){const t=T.useSyncExternalStore(ne.transport.subscribeState,ne.transport.getState,ne.transport.getState),[o,n]=T.useState(!1);if(T.useEffect(()=>{if(t==="connected"&&!window.opentigDesktop)return Fr()},[t]),T.useEffect(()=>(t==="connected"&&n(!0),document.documentElement.dataset.serverConnection=t,()=>{delete document.documentElement.dataset.serverConnection}),[t]),t==="auth-required"){const a=!!window.opentigDesktop;return f.jsx("main",{className:"access-page flex min-h-dvh items-center justify-center bg-background px-4 py-6 text-foreground",children:f.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",role:"status",children:[f.jsx("h1",{className:"text-lg font-semibold",children:"Authentication required"}),f.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:a?"Restart OpenTig to restore its private desktop session.":f.jsx(f.Fragment,{children:"Generate a pairing code with the command below on the server, or from Settings → Network access in the desktop app."})}),!a&&f.jsxs(f.Fragment,{children:[f.jsx(Mr,{}),f.jsx(vr,{className:"mt-5",nativeButton:!1,render:f.jsx("a",{href:"/pair"}),children:"Pair this browser"})]})]})})}return!o&&(t==="offline"||t==="incompatible-version")?f.jsx(Tt,{heading:t==="offline"?"OpenTig server is offline":"OpenTig cannot continue",detail:t==="offline"?"See the server log for details, then restart OpenTig.":"Client and server versions are incompatible.",busy:!1}):f.jsxs(f.Fragment,{children:[e,o&&t!=="connected"&&f.jsxs("div",{className:`server-connection-state ${t}`,role:"status","aria-live":"polite",children:[f.jsx("span",{className:"server-connection-dot","aria-hidden":"true"}),Kr[t]]})]})}function Jr(e,t){return e===t?e:e==="unknown"||t==="unknown"?"unknown":e==="worktree"&&t==="index"||e==="index"&&t==="worktree"?"index":"unknown"}function ho(e,t){return{scope:Jr(e.scope,t.scope),background:e.background&&t.background,view:t.view}}function go(e,t){return t!=="diff"&&t!=="conflict"?!1:e==="worktree"||e==="index"||e==="unknown"}function bo(e){return e==="worktree"||e==="index"||e==="unknown"}function Xr(e,t){const o=e==="unknown";return{status:!0,branches:o||e==="refs"||e==="worktrees",worktrees:o||e==="worktrees",files:t==="files"&&(o||e==="worktree"||e==="index"),history:t==="history"&&(o||e==="refs")}}const Zr=new lt({defaultOptions:{queries:{networkMode:"always",retry:!1,refetchOnWindowFocus:!1,refetchOnReconnect:!1,staleTime:0},mutations:{networkMode:"always",retry:!1}}}),yo={repository:e=>["repository",e],status:e=>["repository",e,"status"],branches:e=>["repository",e,"branches"],worktrees:e=>["repository",e,"worktrees"],files:e=>["repository",e,"files"],fileHistory:e=>["repository",e,"file-history"],history:e=>["repository",e,"history"],githubInfo:e=>["repository",e,"github-info"],pulls:(e,t)=>["repository",e,"pulls",...t],pullRequest:(e,t)=>["repository",e,"pull-request",t],pullRequestDiff:(e,t)=>["repository",e,"pull-request-diff",t],pullRequestCommitDiff:(e,t)=>["repository",e,"pull-request-commit-diff",t],search:(e,t)=>["repository",e,"search",t],localRefs:e=>["repository",e,"local-refs"],branchDetails:(e,t)=>["repository",e,"branch-details",t],branchPullRequest:(e,t)=>["repository",e,"branch-pull-request",t],worktreeDetails:(e,t)=>["repository",e,"worktree-details",t]};function vo(e,t){const o=Xr(e,t);return["status","branches","worktrees","files","history"].filter(n=>o[n])}const eo=T.lazy(()=>qe(()=>import("./App-CeDVj5Hh.js").then(e=>e.a_),__vite__mapDeps([0,1,2,3]))),to=T.lazy(()=>qe(()=>import("./PairingPage-C5Ggk-Z_.js"),__vite__mapDeps([4,1,2,3])));function ro(){const e=window.location.pathname==="/pair"?f.jsx(to,{}):f.jsx(Qr,{children:f.jsx(eo,{})});return f.jsxs(f.Fragment,{children:[f.jsx(Ct,{}),f.jsx(ct,{client:Zr,children:f.jsx(T.Suspense,{fallback:null,children:e})})]})}const it=document.getElementById("root");if(!it)throw new Error("Root container not found.");at.createRoot(it).render(f.jsx(T.StrictMode,{children:f.jsx(ro,{})}));export{vr as B,Cr as I,St as O,Mr as P,Tt as S,jr as T,qe as _,Ar as a,Or as b,xr as c,st as d,uo as e,mo as f,Et as g,go as h,bo as i,po as j,Xr as k,vo as l,ho as m,lo as n,fo as o,io as p,yo as q,ao as r,ne as s,co as t,Er as w};
|