tarsk 0.5.35 → 0.5.36

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.
Files changed (76) hide show
  1. package/dist/index.js +1 -2
  2. package/dist/public/assets/{account-view-k5jIArY-.js → account-view-BB-ze5ek.js} +1 -1
  3. package/dist/public/assets/api-DzFQRz0u.js +1 -0
  4. package/dist/public/assets/{browser-tab-C9kJT-C5.js → browser-tab-B3bYbBws.js} +1 -1
  5. package/dist/public/assets/commit-dialog-CJRMd4oA.js +1 -0
  6. package/dist/public/assets/context-menu-86TNA1D0.js +1 -0
  7. package/dist/public/assets/create-repo-dialog-nLnVNRqq.js +1 -0
  8. package/dist/public/assets/{dialogs-config-B4TDFSrS.js → dialogs-config-I0_cSU2z.js} +14 -14
  9. package/dist/public/assets/diff-view-B8vWYa_2.js +3 -0
  10. package/dist/public/assets/explorer-tab-view-BGWQPnkw.js +2 -0
  11. package/dist/public/assets/{explorer-tree-uXbr6cCI.js → explorer-tree-DrLoiF9t.js} +1 -1
  12. package/dist/public/assets/{explorer-view-CupxzDId.js → explorer-view-Clm-RCAB.js} +1 -1
  13. package/dist/public/assets/git-history-dialog-CcdMtW0o.js +1 -0
  14. package/dist/public/assets/git-ops-button-D9m2nmhO.js +2 -0
  15. package/dist/public/assets/history-view-Be-1C1tJ.js +7 -0
  16. package/dist/public/assets/index-DVXbmgHY.js +65 -0
  17. package/dist/public/assets/index-jIBJk8xl.css +1 -0
  18. package/dist/public/assets/{mcp-server-card-DrUUKNXv.js → mcp-server-card-bNNoXKsW.js} +1 -1
  19. package/dist/public/assets/merged-pr-dialog-Fj8II9Bt.js +1 -0
  20. package/dist/public/assets/onboarding-CgP4bJ5F.js +1 -0
  21. package/dist/public/assets/project-settings-view-DixzP7KH.js +1 -0
  22. package/dist/public/assets/providers-list-view-BzSUZZyq.js +1 -0
  23. package/dist/public/assets/pull-request-dialog-ChuHHY3J.js +1 -0
  24. package/dist/public/assets/pull-with-changes-dialog-Ck6aK6Q7.js +1 -0
  25. package/dist/public/assets/push-before-pr-dialog-CbtHXjDH.js +1 -0
  26. package/dist/public/assets/radio-group-ZjNXbvW6.js +1 -0
  27. package/dist/public/assets/react-vendor-Do-APsQ6.js +16 -0
  28. package/dist/public/assets/settings-general-view-FwrdJbys.js +1 -0
  29. package/dist/public/assets/settings-instructions-view-BHzMtSvN.js +1 -0
  30. package/dist/public/assets/settings-list-BCoqXa_X.js +1 -0
  31. package/dist/public/assets/settings-mcp-servers-view-DBD-NhPx.js +5 -0
  32. package/dist/public/assets/{settings-models-skeleton-B_56ozbA.js → settings-models-skeleton-DsWpzWOw.js} +1 -1
  33. package/dist/public/assets/settings-models-view-vgV5YHRx.js +1 -0
  34. package/dist/public/assets/settings-rules-view-DcSXrmaq.js +8 -0
  35. package/dist/public/assets/settings-skills-view-DVGGs16n.js +2 -0
  36. package/dist/public/assets/settings-slash-commands-view-BsJw1F4p.js +1 -0
  37. package/dist/public/assets/settings-subagents-view-BgWhQ9bf.js +2 -0
  38. package/dist/public/assets/{settings-system-prompt-view-66zf0gRc.js → settings-system-prompt-view-DAAbMucD.js} +1 -1
  39. package/dist/public/assets/settings-view-DLzrbu69.js +2 -0
  40. package/dist/public/assets/{skeleton-BvSNJL9q.js → skeleton-iEZ-dj1s.js} +1 -1
  41. package/dist/public/assets/{terminal-panel-Bm5ECpK_.js → terminal-panel-C5qj1ctH.js} +2 -2
  42. package/dist/public/assets/{ui-components-BZYnvMGc.js → ui-components-BN8dp4Bi.js} +1 -1
  43. package/dist/public/assets/{utils-umVhs9to.js → utils-CU0c_yCM.js} +1 -1
  44. package/dist/public/assets/{whisper-wasm-Cq5Ofwpd.js → whisper-wasm-EGutPGND.js} +2 -2
  45. package/dist/public/index.html +12 -9
  46. package/package.json +1 -1
  47. package/dist/public/assets/api-OCjPhv01.js +0 -1
  48. package/dist/public/assets/commit-dialog-8Ce6d3H8.js +0 -1
  49. package/dist/public/assets/context-menu-CMsWrzLD.js +0 -1
  50. package/dist/public/assets/create-repo-dialog-CVUtteNS.js +0 -1
  51. package/dist/public/assets/diff-view-DGfmGlB_.js +0 -3
  52. package/dist/public/assets/explorer-tab-view-CCXVTkVu.js +0 -2
  53. package/dist/public/assets/git-history-dialog-BCGOZ6ua.js +0 -1
  54. package/dist/public/assets/git-ops-button-BV9X3fo-.js +0 -2
  55. package/dist/public/assets/history-view-Ds_0e_bx.js +0 -7
  56. package/dist/public/assets/index-C0lTt0ZK.css +0 -1
  57. package/dist/public/assets/index-DOsSr4dl.js +0 -65
  58. package/dist/public/assets/merged-pr-dialog-DqWSFdCH.js +0 -1
  59. package/dist/public/assets/onboarding-DfL8a0LZ.js +0 -1
  60. package/dist/public/assets/project-settings-view-Cd_l3Lfy.js +0 -1
  61. package/dist/public/assets/providers-list-view-VXhgM3vp.js +0 -1
  62. package/dist/public/assets/pull-request-dialog-DZXTHHuh.js +0 -1
  63. package/dist/public/assets/pull-with-changes-dialog-CYQrwzcw.js +0 -1
  64. package/dist/public/assets/push-before-pr-dialog-D-ZnRpJi.js +0 -1
  65. package/dist/public/assets/radio-group-c0sU992r.js +0 -1
  66. package/dist/public/assets/react-vendor-unlDVFpU.js +0 -16
  67. package/dist/public/assets/settings-general-view-DI-lvP0L.js +0 -1
  68. package/dist/public/assets/settings-instructions-view-kUG32_dT.js +0 -1
  69. package/dist/public/assets/settings-list-CUbZrggr.js +0 -1
  70. package/dist/public/assets/settings-mcp-servers-view-DmxUO42I.js +0 -5
  71. package/dist/public/assets/settings-models-view-ms828HDa.js +0 -1
  72. package/dist/public/assets/settings-rules-view-Xx0ymfnQ.js +0 -8
  73. package/dist/public/assets/settings-skills-view-DvPPdsi_.js +0 -2
  74. package/dist/public/assets/settings-slash-commands-view-BULIAW2o.js +0 -1
  75. package/dist/public/assets/settings-subagents-view-B7FcLaZT.js +0 -2
  76. package/dist/public/assets/settings-view-B4CMq7it.js +0 -2
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ar as n,Ca as r,Ci as i,Dr as a,Er as o,Fi as s,G as c,On as l,Q as u,Ra as d,Ut as f,Va as p,_o as m,ao as ee,c as h,dr as g,fr as _,it as v,jr as y,kr as b,kt as x,li as S,ma as C,mr as w,oa as T,oo as E,pa as D,si as O,xa as k,ya as A,yo as j,za as M}from"./dialogs-config-I0_cSU2z.js";import{C as N}from"./react-vendor-Do-APsQ6.js";import{t as P}from"./monaco-CZnIWXyV.js";import{u as F}from"./onboarding-CgP4bJ5F.js";import{a as I,l as L,n as te,o as R}from"./history-view-Be-1C1tJ.js";import{n as ne}from"./utils-CU0c_yCM.js";import{A as re,D as ie,O as ae,a as oe,i as se,j as ce,k as le,n as ue,p as de,r as fe,u as pe}from"./index-DVXbmgHY.js";import{a as me,n as z,r as B,t as he}from"./context-menu-86TNA1D0.js";var V=e(j(),1),H=m(),U=t();function ge(e){let t=(0,H.c)(17),{children:n,title:r,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,U.jsx)(`span`,{className:i.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=(0,U.jsx)(h,{className:`flex-1`,children:n}),t[9]=n,t[10]=d);let f;t[11]===o?f=t[12]:(f=o&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[11]=o,t[12]=f);let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function _e(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var ve={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},ye={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function W(e){return S(S(i.compact,`status-badge font-mono font-semibold`),ve[e]??`text-orange-500`)}function G(e){return ye[e]??`M`}function be(e){let t=(0,H.c)(38),{treeData:n,files:r,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:c}=e,l;t[0]===r?l=t[1]:(l=r.reduce(Se,0),t[0]=r,t[1]=l);let u=l,f;t[2]===r?f=t[3]:(f=r.reduce(K,0),t[2]=r,t[3]=f);let m=f,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=S(i.compact,`text-muted-foreground`),t[4]=h):h=t[4];let g=r.length===1?``:`s`,_;t[5]!==r.length||t[6]!==g?(_=(0,U.jsxs)(`span`,{className:h,children:[r.length,` file`,g]}),t[5]=r.length,t[6]=g,t[7]=_):_=t[7];let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=S(i.compact,`text-green-500`),t[8]=v):v=t[8];let y;t[9]===u?y=t[10]:(y=(0,U.jsxs)(`span`,{className:v,children:[`+`,u]}),t[9]=u,t[10]=y);let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=S(i.compact,`text-red-500`),t[11]=b):b=t[11];let x;t[12]===m?x=t[13]:(x=(0,U.jsxs)(`span`,{className:b,children:[`-`,m]}),t[12]=m,t[13]=x);let C;t[14]!==_||t[15]!==y||t[16]!==x?(C=(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_,y,x]}),t[14]=_,t[15]=y,t[16]=x,t[17]=C):C=t[17];let w=C;if(a){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=S(i.compact,`text-destructive text-center`),t[18]=e):e=t[18];let n;t[19]===a?n=t[20]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:a})}),t[19]=a,t[20]=n);let r;return t[21]!==w||t[22]!==n?(r=(0,U.jsx)(ge,{title:`Review Changes`,headerAction:w,children:n}),t[21]=w,t[22]=n,t[23]=r):r=t[23],r}if(r.length===0){let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:S(i.compact,i.bodyMuted,`text-center`),children:`No changes to review`})}),t[24]=e):e=t[24];let n;return t[25]===w?n=t[26]:(n=(0,U.jsx)(ge,{title:`Review Changes`,headerAction:w,children:e}),t[25]=w,t[26]=n),n}let E;t[27]!==r||t[28]!==s||t[29]!==c||t[30]!==o?(E=(e,t)=>{let{isOpen:n,toggle:i}=t,a=!!e.children,l=(0,U.jsxs)(F,{onClick:()=>{a?i():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!a&&e.fileIndex===o,className:`gap-1.5`,children:[a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ee,{className:S(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,U.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!a&&e.status&&(0,U.jsx)(`span`,{className:W(e.status),children:G(e.status)})]});return a?l:(0,U.jsxs)(he,{children:[(0,U.jsx)(me,{asChild:!0,children:l}),(0,U.jsx)(z,{children:(0,U.jsxs)(B,{onClick:()=>{e.fileIndex!==void 0&&c?.(r[e.fileIndex])},children:[(0,U.jsx)(T,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[27]=r,t[28]=s,t[29]=c,t[30]=o,t[31]=E):E=t[31];let D;t[32]!==E||t[33]!==n?(D=(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,U.jsx)(ie,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:E})}),t[32]=E,t[33]=n,t[34]=D):D=t[34];let O;return t[35]!==w||t[36]!==D?(O=(0,U.jsx)(ge,{title:`Review Changes`,headerAction:w,children:D}),t[35]=w,t[36]=D,t[37]=O):O=t[37],O}function K(e,t){return e+t.hunks.reduce(xe,0)}function xe(e,t){return e+t.changes.filter(q).length}function q(e){return e.type===`delete`}function Se(e,t){return e+t.hunks.reduce(J,0)}function J(e,t){return e+t.changes.filter(Ce).length}function Ce(e){return e.type===`add`}function we(e){let t=(0,H.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,U.jsx)(ue,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Te(e){let t=(0,H.c)(36),{open:r,lineNumber:s,lineContent:c,initialComment:l,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,ee]=(0,V.useState)((l===void 0?``:l)??``),h;t[0]!==d||t[1]!==m?(h=()=>{m.trim()&&d(m.trim())},t[0]=d,t[1]=m,t[2]=h):h=t[2];let g=h,_;t[3]===g?_=t[4]:(_=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},t[3]=g,t[4]=_);let v=_,x;t[5]===p?x=t[6]:(x=e=>{e||p()},t[5]=p,t[6]=x);let C;t[7]===s?C=t[8]:(C=(0,U.jsx)(n,{children:(0,U.jsxs)(y,{children:[`Comment on line `,s]})}),t[7]=s,t[8]=C);let w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=S(i.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=w):w=t[9];let T=c||` `,E;t[10]===T?E=t[11]:(E=(0,U.jsx)(`div`,{className:w,children:T}),t[10]=T,t[11]=E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>ee(e.target.value),t[12]=D):D=t[12];let k;t[13]!==v||t[14]!==m?(k=(0,U.jsx)(ae,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:D,onKeyDown:v,rows:12,className:`resize-none text-base`}),t[13]=v,t[14]=m,t[15]=k):k=t[15];let A;t[16]!==u||t[17]!==f?(A=u&&f&&(0,U.jsx)(O,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),t[16]=u,t[17]=f,t[18]=A):A=t[18];let j;t[19]===m?j=t[20]:(j=m.trim(),t[19]=m,t[20]=j);let M=!j,N;t[21]!==g||t[22]!==M?(N=(0,U.jsx)(O,{size:`sm`,onClick:g,disabled:M,children:`Save`}),t[21]=g,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==A||t[25]!==N?(P=(0,U.jsxs)(b,{className:`gap-2 sm:gap-0`,children:[A,N]}),t[24]=A,t[25]=N,t[26]=P):P=t[26];let F;t[27]!==k||t[28]!==P||t[29]!==C||t[30]!==E?(F=(0,U.jsxs)(a,{className:`max-w-2xl`,children:[C,E,k,P]}),t[27]=k,t[28]=P,t[29]=C,t[30]=E,t[31]=F):F=t[31];let I;return t[32]!==r||t[33]!==F||t[34]!==x?(I=(0,U.jsx)(o,{open:r,onOpenChange:x,children:F}),t[32]=r,t[33]=F,t[34]=x,t[35]=I):I=t[35],I}function Ee(e,t){return`git-diff:${e}:${t}`}function Y({threadId:e,onExit:t,loadVersion:n}){let a=I(Ee(e,n),()=>v(e)),o=re(),d=ce(e=>e.diffComments),p=ce(e=>e.projectModelSelections),{resolvedTheme:m}=ne(),h=de(),[y,b]=(0,V.useState)(a.files||[]),[T,j]=(0,V.useState)(null),[M,F]=(0,V.useState)(0),[L,te]=(0,V.useState)(!1),[R,ie]=(0,V.useState)(!1),[ae,ue]=(0,V.useState)(!1),[me,z]=(0,V.useState)(!0),B=(0,V.useRef)(null);(0,V.useEffect)(()=>{z(!0)},[e]);let he=(0,V.useCallback)(e=>{F(e),h&&z(!1)},[h]),H=(0,V.useCallback)(()=>{z(!0)},[]),ge=h&&!me,ve=h&&me,ye=h&&!me,W=(0,V.useMemo)(()=>d[e]??[],[d,e]),G=(0,V.useCallback)(t=>{let n=d[e]??[],r=typeof t==`function`?t(n):t;o({type:le.SetDiffComments,threadId:e,comments:r})},[o,e,d]),[K,xe]=(0,V.useState)(null),[q,Se]=(0,V.useState)(null),[J,Ce]=(0,V.useState)(null),Y=(0,V.useRef)(null),De=(0,V.useRef)(W),Oe=(0,V.useRef)(K),ke=(0,V.useRef)({isFullView:L,selectedFileIndex:M,files:y}),X=(0,V.useRef)({original:[],modified:[]}),Ae=(0,V.useRef)(!0);(0,V.useEffect)(()=>{De.current=W},[W]),(0,V.useEffect)(()=>{Oe.current=K},[K]),(0,V.useEffect)(()=>{ke.current={isFullView:L,selectedFileIndex:M,files:y}},[L,M,y]);let je=(0,V.useCallback)(()=>{B.current&&(R?B.current.expand():B.current.collapse())},[R]),Me=(0,V.useCallback)(async()=>{if(e){j(null);try{b((await v(e)).files||[]),F(0)}catch(e){j(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ne=(0,V.useCallback)(async t=>{try{await f(e,t.path),await Me()}catch(e){j(e instanceof Error?e.message:`Failed to revert file`)}},[e,Me]),Pe=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((d[e]??[]).length>0){Pe.current=!0;return}x(e).then(t=>{t.diffComments&&t.diffComments.length>0&&o({type:le.SetDiffComments,threadId:e,comments:t.diffComments}),Pe.current=!0}).catch(()=>{Pe.current=!0})},[e]),(0,V.useEffect)(()=>{Pe.current&&l(e,{diffComments:W}).catch(()=>{})},[e,W]);let Fe=(0,V.useMemo)(()=>_e(y),[y]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Ie=(e,t,n)=>e.split(`
2
+ `).slice(t-1,n).join(`
3
+ `),Le=e=>{let t=Z(e);return t?t.startLine<=1:!0},Re=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=y[M],ze=Q?L?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Be=Q?L?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!Ae.current)return;let e=Y.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=ke.current,i=De.current,a=Oe.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?X.current.original:X.current.modified,m=e.deltaDecorations(p,d);r===`original`?X.current.original=m:X.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,W,K,M,L,Q]),(0,V.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[M]),(0,V.useEffect)(()=>()=>{Ae.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let Ve=(0,V.useCallback)(e=>{Y.current=e;let t=e=>e===P.MouseTargetType.GUTTER_GLYPH_MARGIN||e===P.MouseTargetType.GUTTER_LINE_NUMBERS||e===P.MouseTargetType.GUTTER_LINE_DECORATIONS||e===P.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=ke.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=De.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?Ce(f):Se({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{Y.current===e&&$()},150)},[$]),He=(0,V.useCallback)(e=>{if(q&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:M,lineNumber:q.lineNumber,lineContent:q.lineContent,comment:e,side:q.side};G(e=>[...e,t]),Se(null)}else J&&(G(t=>t.map(t=>t.id===J.id?{...t,comment:e}:t)),Ce(null))},[q,J,Q,M,G]),Ue=(0,V.useCallback)(()=>{J&&(G(e=>e.filter(e=>e.id!==J.id)),Ce(null))},[J,G]),We=(0,V.useCallback)(e=>{if(W.length===0)return;let t=(e%W.length+W.length)%W.length,n=W[t];xe(t),F(n.fileIndex),h&&z(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=y[n.fileIndex];if(!t)return;let r=L?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[W,y,L,$,h]),Ge=(0,V.useCallback)(()=>{We((K??0)-1)},[We,K]),Ke=(0,V.useCallback)(()=>{We((K??-1)+1)},[We,K]),qe=(0,V.useCallback)(async()=>{let n=p[e];if(!n)try{let e=await u(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:n}=await c(e,W);G([]),o({type:le.SetPendingChatMessage,message:{threadId:e,message:n,model:r,provider:i}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[W,p,o,e,t,G]),Je={readOnly:!0,renderSideBySide:!h,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(L||Le(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,U.jsxs)(se,{direction:`horizontal`,children:[(0,U.jsx)(fe,{ref:B,defaultSize:h?100:25,minSize:h?50:12,maxSize:h?100:40,collapsible:!0,collapsedSize:0,onCollapse:()=>ie(!0),onExpand:()=>ie(!1),className:S(`border-r border-transparent`,ge&&`hidden`),children:(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(be,{treeData:Fe,files:y,error:T,selectedFileIndex:M,onFileSelect:he,onRevertFile:Ne})})}),!h&&(0,U.jsx)(we,{isOpen:!R}),(0,U.jsx)(fe,{className:S(`overflow-hidden bg-transparent`,ve&&`hidden`),children:(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,U.jsxs)(oe,{className:S(`bg-transparent`,R&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ye?(0,U.jsxs)(O,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:H,children:[(0,U.jsx)(D,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,U.jsxs)(O,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:je,children:[R?(0,U.jsx)(D,{className:`h-4 w-4`}):(0,U.jsx)(C,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:S(i.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:S(`flex items-center gap-2`,R&&`ml-0`,!R&&`ml-auto`,`md:ml-auto`),children:[(0,U.jsx)(O,{variant:`ghost`,size:`sm`,onClick:()=>te(e=>!e),disabled:!Q,className:S(i.compact,`h-8 gap-1 px-2`),children:L?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(A,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`h-3 w-3`}),` Show full file`]})}),W.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(g,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsx)(O,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ge,disabled:(K??0)===0,children:(0,U.jsx)(E,{className:`h-3 w-3`})})}),(0,U.jsx)(_,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:S(i.caption,`whitespace-nowrap`),children:W.length===1?`1 Comment`:`Comment ${(K??0)+1} of ${W.length}`}),(0,U.jsxs)(g,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsx)(O,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(K??0)===W.length-1,children:(0,U.jsx)(ee,{className:`h-3 w-3`})})}),(0,U.jsx)(_,{children:`Next comment`})]})]}),W.length>0&&(0,U.jsxs)(g,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsxs)(O,{size:`sm`,onClick:qe,className:S(i.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(k,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(_,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,U.jsx)(N,{height:`100%`,language:Re(Q?.path||``),original:ze,modified:Be,theme:m===`dark`?`vs-dark`:`vs-light`,onMount:Ve,options:Je},`diff-${M}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ae&&(0,U.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,U.jsxs)(O,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>ue(!1),children:[(0,U.jsx)(s,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(pe,{})]}),!ae&&(0,U.jsxs)(g,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsxs)(O,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>ue(!0),children:[(0,U.jsx)(k,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(_,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,U.jsx)(Te,{open:q!==null||J!==null,lineNumber:J?.lineNumber??q?.lineNumber??0,lineContent:J?.lineContent??q?.lineContent??``,initialComment:J?.comment,isEditing:J!==null,onSave:He,onDelete:Ue,onClose:()=>{Se(null),Ce(null)}},`${J?.id??``}-${q?.lineNumber??``}-${q?.side??``}`)]})}function De(e){let t=(0,H.c)(11),[n,r]=(0,V.useState)(0),i;t[0]!==n||t[1]!==e.threadId?(i=function(){R(Ee(e.threadId,n)),r(Oe)},t[0]=n,t[1]=e.threadId,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(L,{}),t[3]=o):o=t[3];let s=`${e.threadId}:${n}`,c;t[4]!==n||t[5]!==e||t[6]!==s?(c=(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(Y,{...e,loadVersion:n},s)}),t[4]=n,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,U.jsx)(te,{fallbackTitle:`Failed to load review changes`,onRetry:a,children:c}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function Oe(e){return e+1}export{De as DiffView,De as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-DrLoiF9t.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DVXbmgHY.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-Be-1C1tJ.js","assets/dialogs-config-I0_cSU2z.js","assets/onboarding-CgP4bJ5F.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Do-APsQ6.js","assets/utils-CU0c_yCM.js","assets/index-jIBJk8xl.css","assets/api-DzFQRz0u.js","assets/context-menu-86TNA1D0.js","assets/ui-components-BN8dp4Bi.js","assets/explorer-view-Clm-RCAB.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ci as n,_o as r,c as i,li as a,yo as o}from"./dialogs-config-I0_cSU2z.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-Be-1C1tJ.js";import{C as u,i as d,j as f,n as p,p as m,r as h}from"./index-DVXbmgHY.js";var g=r(),_=e(o(),1),v=t(),y=(0,_.lazy)(()=>s(()=>import(`./explorer-tree-DrLoiF9t.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),b=(0,_.lazy)(()=>s(()=>import(`./explorer-view-Clm-RCAB.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function x(){let e=(0,g.c)(44),t=f(ee),r=m(),[o,s]=(0,_.useState)(null),[x,S]=(0,_.useState)(!0),{pendingExplorerPath:C,setPendingExplorerPath:w,explorerClearPath:T,setExplorerClearPath:E}=u(),D;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{S(!0)},e[0]=D):D=e[0];let O;e[1]===t?O=e[2]:(O=[t],e[1]=t,e[2]=O),(0,_.useEffect)(D,O);let k;e[3]===r?k=e[4]:(k=e=>{s(e),r&&S(!1)},e[3]=r,e[4]=k);let A=k,j;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{S(!0)},e[5]=j):j=e[5];let M=j,N,P;e[6]!==r||e[7]!==C||e[8]!==w?(N=()=>{C&&(s({name:C.split(`/`).pop()??C,path:C,type:`file`}),r&&S(!1),w(null))},P=[r,C,w],e[6]=r,e[7]=C,e[8]=w,e[9]=N,e[10]=P):(N=e[9],P=e[10]),(0,_.useEffect)(N,P);let F,I;e[11]!==T||e[12]!==r||e[13]!==o||e[14]!==E?(F=()=>{T&&(o&&(o.path===T||o.path.startsWith(T+`/`))&&(s(null),r&&S(!0)),E(null))},I=[T,r,o,E],e[11]=T,e[12]=r,e[13]=o,e[14]=E,e[15]=F,e[16]=I):(F=e[15],I=e[16]),(0,_.useEffect)(F,I);let L=r&&!x,R=r&&x,z=r?100:25,B=r?50:15,V=r?100:50,H=L&&`hidden`,U;e[17]===H?U=e[18]:(U=a(`overflow-hidden border-r border-border`,H),e[17]=H,e[18]=U);let W;e[19]!==A||e[20]!==o?.path||e[21]!==t?(W=(0,v.jsx)(i,{className:`h-full`,children:t?(0,v.jsx)(_.Suspense,{fallback:(0,v.jsx)(l,{}),children:(0,v.jsx)(y,{threadId:t,selectedPath:o?.path??null,onNodeSelect:A})}):(0,v.jsx)(`p`,{className:a(n.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=A,e[20]=o?.path,e[21]=t,e[22]=W):W=e[22];let G;e[23]!==V||e[24]!==U||e[25]!==W||e[26]!==z||e[27]!==B?(G=(0,v.jsx)(h,{defaultSize:z,minSize:B,maxSize:V,className:U,children:W}),e[23]=V,e[24]=U,e[25]=W,e[26]=z,e[27]=B,e[28]=G):G=e[28];let K;e[29]===r?K=e[30]:(K=!r&&(0,v.jsx)(p,{withHandle:!0}),e[29]=r,e[30]=K);let q=R&&`hidden`,J;e[31]===q?J=e[32]:(J=a(`overflow-hidden`,q),e[31]=q,e[32]=J);let Y;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,v.jsx)(c,{}),e[33]=Y):Y=e[33];let X=r&&!x,Z;e[34]!==o||e[35]!==X?(Z=(0,v.jsx)(_.Suspense,{fallback:Y,children:(0,v.jsx)(b,{selectedFile:o,showTreeBackButton:X,onShowTree:M})}),e[34]=o,e[35]=X,e[36]=Z):Z=e[36];let Q;e[37]!==J||e[38]!==Z?(Q=(0,v.jsx)(h,{className:J,children:Z}),e[37]=J,e[38]=Z,e[39]=Q):Q=e[39];let $;return e[40]!==G||e[41]!==K||e[42]!==Q?($=(0,v.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,v.jsxs)(d,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[G,K,Q]})}),e[40]=G,e[41]=K,e[42]=Q,e[43]=$):$=e[43],$}function ee(e){return e.selectedThreadId}export{x as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ia as t,Na as n,Pa as r,Ti as i,Zi as a,br as o,eo as s,fo as c,ii as l,mo as u,no as d,vi as f}from"./dialogs-config-B4TDFSrS.js";import{u as p}from"./onboarding-DfL8a0LZ.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-Ds_0e_bx.js";import{C as T,E,b as D,x as ee,y as O}from"./index-DOsSr4dl.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-CMsWrzLD.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-OCjPhv01.js";import{t as z}from"./ui-components-BZYnvMGc.js";var B=c(),V=e(u(),1),H=i(),U=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(a,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===r?s=n[5]:(s=l(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),n[4]=r,n[5]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==s?(c=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,H.jsx)(z.Input,{ref:t,className:s,...i})]}),n[6]=i,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});W.displayName=z.Input.displayName;var G=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=l(f.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=z.Group.displayName;var J=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=z.Separator.displayName;var Y=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=l(l(f.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=z.Item.displayName;var te=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=l(f.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function ae(e){let r=(0,B.c)(38),{items:i,isReady:a,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,d=a===void 0?!1:a,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;r[0]===s?x=r[1]:(x=function(){h.current||(h.current=!0,s())},r[0]=s,r[1]=x);let S=x,C;r[2]!==b||r[3]!==i?(C=Q(i,re(b),b),r[2]=b,r[3]=i,r[4]=C):C=r[4];let w=C,T,E;r[5]!==c||r[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],r[5]=c,r[6]=v,r[7]=T,r[8]=E):(T=r[7],E=r[8]),(0,V.useEffect)(T,E);let k;r[9]===c?k=r[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},r[9]=c,r[10]=k);let A=k,j;r[11]!==c||r[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},r[11]=c,r[12]=u,r[13]=j):j=r[13];let M=j,N;r[14]===S?N=r[15]:(N=e=>{S(),y(e.target.value)},r[14]=S,r[15]=N);let P;r[16]!==v||r[17]!==S||r[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(o,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),r[16]=v,r[17]=S,r[18]=N,r[19]=P):P=r[19];let F;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=l(f.compact,`py-4`),r[20]=F):F=r[20];let I=d?`No matches found.`:`Indexing files and folders...`,L;r[21]===I?L=r[22]:(L=(0,H.jsx)(K,{className:F,children:I}),r[21]=I,r[22]=L);let R;if(r[23]!==M||r[24]!==w){let e;r[26]===M?e=r[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:l(f.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),r[26]=M,r[27]=e),R=w.map(e),r[23]=M,r[24]=w,r[25]=R}else R=r[25];let z;r[28]===R?z=r[29]:(z=(0,H.jsx)(q,{children:R}),r[28]=R,r[29]=z);let W;r[30]!==L||r[31]!==z?(W=(0,H.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),r[30]=L,r[31]=z,r[32]=W):W=r[32];let J;return r[33]!==A||r[34]!==g||r[35]!==W||r[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),r[33]=A,r[34]=g,r[35]=W,r[36]=P,r[37]=J):J=r[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,V.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:i,level:a,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=l.has(i.path),D=f===i.path,ee=m?.dirPath===i.path&&E;return i.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:a,basePadding:10,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(i)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(d,{className:`h-3 w-3`}):(0,H.jsx)(s,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(i,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(i,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:o,dirPath:i.path,version:u(i.path),children:r=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:a+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),r.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(i.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(i.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(i),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:a,basePadding:22,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:()=>g(i),children:[(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(i,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(i,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(i),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:r,onNodeSelect:i}){let[a,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>a.get(e)??0,[a]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function ue(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function be(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&i(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,H.jsxs)(H.Fragment,{children:[we,t.map(t=>(0,H.jsx)(fe,{node:t,level:0,threadId:e,selectedPath:r,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:i,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},t.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ci as n,Ra as r,Tr as i,Va as a,_o as o,ao as s,li as c,na as l,so as u,yo as d,za as f}from"./dialogs-config-I0_cSU2z.js";import{u as p}from"./onboarding-CgP4bJ5F.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-Be-1C1tJ.js";import{C as T,E,b as D,x as ee,y as O}from"./index-DVXbmgHY.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-86TNA1D0.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-DzFQRz0u.js";import{t as z}from"./ui-components-BN8dp4Bi.js";var B=o(),V=e(d(),1),H=t(),U=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,H.jsx)(l,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=c(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,H.jsx)(z.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});W.displayName=z.Input.displayName;var G=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let r=(0,B.c)(4),i;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=c(n.bodyMuted,`py-6 text-center`),r[0]=i):i=r[0];let a;return r[1]!==e||r[2]!==t?(a=(0,H.jsx)(z.Empty,{ref:t,className:i,...e}),r[1]=e,r[2]=t,r[3]=a):a=r[3],a});K.displayName=z.Empty.displayName;var q=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=z.Group.displayName;var J=V.forwardRef((e,t)=>{let n=(0,B.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=c(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=z.Separator.displayName;var Y=V.forwardRef((e,t)=>{let r=(0,B.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=c(c(n.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,H.jsx)(z.Item,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Y.displayName=z.Item.displayName;var te=e=>{let t=(0,B.c)(8),r,i;t[0]===e?(r=t[1],i=t[2]):({className:r,...i}=e,t[0]=e,t[1]=r,t[2]=i);let a;t[3]===r?a=t[4]:(a=c(n.compact,`ml-auto tracking-widest text-muted-foreground`,r),t[3]=r,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,H.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function ae(e){let t=(0,B.c)(38),{items:o,isReady:s,onRequestIndex:l,onOpenChange:u,onSelect:d}=e,f=s===void 0?!1:s,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;t[0]===l?x=t[1]:(x=function(){h.current||(h.current=!0,l())},t[0]=l,t[1]=x);let S=x,C;t[2]!==b||t[3]!==o?(C=Q(o,re(b),b),t[2]=b,t[3]=o,t[4]=C):C=t[4];let w=C,T,E;t[5]!==u||t[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,u(e))},E=[u,v],t[5]=u,t[6]=v,t[7]=T,t[8]=E):(T=t[7],E=t[8]),(0,V.useEffect)(T,E);let k;t[9]===u?k=t[10]:(k=function(e){e||y(``),_(e),u(e),e&&requestAnimationFrame(()=>p.current?.focus())},t[9]=u,t[10]=k);let A=k,j;t[11]!==u||t[12]!==d?(j=function(e){d(e),_(!1),u(!1),y(``)},t[11]=u,t[12]=d,t[13]=j):j=t[13];let M=j,N;t[14]===S?N=t[15]:(N=e=>{S(),y(e.target.value)},t[14]=S,t[15]=N);let P;t[16]!==v||t[17]!==S||t[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(i,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),t[16]=v,t[17]=S,t[18]=N,t[19]=P):P=t[19];let F;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=c(n.compact,`py-4`),t[20]=F):F=t[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;t[21]===I?L=t[22]:(L=(0,H.jsx)(K,{className:F,children:I}),t[21]=I,t[22]=L);let R;if(t[23]!==M||t[24]!==w){let e;t[26]===M?e=t[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(a,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:c(n.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),t[26]=M,t[27]=e),R=w.map(e),t[23]=M,t[24]=w,t[25]=R}else R=t[25];let z;t[28]===R?z=t[29]:(z=(0,H.jsx)(q,{children:R}),t[28]=R,t[29]=z);let W;t[30]!==L||t[31]!==z?(W=(0,H.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),t[30]=L,t[31]=z,t[32]=W):W=t[32];let J;return t[33]!==A||t[34]!==g||t[35]!==W||t[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),t[33]=A,t[34]=g,t[35]=W,t[36]=P,t[37]=J):J=t[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,V.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:t,level:n,threadId:i,selectedPath:o,expandedPaths:c,getDirVersion:l,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=c.has(t.path),D=d===t.path,ee=m?.dirPath===t.path&&E;return t.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:n,basePadding:10,selected:o===t.path,className:t.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(t)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(u,{className:`h-3 w-3`}):(0,H.jsx)(s,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?v(t,n):b()}else e.key===`Escape`&&b()},onBlur:e=>{let n=e.target.value.trim();n?v(t,n):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:i,dirPath:t.path,version:l(t.path),children:t=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:n+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),t.map(t=>(0,H.jsx)(e,{node:t,level:n+1,threadId:i,selectedPath:o,expandedPaths:c,getDirVersion:l,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(t.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(t.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(t),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:n,basePadding:22,selected:o===t.path,className:t.ignored?`opacity-50`:void 0,onClick:()=>g(t),children:[(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:t.name,onKeyDown:e=>{if(e.key===`Enter`){let n=e.target.value.trim();n?v(t,n):b()}else e.key===`Escape`&&b()},onBlur:e=>{let n=e.target.value.trim();n?v(t,n):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:t.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(t),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(t),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:t,onNodeSelect:n}){let[i,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>i.get(e)??0,[i]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function ue(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function be(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&n(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:r=>(0,H.jsxs)(H.Fragment,{children:[we,r.map(r=>(0,H.jsx)(fe,{node:r,level:0,threadId:e,selectedPath:t,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:n,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},r.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{La as t,Ti as n,ca as r,fo as i,ii as a,li as o,mo as s,ni as c,ui as l,vi as u,ya as d}from"./dialogs-config-B4TDFSrS.js";import{S as f}from"./react-vendor-unlDVFpU.js";import{a as p,l as m,n as h,o as g}from"./history-view-Ds_0e_bx.js";import{n as _}from"./utils-umVhs9to.js";import{E as v,j as y,o as b,w as x}from"./index-DOsSr4dl.js";import{a as S,c as C,i as w}from"./api-OCjPhv01.js";var T=i(),E=e(s(),1),D=n();function O(e){return l(e)===`md`}function k(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[l(e)]??`plaintext`}function A(e,t){return`explorer-file:${e}:${t}`}function j(e){let t=(0,T.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=A(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>S(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=p(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,E.useLayoutEffect)(c,l),null}function M(e,t){return`explorer-media:${e}:${t}`}function N(e,t){let n=(0,T.c)(11),r;n[0]!==t||n[1]!==e?(r=M(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>w(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=p(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,E.useEffect)(c,l),s}function P(e){let t=(0,T.c)(3),{threadId:n,path:r,alt:i}=e,a=N(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,D.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function F(e){let t=(0,T.c)(2),{threadId:n,path:r}=e,i=N(n,r),a;return t[0]===i?a=t[1]:(a=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,D.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function I({selectedFile:e,showTreeBackButton:n=!1,onShowTree:i}){let{resolvedTheme:s}=_(),l=y(e=>e.selectedThreadId),p=(0,E.useRef)(null),[S,w]=(0,E.useState)(null),[T,N]=(0,E.useState)(!1),[I,L]=(0,E.useState)(`edit`),[R,z]=(0,E.useState)(0),B=e?o(e.path,e.name):null,V=e?.type===`file`&&l&&!B?e:null,H=S?.content??``,U=S?.original??``,W=V?`${l}:${V.path}:${R}`:null;(0,E.useEffect)(()=>()=>{p.current&&=(p.current.getModel()?.dispose(),p.current.dispose(),null)},[]),(0,E.useEffect)(()=>{e?.type===`file`?L(O(e.path)?`view`:`edit`):L(`edit`),w(null)},[e?.path,l]);async function G(){if(!(!l||!e)){N(!0);try{await C(l,e.path,H),w({content:H,original:H}),v({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{N(!1)}}}function K(){!l||!V||(g(A(l,V.path)),w(null),z(e=>e+1))}return l?(0,D.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,D.jsxs)(b,{className:`justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[n&&i?(0,D.jsxs)(c,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:i,children:[(0,D.jsx)(r,{className:`h-4 w-4`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:a(u.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,D.jsx)(`span`,{className:a(u.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),V&&S?(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[O(V.path)?(0,D.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,D.jsx)(c,{size:`sm`,variant:I===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`view`),children:`View`}),(0,D.jsx)(c,{size:`sm`,variant:I===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`edit`),children:`Edit`})]}):null,(0,D.jsxs)(c,{size:`sm`,onClick:()=>void G(),disabled:T||!H||H===U,children:[T?(0,D.jsx)(d,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),(0,D.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:V?(0,D.jsxs)(h,{fallbackTitle:`Failed to load file`,onRetry:K,children:[(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(j,{threadId:l,path:V.path,onContentReady:w},W??void 0)}),S?O(V.path)&&I===`view`?(0,D.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,D.jsx)(x,{content:H,enableMermaid:!0})}):(0,D.jsx)(f,{height:`100%`,language:k(V.path),value:H,onChange:e=>w(t=>t&&{...t,content:e??``}),onMount:e=>{p.current=e},theme:s===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,D.jsx)(m,{})]}):e?.type===`file`&&B===`image`?(0,D.jsx)(h,{fallbackTitle:`Failed to load image`,onRetry:()=>{!l||!e||g(M(l,e.path))},children:(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(P,{threadId:l,path:e.path,alt:e.name})})}):e?.type===`file`&&B===`video`?(0,D.jsx)(h,{fallbackTitle:`Failed to load video`,onRetry:()=>{!l||!e||g(M(l,e.path))},children:(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(F,{threadId:l,path:e.path})})}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,D.jsx)(t,{className:`h-10 w-10 text-muted-foreground/50`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:a(u.label,`text-muted-foreground`),children:`No file selected`}),(0,D.jsx)(`p`,{className:a(u.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})})})]}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,D.jsx)(t,{className:`h-8 w-8 text-muted-foreground`}),(0,D.jsx)(`p`,{className:u.bodyMuted,children:`Select a thread to browse its files`})]})}export{I as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ci as n,Ha as r,_o as i,hi as a,li as o,mi as s,pa as c,si as l,wa as u,yo as d}from"./dialogs-config-I0_cSU2z.js";import{S as f}from"./react-vendor-Do-APsQ6.js";import{a as p,l as m,n as h,o as g}from"./history-view-Be-1C1tJ.js";import{n as _}from"./utils-CU0c_yCM.js";import{E as v,a as y,j as b,w as x}from"./index-DVXbmgHY.js";import{a as S,c as C,i as w}from"./api-DzFQRz0u.js";var T=i(),E=e(d(),1),D=t();function O(e){return a(e)===`md`}function k(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[a(e)]??`plaintext`}function A(e,t){return`explorer-file:${e}:${t}`}function j(e){let t=(0,T.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=A(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>S(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=p(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,E.useLayoutEffect)(c,l),null}function M(e,t){return`explorer-media:${e}:${t}`}function N(e,t){let n=(0,T.c)(11),r;n[0]!==t||n[1]!==e?(r=M(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>w(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=p(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,E.useEffect)(c,l),s}function P(e){let t=(0,T.c)(3),{threadId:n,path:r,alt:i}=e,a=N(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,D.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function F(e){let t=(0,T.c)(2),{threadId:n,path:r}=e,i=N(n,r),a;return t[0]===i?a=t[1]:(a=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,D.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function I({selectedFile:e,showTreeBackButton:t=!1,onShowTree:i}){let{resolvedTheme:a}=_(),d=b(e=>e.selectedThreadId),p=(0,E.useRef)(null),[S,w]=(0,E.useState)(null),[T,N]=(0,E.useState)(!1),[I,L]=(0,E.useState)(`edit`),[R,z]=(0,E.useState)(0),B=e?s(e.path,e.name):null,V=e?.type===`file`&&d&&!B?e:null,H=S?.content??``,U=S?.original??``,W=V?`${d}:${V.path}:${R}`:null;(0,E.useEffect)(()=>()=>{p.current&&=(p.current.getModel()?.dispose(),p.current.dispose(),null)},[]),(0,E.useEffect)(()=>{e?.type===`file`?L(O(e.path)?`view`:`edit`):L(`edit`),w(null)},[e?.path,d]);async function G(){if(!(!d||!e)){N(!0);try{await C(d,e.path,H),w({content:H,original:H}),v({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{N(!1)}}}function K(){!d||!V||(g(A(d,V.path)),w(null),z(e=>e+1))}return d?(0,D.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,D.jsxs)(y,{className:`justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[t&&i?(0,D.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:i,children:[(0,D.jsx)(c,{className:`h-4 w-4`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:o(n.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,D.jsx)(`span`,{className:o(n.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),V&&S?(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[O(V.path)?(0,D.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,D.jsx)(l,{size:`sm`,variant:I===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`view`),children:`View`}),(0,D.jsx)(l,{size:`sm`,variant:I===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`edit`),children:`Edit`})]}):null,(0,D.jsxs)(l,{size:`sm`,onClick:()=>void G(),disabled:T||!H||H===U,children:[T?(0,D.jsx)(u,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),(0,D.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:V?(0,D.jsxs)(h,{fallbackTitle:`Failed to load file`,onRetry:K,children:[(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(j,{threadId:d,path:V.path,onContentReady:w},W??void 0)}),S?O(V.path)&&I===`view`?(0,D.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,D.jsx)(x,{content:H,enableMermaid:!0})}):(0,D.jsx)(f,{height:`100%`,language:k(V.path),value:H,onChange:e=>w(t=>t&&{...t,content:e??``}),onMount:e=>{p.current=e},theme:a===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,D.jsx)(m,{})]}):e?.type===`file`&&B===`image`?(0,D.jsx)(h,{fallbackTitle:`Failed to load image`,onRetry:()=>{!d||!e||g(M(d,e.path))},children:(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(P,{threadId:d,path:e.path,alt:e.name})})}):e?.type===`file`&&B===`video`?(0,D.jsx)(h,{fallbackTitle:`Failed to load video`,onRetry:()=>{!d||!e||g(M(d,e.path))},children:(0,D.jsx)(E.Suspense,{fallback:(0,D.jsx)(m,{}),children:(0,D.jsx)(F,{threadId:d,path:e.path})})}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,D.jsx)(r,{className:`h-10 w-10 text-muted-foreground/50`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:o(n.label,`text-muted-foreground`),children:`No file selected`}),(0,D.jsx)(`p`,{className:o(n.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})})})]}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,D.jsx)(r,{className:`h-8 w-8 text-muted-foreground`}),(0,D.jsx)(`p`,{className:n.bodyMuted,children:`Select a thread to browse its files`})]})}export{I as default};
@@ -0,0 +1 @@
1
+ import{Ai as e,Ar as t,Ci as n,Dr as r,Er as i,Or as a,_o as o,jr as s,kr as c,li as l,si as u,wa as d}from"./dialogs-config-I0_cSU2z.js";var f=o(),p=e();function m(e){let o=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=e,S;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(s,{children:`Commit History`}),o[0]=S):S=o[0];let C;o[1]===x?C=o[2]:(C=(0,p.jsxs)(t,{children:[S,(0,p.jsxs)(a,{children:[`Recent commits on branch `,x]})]}),o[1]=x,o[2]=C);let w;o[3]===v?w=o[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:l(n.bodyMuted,`text-center py-8`),children:`No commits found`}),o[3]=v,o[4]=w);let T;o[5]===y?T=o[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(d,{className:`h-4 w-4 animate-spin inline`})}),o[5]=y,o[6]=T);let E;o[7]!==_.length||o[8]!==v.length||o[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:l(n.caption,`p-3 text-center`),children:`Scroll to load more`}),o[7]=_.length,o[8]=v.length,o[9]=y,o[10]=E):E=o[10];let D;o[11]!==w||o[12]!==T||o[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),o[11]=w,o[12]=T,o[13]=E,o[14]=D):D=o[14];let O;o[15]!==b||o[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),o[15]=b,o[16]=D,o[17]=O):O=o[17];let k;o[18]===g?k=o[19]:(k=(0,p.jsx)(c,{children:(0,p.jsx)(u,{onClick:()=>g(!1),children:`Close`})}),o[18]=g,o[19]=k);let A;o[20]!==C||o[21]!==O||o[22]!==k?(A=(0,p.jsxs)(r,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),o[20]=C,o[21]=O,o[22]=k,o[23]=A):A=o[23];let j;return o[24]!==g||o[25]!==m||o[26]!==A?(j=(0,p.jsx)(i,{open:m,onOpenChange:g,children:A}),o[24]=g,o[25]=m,o[26]=A,o[27]=j):j=o[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:l(n.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:l(n.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:n.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-CJRMd4oA.js","assets/index-DVXbmgHY.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-Be-1C1tJ.js","assets/dialogs-config-I0_cSU2z.js","assets/onboarding-CgP4bJ5F.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Do-APsQ6.js","assets/utils-CU0c_yCM.js","assets/index-jIBJk8xl.css","assets/pull-request-dialog-ChuHHY3J.js","assets/create-repo-dialog-nLnVNRqq.js","assets/git-history-dialog-CcdMtW0o.js","assets/push-before-pr-dialog-CbtHXjDH.js","assets/pull-with-changes-dialog-Ck6aK6Q7.js","assets/merged-pr-dialog-Fj8II9Bt.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,Ai as n,C as r,Ci as i,Ht as a,Ia as o,It as s,J as c,Jn as l,Jt as ee,K as u,Ka as d,Kt as te,Lt as f,Na as p,Oi as ne,Pa as m,Rt as re,St as ie,Vt as h,Wt as ae,Yn as g,_o as _,at as oe,dr as se,fr as ce,ho as v,ir as y,ka as le,li as ue,mr as de,pr as fe,qa as pe,rr as b,si as me,so as he,sr as x,st as ge,wa as _e,yo as S,zi as ve,zt as ye}from"./dialogs-config-I0_cSU2z.js";import{r as C}from"./monaco-CZnIWXyV.js";import{A as w,E as T,_ as be,f as E,g as D,h as xe,j as O,k,m as Se,v as Ce}from"./index-DVXbmgHY.js";var A=e(S(),1),j=n();function we(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function M(e,t){return t?(0,j.jsx)(_e,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(v,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,j.jsx)(o,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(d,{className:`h-3.5 w-3.5`}):(0,j.jsx)(m,{className:`h-3.5 w-3.5`})}function Te(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function N(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function P(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ee=_();function De(e){let t=(0,Ee.c)(87),{branchStatus:n,remoteUrl:r,hasRemoteBranch:a,hasUnpushedCommits:o,canCreateRepo:s,repoUrl:c,isRefreshing:l,isBrandState:ee,gitUser:u,isDirectCommitMode:te,isLoading:f,isLoadingHistory:ne,onFetch:re,onPull:ie,onPush:h,onOpenHistory:ae,onCreatePR:g,onCreateRepo:_,onViewInGitHub:oe,onOpenChange:y,layout:b}=e,x=b===void 0?`bar`:b,ge=x===`bar`&&`w-8 rounded-l-none`,S=x===`menu`&&`w-full justify-start gap-2 rounded-md`,ye=ee&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,C;t[0]!==ge||t[1]!==S||t[2]!==ye?(C=ue(`h-8 px-1`,ge,S,ye),t[0]=ge,t[1]=S,t[2]=ye,t[3]=C):C=t[3];let w;t[4]===l?w=t[5]:(w=l?(0,j.jsx)(_e,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(he,{className:`h-3.5 w-3.5`}),t[4]=l,t[5]=w);let T;t[6]===x?T=t[7]:(T=x===`menu`&&(0,j.jsx)(`span`,{children:`More git actions`}),t[6]=x,t[7]=T);let E;t[8]!==f||t[9]!==C||t[10]!==w||t[11]!==T?(E=(0,j.jsx)(Ce,{asChild:!0,children:(0,j.jsxs)(me,{variant:`outline`,size:`sm`,className:C,disabled:f,children:[w,T]})}),t[8]=f,t[9]=C,t[10]=w,t[11]=T,t[12]=E):E=t[12];let O;t[13]!==n||t[14]!==r?(O=n===`Behind`&&(0,j.jsxs)(`div`,{className:ue(i.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,r?`origin`:`remote`]}),t[13]=n,t[14]=r,t[15]=O):O=t[15];let k;t[16]===u?k=t[17]:(k=u&&(0,j.jsxs)(`div`,{className:ue(i.compact,`px-2 py-1 text-muted-foreground`),children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,u]}),t[16]=u,t[17]=k);let A;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(be,{}),t[18]=A):A=t[18];let we;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,j.jsx)(pe,{className:`h-3.5 w-3.5 mr-2`}),t[19]=we):we=t[19];let M;t[20]!==f||t[21]!==re?(M=(0,j.jsx)(de,{asChild:!0,children:(0,j.jsxs)(D,{onClick:re,disabled:f,children:[we,`Fetch`]})}),t[20]=f,t[21]=re,t[22]=M):M=t[22];let Te;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,j.jsx)(ce,{side:`right`,children:`Download latest information from remote without merging changes`}),t[23]=Te):Te=t[23];let N;t[24]===M?N=t[25]:(N=(0,j.jsx)(fe,{children:(0,j.jsxs)(se,{children:[M,Te]})}),t[24]=M,t[25]=N);let P;t[26]!==a||t[27]!==f||t[28]!==ie?(P=()=>{a&&!f&&ie()},t[26]=a,t[27]=f,t[28]=ie,t[29]=P):P=t[29];let De=!a||f?`opacity-50 cursor-not-allowed`:``,Oe;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,j.jsx)(v,{className:`h-3.5 w-3.5 mr-2`}),t[30]=Oe):Oe=t[30];let F;t[31]!==P||t[32]!==De?(F=(0,j.jsx)(de,{asChild:!0,children:(0,j.jsxs)(D,{onClick:P,className:De,children:[Oe,`Pull`]})}),t[31]=P,t[32]=De,t[33]=F):F=t[33];let I=a?`Pull latest changes from remote`:`No remote branch to pull from`,L;t[34]===I?L=t[35]:(L=(0,j.jsx)(ce,{side:`right`,children:I}),t[34]=I,t[35]=L);let R;t[36]!==F||t[37]!==L?(R=(0,j.jsx)(fe,{children:(0,j.jsxs)(se,{children:[F,L]})}),t[36]=F,t[37]=L,t[38]=R):R=t[38];let z;t[39]!==a||t[40]!==f||t[41]!==h?(z=!a&&(0,j.jsx)(fe,{children:(0,j.jsxs)(se,{children:[(0,j.jsx)(de,{asChild:!0,children:(0,j.jsxs)(D,{onClick:h,disabled:f,children:[(0,j.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,j.jsx)(ce,{side:`right`,children:`Create remote branch and push local commits`})]})}),t[39]=a,t[40]=f,t[41]=h,t[42]=z):z=t[42];let B;t[43]!==o||t[44]!==f||t[45]!==h?(B=()=>{o&&!f&&h()},t[43]=o,t[44]=f,t[45]=h,t[46]=B):B=t[46];let ke=!o||f?`opacity-50 cursor-not-allowed`:``,Ae;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),t[47]=Ae):Ae=t[47];let V;t[48]!==B||t[49]!==ke?(V=(0,j.jsx)(de,{asChild:!0,children:(0,j.jsxs)(D,{onClick:B,className:ke,children:[Ae,`Push Commits`]})}),t[48]=B,t[49]=ke,t[50]=V):V=t[50];let je=o?f?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;t[51]===je?H=t[52]:(H=(0,j.jsx)(ce,{side:`right`,children:je}),t[51]=je,t[52]=H);let U;t[53]!==V||t[54]!==H?(U=(0,j.jsx)(fe,{children:(0,j.jsxs)(se,{children:[V,H]})}),t[53]=V,t[54]=H,t[55]=U):U=t[55];let Me=f||ne,Ne;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(le,{className:`h-3.5 w-3.5 mr-2`}),t[56]=Ne):Ne=t[56];let W;t[57]!==ae||t[58]!==Me?(W=(0,j.jsxs)(D,{onClick:ae,disabled:Me,children:[Ne,`History`]}),t[57]=ae,t[58]=Me,t[59]=W):W=t[59];let G;t[60]!==te||t[61]!==f||t[62]!==g?(G=!te&&(0,j.jsxs)(D,{onClick:g,disabled:f,children:[(0,j.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),t[60]=te,t[61]=f,t[62]=g,t[63]=G):G=t[63];let K;t[64]!==s||t[65]!==f||t[66]!==_?(K=s&&(0,j.jsxs)(D,{onClick:_,disabled:f,children:[(0,j.jsx)(p,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),t[64]=s,t[65]=f,t[66]=_,t[67]=K):K=t[67];let q;t[68]!==f||t[69]!==oe||t[70]!==c?(q=c&&(0,j.jsxs)(D,{onClick:oe,disabled:f,children:[(0,j.jsx)(d,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),t[68]=f,t[69]=oe,t[70]=c,t[71]=q):q=t[71];let J;t[72]!==k||t[73]!==N||t[74]!==R||t[75]!==z||t[76]!==U||t[77]!==W||t[78]!==G||t[79]!==K||t[80]!==q||t[81]!==O?(J=(0,j.jsxs)(xe,{align:`end`,children:[O,k,A,N,R,z,U,W,G,K,q]}),t[72]=k,t[73]=N,t[74]=R,t[75]=z,t[76]=U,t[77]=W,t[78]=G,t[79]=K,t[80]=q,t[81]=O,t[82]=J):J=t[82];let Y;return t[83]!==y||t[84]!==J||t[85]!==E?(Y=(0,j.jsxs)(Se,{onOpenChange:y,children:[E,J]}),t[83]=y,t[84]=J,t[85]=E,t[86]=Y):Y=t[86],Y}function Oe(){return{autoGenerateCommitMessage:l(),autoGeneratePRInfo:g(),privateRepositoryDefault:t()}}function F(e){e.autoGenerateCommitMessage!==void 0&&b(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&y(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&x(e.privateRepositoryDefault)}function I(e){return e?!0:(T({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function L(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function R(e,t,n){let[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)(!1),s=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:L(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await c(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}var z=(0,A.lazy)(()=>C(()=>import(`./commit-dialog-CJRMd4oA.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,A.lazy)(()=>C(()=>import(`./pull-request-dialog-ChuHHY3J.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),ke=(0,A.lazy)(()=>C(()=>import(`./create-repo-dialog-nLnVNRqq.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Ae=(0,A.lazy)(()=>C(()=>import(`./git-history-dialog-CcdMtW0o.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,A.lazy)(()=>C(()=>import(`./push-before-pr-dialog-CbtHXjDH.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),je=(0,A.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-Ck6aK6Q7.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),H=(0,A.lazy)(()=>C(()=>import(`./merged-pr-dialog-Fj8II9Bt.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function U(){return null}function Me({projectId:e,threadId:t,layout:n=`bar`}){let i=w(),o=O(e=>e.projectModelSelections[t]),c=O(t=>t.projects.find(t=>t.projectId===e)),[l,u]=(0,A.useState)(!1),[d,p]=(0,A.useState)(!1),[m,g]=(0,A.useState)(!1),[_,v]=(0,A.useState)(!1),[y,le]=(0,A.useState)(``),[pe,b]=(0,A.useState)(``),[he,x]=(0,A.useState)(``),[_e,S]=(0,A.useState)(!1),[ve,C]=(0,A.useState)(null),be=(0,A.useRef)(!1),D=(0,A.useRef)(!1),xe=(0,A.useRef)(pe),Se=(0,A.useRef)(he);xe.current=pe,Se.current=he;let[Ce,Ee]=(0,A.useState)(!1),[L,Me]=(0,A.useState)([]),[Ne,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)([]),[q,J]=(0,A.useState)(!1),[Y,Pe]=(0,A.useState)(!1),[Fe,Ie]=(0,A.useState)(``),[Le,Re]=(0,A.useState)(``),[ze,Be]=(0,A.useState)(``),[Ve,He]=(0,A.useState)(!1),[Ue,We]=(0,A.useState)(!1),[Ge,Ke]=(0,A.useState)(!1),[qe,Je]=(0,A.useState)(!1),X=E(),{fetchUnifiedStatus:Ye}=X,Z=R(t,e,o);async function Q(){te();let e=await ie();i({type:k.SetProjects,projects:e.projects})}let[$,Xe]=(0,A.useState)(()=>Oe()),Ze=c?.commitMethod===ne.Direct;(0,A.useEffect)(()=>{Y&&c?.name&&!Fe&&Ie(c.name)},[Y,c?.name,Fe]),(0,A.useEffect)(()=>{F($)},[$]);function Qe(){Ve||(He(!0),ge().then(e=>Be(e)).catch(()=>{}))}(0,A.useEffect)(()=>{if(!m){D.current=!1;return}if(m&&$.autoGenerateCommitMessage&&!y.trim()&&t&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}e()}},[m,$.autoGenerateCommitMessage,t,Z.generateCommitMessageWithAI,y]),(0,A.useEffect)(()=>{if(!_){be.current=!1;return}if(_&&$.autoGeneratePRInfo&&!xe.current.trim()&&!Se.current.trim()&&t&&!be.current){be.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(b(e.title),x(e.description),T({title:`Success`,description:`PR title and description generated`}))}e()}},[_,$.autoGeneratePRInfo,t,Z.generatePRInfoWithAI]),(0,A.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Je(!0),d&&X.prExists&&X.prState===`OPEN`&&p(!1)},[X.prExists,X.prState,t,d]),(0,A.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[d]);async function $e(){if(y.trim()&&I(t))try{u(!0),await s(t,y),le(``),g(!1),await X.fetchUnifiedStatus(!0),Q(),T({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ge&&(Ke(!1),await at())}catch(e){console.error(`Failed to commit:`,e),T({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function et(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await lt();return}if(X.hasChanges){g(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await ee(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){v(!0);return}if(X.hasUnpushedCommits&&X.prExists){await rt();return}}async function tt(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}async function nt(){if(I(t))try{u(!0),await ye(t),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function rt(){if(I(t))try{u(!0),await a(t),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?T({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):T({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),T({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function it(){if(I(t)){if(X.hasChanges){We(!0);return}await at()}}async function at(){try{u(!0),await h(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),T({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function ot(){We(!1),Ke(!0),g(!0)}async function st(){We(!1),await at()}async function ct(){if(t)try{u(!0);let e=await f(t);te();let n=await ie();i({type:k.SetProjects,projects:n.projects}),T({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Je(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),T({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{u(!1)}}async function lt(){if(I(t))try{u(!0),await ae(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Branch synced successfully`,description:`Your branch '${X.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),T({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function ut(){if(I(t))try{u(!0),p(!0);let e=await re(t,pe,he);e.prUrl&&await ee(e.prUrl),b(``),x(``),v(!1),await X.fetchUnifiedStatus(!0),Q();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(v(!1),pt({title:pe,description:he})):(p(!1),T({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function dt(){if(I(t))try{u(!0);let e=await r(t,Fe,Le,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{ee(e.repoUrl)},3e3),Ie(``),Re(``),Pe(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function ft(){let e=await Z.generatePRInfoWithAI();e&&(b(e.title),x(e.description),T({title:`Success`,description:`PR title and description generated`}))}async function pt(e){let n=e??ve;if(!(!t||!n))try{u(!0),p(!0);try{await a(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){T({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ae(t),await a(t)}catch{throw e}}else throw e}let e=await re(t,n.title,n.description);e.prUrl&&await ee(e.prUrl),b(``),x(``),C(null),S(!1),await X.fetchUnifiedStatus(!0),Q();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;p(!1),T({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function mt(){if(I(t))try{W(!0);let e=await oe(t,100);Me(e),K(e.slice(0,10)),Ee(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{W(!1)}}function ht(){q||(J(!0),setTimeout(()=>{let e=G.length+10;K(L.slice(0,e)),J(!1)},300))}function gt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&G.length<L.length&&!q&&ht()}let _t=P(X);function vt(){X.repoUrl&&ee(X.repoUrl)}function yt(){S(!1),C(null)}function bt(){Je(!1),X.fetchUnifiedStatus(!0)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:ue(`flex items-center gap-0`,n===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,j.jsx)(fe,{children:(0,j.jsxs)(se,{children:[(0,j.jsx)(de,{asChild:!0,children:(0,j.jsxs)(me,{variant:`outline`,size:`sm`,className:ue(`h-8 gap-1.5`,n===`bar`&&`rounded-r-none border-r-0`,n===`menu`&&`rounded-md border`,_t&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:N(X,l,d),onClick:et,children:[M(X,d),we(X,d)]})}),(0,j.jsx)(ce,{children:Te(X)})]})}),(0,j.jsx)(De,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:_t,gitUser:ze,isDirectCommitMode:Ze,isLoading:l||d,isLoadingHistory:Ne,onFetch:()=>void nt(),onPull:()=>void it(),onPush:()=>void rt(),onOpenHistory:()=>void mt(),onCreatePR:()=>v(!0),onCreateRepo:()=>Pe(!0),onViewInGitHub:vt,onOpenChange:e=>{e&&(Qe(),Ye(!0))},layout:n})]}),m&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(z,{open:m,onOpenChange:g,commitMessage:y,onCommitMessageChange:le,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Xe(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:l,onGenerateMessage:tt,onCommit:$e,currentBranch:X.currentBranch})}),_&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(B,{open:_,onOpenChange:v,prTitle:pe,onPrTitleChange:b,prDescription:he,onPrDescriptionChange:x,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:l,onGeneratePRInfo:ft,onCreatePR:ut,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Xe(t=>({...t,autoGeneratePRInfo:e}))})}),_e&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(V,{open:_e,onOpenChange:S,isLoading:l,onPushAndCreatePR:pt,onCancel:yt})}),Y&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(ke,{open:Y,onOpenChange:Pe,repoName:Fe,onRepoNameChange:Ie,repoDescription:Le,onRepoDescriptionChange:Re,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Xe(t=>({...t,privateRepositoryDefault:e})),isLoading:l,onCreateRepo:dt})}),Ce&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Ae,{open:Ce,onOpenChange:Ee,commits:L,displayedCommits:G,isLoadingMore:q,onScroll:gt,currentBranch:X.currentBranch})}),Ue&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(je,{open:Ue,onOpenChange:We,onCommitFirst:ot,onStashAndPull:st,onCancel:()=>We(!1),isLoading:l})}),qe&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(H,{open:qe,onOpenChange:Je,onNewBranch:ct,onJustOpen:bt,isLoading:l})})]})}export{Me as GitOpsButton};
@@ -0,0 +1,7 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as n,Br as r,Ci as i,Fi as a,Fr as o,Hi as s,Hr as c,Ir as l,Kr as u,Lr as d,Mi as f,Mr as p,Nr as m,Pr as h,Qr as g,Rr as _,Si as v,Ur as y,Vr as b,Wr as x,Xa as S,Yr as C,Zr as w,_ as T,_o as E,_r as D,ai as O,ao as k,br as A,c as ee,ci as j,co as M,dr as N,ei as P,fr as te,hr as F,ii as I,io as L,l as R,li as z,mr as ne,ni as re,oi as B,oo as ie,pr as ae,qr as oe,ri as se,rt as ce,s as le,si as ue,so as de,ti as fe,u as pe,vo as me,vr as he,wa as ge,xr as _e,yo as ve,yr as ye,zr as be}from"./dialogs-config-I0_cSU2z.js";var V=E(),H=e(ve(),1),U=n(),xe=`AlertDialog`,[Se,Ce]=O(xe,[b]),W=b(),we=e=>{let{__scopeAlertDialog:t,...n}=e,r=W(t);return(0,U.jsx)(d,{...r,...n,modal:!0})};we.displayName=xe;var Te=`AlertDialogTrigger`,Ee=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=W(n);return(0,U.jsx)(be,{...i,...r,ref:t})});Ee.displayName=Te;var De=`AlertDialogPortal`,Oe=e=>{let{__scopeAlertDialog:t,...n}=e,r=W(t);return(0,U.jsx)(l,{...r,...n})};Oe.displayName=De;var ke=`AlertDialogOverlay`,Ae=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=W(n);return(0,U.jsx)(o,{...i,...r,ref:t})});Ae.displayName=ke;var je=`AlertDialogContent`,[Me,Ne]=Se(je),Pe=fe(`AlertDialogContent`),Fe=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:i,...a}=e,o=W(n),s=H.useRef(null),c=f(t,s),l=H.useRef(null);return(0,U.jsx)(r,{contentName:je,titleName:Ie,docsSlug:`alert-dialog`,children:(0,U.jsx)(Me,{scope:n,cancelRef:l,children:(0,U.jsxs)(m,{role:`alertdialog`,...o,...a,ref:c,onOpenAutoFocus:B(a.onOpenAutoFocus,e=>{e.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,U.jsx)(Pe,{children:i}),(0,U.jsx)(We,{contentRef:s})]})})})});Fe.displayName=je;var Ie=`AlertDialogTitle`,Le=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=W(n);return(0,U.jsx)(_,{...i,...r,ref:t})});Le.displayName=Ie;var Re=`AlertDialogDescription`,ze=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=W(n);return(0,U.jsx)(h,{...i,...r,ref:t})});ze.displayName=Re;var Be=`AlertDialogAction`,Ve=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=W(n);return(0,U.jsx)(p,{...i,...r,ref:t})});Ve.displayName=Be;var He=`AlertDialogCancel`,Ue=H.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Ne(He,n),a=W(n),o=f(t,i);return(0,U.jsx)(p,{...a,...r,ref:o})});Ue.displayName=He;var We=({contentRef:e})=>{let t=`\`${je}\` requires a description for the component to be accessible for screen reader users.
2
+
3
+ You can add a description to the \`${je}\` by passing a \`${Re}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
+
5
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${je}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
+
7
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return H.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Ge=we,Ke=Oe,qe=Ae,Je=Fe,Ye=Ve,Xe=Ue,Ze=Le,Qe=ze,$e=Ge,et=Ke,tt=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(qe,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});tt.displayName=qe.displayName;var nt=H.forwardRef((e,t)=>{let n=(0,V.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,U.jsx)(tt,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=z(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,U.jsxs)(et,{children:[a,(0,U.jsx)(Je,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});nt.displayName=Je.displayName;var rt=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};rt.displayName=`AlertDialogHeader`;var it=e=>{let t=(0,V.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=z(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,U.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};it.displayName=`AlertDialogFooter`;var at=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(i.dialogTitle,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(Ze,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});at.displayName=Ze.displayName;var ot=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(i.dialogDescription,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(Qe,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ot.displayName=Qe.displayName;var st=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(j(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(Ye,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});st.displayName=Ye.displayName;var ct=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(j({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(Xe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ct.displayName=Xe.displayName;function lt(e){let t=(0,V.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(v.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,U.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ut(e){let t=(0,V.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(v.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,U.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function dt(e){let t=(0,V.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(v.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,U.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ft(e){let t=(0,V.c)(16),{title:n,description:r,action:a,className:o,titleClassName:s}=e,c;t[0]===o?c=t[1]:(c=z(`flex items-center justify-between mb-6`,o),t[0]=o,t[1]=c);let l;t[2]===s?l=t[3]:(l=z(i.pageTitle,s),t[2]=s,t[3]=l);let u;t[4]!==l||t[5]!==n?(u=(0,U.jsx)(`h1`,{className:l,children:n}),t[4]=l,t[5]=n,t[6]=u):u=t[6];let d;t[7]===r?d=t[8]:(d=r?(0,U.jsx)(`p`,{className:i.pageSubtitle,children:r}):null,t[7]=r,t[8]=d);let f;t[9]!==u||t[10]!==d?(f=(0,U.jsxs)(`div`,{children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,U.jsxs)(`div`,{className:c,children:[f,a]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function pt(e){let t=(0,V.c)(5),{title:n,className:r}=e,a;t[0]===r?a=t[1]:(a=z(i.sectionTitle,`mb-3`,r),t[0]=r,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,U.jsx)(`h2`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function mt(e){let t=(0,V.c)(6),{children:n,variant:r,className:a}=e,o=r===void 0?`info`:r,s;t[0]!==a||t[1]!==o?(s=z(o===`hint`?i.hintBanner:o===`success`?z(i.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):o===`error`?z(i.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):i.infoBanner,a),t[0]=a,t[1]=o,t[2]=s):s=t[2];let c;return t[3]!==n||t[4]!==s?(c=(0,U.jsx)(`div`,{className:s,children:n}),t[3]=n,t[4]=s,t[5]=c):c=t[5],c}function ht(e){let t=(0,V.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,U.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function gt(e){let t=(0,V.c)(10),{children:n,title:r,action:a}=e,o;t[0]===r?o=t[1]:(o=r?(0,U.jsx)(`h2`,{className:z(i.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=o);let s;t[2]===n?s=t[3]:(s=(0,U.jsx)(`p`,{className:i.bodyMuted,children:n}),t[2]=n,t[3]=s);let c;t[4]===a?c=t[5]:(c=a?(0,U.jsx)(`div`,{className:`mt-4`,children:a}):null,t[4]=a,t[5]=c);let l;return t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,U.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,U.jsxs)(`div`,{className:`text-center`,children:[o,s,c]})}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function _t(e){let t=(0,V.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=z(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,U.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function vt(e){let t=(0,V.c)(14),{title:n,description:r,action:a,children:o,className:s}=e,c;t[0]===n?c=t[1]:(c=(0,U.jsx)(pt,{title:n,className:`mb-1`}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=r?(0,U.jsx)(`p`,{className:i.bodyMuted,children:r}):null,t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==a||t[8]!==u?(d=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[u,a]}),t[7]=a,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==o||t[11]!==s||t[12]!==d?(f=(0,U.jsxs)(`div`,{className:s,children:[d,o]}),t[10]=o,t[11]=s,t[12]=d,t[13]=f):f=t[13],f}var yt=e(me(),1);function bt(e){let t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],St=[` `,`Enter`],G=`Select`,[Ct,wt,Tt]=le(G),[K,Et]=O(G,[Tt,_e]),Dt=_e(),[Ot,q]=K(G),[kt,At]=K(G),jt=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Dt(t),[g,_]=H.useState(null),[v,y]=H.useState(null),[b,x]=H.useState(!1),S=pe(l),[C,w]=re({prop:r,defaultProp:i??!1,onChange:a,caller:G}),[T,E]=re({prop:o,defaultProp:s,onChange:c,caller:G}),D=H.useRef(null),O=g?m||!!g.closest(`form`):!0,[k,ee]=H.useState(new Set),j=Array.from(k).map(e=>e.props.value).join(`;`);return(0,U.jsx)(A,{...h,children:(0,U.jsxs)(Ot,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:se(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,U.jsx)(Ct.Provider,{scope:t,children:(0,U.jsx)(kt,{scope:e.__scopeSelect,onNativeOptionAdd:H.useCallback(e=>{ee(t=>new Set(t).add(e))},[]),onNativeOptionRemove:H.useCallback(e=>{ee(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,U.jsxs)(wn,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,U.jsx)(`option`,{value:``}):null,Array.from(k)]},j):null]})})};jt.displayName=G;var Mt=`SelectTrigger`,Nt=H.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Dt(n),o=q(Mt,n),s=o.disabled||r,c=f(t,o.onTriggerChange),l=wt(n),u=H.useRef(`touch`),[d,p,m]=En(e=>{let t=l().filter(e=>!e.disabled),n=Dn(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),h=e=>{s||(o.onOpenChange(!0),m()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,U.jsx)(D,{asChild:!0,...a,children:(0,U.jsx)(g.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Tn(o.value)?``:void 0,...i,ref:c,onClick:B(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&h(e)}),onPointerDown:B(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(h(e),e.preventDefault())}),onKeyDown:B(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&xt.includes(e.key)&&(h(),e.preventDefault())})})})});Nt.displayName=Mt;var Pt=`SelectValue`,Ft=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=q(Pt,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=f(t,c.onValueNodeChange);return I(()=>{l(u)},[l,u]),(0,U.jsx)(g.span,{...s,ref:d,style:{pointerEvents:`none`},children:Tn(c.value)?(0,U.jsx)(U.Fragment,{children:o}):a})});Ft.displayName=Pt;var It=`SelectIcon`,Lt=H.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,U.jsx)(g.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Lt.displayName=It;var Rt=`SelectPortal`,zt=e=>(0,U.jsx)(u,{asChild:!0,...e});zt.displayName=Rt;var J=`SelectContent`,Bt=H.forwardRef((e,t)=>{let n=q(J,e.__scopeSelect),[r,i]=H.useState();if(I(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?yt.createPortal((0,U.jsx)(Vt,{scope:e.__scopeSelect,children:(0,U.jsx)(Ct.Slot,{scope:e.__scopeSelect,children:(0,U.jsx)(`div`,{children:e.children})})}),t):null}return(0,U.jsx)(Wt,{...e,ref:t})});Bt.displayName=J;var Y=10,[Vt,X]=K(J),Ht=`SelectContentImpl`,Ut=P(`SelectContent.RemoveScroll`),Wt=H.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v,...b}=e,S=q(J,n),[w,T]=H.useState(null),[E,D]=H.useState(null),O=f(t,e=>T(e)),[k,A]=H.useState(null),[ee,j]=H.useState(null),M=wt(n),[N,P]=H.useState(!1),te=H.useRef(!1);H.useEffect(()=>{if(w)return c(w)},[w]),x();let F=H.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&E&&(E.scrollTop=0),n===r&&E&&(E.scrollTop=E.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,E]),I=H.useCallback(()=>F([k,w]),[F,k,w]);H.useEffect(()=>{N&&I()},[N,I]);let{onOpenChange:L,triggerPointerDownPosRef:R}=S;H.useEffect(()=>{if(w){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(R.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(R.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():w.contains(n.target)||L(!1),document.removeEventListener(`pointermove`,t),R.current=null};return R.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[w,L,R]),H.useEffect(()=>{let e=()=>L(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[L]);let[z,ne]=En(e=>{let t=M().filter(e=>!e.disabled),n=Dn(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),re=H.useCallback((e,t,n)=>{let r=!te.current&&!n;(S.value!==void 0&&S.value===t||r)&&(A(e),r&&(te.current=!0))},[S.value]),ie=H.useCallback(()=>w?.focus(),[w]),ae=H.useCallback((e,t,n)=>{let r=!te.current&&!n;(S.value!==void 0&&S.value===t||r)&&j(e)},[S.value]),se=r===`popper`?Jt:Kt,ce=se===Jt?{side:s,sideOffset:l,align:u,alignOffset:d,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:v}:{};return(0,U.jsx)(Vt,{scope:n,content:w,viewport:E,onViewportChange:D,itemRefCallback:re,selectedItem:k,onItemLeave:ie,itemTextRefCallback:ae,focusSelectedItem:I,selectedItemText:ee,position:r,isPositioned:N,searchRef:z,children:(0,U.jsx)(y,{as:Ut,allowPinchZoom:!0,children:(0,U.jsx)(oe,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:B(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,U.jsx)(C,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,U.jsx)(se,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...b,...ce,onPlaced:()=>P(!0),ref:O,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:B(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})});Wt.displayName=Ht;var Gt=`SelectItemAlignedPosition`,Kt=H.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=q(J,n),o=X(J,n),[s,c]=H.useState(null),[l,u]=H.useState(null),d=f(t,e=>u(e)),p=wt(n),m=H.useRef(!1),h=H.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=o,x=H.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&y){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=y.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=R(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Y,d=R(a,[Y,Math.max(Y,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=p(),c=window.innerHeight-Y*2,u=_.scrollHeight,d=window.getComputedStyle(l),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+u+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=c-E,O=v.offsetHeight/2,k=v.offsetTop+O,A=f+h+k,ee=x-A;if(A<=E){let e=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+g);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+ee;s.style.height=t+`px`,_.scrollTop=A-E+_.offsetTop}s.style.margin=`${Y}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,a.trigger,a.valueNode,s,l,_,v,y,a.dir,r]);I(()=>x(),[x]);let[S,C]=H.useState();return I(()=>{l&&C(window.getComputedStyle(l).zIndex)},[l]),(0,U.jsx)(Yt,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:H.useCallback(e=>{e&&h.current===!0&&(x(),b?.(),h.current=!1)},[x,b]),children:(0,U.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,U.jsx)(g.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Kt.displayName=Gt;var qt=`SelectPopperPosition`,Jt=H.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=Dt(n);return(0,U.jsx)(ye,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Jt.displayName=qt;var[Yt,Xt]=K(J,{}),Zt=`SelectViewport`,Qt=H.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=X(Zt,n),o=Xt(Zt,n),s=f(t,a.onViewportChange),c=H.useRef(0);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,U.jsx)(Ct.Slot,{scope:n,children:(0,U.jsx)(g.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:B(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Qt.displayName=Zt;var $t=`SelectGroup`,[en,tn]=K($t),nn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=se();return(0,U.jsx)(en,{scope:n,id:i,children:(0,U.jsx)(g.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});nn.displayName=$t;var rn=`SelectLabel`,an=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=tn(rn,n);return(0,U.jsx)(g.div,{id:i.id,...r,ref:t})});an.displayName=rn;var on=`SelectItem`,[sn,cn]=K(on),ln=H.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=q(on,n),c=X(on,n),l=s.value===r,[u,d]=H.useState(a??``),[p,m]=H.useState(!1),h=f(t,e=>c.itemRefCallback?.(e,r,i)),_=se(),v=H.useRef(`touch`),y=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,U.jsx)(sn,{scope:n,value:r,disabled:i,textId:_,isSelected:l,onItemTextChange:H.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,U.jsx)(Ct.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,U.jsx)(g.div,{role:`option`,"aria-labelledby":_,"data-highlighted":p?``:void 0,"aria-selected":l&&p,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:h,onFocus:B(o.onFocus,()=>m(!0)),onBlur:B(o.onBlur,()=>m(!1)),onClick:B(o.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:B(o.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:B(o.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:B(o.onPointerMove,e=>{v.current=e.pointerType,i?c.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:B(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:B(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(St.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});ln.displayName=on;var un=`SelectItemText`,dn=H.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=q(un,n),s=X(un,n),c=cn(un,n),l=At(un,n),[u,d]=H.useState(null),p=f(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=u?.textContent,h=H.useMemo(()=>(0,U.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:_,onNativeOptionRemove:v}=l;return I(()=>(_(h),()=>v(h)),[_,v,h]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?yt.createPortal(a.children,o.valueNode):null]})});dn.displayName=un;var fn=`SelectItemIndicator`,pn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return cn(fn,n).isSelected?(0,U.jsx)(g.span,{"aria-hidden":!0,...r,ref:t}):null});pn.displayName=fn;var mn=`SelectScrollUpButton`,hn=H.forwardRef((e,t)=>{let n=X(mn,e.__scopeSelect),r=Xt(mn,e.__scopeSelect),[i,a]=H.useState(!1),o=f(t,r.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(vn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});hn.displayName=mn;var gn=`SelectScrollDownButton`,_n=H.forwardRef((e,t)=>{let n=X(gn,e.__scopeSelect),r=Xt(gn,e.__scopeSelect),[i,a]=H.useState(!1),o=f(t,r.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,U.jsx)(vn,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});_n.displayName=gn;var vn=H.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=H.useRef(null),s=wt(n),c=H.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return H.useEffect(()=>()=>c(),[c]),I(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,U.jsx)(g.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:B(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:B(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:B(i.onPointerLeave,()=>{c()})})}),yn=`SelectSeparator`,bn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,U.jsx)(g.div,{"aria-hidden":!0,...r,ref:t})});bn.displayName=yn;var xn=`SelectArrow`,Sn=H.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Dt(n),a=q(xn,n),o=X(xn,n);return a.open&&o.position===`popper`?(0,U.jsx)(he,{...i,...r,ref:t}):null});Sn.displayName=xn;var Cn=`SelectBubbleInput`,wn=H.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=H.useRef(null),a=f(r,i),o=bt(t);return H.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,U.jsx)(g.select,{...n,style:{...F,...n.style},ref:a,defaultValue:t})});wn.displayName=Cn;function Tn(e){return e===``||e===void 0}function En(e){let t=w(e),n=H.useRef(``),r=H.useRef(0),i=H.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=H.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return H.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function Dn(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=On(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function On(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var kn=jt,An=Nt,jn=Ft,Mn=Lt,Nn=zt,Pn=Bt,Fn=Qt,In=an,Ln=ln,Rn=dn,zn=pn,Bn=hn,Vn=_n,Hn=bn,Un=kn,Wn=jn,Gn=H.forwardRef((e,t)=>{let n=(0,V.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=z(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(Mn,{asChild:!0,children:(0,U.jsx)(de,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,U.jsxs)(An,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Gn.displayName=An.displayName;var Kn=H.forwardRef((e,t)=>{let n=(0,V.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(L,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,U.jsx)(Bn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Kn.displayName=Bn.displayName;var qn=H.forwardRef((e,t)=>{let n=(0,V.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(de,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,U.jsx)(Vn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});qn.displayName=Vn.displayName;var Jn=H.forwardRef((e,t)=>{let n=(0,V.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=z(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,U.jsx)(Kn,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,f;n[9]===d?f=n[10]:(f=z(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,U.jsx)(Fn,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,U.jsx)(qn,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,U.jsx)(Nn,{children:(0,U.jsxs)(Pn,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});Jn.displayName=Pn.displayName;var Yn=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(In,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Yn.displayName=In.displayName;var Xn=H.forwardRef((e,t)=>{let n=(0,V.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=z(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,U.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,U.jsx)(zn,{children:(0,U.jsx)(M,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,U.jsx)(Rn,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,U.jsxs)(Ln,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});Xn.displayName=Ln.displayName;var Zn=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zn.displayName=Hn.displayName;function Qn(e){let t=(0,V.c)(14),{className:n,label:r,size:a}=e,o=a===void 0?`md`:a,s=o===`sm`?`h-4 w-4`:o===`lg`?`h-8 w-8`:`h-6 w-6`,c;t[0]===n?c=t[1]:(c=z(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=c);let l;t[2]===s?l=t[3]:(l=z(s,`animate-spin mx-auto text-muted-foreground`),t[2]=s,t[3]=l);let u;t[4]===l?u=t[5]:(u=(0,U.jsx)(ge,{className:l}),t[4]=l,t[5]=u);let d;t[6]===r?d=t[7]:(d=r?(0,U.jsx)(`p`,{className:z(i.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=d);let f;t[8]!==u||t[9]!==d?(f=(0,U.jsxs)(`div`,{className:`text-center`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;return t[11]!==c||t[12]!==f?(p=(0,U.jsx)(`div`,{className:c,children:f}),t[11]=c,t[12]=f,t[13]=p):p=t[13],p}function $n(){let e=(0,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(er)}),e[0]=t):t=e[0],t}function er(e){return(0,U.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function tr(){let e=(0,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Z=new Map;function nr(e,t){let n=Z.get(e);return n||(n={promise:t().catch(t=>{throw Z.delete(e),t})},Z.set(e,n)),n.promise}function rr(e){Z.delete(e)}function ir(e){for(let t of Z.keys())t.startsWith(e)&&Z.delete(t)}function ar(e,t){return(0,H.use)(nr(e,t))}var or=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});or.displayName=`Card`;var sr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sr.displayName=`CardHeader`;var cr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(i.sectionTitle,`leading-none tracking-tight`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(`div`,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});cr.displayName=`CardTitle`;var lr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(i.bodyMuted,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(`div`,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});lr.displayName=`CardDescription`;var ur=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ur.displayName=`CardContent`;var dr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dr.displayName=`CardFooter`;var fr=class extends H.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(or,{className:`max-w-md`,children:[(0,U.jsx)(sr,{children:(0,U.jsx)(cr,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,U.jsxs)(ur,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:i.body,children:e.message}),(0,U.jsx)(ue,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},pr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(`w-full caption-bottom`,i.body,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,U.jsx)(`table`,{ref:t,className:o,...a})}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});pr.displayName=`Table`;var mr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});mr.displayName=`TableHeader`;var hr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hr.displayName=`TableBody`;var gr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});gr.displayName=`TableFooter`;var _r=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_r.displayName=`TableRow`;var Q=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=z(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var vr=H.forwardRef((e,t)=>{let n=(0,V.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=z(i.caption,`mt-4`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,U.jsx)(`caption`,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});vr.displayName=`TableCaption`;var yr=t({ConversationHistoryView:()=>Dr,default:()=>Dr}),br=`__ALL_PROJECTS__`;function xr(e){let t=(0,V.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,U.jsx)(U.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,U.jsxs)(U.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function Sr(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Cr(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ce(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function wr(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function Tr(e,t){if(e.type===`thread`)return await ce(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await Cr(n.threads);return{threadId:e.projectId,...r}}return{threadId:br,...await Cr(t.flatMap(e=>e.threads))}}function Er(e){let t=(0,V.c)(45),{scope:n,projects:r,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:s}=e,c;t[0]!==a||t[1]!==n?(c=wr(n,a),t[0]=a,t[1]=n,t[2]=c):c=t[2];let l;t[3]!==r||t[4]!==n?(l=()=>Tr(n,r),t[3]=r,t[4]=n,t[5]=l):l=t[5];let u=ar(c,l),d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(e){return new Date(e).toLocaleString()},t[6]=d):d=t[6];let f=d,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(e,t){let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},t[7]=p):p=t[7];let m=p,h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=h):h=t[8];let g=h,_;t[9]!==o||t[10]!==u.messages||t[11]!==s?(_=function(){u.messages&&o<u.messages.length-1&&s(o+1)},t[9]=o,t[10]=u.messages,t[11]=s,t[12]=_):_=t[12];let v=_,y;t[13]!==o||t[14]!==s?(y=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=y):y=t[15];let b=y;if(!u.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,U.jsx)(`h3`,{className:i.emptyStateTitle,children:`No history`}),(0,U.jsx)(`p`,{className:i.bodyMuted,children:`No conversation history found for this thread.`})]})}),t[16]=e):e=t[16],e}let x=o===0,C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,U.jsx)(ie,{className:`h-4 w-4 mr-1`}),t[17]=C):C=t[17];let w;t[18]!==b||t[19]!==x?(w=(0,U.jsx)(ue,{variant:`outline`,size:`sm`,onClick:b,disabled:x,children:C}),t[18]=b,t[19]=x,t[20]=w):w=t[20];let T=o>=u.messages.length-1,E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,U.jsx)(k,{className:`h-4 w-4 ml-1`}),t[21]=E):E=t[21];let D;t[22]!==v||t[23]!==T?(D=(0,U.jsx)(ue,{variant:`outline`,size:`sm`,onClick:v,disabled:T,children:E}),t[22]=v,t[23]=T,t[24]=D):D=t[24];let O;t[25]!==w||t[26]!==D?(O=(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,D]}),t[25]=w,t[26]=D,t[27]=O):O=t[27];let A=o+1,j;t[28]!==u.messages.length||t[29]!==A?(j=(0,U.jsxs)(`div`,{className:i.bodyMuted,children:[A,` of `,u.messages.length,` messages`]}),t[28]=u.messages.length,t[29]=A,t[30]=j):j=t[30];let M;t[31]!==O||t[32]!==j?(M=(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[O,j]}),t[31]=O,t[32]=j,t[33]=M):M=t[33];let P;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,U.jsx)(mr,{children:(0,U.jsxs)(_r,{children:[(0,U.jsx)(Q,{children:`Prompt`}),(0,U.jsx)(Q,{children:`Answer`}),(0,U.jsx)(Q,{className:`w-24`,children:`Model`}),(0,U.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,U.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,U.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,U.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[34]=P):P=t[34];let F;if(t[35]!==o||t[36]!==u.messages){let e;t[38]===o?e=t[39]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=g(e);return(0,U.jsxs)(_r,{className:t===o?`bg-muted/50`:``,children:[(0,U.jsx)($,{className:`max-w-md`,children:(0,U.jsx)(`div`,{className:i.body,children:(0,U.jsx)(xr,{text:e.request.message})})}),(0,U.jsx)($,{className:`max-w-md`,children:e.response?(0,U.jsx)(`div`,{className:i.body,children:(0,U.jsx)(xr,{text:e.response.content})}):(0,U.jsx)(`span`,{className:z(i.bodyMuted,`italic`),children:`No response`})}),(0,U.jsx)($,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(S,{className:`h-3 w-3 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,U.jsx)($,{className:z(i.caption,`text-right`),children:e.response?(0,U.jsx)(ae,{children:(0,U.jsxs)(N,{children:[(0,U.jsx)(ne,{asChild:!0,children:(0,U.jsx)(`div`,{className:`cursor-help`,children:m(e.timestamp,e.response.completedAt).display})}),(0,U.jsx)(te,{children:(0,U.jsx)(`p`,{children:m(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,U.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,U.jsx)($,{className:z(i.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,U.jsx)($,{className:z(i.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,U.jsx)($,{className:z(i.bodyMuted,`text-right`),children:f(e.timestamp)})]},e.id)},t[38]=o,t[39]=e),F=u.messages.map(e),t[35]=o,t[36]=u.messages,t[37]=F}else F=t[37];let I;t[40]===F?I=t[41]:(I=(0,U.jsx)(ee,{className:`h-full`,children:(0,U.jsx)(`div`,{className:`py-4`,children:(0,U.jsxs)(pr,{children:[P,(0,U.jsx)(hr,{children:F})]})})}),t[40]=F,t[41]=I);let L;return t[42]!==M||t[43]!==I?(L=(0,U.jsxs)(U.Fragment,{children:[M,I]}),t[42]=M,t[43]=I,t[44]=L):L=t[44],L}var Dr=(0,H.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:o}){let[c,l]=(0,H.useState)(0),[u,d]=(0,H.useState)(``),[f,p]=(0,H.useState)(``),[m,h]=(0,H.useState)(!1),[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(0),[b,x]=(0,H.useState)(null),[S,C]=(0,H.useState)(null),w=(0,H.useMemo)(()=>f?{type:`thread`,threadId:f}:u===br?{type:`all`}:u?{type:`project`,projectId:u}:null,[u,f]),E=w?wr(w,v):null;(0,H.useEffect)(()=>{e&&n?n.type===`thread`?(p(n.id),d(``),l(0)):n.type===`project`&&(d(n.id),p(``),l(0)):e&&!n?(d(br),p(``),l(0)):e||(p(``),d(``),l(0),C(null),x(null))},[e,n]);let D=e=>{p(e),d(``),l(0),x(null),C(null)},O=e=>{d(e),p(``),l(0),x(null),C(null)},k=(0,H.useCallback)(()=>{if(f){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===f),t=r.find(e=>e.threads.some(e=>e.threadId===f)),n=e?Sr(e,t?.name??t?.projectId??``):f;return{options:{threadId:f},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(u&&u!==br){let e=r.find(e=>e.projectId===u)?.name??u;return{options:{projectId:u},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,u,f]),A=(0,H.useCallback)(async()=>{let e=k();_(!0),C(null);try{await T(e.options),E&&rr(E),x(E),l(0),h(!1)}catch(e){C(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{_(!1)}},[k,E]);function ee(){w&&rr(wr(w,v)),y(e=>e+1),x(null),C(null)}let j=k();if(!e)return null;let M=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Un,{value:u,onValueChange:O,children:[(0,U.jsx)(Gn,{className:`w-48`,children:(0,U.jsx)(Wn,{placeholder:`Select project`})}),(0,U.jsxs)(Jn,{children:[(0,U.jsx)(Xn,{value:br,children:`All Projects`}),r.map(e=>(0,U.jsx)(Xn,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,U.jsxs)(Un,{value:f,onValueChange:D,children:[(0,U.jsx)(Gn,{className:`w-48`,children:(0,U.jsx)(Wn,{placeholder:`Select thread`})}),(0,U.jsx)(Jn,{children:r.flatMap(e=>e.threads.map(t=>(0,U.jsx)(Xn,{value:t.threadId,children:Sr(t,e.name??e.projectId)},t.threadId)))})]}),(0,U.jsxs)(ue,{variant:`outline`,size:`sm`,onClick:()=>h(!0),disabled:g,children:[(0,U.jsx)(s,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),N=(0,U.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:o?void 0:`border-b px-6 py-4`,children:(0,U.jsx)(ft,{title:`History`,description:o?`View and browse conversation history across projects and threads.`:void 0,action:(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[M,o?null:(0,U.jsx)(ue,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,U.jsx)(a,{})})]})})}),(0,U.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:S?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,U.jsxs)(or,{className:`max-w-md`,children:[(0,U.jsx)(sr,{children:(0,U.jsx)(cr,{className:`text-destructive`,children:`Error`})}),(0,U.jsxs)(ur,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{children:S}),(0,U.jsx)(ue,{onClick:()=>C(null),children:`Dismiss`})]})]})}):b&&b===E?(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,U.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,U.jsx)(`h3`,{className:i.emptyStateTitle,children:`No history`}),(0,U.jsx)(`p`,{className:i.bodyMuted,children:`No conversation history found for this thread.`})]})}):w?(0,U.jsx)(fr,{fallbackTitle:`Failed to load conversation history`,onRetry:ee,children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(Qn,{label:`Loading conversation history...`,size:`lg`}),children:(0,U.jsx)(Er,{scope:w,projects:r,loadVersion:v,currentPromptIndex:c,onPromptIndexChange:l},E??void 0)})}):(0,U.jsx)(Qn,{label:`Loading conversation history...`,size:`lg`})})]});return(0,U.jsxs)(U.Fragment,{children:[o?(0,U.jsx)(ht,{children:(0,U.jsx)(lt,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:N})}):(0,U.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:N}),(0,U.jsx)($e,{open:m,onOpenChange:h,children:(0,U.jsxs)(nt,{children:[(0,U.jsxs)(rt,{children:[(0,U.jsx)(at,{children:j.title}),(0,U.jsx)(ot,{children:j.description})]}),(0,U.jsxs)(it,{children:[(0,U.jsx)(ct,{disabled:g,children:`Cancel`}),(0,U.jsx)(st,{onClick:e=>{e.preventDefault(),A()},disabled:g,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:g?`Clearing...`:`Clear`})]})]})})]})});export{ct as A,pt as C,ht as D,lt as E,at as F,ot as M,it as N,$e as O,rt as P,ft as S,gt as T,bt as _,ar as a,vt as b,tr as c,Un as d,Jn as f,Wn as g,Gn as h,ur as i,nt as j,st as k,Qn as l,Zn as m,fr as n,rr as o,Xn as p,or as r,ir as s,yr as t,$n as u,ut as v,_t as w,mt as x,dt as y};