tarsk 0.5.36 → 0.5.38

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 +27 -13
  2. package/dist/public/assets/{account-view-BB-ze5ek.js → account-view-BT90zNSx.js} +1 -1
  3. package/dist/public/assets/api-DWU0D34A.js +1 -0
  4. package/dist/public/assets/{browser-tab-B3bYbBws.js → browser-tab-Bp486a9f.js} +1 -1
  5. package/dist/public/assets/commit-dialog-90PGbqs8.js +1 -0
  6. package/dist/public/assets/context-menu-C7FTMa2c.js +1 -0
  7. package/dist/public/assets/create-repo-dialog-BkUdww3q.js +1 -0
  8. package/dist/public/assets/{dialogs-config-I0_cSU2z.js → dialogs-config-DZKtVbNK.js} +3 -3
  9. package/dist/public/assets/diff-view-B4G8vqZa.js +3 -0
  10. package/dist/public/assets/explorer-tab-view-DEQFid8r.js +2 -0
  11. package/dist/public/assets/{explorer-tree-DrLoiF9t.js → explorer-tree-CPHGgahA.js} +1 -1
  12. package/dist/public/assets/explorer-view-BTvhSMDQ.js +1 -0
  13. package/dist/public/assets/git-history-dialog-Bqv0bD41.js +1 -0
  14. package/dist/public/assets/git-ops-button-BnVMlOO3.js +2 -0
  15. package/dist/public/assets/history-view-jX3PPID6.js +9 -0
  16. package/dist/public/assets/index-DjD2SPNZ.js +65 -0
  17. package/dist/public/assets/mcp-server-card-CTCrhFIS.js +1 -0
  18. package/dist/public/assets/merged-pr-dialog-B2qqrQ1g.js +1 -0
  19. package/dist/public/assets/onboarding-CxtzQldG.js +1 -0
  20. package/dist/public/assets/project-settings-view-ZJjQbFbQ.js +1 -0
  21. package/dist/public/assets/providers-list-view-BH13AB_H.js +1 -0
  22. package/dist/public/assets/pull-request-dialog-ZzVXh6M9.js +1 -0
  23. package/dist/public/assets/pull-with-changes-dialog-LUgd2a4S.js +1 -0
  24. package/dist/public/assets/push-before-pr-dialog-CFmgu9H_.js +1 -0
  25. package/dist/public/assets/radio-group-Bd8YbtFD.js +1 -0
  26. package/dist/public/assets/react-vendor-Ba8DSNiO.js +16 -0
  27. package/dist/public/assets/settings-general-view-C8muiP_K.js +1 -0
  28. package/dist/public/assets/settings-instructions-view-CV7lRPuw.js +1 -0
  29. package/dist/public/assets/settings-list-CKPEGohm.js +1 -0
  30. package/dist/public/assets/{settings-mcp-servers-view-DBD-NhPx.js → settings-mcp-servers-view-3gN9ly3z.js} +4 -4
  31. package/dist/public/assets/{settings-models-skeleton-DsWpzWOw.js → settings-models-skeleton-l966LEN8.js} +1 -1
  32. package/dist/public/assets/settings-models-view-CAMouMhE.js +1 -0
  33. package/dist/public/assets/settings-rules-view-BnazfbJb.js +8 -0
  34. package/dist/public/assets/settings-skills-view-DpzKFcpf.js +2 -0
  35. package/dist/public/assets/settings-slash-commands-view-Drje2Dl4.js +1 -0
  36. package/dist/public/assets/settings-subagents-view-D05kHO1W.js +2 -0
  37. package/dist/public/assets/settings-system-prompt-view-DQmSdSnp.js +1 -0
  38. package/dist/public/assets/settings-view-B6e0GfSv.js +2 -0
  39. package/dist/public/assets/skeleton-qzmFgKhS.js +1 -0
  40. package/dist/public/assets/{terminal-panel-C5qj1ctH.js → terminal-panel-BzCO142Q.js} +2 -2
  41. package/dist/public/assets/{ui-components-BN8dp4Bi.js → ui-components-f8jJJzEo.js} +1 -1
  42. package/dist/public/assets/{utils-CU0c_yCM.js → utils-BlXPFbY9.js} +1 -1
  43. package/dist/public/index.html +6 -6
  44. package/package.json +1 -1
  45. package/dist/public/assets/api-DzFQRz0u.js +0 -1
  46. package/dist/public/assets/commit-dialog-CJRMd4oA.js +0 -1
  47. package/dist/public/assets/context-menu-86TNA1D0.js +0 -1
  48. package/dist/public/assets/create-repo-dialog-nLnVNRqq.js +0 -1
  49. package/dist/public/assets/diff-view-B8vWYa_2.js +0 -3
  50. package/dist/public/assets/explorer-tab-view-BGWQPnkw.js +0 -2
  51. package/dist/public/assets/explorer-view-Clm-RCAB.js +0 -1
  52. package/dist/public/assets/git-history-dialog-CcdMtW0o.js +0 -1
  53. package/dist/public/assets/git-ops-button-D9m2nmhO.js +0 -2
  54. package/dist/public/assets/history-view-Be-1C1tJ.js +0 -7
  55. package/dist/public/assets/index-DVXbmgHY.js +0 -65
  56. package/dist/public/assets/mcp-server-card-bNNoXKsW.js +0 -1
  57. package/dist/public/assets/merged-pr-dialog-Fj8II9Bt.js +0 -1
  58. package/dist/public/assets/onboarding-CgP4bJ5F.js +0 -1
  59. package/dist/public/assets/project-settings-view-DixzP7KH.js +0 -1
  60. package/dist/public/assets/providers-list-view-BzSUZZyq.js +0 -1
  61. package/dist/public/assets/pull-request-dialog-ChuHHY3J.js +0 -1
  62. package/dist/public/assets/pull-with-changes-dialog-Ck6aK6Q7.js +0 -1
  63. package/dist/public/assets/push-before-pr-dialog-CbtHXjDH.js +0 -1
  64. package/dist/public/assets/radio-group-ZjNXbvW6.js +0 -1
  65. package/dist/public/assets/react-vendor-Do-APsQ6.js +0 -16
  66. package/dist/public/assets/settings-general-view-FwrdJbys.js +0 -1
  67. package/dist/public/assets/settings-instructions-view-BHzMtSvN.js +0 -1
  68. package/dist/public/assets/settings-list-BCoqXa_X.js +0 -1
  69. package/dist/public/assets/settings-models-view-vgV5YHRx.js +0 -1
  70. package/dist/public/assets/settings-rules-view-DcSXrmaq.js +0 -8
  71. package/dist/public/assets/settings-skills-view-DVGGs16n.js +0 -2
  72. package/dist/public/assets/settings-slash-commands-view-BsJw1F4p.js +0 -1
  73. package/dist/public/assets/settings-subagents-view-BgWhQ9bf.js +0 -2
  74. package/dist/public/assets/settings-system-prompt-view-DAAbMucD.js +0 -1
  75. package/dist/public/assets/settings-view-DLzrbu69.js +0 -2
  76. package/dist/public/assets/skeleton-iEZ-dj1s.js +0 -1
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Cn as t,Er as n,X as r,ci as i,dr as a,ji as o,n as s,r as c,rr as l,sa as ee,ui as u,wi as d,xo as te,yo as ne}from"./dialogs-config-DZKtVbNK.js";import{a as f,i as p,o as m,r as h}from"./react-vendor-Ba8DSNiO.js";import{D as re,E as ie,S as ae,b as g}from"./history-view-jX3PPID6.js";import{t as oe}from"./index-DjD2SPNZ.js";var se=ne(),_=e(te(),1),v=o(),ce=_.forwardRef((e,t)=>{let n=(0,se.c)(11),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=u(`relative flex w-full touch-none select-none items-center`,r),n[3]=r,n[4]=a);let o,s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,v.jsx)(m,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,v.jsx)(h,{className:`absolute h-full bg-primary`})}),s=(0,v.jsx)(f,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=o,n[6]=s):(o=n[5],s=n[6]);let c;return n[7]!==i||n[8]!==t||n[9]!==a?(c=(0,v.jsxs)(p,{ref:t,className:a,...i,children:[o,s]}),n[7]=i,n[8]=t,n[9]=a,n[10]=c):c=n[10],c});ce.displayName=p.displayName;var y=50;function le(){let[e,n]=(0,_.useState)(y),[i,a]=(0,_.useState)(y.toString()),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.maximumTurnCount),a(t.maximumTurnCount.toString()))}catch(e){console.error(`Failed to load maximum turn count:`,e)}finally{e||s(!1)}}return t(),()=>{e=!0}},[]);function ee(e){a(e)}async function u(e){l(!0);try{let r=await t({maximumTurnCount:e});n(r.maximumTurnCount),a(r.maximumTurnCount.toString())}catch(e){throw console.error(`Failed to update maximum turn count:`,e),e}finally{l(!1)}}function d(){a(e.toString())}return{defaultMaximumTurnCount:y,draftMaximumTurnCount:i,isLoading:o,isSaving:c,maximumTurnCount:e,resetDraftMaximumTurnCount:d,setDraftMaximumTurnCount:ee,updateMaximumTurnCount:u}}var ue=`local`;function de(){let[e,n]=(0,_.useState)(ue),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(!0),[ee,u]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function t(){try{let t=await r();e||(n(t.serverBindMode),a(t.serverBindMode),s(t.networkAddresses))}catch(e){console.error(`Failed to load server bind mode:`,e)}finally{e||l(!1)}}return t(),()=>{e=!0}},[]);async function d(e){u(!0);try{let r=await t({serverBindMode:e});n(r.serverBindMode),s(r.networkAddresses)}catch(e){throw console.error(`Failed to update server bind mode:`,e),e}finally{u(!1)}}return{defaultServerBindMode:ue,hasServerBindModeChanged:i!==null&&e!==i,isLoading:c,isSaving:ee,networkAddresses:o,serverBindMode:e,updateServerBindMode:d}}var fe=`default`;function pe(){let e=(0,se.c)(3),[t,n]=(0,_.useState)(me),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=e=>{n(e),a(e)},e[0]=r):r=e[0];let i=r,o;return e[1]===t?o=e[2]:(o={voiceModel:t,updateVoiceModel:i,defaultVoiceModel:fe},e[1]=t,e[2]=o),o}function me(){return l(fe)}var he=[{value:`default`,label:`Standard`},{value:`tiny`,label:`Tiny`}],ge=[{value:`local`,label:`Local`},{value:`network`,label:`Network`}],_e=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,ve=600;function ye(e){let t=(0,se.c)(94),{onboardingResetSignal:r}=e,a=r===void 0?0:r,[o,c]=(0,_.useState)(!1),{scale:l,updateScale:te,resetScale:ne,min:f,max:p,default:m}=oe(),{defaultMaximumTurnCount:h,draftMaximumTurnCount:y,isLoading:ue,isSaving:fe,resetDraftMaximumTurnCount:me,setDraftMaximumTurnCount:ye,updateMaximumTurnCount:Ce}=le(),{voiceModel:we,updateVoiceModel:Te}=pe(),{hasServerBindModeChanged:Ee,isLoading:De,isSaving:Oe,networkAddresses:b,serverBindMode:x,updateServerBindMode:ke}=de(),S,C;t[0]===a?(S=t[1],C=t[2]):(S=()=>{if(a===0)return;c(!0);let e=setTimeout(()=>{c(!1)},ve);return()=>{clearTimeout(e)}},C=[a],t[0]=a,t[1]=S,t[2]=C),(0,_.useEffect)(S,C);let w;t[3]===ye?w=t[4]:(w=function(e){ye(e.target.value)},t[3]=ye,t[4]=w);let Ae=w,T;t[5]!==h||t[6]!==y||t[7]!==me||t[8]!==Ce?(T=async function(){let e=Number.parseInt(y,10),t=Number.isFinite(e)&&e>0?e:h;try{await Ce(t)}catch{me()}},t[5]=h,t[6]=y,t[7]=me,t[8]=Ce,t[9]=T):T=t[9];let je=T,E;t[10]===te?E=t[11]:(E=function(e){e.length>0&&te(e[0])},t[10]=te,t[11]=E);let Me=E,Ne=o&&`animate-headline-reset`,D;t[12]===Ne?D=t[13]:(D=u(Ne),t[12]=Ne,t[13]=D);let O;t[14]===D?O=t[15]:(O=(0,v.jsx)(ae,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:D}),t[14]=D,t[15]=O);let Pe,Fe;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,v.jsx)(ee,{className:`h-3.5 w-3.5`}),Fe=(0,v.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),t[16]=Pe,t[17]=Fe):(Pe=t[16],Fe=t[17]);let k;t[18]===ne?k=t[19]:(k=(0,v.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ne,children:[Pe,Fe]}),t[18]=ne,t[19]=k);let A;t[20]===l?A=t[21]:(A=(0,v.jsxs)(`span`,{className:`${d.mono} tabular-nums w-12 text-right`,children:[l,`%`]}),t[20]=l,t[21]=A);let j;t[22]!==k||t[23]!==A?(j=(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[k,A]}),t[22]=k,t[23]=A,t[24]=j):j=t[24];let M;t[25]===f?M=t[26]:(M=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-8 text-right`,children:[f,`%`]}),t[25]=f,t[26]=M);let N;t[27]===l?N=t[28]:(N=[l],t[27]=l,t[28]=N);let P;t[29]!==Me||t[30]!==p||t[31]!==f||t[32]!==N?(P=(0,v.jsx)(ce,{value:N,min:f,max:p,step:5,onValueChange:Me,"aria-label":`Font size`}),t[29]=Me,t[30]=p,t[31]=f,t[32]=N,t[33]=P):P=t[33];let F;t[34]===p?F=t[35]:(F=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-9`,children:[p,`%`]}),t[34]=p,t[35]=F);let I;t[36]!==M||t[37]!==P||t[38]!==F?(I=(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[M,P,F]}),t[36]=M,t[37]=P,t[38]=F,t[39]=I):I=t[39];let L;t[40]!==m||t[41]!==l?(L=l!==m&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,m,`%).`]}),t[40]=m,t[41]=l,t[42]=L):L=t[42];let R;t[43]!==j||t[44]!==I||t[45]!==L?(R=(0,v.jsxs)(g,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:j,children:[I,L]}),t[43]=j,t[44]=I,t[45]=L,t[46]=R):R=t[46];let z;t[47]===je?z=t[48]:(z=()=>{je()},t[47]=je,t[48]=z);let Ie=ue||fe,B;t[49]!==y||t[50]!==Ae||t[51]!==z||t[52]!==Ie?(B=(0,v.jsx)(n,{type:`number`,min:1,step:1,value:y,onChange:Ae,onBlur:z,disabled:Ie,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),t[49]=y,t[50]=Ae,t[51]=z,t[52]=Ie,t[53]=B):B=t[53];let V;t[54]===h?V=t[55]:(V=(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Default: `,h,` turns.`]}),t[54]=h,t[55]=V);let H;t[56]!==B||t[57]!==V?(H=(0,v.jsx)(g,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:B,children:V}),t[56]=B,t[57]=V,t[58]=H):H=t[58];let U;t[59]===Te?U=t[60]:(U=e=>{(e==="default"||e===`tiny`)&&Te(e)},t[59]=Te,t[60]=U);let W;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(W=he.map(Se),t[61]=W):W=t[61];let G;t[62]!==U||t[63]!==we?(G=(0,v.jsx)(g,{title:`Voice Model`,description:`Choose which voice-to-text model Tarsk downloads and caches for speech input.`,children:(0,v.jsx)(s,{type:`single`,value:we,onValueChange:U,"aria-label":`Voice model`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:W})}),t[62]=U,t[63]=we,t[64]=G):G=t[64];let Le=x===`network`?`Tarsk accepts connections from other devices on your network such as the Tarsk mobile app.`:`Tarsk only accepts connections from this computer at http://localhost:${_e}.`,Re=De||Oe,K;t[65]===ke?K=t[66]:(K=e=>{(e===`local`||e===`network`)&&ke(e)},t[65]=ke,t[66]=K);let ze;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(ze=ge.map(xe),t[67]=ze):ze=t[67];let q;t[68]!==x||t[69]!==Re||t[70]!==K?(q=(0,v.jsx)(s,{type:`single`,value:x,disabled:Re,onValueChange:K,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:ze}),t[68]=x,t[69]=Re,t[70]=K,t[71]=q):q=t[71];let J;t[72]!==b||t[73]!==x?(J=x===`network`&&b.length>0&&(0,v.jsxs)(`div`,{className:`mt-3 space-y-1`,children:[(0,v.jsx)(`p`,{className:d.bodyMuted,children:`Available on your network:`}),(0,v.jsx)(`ul`,{className:`${d.mono} space-y-1`,children:b.map(be)})]}),t[72]=b,t[73]=x,t[74]=J):J=t[74];let Y;t[75]!==b||t[76]!==x?(Y=x===`network`&&b.length===0&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),t[75]=b,t[76]=x,t[77]=Y):Y=t[77];let X;t[78]===Ee?X=t[79]:(X=Ee&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`Restart Tarsk for this change to take effect.`}),t[78]=Ee,t[79]=X);let Z;t[80]!==Le||t[81]!==q||t[82]!==J||t[83]!==Y||t[84]!==X?(Z=(0,v.jsxs)(g,{title:`Local`,description:Le,children:[q,J,Y,X]}),t[80]=Le,t[81]=q,t[82]=J,t[83]=Y,t[84]=X,t[85]=Z):Z=t[85];let Q;t[86]!==R||t[87]!==H||t[88]!==G||t[89]!==Z?(Q=(0,v.jsxs)(`div`,{className:`space-y-8`,children:[R,H,G,Z]}),t[86]=R,t[87]=H,t[88]=G,t[89]=Z,t[90]=Q):Q=t[90];let $;return t[91]!==Q||t[92]!==O?($=(0,v.jsx)(re,{children:(0,v.jsxs)(ie,{children:[O,Q]})}),t[91]=Q,t[92]=O,t[93]=$):$=t[93],$}function be(e){return(0,v.jsxs)(`li`,{children:[`http://`,e,`:`,_e]},e)}function xe(e){return(0,v.jsx)(c,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function Se(e){return(0,v.jsx)(c,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}export{ye as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{At as t,Ea as n,ci as r,ji as i,ln as a,ui as o,wi as s,xo as c}from"./dialogs-config-DZKtVbNK.js";import{E as l,S as u,T as d,w as f}from"./history-view-jX3PPID6.js";import{E as p,O as m,j as h}from"./index-DjD2SPNZ.js";var g=e(c(),1),_=i();function v(){let e=h(e=>e.selectedThreadId),[i,c]=(0,g.useState)(``),[v,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(!1);(0,g.useEffect)(()=>{e&&(y(!0),t(e,`AGENTS.md`).then(e=>c(e.content)).catch(()=>c(``)).finally(()=>y(!1)))},[e]);async function S(){if(e){x(!0);try{await a(e,`AGENTS.md`,i),p({title:`Instructions saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save instructions`,variant:`destructive`})}finally{x(!1)}}}return e?(0,_.jsx)(f,{children:(0,_.jsxs)(l,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,_.jsx)(u,{title:`Instructions`,description:`Add context like coding guidelines and expectations. Stored in AGENTS.md file.`,action:(0,_.jsx)(r,{onClick:S,disabled:v||b,children:b?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),v?(0,_.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,_.jsx)(n,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,_.jsx)(m,{value:i,onChange:e=>c(e.target.value),className:o(s.mono,`flex-1 min-h-0 resize-none`),placeholder:`Add instructions for your agent in AGENTS.md...`,disabled:b})]})}):(0,_.jsx)(d,{children:`Select a thread to edit instructions.`})}export{v as SettingsInstructionsView,v as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{Er as e,ci as t,fr as n,hr as r,ji as i,mr as a,pr as o,ra as s,ui as c,wi as l,xo as u,yo as d}from"./dialogs-config-DZKtVbNK.js";import{O as f,i as p,r as m}from"./history-view-jX3PPID6.js";var h=d(),g=i();u();var _=f(e=>(0,g.jsxs)(`div`,{className:`text-center py-12 border border-dashed rounded-lg mb-8`,children:[e.v0,(0,g.jsx)(`h3`,{className:e.v1,children:e.v2}),(0,g.jsx)(`p`,{className:e.v3,children:e.v4})]}),{name:`InstalledEmptyState_1`,portals:[`v0`,`v2`,`v4`]}),v=function(e){let t=(0,h.c)(8),{icon:n,title:r,description:i}=e,a;t[0]===n?a=t[1]:(a=(0,g.jsx)(n,{className:`mx-auto h-10 w-10 text-muted-foreground/50 mb-3`}),t[0]=n,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=c(l.emptyStateTitle,`mb-1`),t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=c(l.bodyMuted,`mb-3`),t[3]=s):s=t[3];let u;return t[4]!==i||t[5]!==a||t[6]!==r?(u=(0,g.jsx)(_,{v0:a,v1:o,v2:r,v3:s,v4:i}),t[4]=i,t[5]=a,t[6]=r,t[7]=u):u=t[7],u};function y(e){let t=(0,h.c)(16),{title:n,subtitle:r,subtitleMono:i,badge:a,actions:o}=e,s=i===void 0?!1:i,u;t[0]===n?u=t[1]:(u=typeof n==`string`?(0,g.jsx)(`h3`,{className:c(l.label,`truncate`),children:n}):n,t[0]=n,t[1]=u);let d;t[2]!==a||t[3]!==u?(d=(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,a]}),t[2]=a,t[3]=u,t[4]=d):d=t[4];let f;t[5]!==r||t[6]!==s?(f=r?(0,g.jsx)(`p`,{className:c(l.bodyMuted,`mt-1 truncate`,s&&l.mono),children:r}):null,t[5]=r,t[6]=s,t[7]=f):f=t[7];let _;t[8]!==d||t[9]!==f?(_=(0,g.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=_):_=t[10];let v;t[11]===o?v=t[12]:(v=(0,g.jsx)(b,{actions:o}),t[11]=o,t[12]=v);let y;return t[13]!==_||t[14]!==v?(y=(0,g.jsx)(m,{children:(0,g.jsxs)(p,{className:`flex items-center justify-between p-4`,children:[_,v]})}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function b(e){let t=(0,h.c)(4),{actions:n}=e,r;t[0]===n?r=t[1]:(r=n.map(x),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,g.jsx)(a,{delayDuration:300,children:(0,g.jsx)(`div`,{className:`flex items-center gap-1 ml-4 flex-shrink-0`,children:r})}),t[2]=r,t[3]=i),i}function x(e){return(0,g.jsxs)(n,{children:[(0,g.jsx)(r,{asChild:!0,children:(0,g.jsx)(t,{variant:`ghost`,size:`icon-sm`,onClick:e.onClick,children:(0,g.jsx)(`span`,{className:e.destructive?`text-destructive`:void 0,children:e.icon})})}),(0,g.jsx)(o,{children:e.label})]},e.label)}function S(t){let n=(0,h.c)(7),{placeholder:r,value:i,onChange:a}=t,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,g.jsx)(s,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),n[0]=o):o=n[0];let c;n[1]===a?c=n[2]:(c=e=>a(e.target.value),n[1]=a,n[2]=c);let l;return n[3]!==r||n[4]!==c||n[5]!==i?(l=(0,g.jsxs)(`div`,{className:`relative mb-4`,children:[o,(0,g.jsx)(e,{placeholder:r,value:i,onChange:c,className:`pl-8`})]}),n[3]=r,n[4]=c,n[5]=i,n[6]=l):l=n[6],l}function C(e){let t=(0,h.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,g.jsx)(`div`,{className:`grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(220px,100%),1fr))]`,children:n}),t[0]=n,t[1]=r),r}function w(e){let t=(0,h.c)(3),{searchQuery:n,emptyLabel:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=c(l.bodyMuted,`text-center py-8`),t[0]=i):i=t[0];let a=n.trim()?`No results for "${n}"`:r,o;return t[1]===a?o=t[2]:(o=(0,g.jsx)(`p`,{className:i,children:a}),t[1]=a,t[2]=o),o}function T(e){let t=(0,h.c)(3),{message:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(l.bodyMuted,`text-center py-8`),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,g.jsx)(`p`,{className:r,children:n}),t[1]=n,t[2]=i),i}export{S as a,w as i,y as n,T as o,C as r,v as t};
@@ -1,5 +1,5 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ci as n,Dr as r,Er as i,Fi as a,Ha as o,Hi as s,M as c,Tr as l,_o as u,an as d,ca as f,ct as p,ea as m,ft as h,si as g,ua as _,yo as v}from"./dialogs-config-I0_cSU2z.js";import{A as y,C as b,D as ee,E as x,F as S,M as C,N as w,O as T,P as E,S as te,T as D,b as O,d as k,f as A,g as j,h as M,j as N,k as P,p as F,y as I}from"./history-view-Be-1C1tJ.js";import{C as L,E as R,O as z,c as ne,j as B,l as V,o as re,s as H}from"./index-DVXbmgHY.js";import{t as U}from"./skeleton-iEZ-dj1s.js";import{a as W,i as ie,n as G,r as K,t as ae}from"./settings-list-BCoqXa_X.js";import{t as oe}from"./mcp-server-card-bNNoXKsW.js";var q=u(),J=e(v(),1);function se(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await p(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function Y(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{h().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function X(e,t,n){await d(e,t,n)}async function ce(e,t){await c(e,t)}var Z=t();function le(e){return e?.url?`remote`:`local`}function ue(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:t,initialName:r,initialConfig:i,onBack:o}){let{installedServers:s}=se(e),c=!!t,[u,d]=(0,J.useState)(`local`),[p,m]=(0,J.useState)(``),[h,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`sse`),[w,T]=(0,J.useState)([]),[E,D]=(0,J.useState)([]),[N,P]=(0,J.useState)(!1),[L,B]=(0,J.useState)(!1),[U,W]=(0,J.useState)(null),[ie,G]=(0,J.useState)(c),[K,ae]=(0,J.useState)(``),[oe,q]=(0,J.useState)(``);function Y(e,t){let n=le(t);d(n),m(e),_(t.command??``),y((t.args??[]).join(`
2
- `)),x(t.url??``),C(t.transport??`sse`),T(ue(t.env)),D(ue(t.headers)),ae(e),q(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(c&&t){let e=s.find(e=>e.name===t);e&&(Y(e.name,e.config),G(!1))}else i&&Y(r??``,i),G(!1)},[s,t,c,i,r]);let Q=(0,J.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),$=(0,J.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),fe=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,J.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(u===`remote`){let t=_e(E);return{url:b.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=v.split(`
3
- `).map(e=>e.trim()).filter(Boolean);return{command:h.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:p.trim(),type:u,config:ve()}),be=async()=>{W(null);let t=p.trim();if(!t){W(`Server name is required`);return}if(u===`remote`){if(!b.trim()){W(`Server URL is required`);return}try{new URL(b.trim())}catch{W(`Server URL must be a valid URL`);return}}else if(!h.trim()){W(`Command is required`);return}P(!0);try{if(!e)throw Error(`No project path`);await X(e,K||t,ve()),R({title:`Success`,description:c?`MCP server configuration saved`:`MCP server added`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to save server`)}finally{P(!1)}},xe=async()=>{if(e){B(!0);try{await ce(e,K),R({title:`Success`,description:`MCP server removed`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to delete server`)}finally{B(!1)}}},Se=c?ye!==oe:p.trim()!==``||h.trim()!==``||v.trim()!==``||b.trim()!==``||w.length>0||E.length>0;return ie?(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:n.bodyMuted,children:`Loading server configuration...`})}):(0,Z.jsx)(ee,{children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(te,{title:c?p:`Add MCP Server`,description:c?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(O,{title:`Server name`,description:c?`Server name cannot be changed`:void 0,children:(0,Z.jsx)(l,{id:`server-name`,placeholder:`e.g. filesystem`,value:p,onChange:e=>m(e.target.value),disabled:c})}),(0,Z.jsxs)(re,{value:u,onValueChange:e=>d(e),className:`w-full`,children:[(0,Z.jsxs)(ne,{className:`grid w-full grid-cols-2`,children:[(0,Z.jsx)(V,{value:`local`,children:`Local (stdio)`}),(0,Z.jsx)(V,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Z.jsxs)(H,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Command`,children:(0,Z.jsx)(l,{id:`server-command`,placeholder:`e.g. npx`,value:h,onChange:e=>_(e.target.value)})}),(0,Z.jsx)(O,{title:`Arguments`,description:`One argument per line`,children:(0,Z.jsx)(z,{id:`server-args`,placeholder:`-y
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Er as n,Ii as r,M as i,Or as a,Ui as o,Wa as s,ci as c,ct as l,fa as u,ft as d,ji as f,on as p,ta as m,ua as h,wi as g,xo as _,yo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as ee,E as x,F as S,I as C,M as w,N as T,P as E,S as te,T as D,b as O,d as k,f as A,g as j,h as M,j as N,k as P,p as F,y as I}from"./history-view-jX3PPID6.js";import{C as L,E as R,O as z,c as ne,j as B,l as V,o as re,s as H}from"./index-DjD2SPNZ.js";import{t as U}from"./skeleton-qzmFgKhS.js";import{a as W,i as ie,n as G,r as K,t as ae}from"./settings-list-CKPEGohm.js";import{t as oe}from"./mcp-server-card-CTCrhFIS.js";var q=v(),J=e(_(),1);function se(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await l(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function Y(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{d().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function X(e,t,n){await p(e,t,n)}async function ce(e,t){await i(e,t)}var Z=f();function le(e){return e?.url?`remote`:`local`}function ue(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:t,initialName:i,initialConfig:a,onBack:o}){let{installedServers:s}=se(e),l=!!t,[u,d]=(0,J.useState)(`local`),[f,p]=(0,J.useState)(``),[m,_]=(0,J.useState)(``),[v,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[S,C]=(0,J.useState)(`sse`),[w,T]=(0,J.useState)([]),[E,D]=(0,J.useState)([]),[N,P]=(0,J.useState)(!1),[L,B]=(0,J.useState)(!1),[U,W]=(0,J.useState)(null),[ie,G]=(0,J.useState)(l),[K,ae]=(0,J.useState)(``),[oe,q]=(0,J.useState)(``);function Y(e,t){let n=le(t);d(n),p(e),_(t.command??``),y((t.args??[]).join(`
2
+ `)),x(t.url??``),C(t.transport??`sse`),T(ue(t.env)),D(ue(t.headers)),ae(e),q(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(l&&t){let e=s.find(e=>e.name===t);e&&(Y(e.name,e.config),G(!1))}else a&&Y(i??``,a),G(!1)},[s,t,l,a,i]);let Q=(0,J.useCallback)(()=>{T(e=>[...e,{key:``,value:``}])},[]),$=(0,J.useCallback)(e=>{T(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),fe=(0,J.useCallback)((e,t)=>{T(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),pe=(0,J.useCallback)(()=>{D(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{D(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{D(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function ve(){let e=_e(w);if(u===`remote`){let t=_e(E);return{url:b.trim(),transport:S,...t?{headers:t}:{},...e?{env:e}:{}}}let t=v.split(`
3
+ `).map(e=>e.trim()).filter(Boolean);return{command:m.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:f.trim(),type:u,config:ve()}),be=async()=>{W(null);let t=f.trim();if(!t){W(`Server name is required`);return}if(u===`remote`){if(!b.trim()){W(`Server URL is required`);return}try{new URL(b.trim())}catch{W(`Server URL must be a valid URL`);return}}else if(!m.trim()){W(`Command is required`);return}P(!0);try{if(!e)throw Error(`No project path`);await X(e,K||t,ve()),R({title:`Success`,description:l?`MCP server configuration saved`:`MCP server added`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to save server`)}finally{P(!1)}},xe=async()=>{if(e){B(!0);try{await ce(e,K),R({title:`Success`,description:`MCP server removed`}),o()}catch(e){W(e instanceof Error?e.message:`Failed to delete server`)}finally{B(!1)}}},Se=l?ye!==oe:f.trim()!==``||m.trim()!==``||v.trim()!==``||b.trim()!==``||w.length>0||E.length>0;return ie?(0,Z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,Z.jsx)(`p`,{className:g.bodyMuted,children:`Loading server configuration...`})}):(0,Z.jsx)(ee,{children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(te,{title:l?f:`Add MCP Server`,description:l?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(O,{title:`Server name`,description:l?`Server name cannot be changed`:void 0,children:(0,Z.jsx)(n,{id:`server-name`,placeholder:`e.g. filesystem`,value:f,onChange:e=>p(e.target.value),disabled:l})}),(0,Z.jsxs)(re,{value:u,onValueChange:e=>d(e),className:`w-full`,children:[(0,Z.jsxs)(ne,{className:`grid w-full grid-cols-2`,children:[(0,Z.jsx)(V,{value:`local`,children:`Local (stdio)`}),(0,Z.jsx)(V,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,Z.jsxs)(H,{value:`local`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Command`,children:(0,Z.jsx)(n,{id:`server-command`,placeholder:`e.g. npx`,value:m,onChange:e=>_(e.target.value)})}),(0,Z.jsx)(O,{title:`Arguments`,description:`One argument per line`,children:(0,Z.jsx)(z,{id:`server-args`,placeholder:`-y
4
4
  @modelcontextprotocol/server-filesystem
5
- /path/to/dir`,value:v,onChange:e=>y(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,Z.jsxs)(H,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,Z.jsx)(l,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,Z.jsx)(O,{title:`Transport`,children:(0,Z.jsxs)(k,{value:S,onValueChange:e=>C(e),children:[(0,Z.jsx)(M,{children:(0,Z.jsx)(j,{})}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(F,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Z.jsx)(F,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,Z.jsx)(O,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,Z.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,Z.jsx)(f,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:E.length===0?(0,Z.jsx)(`p`,{className:n.caption,children:`No headers configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(l,{placeholder:`Authorization`,value:e.key,onChange:e=>he(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(l,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(g,{variant:`ghost`,size:`icon`,onClick:()=>me(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,Z.jsx)(O,{title:`Environment variables`,description:u===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,Z.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:Q,children:[(0,Z.jsx)(f,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:w.length===0?(0,Z.jsx)(`p`,{className:n.caption,children:`No environment variables configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(l,{placeholder:`KEY`,value:e.key,onChange:e=>de(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(l,{placeholder:`value`,value:e.value,onChange:e=>fe(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(g,{variant:`ghost`,size:`icon`,onClick:()=>$(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})}),U&&(0,Z.jsx)(`p`,{className:n.error,children:U}),(0,Z.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[c&&(0,Z.jsx)(g,{variant:`destructive`,onClick:xe,disabled:L||N,children:L?`Removing...`:`Remove`}),!c&&(0,Z.jsx)(`div`,{}),(0,Z.jsx)(g,{onClick:be,disabled:N||L||!Se,children:N?c?`Saving...`:`Adding...`:c?`Save`:`Add`})]})]})]})})}function $(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function de(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function fe(){let e=B(e=>e.selectedProjectId),t=B(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:n,loadingConfig:a,loadInstalledServers:c}=se(t),{popularServers:l}=Y(),{setActiveMainTab:u,setPendingExplorerPath:d,triggerExplorerRefresh:f}=L(),[p,h]=(0,J.useState)(!1),[v,O]=(0,J.useState)(null),[k,A]=(0,J.useState)(null),[j,M]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[z,ne]=(0,J.useState)(``),V=(0,J.useCallback)(async e=>{if(t){I(!0);try{await ce(t,e),await c(),f(),R({title:`MCP server removed`,description:e}),M(null)}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{I(!1)}}},[t,c,f]),re=(0,J.useCallback)(()=>{d(`.agents/mcp.json`),u(`explorer`)},[d,u]),H=(0,J.useCallback)(async e=>{if(!t)return;let r=$(e);if(!n.some(t=>t.name===r||t.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){O({name:r,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),h(!0);return}try{await X(t,r,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),f(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){R({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await X(t,r,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),f(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[t,n,c,f]),q=z.trim()?l.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):l;return e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{children:(0,Z.jsxs)(x,{children:[(0,Z.jsx)(te,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,Z.jsx)(g,{onClick:()=>h(!0),children:`Add Server`})}),(0,Z.jsx)(b,{title:`Installed`}),a?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):n.length===0?(0,Z.jsx)(ae,{icon:m,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,Z.jsx)(`div`,{className:`space-y-3 mb-8`,children:n.map(e=>(0,Z.jsx)(G,{title:e.name,subtitle:de(e.config),subtitleMono:!0,actions:[{label:`View config file`,icon:(0,Z.jsx)(o,{className:`h-4 w-4`}),onClick:re},{label:`Edit server`,icon:(0,Z.jsx)(_,{className:`h-4 w-4`}),onClick:()=>A(e.name)},{label:`Delete server`,icon:(0,Z.jsx)(s,{className:`h-4 w-4`}),onClick:()=>M(e.name),destructive:!0}]},e.name))}),(0,Z.jsx)(b,{title:`Available`,className:`mb-0`}),(0,Z.jsx)(W,{placeholder:`Search available servers...`,value:z,onChange:ne}),l.length===0?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):q.length===0?(0,Z.jsx)(ie,{searchQuery:z,emptyLabel:`No available servers found.`}):(0,Z.jsx)(K,{children:q.map(e=>{let t=$(e),r=n.some(n=>n.name===t||n.name===e.id);return(0,Z.jsx)(oe,{name:e.name,description:e.description,installed:r,onClick:()=>{r||H(e)},showInstalledControls:!1},e.id)})})]})}),(0,Z.jsx)(i,{open:p,onOpenChange:e=>{h(e),e||O(null)},children:(0,Z.jsx)(r,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:t,initialName:v?.name,initialConfig:v?.config,onBack:()=>{h(!1),O(null),c(),f()}})})}),(0,Z.jsx)(i,{open:k!==null,onOpenChange:e=>{e||A(null)},children:(0,Z.jsx)(r,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:t,serverName:k??void 0,onBack:()=>{A(null),c(),f()}})})}),(0,Z.jsx)(T,{open:j!==null,onOpenChange:e=>!e&&M(null),children:(0,Z.jsxs)(N,{children:[(0,Z.jsxs)(E,{children:[(0,Z.jsx)(S,{children:`Delete MCP Server`}),(0,Z.jsxs)(C,{children:[`Are you sure you want to delete the server "`,j,`"? This action cannot be undone.`]})]}),(0,Z.jsxs)(w,{children:[(0,Z.jsx)(y,{children:`Cancel`}),(0,Z.jsx)(P,{onClick:()=>j&&void V(j),disabled:F,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:F?`Deleting...`:`Delete`})]})]})})]}):(0,Z.jsx)(D,{children:`Select a project to manage MCP servers.`})}export{fe as SettingsMCPServersView,fe as default};
5
+ /path/to/dir`,value:v,onChange:e=>y(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,Z.jsxs)(H,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,Z.jsx)(O,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,Z.jsx)(n,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,Z.jsx)(O,{title:`Transport`,children:(0,Z.jsxs)(k,{value:S,onValueChange:e=>C(e),children:[(0,Z.jsx)(M,{children:(0,Z.jsx)(j,{})}),(0,Z.jsxs)(A,{children:[(0,Z.jsx)(F,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,Z.jsx)(F,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,Z.jsx)(O,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,Z.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:pe,children:[(0,Z.jsx)(h,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:E.length===0?(0,Z.jsx)(`p`,{className:g.caption,children:`No headers configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(n,{placeholder:`Authorization`,value:e.key,onChange:e=>he(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(n,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>me(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(r,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,Z.jsx)(O,{title:`Environment variables`,description:u===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,Z.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:Q,children:[(0,Z.jsx)(h,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:w.length===0?(0,Z.jsx)(`p`,{className:g.caption,children:`No environment variables configured`}):(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:w.map((e,t)=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(n,{placeholder:`KEY`,value:e.key,onChange:e=>de(t,e.target.value),className:`font-mono w-[35%]`}),(0,Z.jsx)(n,{placeholder:`value`,value:e.value,onChange:e=>fe(t,e.target.value),className:`font-mono flex-1`}),(0,Z.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>$(t),className:`h-9 w-9 flex-shrink-0`,children:(0,Z.jsx)(r,{className:`h-3.5 w-3.5`})})]},t))})}),U&&(0,Z.jsx)(`p`,{className:g.error,children:U}),(0,Z.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[l&&(0,Z.jsx)(c,{variant:`destructive`,onClick:xe,disabled:L||N,children:L?`Removing...`:`Remove`}),!l&&(0,Z.jsx)(`div`,{}),(0,Z.jsx)(c,{onClick:be,disabled:N||L||!Se,children:N?l?`Saving...`:`Adding...`:l?`Save`:`Add`})]})]})]})})}function $(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function de(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function fe(){let e=B(e=>e.selectedProjectId),n=B(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:r,loadingConfig:i,loadInstalledServers:l}=se(n),{popularServers:d}=Y(),{setActiveMainTab:f,setPendingExplorerPath:p,triggerExplorerRefresh:h}=L(),[g,_]=(0,J.useState)(!1),[v,O]=(0,J.useState)(null),[k,A]=(0,J.useState)(null),[j,M]=(0,J.useState)(null),[F,I]=(0,J.useState)(!1),[z,ne]=(0,J.useState)(``),V=(0,J.useCallback)(async e=>{if(n){I(!0);try{await ce(n,e),await l(),h(),R({title:`MCP server removed`,description:e}),M(null)}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{I(!1)}}},[n,l,h]),re=(0,J.useCallback)(()=>{p(`.agents/mcp.json`),f(`explorer`)},[p,f]),H=(0,J.useCallback)(async e=>{if(!n)return;let t=$(e);if(!r.some(n=>n.name===t||n.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){O({name:t,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),_(!0);return}try{await X(n,t,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await l(),h(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){R({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await X(n,t,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await l(),h(),R({title:`MCP server installed`,description:e.name})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[n,r,l,h]),q=z.trim()?d.filter(e=>e.name.toLowerCase().includes(z.toLowerCase())||e.description.toLowerCase().includes(z.toLowerCase())):d;return e?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(ee,{children:(0,Z.jsxs)(x,{children:[(0,Z.jsx)(te,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,Z.jsx)(c,{onClick:()=>_(!0),children:`Add Server`})}),(0,Z.jsx)(b,{title:`Installed`}),i?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):r.length===0?(0,Z.jsx)(ae,{icon:m,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,Z.jsx)(`div`,{className:`space-y-3 mb-8`,children:r.map(e=>(0,Z.jsx)(G,{title:e.name,subtitle:de(e.config),subtitleMono:!0,actions:[{label:`View config file`,icon:(0,Z.jsx)(s,{className:`h-4 w-4`}),onClick:re},{label:`Edit server`,icon:(0,Z.jsx)(u,{className:`h-4 w-4`}),onClick:()=>A(e.name)},{label:`Delete server`,icon:(0,Z.jsx)(o,{className:`h-4 w-4`}),onClick:()=>M(e.name),destructive:!0}]},e.name))}),(0,Z.jsx)(b,{title:`Available`,className:`mb-0`}),(0,Z.jsx)(W,{placeholder:`Search available servers...`,value:z,onChange:ne}),d.length===0?(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(U,{className:`h-20 w-full`}),(0,Z.jsx)(U,{className:`h-20 w-full`})]}):q.length===0?(0,Z.jsx)(ie,{searchQuery:z,emptyLabel:`No available servers found.`}):(0,Z.jsx)(K,{children:q.map(e=>{let t=$(e),n=r.some(n=>n.name===t||n.name===e.id);return(0,Z.jsx)(oe,{name:e.name,description:e.description,installed:n,onClick:()=>{n||H(e)},showInstalledControls:!1},e.id)})})]})}),(0,Z.jsx)(t,{open:g,onOpenChange:e=>{_(e),e||O(null)},children:(0,Z.jsx)(a,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:n,initialName:v?.name,initialConfig:v?.config,onBack:()=>{_(!1),O(null),l(),h()}})})}),(0,Z.jsx)(t,{open:k!==null,onOpenChange:e=>{e||A(null)},children:(0,Z.jsx)(a,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(Q,{projectPath:n,serverName:k??void 0,onBack:()=>{A(null),l(),h()}})})}),(0,Z.jsx)(P,{open:j!==null,onOpenChange:e=>!e&&M(null),children:(0,Z.jsxs)(w,{children:[(0,Z.jsxs)(S,{children:[(0,Z.jsx)(C,{children:`Delete MCP Server`}),(0,Z.jsxs)(T,{children:[`Are you sure you want to delete the server "`,j,`"? This action cannot be undone.`]})]}),(0,Z.jsxs)(E,{children:[(0,Z.jsx)(N,{children:`Cancel`}),(0,Z.jsx)(y,{onClick:()=>j&&void V(j),disabled:F,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:F?`Deleting...`:`Delete`})]})]})})]}):(0,Z.jsx)(D,{children:`Select a project to manage MCP servers.`})}export{fe as SettingsMCPServersView,fe as default};
@@ -1 +1 @@
1
- import{Ai as e,_o as t}from"./dialogs-config-I0_cSU2z.js";import{D as n,E as r,S as i}from"./history-view-Be-1C1tJ.js";import{t as a}from"./skeleton-iEZ-dj1s.js";var o=t(),s=e();function c(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,s.jsx)(i,{title:`Models`,description:`View and manage available models from your configured providers.`}),e[0]=t):t=e[0];let c,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,s.jsx)(a,{className:`h-10 w-full`}),u=(0,s.jsx)(a,{className:`h-9 w-48`}),e[1]=c,e[2]=u):(c=e[1],u=e[2]);let d;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,s.jsx)(n,{children:(0,s.jsxs)(r,{children:[t,(0,s.jsxs)(`div`,{className:`space-y-6`,children:[c,u,(0,s.jsx)(`div`,{className:`space-y-6`,children:[1,2].map(l)})]})]})}),e[3]=d):d=e[3],d}function l(e){return(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(a,{className:`h-8 w-8 rounded-full`}),(0,s.jsx)(a,{className:`h-6 w-36`})]}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,s.jsx)(a,{className:`h-5 w-32`}),(0,s.jsx)(a,{className:`h-8 w-28`})]}),(0,s.jsx)(`div`,{className:`border border-border rounded-md overflow-hidden`,children:[1,2,3,4,5].map(u)})]},e)}function u(e){return(0,s.jsxs)(`div`,{className:`flex items-center gap-3 p-3 border-b border-border last:border-b-0`,children:[(0,s.jsx)(a,{className:`h-4 w-4 rounded-sm`}),(0,s.jsx)(a,{className:`h-4 flex-1 max-w-xs`}),(0,s.jsx)(a,{className:`h-3 w-24`})]},e)}export{c as t};
1
+ import{ji as e,yo as t}from"./dialogs-config-DZKtVbNK.js";import{D as n,E as r,S as i}from"./history-view-jX3PPID6.js";import{t as a}from"./skeleton-qzmFgKhS.js";var o=t(),s=e();function c(){let e=(0,o.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,s.jsx)(i,{title:`Models`,description:`View and manage available models from your configured providers.`}),e[0]=t):t=e[0];let c,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,s.jsx)(a,{className:`h-10 w-full`}),u=(0,s.jsx)(a,{className:`h-9 w-48`}),e[1]=c,e[2]=u):(c=e[1],u=e[2]);let d;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,s.jsx)(n,{children:(0,s.jsxs)(r,{children:[t,(0,s.jsxs)(`div`,{className:`space-y-6`,children:[c,u,(0,s.jsx)(`div`,{className:`space-y-6`,children:[1,2].map(l)})]})]})}),e[3]=d):d=e[3],d}function l(e){return(0,s.jsxs)(`div`,{className:`space-y-3`,children:[(0,s.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,s.jsx)(a,{className:`h-8 w-8 rounded-full`}),(0,s.jsx)(a,{className:`h-6 w-36`})]}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,s.jsx)(a,{className:`h-5 w-32`}),(0,s.jsx)(a,{className:`h-8 w-28`})]}),(0,s.jsx)(`div`,{className:`border border-border rounded-md overflow-hidden`,children:[1,2,3,4,5].map(u)})]},e)}function u(e){return(0,s.jsxs)(`div`,{className:`flex items-center gap-3 p-3 border-b border-border last:border-b-0`,children:[(0,s.jsx)(a,{className:`h-4 w-4 rounded-sm`}),(0,s.jsx)(a,{className:`h-4 flex-1 max-w-xs`}),(0,s.jsx)(a,{className:`h-3 w-24`})]},e)}export{c as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{B as t,H as n,Ji as r,Tt as i,U as a,V as o,W as s,Xa as c,ci as l,di as u,fr as d,hr as f,ji as p,mr as m,pr as h,ui as g,vo as _,wi as v,wt as y,xo as b,yo as x,z as S}from"./dialogs-config-DZKtVbNK.js";import{n as C,s as w}from"./onboarding-CxtzQldG.js";import{C as T,D as E,E as D,S as O,T as k,a as A,l as j,n as M,o as N,x as P}from"./history-view-jX3PPID6.js";import{c as F,l as I,o as L,s as R}from"./index-DjD2SPNZ.js";import{a as z,o as B}from"./settings-list-CKPEGohm.js";import{t as V}from"./settings-models-skeleton-l966LEN8.js";var H=e(b(),1),U=x();function W(e){return`settings-models:coding:${e}`}function G(e){return`settings-models:image:${e}`}async function K(){let e=(await i()).filter(e=>e.apiKey),t={};e.forEach(e=>{t[e.slug]=`alphabetical`});let n={},r={};return await Promise.all(e.map(async e=>{try{let t=await s(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{providers:e,allModels:n,enabledModelIds:r,providerSortOptions:t}}async function q(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n={},r={};return await Promise.all(t.map(async e=>{try{let t=await a(e.slug);n[e.slug]=t.models,r[e.slug]=new Set(t.enabledModelIds)}catch(t){console.error(`Failed to load image models for ${e.slug}:`,t),n[e.slug]=[],r[e.slug]=new Set}})),{allImageModels:n,enabledImageModelIds:r}}var J=p();function ee({providers:e,globalSearchQuery:t,providerSortOptions:n,setProviderSortOptions:r,filterAndSortModels:i,getModelDisplayName:a,onSaveStatus:s}){let p=A(G(0),()=>q(e)),[b]=(0,H.useState)(p.allImageModels),[x,w]=(0,H.useState)(p.enabledImageModelIds);async function E(e,t){try{x[e]?.has(t)?(await S(e,t),w(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await o(e,t),w(n=>({...n,[e]:new Set([...n[e]||[],t])}))),s(`Model preferences saved successfully`)}catch(e){s(e instanceof Error?e.message:`Failed to save model changes`)}}async function D(e,t){let n=b[e],r=x[e];if(n)for(let i of n)r?.has(i.id)!==t&&await E(e,i.id)}return(0,J.jsx)(`div`,{className:`space-y-6`,children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let o=b[e.slug]||[],s=x[e.slug]||new Set,p=n[e.slug]||`alphabetical`,S=i(o,s,p);return S.length===0&&t?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),S.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-image-${e.slug}`,checked:S.every(e=>s.has(e.id)),onCheckedChange:t=>void D(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-image-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:p===`price-low`||p===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]})]})})]}),S.length===0?(0,J.jsx)(B,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:S.map(t=>{let n=s.has(t.id),r=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:`image-${t.id}`,checked:n,onCheckedChange:()=>void E(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:`image-${t.id}`,className:g(v.label,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:a(t)})}),r&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(r.prompt??0)===0&&(r.completion??0)===0?``:`$${u(r.prompt??0)} in | $${u(r.completion??0)} out`})]})]},t.id)})})})]},e.slug)})})}function Y({loadVersion:e}){let i=A(W(e),()=>K()),a=i.providers,[o]=(0,H.useState)(i.allModels),[s,p]=(0,H.useState)(i.enabledModelIds),[b,x]=(0,H.useState)(`coding`),[S,M]=(0,H.useState)(``),[N,V]=(0,H.useState)(i.providerSortOptions),[U,G]=(0,H.useState)(``),q=e=>w(e.id),Y=async(e,r)=>{try{s[e]?.has(r)?(await t(e,r),p(t=>{let n=new Set(t[e]??[]);return n.delete(r),{...t,[e]:n}})):(await n(e,r),p(t=>({...t,[e]:new Set([...t[e]||[],r])}))),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},X=async(e,t)=>{let n=o[e],r=s[e];if(n)for(let i of n)r?.has(i.id)!==t&&await Y(e,i.id)},Z=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Q=({codingIndex:e,modelName:t})=>{let n=Z(e);return n===0?null:(0,J.jsx)(m,{children:(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,J.jsx)(r,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,J.jsx)(h,{children:(0,J.jsxs)(`p`,{className:v.body,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},$=(e,t,n)=>{let r=S.toLowerCase();return e.filter(e=>{let t=q(e);return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)||t.toLowerCase().includes(r)}).sort((e,r)=>{let i=+!t.has(e.id),a=+!t.has(r.id);if(i!==a)return i-a;if(n===`price-low`){let t=!!e.pricing;return t===!!r.pricing?!e.pricing||!r.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((r.pricing.prompt??0)+(r.pricing.completion??0))/2:t?-1:1}if(n===`price-high`){let t=!!e.pricing;if(t!==!!r.pricing)return t?-1:1;if(!e.pricing||!r.pricing)return 0;let n=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((r.pricing.prompt??0)+(r.pricing.completion??0))/2-n}if(n===`coding-index`){let t=e.coding_index!==void 0&&e.coding_index!==null;return t===(r.coding_index!==void 0&&r.coding_index!==null)?e.coding_index==null||r.coding_index==null?0:r.coding_index-e.coding_index:t?-1:1}return q(e).localeCompare(q(r))})};return a.length===0?(0,J.jsx)(k,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}):(0,J.jsx)(E,{children:(0,J.jsxs)(D,{children:[(0,J.jsx)(O,{title:`Models`,description:`View and manage available models from your configured providers.`}),(0,J.jsxs)(`div`,{className:`space-y-6`,children:[(0,J.jsx)(z,{placeholder:`Search models across all providers...`,value:S,onChange:M}),(0,J.jsxs)(L,{value:b,onValueChange:e=>{x(e),M(``)},children:[(0,J.jsxs)(F,{className:`mb-4`,children:[(0,J.jsx)(I,{value:`coding`,children:`Coding`}),a.some(e=>e.name.toLowerCase()===`openrouter`)&&(0,J.jsx)(I,{value:`image`,children:`Image`})]}),(0,J.jsx)(R,{value:`coding`,children:(0,J.jsx)(`div`,{className:`space-y-6`,children:a.map(e=>{let t=o[e.slug]||[],n=s[e.slug]||new Set,i=N[e.slug]||`alphabetical`,a=$(t,n,i);return a.length===0&&S?null:(0,J.jsxs)(`div`,{className:`space-y-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`div`,{className:`h-8 w-8 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:(0,J.jsx)(`img`,{src:y(e.slug),alt:`${e.name} logo`,className:`h-5 w-5 dark:invert`,onError:e=>{e.target.style.display=`none`;let t=e.target.parentElement;t&&(t.classList.remove(`overflow-hidden`),t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-muted-foreground"><path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5a2.5 2.5 0 0 0 0 5"/><path d="M15.5 15.5a2.5 2.5 0 0 0 0-5"/></svg>`)}})}),(0,J.jsx)(T,{title:e.name,className:`mb-0`})]}),a.length>0&&(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(C,{id:`select-all-${e.slug}`,checked:a.every(e=>n.has(e.id)),onCheckedChange:t=>X(e.slug,t===!0)}),(0,J.jsx)(`label`,{htmlFor:`select-all-${e.slug}`,className:g(v.body,`cursor-pointer whitespace-nowrap`),children:`Select all models`})]}),(0,J.jsx)(m,{children:(0,J.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`alphabetical`})),children:(0,J.jsx)(_,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort A–Z`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`price-low`||i===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`price-low`})),children:(0,J.jsx)(c,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by price`})]}),(0,J.jsxs)(d,{children:[(0,J.jsx)(f,{asChild:!0,children:(0,J.jsx)(l,{type:`button`,variant:i===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(t=>({...t,[e.slug]:`coding-index`})),children:(0,J.jsx)(r,{className:`h-4 w-4`})})}),(0,J.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),a.length===0?(0,J.jsx)(B,{message:S?`No models matching your search.`:`No models available for this provider.`}):(0,J.jsx)(m,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:a.map(t=>{let r=n.has(t.id),a=t.pricing;return(0,J.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,children:[(0,J.jsx)(C,{id:t.id,checked:r,onCheckedChange:()=>Y(e.slug,t.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,J.jsx)(`label`,{htmlFor:t.id,className:g(v.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:q(t)})}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[i===`coding-index`&&(0,J.jsx)(Q,{codingIndex:t.coding_index,modelName:q(t)}),a&&(0,J.jsx)(`span`,{className:g(v.compact,`text-muted-foreground whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${u(a.prompt??0)} in | $${u(a.completion??0)} out`})]})]})]},t.id)})})})]},e.slug)})})}),(0,J.jsx)(R,{value:`image`,children:b===`image`?(0,J.jsx)(H.Suspense,{fallback:(0,J.jsx)(j,{className:`py-12`,size:`sm`}),children:(0,J.jsx)(ee,{providers:a,globalSearchQuery:S,providerSortOptions:N,setProviderSortOptions:V,filterAndSortModels:$,getModelDisplayName:q,onSaveStatus:e=>{G(e),e.includes(`Failed`)||setTimeout(()=>G(``),3e3)}})}):null})]}),U&&(0,J.jsx)(P,{variant:U.includes(`error`)||U.includes(`Failed`)?`error`:`success`,className:`mb-0`,children:U})]})]})})}function X(){let e=(0,U.c)(8),[t,n]=(0,H.useState)(0),r;e[0]===t?r=e[1]:(r=function(){N(W(t)),n(Q)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,J.jsx)(V,{}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,J.jsx)(H.Suspense,{fallback:a,children:(0,J.jsx)(Y,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,J.jsx)(M,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:Z,children:o}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function Z(e,t){return(0,J.jsx)(k,{title:`Failed to load models`,action:(0,J.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Q(e){return e+1}export{X as SettingsModelsView,X as default};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Or as o,P as s,Ui as c,Wa as l,ci as u,ia as d,ji as f,jt as p,ln as m,pt as h,so as g,ui as _,vt as ee,wi as v,xo as y,yo as b}from"./dialogs-config-DZKtVbNK.js";import{n as x,t as S}from"./react-vendor-Ba8DSNiO.js";import{A as te,C,D as w,E as ne,F as T,I as re,M as ie,N as ae,P as oe,S as E,T as D,b as O,j as k,k as A,x as j,y as M}from"./history-view-jX3PPID6.js";import{C as se,E as N,O as P,j as F}from"./index-DjD2SPNZ.js";import{t as I}from"./skeleton-qzmFgKhS.js";import{a as ce,i as le,n as L,r as R,t as z}from"./settings-list-CKPEGohm.js";import{t as B}from"./mcp-server-card-CTCrhFIS.js";var V=b(),H=e(y(),1),U=f(),W=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=_(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(x,{className:_(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,U.jsx)(S,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});W.displayName=S.displayName;function ue({threadId:e,onRuleCreated:t}){let[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),p=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=p.length>0&&p.length<=64;return e?(0,U.jsx)(w,{children:(0,U.jsxs)(M,{children:[(0,U.jsx)(E,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsxs)(O,{title:`Rule Name`,children:[(0,U.jsx)(r,{id:`ruleName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:d}),i?(0,U.jsxs)(`p`,{className:_(v.caption,`mt-2`),children:[`File name: `,(0,U.jsxs)(`span`,{className:`font-mono`,children:[p||`...`,`.md`]})]}):null]}),(0,U.jsx)(O,{title:`Description`,children:(0,U.jsx)(P,{id:`ruleDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:d})}),(0,U.jsx)(O,{title:`Always Apply`,description:c?`This rule will be automatically added to context for all conversations.`:`Only the rule description will be added to context, allowing the agent to read the rule file when needed.`,action:(0,U.jsx)(W,{id:`alwaysApply`,checked:c,onCheckedChange:l,disabled:d})}),(0,U.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,U.jsx)(u,{onClick:async()=>{if(!(!h||!e)){f(!0);try{let n=`---
2
+ description: ${o.trim()}
3
+ alwaysApply: ${c}
4
+ ---
5
+
6
+ Place your rule instructions here as markdown.
7
+ `;await m(e,`.agents/rules/${p}.md`,n),N({title:`Rule created`,description:`Rule '${p}' was created successfully.`}),a(``),s(``),l(!1),t?.(p)}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{f(!1)}}},disabled:!h||!o.trim()||d,children:d?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,U.jsxs)(U.Fragment,{children:[`Continue`,(0,U.jsx)(g,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,U.jsx)(D,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function G(e){let t=[];for(let n of e)n.type===`file`&&n.path.startsWith(`.agents/rules/`)&&t.push(n),n.children&&n.children.length>0&&t.push(...G(n.children));return t}function K(){let e=F(e=>e.selectedProjectId),n=F(e=>e.selectedThreadId),{setActiveMainTab:r,setPendingExplorerPath:f,triggerExplorerRefresh:g,setExplorerClearPath:_}=se(),[v,y]=(0,H.useState)([]),[b,x]=(0,H.useState)(!1),[S,O]=(0,H.useState)(!1),[M,P]=(0,H.useState)(null),[V,W]=(0,H.useState)(!1),[K,q]=(0,H.useState)([]),[J,Y]=(0,H.useState)(new Set),[X,Z]=(0,H.useState)(``),Q=(0,H.useCallback)(async()=>{if(e){x(!0);try{let t=G(await ee(e));if(n)try{let e=G(await p(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}y(t),Y(new Set(t.map(e=>e.path)))}catch{y([]),Y(new Set)}finally{x(!1)}}},[e,n]);(0,H.useEffect)(()=>{Q()},[Q]),(0,H.useEffect)(()=>{h().then(q).catch(()=>q([]))},[]);let de=(0,H.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;W(!0);try{try{await s(e,i)}catch{if(n)await a(n,i);else throw Error(`No thread selected to delete from`)}_(i),g(),Y(e=>{let t=new Set(e);return t.delete(i),t}),N({title:`Rule removed`,description:r}),P(null),await Q()}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{W(!1)}},[e,n,Q,g,_]),fe=(0,H.useCallback)(e=>{f(e),r(`explorer`)},[f,r]),pe=(0,H.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!n||J.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await i(n,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await m(n,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
8
+ `)),Y(e=>new Set(e).add(t)),g(),Q(),N({title:`Rule installed`,description:e.name})}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[n,J,g,Q]),$=X.trim()?K.filter(e=>e.name.toLowerCase().includes(X.toLowerCase())||e.description.toLowerCase().includes(X.toLowerCase())):K;return e?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(w,{children:(0,U.jsxs)(ne,{children:[(0,U.jsx)(E,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,U.jsx)(u,{onClick:()=>O(!0),disabled:!n,children:`Add Rule`})}),!n&&(0,U.jsx)(j,{children:`Select a thread to add or install rules.`}),(0,U.jsx)(C,{title:`Installed`}),b?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(I,{className:`h-20 w-full`}),(0,U.jsx)(I,{className:`h-20 w-full`})]}):v.length===0?(0,U.jsx)(z,{icon:d,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,U.jsx)(`div`,{className:`space-y-3 mb-8`,children:v.map(e=>(0,U.jsx)(L,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,U.jsx)(l,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete rule`,icon:(0,U.jsx)(c,{className:`h-4 w-4`}),onClick:()=>P(e),destructive:!0}]},e.id))}),(0,U.jsx)(C,{title:`Available`,className:`mb-0`}),(0,U.jsx)(ce,{placeholder:`Search available rules...`,value:X,onChange:Z}),K.length===0?(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(I,{className:`h-20 w-full`}),(0,U.jsx)(I,{className:`h-20 w-full`})]}):$.length===0?(0,U.jsx)(le,{searchQuery:X,emptyLabel:`No available rules found.`}):(0,U.jsx)(R,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=J.has(t);return(0,U.jsx)(B,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,U.jsx)(t,{open:S,onOpenChange:O,children:(0,U.jsx)(o,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,U.jsx)(ue,{threadId:n,onRuleCreated:()=>{O(!1),Q(),g()}})})}),(0,U.jsx)(A,{open:M!==null,onOpenChange:e=>!e&&P(null),children:(0,U.jsxs)(ie,{children:[(0,U.jsxs)(T,{children:[(0,U.jsx)(re,{children:`Delete Rule`}),(0,U.jsxs)(ae,{children:[`Are you sure you want to delete the rule "`,M?.name,`"? This action cannot be undone.`]})]}),(0,U.jsxs)(oe,{children:[(0,U.jsx)(k,{children:`Cancel`}),(0,U.jsx)(te,{onClick:()=>M&&void de(M),disabled:V,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:V?`Deleting...`:`Delete`})]})]})})]}):(0,U.jsx)(D,{children:`Select a project to manage rules.`})}export{K as SettingsRulesView,K as default};
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,Li as o,Or as s,P as c,Ui as l,Wa as u,ci as d,ji as f,jt as p,k as m,ln as ee,mt as te,so as h,ui as g,vt as ne,wi as _,xo as v}from"./dialogs-config-DZKtVbNK.js";import{A as y,C as b,D as x,E as S,F as C,I as re,M as ie,N as ae,P as oe,S as w,T,b as E,j as se,k as ce,x as le,y as D}from"./history-view-jX3PPID6.js";import{C as O,E as k,O as A,j}from"./index-DjD2SPNZ.js";import{t as M}from"./skeleton-qzmFgKhS.js";import{a as N,i as P,n as F,r as I,t as L}from"./settings-list-CKPEGohm.js";import{t as R}from"./mcp-server-card-CTCrhFIS.js";var z=e(v(),1),B=f();function V({threadId:e,onSkillCreated:t}){let[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),u=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),f=u.length>0&&u.length<=64;return e?(0,B.jsx)(x,{children:(0,B.jsxs)(D,{children:[(0,B.jsx)(w,{title:`Add Skill`,description:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(E,{title:`Skill Name`,children:[(0,B.jsx)(r,{id:`skillName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Code Review`,disabled:c}),i?(0,B.jsxs)(`p`,{className:g(_.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:u||`...`})]}):null]}),(0,B.jsx)(E,{title:`Description`,children:(0,B.jsx)(A,{id:`skillDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:c})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(d,{onClick:async()=>{if(!(!f||!o.trim()||!e)){l(!0);try{let n=await m(e,u,o.trim());k({title:`Skill created`,description:`Skill '${u}' was created successfully.`}),a(``),s(``),t?.(n.path,`SKILL.md`)}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{l(!1)}}},disabled:!f||!o.trim()||c,children:c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(h,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(T,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function H(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...H(n.children))}return t}function U(){let e=j(e=>e.selectedProjectId),n=j(e=>e.selectedThreadId),{setActiveMainTab:r,setPendingExplorerPath:f,triggerExplorerRefresh:m,setExplorerClearPath:h}=O(),[g,_]=(0,z.useState)([]),[v,E]=(0,z.useState)(!1),[D,A]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){E(!0);try{let t=H(await ne(e));if(n)try{let e=H(await p(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}_(t),X(new Set(t.map(e=>`${e.path}/SKILL.md`)))}catch{_([]),X(new Set)}finally{E(!1)}}},[e,n]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{te().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;K(!0);try{try{await c(e,i)}catch{if(n)await a(n,i);else throw Error(`No thread selected to delete from`)}h(i),m(),X(e=>{let t=new Set(e);return t.delete(`${i}/SKILL.md`),t}),k({title:`Skill removed`,description:r}),W(null),await Q()}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to remove skill`,variant:`destructive`})}finally{K(!1)}},[e,n,Q,m,h]),fe=(0,z.useCallback)(e=>{f(`${e}/SKILL.md`),r(`explorer`)},[f,r]),pe=(0,z.useCallback)(async e=>{let t=`.agents/skills/${e.id}/SKILL.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await i(n,e.gitHubRepo,e.gitHubFolder,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions),await ee(n,t,r.join(`
2
+ `))}X(e=>new Set(e).add(t)),m(),Q(),k({title:`Skill installed`,description:e.name})}catch(e){k({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`})}},[n,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(x,{children:(0,B.jsxs)(S,{children:[(0,B.jsx)(w,{title:`Skills`,description:`Manage agent skills. Skills are reusable instruction sets that guide agent behavior.`,action:(0,B.jsx)(d,{onClick:()=>A(!0),disabled:!n,children:`Add Skill`})}),!n&&(0,B.jsx)(le,{children:`Select a thread to add or install skills.`}),(0,B.jsx)(b,{title:`Installed`}),v?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):g.length===0?(0,B.jsx)(L,{icon:o,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:g.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete skill`,icon:(0,B.jsx)(l,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(b,{title:`Available`,className:`mb-0`}),(0,B.jsx)(N,{placeholder:`Search available skills...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(M,{className:`h-20 w-full`}),(0,B.jsx)(M,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(P,{searchQuery:Z,emptyLabel:`No available skills found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/skills/${e.id}/SKILL.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:D,onOpenChange:A,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:n,onSkillCreated:()=>{A(!1),Q(),m()}})})}),(0,B.jsx)(ce,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(ie,{children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(re,{children:`Delete Skill`}),(0,B.jsxs)(ae,{children:[`Are you sure you want to delete the skill "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(oe,{children:[(0,B.jsx)(se,{children:`Cancel`}),(0,B.jsx)(y,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(T,{children:`Select a project to manage skills.`})}export{U as SettingsSkillsView,U as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Dt as n,E as r,Ea as i,Er as a,F as o,Gi as s,Gt as c,Or as l,Ui as u,Wa as d,ci as f,ht as p,ji as m,so as h,ui as g,wi as _,wr as v,xo as y}from"./dialogs-config-DZKtVbNK.js";import{A as b,C as x,D as S,E as C,F as ee,I as te,M as ne,N as w,P as T,S as E,T as D,b as O,j as re,k,x as A,y as j}from"./history-view-jX3PPID6.js";import{C as M,E as N,j as P}from"./index-DjD2SPNZ.js";import{t as F}from"./skeleton-qzmFgKhS.js";import{n as I,t as L}from"./radio-group-Bd8YbtFD.js";import{a as ie,i as ae,n as oe,r as se,t as R}from"./settings-list-CKPEGohm.js";import{t as ce}from"./mcp-server-card-CTCrhFIS.js";var z=e(y(),1),B=m();function V({projectId:e,threadId:t,onCommandCreated:n}){let[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(``),[p,m]=(0,z.useState)(`default`),[y,b]=(0,z.useState)(!1),x=o.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=x.length>0&&x.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(j,{children:[(0,B.jsx)(E,{title:`Add Slash Command`,description:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(O,{title:`Command Name`,children:[(0,B.jsx)(a,{id:`commandName`,value:o,onChange:e=>s(e.target.value),placeholder:`e.g. review`,disabled:y}),o?(0,B.jsxs)(`p`,{className:g(_.caption,`mt-2`),children:[`Command: `,(0,B.jsxs)(`span`,{className:`font-mono`,children:[`/`,x||`...`]})]}):null]}),(0,B.jsx)(O,{title:`Description`,children:(0,B.jsx)(a,{id:`commandDescription`,value:c,onChange:e=>l(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:y})}),(0,B.jsx)(O,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,B.jsx)(a,{id:`argumentHint`,value:u,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:y})}),(0,B.jsx)(O,{title:`Mode`,description:p==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,B.jsxs)(L,{value:p,onValueChange:e=>m(e),className:`flex gap-4`,disabled:y,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`default`,id:`mode-default`}),(0,B.jsx)(v,{htmlFor:`mode-default`,className:g(_.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(I,{value:`plan`,id:`mode-plan`}),(0,B.jsx)(v,{htmlFor:`mode-plan`,className:g(_.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(f,{onClick:async()=>{if(!(!C||!e)){b(!0);try{await r(x,``,{description:c.trim()||void 0,argumentHint:u.trim()||void 0,mode:p===`plan`?`plan`:void 0},`project`,t??void 0),N({title:`Command created`,description:`Command '/${x}' was created successfully.`}),s(``),l(``),d(``),m(`default`),n?.(x)}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{b(!1)}}},disabled:!C||y,children:y?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(h,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(D,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function H(){let e=P(e=>e.selectedProjectId),i=P(e=>e.selectedThreadId),{setActiveMainTab:a,setPendingExplorerPath:m,triggerExplorerRefresh:h,setExplorerClearPath:v}=M(),[y,O]=(0,z.useState)([]),[j,I]=(0,z.useState)(!1),[L,H]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Map),[Z,le]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(i){I(!0);try{let e=await n(i);O(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{O([]),X(new Map)}finally{I(!1)}}},[i]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{p().then(J).catch(()=>J([]))},[]);let ue=(0,z.useCallback)(async e=>{K(!0);try{await o(e.filePath),v(e.filePath),h(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),N({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,h,v]),de=(0,z.useCallback)(e=>{m(e),a(`explorer`)},[m,a]),fe=(0,z.useCallback)(async e=>{if(!(!i||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await c(i,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await r(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,i);X(n=>new Map(n).set(e.name,t.filePath))}h(),Q(),N({title:`Command installed`,description:`/${e.name}`})}catch(e){N({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[i,Y,h,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(C,{children:[(0,B.jsx)(E,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,B.jsx)(f,{onClick:()=>H(!0),disabled:!i,children:`Add Command`})}),!i&&(0,B.jsx)(A,{children:`Select a thread to add or install slash commands.`}),(0,B.jsx)(x,{title:`Installed`}),j?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):y.length===0?(0,B.jsx)(R,{icon:s,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:y.map(e=>(0,B.jsx)(oe,{title:`/${e.name}`,subtitle:e.metadata?.description||`No description`,badge:e.metadata?.mode?(0,B.jsx)(`span`,{className:g(_.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):void 0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(d,{className:`h-4 w-4`}),onClick:()=>de(e.filePath)},{label:`Delete command`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.filePath))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ie,{placeholder:`Search available commands...`,value:Z,onChange:le}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(F,{className:`h-20 w-full`}),(0,B.jsx)(F,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(ae,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,B.jsx)(se,{children:$.map(e=>{let t=Y.has(e.name);return(0,B.jsx)(ce,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||fe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:L,onOpenChange:H,children:(0,B.jsx)(l,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{projectId:e,threadId:i,onCommandCreated:()=>{H(!1),Q(),h()}})})}),(0,B.jsx)(k,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(ne,{children:[(0,B.jsxs)(ee,{children:[(0,B.jsx)(te,{children:`Delete Slash Command`}),(0,B.jsxs)(w,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(T,{children:[(0,B.jsx)(re,{children:`Cancel`}),(0,B.jsx)(b,{onClick:()=>U&&void ue(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(D,{children:`Select a project to manage slash commands.`})}export{H as SettingsSlashCommandsView,H as default};
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Dr as t,Ea as n,Er as r,Gt as i,L as a,O as o,Or as s,P as c,Ri as l,Ui as u,Wa as d,ci as f,dt as p,ji as m,jt as h,ln as ee,so as g,ui as _,vt as v,wi as y,xo as b}from"./dialogs-config-DZKtVbNK.js";import{A as te,C as x,D as S,E as C,F as w,I as ne,M as re,N as ie,P as ae,S as T,T as E,b as D,j as O,k as oe,x as k,y as A}from"./history-view-jX3PPID6.js";import{C as se,E as j,O as M,j as N}from"./index-DjD2SPNZ.js";import{t as P}from"./skeleton-qzmFgKhS.js";import{a as ce,i as le,n as F,r as I,t as L}from"./settings-list-CKPEGohm.js";import{t as R}from"./mcp-server-card-CTCrhFIS.js";var z=e(b(),1),B=m();function V({threadId:e,onAgentCreated:t}){let[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(``),[d,p]=(0,z.useState)(!1),m=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),h=m.length>0&&m.length<=64;return e?(0,B.jsx)(S,{children:(0,B.jsxs)(A,{children:[(0,B.jsx)(T,{title:`Add Agent`,description:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(D,{title:`Agent Name`,children:[(0,B.jsx)(r,{id:`agentName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:d}),i?(0,B.jsxs)(`p`,{className:_(y.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:m||`...`})]}):null]}),(0,B.jsx)(D,{title:`Description`,children:(0,B.jsx)(M,{id:`agentDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:d})}),(0,B.jsx)(D,{title:`Allowed Tools`,description:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`,children:(0,B.jsx)(r,{id:`agentTools`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. read grep glob`,disabled:d})}),(0,B.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,B.jsx)(f,{onClick:async()=>{if(!(!h||!s.trim()||!e)){p(!0);try{let n=await o(e,m,s.trim(),l.trim()||void 0);j({title:`Agent created`,description:`Agent '${m}' was created successfully.`}),a(``),c(``),u(``),t?.(n.path,`AGENT.md`)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{p(!1)}}},disabled:!h||!s.trim()||d,children:d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(n,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,B.jsxs)(B.Fragment,{children:[`Continue`,(0,B.jsx)(g,{className:`ml-2 h-4 w-4`})]})})})]})]})}):(0,B.jsx)(E,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function H(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...H(n.children));return t}function U(){let e=N(e=>e.selectedProjectId),n=N(e=>e.selectedThreadId),{setActiveMainTab:r,setPendingExplorerPath:o,triggerExplorerRefresh:m,setExplorerClearPath:g}=se(),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)(!1),[A,M]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,ue]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){D(!0);try{let t=H(await v(e));if(n)try{let e=H(await h(n)),r=new Set(t.map(e=>e.path));for(let n of e)r.has(n.path)||t.push(n)}catch{}y(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{y([]),X(new Set)}finally{D(!1)}}},[e,n]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{p().then(J).catch(()=>J([]))},[]);let de=(0,z.useCallback)(async t=>{if(!e)return;let r=t.name,i=t.path;K(!0);try{try{await c(e,i)}catch{if(n)await a(n,i);else throw Error(`No thread selected to delete from`)}g(i),m(),X(e=>{let t=new Set(e);return t.delete(`${i}/AGENT.md`),t}),j({title:`Agent removed`,description:r}),W(null),await Q()}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,n,Q,m,g]),fe=(0,z.useCallback)(e=>{o(`${e}/AGENT.md`),r(`explorer`)},[o,r]),pe=(0,z.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!n||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await i(n,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await ee(n,t,r.join(`
2
+ `))}X(e=>new Set(e).add(t)),m(),Q(),j({title:`Agent installed`,description:e.name})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[n,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S,{children:(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(f,{onClick:()=>M(!0),disabled:!n,children:`Add Subagent`})}),!n&&(0,B.jsx)(k,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(x,{title:`Installed`}),b?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):_.length===0?(0,B.jsx)(L,{icon:l,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,B.jsx)(`div`,{className:`space-y-3 mb-8`,children:_.map(e=>(0,B.jsx)(F,{title:e.name,subtitle:e.path,subtitleMono:!0,actions:[{label:`View in explorer`,icon:(0,B.jsx)(d,{className:`h-4 w-4`}),onClick:()=>fe(e.path)},{label:`Delete agent`,icon:(0,B.jsx)(u,{className:`h-4 w-4`}),onClick:()=>W(e),destructive:!0}]},e.id))}),(0,B.jsx)(x,{title:`Available`,className:`mb-0`}),(0,B.jsx)(ce,{placeholder:`Search available subagents...`,value:Z,onChange:ue}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(P,{className:`h-20 w-full`}),(0,B.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(le,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(I,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,B.jsx)(R,{name:e.name,description:e.description,installed:n,onClick:()=>{n||pe(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(t,{open:A,onOpenChange:M,children:(0,B.jsx)(s,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{threadId:n,onAgentCreated:()=>{M(!1),Q(),m()}})})}),(0,B.jsx)(oe,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(re,{children:[(0,B.jsxs)(w,{children:[(0,B.jsx)(ne,{children:`Delete Subagent`}),(0,B.jsxs)(ie,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(ae,{children:[(0,B.jsx)(O,{children:`Cancel`}),(0,B.jsx)(te,{onClick:()=>U&&void de(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(E,{children:`Select a project to manage subagents.`})}export{U as SettingsSubagentsView,U as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Kt as n,ci as r,ji as i,ui as a,wi as o,wn as s,wr as c,xo as l,xt as u}from"./dialogs-config-DZKtVbNK.js";import{n as d}from"./onboarding-CxtzQldG.js";import{A as f,E as p,F as m,I as h,M as g,N as _,P as v,S as y,T as b,j as x,k as S,w as C}from"./history-view-jX3PPID6.js";import{E as w,O as T,j as E}from"./index-DjD2SPNZ.js";var D=e(l(),1),O=i();function k(){let e=E(e=>e.selectedProjectId),[i,l]=(0,D.useState)(``),[k,A]=(0,D.useState)(``),[j,M]=(0,D.useState)(!0),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(``),[L,R]=(0,D.useState)(!1),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1);(0,D.useEffect)(()=>{e&&(R(!0),u(e).then(e=>{let t=e.useCustomSystemPrompt;l(e.generatedPrompt),P(t),I(e.customSystemPrompt),M(!t),A(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{l(``),A(``),M(!0),P(!1),I(``)}).finally(()=>R(!1)))},[e]);function U(){return j?N:k.trim()!==F.trim()}function W(e){A(e),j&&M(!1)}function G(){A(i),M(!0)}function K(e){if(!e){M(!1);return}if(k===i){G();return}H(!0)}function q(){G(),H(!1)}function J(){H(!1)}async function Y(){if(e){if(!j&&!k.trim()){w({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}B(!0);try{await s(e,{customSystemPrompt:j?null:k.trim(),useCustomSystemPrompt:!j}),n(),P(!j),I(j?``:k.trim()),w({title:`System prompt settings saved`})}catch(e){w({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{B(!1)}}}return e?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(C,{children:(0,O.jsxs)(p,{className:`w-full flex-1 flex flex-col min-h-0`,children:[(0,O.jsx)(y,{title:`System Prompt`,description:`View the default system prompt or override it for this project. Instructions, rules, and other context are added separately at runtime.`,action:(0,O.jsx)(r,{onClick:Y,disabled:L||z||!U(),children:z?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(t,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,O.jsx)(d,{id:`use-generated-prompt`,checked:j,onCheckedChange:e=>K(e===!0),disabled:L||z}),(0,O.jsx)(c,{htmlFor:`use-generated-prompt`,className:a(o.labelNormal,`cursor-pointer`),children:`Generated`})]}),L?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,O.jsx)(t,{className:`h-8 w-8 animate-spin text-muted-foreground`})}):(0,O.jsx)(T,{value:k,onChange:e=>W(e.target.value),className:a(o.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:z})]})}),(0,O.jsx)(S,{open:V,onOpenChange:H,children:(0,O.jsxs)(g,{children:[(0,O.jsxs)(m,{children:[(0,O.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,O.jsx)(_,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,O.jsxs)(v,{children:[(0,O.jsx)(x,{onClick:J,children:`No`}),(0,O.jsx)(f,{onClick:q,children:`Yes`})]})]})})]}):(0,O.jsx)(b,{children:`Select a project to edit the system prompt.`})}export{k as SettingsSystemPromptView,k as default};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-C8muiP_K.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-DjD2SPNZ.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-jX3PPID6.js","assets/dialogs-config-DZKtVbNK.js","assets/onboarding-CxtzQldG.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Ba8DSNiO.js","assets/utils-BlXPFbY9.js","assets/index-jIBJk8xl.css","assets/project-settings-view-ZJjQbFbQ.js","assets/radio-group-Bd8YbtFD.js","assets/providers-list-view-BH13AB_H.js","assets/skeleton-qzmFgKhS.js","assets/settings-models-view-CAMouMhE.js","assets/settings-models-skeleton-l966LEN8.js","assets/settings-list-CKPEGohm.js","assets/settings-mcp-servers-view-3gN9ly3z.js","assets/mcp-server-card-CTCrhFIS.js","assets/settings-skills-view-DpzKFcpf.js","assets/settings-rules-view-BnazfbJb.js","assets/settings-slash-commands-view-Drje2Dl4.js","assets/settings-subagents-view-D05kHO1W.js","assets/settings-instructions-view-CV7lRPuw.js","assets/settings-system-prompt-view-DQmSdSnp.js","assets/account-view-BT90zNSx.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ba as n,Ci as r,Gi as i,Kt as a,Li as o,Qa as s,Ri as c,St as l,Xi as u,ci as d,do as f,en as p,ha as m,ia as h,ja as g,ji as _,po as v,ta as y,ui as b,wi as ee,xo as x,yo as te,zi as S}from"./dialogs-config-DZKtVbNK.js";import{ct as ne,lt as re,st as ie}from"./react-vendor-Ba8DSNiO.js";import{r as C}from"./monaco-CZnIWXyV.js";import{c as w,o as T}from"./onboarding-CxtzQldG.js";import{D as E,E as D,T as O}from"./history-view-jX3PPID6.js";import{A as k,T as A,i as ae,j,k as M,n as N,p as P,r as F}from"./index-DjD2SPNZ.js";import{t as I}from"./settings-models-skeleton-l966LEN8.js";var L=te(),R=e(x(),1),z=_(),oe=(0,R.forwardRef)(function(e,t){let n=(0,L.c)(28),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:p,isMobile:m,mobileShowSidebar:h}=e,g=a===void 0?25:a,_=o===void 0?20:o,v=s===void 0?30:s,y=c===void 0?40:c,ee=l===void 0?!1:l,x=u===void 0?0:u,te=d===void 0?``:d,S=m===void 0?!1:m,ne=h===void 0?!0:h,re=S&&!ne,ie=S&&ne,C=`h-full ${te}`,w=S?100:g,T=S?50:_,E=S?100:v,D=re&&`hidden`,O;n[0]===D?O=n[1]:(O=b(`border-r border-transparent`,D),n[0]=D,n[1]=O);let k;n[2]!==x||n[3]!==ee||n[4]!==f||n[5]!==p||n[6]!==t||n[7]!==r||n[8]!==w||n[9]!==T||n[10]!==E||n[11]!==O?(k=(0,z.jsx)(F,{ref:t,defaultSize:w,minSize:T,maxSize:E,collapsible:ee,collapsedSize:x,onCollapse:f,onExpand:p,className:O,children:r}),n[2]=x,n[3]=ee,n[4]=f,n[5]=p,n[6]=t,n[7]=r,n[8]=w,n[9]=T,n[10]=E,n[11]=O,n[12]=k):k=n[12];let A;n[13]===S?A=n[14]:(A=!S&&(0,z.jsx)(N,{withHandle:!0,className:`ml-[-40px]`}),n[13]=S,n[14]=A);let j=ie&&`hidden`,M;n[15]===j?M=n[16]:(M=b(`overflow-hidden`,j),n[15]=j,n[16]=M);let P;n[17]!==i||n[18]!==y||n[19]!==M?(P=(0,z.jsx)(F,{minSize:y,className:M,children:i}),n[17]=i,n[18]=y,n[19]=M,n[20]=P):P=n[20];let I;n[21]!==k||n[22]!==A||n[23]!==P?(I=(0,z.jsxs)(ae,{direction:`horizontal`,className:`h-full`,children:[k,A,P]}),n[21]=k,n[22]=A,n[23]=P,n[24]=I):I=n[24];let R;return n[25]!==C||n[26]!==I?(R=(0,z.jsx)(`div`,{className:C,children:I}),n[25]=C,n[26]=I,n[27]=R):R=n[27],R}),se=[{id:`providers`,label:`Providers`,icon:(0,z.jsx)(s,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,z.jsx)(f,{className:`h-4 w-4`}),route:`/settings/models`},{id:`skills`,label:`Skills`,icon:(0,z.jsx)(o,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`rules`,label:`Rules`,icon:(0,z.jsx)(h,{className:`h-4 w-4`}),route:`/settings/rules`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,z.jsx)(i,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,z.jsx)(c,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`instructions`,label:`Instructions`,icon:(0,z.jsx)(v,{className:`h-4 w-4`}),route:`/settings/instructions`},{id:`system-prompt`,label:`System Prompt`,icon:(0,z.jsx)(u,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,z.jsx)(y,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`General`,icon:(0,z.jsx)(t,{className:`h-4 w-4`}),route:`/settings/general`},{id:`history`,label:`History`,icon:(0,z.jsx)(g,{className:`h-4 w-4`}),route:`/settings/history`},{id:`account`,label:`Account`,icon:(0,z.jsx)(S,{className:`h-4 w-4`}),route:`/settings/account`}];function B(e){let t=[...se];if(!e)return t;let r=t.findIndex(e=>e.id===`skills`);return t.splice(r,0,{id:`project`,label:`Project`,icon:(0,z.jsx)(n,{className:`h-4 w-4`}),route:`/settings/project/${e}`}),t}function ce(e){let t=(0,L.c)(13),{className:n,selectedProjectId:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=ne(),s=ie(),c=(0,R.useRef)(0),l=(0,R.useRef)(null),u,d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>()=>{l.current&&clearTimeout(l.current)},d=[],t[0]=u,t[1]=d):(u=t[0],d=t[1]),(0,R.useEffect)(u,d);let f,p;if(t[2]!==n||t[3]!==s.pathname||t[4]!==o||t[5]!==a||t[6]!==i||t[7]!==r){let e=B(r),u=function(){let t=s.pathname;if(t.startsWith(`/settings/project/`))return`project`;for(let n of e)if(t.startsWith(n.route))return n.id;return`general`}(),d=function(e){e.id===`general`&&i&&(l.current&&clearTimeout(l.current),c.current+=1,c.current>=3?(c.current=0,i()):l.current=setTimeout(()=>{c.current=0},1500)),a?.(),o(e.route)};f=`space-y-1${n?` ${n}`:``}`,p=e.map((t,n)=>(0,z.jsxs)(R.Fragment,{children:[(0,z.jsx)(w,{selected:u===t.id,asChild:!0,children:(0,z.jsx)(`button`,{className:`justify-start`,onClick:()=>d(t),children:(0,z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[t.icon,(0,z.jsx)(`span`,{children:t.label})]})})}),(t.id===`models`||t.id===`mcp-servers`||n===e.length-1)&&(0,z.jsx)(T,{className:`my-2 bg-sidebar-border`})]},t.id)),t[2]=n,t[3]=s.pathname,t[4]=o,t[5]=a,t[6]=i,t[7]=r,t[8]=f,t[9]=p}else f=t[8],p=t[9];let m;return t[10]!==f||t[11]!==p?(m=(0,z.jsx)(`div`,{className:f,children:p}),t[10]=f,t[11]=p,t[12]=m):m=t[12],m}var le=(0,R.lazy)(()=>C(()=>import(`./settings-general-view-C8muiP_K.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ue=(0,R.lazy)(()=>C(()=>import(`./project-settings-view-ZJjQbFbQ.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11,13]))),de=(0,R.lazy)(()=>C(()=>import(`./providers-list-view-BH13AB_H.js`),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,15]))),fe=(0,R.lazy)(()=>C(()=>import(`./settings-models-view-CAMouMhE.js`),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,17,15,18]))),pe=(0,R.lazy)(()=>C(()=>import(`./settings-mcp-servers-view-3gN9ly3z.js`),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),me=(0,R.lazy)(()=>C(()=>import(`./settings-skills-view-DpzKFcpf.js`),__vite__mapDeps([21,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),he=(0,R.lazy)(()=>C(()=>import(`./settings-rules-view-BnazfbJb.js`),__vite__mapDeps([22,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ge=(0,R.lazy)(()=>C(()=>import(`./settings-slash-commands-view-Drje2Dl4.js`),__vite__mapDeps([23,1,2,3,4,5,6,7,8,9,10,11,20,13,18,15]))),_e=(0,R.lazy)(()=>C(()=>import(`./settings-subagents-view-D05kHO1W.js`),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,20,18,15]))),ve=(0,R.lazy)(()=>C(()=>import(`./settings-instructions-view-CV7lRPuw.js`),__vite__mapDeps([25,1,2,3,4,5,6,7,8,9,10,11]))),ye=(0,R.lazy)(()=>C(()=>import(`./settings-system-prompt-view-DQmSdSnp.js`),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11]))),be=(0,R.lazy)(()=>C(()=>import(`./account-view-BT90zNSx.js`),__vite__mapDeps([27,1,2,3,4,5,6,7,8,9,10,11,15]))),xe=(0,R.lazy)(()=>C(()=>import(`./history-view-jX3PPID6.js`).then(e=>e.t),__vite__mapDeps([5,1,6]))),Se=[`general`,`providers`,`models`,`skills`,`rules`,`slash-commands`,`subagents`,`instructions`,`system-prompt`,`mcp-servers`,`history`,`account`];function V(e){let t=(0,L.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,z.jsx)(O,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function Ce(){let e=(0,L.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`mb-6`,children:[(0,z.jsx)(`div`,{className:`h-8 w-32 bg-muted rounded animate-pulse mb-2`}),(0,z.jsx)(`div`,{className:`h-4 w-64 bg-muted rounded animate-pulse`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,z.jsx)(`div`,{className:`mb-6`,children:(0,z.jsx)(`div`,{className:`h-10 w-full bg-muted rounded animate-pulse`})}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(`div`,{className:`h-4 w-36 bg-muted rounded animate-pulse mb-3`}),e[2]=r):r=e[2];let i,a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,z.jsxs)(`div`,{children:[r,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]}),a=(0,z.jsx)(`div`,{className:`h-4 w-40 bg-muted rounded animate-pulse mb-3`}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let o;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,z.jsx)(E,{children:(0,z.jsxs)(D,{children:[t,n,(0,z.jsxs)(`div`,{className:`space-y-8`,children:[i,(0,z.jsxs)(`div`,{children:[a,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-24 bg-muted rounded-lg animate-pulse`})]})]})]})]})}),e[5]=o):o=e[5],o}function we(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/rules`)?`rules`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/instructions`)?`instructions`:e.startsWith(`/settings/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/account`)?`account`:`general`}function Te(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function Ee(){let e=(0,L.c)(61),{tab:t,projectId:n}=re(),i=ne(),o=ie(),s=k(),c=j(ke),u=j(Oe),f;e[0]!==o.pathname||e[1]!==n?(f=!!n&&o.pathname.startsWith(`/settings/project/`),e[0]=o.pathname,e[1]=n,e[2]=f):f=e[2];let h=f,g;e[3]===o.pathname?g=e[4]:(g=Te(o.pathname),e[3]=o.pathname,e[4]=g);let _=g!==null,v;if(e[5]!==o.pathname||e[6]!==o.search||e[7]!==t){let n=new URLSearchParams(o.search).get(`tab`);v=n&&Se.includes(n)?n:t&&Se.includes(t)?t:we(o.pathname),e[5]=o.pathname,e[6]=o.search,e[7]=t,e[8]=v}else v=e[8];let y=v,x=P(),[te,S]=(0,R.useState)(!1),[C,w]=(0,R.useState)(!0),[T,E]=(0,R.useState)(0),D=(0,R.useRef)(null),O;bb0:{if(h){O=`Project`;break bb0}let t;e[9]===y?t=e[10]:(t=se.find(e=>e.id===y)?.label??`Settings`,e[9]=y,e[10]=t),O=t}let ae=O,N;e[11]===x?N=e[12]:(N=()=>{x&&w(!1)},e[11]=x,e[12]=N);let F=N,B;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=()=>{w(!0)},e[13]=B):B=e[13];let Ee=B,H;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(H=async()=>{try{await p(),E(De)}catch(e){console.error(`Failed to reset onboarding:`,e)}},e[14]=H):H=e[14];let Ae=H,U;e[15]===i?U=e[16]:(U=()=>{i(`/`)},e[15]=i,e[16]=U);let je=U,W;e[17]===c?W=e[18]:(W=c?{type:`project`,id:c}:void 0,e[17]=c,e[18]=W);let Me=W,G;e[19]===i?G=e[20]:(G=()=>{i(`/settings/general`)},e[19]=i,e[20]=G);let Ne=G,K;e[21]!==s||e[22]!==n?(K=async()=>{a(n);try{let e=await l();s({type:M.SetProjects,projects:e.projects})}catch(e){let t=e;throw console.error(`Failed to refresh projects after settings update:`,t),t}},e[21]=s,e[22]=n,e[23]=K):K=e[23];let Pe=K,q,J;e[24]!==o.pathname||e[25]!==i?(q=()=>{(o.pathname===`/settings`||o.pathname===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>o.pathname.startsWith(e)))&&i(`/settings/general`,{replace:!0})},J=[o.pathname,i],e[24]=o.pathname,e[25]=i,e[26]=q,e[27]=J):(q=e[26],J=e[27]),(0,R.useEffect)(q,J);let Y;e[28]!==je||e[29]!==F||e[30]!==c?(Y=()=>(0,z.jsx)(A,{onTitleClose:je,subtitle:`Settings`,children:(0,z.jsx)(`div`,{className:`px-2 py-2`,children:(0,z.jsx)(ce,{selectedProjectId:c,onResetOnboarding:Ae,onNavItemSelect:F})})}),e[28]=je,e[29]=F,e[30]=c,e[31]=Y):Y=e[31];let Fe=Y,Ie;e[32]!==y||e[33]!==Ne||e[34]!==Pe||e[35]!==Me||e[36]!==h||e[37]!==T||e[38]!==n||e[39]!==u?(Ie=()=>{if(h&&n)return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Project Settings`}),children:(0,z.jsx)(ue,{projectId:n,onProjectUpdated:Pe})});switch(y){case`general`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`General`}),children:(0,z.jsx)(le,{onboardingResetSignal:T})});case`providers`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(Ce,{}),children:(0,z.jsx)(de,{})});case`models`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(I,{}),children:(0,z.jsx)(fe,{})});case`skills`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Skills`}),children:(0,z.jsx)(me,{})});case`rules`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Rules`}),children:(0,z.jsx)(he,{})});case`slash-commands`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Slash Commands`}),children:(0,z.jsx)(ge,{})});case`subagents`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Subagents`}),children:(0,z.jsx)(_e,{})});case`instructions`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Instructions`}),children:(0,z.jsx)(ve,{})});case`system-prompt`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`System Prompt`}),children:(0,z.jsx)(ye,{})});case`mcp-servers`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`MCP Servers`}),children:(0,z.jsx)(pe,{})});case`history`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`History`}),children:(0,z.jsx)(xe,{isOpen:!0,onClose:Ne,initialFilter:Me,projects:u,inline:!0})});case`account`:return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(V,{title:`Account`}),children:(0,z.jsx)(be,{})});default:return(0,z.jsx)(V,{title:`Settings`})}},e[32]=y,e[33]=Ne,e[34]=Pe,e[35]=Me,e[36]=h,e[37]=T,e[38]=n,e[39]=u,e[40]=Ie):Ie=e[40];let Le=Ie,Re,ze;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>S(!0),ze=()=>S(!1),e[41]=Re,e[42]=ze):(Re=e[41],ze=e[42]);let X;e[43]===Fe?X=e[44]:(X=Fe(),e[43]=Fe,e[44]=X);let Be=`flex-1 overflow-auto ${te&&!x?`ml-[40px]`:``}`,Z;e[45]!==ae||e[46]!==x||e[47]!==_||e[48]!==C?(Z=x&&!C&&!_?(0,z.jsx)(`div`,{className:b(r.settingsPage,`pb-0`),children:(0,z.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:Ee,children:[(0,z.jsx)(m,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`})]}),(0,z.jsx)(`span`,{className:b(ee.sectionTitle,`truncate text-foreground`),children:ae})]})}):null,e[45]=ae,e[46]=x,e[47]=_,e[48]=C,e[49]=Z):Z=e[49];let Q;e[50]===Le?Q=e[51]:(Q=Le(),e[50]=Le,e[51]=Q);let $;e[52]!==Be||e[53]!==Z||e[54]!==Q?($=(0,z.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,z.jsxs)(`div`,{className:Be,children:[Z,Q]})}),e[52]=Be,e[53]=Z,e[54]=Q,e[55]=$):$=e[55];let Ve;return e[56]!==x||e[57]!==C||e[58]!==X||e[59]!==$?(Ve=(0,z.jsx)(oe,{ref:D,collapsible:!0,isMobile:x,mobileShowSidebar:C,onCollapse:Re,onExpand:ze,sidebar:X,children:$}),e[56]=x,e[57]=C,e[58]=X,e[59]=$,e[60]=Ve):Ve=e[60],Ve}function De(e){return e+1}function Oe(e){return e.projects}function ke(e){return e.selectedProjectId}export{Ee as default};
@@ -0,0 +1 @@
1
+ import{ji as e,ui as t,yo as n}from"./dialogs-config-DZKtVbNK.js";var r=n(),i=e();function a(e){let n=(0,r.c)(8),a,o;n[0]===e?(a=n[1],o=n[2]):({className:a,...o}=e,n[0]=e,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=t(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Za as n,ao as r,tn as i,yo as a}from"./dialogs-config-I0_cSU2z.js";import{C as o,M as s,S as c,j as l,k as u}from"./index-DVXbmgHY.js";var d=e(a(),1),f=t();function p(){let e=l(e=>e.selectedProjectId),t=l(e=>e.selectedThreadId),a=l(e=>e.projects),{terminalState:p,dispatch:m}=s(t),{queuedCommand:h,queuedRelativeFolder:g,outputLines:_,history:v,historyIndex:y,cwd:b,isRunning:x}=p,[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)([]),E=a.flatMap(e=>e.threads).find(e=>e.threadId===t)?.path??null,D=!b||b===`.`||b===`./`?E:b,O=!D||D===E,{activeMainTab:k}=o(),A=(0,d.useRef)(null),j=(0,d.useRef)(null),M=(0,d.useRef)(0);(0,d.useEffect)(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[w]),(0,d.useEffect)(()=>{T(_),M.current=_.length},[t,_]),(0,d.useEffect)(()=>{if(_.length===0)T([]),M.current=0;else if(_.length>M.current){let e=_.slice(M.current);T(t=>[...t,...e]),M.current=_.length}},[_]),(0,d.useEffect)(()=>{x||j.current?.focus()},[x]),(0,d.useEffect)(()=>{k===`terminal`&&j.current?.focus()},[k]);let N=(0,d.useCallback)(async(n,r)=>{if(!(!e||!t||!n.trim())){m({type:u.AppendTerminalLine,line:{type:`input`,content:n}}),m({type:u.SetTerminalHistory,history:[n,...v.filter(e=>e!==n)].slice(0,50)}),m({type:u.SetTerminalHistoryIndex,index:-1}),C(``),m({type:u.SetTerminalRunning,isRunning:!0});try{let a=await i(e,t,n,r??void 0);if(!a){m({type:u.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),m({type:u.SetTerminalRunning,isRunning:!1});return}let o=a.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
2
- `);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(t)}}):t.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(t.message)}}):t.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:t.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}}):e.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(e.message)}}):e.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:e.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(l)}})}}catch(e){m({type:u.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{m({type:u.SetTerminalRunning,isRunning:!1})}}},[e,t,m,v]);return(0,d.useEffect)(()=>{h&&!x&&(N(h,g??void 0),m({type:u.ClearQueuedTerminalCommand}))},[h,g,x,m,N]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,f.jsxs)(`div`,{ref:A,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&j.current?.focus()},children:[w.length===0&&!x&&(0,f.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),w.map((e,t)=>(0,f.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,f.jsx)(r,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,f.jsx)(`span`,{children:e.content})]},t))]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!O&&(0,f.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:D.split(`/`).pop()}),(0,f.jsx)(r,{className:`h-4 w-4 text-blue-400 ${O?``:`-ml-1`}`}),(0,f.jsx)(`input`,{ref:j,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:x?`Running...`:`Type a command...`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)N(S);else if(e.key===`ArrowUp`){e.preventDefault();let t=y+1;t<v.length&&(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=y-1;t>=0?(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t])):(m({type:u.SetTerminalHistoryIndex,index:-1}),C(``))}},disabled:x}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,f.jsx)(n,{className:`h-3 w-3 text-neutral-600`}),(0,f.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{p as TerminalPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,ji as n,nn as r,so as i,xo as a}from"./dialogs-config-DZKtVbNK.js";import{C as o,M as s,S as c,j as l,k as u}from"./index-DjD2SPNZ.js";var d=e(a(),1),f=n();function p(){let e=l(e=>e.selectedProjectId),n=l(e=>e.selectedThreadId),a=l(e=>e.projects),{terminalState:p,dispatch:m}=s(n),{queuedCommand:h,queuedRelativeFolder:g,outputLines:_,history:v,historyIndex:y,cwd:b,isRunning:x}=p,[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)([]),E=a.flatMap(e=>e.threads).find(e=>e.threadId===n)?.path??null,D=!b||b===`.`||b===`./`?E:b,O=!D||D===E,{activeMainTab:k}=o(),A=(0,d.useRef)(null),j=(0,d.useRef)(null),M=(0,d.useRef)(0);(0,d.useEffect)(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[w]),(0,d.useEffect)(()=>{T(_),M.current=_.length},[n,_]),(0,d.useEffect)(()=>{if(_.length===0)T([]),M.current=0;else if(_.length>M.current){let e=_.slice(M.current);T(t=>[...t,...e]),M.current=_.length}},[_]),(0,d.useEffect)(()=>{x||j.current?.focus()},[x]),(0,d.useEffect)(()=>{k===`terminal`&&j.current?.focus()},[k]);let N=(0,d.useCallback)(async(t,i)=>{if(!(!e||!n||!t.trim())){m({type:u.AppendTerminalLine,line:{type:`input`,content:t}}),m({type:u.SetTerminalHistory,history:[t,...v.filter(e=>e!==t)].slice(0,50)}),m({type:u.SetTerminalHistoryIndex,index:-1}),C(``),m({type:u.SetTerminalRunning,isRunning:!0});try{let a=await r(e,n,t,i??void 0);if(!a){m({type:u.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),m({type:u.SetTerminalRunning,isRunning:!1});return}let o=a.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
2
+ `);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(t)}}):t.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(t.message)}}):t.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:t.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?m({type:u.AppendTerminalLine,line:{type:`output`,content:c(e)}}):e.type===`error`?m({type:u.AppendTerminalLine,line:{type:`error`,content:c(e.message)}}):e.type===`cwd`&&m({type:u.SetTerminalCwd,cwd:e.path})}catch{m({type:u.AppendTerminalLine,line:{type:`output`,content:c(l)}})}}catch(e){m({type:u.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{m({type:u.SetTerminalRunning,isRunning:!1})}}},[e,n,m,v]);return(0,d.useEffect)(()=>{h&&!x&&(N(h,g??void 0),m({type:u.ClearQueuedTerminalCommand}))},[h,g,x,m,N]),(0,f.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,f.jsxs)(`div`,{ref:A,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&j.current?.focus()},children:[w.length===0&&!x&&(0,f.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),w.map((e,t)=>(0,f.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,f.jsx)(i,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,f.jsx)(`span`,{children:e.content})]},t))]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!O&&(0,f.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:D.split(`/`).pop()}),(0,f.jsx)(i,{className:`h-4 w-4 text-blue-400 ${O?``:`-ml-1`}`}),(0,f.jsx)(`input`,{ref:j,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:x?`Running...`:`Type a command...`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)N(S);else if(e.key===`ArrowUp`){e.preventDefault();let t=y+1;t<v.length&&(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=y-1;t>=0?(m({type:u.SetTerminalHistoryIndex,index:t}),C(v[t])):(m({type:u.SetTerminalHistoryIndex,index:-1}),C(``))}},disabled:x}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,f.jsx)(t,{className:`h-3 w-3 text-neutral-600`}),(0,f.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{p as TerminalPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Fr as t,Ir as n,Lr as r,Nr as i,ji as a,ri as o,wr as s,yo as c}from"./dialogs-config-I0_cSU2z.js";var l=1,u=.9,d=.8,f=.17,p=.1,m=.999,h=.9999,g=.99,_=/[\\\/_+.#"@\[\(\{&]/,v=/[\\\/_+.#"@\[\(\{&]/g,y=/[\s-]/,b=/[\s-]/g;function x(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?l:g;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),S=n.indexOf(c,i),C=0,w,T,E,D;S>=0;)w=x(e,t,n,r,S+1,a+1,o),w>C&&(S===i?w*=l:_.test(e.charAt(S-1))?(w*=d,E=e.slice(i,S-1).match(v),E&&i>0&&(w*=m**+E.length)):y.test(e.charAt(S-1))?(w*=u,D=e.slice(i,S-1).match(b),D&&i>0&&(w*=m**+D.length)):(w*=f,i>0&&(w*=m**+(S-i))),e.charAt(S)!==t.charAt(a)&&(w*=h)),(w<p&&n.charAt(S-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(S-1)!==r.charAt(a))&&(T=x(e,t,n,r,S+1,a+2,o),T*p>w&&(w=T*p)),w>C&&(C=w),S=n.indexOf(c,S+1);return o[s]=C,C}function S(e){return e.toLowerCase().replace(b,` `)}function C(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,x(e,t,S(e),S(t),0,0,{})}var w=e(c(),1),T=`[cmdk-group=""]`,E=`[cmdk-group-items=""]`,D=`[cmdk-group-heading=""]`,O=`[cmdk-item=""]`,k=`${O}:not([aria-disabled="true"])`,A=`cmdk-item-select`,j=`data-value`,ee=(e,t,n)=>C(e,t,n),M=w.createContext(void 0),N=()=>w.useContext(M),P=w.createContext(void 0),F=()=>w.useContext(P),I=w.createContext(void 0),L=w.forwardRef((e,t)=>{let n=Y(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Y(()=>new Set),i=Y(()=>new Map),a=Y(()=>new Map),c=Y(()=>new Set),l=q(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=o(),x=o(),S=o(),C=w.useRef(null),N=re();J(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,F.emit()}},[f]),J(()=>{N(6,V)},[]);let F=w.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)B(),R(),N(1,z);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(N(7,()=>{n.current.selectedItemId=H()?.id,F.emit()}),r||N(5,V),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}F.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),I=w.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,L(t,r)),N(2,()=>{R(),F.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),N(3,()=>{B(),R(),n.current.value||z(),F.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=H();N(4,()=>{B(),t?.getAttribute(`id`)===e&&z(),F.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function L(e,t){let r=l.current?.filter??ee;return e?r(e,n.current.search,t):0}function R(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;U().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(E);t?t.appendChild(e.parentElement===t?e:e.closest(`${E} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${E} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${T}[${j}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function z(){let e=U().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(j);F.setState(`value`,e||void 0)}function B(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=L(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function V(){var e;let t=H();t&&(t.parentElement?.firstChild===t&&((e=t.closest(T)?.querySelector(D))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function H(){return C.current?.querySelector(`${O}[aria-selected="true"]`)}function U(){return Array.from(C.current?.querySelectorAll(k)||[])}function W(e){let t=U()[e];t&&F.setState(`value`,t.getAttribute(j))}function G(e){var t;let n=H(),r=U(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&F.setState(`value`,a.getAttribute(j))}function K(e){let t=H()?.closest(T),n;for(;t&&!n;)t=e>0?te(t,T):ne(t,T),n=t?.querySelector(k);n?F.setState(`value`,n.getAttribute(j)):G(e)}let X=()=>W(U().length-1),Z=e=>{e.preventDefault(),e.metaKey?X():e.altKey?K(1):G(1)},Q=e=>{e.preventDefault(),e.metaKey?W(0):e.altKey?K(-1):G(-1)};return w.createElement(s.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&Z(e);break;case`ArrowDown`:Z(e);break;case`p`:case`k`:v&&e.ctrlKey&&Q(e);break;case`ArrowUp`:Q(e);break;case`Home`:e.preventDefault(),W(0);break;case`End`:e.preventDefault(),X();break;case`Enter`:{e.preventDefault();let t=H();if(t){let e=new Event(A);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:I.inputId,id:I.labelId,style:ie},u),$(e,e=>w.createElement(P.Provider,{value:F},w.createElement(M.Provider,{value:I},e))))}),R=w.forwardRef((e,t)=>{let n=o(),r=w.useRef(null),i=w.useContext(I),c=N(),l=q(e),u=l.current?.forceMount??i?.forceMount;J(()=>{if(!u)return c.item(n,i?.id)},[u]);let d=Z(n,r,[e.value,e.children,r],e.keywords),f=F(),p=X(e=>e.value&&e.value===d.current),m=X(e=>u||c.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);w.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(A,h),()=>t.removeEventListener(A,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return w.createElement(s.div,{ref:a(r,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),z=w.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...c}=e,l=o(),u=w.useRef(null),d=w.useRef(null),f=o(),p=N(),m=X(e=>i||p.filter()===!1?!0:e.search?e.filtered.groups.has(l):!0);J(()=>p.group(l),[]),Z(l,u,[e.value,e.heading,d]);let h=w.useMemo(()=>({id:l,forceMount:i}),[i]);return w.createElement(s.div,{ref:a(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:m?void 0:!0},n&&w.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),$(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},w.createElement(I.Provider,{value:h},e))))}),B=w.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=w.useRef(null),o=X(e=>!e.search);return!n&&!o?null:w.createElement(s.div,{ref:a(i,t),...r,"cmdk-separator":``,role:`separator`})}),V=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=F(),o=X(e=>e.search),c=X(e=>e.selectedItemId),l=N();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(s.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),H=w.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,o=w.useRef(null),c=w.useRef(null),l=X(e=>e.selectedItemId),u=N();return w.useEffect(()=>{if(c.current&&o.current){let e=c.current,t=o.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(s.div,{ref:a(o,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:u.listId},$(e,e=>w.createElement(`div`,{ref:a(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),U=w.forwardRef((e,a)=>{let{open:o,onOpenChange:s,overlayClassName:c,contentClassName:l,container:u,...d}=e;return w.createElement(r,{open:o,onOpenChange:s},w.createElement(n,{container:u},w.createElement(t,{"cmdk-overlay":``,className:c}),w.createElement(i,{"aria-label":e.label,"cmdk-dialog":``,className:l},w.createElement(L,{ref:a,...d}))))}),W=w.forwardRef((e,t)=>X(e=>e.filtered.count===0)?w.createElement(s.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),G=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(s.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(L,{List:H,Item:R,Input:V,Group:z,Separator:B,Dialog:U,Empty:W,Loading:G});function te(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ne(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function q(e){let t=w.useRef(e);return J(()=>{t.current=e}),t}var J=typeof window>`u`?w.useEffect:w.useLayoutEffect;function Y(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function X(e){let t=F(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Z(e,t,n,r=[]){let i=w.useRef(),a=N();return J(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(j,s),i.current=s}),i}var re=()=>{let[e,t]=w.useState(),n=Y(()=>new Map);return J(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Q(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Q(t),{ref:t.ref},n(t.props.children)):n(t)}var ie={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};export{K as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ir as t,Lr as n,Mi as r,Pr as i,Rr as a,Tr as o,ii as s,xo as c}from"./dialogs-config-DZKtVbNK.js";var l=1,u=.9,d=.8,f=.17,p=.1,m=.999,h=.9999,g=.99,_=/[\\\/_+.#"@\[\(\{&]/,v=/[\\\/_+.#"@\[\(\{&]/g,y=/[\s-]/,b=/[\s-]/g;function x(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?l:g;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),S=n.indexOf(c,i),C=0,w,T,E,D;S>=0;)w=x(e,t,n,r,S+1,a+1,o),w>C&&(S===i?w*=l:_.test(e.charAt(S-1))?(w*=d,E=e.slice(i,S-1).match(v),E&&i>0&&(w*=m**+E.length)):y.test(e.charAt(S-1))?(w*=u,D=e.slice(i,S-1).match(b),D&&i>0&&(w*=m**+D.length)):(w*=f,i>0&&(w*=m**+(S-i))),e.charAt(S)!==t.charAt(a)&&(w*=h)),(w<p&&n.charAt(S-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(S-1)!==r.charAt(a))&&(T=x(e,t,n,r,S+1,a+2,o),T*p>w&&(w=T*p)),w>C&&(C=w),S=n.indexOf(c,S+1);return o[s]=C,C}function S(e){return e.toLowerCase().replace(b,` `)}function C(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,x(e,t,S(e),S(t),0,0,{})}var w=e(c(),1),T=`[cmdk-group=""]`,E=`[cmdk-group-items=""]`,D=`[cmdk-group-heading=""]`,O=`[cmdk-item=""]`,k=`${O}:not([aria-disabled="true"])`,A=`cmdk-item-select`,j=`data-value`,ee=(e,t,n)=>C(e,t,n),M=w.createContext(void 0),N=()=>w.useContext(M),P=w.createContext(void 0),F=()=>w.useContext(P),I=w.createContext(void 0),L=w.forwardRef((e,t)=>{let n=Y(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=Y(()=>new Set),i=Y(()=>new Map),a=Y(()=>new Map),c=Y(()=>new Set),l=q(e),{label:u,children:d,value:f,onValueChange:p,filter:m,shouldFilter:h,loop:g,disablePointerSelection:_=!1,vimBindings:v=!0,...y}=e,b=s(),x=s(),S=s(),C=w.useRef(null),N=re();J(()=>{if(f!==void 0){let e=f.trim();n.current.value=e,F.emit()}},[f]),J(()=>{N(6,V)},[]);let F=w.useMemo(()=>({subscribe:e=>(c.current.add(e),()=>c.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)B(),R(),N(1,z);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(S);e?e.focus():(i=document.getElementById(b))==null||i.focus()}if(N(7,()=>{n.current.selectedItemId=H()?.id,F.emit()}),r||N(5,V),l.current?.value!==void 0){let e=t??``;(o=(a=l.current).onValueChange)==null||o.call(a,e);return}}F.emit()}},emit:()=>{c.current.forEach(e=>e())}}),[]),I=w.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,L(t,r)),N(2,()=>{R(),F.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),N(3,()=>{B(),R(),n.current.value||z(),F.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=H();N(4,()=>{B(),t?.getAttribute(`id`)===e&&z(),F.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>l.current.shouldFilter,label:u||e[`aria-label`],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:S,labelId:x,listInnerRef:C}),[]);function L(e,t){let r=l.current?.filter??ee;return e?r(e,n.current.search,t):0}function R(){if(!n.current.search||l.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=C.current;U().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(E);t?t.appendChild(e.parentElement===t?e:e.closest(`${E} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${E} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=C.current?.querySelector(`${T}[${j}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function z(){let e=U().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(j);F.setState(`value`,e||void 0)}function B(){if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=L(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function V(){var e;let t=H();t&&(t.parentElement?.firstChild===t&&((e=t.closest(T)?.querySelector(D))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function H(){return C.current?.querySelector(`${O}[aria-selected="true"]`)}function U(){return Array.from(C.current?.querySelectorAll(k)||[])}function W(e){let t=U()[e];t&&F.setState(`value`,t.getAttribute(j))}function G(e){var t;let n=H(),r=U(),i=r.findIndex(e=>e===n),a=r[i+e];(t=l.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&F.setState(`value`,a.getAttribute(j))}function K(e){let t=H()?.closest(T),n;for(;t&&!n;)t=e>0?te(t,T):ne(t,T),n=t?.querySelector(k);n?F.setState(`value`,n.getAttribute(j)):G(e)}let X=()=>W(U().length-1),Z=e=>{e.preventDefault(),e.metaKey?X():e.altKey?K(1):G(1)},Q=e=>{e.preventDefault(),e.metaKey?W(0):e.altKey?K(-1):G(-1)};return w.createElement(o.div,{ref:t,tabIndex:-1,...y,"cmdk-root":``,onKeyDown:e=>{var t;(t=y.onKeyDown)==null||t.call(y,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:v&&e.ctrlKey&&Z(e);break;case`ArrowDown`:Z(e);break;case`p`:case`k`:v&&e.ctrlKey&&Q(e);break;case`ArrowUp`:Q(e);break;case`Home`:e.preventDefault(),W(0);break;case`End`:e.preventDefault(),X();break;case`Enter`:{e.preventDefault();let t=H();if(t){let e=new Event(A);t.dispatchEvent(e)}}}}},w.createElement(`label`,{"cmdk-label":``,htmlFor:I.inputId,id:I.labelId,style:ie},u),$(e,e=>w.createElement(P.Provider,{value:F},w.createElement(M.Provider,{value:I},e))))}),R=w.forwardRef((e,t)=>{let n=s(),i=w.useRef(null),a=w.useContext(I),c=N(),l=q(e),u=l.current?.forceMount??a?.forceMount;J(()=>{if(!u)return c.item(n,a?.id)},[u]);let d=Z(n,i,[e.value,e.children,i],e.keywords),f=F(),p=X(e=>e.value&&e.value===d.current),m=X(e=>u||c.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);w.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(A,h),()=>t.removeEventListener(A,h)},[m,e.onSelect,e.disabled]);function h(){var e,t;g(),(t=(e=l.current).onSelect)==null||t.call(e,d.current)}function g(){f.setState(`value`,d.current,!0)}if(!m)return null;let{disabled:_,value:v,onSelect:y,forceMount:b,keywords:x,...S}=e;return w.createElement(o.div,{ref:r(i,t),...S,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!_,"aria-selected":!!p,"data-disabled":!!_,"data-selected":!!p,onPointerMove:_||c.getDisablePointerSelection()?void 0:g,onClick:_?void 0:h},e.children)}),z=w.forwardRef((e,t)=>{let{heading:n,children:i,forceMount:a,...c}=e,l=s(),u=w.useRef(null),d=w.useRef(null),f=s(),p=N(),m=X(e=>a||p.filter()===!1?!0:e.search?e.filtered.groups.has(l):!0);J(()=>p.group(l),[]),Z(l,u,[e.value,e.heading,d]);let h=w.useMemo(()=>({id:l,forceMount:a}),[a]);return w.createElement(o.div,{ref:r(u,t),...c,"cmdk-group":``,role:`presentation`,hidden:m?void 0:!0},n&&w.createElement(`div`,{ref:d,"cmdk-group-heading":``,"aria-hidden":!0,id:f},n),$(e,e=>w.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?f:void 0},w.createElement(I.Provider,{value:h},e))))}),B=w.forwardRef((e,t)=>{let{alwaysRender:n,...i}=e,a=w.useRef(null),s=X(e=>!e.search);return!n&&!s?null:w.createElement(o.div,{ref:r(a,t),...i,"cmdk-separator":``,role:`separator`})}),V=w.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=F(),s=X(e=>e.search),c=X(e=>e.selectedItemId),l=N();return w.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),w.createElement(o.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":c,id:l.inputId,type:`text`,value:i?e.value:s,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),H=w.forwardRef((e,t)=>{let{children:n,label:i=`Suggestions`,...a}=e,s=w.useRef(null),c=w.useRef(null),l=X(e=>e.selectedItemId),u=N();return w.useEffect(()=>{if(c.current&&s.current){let e=c.current,t=s.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),w.createElement(o.div,{ref:r(s,t),...a,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":l,"aria-label":i,id:u.listId},$(e,e=>w.createElement(`div`,{ref:r(c,u.listInnerRef),"cmdk-list-sizer":``},e)))}),U=w.forwardRef((e,r)=>{let{open:o,onOpenChange:s,overlayClassName:c,contentClassName:l,container:u,...d}=e;return w.createElement(a,{open:o,onOpenChange:s},w.createElement(n,{container:u},w.createElement(t,{"cmdk-overlay":``,className:c}),w.createElement(i,{"aria-label":e.label,"cmdk-dialog":``,className:l},w.createElement(L,{ref:r,...d}))))}),W=w.forwardRef((e,t)=>X(e=>e.filtered.count===0)?w.createElement(o.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),G=w.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return w.createElement(o.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},$(e,e=>w.createElement(`div`,{"aria-hidden":!0},e)))}),K=Object.assign(L,{List:H,Item:R,Input:V,Group:z,Separator:B,Dialog:U,Empty:W,Loading:G});function te(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ne(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function q(e){let t=w.useRef(e);return J(()=>{t.current=e}),t}var J=typeof window>`u`?w.useEffect:w.useLayoutEffect;function Y(e){let t=w.useRef();return t.current===void 0&&(t.current=e()),t}function X(e){let t=F(),n=()=>e(t.snapshot());return w.useSyncExternalStore(t.subscribe,n,n)}function Z(e,t,n,r=[]){let i=w.useRef(),a=N();return J(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(j,s),i.current=s}),i}var re=()=>{let[e,t]=w.useState(),n=Y(()=>new Map);return J(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Q(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function $({asChild:e,children:t},n){return e&&w.isValidElement(t)?w.cloneElement(Q(t),{ref:t.ref},n(t.props.children)):n(t)}var ie={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};export{K as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{yo as t}from"./dialogs-config-I0_cSU2z.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{xo as t}from"./dialogs-config-DZKtVbNK.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
@@ -22,15 +22,15 @@
22
22
  <meta name="apple-mobile-web-app-title" content="Tarsk" />
23
23
 
24
24
  <title>Tarsk</title>
25
- <script type="module" crossorigin src="/assets/index-DVXbmgHY.js"></script>
25
+ <script type="module" crossorigin src="/assets/index-DjD2SPNZ.js"></script>
26
26
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/monaco-CZnIWXyV.js">
28
- <link rel="modulepreload" crossorigin href="/assets/dialogs-config-I0_cSU2z.js">
29
- <link rel="modulepreload" crossorigin href="/assets/history-view-Be-1C1tJ.js">
30
- <link rel="modulepreload" crossorigin href="/assets/onboarding-CgP4bJ5F.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/dialogs-config-DZKtVbNK.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/history-view-jX3PPID6.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/onboarding-CxtzQldG.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/whisper-wasm-EGutPGND.js">
32
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-Do-APsQ6.js">
33
- <link rel="modulepreload" crossorigin href="/assets/utils-CU0c_yCM.js">
32
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-Ba8DSNiO.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/utils-BlXPFbY9.js">
34
34
  <link rel="stylesheet" crossorigin href="/assets/monaco-Br_kD0ds.css">
35
35
  <link rel="stylesheet" crossorigin href="/assets/index-jIBJk8xl.css">
36
36
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsk",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "description": "CLI for Tarsk - Project Threads Manager",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{Fn as e,In as t,Ln as n,Mn as r,Nn as i,Rn as a,jn as o}from"./dialogs-config-I0_cSU2z.js";async function s(e,t,n=!1){return i(`api/threads/${r(e)}/explorer?path=${encodeURIComponent(t)}&recursive=${n}`)}async function c(e,t){return i(`api/threads/${r(e)}/ai-file?path=${encodeURIComponent(t)}`)}async function l(e,t,n){return a(`api/threads/${r(e)}/ai-file`,{path:t,content:n})}async function u(e,t){return o(`api/threads/${r(e)}/explorer?path=${encodeURIComponent(t)}`)}async function d(e,n,i){return t(`api/threads/${r(e)}/explorer`,{path:n,newName:i})}async function f(e,t,i){return n(`api/threads/${r(e)}/explorer/file`,{dirPath:t,name:i})}async function p(t,n){return e(`api/threads/${r(t)}/explorer/media?path=${encodeURIComponent(n)}`)}async function m(e,t,i){return n(`api/threads/${r(e)}/explorer/folder`,{dirPath:t,name:i})}export{c as a,l as c,p as i,m as n,s as o,u as r,d as s,f as t};
@@ -1 +0,0 @@
1
- import{Ai as e,Ar as ee,Ci as t,Cr as n,Dr as r,Er as i,Or as a,Yi as o,_o as s,dr as c,fr as l,jr as u,kr as d,mr as te,pr as ne,si as f,wa as p}from"./dialogs-config-I0_cSU2z.js";import{n as m}from"./onboarding-CgP4bJ5F.js";import{O as h}from"./index-DVXbmgHY.js";var g=s(),_=e();function v(e){let s=(0,g.c)(57),{open:v,onOpenChange:y,commitMessage:b,onCommitMessageChange:x,autoGenerateCommitMessage:S,onAutoGenerateChange:C,isGeneratingMessage:w,isLoading:T,onGenerateMessage:E,onCommit:D,currentBranch:O}=e,k;s[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(u,{children:`Commit Changes`}),s[0]=k):k=s[0];let A;s[1]===O?A=s[2]:(A=(0,_.jsxs)(ee,{children:[k,(0,_.jsxs)(a,{children:[`Enter a commit message for your changes on branch `,O]})]}),s[1]=O,s[2]=A);let j;s[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,_.jsx)(n,{htmlFor:`commit-message`,children:`Commit Message`}),s[3]=j):j=s[3];let M;s[4]===x?M=s[5]:(M=e=>x(e.target.value),s[4]=x,s[5]=M);let N;s[6]!==b||s[7]!==M?(N=(0,_.jsx)(h,{id:`commit-message`,placeholder:`Enter commit message...`,value:b,onChange:M,rows:4,className:`pr-10`}),s[6]=b,s[7]=M,s[8]=N):N=s[8];let P=w||T,F;s[9]===w?F=s[10]:(F=w?(0,_.jsx)(p,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(o,{className:`h-3.5 w-3.5`}),s[9]=w,s[10]=F);let I;s[11]!==E||s[12]!==P||s[13]!==F?(I=(0,_.jsx)(te,{asChild:!0,children:(0,_.jsx)(f,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:E,disabled:P,children:F})}),s[11]=E,s[12]=P,s[13]=F,s[14]=I):I=s[14];let L=w?`Generating commit message...`:`Generate commit message with AI`,R;s[15]===L?R=s[16]:(R=(0,_.jsx)(l,{children:L}),s[15]=L,s[16]=R);let z;s[17]!==R||s[18]!==I?(z=(0,_.jsx)(ne,{children:(0,_.jsxs)(c,{children:[I,R]})}),s[17]=R,s[18]=I,s[19]=z):z=s[19];let B;s[20]!==z||s[21]!==N?(B=(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,_.jsxs)(`div`,{className:`relative`,children:[N,z]})]}),s[20]=z,s[21]=N,s[22]=B):B=s[22];let V;s[23]===C?V=s[24]:(V=e=>C(e===!0),s[23]=C,s[24]=V);let H;s[25]!==S||s[26]!==V?(H=(0,_.jsx)(m,{id:`auto-generate`,checked:S,onCheckedChange:V}),s[25]=S,s[26]=V,s[27]=H):H=s[27];let U;s[28]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,_.jsx)(n,{htmlFor:`auto-generate`,className:t.labelNormal,children:`Auto generate commit messages`}),s[28]=U):U=s[28];let W;s[29]===H?W=s[30]:(W=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),s[29]=H,s[30]=W);let G;s[31]!==B||s[32]!==W?(G=(0,_.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[B,W]}),s[31]=B,s[32]=W,s[33]=G):G=s[33];let K;s[34]===y?K=s[35]:(K=()=>y(!1),s[34]=y,s[35]=K);let q;s[36]!==T||s[37]!==K?(q=(0,_.jsx)(f,{variant:`outline`,onClick:K,disabled:T,children:`Cancel`}),s[36]=T,s[37]=K,s[38]=q):q=s[38];let J;s[39]!==b||s[40]!==T?(J=T||!b.trim(),s[39]=b,s[40]=T,s[41]=J):J=s[41];let Y=T?`Committing...`:`Commit`,X;s[42]!==D||s[43]!==J||s[44]!==Y?(X=(0,_.jsx)(f,{onClick:D,disabled:J,children:Y}),s[42]=D,s[43]=J,s[44]=Y,s[45]=X):X=s[45];let Z;s[46]!==q||s[47]!==X?(Z=(0,_.jsxs)(d,{children:[q,X]}),s[46]=q,s[47]=X,s[48]=Z):Z=s[48];let Q;s[49]!==G||s[50]!==A||s[51]!==Z?(Q=(0,_.jsxs)(r,{children:[A,G,Z]}),s[49]=G,s[50]=A,s[51]=Z,s[52]=Q):Q=s[52];let $;return s[53]!==y||s[54]!==v||s[55]!==Q?($=(0,_.jsx)(i,{open:v,onOpenChange:y,children:Q}),s[53]=y,s[54]=v,s[55]=Q,s[56]=$):$=s[56],$}export{v as CommitDialog};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,Ci as n,_o as r,ao as i,co as a,eo as o,li as s,yo as c}from"./dialogs-config-I0_cSU2z.js";import{_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./react-vendor-Do-APsQ6.js";var x=r(),S=e(c(),1),C=t(),w=l,T=y,E=S.forwardRef((e,t)=>{let r=(0,x.c)(14),a,o,c,l;r[0]===e?(a=r[1],o=r[2],c=r[3],l=r[4]):({className:o,inset:c,children:a,...l}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=c,r[4]=l);let d;r[5]!==o||r[6]!==c?(d=s(s(n.body,`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`),c&&`pl-8`,o),r[5]=o,r[6]=c,r[7]=d):d=r[7];let f;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,C.jsx)(i,{className:`ml-auto h-4 w-4`}),r[8]=f):f=r[8];let p;return r[9]!==a||r[10]!==l||r[11]!==t||r[12]!==d?(p=(0,C.jsxs)(u,{ref:t,className:d,...l,children:[a,f]}),r[9]=a,r[10]=l,r[11]=t,r[12]=d,r[13]=p):p=r[13],p});E.displayName=u.displayName;var D=S.forwardRef((e,t)=>{let n=(0,x.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=s(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,C.jsx)(b,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});D.displayName=b.displayName;var O=S.forwardRef((e,t)=>{let n=(0,x.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=s(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,C.jsx)(m,{children:(0,C.jsx)(d,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});O.displayName=d.displayName;var k=S.forwardRef((e,t)=>{let r=(0,x.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let c;r[4]!==i||r[5]!==a?(c=s(s(n.body,`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),a&&`pl-8`,i),r[4]=i,r[5]=a,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,C.jsx)(f,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});k.displayName=f.displayName;var A=S.forwardRef((e,t)=>{let r=(0,x.c)(14),i,o,c,l;r[0]===e?(i=r[1],o=r[2],c=r[3],l=r[4]):({className:c,children:o,checked:i,...l}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=c,r[4]=l);let u;r[5]===c?u=r[6]:(u=s(s(n.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),c),r[5]=c,r[6]=u);let d;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(a,{className:`h-4 w-4`})})}),r[7]=d):d=r[7];let f;return r[8]!==i||r[9]!==o||r[10]!==l||r[11]!==t||r[12]!==u?(f=(0,C.jsxs)(_,{ref:t,className:u,checked:i,...l,children:[d,o]}),r[8]=i,r[9]=o,r[10]=l,r[11]=t,r[12]=u,r[13]=f):f=r[13],f});A.displayName=_.displayName;var j=S.forwardRef((e,t)=>{let r=(0,x.c)(12),i,a,c;r[0]===e?(i=r[1],a=r[2],c=r[3]):({className:a,children:i,...c}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=c);let l;r[4]===a?l=r[5]:(l=s(s(n.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),a),r[4]=a,r[5]=l);let u;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(o,{className:`h-2 w-2 fill-current`})})}),r[6]=u):u=r[6];let d;return r[7]!==i||r[8]!==c||r[9]!==t||r[10]!==l?(d=(0,C.jsxs)(p,{ref:t,className:l,...c,children:[u,i]}),r[7]=i,r[8]=c,r[9]=t,r[10]=l,r[11]=d):d=r[11],d});j.displayName=p.displayName;var M=S.forwardRef((e,t)=>{let r=(0,x.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,inset:a,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let c;r[4]!==i||r[5]!==a?(c=s(s(n.body,`px-2 py-1.5 font-semibold text-foreground`),a&&`pl-8`,i),r[4]=i,r[5]=a,r[6]=c):c=r[6];let l;return r[7]!==o||r[8]!==t||r[9]!==c?(l=(0,C.jsx)(h,{ref:t,className:c,...o}),r[7]=o,r[8]=t,r[9]=c,r[10]=l):l=r[10],l});M.displayName=h.displayName;var N=S.forwardRef((e,t)=>{let n=(0,x.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=s(`-mx-1 my-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,C.jsx)(v,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});N.displayName=v.displayName;var P=e=>{let t=(0,x.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=s(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,C.jsx)(`span`,{className:a,...i}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o};P.displayName=`ContextMenuShortcut`;export{T as a,N as i,O as n,k as r,w as t};
@@ -1 +0,0 @@
1
- import{Ai as e,Ar as t,Ci as n,Cr as r,Dr as i,Er as a,Or as o,Tr as s,_o as c,jr as l,kr as u,si as d}from"./dialogs-config-I0_cSU2z.js";import{n as f}from"./onboarding-CgP4bJ5F.js";import{O as p}from"./index-DVXbmgHY.js";var m=c(),h=e();function g(e){let c=(0,m.c)(48),{open:g,onOpenChange:_,repoName:v,onRepoNameChange:y,repoDescription:b,onRepoDescriptionChange:x,isPrivateRepo:S,onPrivateRepoChange:C,isLoading:w,onCreateRepo:T}=e,E;c[0]!==_||c[1]!==x||c[2]!==y?(E=e=>{e||(y(``),x(``)),_(e)},c[0]=_,c[1]=x,c[2]=y,c[3]=E):E=c[3];let D;c[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsxs)(t,{children:[(0,h.jsx)(l,{children:`Create GitHub Repository`}),(0,h.jsx)(o,{children:`Create a new GitHub repository and push your local repository`})]}),c[4]=D):D=c[4];let O;c[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,h.jsx)(r,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),c[5]=O):O=c[5];let k;c[6]===y?k=c[7]:(k=e=>y(e.target.value),c[6]=y,c[7]=k);let A;c[8]!==v||c[9]!==k?(A=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,h.jsx)(s,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:v,onChange:k})]}),c[8]=v,c[9]=k,c[10]=A):A=c[10];let j;c[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(r,{htmlFor:`repo-description`,children:`Description (optional)`}),c[11]=j):j=c[11];let M;c[12]===x?M=c[13]:(M=e=>x(e.target.value),c[12]=x,c[13]=M);let N;c[14]!==b||c[15]!==M?(N=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(p,{id:`repo-description`,placeholder:`Enter repository description...`,value:b,onChange:M,rows:3})]}),c[14]=b,c[15]=M,c[16]=N):N=c[16];let P;c[17]===C?P=c[18]:(P=e=>C(e===!0),c[17]=C,c[18]=P);let F;c[19]!==S||c[20]!==P?(F=(0,h.jsx)(f,{id:`repo-private`,checked:S,onCheckedChange:P}),c[19]=S,c[20]=P,c[21]=F):F=c[21];let I;c[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(r,{htmlFor:`repo-private`,className:n.labelNormal,children:`Private repository`}),c[22]=I):I=c[22];let L;c[23]===F?L=c[24]:(L=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F,I]}),c[23]=F,c[24]=L);let R;c[25]!==L||c[26]!==A||c[27]!==N?(R=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[A,N,L]}),c[25]=L,c[26]=A,c[27]=N,c[28]=R):R=c[28];let z;c[29]===_?z=c[30]:(z=()=>_(!1),c[29]=_,c[30]=z);let B;c[31]!==w||c[32]!==z?(B=(0,h.jsx)(d,{variant:`outline`,onClick:z,disabled:w,children:`Cancel`}),c[31]=w,c[32]=z,c[33]=B):B=c[33];let V=w?`Creating...`:`Create & Push`,H;c[34]!==w||c[35]!==T||c[36]!==V?(H=(0,h.jsx)(d,{onClick:T,disabled:w,children:V}),c[34]=w,c[35]=T,c[36]=V,c[37]=H):H=c[37];let U;c[38]!==B||c[39]!==H?(U=(0,h.jsxs)(u,{children:[B,H]}),c[38]=B,c[39]=H,c[40]=U):U=c[40];let W;c[41]!==R||c[42]!==U?(W=(0,h.jsxs)(i,{children:[D,R,U]}),c[41]=R,c[42]=U,c[43]=W):W=c[43];let G;return c[44]!==g||c[45]!==E||c[46]!==W?(G=(0,h.jsx)(a,{open:g,onOpenChange:E,children:W}),c[44]=g,c[45]=E,c[46]=W,c[47]=G):G=c[47],G}export{g as CreateRepoDialog};
@@ -1,3 +0,0 @@
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};
@@ -1,2 +0,0 @@
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 +0,0 @@
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};