@opentig/cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/chunks/{cli-Bi6ET5UT.mjs → cli-B6JTojx_.mjs} +1 -1
- package/dist/client/assets/App-Dfm5F199.js +74 -0
- package/dist/client/assets/CreatePullRequestDialog-CAeykZ72.js +2 -0
- package/dist/client/assets/{DiffWorkspace-RDG_Y70N.js → DiffWorkspace-BRicWHvw.js} +13 -13
- package/dist/client/assets/{EditableFileViewer-CsbifqBO.js → EditableFileViewer-DWeSDnZn.js} +1 -1
- package/dist/client/assets/{File-CHjvYpb2.js → File-D65shwRR.js} +1 -1
- package/dist/client/assets/FilesView-EfoU7sF-.js +1 -0
- package/dist/client/assets/GitHubAvatar-C8R3iNoM.js +1 -0
- package/dist/client/assets/HistoryView-C6T2dsBC.js +1 -0
- package/dist/client/assets/{HtmlFileViewer-h8ULU8Gy.js → HtmlFileViewer-JXLHTNPm.js} +1 -1
- package/dist/client/assets/{IconEdit-Cg8S2wqW.js → IconEdit-3fgBTCQ4.js} +1 -1
- package/dist/client/assets/{IconFolderSymlink-BZSLX1ez.js → IconFolderSymlink-C4ydD1eS.js} +1 -1
- package/dist/client/assets/{ImageFileViewer-Cjw58ckv.js → ImageFileViewer-YH2xhkkk.js} +1 -1
- package/dist/client/assets/LocalRefsDialog--1NiYKYj.js +1 -0
- package/dist/client/assets/{MarkdownFileViewer-kLiduag6.js → MarkdownFileViewer-BsB8WkIH.js} +2 -2
- package/dist/client/assets/PairingPage-DXRyAYHn.js +1 -0
- package/dist/client/assets/{PierreDiffViewer-eAcugmoF.js → PierreDiffViewer-DoV3V0IW.js} +1 -1
- package/dist/client/assets/{PierreEditBoundary-DlGd1pqO.js → PierreEditBoundary-BnYZbHfi.js} +1 -1
- package/dist/client/assets/{PierreWorkerPool-Col4k7qz.js → PierreWorkerPool-Cg9zdxiI.js} +1 -1
- package/dist/client/assets/PullRequestDiff-D6QG5Anx.js +1 -0
- package/dist/client/assets/PullRequestViewer-jC3LVmiO.js +2 -0
- package/dist/client/assets/PullRequestsView-GStKxG7k.js +1 -0
- package/dist/client/assets/{QuickOpenDialog-BFDDZVCL.js → QuickOpenDialog-HvslpGQl.js} +1 -1
- package/dist/client/assets/{RepositoryProjectsDialog-CvB8KcFp.js → RepositoryProjectsDialog-Biqv5GO_.js} +1 -1
- package/dist/client/assets/SearchView-D5XB6wdu.js +1 -0
- package/dist/client/assets/SettingsDialog-DWAunOQB.js +72 -0
- package/dist/client/assets/{Viewer-o1hDU33O.js → Viewer-Gfy3Ejyo.js} +3 -3
- package/dist/client/assets/{abnfDiagram-N423BO3Z-BvrnK_R-.js → abnfDiagram-N423BO3Z-DdAfHevw.js} +1 -1
- package/dist/client/assets/{arc-DLa3_7ua.js → arc-C43uoeEi.js} +1 -1
- package/dist/client/assets/{architectureDiagram-T3A2C74G-BexwhnyX.js → architectureDiagram-T3A2C74G-C7q0hhRO.js} +1 -1
- package/dist/client/assets/{blockDiagram-VBNYF7ZC-CoOttUUo.js → blockDiagram-VBNYF7ZC-C1x9Iap4.js} +1 -1
- package/dist/client/assets/{c4Diagram-5PPSVZJV-Bgp6ppUh.js → c4Diagram-5PPSVZJV-BmKaVW6q.js} +1 -1
- package/dist/client/assets/channel-Diwpee6E.js +1 -0
- package/dist/client/assets/checkbox-XfIUFPxh.js +1 -0
- package/dist/client/assets/{chunk-2GRJ4B5K-C_kzp38w.js → chunk-2GRJ4B5K-kzy_H3BQ.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-CysYnRkJ.js → chunk-2Q5K7J3B-BMj-FT4X.js} +1 -1
- package/dist/client/assets/{chunk-5RXB4S5H-oMS6x_ag.js → chunk-5RXB4S5H-DmPGiCCb.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-C5-dW5wf.js → chunk-5VM5RSS4-DYFL8__L.js} +1 -1
- package/dist/client/assets/{chunk-6Q2QTUOP-DxahInnA.js → chunk-6Q2QTUOP-CI98oVdT.js} +1 -1
- package/dist/client/assets/{chunk-GF5L2VYU-D7V-3eRg.js → chunk-GF5L2VYU-D9JiiMlX.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BrLmjbVP.js → chunk-JWPE2WC7-D0THYpZl.js} +1 -1
- package/dist/client/assets/{chunk-KBJHAD2P-CyOvijwM.js → chunk-KBJHAD2P-Z1tJfyAr.js} +1 -1
- package/dist/client/assets/{chunk-RYQCIY6F-BvEjVjQs.js → chunk-RYQCIY6F-31aS4cD3.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-C_IY9A64.js → chunk-XXDRQBXY-ClWDHmEp.js} +1 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-BDuo9kiS.js +1 -0
- package/dist/client/assets/classDiagram-v2-OCEON4UE-BDuo9kiS.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Cu7qZi7h.js → cose-bilkent-JH36ORCC-Btg2MYLh.js} +1 -1
- package/dist/client/assets/{cynefin-VYW2F7L2-B4M1t9lL.js → cynefin-VYW2F7L2-Cbh4Pk6j.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-MW4NZA55-CAosOLmT.js → cynefinDiagram-MW4NZA55-BBqorl0u.js} +1 -1
- package/dist/client/assets/{dagre-VZM6K2ZE-q354V538.js → dagre-VZM6K2ZE-DugEItZ0.js} +1 -1
- package/dist/client/assets/{diagram-7IWD3JNH-C_CzkBPt.js → diagram-7IWD3JNH-Biu7dmH8.js} +1 -1
- package/dist/client/assets/{diagram-B4RE2ZJO-VvvYHE9c.js → diagram-B4RE2ZJO-UDm4DXFS.js} +1 -1
- package/dist/client/assets/{diagram-LBJQPF4R-D8vRQwb5.js → diagram-LBJQPF4R-Bcku4gb-.js} +1 -1
- package/dist/client/assets/{diagram-Q27KOJAE-Bul4aDKg.js → diagram-Q27KOJAE-DFRjglV-.js} +1 -1
- package/dist/client/assets/{diagram-UB23O5K3-DNadEE58.js → diagram-UB23O5K3-CgfMWtd0.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-BXEA7PRR-Bf-68MMZ.js → ebnfDiagram-BXEA7PRR-CZzYOqs0.js} +1 -1
- package/dist/client/assets/{erDiagram-JOGREHBK-CJ-jHFsf.js → erDiagram-JOGREHBK-Cdlbxgs6.js} +1 -1
- package/dist/client/assets/{flowDiagram-UKHOOZJN-DMOdinBU.js → flowDiagram-UKHOOZJN-BgImDwpP.js} +1 -1
- package/dist/client/assets/{ganttDiagram-PKOTCBZU-DzezS3Zy.js → ganttDiagram-PKOTCBZU-SFhtiyL4.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-Dftpvns8.js → gitGraphDiagram-DS77QQ5N-Bkm5ueys.js} +1 -1
- package/dist/client/assets/{index-DAUK3rnz.js → index-B5RC4THs.js} +4 -4
- package/dist/client/assets/index-Dc9xVluy.css +1 -0
- package/dist/client/assets/{infoDiagram-6WML65LV-DmgUBq17.js → infoDiagram-6WML65LV-pCYc-VX2.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-CL0PQhpQ.js → ishikawaDiagram-WSZJBQD7-BtNbG3Y6.js} +1 -1
- package/dist/client/assets/{journeyDiagram-NVQOT4AX-Ck4pQx_A.js → journeyDiagram-NVQOT4AX-CPW2qT3y.js} +1 -1
- package/dist/client/assets/{kanban-definition-27J2QSJJ-DuRZxBql.js → kanban-definition-27J2QSJJ-wD6JXQFs.js} +1 -1
- package/dist/client/assets/{linear-C2JDCaz4.js → linear-sj8MOkmS.js} +1 -1
- package/dist/client/assets/{mermaid.core-9dt2ugQA.js → mermaid.core-CGJtfmwb.js} +4 -4
- package/dist/client/assets/{mindmap-definition-FAOFIHXS-vy0fdDF0.js → mindmap-definition-FAOFIHXS-BQwLHBVs.js} +1 -1
- package/dist/client/assets/{pegDiagram-VL7TDLO6-DjVJy-Gm.js → pegDiagram-VL7TDLO6-DtDsb-Z8.js} +1 -1
- package/dist/client/assets/{pieDiagram-7S7Q4E2Y-ATbd_8vw.js → pieDiagram-7S7Q4E2Y-B3WhqNuS.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-C8o6ofcl.js → quadrantDiagram-CIZ2JOQS-CPi38pp_.js} +1 -1
- package/dist/client/assets/{railroadDiagram-AXF67PYL-Qvij9Ubo.js → railroadDiagram-AXF67PYL-Btac44Ux.js} +1 -1
- package/dist/client/assets/{render-markdown-BtCybfvQ.js → render-markdown-hAIWRfn0.js} +6 -6
- package/dist/client/assets/{requirementDiagram-LRYGKXZP-yLfrba2h.js → requirementDiagram-LRYGKXZP-CHJgDNdg.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-W5VNT64P-BTXRtTyG.js → sankeyDiagram-W5VNT64P-OYJHfmtd.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BN1CCZIX.js → sequenceDiagram-SI44F4Z6-9ypa9W08.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-BfXjBBYo.js → sizeCapture-X5ZJPWSS-5ZDUTERI.js} +1 -1
- package/dist/client/assets/{stateDiagram-OKZ733FA-DMAWiBsP.js → stateDiagram-OKZ733FA-nGHE1hN7.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CkCpE1Yu.js +1 -0
- package/dist/client/assets/{swimlanes-SLNWSIFB-BD20m5cw.js → swimlanes-SLNWSIFB-BZFv9Zp8.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-Dxlb7bju.js +8 -0
- package/dist/client/assets/tanstack-CcfAJoQ7.js +1 -0
- package/dist/client/assets/{timeline-definition-Z64GVDOM-gtc0-AHB.js → timeline-definition-Z64GVDOM-pUIcaCIE.js} +1 -1
- package/dist/client/assets/{vennDiagram-T6HMQDX7-Cdr4AXTp.js → vennDiagram-T6HMQDX7-D6dEIJmP.js} +1 -1
- package/dist/client/assets/{viewer-tabs-D-T0xQaq.js → viewer-tabs-BjG3oKQ9.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-T6FBY63Y-BcU4vxO8.js → wardleyDiagram-T6FBY63Y-DZ8ro_-y.js} +1 -1
- package/dist/client/assets/{xychartDiagram-ELKLHX3M-B3Zuadj8.js → xychartDiagram-ELKLHX3M-WJ2Zfmlk.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/dev.mjs +2 -2
- package/dist/manifest.json +2 -2
- package/dist/server.mjs +1616 -473
- package/dist/utility.mjs +11 -5
- package/package.json +1 -1
- package/dist/client/assets/App-BXZLGT86.js +0 -74
- package/dist/client/assets/CreatePullRequestDialog-DFonMYEx.js +0 -2
- package/dist/client/assets/FilesView-Dl8QFbFA.js +0 -1
- package/dist/client/assets/GitHubAvatar-CnBaloV0.js +0 -1
- package/dist/client/assets/HistoryView-BgCZU2JO.js +0 -1
- package/dist/client/assets/LocalRefsDialog-DNgrd7Qp.js +0 -1
- package/dist/client/assets/PairingPage-C97sv-8s.js +0 -1
- package/dist/client/assets/PullRequestDiff-DhKTXyIF.js +0 -1
- package/dist/client/assets/PullRequestViewer-BgI8HFMe.js +0 -2
- package/dist/client/assets/PullRequestsView-PYWLy8We.js +0 -1
- package/dist/client/assets/SearchView-BwF_MsxK.js +0 -1
- package/dist/client/assets/SettingsDialog-DIcLmXSE.js +0 -9
- package/dist/client/assets/channel-1k1AYpyV.js +0 -1
- package/dist/client/assets/checkbox-BRH0ZNIC.js +0 -1
- package/dist/client/assets/classDiagram-JCYQIIEL-ChyNFpay.js +0 -1
- package/dist/client/assets/classDiagram-v2-OCEON4UE-ChyNFpay.js +0 -1
- package/dist/client/assets/index-BfA4tAc1.css +0 -1
- package/dist/client/assets/stateDiagram-v2-UEYNNEHI-D_ofZeaa.js +0 -1
- package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-CF9m5JSB.js +0 -8
- package/dist/client/assets/tanstack-B0Sf7wNU.js +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import{r as g,j as s}from"./react-rd22PHbN.js";import{b as $t,u as Xe,c as Un,t as Gn,d as Hn,r as Bn,e as Vn,k as nr}from"./tanstack-CcfAJoQ7.js";import{M as sr,i as mt,u as Jn,g as Wn,h as rr,j as ir,L as or,k as ar,l as cr,p as lr,c as B,o as H,q as W,B as k,s as P,I as tt,w as jt,a as ie,T as te,b as ne,d as se,m as Xt}from"./index-B5RC4THs.js";import{D as ue,a as de,b as he,c as fe,g as Y,x as Le,H as ur,S as Kn,I as qn,y as dr,R as ve,w as Te,p as Ie,q as at,ak as hr,aQ as $e,j as Et,d as _e,e as ct,aR as Yn,h as en,a9 as fr,k as Ot,m as At,l as Tt,n as It,o as Fe,aS as tn,aT as nn,aU as sn,aV as pr,aW as gt,aX as rn,$ as Qn,aY as Xn,aZ as es,a_ as mr,a$ as on,b0 as gr,b1 as br,f as Pt,b2 as vr,b3 as xr,b4 as yr,K as jr,b5 as wr}from"./App-Dfm5F199.js";import{r as kr,s as _r,t as Nr,u as Sr,v as zr}from"./base-ui-CJ8ZIx3d.js";import{I as an}from"./IconEdit-3fgBTCQ4.js";function cn(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Cr(...e){return t=>{let n=!1;const r=e.map(i=>{const o=cn(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():cn(e[i],null)}}}}function $r(...e){return g.useCallback(Cr(...e),e)}class Er extends g.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(mt(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=mt(r)&&r.offsetWidth||0,o=mt(r)&&r.offsetHeight||0,a=getComputedStyle(n),c=this.props.sizeRef.current;c.height=parseFloat(a.height),c.width=parseFloat(a.width),c.top=n.offsetTop,c.left=n.offsetLeft,c.right=i-c.width-c.left,c.bottom=o-c.height-c.top,c.direction=a.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function Or({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:o}){const a=g.useId(),c=g.useRef(null),l=g.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:u}=g.useContext(sr),h=o!==!1?e.props?.ref??e?.ref:void 0,m=$r(c,h);return g.useInsertionEffect(()=>{const{width:d,height:p,top:f,left:y,right:j,bottom:C,direction:Z}=l.current;if(t||o===!1||!c.current||!d||!p)return;const A=Z==="rtl",w=n==="left"?A?`right: ${j}`:`left: ${y}`:A?`left: ${y}`:`right: ${j}`,S=r==="bottom"?`bottom: ${C}`:`top: ${f}`;c.current.dataset.motionPopId=a;const x=document.createElement("style");u&&(x.nonce=u);const T=i??document.head;return T.appendChild(x),x.sheet&&x.sheet.insertRule(`
|
|
2
|
+
[data-motion-pop-id="${a}"] {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
width: ${d}px !important;
|
|
5
|
+
height: ${p}px !important;
|
|
6
|
+
${w}px !important;
|
|
7
|
+
${S}px !important;
|
|
8
|
+
}
|
|
9
|
+
`),()=>{c.current?.removeAttribute("data-motion-pop-id"),T.contains(x)&&T.removeChild(x)}},[t]),s.jsx(Er,{isPresent:t,childRef:c,sizeRef:l,pop:o,children:o===!1?e:g.cloneElement(e,{ref:m})})}const Ar=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a,anchorX:c,anchorY:l,root:u})=>{const h=Jn(Tr),m=g.useId(),d=g.useRef(n),p=g.useRef(r);Wn(()=>{d.current=n,p.current=r});let f=!0,y=g.useMemo(()=>(f=!1,{id:m,initial:t,isPresent:n,custom:i,onExitComplete:j=>{h.set(j,!0);for(const C of h.values())if(!C)return;r&&r()},register:j=>(h.set(j,!1),()=>{h.delete(j),!d.current&&!h.size&&p.current?.()})}),[n,h,r]);return o&&f&&(y={...y}),g.useMemo(()=>{h.forEach((j,C)=>h.set(C,!1))},[n]),g.useEffect(()=>{!n&&!h.size&&r&&r()},[n]),e=s.jsx(Or,{pop:a==="popLayout",isPresent:n,anchorX:c,anchorY:l,root:u,children:e}),s.jsx(rr.Provider,{value:y,children:e})};function Tr(){return new Map}const We=e=>e.key||"";function ln(e){const t=[];return g.Children.forEach(e,n=>{g.isValidElement(n)&&t.push(n)}),t}const un=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o="sync",propagate:a=!1,anchorX:c="left",anchorY:l="top",root:u})=>{const[h,m]=ir(a),d=g.useMemo(()=>ln(e),[e]),p=a&&!h?[]:d.map(We),f=g.useRef(!0),y=g.useRef(d),j=Jn(()=>new Map),C=g.useRef(new Set),[Z,A]=g.useState(d),[w,S]=g.useState(d);Wn(()=>{f.current=!1,y.current=d;for(let z=0;z<w.length;z++){const $=We(w[z]);p.includes($)?(j.delete($),C.current.delete($)):j.get($)!==!0&&j.set($,!1)}},[w,p.length,p.join("-")]);const x=[];if(d!==Z){let z=[...d];for(let $=0;$<w.length;$++){const X=w[$],ae=We(X);p.includes(ae)||(z.splice($,0,X),x.push(X))}return o==="wait"&&x.length&&(z=x),S(ln(z)),A(d),null}const{forceRender:T}=g.useContext(or);return s.jsx(s.Fragment,{children:w.map(z=>{const $=We(z),X=a&&!h?!1:d===w||p.includes($),ae=()=>{if(C.current.has($))return;if(j.has($))C.current.add($),j.set($,!0);else return;let L=!0;j.forEach(J=>{J||(L=!1)}),L&&(T?.(),S(y.current),a&&m?.(),r&&r())};return s.jsx(Ar,{isPresent:X,initial:!f.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:u,onExitComplete:X?void 0:ae,anchorX:c,anchorY:l,children:z},$)})})};function Ir(){!ar.current&&cr();const[e]=g.useState(lr.current);return e}const Pr=[["path",{d:"M4 10a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M6 4v4",key:"svg-1"}],["path",{d:"M6 12v8",key:"svg-2"}],["path",{d:"M10 16a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-3"}],["path",{d:"M12 4v10",key:"svg-4"}],["path",{d:"M12 18v2",key:"svg-5"}],["path",{d:"M16 7a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-6"}],["path",{d:"M18 4v1",key:"svg-7"}],["path",{d:"M18 9v11",key:"svg-8"}]],Rr=B("outline","adjustments","Adjustments",Pr);const Zr=[["path",{d:"M3 9l4 -4l4 4m-4 -4v14",key:"svg-0"}],["path",{d:"M21 15l-4 4l-4 -4m4 4v-14",key:"svg-1"}]],ts=B("outline","arrows-sort","ArrowsSort",Zr);const Mr=[["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"}]],Lr=B("outline","browser","Browser",Mr);const Dr=[["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"}]],Fr=B("outline","keyboard","Keyboard",Dr);const Ur=[["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"}]],Gr=B("outline","link","Link",Ur);const Hr=[["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"}]],Br=B("outline","list","List",Hr);const Vr=[["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"}]],Jr=B("outline","moon","Moon",Vr);const Wr=[["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"}]],Kr=B("outline","network","Network",Wr);const qr=[["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"}]],Yr=B("outline","qrcode","Qrcode",qr);const Qr=[["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"}]],dn=B("outline","shield-lock","ShieldLock",Qr);const Xr=[["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"}]],ns=B("outline","sort-ascending","SortAscending",Xr);const ei=[["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"}]],ss=B("outline","sort-descending","SortDescending",ei);const ti=[["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"}]],rs=B("outline","sparkles","Sparkles",ti);const ni=[["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"}]],is=B("outline","sun","Sun",ni);const si=[["path",{d:"M4 20l3 0",key:"svg-0"}],["path",{d:"M14 20l7 0",key:"svg-1"}],["path",{d:"M6.9 15l6.9 0",key:"svg-2"}],["path",{d:"M10.2 6.3l5.8 13.7",key:"svg-3"}],["path",{d:"M5 20l6 -16l2 0l7 16",key:"svg-4"}]],ri=B("outline","typography","Typography",si);const ii=[["path",{d:"M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0",key:"svg-0"}],["path",{d:"M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2",key:"svg-1"}]],oi=B("outline","user","User",ii);var hn;function b(e,t,n){function r(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);const u=a.prototype,h=Object.keys(u);for(let m=0;m<h.length;m++){const d=h[m];d in c||(c[d]=u[d].bind(c))}}const i=n?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(c){var l;const u=n?.Parent?new o:this;r(u,c),(l=u._zod).deferred??(l.deferred=[]);for(const h of u._zod.deferred)h();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>n?.Parent&&c instanceof n.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class Ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class os extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(hn=globalThis).__zod_globalConfig??(hn.__zod_globalConfig={});const Rt=globalThis.__zod_globalConfig;function Ne(e){return Rt}function as(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>t.indexOf(+r)===-1).map(([r,i])=>i)}function wt(e,t){return typeof t=="bigint"?t.toString():t}function Zt(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Mt(e){return e==null}function Lt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const fn=Symbol("evaluating");function E(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==fn)return r===void 0&&(r=fn,r=n()),r},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function ze(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function xe(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function pn(e){return JSON.stringify(e)}function ai(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const cs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function nt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ci=Zt(()=>{if(Rt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ue(e){if(nt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(nt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ls(e){return Ue(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const li=new Set(["string","number","symbol"]);function lt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ye(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ui(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function di(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=xe(e._zod.def,{get shape(){const a={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=n.shape[c])}return ze(this,"shape",a),a},checks:[]});return ye(e,o)}function hi(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=xe(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return ze(this,"shape",a),a},checks:[]});return ye(e,o)}function fi(e,t){if(!Ue(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=xe(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ze(this,"shape",o),o}});return ye(e,i)}function pi(e,t){if(!Ue(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=xe(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return ze(this,"shape",r),r}});return ye(e,n)}function mi(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=xe(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return ze(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ye(e,n)}function gi(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=xe(t._zod.def,{get shape(){const c=t._zod.def.shape,l={...c};if(n)for(const u in n){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(l[u]=e?new e({type:"optional",innerType:c[u]}):c[u])}else for(const u in c)l[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return ze(this,"shape",l),l},checks:[]});return ye(t,a)}function bi(e,t,n){const r=xe(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(const a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return ze(this,"shape",o),o}});return ye(t,r)}function Oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function vi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function us(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ke(e){return typeof e=="string"?e:e?.message}function Se(e,t,n){const r=e.message?e.message:Ke(e.inst?._zod.def?.error?.(e))??Ke(t?.error?.(e))??Ke(n.customError?.(e))??Ke(n.localeError?.(e))??"Invalid input",{inst:i,continue:o,input:a,...c}=e;return c.path??(c.path=[]),c.message=r,t?.reportInput&&(c.input=a),c}function Dt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ge(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ds=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,wt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},hs=b("$ZodError",ds),fs=b("$ZodError",ds,{Parent:Error});function xi(e,t=n=>n.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function yi(e,t=n=>n.message){const n={_errors:[]},r=(i,o=[])=>{for(const a of i.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...o,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...o,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...o,...a.path]);else{const c=[...o,...a.path];if(c.length===0)n._errors.push(t(a));else{let l=n,u=0;for(;u<c.length;){const h=c[u];u===c.length-1?(l[h]=l[h]||{_errors:[]},l[h]._errors.push(t(a))):l[h]=l[h]||{_errors:[]},l=l[h],u++}}}};return r(e),n}const Ft=e=>(t,n,r,i)=>{const o=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Ae;if(a.issues.length){const c=new(i?.Err??e)(a.issues.map(l=>Se(l,o,Ne())));throw cs(c,i?.callee),c}return a.value},Ut=e=>async(t,n,r,i)=>{const o=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new(i?.Err??e)(a.issues.map(l=>Se(l,o,Ne())));throw cs(c,i?.callee),c}return a.value},ut=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Ae;return o.issues.length?{success:!1,error:new(e??hs)(o.issues.map(a=>Se(a,i,Ne())))}:{success:!0,data:o.value}},ji=ut(fs),dt=e=>async(t,n,r)=>{const i=r?{...r,async:!0}:{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Se(a,i,Ne())))}:{success:!0,data:o.value}},wi=dt(fs),ki=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ft(e)(t,n,i)},_i=e=>(t,n,r)=>Ft(e)(t,n,r),Ni=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Ut(e)(t,n,i)},Si=e=>async(t,n,r)=>Ut(e)(t,n,r),zi=e=>(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return ut(e)(t,n,i)},Ci=e=>(t,n,r)=>ut(e)(t,n,r),$i=e=>async(t,n,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return dt(e)(t,n,i)},Ei=e=>async(t,n,r)=>dt(e)(t,n,r),Oi=/^[cC][0-9a-z]{6,}$/,Ai=/^[0-9a-z]+$/,Ti=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ii=/^[0-9a-vA-V]{20}$/,Pi=/^[A-Za-z0-9]{27}$/,Ri=/^[a-zA-Z0-9_-]{21}$/,Zi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,mn=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Li=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Di="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fi(){return new RegExp(Di,"u")}const Ui=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Hi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Bi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ps=/^[A-Za-z0-9_-]*$/,Ji=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,ms="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ki=new RegExp(`^${ms}$`);function gs(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function qi(e){return new RegExp(`^${gs(e)}$`)}function Yi(e){const t=gs({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ms}T(?:${r})$`)}const Qi=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Xi=/^[^A-Z]*$/,eo=/^[^a-z]*$/,oe=b("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),to=b("$ZodCheckMaxLength",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Mt(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const a=Dt(i);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),no=b("$ZodCheckMinLength",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Mt(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const a=Dt(i);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),so=b("$ZodCheckLengthEquals",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const i=r.value;return!Mt(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=r=>{const i=r.value,o=i.length;if(o===t.length)return;const a=Dt(i),c=o>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ht=b("$ZodCheckStringFormat",(e,t)=>{var n,r;oe.init(e,t),e._zod.onattach.push(i=>{const o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ro=b("$ZodCheckRegex",(e,t)=>{ht.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),io=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xi),ht.init(e,t)}),oo=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=eo),ht.init(e,t)}),ao=b("$ZodCheckIncludes",(e,t)=>{oe.init(e,t);const n=lt(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),co=b("$ZodCheckStartsWith",(e,t)=>{oe.init(e,t);const n=new RegExp(`^${lt(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),lo=b("$ZodCheckEndsWith",(e,t)=>{oe.init(e,t);const n=new RegExp(`.*${lt(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),uo=b("$ZodCheckOverwrite",(e,t)=>{oe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class ho{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
10
|
+
`).filter(a=>a),i=Math.min(...r.map(a=>a.length-a.trimStart().length)),o=r.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(const a of o)this.content.push(a)}compile(){const t=Function,n=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...n,i.join(`
|
|
11
|
+
`))}}const fo={major:4,minor:4,patch:3},F=b("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fo;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const o of i._zod.onattach)o(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(a,c,l)=>{let u=Oe(a),h;for(const m of c){if(m._zod.def.when){if(vi(a)||!m._zod.def.when(a))continue}else if(u)continue;const d=a.issues.length,p=m._zod.check(a);if(p instanceof Promise&&l?.async===!1)throw new Ae;if(h||p instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await p,a.issues.length!==d&&(u||(u=Oe(a,d)))});else{if(a.issues.length===d)continue;u||(u=Oe(a,d))}}return h?h.then(()=>a):a},o=(a,c,l)=>{if(Oe(a))return a.aborted=!0,a;const u=i(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new Ae;return u.then(h=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){const u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(h=>o(h,a,c)):o(u,a,c)}const l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new Ae;return l.then(u=>i(u,r,c))}return i(l,r,c)}}E(e,"~standard",()=>({validate:i=>{try{const o=ji(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return wi(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Gt=b("$ZodString",(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qi(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),R=b("$ZodStringFormat",(e,t)=>{ht.init(e,t),Gt.init(e,t)}),po=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Mi),R.init(e,t)}),mo=b("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=mn(r))}else t.pattern??(t.pattern=mn());R.init(e,t)}),go=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Li),R.init(e,t)}),bo=b("$ZodURL",(e,t)=>{R.init(e,t),e._zod.check=n=>{try{const r=n.value.trim();if(!t.normalize&&t.protocol?.source===Ji.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),vo=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fi()),R.init(e,t)}),xo=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ri),R.init(e,t)}),yo=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Oi),R.init(e,t)}),jo=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ai),R.init(e,t)}),wo=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ti),R.init(e,t)}),ko=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ii),R.init(e,t)}),_o=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pi),R.init(e,t)}),No=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yi(t)),R.init(e,t)}),So=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ki),R.init(e,t)}),zo=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=qi(t)),R.init(e,t)}),Co=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zi),R.init(e,t)}),$o=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ui),R.init(e,t),e._zod.bag.format="ipv4"}),Eo=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Gi),R.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Oo=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hi),R.init(e,t)}),Ao=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Bi),R.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[i,o]=r;if(!o)throw new Error;const a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function bs(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const To=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Vi),R.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{bs(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Io(e){if(!ps.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return bs(n)}const Po=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ps),R.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Io(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ro=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),R.init(e,t)});function Zo(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}const Mo=b("$ZodJWT",(e,t)=>{R.init(e,t),e._zod.check=n=>{Zo(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Lo=b("$ZodUnknown",(e,t)=>{F.init(e,t),e._zod.parse=n=>n}),Do=b("$ZodNever",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function gn(e,t,n){e.issues.length&&t.issues.push(...us(n,e.issues)),t.value[n]=e.value}const Fo=b("$ZodArray",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let a=0;a<i.length;a++){const c=i[a],l=t.element._zod.run({value:c,issues:[]},r);l instanceof Promise?o.push(l.then(u=>gn(u,n,a))):gn(l,n,a)}return o.length?Promise.all(o).then(()=>n):n}});function st(e,t,n,r,i,o){const a=n in r;if(e.issues.length){if(i&&o&&!a)return;t.issues.push(...us(n,e.issues))}if(!a&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?a&&(t.value[n]=void 0):t.value[n]=e.value}function vs(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=ui(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function xs(e,t,n,r,i,o){const a=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,h=l.optin==="optional",m=l.optout==="optional";for(const d in t){if(d==="__proto__"||c.has(d))continue;if(u==="never"){a.push(d);continue}const p=l.run({value:t[d],issues:[]},r);p instanceof Promise?e.push(p.then(f=>st(f,n,d,t,h,m))):st(p,n,d,t,h,m)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const Uo=b("$ZodObject",(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Zt(()=>vs(t));E(e._zod,"propValues",()=>{const c=t.shape,l={};for(const u in c){const h=c[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(const m of h.values)l[u].add(m)}}return l});const i=nt,o=t.catchall;let a;e._zod.parse=(c,l)=>{a??(a=r.value);const u=c.value;if(!i(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};const h=[],m=a.shape;for(const d of a.keys){const p=m[d],f=p._zod.optin==="optional",y=p._zod.optout==="optional",j=p._zod.run({value:u[d],issues:[]},l);j instanceof Promise?h.push(j.then(C=>st(C,c,d,u,f,y))):st(j,c,d,u,f,y)}return o?xs(h,u,c,l,r.value,e):h.length?Promise.all(h).then(()=>c):c}}),Go=b("$ZodObjectJIT",(e,t)=>{Uo.init(e,t);const n=e._zod.parse,r=Zt(()=>vs(t)),i=d=>{const p=new ho(["shape","payload","ctx"]),f=r.value,y=A=>{const w=pn(A);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};p.write("const input = payload.value;");const j=Object.create(null);let C=0;for(const A of f.keys)j[A]=`key_${C++}`;p.write("const newResult = {};");for(const A of f.keys){const w=j[A],S=pn(A),x=d[A],T=x?._zod?.optin==="optional",z=x?._zod?.optout==="optional";p.write(`const ${w} = ${y(A)};`),T&&z?p.write(`
|
|
12
|
+
if (${w}.issues.length) {
|
|
13
|
+
if (${S} in input) {
|
|
14
|
+
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
15
|
+
...iss,
|
|
16
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (${w}.value === undefined) {
|
|
22
|
+
if (${S} in input) {
|
|
23
|
+
newResult[${S}] = undefined;
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
newResult[${S}] = ${w}.value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
`):T?p.write(`
|
|
30
|
+
if (${w}.issues.length) {
|
|
31
|
+
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (${w}.value === undefined) {
|
|
38
|
+
if (${S} in input) {
|
|
39
|
+
newResult[${S}] = undefined;
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
newResult[${S}] = ${w}.value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
`):p.write(`
|
|
46
|
+
const ${w}_present = ${S} in input;
|
|
47
|
+
if (${w}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
49
|
+
...iss,
|
|
50
|
+
path: iss.path ? [${S}, ...iss.path] : [${S}]
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
if (!${w}_present && !${w}.issues.length) {
|
|
54
|
+
payload.issues.push({
|
|
55
|
+
code: "invalid_type",
|
|
56
|
+
expected: "nonoptional",
|
|
57
|
+
input: undefined,
|
|
58
|
+
path: [${S}]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (${w}_present) {
|
|
63
|
+
if (${w}.value === undefined) {
|
|
64
|
+
newResult[${S}] = undefined;
|
|
65
|
+
} else {
|
|
66
|
+
newResult[${S}] = ${w}.value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const Z=p.compile();return(A,w)=>Z(d,A,w)};let o;const a=nt,c=!Rt.jitless,u=c&&ci.value,h=t.catchall;let m;e._zod.parse=(d,p)=>{m??(m=r.value);const f=d.value;return a(f)?c&&u&&p?.async===!1&&p.jitless!==!0?(o||(o=i(t.shape)),d=o(d,p),h?xs([],f,d,p,m,e):d):n(d,p):(d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d)}});function bn(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const i=e.filter(o=>!Oe(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(a=>Se(a,r,Ne())))}),t)}const Ho=b("$ZodUnion",(e,t)=>{F.init(e,t),E(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),E(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),E(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),E(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Lt(i.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let o=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:r.value,issues:[]},i);if(l instanceof Promise)a.push(l),o=!0;else{if(l.issues.length===0)return l;a.push(l)}}return o?Promise.all(a).then(c=>bn(c,r,e,i)):bn(a,r,e,i)}}),Bo=b("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{const i=n.value,o=t.left._zod.run({value:i,issues:[]},r),a=t.right._zod.run({value:i,issues:[]},r);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,u])=>vn(n,l,u)):vn(n,o,a)}});function kt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ue(e)&&Ue(t)){const n=Object.keys(t),r=Object.keys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...t};for(const o of r){const a=kt(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=t[r],a=kt(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function vn(e,t,n){const r=new Map;let i;for(const c of t.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(c);const o=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(o.length&&i&&e.issues.push({...i,keys:o}),Oe(e))return e;const a=kt(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Vo=b("$ZodEnum",(e,t)=>{F.init(e,t);const n=as(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(i=>li.has(typeof i)).map(i=>typeof i=="string"?lt(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{const a=i.value;return r.has(a)||i.issues.push({code:"invalid_value",values:n,input:a,inst:e}),i}}),Jo=b("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new os(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(n.value=a,n.fallback=!0,n));if(i instanceof Promise)throw new Ae;return n.value=i,n.fallback=!0,n}});function xn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const ys=b("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),E(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lt(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const i=n.value,o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(a=>xn(a,i)):xn(o,i)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Wo=b("$ZodExactOptional",(e,t)=>{ys.init(e,t),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ko=b("$ZodNullable",(e,t)=>{F.init(e,t),E(e._zod,"optin",()=>t.innerType._zod.optin),E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Lt(n.source)}|null)$`):void 0}),E(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),qo=b("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>yn(o,t)):yn(i,t)}});function yn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Yo=b("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Qo=b("$ZodNonOptional",(e,t)=>{F.init(e,t),E(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>jn(o,e)):jn(i,e)}});function jn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Xo=b("$ZodCatch",(e,t)=>{F.init(e,t),e._zod.optin="optional",E(e._zod,"optout",()=>t.innerType._zod.optout),E(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>Se(a,r,Ne()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(o=>Se(o,r,Ne()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),ea=b("$ZodPipe",(e,t)=>{F.init(e,t),E(e._zod,"values",()=>t.in._zod.values),E(e._zod,"optin",()=>t.in._zod.optin),E(e._zod,"optout",()=>t.out._zod.optout),E(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const o=t.out._zod.run(n,r);return o instanceof Promise?o.then(a=>qe(a,t.in,r)):qe(o,t.in,r)}const i=t.in._zod.run(n,r);return i instanceof Promise?i.then(o=>qe(o,t.out,r)):qe(i,t.out,r)}});function qe(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const ta=b("$ZodReadonly",(e,t)=>{F.init(e,t),E(e._zod,"propValues",()=>t.innerType._zod.propValues),E(e._zod,"values",()=>t.innerType._zod.values),E(e._zod,"optin",()=>t.innerType?._zod?.optin),E(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(wn):wn(i)}});function wn(e){return e.value=Object.freeze(e.value),e}const na=b("$ZodCustom",(e,t)=>{oe.init(e,t),F.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(o=>kn(o,n,r,e));kn(i,n,r,e)}});function kn(e,t,n,r){if(!e){const i={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Ge(i))}}var _n;class sa{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const i={...r,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ra(){return new sa}(_n=globalThis).__zod_globalRegistry??(_n.__zod_globalRegistry=ra());const De=globalThis.__zod_globalRegistry;function ia(e,t){return new e({type:"string",..._(t)})}function oa(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Nn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function ca(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function la(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function ua(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function da(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function ha(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function fa(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function pa(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function ma(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function ga(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function ba(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function va(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function xa(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function ya(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function wa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function ka(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function _a(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Na(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Sa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function za(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Ca(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function $a(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Ea(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Oa(e){return new e({type:"unknown"})}function Aa(e,t){return new e({type:"never",..._(t)})}function js(e,t){return new to({check:"max_length",..._(t),maximum:e})}function rt(e,t){return new no({check:"min_length",..._(t),minimum:e})}function ws(e,t){return new so({check:"length_equals",..._(t),length:e})}function Ta(e,t){return new ro({check:"string_format",format:"regex",..._(t),pattern:e})}function Ia(e){return new io({check:"string_format",format:"lowercase",..._(e)})}function Pa(e){return new oo({check:"string_format",format:"uppercase",..._(e)})}function Ra(e,t){return new ao({check:"string_format",format:"includes",..._(t),includes:e})}function Za(e,t){return new co({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Ma(e,t){return new lo({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Pe(e){return new uo({check:"overwrite",tx:e})}function La(e){return Pe(t=>t.normalize(e))}function Da(){return Pe(e=>e.trim())}function Fa(){return Pe(e=>e.toLowerCase())}function Ua(){return Pe(e=>e.toUpperCase())}function Ga(){return Pe(e=>ai(e))}function Ha(e,t,n){return new e({type:"array",element:t,..._(n)})}function Ba(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function Va(e,t){const n=Ja(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Ge(i,r.value,n._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),r.issues.push(Ge(o))}},e(r.value,r)),t);return n}function Ja(e,t){const n=new oe({check:"custom",..._(t)});return n._zod.check=e,n}function ks(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??De,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function G(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{const h={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,h);else{const d=a.schema,p=t.processors[i.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);p(e,t,d,h)}const m=e._zod.parent;m&&(a.ref||(a.ref=m),G(m,t,h),t.seen.get(m).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&V(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _s(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const a of e.seen.entries()){const c=e.metadataRegistry.get(a[0])?.id;if(c){const l=r.get(c);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,a[0])}}const i=a=>{const c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(a[0])?.id,d=e.external.uri??(f=>f);if(m)return{ref:d(m)};const p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${d("__shared")}#/${c}/${p}`}}if(a[1]===n)return{ref:"#"};const u=`#/${c}/`,h=a[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:u+h}},o=a=>{if(a[1].schema.$ref)return;const c=a[1],{ref:l,defId:u}=i(a);c.def={...c.schema},u&&(c.defId=u);const h=c.schema;for(const m in h)delete h[m];h.$ref=l};if(e.cycles==="throw")for(const a of e.seen.entries()){const c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
71
|
+
|
|
72
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const c=a[1];if(t===a[0]){o(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1&&e.reused==="ref"){o(a);continue}}}function Ns(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=c=>{const l=e.seen.get(c);if(l.ref===null)return;const u=l.def??l.schema,h={...u},m=l.ref;if(l.ref=null,m){r(m);const p=e.seen.get(m),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,h),c._zod.parent===m)for(const j in u)j==="$ref"||j==="allOf"||j in h||delete u[j];if(f.$ref&&p.def)for(const j in u)j==="$ref"||j==="allOf"||j in p.def&&JSON.stringify(u[j])===JSON.stringify(p.def[j])&&delete u[j]}const d=c._zod.parent;if(d&&d!==m){r(d);const p=e.seen.get(d);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(const f in u)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f])&&delete u[f]}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};for(const c of[...e.seen.entries()].reverse())r(c[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(c)}Object.assign(i,n.def??n.schema);const o=e.metadataRegistry.get(t)?.id;o!==void 0&&i.id===o&&delete i.id;const a=e.external?.defs??{};for(const c of e.seen.entries()){const l=c[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,a[l.defId]=l.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?i.$defs=a:i.definitions=a);try{const c=JSON.parse(JSON.stringify(i));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:it(t,"input",e.processors),output:it(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function V(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return V(r.element,n);if(r.type==="set")return V(r.valueType,n);if(r.type==="lazy")return V(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return V(r.innerType,n);if(r.type==="intersection")return V(r.left,n)||V(r.right,n);if(r.type==="record"||r.type==="map")return V(r.keyType,n)||V(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:V(r.in,n)||V(r.out,n);if(r.type==="object"){for(const i in r.shape)if(V(r.shape[i],n))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(V(i,n))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(V(i,n))return!0;return!!(r.rest&&V(r.rest,n))}return!1}const Wa=(e,t={})=>n=>{const r=ks({...n,processors:t});return G(e,r),_s(r,e),Ns(r,e)},it=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},a=ks({...i??{},target:o,io:t,processors:n});return G(e,a),_s(a,e),Ns(a,e)},Ka={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qa=(e,t,n,r)=>{const i=n;i.type="string";const{minimum:o,maximum:a,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),c&&(i.format=Ka[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),u&&(i.contentEncoding=u),l&&l.size>0){const h=[...l];h.length===1?i.pattern=h[0].source:h.length>1&&(i.allOf=[...h.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ya=(e,t,n,r)=>{n.not={}},Qa=(e,t,n,r)=>{},Xa=(e,t,n,r)=>{const i=e._zod.def,o=as(i.entries);o.every(a=>typeof a=="number")&&(n.type="number"),o.every(a=>typeof a=="string")&&(n.type="string"),n.enum=o},ec=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},tc=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},nc=(e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=G(o.element,t,{...r,path:[...r.path,"items"]})},sc=(e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const a=o.shape;for(const u in a)i.properties[u]=G(a[u],t,{...r,path:[...r.path,"properties",u]});const c=new Set(Object.keys(a)),l=new Set([...c].filter(u=>{const h=o.shape[u]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=G(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},rc=(e,t,n,r)=>{const i=e._zod.def,o=i.inclusive===!1,a=i.options.map((c,l)=>G(c,t,{...r,path:[...r.path,o?"oneOf":"anyOf",l]}));o?n.oneOf=a:n.anyOf=a},ic=(e,t,n,r)=>{const i=e._zod.def,o=G(i.left,t,{...r,path:[...r.path,"allOf",0]}),a=G(i.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,l=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];n.allOf=l},oc=(e,t,n,r)=>{const i=e._zod.def,o=G(i.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},ac=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},cc=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},lc=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},uc=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},dc=(e,t,n,r)=>{const i=e._zod.def,o=i.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?o?i.out:i.in:i.out;G(a,t,r);const c=t.seen.get(e);c.ref=a},hc=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType,n.readOnly=!0},Ss=(e,t,n,r)=>{const i=e._zod.def;G(i.innerType,t,r);const o=t.seen.get(e);o.ref=i.innerType},fc=b("ZodISODateTime",(e,t)=>{No.init(e,t),M.init(e,t)});function pc(e){return za(fc,e)}const mc=b("ZodISODate",(e,t)=>{So.init(e,t),M.init(e,t)});function gc(e){return Ca(mc,e)}const bc=b("ZodISOTime",(e,t)=>{zo.init(e,t),M.init(e,t)});function vc(e){return $a(bc,e)}const xc=b("ZodISODuration",(e,t)=>{Co.init(e,t),M.init(e,t)});function yc(e){return Ea(xc,e)}const jc=(e,t)=>{hs.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>yi(e,n)},flatten:{value:n=>xi(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,wt,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,wt,2)}},isEmpty:{get(){return e.issues.length===0}}})},Q=b("ZodError",jc,{Parent:Error}),wc=Ft(Q),kc=Ut(Q),_c=ut(Q),Nc=dt(Q),Sc=ki(Q),zc=_i(Q),Cc=Ni(Q),$c=Si(Q),Ec=zi(Q),Oc=Ci(Q),Ac=$i(Q),Tc=Ei(Q),Sn=new WeakMap;function ft(e,t,n){const r=Object.getPrototypeOf(e);let i=Sn.get(r);if(i||(i=new Set,Sn.set(r,i)),!i.has(t)){i.add(t);for(const o in n){const a=n[o];Object.defineProperty(r,o,{configurable:!0,enumerable:!1,get(){const c=a.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const U=b("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:it(e,"input"),output:it(e,"output")}}),e.toJSONSchema=Wa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>wc(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>_c(e,n,r),e.parseAsync=async(n,r)=>kc(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Nc(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Sc(e,n,r),e.decode=(n,r)=>zc(e,n,r),e.encodeAsync=async(n,r)=>Cc(e,n,r),e.decodeAsync=async(n,r)=>$c(e,n,r),e.safeEncode=(n,r)=>Ec(e,n,r),e.safeDecode=(n,r)=>Oc(e,n,r),e.safeEncodeAsync=async(n,r)=>Ac(e,n,r),e.safeDecodeAsync=async(n,r)=>Tc(e,n,r),ft(e,"ZodType",{check(...n){const r=this.def;return this.clone(xe(r,{checks:[...r.checks??[],...n.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return ye(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Sl(n,r))},superRefine(n,r){return this.check(zl(n,r))},overwrite(n){return this.check(Pe(n))},optional(){return $n(this)},exactOptional(){return fl(this)},nullable(){return En(this)},nullish(){return $n(En(this))},nonoptional(n){return xl(this,n)},array(){return nl(this)},or(n){return ol([this,n])},and(n){return cl(this,n)},transform(n){return On(this,dl(n))},default(n){return gl(this,n)},prefault(n){return vl(this,n)},catch(n){return jl(this,n)},pipe(n){return On(this,n)},readonly(){return _l(this)},describe(n){const r=this.clone();return De.add(r,{description:n}),r},meta(...n){if(n.length===0)return De.get(this);const r=this.clone();return De.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e)),zs=b("_ZodString",(e,t)=>{Gt.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,i,o)=>qa(e,r,i);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,ft(e,"_ZodString",{regex(...r){return this.check(Ta(...r))},includes(...r){return this.check(Ra(...r))},startsWith(...r){return this.check(Za(...r))},endsWith(...r){return this.check(Ma(...r))},min(...r){return this.check(rt(...r))},max(...r){return this.check(js(...r))},length(...r){return this.check(ws(...r))},nonempty(...r){return this.check(rt(1,...r))},lowercase(r){return this.check(Ia(r))},uppercase(r){return this.check(Pa(r))},trim(){return this.check(Da())},normalize(...r){return this.check(La(...r))},toLowerCase(){return this.check(Fa())},toUpperCase(){return this.check(Ua())},slugify(){return this.check(Ga())}})}),Ic=b("ZodString",(e,t)=>{Gt.init(e,t),zs.init(e,t),e.email=n=>e.check(oa(Pc,n)),e.url=n=>e.check(da(Rc,n)),e.jwt=n=>e.check(Sa(Yc,n)),e.emoji=n=>e.check(ha(Zc,n)),e.guid=n=>e.check(Nn(zn,n)),e.uuid=n=>e.check(aa(Ye,n)),e.uuidv4=n=>e.check(ca(Ye,n)),e.uuidv6=n=>e.check(la(Ye,n)),e.uuidv7=n=>e.check(ua(Ye,n)),e.nanoid=n=>e.check(fa(Mc,n)),e.guid=n=>e.check(Nn(zn,n)),e.cuid=n=>e.check(pa(Lc,n)),e.cuid2=n=>e.check(ma(Dc,n)),e.ulid=n=>e.check(ga(Fc,n)),e.base64=n=>e.check(ka(Wc,n)),e.base64url=n=>e.check(_a(Kc,n)),e.xid=n=>e.check(ba(Uc,n)),e.ksuid=n=>e.check(va(Gc,n)),e.ipv4=n=>e.check(xa(Hc,n)),e.ipv6=n=>e.check(ya(Bc,n)),e.cidrv4=n=>e.check(ja(Vc,n)),e.cidrv6=n=>e.check(wa(Jc,n)),e.e164=n=>e.check(Na(qc,n)),e.datetime=n=>e.check(pc(n)),e.date=n=>e.check(gc(n)),e.time=n=>e.check(vc(n)),e.duration=n=>e.check(yc(n))});function bt(e){return ia(Ic,e)}const M=b("ZodStringFormat",(e,t)=>{R.init(e,t),zs.init(e,t)}),Pc=b("ZodEmail",(e,t)=>{go.init(e,t),M.init(e,t)}),zn=b("ZodGUID",(e,t)=>{po.init(e,t),M.init(e,t)}),Ye=b("ZodUUID",(e,t)=>{mo.init(e,t),M.init(e,t)}),Rc=b("ZodURL",(e,t)=>{bo.init(e,t),M.init(e,t)}),Zc=b("ZodEmoji",(e,t)=>{vo.init(e,t),M.init(e,t)}),Mc=b("ZodNanoID",(e,t)=>{xo.init(e,t),M.init(e,t)}),Lc=b("ZodCUID",(e,t)=>{yo.init(e,t),M.init(e,t)}),Dc=b("ZodCUID2",(e,t)=>{jo.init(e,t),M.init(e,t)}),Fc=b("ZodULID",(e,t)=>{wo.init(e,t),M.init(e,t)}),Uc=b("ZodXID",(e,t)=>{ko.init(e,t),M.init(e,t)}),Gc=b("ZodKSUID",(e,t)=>{_o.init(e,t),M.init(e,t)}),Hc=b("ZodIPv4",(e,t)=>{$o.init(e,t),M.init(e,t)}),Bc=b("ZodIPv6",(e,t)=>{Eo.init(e,t),M.init(e,t)}),Vc=b("ZodCIDRv4",(e,t)=>{Oo.init(e,t),M.init(e,t)}),Jc=b("ZodCIDRv6",(e,t)=>{Ao.init(e,t),M.init(e,t)}),Wc=b("ZodBase64",(e,t)=>{To.init(e,t),M.init(e,t)}),Kc=b("ZodBase64URL",(e,t)=>{Po.init(e,t),M.init(e,t)}),qc=b("ZodE164",(e,t)=>{Ro.init(e,t),M.init(e,t)}),Yc=b("ZodJWT",(e,t)=>{Mo.init(e,t),M.init(e,t)}),Qc=b("ZodUnknown",(e,t)=>{Lo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Qa()});function Cn(){return Oa(Qc)}const Xc=b("ZodNever",(e,t)=>{Do.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ya(e,n,r)});function el(e){return Aa(Xc,e)}const tl=b("ZodArray",(e,t)=>{Fo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>nc(e,n,r,i),e.element=t.element,ft(e,"ZodArray",{min(n,r){return this.check(rt(n,r))},nonempty(n){return this.check(rt(1,n))},max(n,r){return this.check(js(n,r))},length(n,r){return this.check(ws(n,r))},unwrap(){return this.element}})});function nl(e,t){return Ha(tl,e,t)}const sl=b("ZodObject",(e,t)=>{Go.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>sc(e,n,r,i),E(e,"shape",()=>t.shape),ft(e,"ZodObject",{keyof(){return ll(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Cn()})},loose(){return this.clone({...this._zod.def,catchall:Cn()})},strict(){return this.clone({...this._zod.def,catchall:el()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return fi(this,n)},safeExtend(n){return pi(this,n)},merge(n){return mi(this,n)},pick(n){return di(this,n)},omit(n){return hi(this,n)},partial(...n){return gi(Cs,this,n[0])},required(...n){return bi($s,this,n[0])}})});function rl(e,t){const n={type:"object",shape:e??{},..._(t)};return new sl(n)}const il=b("ZodUnion",(e,t)=>{Ho.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>rc(e,n,r,i),e.options=t.options});function ol(e,t){return new il({type:"union",options:e,..._(t)})}const al=b("ZodIntersection",(e,t)=>{Bo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ic(e,n,r,i)});function cl(e,t){return new al({type:"intersection",left:e,right:t})}const _t=b("ZodEnum",(e,t)=>{Vo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(r,i,o)=>Xa(e,r,i),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,i)=>{const o={};for(const a of r)if(n.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new _t({...t,checks:[],..._(i),entries:o})},e.exclude=(r,i)=>{const o={...t.entries};for(const a of r)if(n.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new _t({...t,checks:[],..._(i),entries:o})}});function ll(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new _t({type:"enum",entries:n,..._(t)})}const ul=b("ZodTransform",(e,t)=>{Jo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>tc(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new os(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(Ge(o,n.value,t));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Ge(a))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(o=>(n.value=o,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function dl(e){return new ul({type:"transform",transform:e})}const Cs=b("ZodOptional",(e,t)=>{ys.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ss(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function $n(e){return new Cs({type:"optional",innerType:e})}const hl=b("ZodExactOptional",(e,t)=>{Wo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>Ss(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function fl(e){return new hl({type:"optional",innerType:e})}const pl=b("ZodNullable",(e,t)=>{Ko.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>oc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function En(e){return new pl({type:"nullable",innerType:e})}const ml=b("ZodDefault",(e,t)=>{qo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>cc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gl(e,t){return new ml({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ls(t)}})}const bl=b("ZodPrefault",(e,t)=>{Yo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>lc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function vl(e,t){return new bl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ls(t)}})}const $s=b("ZodNonOptional",(e,t)=>{Qo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ac(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function xl(e,t){return new $s({type:"nonoptional",innerType:e,..._(t)})}const yl=b("ZodCatch",(e,t)=>{Xo.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>uc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jl(e,t){return new yl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const wl=b("ZodPipe",(e,t)=>{ea.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>dc(e,n,r,i),e.in=t.in,e.out=t.out});function On(e,t){return new wl({type:"pipe",in:e,out:t})}const kl=b("ZodReadonly",(e,t)=>{ta.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>hc(e,n,r,i),e.unwrap=()=>e._zod.def.innerType});function _l(e){return new kl({type:"readonly",innerType:e})}const Nl=b("ZodCustom",(e,t)=>{na.init(e,t),U.init(e,t),e._zod.processJSONSchema=(n,r,i)=>ec(e,n)});function Sl(e,t={}){return Ba(Nl,e,t)}function zl(e,t){return Va(e,t)}const Cl=rl({name:bt().trim().min(1).max(120).regex(/^[^<>]+$/).refine(An),email:bt().trim().max(254).regex(/^[^\s<>@]+@[^\s<>@]+$/).refine(An),expectedRevision:bt().regex(/^[a-f0-9]{64}$/)});function An(e){return[...e].every(t=>t.charCodeAt(0)>=32&&t.charCodeAt(0)!==127)}function Nt(e){return{local:"Repository Git settings",global:"Global Git settings",system:"System Git settings",worktree:"Worktree Git settings",environment:"Backend environment",custom:"Custom author/committer settings",mixed:"Mixed Git settings",inferred:"Identity inferred by Git",unset:"Git identity not configured"}[e]}function $l({repository:e,open:t,onOpenChange:n}){const r=$t(),[i,o]=g.useState(null),[a,c]=g.useState(""),[l,u]=g.useState(""),[h,m]=g.useState(!1),[d,p]=g.useState(!1),[f,y]=g.useState(!1),[j,C]=g.useState(null);g.useEffect(()=>{if(!t)return;let w=!1;return p(!0),m(!1),C(null),o(null),r.fetchQuery({queryKey:W.commitAuthorship(e.id),queryFn:()=>H.commits.authorship(e.id),staleTime:0}).then(S=>{w||(o(S),c(S.author?.name??""),u(S.author?.email??""))}).catch(S=>{w||C(Tn(S))}).finally(()=>{w||p(!1)}),()=>{w=!0}},[r,t,e.id]);const Z=Cl.safeParse({name:a,email:l,expectedRevision:i?.revision}),A=async()=>{if(!(!Z.success||!i?.editable||f)){y(!0),C(null);try{const w=await H.commits.setAuthorship(e.id,Z.data);await r.cancelQueries({queryKey:W.commitAuthorship(e.id)}),r.setQueryData(W.commitAuthorship(e.id),w),n(!1),P.success({title:"Commit authorship saved",description:"Repository Git settings updated for future commits."})}catch(w){const S=Tn(w);C(S),P.error({title:"Could not save commit authorship",description:S})}finally{y(!1)}}};return s.jsx(ue,{open:t,onOpenChange:w=>{f||n(w)},children:s.jsxs(de,{className:"github-authorship-dialog",children:[s.jsx(he,{children:h?"Apply authorship to this repository":"Commit authorship"}),s.jsxs(fe,{children:[e.name," · name and email used by Git for future commits."]}),d?s.jsxs("p",{className:"github-authorship-loading",role:"status",children:[s.jsx(Y,{className:"animate-spin"}),"Reading the current Git identity…"]}):i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"github-authorship-review",children:[s.jsx("span",{children:h?"Current":"Current Git identity"}),s.jsx("strong",{children:i.author?.name||"Not configured"}),s.jsx("p",{children:i.author?.email||"No commit email configured"}),s.jsx("small",{children:Nt(i.source)}),i.committer&&(i.committer.name!==i.author?.name||i.committer.email!==i.author?.email)&&s.jsxs("p",{children:["Committer: ",i.committer.name," <",i.committer.email,">"]})]}),i.blockers.map(w=>s.jsx("p",{className:"github-settings-notice",children:w},w)),h?s.jsxs("div",{className:"github-authorship-review next",children:[s.jsx("span",{children:"New author and committer"}),s.jsx("strong",{children:a.trim()}),s.jsx("p",{children:l.trim()}),s.jsx("small",{children:"Repository Git settings"})]}):s.jsxs("form",{id:"commit-authorship-form",onSubmit:w=>{w.preventDefault(),Z.success&&i.editable&&m(!0)},children:[s.jsx("label",{htmlFor:"commit-author-name",children:"Name"}),s.jsx("input",{id:"commit-author-name",value:a,onChange:w=>c(w.target.value),autoComplete:"off",maxLength:120,disabled:!i.editable,required:!0}),s.jsx("label",{htmlFor:"commit-author-email",children:"Commit email"}),s.jsx("input",{id:"commit-author-email",type:"email",value:l,onChange:w=>u(w.target.value),autoComplete:"off",maxLength:254,disabled:!i.editable,required:!0}),s.jsx("p",{className:"github-settings-note",children:"Choose an email associated with your GitHub account, or copy its exact noreply address from GitHub Settings → Emails. It is not inferred from the account login."})]}),s.jsx("p",{className:"github-authorship-scope",children:"Applies to this repository and its worktrees, including commits from other Git tools. Only future commits change. Global Git settings, gh, SSH and commit signing are kept."})]}),j&&s.jsx("p",{className:"github-settings-notice",role:"alert",children:j}),s.jsxs("div",{className:"github-add-actions",children:[s.jsx(k,{variant:"ghost",disabled:f,onClick:()=>n(!1),children:"Cancel"}),h?s.jsxs(s.Fragment,{children:[s.jsx(k,{variant:"outline",disabled:f,onClick:()=>m(!1),children:"Back"}),s.jsxs(k,{disabled:f||!i?.editable,onClick:()=>{A()},children:[f&&s.jsx(Y,{className:"animate-spin"}),"Apply to repository"]})]}):s.jsx(k,{type:"submit",form:"commit-authorship-form",disabled:d||!i?.editable||!Z.success,children:"Review changes"})]})]})})}function Tn(e){return e instanceof Error?e.message:"Could not read Git identity."}function El(e){return e.message?e.message:e.source==="explicit"?"Explicit choice for this repository":e.source==="ssh"?"Automatic · verified SSH identity":e.source==="environment"?"Automatic · backend environment credentials":e.source==="global"?"Automatic · active GitHub CLI account":"Check status to verify the repository account."}function Ol({repository:e}){const t=$t(),n=Xe({queryKey:W.githubAccounts,queryFn:()=>H.github.accountsStatus(!1),staleTime:1/0}),r=Xe({queryKey:W.githubAccount(e?.id??""),queryFn:()=>H.github.repositoryAccount(e.id,!1),enabled:e!==null,staleTime:1/0}),i=Xe({queryKey:W.commitAuthorship(e?.id??""),queryFn:()=>H.commits.authorship(e.id),enabled:e!==null}),[o,a]=g.useState(!1),[c,l]=g.useState(!1),[u,h]=g.useState(!1),[m,d]=g.useState(!1);g.useEffect(()=>{d(!1)},[e?.id]),g.useEffect(()=>H.events.onRepositoryChanged((x,T)=>{x===e?.id&&T==="unknown"&&t.invalidateQueries({queryKey:W.commitAuthorship(x)})}),[t,e?.id]);const p=n.data,f=r.data,y=i.data,j=f?.selection.mode==="account"?f.selection.login:"auto",C=p?.accounts??[],Z=C.map(x=>({value:x.login,label:`@${x.login}`,description:`${x.state==="authenticated"?"Authenticated":x.state==="invalid"?"Credentials rejected":"Not verified"}${x.active?" · active in gh":""}`,icon:s.jsx(Le,{})}));j!=="auto"&&!Z.some(x=>x.value===j)&&Z.push({value:j,label:`@${j}`,description:"Not in the last checked accounts",icon:s.jsx(Le,{})});const A=async()=>{a(!0);try{const x=await H.github.accountsStatus(!0);if(t.setQueryData(W.githubAccounts,x),e){const T=await H.github.repositoryAccount(e.id,!0);t.setQueryData(W.githubAccount(e.id),T),await t.invalidateQueries({queryKey:W.commitAuthorship(e.id)})}}catch(x){P.error({title:"Could not check GitHub",description:Ee(x)})}finally{a(!1)}},w=async x=>{if(!e||c)return;l(!0);const T=x==="auto"?{mode:"auto"}:{mode:"account",host:"github.com",login:x};try{await H.github.setRepositoryAccount(e.id,T);const z=await H.github.repositoryAccount(e.id,!0);t.setQueryData(W.githubAccount(e.id),z)}catch(z){P.error({title:"Could not save GitHub account",description:Ee(z)})}finally{l(!1)}},S=f?.state==="ready"&&f.login?`@${f.login}`:f?.state==="error"?f.login?`@${f.login} unavailable`:"Choose or verify an account":f?.nameWithOwner?"Not verified yet":e?"No GitHub remote":"No repository open";return s.jsxs("div",{className:"github-settings",children:[e&&s.jsxs("section",{className:"github-repository-summary","aria-label":"Current repository identities",children:[s.jsx("span",{className:"github-settings-eyebrow",children:"Current repository"}),s.jsxs("h2",{children:[s.jsx(ur,{}),f?.nameWithOwner||e.name]}),s.jsxs("div",{className:"github-identity-summary",children:[s.jsxs("div",{className:`github-effective-account ${f?.state??"unchecked"}`,children:[s.jsx("span",{children:"GitHub account"}),s.jsx("strong",{children:S}),s.jsx("p",{children:f?El(f):"Reading saved repository selection…"})]}),s.jsxs("div",{className:"github-author-summary",children:[s.jsx("span",{children:"Author of the next commit"}),s.jsx("strong",{children:y?.author?.name||(i.isPending?"Reading Git identity…":y?"Not configured":"Could not read Git identity")}),y?.author?.email&&s.jsx("p",{children:y.author.email}),y&&s.jsx("small",{children:Nt(y.source)})]})]})]}),s.jsxs("section",{className:"github-settings-section",children:[s.jsx("div",{className:"github-settings-row",children:s.jsx("h3",{children:"Account for this repository"})}),e?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"github-account-picker",children:[s.jsx("label",{className:"sr-only",htmlFor:"github-account-choice",children:"Account for GitHub operations"}),s.jsx(Kn,{groups:[{id:"automatic",label:"",items:[{value:"auto",label:"Automatic",description:"Verified SSH identity, or active gh credentials for HTTPS",pinned:!0,icon:s.jsx(Le,{})}]},{id:"accounts",label:"Saved accounts",items:Z}],value:j,onValueChange:x=>{w(x)},label:"GitHub account for this repository",triggerId:"github-account-choice",triggerLabel:j==="auto"?"Automatic":`@${j}`,placeholder:"Search accounts…",size:"default",align:"start",disabled:c||!f?.nameWithOwner})]}),f?.nameWithOwner?s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"github-settings-note",children:"The same account reads and creates PRs. Your Git/SSH authentication and commit author stay independent."}),s.jsxs("p",{className:"github-selection-saved",children:[s.jsx(qn,{}),c?"Saving and verifying…":"Selection saved · shared across worktrees"]})]}):s.jsx("p",{className:"github-settings-note",children:"The origin remote must point to github.com to select a GitHub account. You can still edit the Git commit identity below."}),f?.state==="error"&&s.jsx("p",{className:"github-settings-notice",role:"status",children:f.message||"The selected account is unavailable. Check status or choose another saved account."})]}):s.jsx("p",{className:"github-settings-note",children:"Open a repository to choose its GitHub account and review its commit authorship."}),s.jsxs("p",{className:"github-global-account",children:["Active globally in gh: ",s.jsx("strong",{children:p?.activeLogin?`@${p.activeLogin}`:"Not verified"})]}),p?.environment.present&&s.jsxs("p",{className:"github-settings-notice",children:["Backend environment credentials: ",p.environment.login?`@${p.environment.login}`:"identity not verified",". They override the global gh account in Automatic mode for HTTPS; explicit and verified SSH accounts keep their saved credentials."]}),r.error&&s.jsx("p",{className:"github-settings-notice",role:"alert",children:Ee(r.error)})]}),e&&s.jsxs("section",{className:"github-settings-section",children:[s.jsxs("div",{className:"github-settings-row",children:[s.jsx("h3",{children:"Commit authorship"}),s.jsx(k,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:i.isPending||!y,children:"Edit authorship"})]}),s.jsxs("div",{className:"github-authorship-card",children:[s.jsx(oi,{}),s.jsxs("div",{children:[s.jsx("strong",{children:y?.author?.name||"Not configured"}),s.jsx("p",{children:y?.author?.email||"Set a name and email before creating commits."}),y&&s.jsxs("small",{children:[Nt(y.source)," · independent of gh"]}),y?.committer&&(y.committer.name!==y.author?.name||y.committer.email!==y.author?.email)&&s.jsxs("p",{className:"github-authorship-committer",children:["Committer: ",y.committer.name," <",y.committer.email,">"]})]})]}),y?.blockers.map(x=>s.jsx("p",{className:"github-settings-notice",children:x},x)),i.error&&s.jsx("p",{className:"github-settings-notice",role:"alert",children:Ee(i.error)}),s.jsx("p",{className:"github-settings-note",children:"Edit the effective Git name and email explicitly. Changing the GitHub account never changes authorship automatically."})]}),s.jsxs("section",{className:"github-settings-section github-accounts-section",children:[s.jsxs("div",{className:"github-settings-row",children:[s.jsx("h3",{children:"Available accounts"}),s.jsxs(k,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[s.jsx(dr,{}),"Add account"]})]}),s.jsx("div",{className:"github-accounts-list",children:C.map(x=>s.jsxs("div",{className:"github-account-row",children:[s.jsx("span",{className:"github-account-avatar","aria-hidden":"true",children:x.login.slice(0,2).toUpperCase()}),s.jsxs("div",{className:"github-account-copy",children:[s.jsxs("strong",{children:["@",x.login]}),s.jsx("small",{children:x.active?"Active in gh · global":"Saved in GitHub CLI"})]}),s.jsxs("div",{className:"github-account-badges",children:[f?.state==="ready"&&f.login?.toLowerCase()===x.login.toLowerCase()&&s.jsx(ve,{variant:"secondary",children:"This repository"}),s.jsx("span",{className:`github-auth-state ${x.state}`,children:x.state==="authenticated"?"Authenticated":x.state==="invalid"?"Credentials rejected":"Not verified"})]})]},x.login))}),!C.length&&s.jsx("p",{className:"github-settings-note",children:p?.checkedAt?"No saved accounts were available in the last check. Add an account on the backend host and check again.":"Check status to list the accounts saved in GitHub CLI."})]}),s.jsxs("section",{className:"github-cli-section",children:[s.jsxs("div",{className:"github-settings-row",children:[s.jsxs("div",{children:[s.jsxs("strong",{className:"github-cli-version",children:[s.jsx(Le,{}),p?.version||"GitHub CLI",s.jsx(ve,{variant:"outline",children:Tl(p)})]}),s.jsx("p",{className:"github-settings-note",children:p?.checkedAt?`Last checked: ${Te(p.checkedAt,{seconds:!0})}`:"Status has not been checked yet."})]}),s.jsxs(k,{variant:"outline",size:"sm",onClick:()=>{A()},disabled:o||n.isFetching,children:[o?s.jsx(Y,{className:"animate-spin"}):s.jsx(Ie,{}),o?s.jsx(at,{text:"Checking…"}):"Check status"]})]}),s.jsx("p",{className:"github-settings-note",children:"Saved results are reused. Opening Settings does not check GitHub."}),p?.message&&s.jsx("p",{className:"github-settings-notice",role:"status",children:p.message}),n.error&&s.jsx("p",{className:"github-settings-notice",role:"alert",children:Ee(n.error)})]}),e&&s.jsx($l,{repository:e,open:m,onOpenChange:d},e.id),s.jsx(Al,{open:u,onOpenChange:h,status:p,onCheck:A,checking:o})]})}function Al({open:e,onOpenChange:t,status:n,onCheck:r,checking:i}){const[o,a]=g.useState(0),[c,l]=g.useState(null),[u,h]=g.useState([]),m=n?.accounts.filter(f=>!u.includes(f.login))??[],d=async f=>{try{await jt(f),P.success({title:"Command copied"})}catch(y){P.error({title:"Could not copy command",description:Ee(y)})}},p=f=>{f||a(0),t(f)};return s.jsx(ue,{open:e,onOpenChange:p,children:s.jsxs(de,{className:"github-add-dialog",children:[s.jsx(he,{children:o===2?"Check the updated accounts":"Add a GitHub account"}),s.jsx(fe,{children:"Use the official GitHub CLI browser login on the machine running OpenTig."}),s.jsx("div",{className:"github-add-steps","aria-label":`Step ${o+1} of 3`,children:[0,1,2].map(f=>s.jsx("span",{className:f<=o?"active":""},f))}),o===0?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"Your saved accounts are kept. There is no need to log out first."}),s.jsxs("p",{className:"github-settings-notice",children:[s.jsx("strong",{children:"GitHub CLI activates the account you add."})," This can affect other terminals and HTTPS repositories using Automatic. OpenTig will not switch the global account back automatically."]}),s.jsx("p",{children:"Keep Git credential setup and SSH key management unchanged during login. Your account selection in OpenTig is saved separately."})]}):o===1?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"github-login-command",children:[s.jsx("code",{children:"gh auth login --hostname github.com --web --skip-ssh-key"}),s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Copy GitHub login command",onClick:()=>{d("gh auth login --hostname github.com --web --skip-ssh-key")},children:s.jsx(tt,{})})]}),s.jsxs("ol",{children:[s.jsx("li",{children:"Run the command in a terminal on the backend host."}),s.jsxs("li",{children:["Keep your existing Git protocol. If gh offers to authenticate Git, answer ",s.jsx("strong",{children:"No"}),". Skip creating or uploading SSH keys."]}),s.jsx("li",{children:"Verify the intended account in your browser before authorising GitHub CLI."}),s.jsx("li",{children:"Return here and check the accounts. If backend token environment variables prevent login, manage them in that terminal; OpenTig does not edit them."})]}),c&&s.jsxs("p",{className:"github-settings-note",children:["Previously checked active account: @",c,"."]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{children:m.length?`Newly detected accounts: ${m.map(f=>`@${f.login}`).join(", ")}.`:"No new saved account was detected. You can check again after finishing the login."}),s.jsxs("p",{className:"github-settings-notice",children:["Last checked active account: ",n?.activeLogin?`@${n.activeLogin}`:"not available",". Existing accounts and explicit repository selections are preserved."]}),c&&c!==n?.activeLogin&&s.jsxs(s.Fragment,{children:[s.jsx("p",{children:"To restore the previous global account, run this command voluntarily in your terminal:"}),s.jsxs("div",{className:"github-login-command",children:[s.jsxs("code",{children:["gh auth switch --hostname github.com --user ",c]}),s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Copy restore global account command",onClick:()=>{d(`gh auth switch --hostname github.com --user ${c}`)},children:s.jsx(tt,{})})]})]}),s.jsx("p",{className:"github-settings-note",children:"These commands are only copied. OpenTig never executes login, logout or account switching."})]}),s.jsxs("div",{className:"github-add-actions",children:[s.jsx(k,{variant:"ghost",onClick:()=>p(!1),children:o===2?"Done":"Cancel"}),o===0?s.jsx(k,{onClick:()=>{l(n?.activeLogin??null),h(n?.accounts.map(f=>f.login)??[]),a(1)},children:"View instructions"}):s.jsxs(k,{onClick:()=>{r().then(()=>a(2))},disabled:i,children:[i&&s.jsx(Y,{className:"animate-spin"}),o===1?"I have finished · check accounts":"Check again"]})]})]})})}function Tl(e){switch(e?.installationStatus){case"available":return"Available";case"not-found":return"Not installed";case"not-executable":return"Cannot run";case"incompatible":return"Update required";case"inspection-failed":return"Check failed";default:return"Not checked"}}function Ee(e){return e instanceof Error?e.message:"The request could not be completed."}function Il({className:e,...t}){return s.jsx(kr,{"data-slot":"accordion",className:ie("w-full overflow-hidden rounded-xl border border-border",e),...t})}function Pl({className:e,...t}){return s.jsx(_r,{"data-slot":"accordion-item",className:ie("not-last:border-b",e),...t})}function Rl({className:e,children:t,...n}){return s.jsx(Nr,{className:"flex",children:s.jsxs(Sr,{"data-slot":"accordion-trigger",className:ie("group flex flex-1 items-center justify-between gap-4 rounded-lg p-4 text-left text-xs font-semibold outline-none transition-colors hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring aria-disabled:pointer-events-none aria-disabled:opacity-50",e),...n,children:[t,s.jsx(hr,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-transform group-aria-expanded:rotate-180 motion-reduce:transition-none"})]})})}function Zl({className:e,children:t,...n}){return s.jsx(zr,{"data-slot":"accordion-content",className:"accordion-content",...n,children:s.jsx("div",{className:ie("px-4 pb-4",e),children:t})})}function Ml({harness:e,preferences:t,status:n,onPreference:r}){const i=t.aiExecutablePaths[e]??"",[o,a]=g.useState(i),[c,l]=g.useState(!1),u=async h=>{l(!0);try{await r({aiExecutablePaths:{...t.aiExecutablePaths,[e]:h}})!==!1&&a(h)}finally{l(!1)}};return s.jsx(Il,{className:"ai-executable-settings",children:s.jsxs(Pl,{value:"cli-detection",children:[s.jsx(Rl,{className:"ai-executable-trigger",children:s.jsxs("span",{className:"ai-executable-heading",children:[s.jsx(Rr,{"aria-hidden":"true"}),s.jsxs("span",{children:[s.jsx("strong",{children:"Advanced CLI detection"}),s.jsx("small",{children:"Executable path and diagnostics"})]})]})}),s.jsx(Zl,{className:"ai-executable-content",children:s.jsxs("div",{className:"settings-field",children:[s.jsxs("label",{className:"settings-field-label",htmlFor:"ai-executable-path",children:[s.jsxs("strong",{children:[$e(e)," executable"]}),s.jsx("span",{children:"Leave on Automatic, or enter an absolute executable path without arguments. For web access, use a path on the server."})]}),s.jsxs("div",{className:"ai-executable-editor",children:[s.jsx("input",{className:"ai-executable-input",id:"ai-executable-path",value:o,onChange:h=>a(h.target.value),placeholder:"Automatic",maxLength:4096,spellCheck:!1,autoComplete:"off",disabled:c}),s.jsxs("div",{className:"ai-executable-actions",children:[s.jsx(k,{size:"sm",onClick:()=>{u(o)},disabled:c||o===i,children:"Save path"}),s.jsx(k,{size:"sm",variant:"outline",onClick:()=>{u("")},disabled:c||!i&&!o,children:"Reset to Automatic"})]})]}),n?.executablePath&&s.jsxs("div",{className:"ai-executable-diagnostic",children:[s.jsx("strong",{children:"Detected executable"}),s.jsx("code",{children:n.executablePath}),s.jsxs("span",{children:["Source: ",Ll(n.executableSource)]})]}),n?.discoveryWarning&&s.jsx("p",{className:"ai-login-hint",children:n.discoveryWarning})]})})]})})}function Ll(e){return e==="configured"?"Configured path":e==="process-path"?"Inherited PATH":e==="user-path"?"Refreshed user PATH":"Known installation location"}function Dl(e){return JSON.stringify(["codex","claude","opencode","grok"].map(t=>e[t]??""))}function Es({className:e,...t}){return s.jsx("div",{"data-slot":"table-container",className:"relative w-full",children:s.jsx("table",{"data-slot":"table",className:ie("w-full caption-bottom text-xs",e),...t})})}function Os({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:ie("[&_tr]:border-b",e),...t})}function As({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:ie("[&_tr:last-child]:border-0",e),...t})}function ot({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:ie("border-b border-border transition-colors hover:bg-muted/40 data-[state=selected]:bg-muted",e),...t})}function Ts({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:ie("h-8 whitespace-nowrap px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function Is({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:ie("px-2 py-1.5 align-middle [&:has([role=checkbox])]:pr-0",e),...t})}const Fl={"commit-message":"commit message","pull-request-draft":"pull request draft"};function ge({column:e,label:t}){const n=e.getIsSorted();return s.jsxs("button",{type:"button",className:"ai-log-sort-button",onClick:()=>e.toggleSorting(n==="asc"),children:[t,n==="asc"&&s.jsx(ns,{size:13}),n==="desc"&&s.jsx(ss,{size:13}),!n&&s.jsx(ts,{size:13,className:"ai-log-sort-idle"})]})}const Ul=Gn({rowSortingFeature:Bn,sortedRowModel:Vn()}),re=Hn(),Gl=re.columns([re.accessor("status",{header:({column:e})=>s.jsx(ge,{column:e,label:"Status"}),cell:({getValue:e})=>{const t=e();return s.jsx(ve,{variant:t==="success"?"secondary":t==="cancelled"?"outline":"destructive",children:t})}}),re.accessor("harness",{header:({column:e})=>s.jsx(ge,{column:e,label:"Harness"}),cell:({getValue:e})=>s.jsx("strong",{children:e()})}),re.accessor("model",{header:({column:e})=>s.jsx(ge,{column:e,label:"Model"}),cell:({getValue:e})=>s.jsx("span",{className:"ai-log-model",children:e()})}),re.accessor("operation",{header:({column:e})=>s.jsx(ge,{column:e,label:"Task"}),cell:({getValue:e})=>Fl[e()]}),re.accessor(e=>new Date(e.at).getTime(),{id:"at",header:({column:e})=>s.jsx(ge,{column:e,label:"Date"}),cell:({row:e})=>s.jsx("time",{dateTime:e.original.at,children:Te(e.original.at,{seconds:!0})})}),re.accessor("durationMs",{header:({column:e})=>s.jsx(ge,{column:e,label:"Duration"}),cell:({getValue:e})=>`${(e()/1e3).toFixed(1)}s`}),re.accessor(e=>(e.usage.inputTokens??0)+(e.usage.outputTokens??0),{id:"usage",header:({column:e})=>s.jsx(ge,{column:e,label:"Usage"}),cell:({row:e})=>Vl(e.original)}),re.accessor("stagedFileCount",{header:({column:e})=>s.jsx(ge,{column:e,label:"Staged"}),cell:({getValue:e})=>e()??"—"}),re.display({id:"notes",header:"Notes",cell:({row:e})=>{const t=e.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:s.jsx("div",{className:"ai-log-row-notes",children:n.map(r=>s.jsx(Bl,{text:r.text,tone:r.tone,detail:r.detail},r.key))})}})]);function Hl({open:e,onOpenChange:t}){const[n,r]=g.useState([]),[i,o]=g.useState(!1),[a,c]=g.useState([]),l=g.useCallback(async()=>{o(!0);try{r(await H.ai.log())}catch(d){P.error({title:"Could not read the AI history",description:Pn(d)})}finally{o(!1)}},[]);g.useEffect(()=>{e&&l()},[l,e]);const u=g.useMemo(()=>{const d=n.filter(p=>p.status==="failed").length;return{runs:n.length,failed:d,tokens:n.reduce((p,f)=>p+(f.usage.inputTokens??0)+(f.usage.outputTokens??0),0),cost:n.reduce((p,f)=>p+(f.usage.costUsd??0),0),costed:n.filter(p=>p.usage.costUsd!==null).length}},[n]),h=Un({features:Ul,data:n,columns:Gl,onSortingChange:c,state:{sorting:a}}),m=async()=>{if(window.confirm("Delete the whole AI history? This cannot be undone."))try{await H.ai.clearLog(),r([])}catch(d){P.error({title:"Could not clear the AI history",description:Pn(d)})}};return s.jsx(ue,{open:e,onOpenChange:t,children:s.jsxs(de,{className:"ai-log-dialog",children:[s.jsxs("header",{className:"ai-log-header",children:[s.jsxs("div",{children:[s.jsx(he,{children:"AI history"}),s.jsx(fe,{children:"Recent generations on this machine. Prompts and file contents are never recorded."})]}),s.jsxs("div",{className:"ai-log-header-actions",children:[s.jsxs(k,{variant:"outline",size:"sm",disabled:i,onClick:()=>{l()},children:[i?s.jsx(Y,{className:"animate-spin"}):s.jsx(Ie,{})," Refresh"]}),s.jsxs(k,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[s.jsx(Et,{})," Clear"]}),s.jsx(_e,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Close AI history"}),children:s.jsx(ct,{})})]})]}),n.length>0&&s.jsxs("div",{className:"ai-log-totals",children:[s.jsxs("span",{children:[s.jsx("strong",{children:u.runs})," runs"]}),s.jsxs("span",{children:[s.jsx("strong",{children:u.failed})," failed"]}),s.jsxs("span",{children:[s.jsx("strong",{children:St(u.tokens)})," tokens"]}),u.costed>0&&s.jsxs("span",{children:[s.jsxs("strong",{children:["$",u.cost.toFixed(4)]})," reported by ",u.costed," of ",u.runs]})]}),s.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&s.jsxs("div",{className:"view-loading",role:"status",children:[s.jsx(Y,{className:"spinner"})," ",s.jsx(at,{text:"Reading history…"})]}),!i&&n.length===0&&s.jsx("p",{className:"ai-log-empty",children:"No generations recorded yet. Generate a commit message and it will show up here."}),n.length>0&&s.jsx("div",{className:"ai-log-table-wrap",children:s.jsxs(Es,{children:[s.jsx(Os,{children:h.getHeaderGroups().map(d=>s.jsx(ot,{children:d.headers.map(p=>s.jsx(Ts,{children:p.isPlaceholder?null:s.jsx(h.FlexRender,{header:p})},p.id))},d.id))}),s.jsx(As,{children:h.getRowModel().rows.map(d=>s.jsx(ot,{className:d.original.status==="failed"?"ai-log-row-failed":void 0,children:d.getAllCells().map(p=>s.jsx(Is,{children:s.jsx(h.FlexRender,{cell:p})},p.id))},d.id))})]})})]})]})})}const In=140;function Bl({text:e,tone:t,detail:n}){const[r,i]=g.useState(!1),o=e.length>In?`${e.slice(0,In-1)}…`:e,a=`ai-log-note ${t??""}`;return n?s.jsxs(s.Fragment,{children:[s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx("button",{type:"button",className:a,onClick:()=>i(!0),"aria-label":"Read generation details"}),children:o}),s.jsx(se,{className:"max-w-md",children:n})]}),s.jsx(ue,{open:r,onOpenChange:i,children:s.jsx(de,{className:"name-dialog",children:s.jsxs("div",{className:"name-dialog-content",children:[s.jsx(he,{children:"Generation details"}),s.jsx(fe,{className:"whitespace-pre-wrap break-words",children:n}),s.jsx("div",{className:"name-dialog-actions",children:s.jsx(_e,{render:s.jsx(k,{variant:"outline"}),children:"Close"})})]})})})]}):s.jsx("span",{className:a,children:o})}function Vl(e){const{inputTokens:t,outputTokens:n,costUsd:r}=e.usage;if(t===null&&n===null)return"no usage reported";const i=`${St(t??0)} in · ${St(n??0)} out`;return r===null?i:`${i} · $${r.toFixed(4)}`}function St(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Pn(e){return e instanceof Error?e.message:"An unexpected error occurred."}const Jl=[{value:"system",label:"System",icon:Yn},{value:"light",label:"Light",icon:is},{value:"dark",label:"Dark",icon:Jr}],Wl=[{value:"tree",label:"Tree",icon:fr},{value:"list",label:"List",icon:Br}],Kl=[{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"}],ql=[{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"}],vt=[0,15,30,60,120,300];function be({label:e,description:t,children:n,toggle:r=!1}){return s.jsxs("div",{className:`settings-general-row${r?" settings-general-toggle":""}`,children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:e}),s.jsx("span",{children:t})]}),s.jsx("div",{className:"settings-general-control",children:n})]})}function Rn({label:e,options:t,value:n,onChange:r}){return s.jsx("div",{className:"settings-theme-options",role:"radiogroup","aria-label":e,children:t.map(({value:i,label:o,icon:a},c)=>s.jsxs("button",{type:"button",role:"radio","aria-checked":n===i,tabIndex:n===i?0:-1,className:`settings-theme-option${n===i?" active":""}`,onClick:()=>r(i),onKeyDown:l=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(l.key))return;l.preventDefault();const u=l.key==="Home"?0:l.key==="End"?t.length-1:(c+(["ArrowLeft","ArrowUp"].includes(l.key)?-1:1)+t.length)%t.length,h=t[u];h&&(r(h.value),l.currentTarget.parentElement?.querySelectorAll("button")[u]?.focus())},children:[s.jsx(a,{"aria-hidden":"true"}),s.jsx("span",{children:o})]},i))})}function Zn({label:e,options:t,value:n,onChange:r}){const i=t.find(o=>o.value===n);return s.jsxs(Ot,{value:n,onValueChange:o=>{const a=t.find(c=>c.value===o);a&&r(a.value)},children:[s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(At,{className:"settings-general-select w-[220px] text-[11px] font-normal","aria-label":e,style:{fontFamily:i?.family}}),children:s.jsx(Tt,{children:i?.label??n})}),s.jsx(se,{children:i?.label})]}),s.jsx(It,{align:"end",alignItemWithTrigger:!1,className:"settings-general-font-menu min-w-[14rem]",children:t.map(o=>s.jsx(Fe,{value:o.value,className:"min-h-8 text-xs font-normal",children:s.jsx("span",{style:{fontFamily:o.family},children:o.label})},o.value))})]})}function xt(e){return e===0?"Off":e>=60&&e%60===0?`${e/60} ${e===60?"minute":"minutes"}`:`${e} seconds`}function Yl({preferences:e,onPreference:t}){const n=g.useId(),r=g.useRef(null),[i,o]=g.useState(null),[a,c]=g.useState(!1),[l,u]=g.useState(!1),[h,m]=g.useState(!1),d=e.remoteFetchIntervalSeconds,p=()=>{o(null),c(!1),r.current?.focus()};return s.jsxs("div",{className:"settings-general",children:[s.jsxs("div",{className:"settings-general-content",children:[s.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-appearance`,children:[s.jsxs("h3",{id:`${n}-appearance`,children:[s.jsx(is,{"aria-hidden":"true"}),"Appearance"]}),s.jsx(be,{label:"Theme",description:"Follow your system or choose a theme.",children:s.jsx(Rn,{label:"Theme",options:Jl,value:e.theme,onChange:f=>t({theme:f})})}),s.jsx(be,{label:"Interface font",description:"Menus, labels and navigation.",children:s.jsx(Zn,{label:"Interface font",options:Kl,value:e.uiFont,onChange:f=>t({uiFont:f})})}),s.jsx(be,{label:"Code font",description:"Code, diffs and the file viewer.",children:s.jsx(Zn,{label:"Code font",options:ql,value:e.monoFont,onChange:f=>t({monoFont:f})})}),s.jsx(be,{label:"Interface size",description:"Scale text, icons and controls.",children:s.jsxs("div",{className:"settings-zoom-control",children:[s.jsx("input",{type:"range",min:"80",max:"130",step:"10",value:e.uiZoom,onChange:f=>t({uiZoom:Number(f.target.value)}),"aria-label":"Interface zoom"}),s.jsxs("output",{"aria-live":"off",children:[e.uiZoom,"%"]})]})}),h&&s.jsxs("div",{id:`${n}-preview`,className:"settings-general-preview",children:[s.jsxs("span",{children:[s.jsx(en,{"aria-hidden":"true"}),"src / components / Button.tsx"]}),s.jsxs("code",{children:[s.jsx("span",{children:"const"})," changes = files.filter(isModified);"]})]})]}),s.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-files`,children:[s.jsxs("h3",{id:`${n}-files`,children:[s.jsx(en,{"aria-hidden":"true"}),"Files & viewer"]}),s.jsx(be,{label:"Changes layout",description:"Folders or a flat list.",children:s.jsx(Rn,{label:"Changes layout",options:Wl,value:e.changesLayout,onChange:f=>t({changesLayout:f})})}),s.jsxs(be,{label:"Wrap long lines",description:"Fit lines to the viewer width.",toggle:!0,children:[s.jsx("span",{className:"settings-general-switch-state","aria-hidden":"true",children:e.wrapLines?"On":"Off"}),s.jsx("button",{type:"button",role:"switch","aria-label":"Wrap long lines","aria-checked":e.wrapLines,className:"settings-switch",onClick:()=>t({wrapLines:!e.wrapLines}),children:s.jsx("span",{})})]}),s.jsxs(be,{label:"Show ignored files",description:s.jsxs(s.Fragment,{children:["Include files excluded by ",s.jsx("code",{children:".gitignore"}),"."]}),toggle:!0,children:[s.jsx("span",{className:"settings-general-switch-state","aria-hidden":"true",children:e.showDotEnvFiles?"On":"Off"}),s.jsx("button",{type:"button",role:"switch","aria-label":"Show ignored files","aria-checked":e.showDotEnvFiles,className:"settings-switch",onClick:()=>t({showDotEnvFiles:!e.showDotEnvFiles}),children:s.jsx("span",{})})]})]}),s.jsxs("section",{className:"settings-general-group","aria-labelledby":`${n}-sync`,children:[s.jsxs("h3",{id:`${n}-sync`,children:[s.jsx(Ie,{"aria-hidden":"true"}),"Repository sync"]}),s.jsx(be,{label:"Remote check interval",description:"Keep ahead / behind counts current.",children:s.jsxs(Ot,{value:String(d),onValueChange:f=>{c(!1),f==="custom"?o(String(d||30)):f!==null&&vt.includes(Number(f))&&(o(null),t({remoteFetchIntervalSeconds:Number(f)}))},children:[s.jsx(At,{ref:r,className:"settings-general-select settings-general-interval w-[174px] text-[11px] font-normal","aria-label":"Remote check interval",children:s.jsx(Tt,{children:xt(d)})}),s.jsxs(It,{align:"end",alignItemWithTrigger:!1,className:"min-w-[14rem]",children:[vt.map(f=>s.jsxs(Fe,{value:String(f),className:"min-h-8 text-xs font-normal",children:[xt(f),f===30&&s.jsx("small",{className:"settings-general-option-note",children:"Default"})]},f)),!vt.includes(d)&&s.jsxs(Fe,{value:String(d),className:"min-h-8 text-xs font-normal",children:[xt(d),s.jsx("small",{className:"settings-general-option-note",children:"Custom"})]}),s.jsxs(Fe,{value:"custom",className:"min-h-8 text-xs font-normal",children:["Custom…",s.jsx("small",{className:"settings-general-option-note",children:"5–300 seconds"})]})]})]})}),s.jsxs("div",{className:"settings-general-help",children:[s.jsx("span",{children:d===0?"Periodic fetch is off.":`Checks every ${d} seconds.`}),s.jsx("button",{type:"button","aria-expanded":l,"aria-controls":`${n}-interval-help`,onClick:()=>u(!l),children:"What does Off do?"})]}),l&&s.jsx("p",{id:`${n}-interval-help`,className:"settings-general-help-detail",children:"Off disables periodic fetch. Remote checks still run when you pull or push."}),i!==null&&s.jsxs("form",{className:"settings-general-custom",noValidate:!0,onSubmit:f=>{f.preventDefault();const y=Number(i);if(!Number.isFinite(y)||y<sn||y>nn||y%tn!==0){c(!0);return}t({remoteFetchIntervalSeconds:y}),p()},children:[s.jsxs("div",{className:"settings-general-custom-controls",children:[s.jsx("label",{htmlFor:`${n}-custom-interval`,children:"Every"}),s.jsx("input",{id:`${n}-custom-interval`,type:"number",min:sn,max:nn,step:tn,required:!0,autoFocus:!0,value:i,"aria-label":"Custom interval in seconds","aria-invalid":a,"aria-describedby":`${n}-interval-range`,onChange:f=>{o(f.target.value),c(!1)},onKeyDown:f=>{f.key==="Escape"&&(f.preventDefault(),f.stopPropagation(),p())}}),s.jsx("span",{children:"seconds"}),s.jsx(k,{type:"submit",variant:"outline",size:"sm",children:"Apply"}),s.jsx(k,{type:"button",variant:"ghost",size:"sm",onClick:p,children:"Cancel"})]}),s.jsx("p",{id:`${n}-interval-range`,className:a?"settings-general-error":"settings-general-help-detail",role:a?"alert":void 0,children:"Choose 5–300 seconds, in steps of 5."})]})]})]}),s.jsxs("footer",{className:"settings-general-footer",children:[s.jsxs("span",{children:[s.jsx(qn,{"aria-hidden":"true"}),"Changes apply immediately"]}),s.jsxs("button",{type:"button","aria-expanded":h,"aria-controls":`${n}-preview`,onClick:()=>m(!h),children:[s.jsx(ri,{"aria-hidden":"true"}),"Text preview"]})]})]})}function Ze({column:e,label:t}){const n=e.getIsSorted();return s.jsxs("button",{type:"button",className:"ai-log-sort-button",onClick:()=>e.toggleSorting(n==="asc"),children:[t,n==="asc"&&s.jsx(ns,{size:13}),n==="desc"&&s.jsx(ss,{size:13}),!n&&s.jsx(ts,{size:13,className:"ai-log-sort-idle"})]})}const Ql=Gn({rowSortingFeature:Bn,sortedRowModel:Vn()}),Ce=Hn(),Xl=Ce.columns([Ce.accessor("level",{header:({column:e})=>s.jsx(Ze,{column:e,label:"Level"}),cell:({getValue:e})=>{const t=e();return s.jsx(ve,{variant:t==="warn"?"outline":"destructive",children:t})}}),Ce.accessor("operation",{header:({column:e})=>s.jsx(Ze,{column:e,label:"Operation"}),cell:({getValue:e})=>s.jsx("strong",{children:e()})}),Ce.accessor("code",{header:({column:e})=>s.jsx(Ze,{column:e,label:"Code"}),cell:({getValue:e})=>e()??"—"}),Ce.accessor(e=>new Date(e.at).getTime(),{id:"at",header:({column:e})=>s.jsx(Ze,{column:e,label:"Date"}),cell:({row:e})=>s.jsx("time",{dateTime:e.original.at,children:Te(e.original.at,{seconds:!0})})}),Ce.accessor("message",{header:({column:e})=>s.jsx(Ze,{column:e,label:"Message"}),cell:({getValue:e})=>s.jsx("span",{className:"ai-log-model",children:e()})})]);function Mn(e){return e instanceof Error?e.message:"An unexpected error occurred."}function eu({open:e,onOpenChange:t}){const[n,r]=g.useState([]),[i,o]=g.useState(!1),[a,c]=g.useState([]),l=g.useCallback(async()=>{o(!0);try{r(await H.diagnostics.list())}catch(d){P.error({title:"Could not read local problems",description:Mn(d)})}finally{o(!1)}},[]);g.useEffect(()=>{e&&l()},[l,e]);const u=g.useMemo(()=>({all:n.length,errors:n.filter(d=>d.level==="error").length}),[n]),h=Un({features:Ql,data:n,columns:Xl,onSortingChange:c,state:{sorting:a}}),m=async()=>{if(window.confirm("Delete the local problem history? This cannot be undone."))try{await H.diagnostics.clear(),r([])}catch(d){P.error({title:"Could not clear local problems",description:Mn(d)})}};return s.jsx(ue,{open:e,onOpenChange:t,children:s.jsxs(de,{className:"ai-log-dialog",children:[s.jsxs("header",{className:"ai-log-header",children:[s.jsxs("div",{children:[s.jsx(he,{children:"Problem history"}),s.jsx(fe,{children:"Recent local failures on this machine. Prompts and file contents are never recorded."})]}),s.jsxs("div",{className:"ai-log-header-actions",children:[s.jsxs(k,{variant:"outline",size:"sm",disabled:i,onClick:()=>{l()},children:[i?s.jsx(Y,{className:"animate-spin"}):s.jsx(Ie,{})," Refresh"]}),s.jsxs(k,{variant:"ghost",size:"sm",disabled:n.length===0,onClick:()=>{m()},children:[s.jsx(Et,{})," Clear"]}),s.jsx(_e,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Close problem history"}),children:s.jsx(ct,{})})]})]}),n.length>0&&s.jsxs("div",{className:"ai-log-totals",children:[s.jsxs("span",{children:[s.jsx("strong",{children:u.all})," recorded"]}),s.jsxs("span",{children:[s.jsx("strong",{children:u.errors})," errors"]})]}),s.jsxs("div",{className:"ai-log-body",children:[i&&n.length===0&&s.jsxs("div",{className:"view-loading",role:"status",children:[s.jsx(Y,{className:"spinner"})," ",s.jsx(at,{text:"Reading problems…"})]}),!i&&n.length===0&&s.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&&s.jsx("div",{className:"ai-log-table-wrap",children:s.jsxs(Es,{children:[s.jsx(Os,{children:h.getHeaderGroups().map(d=>s.jsx(ot,{children:d.headers.map(p=>s.jsx(Ts,{children:p.isPlaceholder?null:s.jsx(h.FlexRender,{header:p})},p.id))},d.id))}),s.jsx(As,{children:h.getRowModel().rows.map(d=>s.jsx(ot,{className:d.original.level==="error"?"ai-log-row-failed":void 0,children:d.getAllCells().map(p=>s.jsx(Is,{children:s.jsx(h.FlexRender,{cell:p})},p.id))},d.id))})]})})]})]})})}const tu=new Set(["Control","Shift","Alt","Meta"]);function nu({preferences:e,onPreference:t}){const n=g.useMemo(()=>pr(e.shortcutOverrides),[e.shortcutOverrides]),[r,i]=g.useState(null),o=Object.keys(e.shortcutOverrides).length>0,a=g.useMemo(()=>["General","Commit","Editor","Tabs"].map(m=>({category:m,definitions:gt.filter(d=>d.category===m)})),[]),c=g.useMemo(()=>[...new Set(rn.map(m=>m.category))].map(m=>({category:m,items:rn.filter(d=>d.category===m)})),[]),l=(h,m)=>{if(m===n[h]){i(null);return}const d=mr(h,m,n);if(d){const y=d==="reserved"?`${on(m)} is reserved for a fixed shortcut.`:`${on(m)} is already used by "${gt.find(j=>j.id===d).label}".`;i({id:h,message:y});return}i(null);const p=gt.find(y=>y.id===h),f={...e.shortcutOverrides};m===p.defaultCombo?delete f[h]:f[h]=m,t({shortcutOverrides:f})},u=h=>{i(null);const m={...e.shortcutOverrides};delete m[h],t({shortcutOverrides:m})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"settings-field settings-toggle-row",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Show and focus from anywhere"}),s.jsx("span",{children:"Double-tap Control to bring OpenTig to the front, even while another app is focused."})]}),s.jsx("button",{type:"button",role:"switch","aria-label":"Show and focus from anywhere","aria-checked":e.doubleControlShortcutEnabled,className:"settings-switch",onClick:()=>t({doubleControlShortcutEnabled:!e.doubleControlShortcutEnabled}),children:s.jsx("span",{})})]}),s.jsxs("div",{className:"settings-field settings-field-separated",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Keyboard shortcuts"}),s.jsx("span",{children:"Click a shortcut, then press a new key combination. Press Escape to cancel."})]}),o&&s.jsxs(k,{variant:"outline",size:"sm",className:"shortcuts-reset-all",onClick:()=>{i(null),t({shortcutOverrides:{}})},children:[s.jsx(Qn,{})," Reset all to defaults"]}),a.map(({category:h,definitions:m})=>s.jsxs("div",{className:"shortcuts-group",children:[s.jsx("div",{className:"shortcuts-group-heading",children:h}),m.map(d=>s.jsxs("div",{className:"shortcuts-row",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:d.label}),s.jsx("span",{children:d.description})]}),s.jsx(su,{combo:n[d.id],allowBare:d.allowBare,isCustom:e.shortcutOverrides[d.id]!==void 0,error:r?.id===d.id?r.message:null,onCapture:p=>l(d.id,p),onReset:()=>u(d.id)})]},d.id))]},h))]}),s.jsxs("div",{className:"settings-field settings-field-separated",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Fixed shortcuts"}),s.jsx("span",{children:"These follow platform and file-manager conventions and cannot be changed."})]}),c.map(({category:h,items:m})=>s.jsxs("div",{className:"shortcuts-group",children:[s.jsx("div",{className:"shortcuts-group-heading",children:h}),m.map(d=>s.jsxs("div",{className:"shortcuts-fixed-row",children:[s.jsx("span",{children:d.label}),s.jsx(Xn,{children:d.combo.split(" / ").flatMap((p,f)=>[...f>0?[s.jsx("span",{className:"shortcuts-fixed-sep",children:" / "},`sep-${p}`)]:[],...p.split(" + ").map((y,j)=>s.jsx(es,{children:y},`${p}-${j}`))])})]},d.combo+d.label))]},h))]})]})}function su({combo:e,allowBare:t,isCustom:n,error:r,onCapture:i,onReset:o}){const[a,c]=g.useState(!1);return g.useEffect(()=>{if(!a)return;const l=u=>{if(u.preventDefault(),u.stopPropagation(),u.key==="Escape"){c(!1);return}if(tu.has(u.key))return;const h=gr(u);c(!1),h&&br(h,t)&&i(h)};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[a,t,i]),s.jsxs("div",{className:"shortcut-recorder",children:[r&&s.jsx("span",{className:"shortcut-recorder-error",children:r}),s.jsx("button",{type:"button",className:`shortcut-recorder-button ${a?"listening":""} ${r?"error":""}`,onClick:()=>c(!0),onBlur:()=>c(!1),children:a?"Press a key…":s.jsx(Xn,{children:e.split("+").map(l=>s.jsx(es,{children:l},l))})}),n&&s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"ghost",size:"icon-xs","aria-label":"Reset to default",onClick:o}),children:s.jsx(Qn,{})}),s.jsx(se,{children:"Reset to default"})]})]})}function ru(e){const t=e.trim();if(!t||t.length>2048||/[\s\\]/.test(t)||!/^https?:\/\/[^/?#]+\/?$/i.test(t))throw new Error("Enter an HTTP or HTTPS address without a path, query, fragment, or credentials.");const n=new URL(t);if(n.protocol!=="http:"&&n.protocol!=="https:"||n.username||n.password||n.pathname!=="/"||n.search||n.hash)throw new Error("Enter an HTTP or HTTPS address without a path, query, fragment, or credentials.");return n.origin}var ke=(e=>(e[e.Border=-1]="Border",e[e.Data=0]="Data",e[e.Function=1]="Function",e[e.Position=2]="Position",e[e.Timing=3]="Timing",e[e.Alignment=4]="Alignment",e))(ke||{});const iu=[0,1],Ps=[1,0],Rs=[2,3],Zs=[3,2],ou={L:iu,M:Ps,Q:Rs,H:Zs},au=/^\d*$/,cu=/^[A-Z0-9 $%*+./:-]*$/,yt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ht=1,Bt=40,Ln=3,lu=3,Qe=40,uu=10,Ms=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ls=[[-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 du{constructor(t,n,r,i){if(this.version=t,this.ecc=n,t<Ht||t>Bt)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 o=Array.from({length:this.size}).fill(!1);for(let c=0;c<this.size;c++)this.modules.push(o.slice()),this.types.push(o.map(()=>0));this.drawFunctionPatterns();const a=this.addEccAndInterleave(r);if(this.drawCodewords(a),i===-1){let c=1e9;for(let l=0;l<8;l++){this.applyMask(l),this.drawFormatBits(l);const u=this.getPenaltyScore();u<c&&(i=l,c=u),this.applyMask(l)}}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 r=0;r<this.size;r++)this.setFunctionModule(6,r,r%2===0,ke.Timing),this.setFunctionModule(r,6,r%2===0,ke.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 r=0;r<n;r++)for(let i=0;i<n;i++)r===0&&i===0||r===0&&i===n-1||r===n-1&&i===0||this.drawAlignmentPattern(t[r],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){const n=this.ecc[1]<<3|t;let r=n;for(let o=0;o<10;o++)r=r<<1^(r>>>9)*1335;const i=(n<<10|r)^21522;for(let o=0;o<=5;o++)this.setFunctionModule(8,o,ce(i,o));this.setFunctionModule(8,7,ce(i,6)),this.setFunctionModule(8,8,ce(i,7)),this.setFunctionModule(7,8,ce(i,8));for(let o=9;o<15;o++)this.setFunctionModule(14-o,8,ce(i,o));for(let o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,ce(i,o));for(let o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,ce(i,o));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let r=0;r<12;r++)t=t<<1^(t>>>11)*7973;const n=this.version<<12|t;for(let r=0;r<18;r++){const i=ce(n,r),o=this.size-11+r%3,a=Math.floor(r/3);this.setFunctionModule(o,a,i),this.setFunctionModule(a,o,i)}}drawFinderPattern(t,n){for(let r=-4;r<=4;r++)for(let i=-4;i<=4;i++){const o=Math.max(Math.abs(i),Math.abs(r)),a=t+i,c=n+r;a>=0&&a<this.size&&c>=0&&c<this.size&&this.setFunctionModule(a,c,o!==2&&o!==4,ke.Position)}}drawAlignmentPattern(t,n){for(let r=-2;r<=2;r++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,n+r,Math.max(Math.abs(i),Math.abs(r))!==1,ke.Alignment)}setFunctionModule(t,n,r,i=ke.Function){this.modules[n][t]=r,this.types[n][t]=i}addEccAndInterleave(t){const n=this.version,r=this.ecc;if(t.length!==et(n,r))throw new RangeError("Invalid argument");const i=Ls[r[0]][n],o=Ms[r[0]][n],a=Math.floor(zt(n)/8),c=i-a%i,l=Math.floor(a/i),u=[],h=yu(o);for(let d=0,p=0;d<i;d++){const f=t.slice(p,p+l-o+(d<c?0:1));p+=f.length;const y=ju(f,h);d<c&&f.push(0),u.push(f.concat(y))}const m=[];for(let d=0;d<u[0].length;d++)u.forEach((p,f)=>{(d!==l-o||f>=c)&&m.push(p[d])});return m}drawCodewords(t){if(t.length!==Math.floor(zt(this.version)/8))throw new RangeError("Invalid argument");let n=0;for(let r=this.size-1;r>=1;r-=2){r===6&&(r=5);for(let i=0;i<this.size;i++)for(let o=0;o<2;o++){const a=r-o,l=(r+1&2)===0?this.size-1-i:i;!this.types[l][a]&&n<t.length*8&&(this.modules[l][a]=ce(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 r=0;r<this.size;r++){let i;switch(t){case 0:i=(r+n)%2===0;break;case 1:i=n%2===0;break;case 2:i=r%3===0;break;case 3:i=(r+n)%3===0;break;case 4:i=(Math.floor(r/3)+Math.floor(n/2))%2===0;break;case 5:i=r*n%2+r*n%3===0;break;case 6:i=(r*n%2+r*n%3)%2===0;break;case 7:i=((r+n)%2+r*n%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[n][r]&&i&&(this.modules[n][r]=!this.modules[n][r])}}getPenaltyScore(){let t=0;for(let o=0;o<this.size;o++){let a=!1,c=0;const l=[0,0,0,0,0,0,0];for(let u=0;u<this.size;u++)this.modules[o][u]===a?(c++,c===5?t+=Ln:c>5&&t++):(this.finderPenaltyAddHistory(c,l),a||(t+=this.finderPenaltyCountPatterns(l)*Qe),a=this.modules[o][u],c=1);t+=this.finderPenaltyTerminateAndCount(a,c,l)*Qe}for(let o=0;o<this.size;o++){let a=!1,c=0;const l=[0,0,0,0,0,0,0];for(let u=0;u<this.size;u++)this.modules[u][o]===a?(c++,c===5?t+=Ln:c>5&&t++):(this.finderPenaltyAddHistory(c,l),a||(t+=this.finderPenaltyCountPatterns(l)*Qe),a=this.modules[u][o],c=1);t+=this.finderPenaltyTerminateAndCount(a,c,l)*Qe}for(let o=0;o<this.size-1;o++)for(let a=0;a<this.size-1;a++){const c=this.modules[o][a];c===this.modules[o][a+1]&&c===this.modules[o+1][a]&&c===this.modules[o+1][a+1]&&(t+=lu)}let n=0;for(const o of this.modules)n=o.reduce((a,c)=>a+(c?1:0),n);const r=this.size*this.size,i=Math.ceil(Math.abs(n*20-r*10)/r)-1;return t+=i*uu,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,r=[6];for(let i=this.size-7;r.length<t;i-=n)r.splice(1,0,i);return r}}finderPenaltyCountPatterns(t){const n=t[1],r=n>0&&t[2]===n&&t[3]===n*3&&t[4]===n&&t[5]===n;return(r&&t[0]>=n*4&&t[6]>=n?1:0)+(r&&t[6]>=n*4&&t[0]>=n?1:0)}finderPenaltyTerminateAndCount(t,n,r){return t&&(this.finderPenaltyAddHistory(n,r),n=0),n+=this.size,this.finderPenaltyAddHistory(n,r),this.finderPenaltyCountPatterns(r)}finderPenaltyAddHistory(t,n){n[0]===0&&(t+=this.size),n.pop(),n.unshift(t)}}function le(e,t,n){if(t<0||t>31||e>>>t)throw new RangeError("Value out of range");for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function ce(e,t){return(e>>>t&1)!==0}class Vt{constructor(t,n,r){if(this.mode=t,this.numChars=n,this.bitData=r,n<0)throw new RangeError("Invalid argument");this.bitData=r.slice()}getData(){return this.bitData.slice()}}const hu=[1,10,12,14],fu=[2,9,11,13],pu=[4,8,16,16];function Ds(e,t){return e[Math.floor((t+7)/17)+1]}function Fs(e){const t=[];for(const n of e)le(n,8,t);return new Vt(pu,e.length,t)}function mu(e){if(!Us(e))throw new RangeError("String contains non-numeric characters");const t=[];for(let n=0;n<e.length;){const r=Math.min(e.length-n,3);le(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new Vt(hu,e.length,t)}function gu(e){if(!Gs(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");const t=[];let n;for(n=0;n+2<=e.length;n+=2){let r=yt.indexOf(e.charAt(n))*45;r+=yt.indexOf(e.charAt(n+1)),le(r,11,t)}return n<e.length&&le(yt.indexOf(e.charAt(n)),6,t),new Vt(fu,e.length,t)}function bu(e){return e===""?[]:Us(e)?[mu(e)]:Gs(e)?[gu(e)]:[Fs(xu(e))]}function Us(e){return au.test(e)}function Gs(e){return cu.test(e)}function vu(e,t){let n=0;for(const r of e){const i=Ds(r.mode,t);if(r.numChars>=1<<i)return Number.POSITIVE_INFINITY;n+=4+i+r.bitData.length}return n}function xu(e){e=encodeURI(e);const t=[];for(let n=0;n<e.length;n++)e.charAt(n)!=="%"?t.push(e.charCodeAt(n)):(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2);return t}function zt(e){if(e<Ht||e>Bt)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function et(e,t){return Math.floor(zt(e)/8)-Ms[t[0]][e]*Ls[t[0]][e]}function yu(e){if(e<1||e>255)throw new RangeError("Degree out of range");const t=[];for(let r=0;r<e-1;r++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let i=0;i<t.length;i++)t[i]=Ct(t[i],n),i+1<t.length&&(t[i]^=t[i+1]);n=Ct(n,2)}return t}function ju(e,t){const n=t.map(r=>0);for(const r of e){const i=r^n.shift();n.push(0),t.forEach((o,a)=>n[a]^=Ct(o,i))}return n}function Ct(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function wu(e,t,n=1,r=40,i=-1,o=!0){if(!(Ht<=n&&n<=r&&r<=Bt)||i<-1||i>7)throw new RangeError("Invalid value");let a,c;for(a=n;;a++){const m=et(a,t)*8,d=vu(e,a);if(d<=m){c=d;break}if(a>=r)throw new RangeError("Data too long")}for(const m of[Ps,Rs,Zs])o&&c<=et(a,m)*8&&(t=m);const l=[];for(const m of e){le(m.mode[0],4,l),le(m.numChars,Ds(m.mode,a),l);for(const d of m.getData())l.push(d)}const u=et(a,t)*8;le(0,Math.min(4,u-l.length),l),le(0,(8-l.length%8)%8,l);for(let m=236;l.length<u;m^=253)le(m,8,l);const h=Array.from({length:Math.ceil(l.length/8)},()=>0);return l.forEach((m,d)=>h[d>>>3]|=m<<7-(d&7)),new du(a,t,h,i)}function ku(e,t){const{ecc:n="L",boostEcc:r=!1,minVersion:i=1,maxVersion:o=40,maskPattern:a=-1,border:c=1}=t||{},l=typeof e=="string"?bu(e):Array.isArray(e)?[Fs(e)]:void 0;if(!l)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);const u=wu(l,ou[n],i,o,a,r),h=_u({version:u.version,maskPattern:u.mask,size:u.size,data:u.modules,types:u.types},c);return t?.invert&&(h.data=h.data.map(m=>m.map(d=>!d))),t?.onEncoded?.(h),h}function _u(e,t=1){if(!t)return e;const{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(o=>{for(let a=0;a<t;a++)o.unshift(!1),o.push(!1)});for(let o=0;o<t;o++)e.data.unshift(Array.from({length:r},a=>!1)),e.data.push(Array.from({length:r},a=>!1));const i=ke.Border;e.types.forEach(o=>{for(let a=0;a<t;a++)o.unshift(i),o.push(i)});for(let o=0;o<t;o++)e.types.unshift(Array.from({length:r},a=>i)),e.types.push(Array.from({length:r},a=>i));return e}function Dn(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Nu(e,t={}){const n=ku(e,t),{pixelSize:r=10,whiteColor:i="white",blackColor:o="black"}=t,a=n.size*r,c=n.size*r;let l=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c} ${a}">`;const u=[];for(let h=0;h<n.size;h++)for(let m=0;m<n.size;m++){const d=m*r,p=h*r;n.data[h][m]&&u.push(`M${d},${p}h${r}v${r}h-${r}z`)}return l+=`<rect fill="${Dn(i)}" width="${c}" height="${a}"/>`,l+=`<path fill="${Dn(o)}" d="${u.join("")}"/>`,l+="</svg>",l}async function Su(){const e=await fetch("/api/auth/sessions",{credentials:"include"});if(!e.ok)throw new Error(await Jt(e,"Could not load owner sessions."));const t=await e.json();if(!Array.isArray(t.sessions))throw new Error("OpenTig returned an invalid session list.");return t.sessions}async function zu(e){return Hs("/api/auth/sessions/revoke",{sessionId:e})}async function Cu(){return Hs("/api/auth/sessions/revoke-all",{})}async function $u(e,t){const n=await fetch("/api/auth/sessions/rename",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,clientName:t})});if(!n.ok)throw new Error(await Jt(n,"Could not rename the browser session."))}async function Hs(e,t){const n=await fetch(e,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await Jt(n,"Could not revoke the browser session."));const r=await n.json();if(!Number.isSafeInteger(r.revokedCount)||Number(r.revokedCount)<0)throw new Error("OpenTig returned an invalid revocation result.");return Number(r.revokedCount)}async function Jt(e,t){try{const n=await e.json();return typeof n.error=="string"?n.error:t}catch{return t}}class Eu{generation=0;pending=!1;begin(){return this.pending?null:(this.pending=!0,++this.generation)}dismiss(){this.generation++}isCurrent(t){return t===this.generation}finish(t){return this.pending=!1,this.isCurrent(t)}}const Ou={starting:"Starting",ready:"Ready",restarting:"Restarting",failed:"Failed",stopped:"Stopped"};function Au(){const e=window.opentigDesktop?.webAccess,[t,n]=g.useState(null),[r,i]=g.useState([]),[o,a]=g.useState(null),[c,l]=g.useState("local"),[u,h]=g.useState(""),[m,d]=g.useState(!1),[p,f]=g.useState(""),[y,j]=g.useState(null),C=g.useRef(null),[Z,A]=g.useState(!1),[w,S]=g.useState(!1),[x,T]=g.useState(null),z=g.useRef(new Eu),$=g.useRef(!0),[X,ae]=g.useState(!0),[L,J]=g.useState(null),[pe,N]=g.useState(null),[I,K]=g.useState(null),[je,me]=g.useState(null),[Re,Wt]=g.useState(""),Kt=t?.webAccessEnabled&&t.listeningOnLan?t.networkEndpoints.filter(v=>t.pairingEndpoints.includes(v)):[],He=c==="public"?t?.publicOrigin??"":c==="lan"?u:t?.localEndpoint??"",Be=c==="public"&&(!t?.publicOrigin||m),qt=t?.webAccessEnabled&&t.serverState==="ready"&&t.pairingEndpoints.includes(He)&&!Be&&L===null&&!Z,Bs=[{value:"local",label:"Local"},...Kt.length?[{value:"lan",label:"LAN"}]:[],{value:"public",label:"My domain"}],q=g.useCallback(()=>{z.current.dismiss(),a(null),S(!1)},[]);g.useEffect(()=>{const v=z.current;return $.current=!0,()=>{$.current=!1,v.dismiss()}},[]),g.useEffect(()=>{f(t?.publicOrigin??"")},[t?.publicOrigin]);const Ve=t?.webAccessEnabled;g.useEffect(()=>{Ve===!1&&(q(),d(!1),j(null),f(t?.publicOrigin??""))},[Ve,t?.publicOrigin,q]),g.useEffect(()=>{Ve&&Be&&C.current?.focus()},[Ve,Be]),g.useEffect(()=>{q()},[He,q]),g.useEffect(()=>{if(!o||x===null)return;const v=window.setTimeout(()=>{z.current.isCurrent(x)&&q()},Math.max(0,Date.parse(o.expiresAt)-Date.now()));return()=>window.clearTimeout(v)},[o,x,q]);const we=g.useCallback(async(v=!0)=>{const O=await Promise.allSettled([e?.getStatus()??Promise.resolve(null),Su()]);$.current&&(O[0].status==="fulfilled"?n(O[0].value):v&&P.error({title:"Could not read web access status",description:ee(O[0].reason)}),O[1].status==="fulfilled"?i(O[1].value):v&&P.error({title:"Could not read owner sessions",description:ee(O[1].reason)}),ae(!1))},[e]);g.useEffect(()=>{we();const v=window.setInterval(()=>{we(!1)},2e3);return()=>window.clearInterval(v)},[we]),g.useEffect(()=>{if(!t)return;const v=t.listeningOnLan?t.networkEndpoints.filter(O=>t.pairingEndpoints.includes(O)):[];v.includes(u)||h(v[0]??""),c==="lan"&&v.length===0&&l("local")},[u,c,t]);const Yt=g.useMemo(()=>o?`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(Nu(o.url,{ecc:"M",border:2}))}`:null,[o]),pt=g.useMemo(()=>o?new URLSearchParams(new URL(o.url).hash.slice(1)).get("token")??"":"",[o]);if(X&&(!e||!t)&&r.length===0)return s.jsxs("div",{className:"web-access-loading",role:"status",children:[s.jsx(Y,{className:"animate-spin"})," Loading web access…"]});const Vs=async v=>{if(e){J("toggle"),q();try{n(await e.setEnabled(v)),P.success({title:v?"Web access enabled":"Web access paused; paired devices saved"})}catch(O){P.error({title:"Could not change web access",description:ee(O)}),await we(!1)}finally{J(null),N(null)}}},Js=async v=>{if(e){J("lan"),q();try{n(await e.setLanEnabled(v))}catch(O){P.error({title:"Could not change LAN access",description:ee(O)}),await we(!1)}finally{J(null)}}},Qt=async(v=!1)=>{if(!e)return;j(null);let O;try{const D=p.trim();O=v?"":ru(D&&!D.includes("://")?`https://${D}`:D)}catch(D){j(ee(D));return}J("origin"),q();try{const D=await e.setPublicOrigin(O);n(D),f(D.publicOrigin??""),d(!1),l(D.publicOrigin?"public":"local")}catch(D){j(ee(D))}finally{J(null)}},Ws=v=>{q(),l(v),d(!1),f(t?.publicOrigin??""),j(null)},Ks=()=>{f(t?.publicOrigin??""),j(null),d(!1),t?.publicOrigin||l("local")},qs=async()=>{if(!e||!qt)return;const v=z.current.begin();if(v!==null){a(null),T(v),S(!0),A(!0);try{const O=await e.createPairingLink(He);$.current&&z.current.isCurrent(v)&&a(O)}catch(O){$.current&&z.current.isCurrent(v)&&(S(!1),P.error({title:"Could not create pairing link",description:ee(O)}))}finally{z.current.finish(v),$.current&&A(!1)}}},Ys=async()=>{if(o)try{await jt(o.url),P.success({title:"Pairing link copied"})}catch(v){P.error({title:"Could not copy pairing link",description:ee(v)})}},Qs=async()=>{if(pt)try{await jt(pt),P.success({title:"Pairing code copied"})}catch(v){P.error({title:"Could not copy pairing code",description:ee(v)})}},Xs=async()=>{const v=je,O=Re.trim();if(!(!v||!O||O.length>64)){J(`rename:${v.id}`);try{await $u(v.id,O),P.success({title:"Device renamed"}),await we(!1),me(null)}catch(D){P.error({title:"Could not rename device",description:ee(D)})}finally{J(null)}}},er=async()=>{const v=I;if(!v)return;const O=v==="all"?"revoke-all":`revoke:${v.id}`;J(O);try{const D=v==="all"?await Cu():await zu(v.id);a(null),P.success({title:`${D} browser ${D===1?"session":"sessions"} revoked`}),await we(!1)}catch(D){P.error({title:"Could not revoke session",description:ee(D)})}finally{J(null),K(null)}},Je=t?.serverState==="ready",tr=r.filter(v=>v.kind!=="desktop");return s.jsxs("div",{className:"web-access-settings",children:[e&&t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"web-access-summary",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Web access"}),s.jsx("span",{children:"Allow paired browsers to use OpenTig. Turning this off disconnects browsers but keeps paired devices. Enable it again to restore their access; the desktop stays connected."})]}),s.jsx("button",{type:"button",role:"switch","aria-label":"Web access","aria-checked":t.webAccessEnabled,className:"settings-switch",disabled:L!==null||!Je,onClick:()=>N(t.webAccessEnabled?"disable":"enable"),children:s.jsx("span",{})})]}),s.jsxs("div",{className:"web-access-facts","aria-live":"polite",children:[s.jsx(Me,{label:"Server status",children:s.jsx(ve,{variant:Je?"secondary":"outline",children:Ou[t.serverState]})}),s.jsx(Me,{label:"Actual port",children:s.jsx("code",{children:t.actualPort??"Unavailable"})}),s.jsx(Me,{label:"Listening on",children:s.jsx("span",{children:t.listeningOnLan?"All network interfaces":"This computer (loopback)"})}),s.jsx(Me,{label:"Local endpoint",children:s.jsx(Fn,{value:t.localEndpoint})}),s.jsxs("div",{className:"web-access-summary web-access-network-settings",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"LAN access"}),s.jsx("span",{children:"Allow direct connections from this computer's network. Cloudflare Tunnel on this PC works with LAN access off. Changing LAN access restarts the listener."})]}),s.jsx("button",{type:"button",role:"switch","aria-label":"LAN access","aria-checked":t.listeningOnLan,className:"settings-switch",disabled:!t.webAccessEnabled||L!==null||!Je,onClick:()=>{Js(!t.listeningOnLan)},children:s.jsx("span",{})})]}),s.jsx(Me,{label:"LAN endpoints",children:s.jsx("div",{className:"web-access-endpoints",children:t.networkEndpoints.length===0?s.jsx("span",{children:"None detected"}):t.networkEndpoints.map(v=>s.jsx(Fn,{value:v,muted:!t.webAccessEnabled||!t.listeningOnLan},v))})})]}),t.restartError&&s.jsxs("div",{className:"web-access-error",role:"alert",children:[s.jsx(Pt,{})," ",s.jsx("span",{children:t.restartError})]}),!t.webAccessEnabled&&s.jsx("p",{className:"web-access-hint",children:"Browser access is paused, including through tunnels. Paired devices are saved; the private desktop session stays connected."}),t.webAccessEnabled&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"web-access-actions settings-field-separated",children:s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Pair a browser"}),s.jsx("span",{children:"Choose where to open your five-minute, one-use link."})]})}),s.jsxs("div",{className:"web-access-pairing-options",children:[s.jsxs("fieldset",{className:"web-access-destinations",disabled:L!==null,children:[s.jsx("legend",{className:"sr-only",children:"Pairing destination"}),Bs.map(({value:v,label:O})=>s.jsxs("label",{children:[s.jsx("input",{type:"radio",name:"web-access-destination",value:v,checked:c===v,onChange:()=>Ws(v)}),O]},v))]}),c==="public"?s.jsx("div",{className:"web-access-domain",children:Be?s.jsxs("form",{onSubmit:v=>{v.preventDefault(),Qt()},children:[s.jsx("label",{htmlFor:"web-access-public-origin",children:"Your domain"}),s.jsx("input",{ref:C,id:"web-access-public-origin",className:"web-access-rename-input",value:p,onChange:v=>{f(v.target.value),j(null)},placeholder:"https://git.example.com","aria-invalid":y!==null,"aria-describedby":`web-access-origin-help${y?" web-access-origin-error":""}`,maxLength:2048,disabled:L!==null,autoComplete:"off",spellCheck:!1,inputMode:"url"}),s.jsx("p",{id:"web-access-origin-help",className:"web-access-hint",children:"Your tunnel address, without a path. It will be used in the link and QR. Point your tunnel at the local endpoint shown above."}),y&&s.jsx("p",{id:"web-access-origin-error",className:"web-access-error",role:"alert",children:y}),s.jsxs("div",{className:"web-access-domain-actions",children:[s.jsx(k,{type:"submit",size:"sm",disabled:L!==null||!p.trim(),children:"Save and use"}),s.jsx(k,{type:"button",variant:"ghost",size:"sm",onClick:Ks,disabled:L!==null,children:"Cancel"}),t.publicOrigin&&s.jsx(k,{type:"button",variant:"ghost",size:"sm",onClick:()=>{Qt(!0)},disabled:L!==null,children:"Remove"})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"web-access-saved-domain",children:[s.jsx("code",{children:t.publicOrigin}),s.jsxs(k,{variant:"ghost",size:"sm",onClick:()=>{q(),d(!0)},disabled:L!==null,children:[s.jsx(an,{})," Edit"]})]}),s.jsx("p",{className:"web-access-hint",children:"Saved and selected for this link and QR."})]})}):c==="lan"?s.jsxs("div",{className:"web-access-endpoint-select",children:[s.jsx("label",{htmlFor:"web-access-endpoint",children:"Network address"}),s.jsxs(Ot,{value:u,onValueChange:v=>{v&&h(v)},disabled:L!==null,children:[s.jsx(At,{id:"web-access-endpoint",className:"w-full",children:s.jsx(Tt,{children:u})}),s.jsx(It,{alignItemWithTrigger:!1,children:s.jsx(vr,{children:Kt.map(v=>s.jsx(Fe,{value:v,children:v},v))})})]})]}):s.jsx("p",{className:"web-access-hint",children:"For a browser on this computer."}),s.jsxs("div",{className:"web-access-link-destination",children:[s.jsx("span",{children:"Address for the link and QR"}),s.jsx("code",{children:He||(c==="public"?"Add your domain above":"Unavailable")})]}),s.jsxs(k,{size:"sm",onClick:()=>{qs()},disabled:!qt,children:[Z?s.jsx(Y,{className:"animate-spin"}):s.jsx(Gr,{})," Create pairing link"]})]}),w&&s.jsxs("div",{className:"web-access-pairing",role:"status",children:[s.jsxs("div",{className:"web-access-pairing-copy",children:[o?s.jsx(Yr,{"aria-hidden":"true"}):s.jsx(Y,{className:"animate-spin","aria-hidden":"true"}),s.jsxs("div",{children:[s.jsx("strong",{children:o?"Pairing link ready":"Creating pairing link…"}),s.jsx("span",{children:o?`Expires ${Te(o.expiresAt,{seconds:!0})}.`:"You can close this while the link is being created."})]}),s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Close pairing link",onClick:q}),children:s.jsx(ct,{})}),s.jsx(se,{children:"Close pairing link"})]})]}),o&&s.jsxs(s.Fragment,{children:[Yt&&s.jsx("img",{src:Yt,alt:"QR code for the one-use OpenTig pairing link"}),s.jsxs("div",{className:"web-access-link-row",children:[s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx("code",{className:"web-access-link"}),children:o.url}),s.jsx(se,{side:"bottom",children:"One-use link; do not share publicly"})]}),s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing link",onClick:()=>{Ys()}}),children:s.jsx(tt,{})}),s.jsx(se,{children:"Copy pairing link"})]})]}),s.jsxs("div",{className:"web-access-link-row",children:[s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx("code",{className:"web-access-link"}),children:pt}),s.jsx(se,{side:"bottom",children:"Paste this code on any /pair page served by this OpenTig instance"})]}),s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"outline",size:"icon-sm","aria-label":"Copy pairing code",onClick:()=>{Qs()}}),children:s.jsx(tt,{})}),s.jsx(se,{children:"Copy pairing code"})]})]}),s.jsx("p",{className:"web-access-hint",children:"Closing hides this code. A copied code remains valid until used, replaced, or expired. Turning off Web access invalidates it."})]})]})]})]}),s.jsxs("div",{className:`web-access-session-heading ${e?"settings-field-separated":""}`,children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Owner sessions"}),s.jsx("span",{children:"Desktop authentication stays private. Paired browsers can be disconnected individually."})]}),s.jsxs(k,{variant:"destructive",size:"sm",onClick:()=>K("all"),disabled:tr.length===0||L!==null,children:[s.jsx(dn,{})," Revoke browsers"]})]}),s.jsx("div",{className:"web-access-session-list","aria-live":"polite",children:r.length===0?s.jsx("div",{className:"web-access-empty-session",children:"No owner sessions found."}):r.map(v=>s.jsxs("div",{className:"web-access-session",children:[s.jsx("div",{className:`web-access-session-icon ${v.connected?"connected":""}`,children:v.kind==="desktop"?s.jsx(Yn,{}):s.jsx(Lr,{})}),s.jsxs("div",{className:"web-access-session-copy",children:[s.jsxs("div",{children:[s.jsx("strong",{children:v.clientName}),v.current&&s.jsx(ve,{variant:"secondary",children:"This session"}),v.kind==="desktop"&&s.jsx(ve,{variant:"outline",children:"Desktop"})]}),s.jsxs("span",{children:[v.connected?`Connected${v.connectionCount>1?` (${v.connectionCount} tabs)`:""}`:v.lastConnectedAt?`Last connected ${Te(v.lastConnectedAt,{seconds:!0})}`:"Not yet connected"," · ",v.browser&&v.os?`${v.browser} on ${v.os}`:v.browser??v.os??Tu(v.deviceType),v.viaProxy?" · Via proxy":"",v.remoteAddress?` · ${v.remoteAddress}`:""]})]}),v.kind!=="desktop"&&s.jsxs("div",{className:"web-access-session-controls",children:[s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":`Rename ${v.clientName}`,onClick:()=>{me(v),Wt(v.clientName)},disabled:L!==null}),children:s.jsx(an,{})}),s.jsx(se,{children:"Rename this device"})]}),s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":`Revoke ${v.clientName} session`,onClick:()=>K(v),disabled:L!==null}),children:s.jsx(Et,{})}),s.jsx(se,{children:"Revoke this browser session"})]})]})]},v.id))}),!e&&s.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."}),s.jsx(ue,{open:pe!==null,onOpenChange:v=>{v||N(null)},children:s.jsxs(de,{className:"undo-commit-dialog",children:[s.jsxs("div",{className:"undo-commit-content",children:[s.jsx(he,{children:pe==="disable"?"Disable Web access?":"Enable browser access?"}),s.jsx(fe,{children:pe==="disable"?"Connected browsers will disconnect and cannot access OpenTig until Web access is enabled again. Paired devices stay saved and can reconnect with their valid sessions. The desktop stays connected.":"Paired browsers can edit or delete files and act with your OS user permissions. Saved paired devices can reconnect. Use only devices you trust. LAN exposure is configured separately."})]}),s.jsxs("div",{className:"undo-commit-actions",children:[s.jsx(_e,{render:s.jsx(k,{variant:"ghost"}),children:"Cancel"}),s.jsx(k,{variant:pe==="disable"?"destructive":"default",onClick:()=>{Vs(pe==="enable")},disabled:L!==null||!Je,children:pe==="disable"?"Disable Web access":"Enable Web access"})]})]})}),s.jsx(ue,{open:I!==null,onOpenChange:v=>{v||K(null)},children:s.jsxs(de,{className:"undo-commit-dialog",children:[s.jsxs("div",{className:"undo-commit-content",children:[s.jsx(he,{children:I==="all"?"Revoke all browser sessions?":"Revoke this browser session?"}),s.jsx(fe,{children:I==="all"?"Every paired browser disconnects immediately. The private desktop session remains signed in.":I?.current?"This browser will disconnect immediately and require a new pairing link.":"That browser disconnects immediately and will require a new pairing link."}),I&&I!=="all"&&s.jsx("div",{className:"undo-commit-summary",children:s.jsx("strong",{children:I.clientName})})]}),s.jsxs("div",{className:"undo-commit-actions",children:[s.jsx(_e,{render:s.jsx(k,{variant:"ghost"}),children:"Cancel"}),s.jsxs(k,{variant:"destructive",onClick:()=>{er()},disabled:L!==null,children:[s.jsx(dn,{})," Revoke"]})]})]})}),s.jsx(ue,{open:je!==null,onOpenChange:v=>{v||me(null)},children:s.jsxs(de,{className:"undo-commit-dialog",children:[s.jsxs("div",{className:"undo-commit-content",children:[s.jsx(he,{children:"Rename paired device"}),s.jsx(fe,{children:"Use a name that makes this browser easy to identify later."}),s.jsx("input",{className:"web-access-rename-input",value:Re,onChange:v=>Wt(v.target.value),maxLength:64,"aria-label":"Device name",autoComplete:"off"})]}),s.jsxs("div",{className:"undo-commit-actions",children:[s.jsx(_e,{render:s.jsx(k,{variant:"ghost"}),children:"Cancel"}),s.jsx(k,{onClick:()=>{Xs()},disabled:L!==null||!Re.trim(),children:"Save"})]})]})})]})}function Me({label:e,children:t}){return s.jsxs("div",{className:"web-access-fact",children:[s.jsx("span",{children:e}),s.jsx("div",{children:t})]})}function Fn({value:e,muted:t=!1}){return e?s.jsxs(te,{children:[s.jsx(ne,{render:s.jsx("code",{className:t?"muted":void 0}),children:e}),s.jsx(se,{side:"bottom",children:t?"Enable Web access and LAN access to use this endpoint":e})]}):s.jsx("span",{children:"Unavailable"})}function Tu(e){return e==="desktop"?"Desktop browser":e==="mobile"?"Mobile browser":e==="tablet"?"Tablet browser":e==="bot"?"Automated client":"Unknown browser"}function ee(e){return e instanceof Error?e.message:String(e)}const Iu=[{id:"general",label:"General",icon:xr},{id:"updates",label:"Updates",icon:Ie},{id:"shortcuts",label:"Shortcuts",icon:Fr},{id:"github",label:"GitHub",icon:Le},{id:"ai",label:"AI assistance",icon:rs},{id:"diagnostics",label:"Diagnostics",icon:Pt},{id:"webAccess",label:"Web access",icon:Kr}],Pu={github:{title:"GitHub",description:"Repository access and commit authorship in one place."},updates:{title:"Updates",description:"Check, download, and install new OpenTig releases."},general:{title:"General",description:"Appearance, files and repository behavior."},shortcuts:{title:"Shortcuts",description:"Rebind commands or review the shortcuts that stay fixed."},ai:{title:"AI assistance",description:"Local harness and model used to suggest commit messages and pull-request drafts."},diagnostics:{title:"Diagnostics",description:"Recent local failures on this machine. Prompts and file contents are never recorded."}};function Vu({preferences:e,onPreference:t,open:n,onOpenChange:r,section:i,onSectionChange:o,repository:a=null}){const c=$t(),l=Dl(e.aiExecutablePaths),u=W.aiStatuses(l),h=Xe({queryKey:u,queryFn:()=>H.ai.statuses(!1),enabled:n&&i==="ai",staleTime:1/0,gcTime:1/0,placeholderData:nr}),m=h.data??[],d=h.isFetching,[p,f]=g.useState(!1),[y,j]=g.useState(!1),C=g.useRef(null),Z=Ir(),A=Z?{duration:0}:{duration:.16,ease:[.22,1,.36,1]},w=g.useRef(l);g.useEffect(()=>{w.current!==l&&(c.removeQueries({queryKey:W.aiStatuses(w.current),exact:!0}),w.current=l)},[l,c]),g.useEffect(()=>{h.error&&P.error({title:"Could not check local AI",description:Lu(h.error)})},[h.error]);const S=()=>c.fetchQuery({queryKey:u,queryFn:()=>H.ai.statuses(!0),staleTime:0}).catch(()=>{});g.useLayoutEffect(()=>{n&&C.current&&(C.current.scrollTop=0)},[n,i]);const x=e.commitMessageHarness,T=m.find(N=>N.id===x),z=e.commitMessageModels[x]??"default",$=T?.models??[{id:"default",label:"Default (CLI)"}],X=$.some(N=>N.id===z)?$:[...$,{id:z,label:`${z} (unavailable)`}],ae=[];for(const N of X){const I=x==="opencode"?N.id.indexOf("/"):-1,K=I>0?N.id.slice(0,I):x,je=N.id==="default"?"default":`provider:${K}`;let me=ae.find(Re=>Re.id===je);me||(me={id:je,label:N.id==="default"?"":I>0?K:$e(x),items:[]},ae.push(me)),me.items.push({value:N.id,label:I>0&&N.label===N.id?N.id.slice(I+1):N.label,search:N.id,tooltip:N.id==="default"||N.label===N.id?N.label:`${N.label} · ${N.id}`,pinned:N.id==="default",icon:s.jsx(rs,{})})}const L=X.find(N=>N.id===z)?.label??z,{title:J,description:pe}=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."}:Pu[i];return s.jsx(ue,{open:n,onOpenChange:r,children:s.jsx(de,{className:`settings-dialog${i==="github"?" settings-dialog-github":i==="general"?" settings-dialog-general":i==="ai"?" settings-dialog-ai w-[min(1000px,calc((100vw-48px)/var(--settings-ui-scale,1)))]":""}`,style:{"--settings-ui-scale":window.opentigDesktop||window.matchMedia("(max-width: 767px)").matches?1:e.uiZoom/100},children:s.jsxs("div",{className:"settings-shell",children:[s.jsxs("aside",{className:"settings-nav",children:[s.jsx("div",{className:"settings-nav-title",children:"Settings"}),Iu.map(({id:N,label:I,icon:K})=>s.jsxs("button",{className:`settings-nav-item ${i===N?"active":""}`,onClick:()=>o(N),"aria-current":i===N,children:[s.jsx(K,{})," ",I]},N))]}),s.jsxs("section",{className:"settings-panel",children:[s.jsxs("header",{className:"settings-panel-header",children:[s.jsx(un,{initial:!1,mode:"wait",children:s.jsxs(Xt.div,{initial:Z?!1:{opacity:0,y:4},animate:{opacity:1,y:0},exit:Z?{opacity:1}:{opacity:0,y:-3},transition:A,children:[s.jsx(he,{children:J}),s.jsx(fe,{children:pe})]},i)}),s.jsx(_e,{render:s.jsx(k,{variant:"ghost",size:"icon-sm","aria-label":"Close settings"}),children:s.jsx(ct,{})})]}),s.jsx("div",{ref:C,className:`settings-panel-body${i==="general"?" settings-panel-body-general":""}`,children:s.jsx(un,{initial:!1,mode:"wait",children:s.jsx(Xt.div,{className:`settings-panel-section${i==="general"?" settings-panel-section-general":""}`,initial:Z?!1:{opacity:0,y:7},animate:{opacity:1,y:0},exit:Z?{opacity:1}:{opacity:0,y:-5},transition:A,children:i==="github"?s.jsx(Ol,{repository:a}):i==="general"?s.jsx(Yl,{preferences:e,onPreference:t}):i==="updates"?s.jsx(yr,{}):i==="shortcuts"?s.jsx(nu,{preferences:e,onPreference:t}):i==="webAccess"?s.jsx(Au,{}):i==="diagnostics"?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"settings-field",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Problem history"}),s.jsx("span",{children:"Failed Git, file, and network operations recorded locally. Prompts and file contents are never stored."})]}),s.jsxs(k,{variant:"outline",size:"sm",onClick:()=>j(!0),children:[s.jsx(Pt,{})," View problems"]})]}),s.jsx(eu,{open:y,onOpenChange:j})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"ai-settings-heading",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Local harness"}),s.jsx("span",{children:"OpenTig uses the selected CLI session. It does not copy or store credentials."}),T&&s.jsxs("span",{children:["Last checked: ",Te(T.checkedAt,{seconds:!0})]})]}),s.jsxs(k,{variant:"outline",size:"sm",onClick:()=>{S()},disabled:d,children:[d?s.jsx(Y,{className:"animate-spin"}):s.jsx(Ie,{})," ",d?s.jsx(at,{text:m.length?"Checking…":"Loading…"}):"Check again"]})]}),s.jsx("div",{className:"ai-harness-list",role:"radiogroup","aria-label":"Harness for AI assistance",children:["codex","claude","opencode","grok"].map(N=>{const I=m.find(je=>je.id===N),K=x===N;return s.jsxs("button",{type:"button",role:"radio","aria-checked":K,className:`ai-harness-card ${K?"active":""}`,onClick:()=>t({commitMessageHarness:N}),children:[s.jsxs("span",{className:"ai-harness-card-main",children:[s.jsx(jr,{harness:N}),s.jsxs("span",{className:"ai-harness-card-copy",children:[s.jsx("strong",{children:$e(N)}),s.jsx("small",{children:I?.version||(I?I.installationStatus==="inspection-failed"?"Inspection unavailable":I.installed?"Version unavailable":"Executable not found":d?"Loading…":"Status not checked")})]})]}),s.jsx(ve,{variant:Zu(I),className:`ai-status-badge ${I?.availability??"unknown"}`,children:Ru(I)}),I?.message&&s.jsx("span",{className:"ai-harness-message",children:I.message})]},N)})}),s.jsxs("div",{className:"settings-field settings-field-separated ai-model-field",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsxs("strong",{children:[$e(x)," model"]}),s.jsx("span",{children:x==="grok"?"Default uses Grok’s built-in default. Custom CLI models and configuration are not loaded.":"Default lets the CLI choose. OpenTig remembers a separate selection for each harness."})]}),s.jsx(Kn,{groups:ae,value:z,onValueChange:N=>t({commitMessageModels:{...e.commitMessageModels,[x]:N}}),label:`${$e(x)} model`,triggerLabel:L,triggerClassName:"ai-model-select",contentClassName:"ai-model-picker",size:"default",align:"end",placeholder:"Search models…"},x),T?.authStatus==="unauthenticated"&&s.jsxs("p",{className:"ai-login-hint",children:["Sign in from a terminal with ",s.jsx("code",{children:Mu(x,T.cliName)})," and check again."]}),T&&!T.installed&&T.installationStatus!=="inspection-failed"&&s.jsxs("p",{className:"ai-login-hint",children:["Install ",$e(x)," and check its availability again."]})]}),s.jsx(Ml,{harness:x,preferences:e,status:T,onPreference:t},x),s.jsxs("div",{className:"settings-field settings-field-separated ai-history-field",children:[s.jsxs("div",{className:"settings-field-label",children:[s.jsx("strong",{children:"Generation history"}),s.jsx("span",{children:"Outcome, duration, tokens, and cost of recent runs, kept locally for diagnostics."})]}),s.jsxs(k,{variant:"outline",size:"sm",onClick:()=>f(!0),children:[s.jsx(wr,{})," View history"]})]}),s.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."}),s.jsx(Hl,{open:p,onOpenChange:f})]})},i)})})]})]})})})}function Ru(e){return e?e.installationStatus==="inspection-failed"?"Check failed":e.installationStatus==="not-executable"?"Cannot run":e.installationStatus==="incompatible"?"Incompatible":e.installed?e.authStatus==="unauthenticated"?"Not authenticated":e.availability==="ready"?"Available":"Check":"Not found":"Not checked"}function Zu(e){return e?!e.installed||e.authStatus==="unauthenticated"||e.availability==="error"?"destructive":e.availability==="ready"?"default":"secondary":"outline"}function Mu(e,t){return e==="codex"?"codex login":e==="claude"?"claude auth login":e==="grok"?"grok login":t==="opencode2"?"opencode2 auth login":"opencode auth login"}function Lu(e){return e instanceof Error?e.message:"An unexpected error occurred."}export{Vu as SettingsDialog};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-
|
|
2
|
-
import{o as _,B as
|
|
3
|
-
`).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!f?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":f,onClick:()=>
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PierreDiffViewer-DoV3V0IW.js","assets/react-rd22PHbN.js","assets/PierreWorkerPool-Cg9zdxiI.js","assets/platform-Bqt97_Jr.js","assets/one-light-CoLDteqg.js","assets/index-BgLrS_2D.js","assets/index-B5RC4THs.js","assets/tanstack-CcfAJoQ7.js","assets/base-ui-CJ8ZIx3d.js","assets/index-Dc9xVluy.css","assets/index-CtEztN1P.js","assets/File-D65shwRR.js","assets/EditContext-CvJWfVl1.js","assets/DiffWorkspace-BRicWHvw.js","assets/App-Dfm5F199.js","assets/PierreEditBoundary-BnYZbHfi.js","assets/edit-ready-context-D77R8XU8.js","assets/MarkdownFileViewer-BsB8WkIH.js","assets/viewer-tabs-BjG3oKQ9.js","assets/viewer-tabs-D8o-L3pM.css","assets/EditableFileViewer-DWeSDnZn.js","assets/EditableFileViewer-B2G3Xa33.css","assets/render-markdown-hAIWRfn0.js","assets/markdown-BpzjXclZ.css","assets/PullRequestViewer-jC3LVmiO.js","assets/GitHubAvatar-C8R3iNoM.js","assets/HtmlFileViewer-JXLHTNPm.js","assets/HtmlFileViewer-D6UPnZvW.css","assets/ImageFileViewer-YH2xhkkk.js","assets/ImageFileViewer-D8TdwFTO.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as _,B as G,_ as v,T as ae,b as ne,d as le}from"./index-B5RC4THs.js";import{r as n,j as t}from"./react-rd22PHbN.js";import{r as re,t as oe,u as ue,g as F,v as fe,q as Z,w as J}from"./App-Dfm5F199.js";import"./tanstack-CcfAJoQ7.js";import"./base-ui-CJ8ZIx3d.js";class de{constructor(e){if(this.options=e,!Number.isInteger(e.maxEntries)||e.maxEntries<1)throw new RangeError("maxEntries must be a positive integer.");if(!Number.isFinite(e.maxBytes)||e.maxBytes<1)throw new RangeError("maxBytes must be a positive number.")}options;entries=new Map;totalBytes=0;get size(){return this.entries.size}get bytes(){return this.totalBytes}get(e){const o=this.entries.get(e);if(o)return this.entries.delete(e),this.entries.set(e,o),o.value}set(e,o){const f=ce(this.options.sizeOf(o)),x=this.entries.get(e);return x&&(this.entries.delete(e),this.totalBytes-=x.bytes),f>this.options.maxBytes?!1:(this.entries.set(e,{value:o,bytes:f}),this.totalBytes+=f,this.evictToBudget(),this.entries.has(e))}delete(e){const o=this.entries.get(e);return o?(this.entries.delete(e),this.totalBytes-=o.bytes,!0):!1}clear(){this.entries.clear(),this.totalBytes=0}evictToBudget(){for(;this.entries.size>this.options.maxEntries||this.totalBytes>this.options.maxBytes;){const e=this.entries.keys().next();if(e.done)break;this.delete(e.value)}}}function ce(i){if(!Number.isFinite(i)||i<0)throw new RangeError("sizeOf must return a finite, non-negative number.");return Math.ceil(i)}const Q=n.lazy(()=>v(()=>import("./PierreDiffViewer-DoV3V0IW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),me=n.lazy(()=>v(()=>import("./PierreEditBoundary-BnYZbHfi.js"),__vite__mapDeps([15,6,1,7,8,9,12,16])).then(i=>({default:i.PierreEditBoundary}))),he=n.lazy(()=>v(()=>import("./MarkdownFileViewer-BsB8WkIH.js"),__vite__mapDeps([17,1,6,7,8,9,14,18,19,20,2,3,4,5,10,11,12,16,21,22,23])).then(i=>({default:i.MarkdownFileViewer}))),pe=n.lazy(()=>v(()=>import("./PullRequestViewer-jC3LVmiO.js"),__vite__mapDeps([24,6,1,7,8,9,14,25,18,19,23])).then(i=>({default:i.PullRequestViewer}))),ve=n.lazy(()=>v(()=>import("./EditableFileViewer-DWeSDnZn.js").then(i=>i.E),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,16,14,21])).then(i=>({default:i.EditableFileViewer}))),xe=n.lazy(()=>v(()=>import("./HtmlFileViewer-JXLHTNPm.js"),__vite__mapDeps([26,1,18,6,7,8,9,19,20,2,3,4,5,10,11,12,16,14,21,27])).then(i=>({default:i.HtmlFileViewer}))),ye=n.lazy(()=>v(()=>import("./ImageFileViewer-YH2xhkkk.js"),__vite__mapDeps([28,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,16,14,21,29])).then(i=>({default:i.ImageFileViewer}))),ge=n.lazy(()=>v(()=>import("./ImageFileViewer-YH2xhkkk.js"),__vite__mapDeps([28,1,6,7,8,9,18,19,20,2,3,4,5,10,11,12,16,14,21,29])).then(i=>({default:i.SvgFileViewer}))),R=new de({maxEntries:8,maxBytes:16*1024*1024,sizeOf:i=>i.patch.length*2+i.path.length*2+256});let X=null;function Se({repositoryId:i,selection:e,diffView:o,wrapLines:f,theme:x,revision:y,readOnly:g,commits:$,draftFor:E,onSelect:C,onOpenFile:W,onDiffViewChange:K,onWrapLinesChange:M,onDraftChange:O,onDraftSaved:q,onUpdateConflict:I,onResolveConflict:ee}){const[a,w]=n.useState(null),[te,D]=n.useState(!1),[P,A]=n.useState(null),[V,H]=n.useState(!1),b=n.useRef(0),N=n.useRef(!1),c=we(i,e);n.useEffect(()=>{H(!1),N.current=!1},[e]),n.useEffect(()=>{X!==i&&(R.clear(),X=i);const s=++b.current;if(A(null),!e||e.type==="pull-request"){w(null),D(!1);return}D(!0),(async()=>{try{if(e.type==="file"||e.type==="conflict"){if(e.type==="file"&&fe(e.path)){const l=await _.repository.readImage(i,e.path);if(s!==b.current)return;w({docKey:c,type:"image",value:l});return}const u=await _.repository.readFile(i,e.path,e.type==="conflict"?!0:V);if(s!==b.current)return;if(e.type==="conflict"){w({docKey:c,type:"conflict",value:u});return}w(l=>l&&l.docKey===c&&l.type==="file"&&N.current||l&&l.docKey===c&&l.type==="file"&&l.value.content===u.content&&l.value.size===u.size&&l.value.binary===u.binary&&l.value.tooLarge===u.tooLarge?l:{docKey:c,type:"file",value:u})}else{const u=e.type!=="diff";let l=u?R.get(c):void 0;if(l||(l=e.type==="commit"?await _.diff.getCommit(i,e.oid):e.type==="commit-file"?await _.diff.getCommitFile(i,e.oid,e.path,e.oldPath):await _.diff.get({repositoryId:i,path:e.path,kind:e.kind}),u&&R.set(c,l)),s!==b.current)return;const p=l;w(d=>d&&d.docKey===c&&d.type==="diff"&&d.value.patch===p.patch&&d.value.binary===p.binary?d:{docKey:c,type:"diff",value:p})}}catch(u){s===b.current&&A(u instanceof Error?u.message:"Could not load the viewer.")}finally{s===b.current&&D(!1)}})()},[V,c,i,y,e]);const j=x==="system"?"system":x,ie=f?"wrap":"scroll",B=n.useCallback(s=>{N.current=s},[]),S=n.useCallback(async(s,h,u)=>{const l=E(s),p=await _.repository.writeFile(i,s,h,l?.expectedContent??u);return p.status==="saved"&&(N.current=!1,q(s),w(d=>d?.type==="file"&&d.value.path===s?{...d,value:{...d.value,content:h,binary:!1,tooLarge:!1,size:p.size,mtimeMs:p.mtimeMs}}:d)),p},[E,q,i]),k=n.useCallback(s=>s.path,[]),T=n.useCallback(s=>E(s.path)?.content??s.content,[E]),z=n.useCallback(s=>h=>O(s.path,h,s.content,s.mtimeMs),[O]),se=te&&a!==null&&!P;let r,L=null;if(!e)r=t.jsx(be,{});else if(e.type==="pull-request")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(pe,{repositoryId:i,prNumber:e.number,onSelectPullRequest:s=>C({type:"pull-request",number:s}),diffView:o,themeType:j,wrapLines:f,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>C(null)},`${i}:${e.number}`)});else if(P)r=t.jsx("div",{className:"viewer-message text-destructive",children:P});else if(!a)r=t.jsxs("div",{className:"viewer-message",children:[t.jsx(F,{className:"spinner"})," ",t.jsx(Z,{text:"Loading…"})]});else if(a.type==="image")r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ye,{image:a.value},`${a.value.path}:${a.value.mtimeMs}`)});else if(a.type!=="diff"&&a.value.binary)r=t.jsxs("div",{className:"viewer-message",children:["Binary file · ",Y(a.value.size)]});else if(a.type==="file"&&a.value.tooLarge&&!V)r=t.jsxs("div",{className:"viewer-message flex-col gap-3",children:[t.jsxs("p",{children:["The file is ",Y(a.value.size),". Preview is limited to protect performance."]}),t.jsx(G,{variant:"outline",onClick:()=>H(!0),children:"Load preview"})]});else if(a.type==="file"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The file exceeds the built-in editor's 8 MB safety limit."});else if(a.type==="conflict"&&a.value.tooLarge)r=t.jsx("div",{className:"viewer-message text-destructive",children:"The conflicted file exceeds the viewer's safe limit. Open it in an external editor to resolve it."});else if(a.type==="conflict")r=null,L=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(Q,{kind:"conflict",contentKey:a.docKey,file:a.value,themeType:j,overflow:ie,onUpdate:I,onResolve:ee})});else if(a.type==="file"&&re(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(he,{repositoryId:i,file:s,initialContent:T(s),revision:y,themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onOpenFile:W,onDirtyChange:B,onDraftChange:z(s),onSave:S},k(s))})}else if(a.type==="file"&&oe(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ge,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onDirtyChange:B,onDraftChange:z(s),onSave:S},k(s))})}else if(a.type==="file"&&ue(a.value.path)){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(xe,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g||s.tooLarge,onDirtyChange:B,onDraftChange:z(s),onSave:S},k(s))})}else if(a.type==="file"){const s=a.value;r=t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(ve,{file:s,initialContent:T(s),themeType:j,wrapLines:f,readOnly:g,onDirtyChange:B,onDraftChange:z(s),onSave:S},k(s))})}else if(a.type==="diff"&&a.value.patch){const s=e.type==="commit"||e.type==="commit-file"?e:null,h=s?$.find(l=>l.oid===s.oid):void 0,u=e.type==="commit-file"?t.jsx(G,{type:"button",variant:"outline",size:"xs",onClick:()=>C({type:"commit",oid:e.oid,subject:h?.subject??e.oid.slice(0,8)}),children:"All files"}):void 0;r=null,L=t.jsxs("div",{className:s?"commit-diff-viewer":"standalone-diff-viewer",children:[s&&t.jsx(je,{commit:h,fallbackSubject:"subject"in s?s.subject:""},s.oid),t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(Q,{kind:"diff",contentKey:a.docKey,value:a.value,diffView:o,themeType:j,wrapLines:f,initiallyCollapsed:e.type==="commit",compact:e.type==="diff",scopeControl:u,onDiffViewChange:K,onWrapLinesChange:M,onClose:()=>C(null)})})]})}else a.type==="diff"?r=t.jsx("div",{className:"viewer-message",children:"No differences to show."}):r=t.jsx("div",{className:"viewer-message",children:"This file cannot be edited."});const U=t.jsxs(t.Fragment,{children:[L??t.jsx("div",{className:"viewer-transition",children:r},a?a.docKey:c),se&&t.jsx("span",{className:"viewer-reloading","aria-hidden":"true",children:t.jsx(F,{className:"spinner"})})]});return a?.type!=="file"?U:t.jsx(n.Suspense,{fallback:t.jsx(m,{}),children:t.jsx(me,{enabled:!0,children:U})})}function je({commit:i,fallbackSubject:e}){const o=i?.date,[f,x]=n.useState(!1),y=i?.body??"",g=y.length>240||y.split(`
|
|
3
|
+
`).length>3;return t.jsxs("header",{className:"commit-diff-header",children:[t.jsx("h2",{children:i?.subject||e||"(no subject)"}),y&&t.jsxs("div",{className:"commit-diff-description-wrap",children:[t.jsx("p",{className:`commit-diff-description ${g&&!f?"collapsed":""}`,children:y}),g&&t.jsx("button",{type:"button",className:"commit-description-toggle","aria-expanded":f,onClick:()=>x($=>!$),children:f?"Show less":"Show full description"})]}),t.jsxs("div",{className:"commit-diff-meta",children:[t.jsx("code",{children:i?.shortOid??"commit"}),i?.author&&t.jsxs("span",{children:[i.author,i.email?` <${i.email}>`:""]}),o&&Number.isFinite(new Date(o).getTime())&&t.jsxs(ae,{children:[t.jsx(ne,{render:t.jsx("time",{dateTime:i?.date}),children:J(o,{seconds:!0})}),t.jsx(le,{children:J(o,{seconds:!0})})]}),i?.parentCount&&i.parentCount>1?t.jsx("span",{children:"Merge commit"}):null,i?.upstreamState==="local-only"&&t.jsx("span",{className:"commit-local-label",children:"Local only"})]})]})}function we(i,e){return e?e.type==="pull-request"?`${i}:pull:${e.number}`:e.type==="commit"?`${i}:commit:${e.oid}`:e.type==="commit-file"?`${i}:commit-file:${e.oid}:${e.oldPath??""}:${e.path}`:e.type==="diff"?`${i}:diff:${e.kind}:${e.path}`:`${i}:${e.type}:${e.path}`:`${i}:empty`}function m(){return t.jsxs("div",{className:"viewer-message",children:[t.jsx(F,{className:"spinner"})," ",t.jsx(Z,{text:"Loading viewer…"})]})}function be(){return t.jsxs("div",{className:"viewer-empty",children:[t.jsx("h2",{children:"Nothing selected"}),t.jsx("p",{children:"Select a change, file, commit, or pull request."})]})}function Y(i){return i?i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(1)} KB`:`${(i/1024/1024).toFixed(1)} MB`:"unknown size"}export{Se as default};
|
package/dist/client/assets/{abnfDiagram-N423BO3Z-BvrnK_R-.js → abnfDiagram-N423BO3Z-DdAfHevw.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-CI98oVdT.js";import{p as f}from"./chunk-JWPE2WC7-D0THYpZl.js";import{_ as n,l as s}from"./mermaid.core-CGJtfmwb.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-Cbh4Pk6j.js";import"./index-B5RC4THs.js";import"./react-rd22PHbN.js";import"./tanstack-CcfAJoQ7.js";import"./base-ui-CJ8ZIx3d.js";import"./render-markdown-hAIWRfn0.js";import"./App-Dfm5F199.js";import"./one-light-CoLDteqg.js";import"./index-BgLrS_2D.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,o]=e.split("*"),m=t?parseInt(t,10):0,l=o?parseInt(o,10):1/0;return{min:m,max:l}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:o}=b(e.repeat);return t===0&&o===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:o}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),s.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;s.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),s.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},$={parser:R,db:a,renderer:u,styles:p};export{$ as diagram};
|