upfynai-code 2.5.0 → 2.6.0

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 (130) hide show
  1. package/README.md +131 -0
  2. package/client/dist/assets/{AppContent-CRld2UWX.js → AppContent-C0CyP3g5.js} +3 -3
  3. package/client/dist/assets/{CanvasPanel-CB4sweQq.js → CanvasPanel-0u9QR7U-.js} +5 -5
  4. package/client/dist/assets/DashboardPanel-Dgqw1yZk.js +1 -0
  5. package/client/dist/assets/{LoginModal-BwkvjfPR.js → LoginModal-CZDEzqjK.js} +1 -1
  6. package/client/dist/assets/Onboarding-DR6NZ4Vz.js +1 -0
  7. package/client/dist/assets/{SetupForm-CH5EA5W0.js → SetupForm-D49gtWY4.js} +1 -1
  8. package/client/dist/assets/{WorkflowsPanel-CO5g5yGG.js → WorkflowsPanel-CqlbEJA_.js} +1 -1
  9. package/client/dist/assets/{ar-SA-G6X2FPQ2-DoJuo98H.js → ar-SA-G6X2FPQ2-BWqa1yBH.js} +1 -1
  10. package/client/dist/assets/{arc-B0wBaTeh.js → arc-BegSKqEW.js} +1 -1
  11. package/client/dist/assets/{az-AZ-76LH7QW2-xdrt1Z13.js → az-AZ-76LH7QW2-DrVlbZDP.js} +1 -1
  12. package/client/dist/assets/{bg-BG-XCXSNQG7-D8NAiF6Y.js → bg-BG-XCXSNQG7-DdunjBgT.js} +1 -1
  13. package/client/dist/assets/{blockDiagram-38ab4fdb-DSnyKzK4.js → blockDiagram-38ab4fdb-BKMbwGHu.js} +1 -1
  14. package/client/dist/assets/{bn-BD-2XOGV67Q-B0qWv8_J.js → bn-BD-2XOGV67Q-_7DtmvwO.js} +1 -1
  15. package/client/dist/assets/{c4Diagram-3d4e48cf-DoZJ13XA.js → c4Diagram-3d4e48cf-hJuiHhSn.js} +1 -1
  16. package/client/dist/assets/{ca-ES-6MX7JW3Y-RgLhfbZZ.js → ca-ES-6MX7JW3Y-BFIrmojG.js} +1 -1
  17. package/client/dist/assets/channel-Bur-rRTp.js +1 -0
  18. package/client/dist/assets/{classDiagram-70f12bd4-GNyDrRCk.js → classDiagram-70f12bd4-BjiAf9cM.js} +1 -1
  19. package/client/dist/assets/{classDiagram-v2-f2320105-CxdGhHm2.js → classDiagram-v2-f2320105-pwBewejc.js} +1 -1
  20. package/client/dist/assets/clone-BtqXeoBJ.js +1 -0
  21. package/client/dist/assets/{createText-2e5e7dd3-DiPywQOa.js → createText-2e5e7dd3-Dq_acOWe.js} +1 -1
  22. package/client/dist/assets/{cs-CZ-2BRQDIVT-BAjmnuoC.js → cs-CZ-2BRQDIVT-B-x4F6TJ.js} +1 -1
  23. package/client/dist/assets/{da-DK-5WZEPLOC-JxKVGt8o.js → da-DK-5WZEPLOC-Btlc8Dgn.js} +1 -1
  24. package/client/dist/assets/{de-DE-XR44H4JA-CrnRlt4z.js → de-DE-XR44H4JA-BVu3ZIoD.js} +1 -1
  25. package/client/dist/assets/{edges-e0da2a9e-DDsXzXLJ.js → edges-e0da2a9e-DH0wVTXR.js} +1 -1
  26. package/client/dist/assets/{el-GR-BZB4AONW-DQd8iogq.js → el-GR-BZB4AONW-h2ll8_ZC.js} +1 -1
  27. package/client/dist/assets/{erDiagram-9861fffd-CBiCC4rl.js → erDiagram-9861fffd-BYezLIR7.js} +1 -1
  28. package/client/dist/assets/{es-ES-U4NZUMDT-vvUblc5i.js → es-ES-U4NZUMDT-Cveiulwt.js} +1 -1
  29. package/client/dist/assets/{eu-ES-A7QVB2H4-De4NNCc1.js → eu-ES-A7QVB2H4-DQluL2PY.js} +1 -1
  30. package/client/dist/assets/{fa-IR-HGAKTJCU-DFBXqIqq.js → fa-IR-HGAKTJCU-BJtcMBSv.js} +1 -1
  31. package/client/dist/assets/{fi-FI-Z5N7JZ37-DV9zESPg.js → fi-FI-Z5N7JZ37-D8NfbVXV.js} +1 -1
  32. package/client/dist/assets/{flowDb-956e92f1-BhdSHbdO.js → flowDb-956e92f1-scnUykhM.js} +1 -1
  33. package/client/dist/assets/{flowDiagram-66a62f08-M-fp1_Ie.js → flowDiagram-66a62f08-jVyWsfyU.js} +1 -1
  34. package/client/dist/assets/flowDiagram-v2-96b9c2cf-N6xgi25h.js +1 -0
  35. package/client/dist/assets/{flowchart-elk-definition-4a651766-Bp0SonQx.js → flowchart-elk-definition-4a651766-gKGX3HqR.js} +1 -1
  36. package/client/dist/assets/{fr-FR-RHASNOE6-CKTMXuGk.js → fr-FR-RHASNOE6-vdj42kC6.js} +1 -1
  37. package/client/dist/assets/{ganttDiagram-c361ad54-iA737GUS.js → ganttDiagram-c361ad54-C2CiWFUP.js} +1 -1
  38. package/client/dist/assets/{gitGraphDiagram-72cf32ee-BX-wj-PV.js → gitGraphDiagram-72cf32ee-C59Yz2LK.js} +1 -1
  39. package/client/dist/assets/{gl-ES-HMX3MZ6V-Cdiqq4jY.js → gl-ES-HMX3MZ6V-DQo0TzoP.js} +1 -1
  40. package/client/dist/assets/{graph-Rxkx3sEa.js → graph-Dx_H43Kv.js} +1 -1
  41. package/client/dist/assets/{he-IL-6SHJWFNN-gYmR5_KT.js → he-IL-6SHJWFNN-DKXK5e33.js} +1 -1
  42. package/client/dist/assets/{hi-IN-IWLTKZ5I-pyqK94AR.js → hi-IN-IWLTKZ5I-C2Qgqc0R.js} +1 -1
  43. package/client/dist/assets/{hu-HU-A5ZG7DT2-DpacJgJy.js → hu-HU-A5ZG7DT2-Ss-6vX0m.js} +1 -1
  44. package/client/dist/assets/{id-ID-SAP4L64H-CAvIX-mj.js → id-ID-SAP4L64H-D7Wsg1S2.js} +1 -1
  45. package/client/dist/assets/{index-3862675e-BX3Fpn6V.js → index-3862675e-u8Nv7hHC.js} +1 -1
  46. package/client/dist/assets/{index-BBlwbHq_.js → index-BVowJdZF.js} +4 -4
  47. package/client/dist/assets/{index-ClfzLIqY.js → index-ce18TYkg.js} +4 -4
  48. package/client/dist/assets/index-kQoJx-bc.css +1 -0
  49. package/client/dist/assets/{infoDiagram-f8f76790-Ckv8imiv.js → infoDiagram-f8f76790-LmoJYsxo.js} +1 -1
  50. package/client/dist/assets/{it-IT-JPQ66NNP-BtpNRSce.js → it-IT-JPQ66NNP-CAPTVl7M.js} +1 -1
  51. package/client/dist/assets/{ja-JP-DBVTYXUO-CwJRyY6M.js → ja-JP-DBVTYXUO-eNVPawR2.js} +1 -1
  52. package/client/dist/assets/{journeyDiagram-49397b02-DWWZssji.js → journeyDiagram-49397b02-BaJqehpR.js} +1 -1
  53. package/client/dist/assets/{kaa-6HZHGXH3-DIWQEb4A.js → kaa-6HZHGXH3-tpuNkKhS.js} +1 -1
  54. package/client/dist/assets/{kab-KAB-ZGHBKWFO-DjGbqhUg.js → kab-KAB-ZGHBKWFO-Dp83kx4x.js} +1 -1
  55. package/client/dist/assets/{kk-KZ-P5N5QNE5-B_VzJdWf.js → kk-KZ-P5N5QNE5-B9IlC6YN.js} +1 -1
  56. package/client/dist/assets/{km-KH-HSX4SM5Z-DUD5mi0o.js → km-KH-HSX4SM5Z-B_KMYaMj.js} +1 -1
  57. package/client/dist/assets/{ko-KR-MTYHY66A--sDB10db.js → ko-KR-MTYHY66A-yebnUNdb.js} +1 -1
  58. package/client/dist/assets/{ku-TR-6OUDTVRD-CKvKrkcX.js → ku-TR-6OUDTVRD-BR6fh6-5.js} +1 -1
  59. package/client/dist/assets/{layout-CkB7sSeq.js → layout-DLl5Jwcl.js} +1 -1
  60. package/client/dist/assets/{line-DC7MA9qY.js → line-FpB7omSK.js} +1 -1
  61. package/client/dist/assets/{linear-C1lBBthf.js → linear-CkXqUFJ8.js} +1 -1
  62. package/client/dist/assets/{lt-LT-XHIRWOB4-MSZf7xYG.js → lt-LT-XHIRWOB4-SutZSWtR.js} +1 -1
  63. package/client/dist/assets/{lv-LV-5QDEKY6T-C-gvvmBB.js → lv-LV-5QDEKY6T-DuAxdcZL.js} +1 -1
  64. package/client/dist/assets/{mindmap-definition-fc14e90a-B3O7hztq.js → mindmap-definition-fc14e90a-DyxXOExh.js} +1 -1
  65. package/client/dist/assets/{mr-IN-CRQNXWMA-XHtBUWQH.js → mr-IN-CRQNXWMA-DqDUWM_8.js} +1 -1
  66. package/client/dist/assets/{my-MM-5M5IBNSE-D9eD2edL.js → my-MM-5M5IBNSE-C40kMFMR.js} +1 -1
  67. package/client/dist/assets/{nb-NO-T6EIAALU-BlImC6gp.js → nb-NO-T6EIAALU-DVij32Ju.js} +1 -1
  68. package/client/dist/assets/{nl-NL-IS3SIHDZ-CPFhnaSP.js → nl-NL-IS3SIHDZ-rT84mDYq.js} +1 -1
  69. package/client/dist/assets/{nn-NO-6E72VCQL-BMvoJSKQ.js → nn-NO-6E72VCQL-BBZXBW8V.js} +1 -1
  70. package/client/dist/assets/{oc-FR-POXYY2M6-Buye63LS.js → oc-FR-POXYY2M6-DzjOugOf.js} +1 -1
  71. package/client/dist/assets/{pa-IN-N4M65BXN-D9uQ3niy.js → pa-IN-N4M65BXN-DD1iU8_F.js} +1 -1
  72. package/client/dist/assets/{percentages-BXMCSKIN-BzXIakGM.js → percentages-BXMCSKIN-WVlHS4wx.js} +6 -6
  73. package/client/dist/assets/{pieDiagram-8a3498a8-BU38mzx-.js → pieDiagram-8a3498a8-Dd_85qBH.js} +1 -1
  74. package/client/dist/assets/{pl-PL-T2D74RX3-BqM4xdcg.js → pl-PL-T2D74RX3-ukVXa48G.js} +1 -1
  75. package/client/dist/assets/{pt-BR-5N22H2LF-rAjrxGyI.js → pt-BR-5N22H2LF-BibawarT.js} +1 -1
  76. package/client/dist/assets/{pt-PT-UZXXM6DQ-DXsqcwLt.js → pt-PT-UZXXM6DQ-So3i9l9w.js} +1 -1
  77. package/client/dist/assets/{quadrantDiagram-120e2f19-HhK4H1WU.js → quadrantDiagram-120e2f19-C4dFVDEx.js} +1 -1
  78. package/client/dist/assets/{requirementDiagram-deff3bca-aDrcyj-A.js → requirementDiagram-deff3bca-DrTO7yFl.js} +1 -1
  79. package/client/dist/assets/{ro-RO-JPDTUUEW-D_F9UKer.js → ro-RO-JPDTUUEW-DY0Xq_Hd.js} +1 -1
  80. package/client/dist/assets/{ru-RU-B4JR7IUQ-MirqN29p.js → ru-RU-B4JR7IUQ-B7u_Zvkd.js} +1 -1
  81. package/client/dist/assets/{sankeyDiagram-04a897e0-C6ij7qbQ.js → sankeyDiagram-04a897e0-D24gfzuS.js} +1 -1
  82. package/client/dist/assets/{sequenceDiagram-704730f1-C0EKO3th.js → sequenceDiagram-704730f1-Dgji2XLQ.js} +1 -1
  83. package/client/dist/assets/{si-LK-N5RQ5JYF-DyZC3mkC.js → si-LK-N5RQ5JYF-OejsLzQ_.js} +1 -1
  84. package/client/dist/assets/{sk-SK-C5VTKIMK-D-ksz-WY.js → sk-SK-C5VTKIMK-_vy2Bt-M.js} +1 -1
  85. package/client/dist/assets/{sl-SI-NN7IZMDC-CknuYoQ1.js → sl-SI-NN7IZMDC-DKOl_u2M.js} +1 -1
  86. package/client/dist/assets/{stateDiagram-587899a1-CYoq2VjL.js → stateDiagram-587899a1-CJ8eBaiU.js} +1 -1
  87. package/client/dist/assets/{stateDiagram-v2-d93cdb3a-C5lbp5px.js → stateDiagram-v2-d93cdb3a-C5K3l-Nt.js} +1 -1
  88. package/client/dist/assets/{styles-6aaf32cf-Dkfsk8gt.js → styles-6aaf32cf-DAKE0jbx.js} +1 -1
  89. package/client/dist/assets/{styles-9a916d00-CMYqtcEN.js → styles-9a916d00-LFAJCgEy.js} +1 -1
  90. package/client/dist/assets/{styles-c10674c1-Bp-5OlRU.js → styles-c10674c1-CllKO8NG.js} +1 -1
  91. package/client/dist/assets/{subset-shared.chunk-kfIB1Zam.js → subset-shared.chunk-Uy-J87FQ.js} +1 -1
  92. package/client/dist/assets/{subset-worker.chunk-DwQBgc4z.js → subset-worker.chunk-dvgDvqt9.js} +1 -1
  93. package/client/dist/assets/{sv-SE-XGPEYMSR-DwN13se1.js → sv-SE-XGPEYMSR-CDCB2ZV5.js} +1 -1
  94. package/client/dist/assets/{svgDrawCommon-08f97a94-CEgCMqs4.js → svgDrawCommon-08f97a94-CObOzbFQ.js} +1 -1
  95. package/client/dist/assets/{ta-IN-2NMHFXQM-ejDfFhwa.js → ta-IN-2NMHFXQM-DHUNdO69.js} +1 -1
  96. package/client/dist/assets/{th-TH-HPSO5L25-Bqc90ZNn.js → th-TH-HPSO5L25-zI2hnBq3.js} +1 -1
  97. package/client/dist/assets/{timeline-definition-85554ec2-BmGdKqG0.js → timeline-definition-85554ec2-C2XHRmxK.js} +1 -1
  98. package/client/dist/assets/{tr-TR-DEFEU3FU-CJvlPbcW.js → tr-TR-DEFEU3FU-l-6Hu4-D.js} +1 -1
  99. package/client/dist/assets/{uk-UA-QMV73CPH-D26-cbWL.js → uk-UA-QMV73CPH-CqSOwrl7.js} +1 -1
  100. package/client/dist/assets/{vendor-icons-aNdOvTr_.js → vendor-icons-Lb69KSFJ.js} +136 -126
  101. package/client/dist/assets/{vi-VN-M7AON7JQ-MbqIIwYM.js → vi-VN-M7AON7JQ-CUL8-mBZ.js} +1 -1
  102. package/client/dist/assets/{xychartDiagram-e933f94c-gfcTauxU.js → xychartDiagram-e933f94c-1fmf6slj.js} +1 -1
  103. package/client/dist/assets/{zh-CN-LNUGB5OW-BZSmhUdL.js → zh-CN-LNUGB5OW-CB5y5VVU.js} +1 -1
  104. package/client/dist/assets/{zh-HK-E62DVLB3-BJqejpiX.js → zh-HK-E62DVLB3-BHcrrEeJ.js} +1 -1
  105. package/client/dist/assets/{zh-TW-RAJ6MFWO-BBXtV-Uz.js → zh-TW-RAJ6MFWO-DoDUdkaJ.js} +1 -1
  106. package/client/dist/index.html +3 -3
  107. package/package.json +17 -14
  108. package/server/cli.js +44 -0
  109. package/server/database/db.js +16 -2
  110. package/server/index.js +2738 -2621
  111. package/server/middleware/auth.js +10 -2
  112. package/server/relay-client.js +73 -20
  113. package/server/routes/agent.js +1226 -1266
  114. package/server/routes/auth.js +32 -29
  115. package/server/routes/commands.js +598 -601
  116. package/server/routes/cursor.js +806 -807
  117. package/server/routes/dashboard.js +154 -1
  118. package/server/routes/git.js +1151 -1165
  119. package/server/routes/mcp.js +534 -551
  120. package/server/routes/settings.js +261 -269
  121. package/server/routes/taskmaster.js +1927 -1963
  122. package/server/routes/vapi-chat.js +94 -0
  123. package/server/routes/voice.js +0 -4
  124. package/server/sandbox.js +120 -0
  125. package/client/dist/assets/DashboardPanel-BXaA-b9z.js +0 -1
  126. package/client/dist/assets/Onboarding-2A_5fPxy.js +0 -1
  127. package/client/dist/assets/channel-BmO6nY0W.js +0 -1
  128. package/client/dist/assets/clone-xuHMqFoD.js +0 -1
  129. package/client/dist/assets/flowDiagram-v2-96b9c2cf-C5eiN8Pg.js +0 -1
  130. package/client/dist/assets/index-Td4UdtLF.css +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-CYdvwJaV.js","assets/vendor-react-9mUTKBHH.js","assets/vendor-markdown-BXEi_H3G.js","assets/vendor-syntax-DnmwQQJF.js","assets/CanvasPanel-CB4sweQq.js","assets/vendor-icons-aNdOvTr_.js","assets/CanvasPanel-WhZulBJw.css","assets/WorkflowsPanel-CO5g5yGG.js","assets/index-ClfzLIqY.js","assets/vendor-i18n-DCFGyhQR.js","assets/index-Td4UdtLF.css","assets/DashboardPanel-BXaA-b9z.js"])))=>i.map(i=>d[i]);
2
- import{r as c,j as e,v as Ft,e as ss,g as lo,u as Ti,f as Ii}from"./vendor-react-9mUTKBHH.js";import{e as mr,f as He,h as Ta,a as Ee,i as Yr,l as Ka,d as Ia,j as Ar,k as Ai}from"./index-ClfzLIqY.js";import{v as Di,w as Qe,t as Ht,x as Va,R as Ut,P as lt,y as Mi,z as dr,X as qe,B as xs,o as Ds,i as Qr,k as qr,h as ht,C as Tt,g as $i,n as vt,D as er,I as tr,J as Ja,K as Kr,c as Ot,W as co,G as Gt,N as Aa,b as jr,a as mo,O as ur,Q as uo,V as Da,E as Ya,Y as Li,L as Fi,_ as qt,$ as Pt,a0 as Ms,a1 as ct,a2 as Vr,Z as cr,a3 as po,a4 as oa,a5 as ia,a6 as Pi,a7 as _i,a8 as Ma,a9 as $s,aa as xo,ab as gs,F as it,ac as Cr,ad as zi,S as fs,ae as Oi,af as go,ag as $a,ah as ho,ai as bs,m as fo,aj as Ri,f as Bi,ak as Wi,al as Ui,am as Xt,an as Rr,ao as la,ap as ca,aq as da,ar as Br,as as Nr,at as ma,au as Sr,av as ua,aw as Wr,ax as bo,ay as yr,az as vr,aA as $r,aB as Lr,aC as kr,aD as Hi,aE as Vt,aF as Qa,aG as Gi,aH as Xa,aI as Fr,aJ as Pr,aK as qi,aL as Ki,aM as _r,aN as Za,aO as Vi,aP as Ji,aQ as hs,aR as as,aS as ys,H as en,aT as qs,aU as Yi,d as Qi,e as La,aV as Xi,aW as yo,aX as vo,aY as Zi,aZ as el,a_ as tl,a$ as rl,b0 as sl,b1 as al,b2 as nl,b3 as tn,b4 as ol}from"./vendor-icons-aNdOvTr_.js";import{a as il,b as ll,C as cl,u as Ge,L as dl,S as ko,c as ml}from"./LoginModal-BwkvjfPR.js";import{h as ul,p as pl,b as Ls}from"./vendor-syntax-DnmwQQJF.js";import{a as xl,b as gl,d as hl,M as fl}from"./vendor-markdown-BXEi_H3G.js";import{F as wo,E as Zt,S as bl,V as Fa,c as Er,a as yl,f as vl,u as kl,b as wl,T as rn,l as jl,h as sn,s as Nl,d as Cl,e as Sl,g as El,i as Ks,j as Tl,R as jo,o as No,k as Il,m as Co,n as Al,p as Dl,q as Ml,r as $l,t as Ll,v as Fl}from"./vendor-codemirror-D_s0aGBu.js";const an=t=>typeof window>"u"?!1:window.innerWidth<t,nn=()=>{if(typeof window>"u")return!1;const t=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!t.standalone||document.referrer.includes("android-app://")};function Pa(t={}){const{mobileBreakpoint:r=768,trackMobile:s=!0,trackPWA:a=!0}=t,[n,o]=c.useState(()=>s?an(r):!1),[i,l]=c.useState(()=>a?nn():!1);return c.useEffect(()=>{if(!s||typeof window>"u")return;const m=()=>{o(an(r))};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[r,s]),c.useEffect(()=>{if(!a||typeof window>"u")return;const m=window.matchMedia("(display-mode: standalone)"),d=()=>{l(nn())};return d(),typeof m.addEventListener=="function"?(m.addEventListener("change",d),()=>{m.removeEventListener("change",d)}):(m.addListener(d),()=>{m.removeListener(d)})},[a]),{isMobile:n,isPWA:i}}const on="2.5.0",Pl=(t,r)=>{const s=t.split(".").map(Number),a=r.split(".").map(Number);for(let n=0;n<Math.max(s.length,a.length);n++){const o=s[n]||0,i=a[n]||0;if(o!==i)return o-i}return 0},So=(t,r)=>{const[s,a]=c.useState(!1),[n,o]=c.useState(null),[i,l]=c.useState(null);return c.useEffect(()=>{const m=async()=>{try{const g=await(await fetch(`https://api.github.com/repos/${t}/${r}/releases/latest`)).json();if(g.tag_name){const p=g.tag_name.replace(/^v/,"");o(p),a(Pl(p,on)>0),l({title:g.name||g.tag_name,body:g.body||"",htmlUrl:g.html_url||`https://github.com/${t}/${r}/releases/latest`,publishedAt:g.published_at})}else a(!1),o(null),l(null)}catch(u){console.error("Version check failed:",u),a(!1),o(null),l(null)}};m();const d=setInterval(m,300*1e3);return()=>clearInterval(d)},[t,r]),{updateAvailable:s,latestVersion:n,currentVersion:on,releaseInfo:i}},or={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},vs=Object.keys(or),_l=new Set(vs),Vs="ui-preferences:sync",ks=(t,r)=>{if(typeof t=="boolean")return t;if(typeof t=="string"){if(t==="true")return!0;if(t==="false")return!1}return r},zl=(t,r)=>{try{const s=localStorage.getItem(t);if(s===null)return r;const a=JSON.parse(s);return ks(a,r)}catch{return r}},Ol=t=>{if(typeof window>"u")return or;try{const r=localStorage.getItem(t);if(r){const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)){const a=s;return vs.reduce((n,o)=>(n[o]=ks(a[o],or[o]),n),{...or})}}}catch{}return vs.reduce((r,s)=>(r[s]=zl(s,or[s]),r),{...or})};function Rl(t,r){switch(r.type){case"set":{const{key:s,value:a}=r;if(!_l.has(s))return t;const n=ks(a,t[s]);return t[s]===n?t:{...t,[s]:n}}case"set_many":{const s=r.value||{};let a=!1;const n={...t};for(const o of vs){if(!(o in s))continue;const i=s[o],l=ks(i,t[o]);n[o]!==l&&(n[o]=l,a=!0)}return a?n:t}case"reset":return{...or,...r.value||{}};default:return t}}function _a(t="uiPreferences"){const r=c.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[s,a]=c.useReducer(Rl,t,Ol);return c.useEffect(()=>{typeof window>"u"||(localStorage.setItem(t,JSON.stringify(s)),window.dispatchEvent(new CustomEvent(Vs,{detail:{storageKey:t,sourceId:r.current,value:s}})))},[s,t]),c.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||a({type:"set_many",value:u})},m=u=>{if(!(u.key!==t||u.newValue===null))try{const g=JSON.parse(u.newValue);l(g)}catch{}},d=u=>{const p=u.detail;!p||p.storageKey!==t||p.sourceId===r.current||l(p.value)};return window.addEventListener("storage",m),window.addEventListener(Vs,d),()=>{window.removeEventListener("storage",m),window.removeEventListener(Vs,d)}},[t]),{preferences:s,setPreference:(l,m)=>{a({type:"set",key:l,value:m})},setPreferences:l=>{a({type:"set_many",value:l})},resetPreferences:l=>{a({type:"reset",value:l})},dispatch:a}}const Bl=()=>{try{const t=localStorage.getItem("claude-settings");return t&&JSON.parse(t).projectSortOrder==="date"?"date":"name"}catch{return"name"}},Wl=()=>{try{const t=localStorage.getItem("starredProjects");return t?new Set(JSON.parse(t)):new Set}catch{return new Set}},Ul=t=>{try{localStorage.setItem("starredProjects",JSON.stringify([...t]))}catch{}},ws=t=>t.__provider==="cursor"?new Date(t.createdAt||0):t.__provider==="codex"?new Date(t.createdAt||t.lastActivity||0):new Date(t.lastActivity||0),Hl=(t,r)=>t.__provider==="cursor"?t.name||r("projects.untitledSession"):t.__provider==="codex"?t.summary||t.name||r("projects.codexSession"):t.summary||r("projects.newSession"),Gl=t=>t.__provider==="cursor"?String(t.createdAt||""):t.__provider==="codex"?String(t.createdAt||t.lastActivity||""):String(t.lastActivity||""),ql=(t,r,s)=>{const a=ws(t),n=Math.floor((r.getTime()-a.getTime())/(1e3*60));return{isCursorSession:t.__provider==="cursor",isCodexSession:t.__provider==="codex",isActive:n<10,sessionName:Hl(t,s),sessionTime:Gl(t),messageCount:Number(t.messageCount||0)}},Eo=(t,r)=>{const s=[...t.sessions||[],...r[t.name]||[]].map(o=>({...o,__provider:"claude"})),a=(t.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),n=(t.codexSessions||[]).map(o=>({...o,__provider:"codex"}));return[...s,...a,...n].sort((o,i)=>ws(i).getTime()-ws(o).getTime())},ln=(t,r)=>{const s=Eo(t,r);return s.length===0?new Date(0):s.reduce((a,n)=>{const o=ws(n);return o>a?o:a},new Date(0))},Kl=(t,r,s,a)=>{const n=[...t];return n.sort((o,i)=>{const l=s.has(o.name),m=s.has(i.name);return l&&!m?-1:!l&&m?1:r==="date"?ln(i,a).getTime()-ln(o,a).getTime():(o.displayName||o.name).localeCompare(i.displayName||i.name)}),n},Vl=(t,r)=>{const s=r.trim().toLowerCase();return s?t.filter(a=>{const n=(a.displayName||a.name).toLowerCase(),o=a.name.toLowerCase();return n.includes(s)||o.includes(s)}):t},Jl=(t,r)=>{var n;const s=!!((n=t.taskmaster)!=null&&n.hasTaskmaster),a=!!(r!=null&&r.hasMCPServer&&(r!=null&&r.isConfigured));return s&&a?"fully-configured":s?"taskmaster-only":a?"mcp-only":"not-configured"},Yl=t=>{const r=typeof t.fullPath=="string"&&t.fullPath.length>0?t.fullPath:typeof t.path=="string"?t.path:"";return{name:t.name,displayName:typeof t.displayName=="string"&&t.displayName.trim().length>0?t.displayName:t.name,fullPath:r,path:typeof t.path=="string"&&t.path.length>0?t.path:r}};function Ql({projects:t,selectedProject:r,selectedSession:s,isLoading:a,isMobile:n,t:o,onRefresh:i,onProjectSelect:l,onSessionSelect:m,onSessionDelete:d,onProjectDelete:u,setCurrentProject:g,setSidebarVisible:p,sidebarVisible:x}){const{addToast:f}=mr(),[h,b]=c.useState(new Set),[C,I]=c.useState(null),[y,v]=c.useState(!1),[A,M]=c.useState(""),[$,k]=c.useState({}),[T,W]=c.useState({}),[U,S]=c.useState(new Set),[H,w]=c.useState(new Date),[P,j]=c.useState("name"),[F,G]=c.useState(!1),[X,D]=c.useState({}),[oe,E]=c.useState(null),[se,J]=c.useState(""),[B,K]=c.useState(""),[V,z]=c.useState(new Set),[O,ne]=c.useState(null),[me,q]=c.useState(null),[N,_]=c.useState(!1),[re,te]=c.useState(()=>Wl()),ve=!n&&!x;c.useEffect(()=>{const ae=setInterval(()=>{w(new Date)},6e4);return()=>clearInterval(ae)},[]),c.useEffect(()=>{W({}),S(new Set),D({})},[t]),c.useEffect(()=>{r&&b(ae=>{if(ae.has(r.name))return ae;const ke=new Set(ae);return ke.add(r.name),ke})},[s,r]),c.useEffect(()=>{if(t.length>0&&!a){const ae=new Set;t.forEach(ke=>{ke.sessions&&ke.sessions.length>=0&&ae.add(ke.name)}),S(ae)}},[t,a]),c.useEffect(()=>{const ae=()=>{j(Bl())};ae();const ke=Ue=>{Ue.key==="claude-settings"&&ae()};window.addEventListener("storage",ke);const Be=setInterval(()=>{document.hasFocus()&&ae()},1e3);return()=>{window.removeEventListener("storage",ke),clearInterval(Be)}},[]);const je=c.useCallback(ae=>ke=>{const Be=ke.target;Be.closest(".overflow-y-auto")||Be.closest("[data-scroll-container]")||(ke.preventDefault(),ke.stopPropagation(),ae())},[]),Ne=c.useCallback(ae=>{b(ke=>{const Be=new Set;return ke.has(ae)||Be.add(ae),Be})},[]),we=c.useCallback((ae,ke)=>{m({...ae,__projectName:ke})},[m]),Ie=c.useCallback(ae=>{te(ke=>{const Be=new Set(ke);return Be.has(ae)?Be.delete(ae):Be.add(ae),Ul(Be),Be})},[]),Re=c.useCallback(ae=>re.has(ae),[re]),Z=c.useCallback(ae=>Eo(ae,T),[T]),ye=c.useMemo(()=>t.map(ae=>{const ke=X[ae.name];return ke===void 0?ae:{...ae,sessionMeta:{...ae.sessionMeta,hasMore:ke}}}),[X,t]),Y=c.useMemo(()=>Kl(ye,P,re,T),[T,P,ye,re]),ie=c.useMemo(()=>Vl(Y,B),[B,Y]),De=c.useCallback(ae=>{I(ae.name),M(ae.displayName)},[]),de=c.useCallback(()=>{I(null),M("")},[]),$e=c.useCallback(async ae=>{try{(await He.renameProject(ae,A)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ke){console.error("Error renaming project:",ke)}finally{I(null),M("")}},[A]),Le=c.useCallback((ae,ke,Be,Ue="claude")=>{q({projectName:ae,sessionId:ke,sessionTitle:Be,provider:Ue})},[]),Je=c.useCallback(async()=>{if(!me)return;const{projectName:ae,sessionId:ke,provider:Be}=me;q(null),d==null||d(ke);try{const Ue=Be==="codex"?await He.deleteCodexSession(ke):await He.deleteSession(ae,ke);Ue.ok||console.error("[Sidebar] Failed to delete session:",Ue.status)}catch(Ue){console.error("[Sidebar] Error deleting session:",Ue)}},[d,me,o]),Ve=c.useCallback(ae=>{ne({project:ae,sessionCount:Z(ae).length})},[Z]),ge=c.useCallback(async()=>{if(!O)return;const{project:ae,sessionCount:ke}=O,Be=ke===0;ne(null),z(Ue=>new Set([...Ue,ae.name]));try{const Ue=await He.deleteProject(ae.name,!Be);if(Ue.ok)u==null||u(ae.name);else{const mt=await Ue.json();f(mt.error||o("messages.deleteProjectFailed"),"error")}}catch(Ue){console.error("Error deleting project:",Ue),f(o("messages.deleteProjectError"),"error")}finally{z(Ue=>{const mt=new Set(Ue);return mt.delete(ae.name),mt})}},[O,u,o]),Fe=c.useCallback(async ae=>{var Ue,mt,It;const ke=X[ae.name];if(!(!(ke!==void 0?ke:((Ue=ae.sessionMeta)==null?void 0:Ue.hasMore)===!0)||$[ae.name])){k(pt=>({...pt,[ae.name]:!0}));try{const pt=(((mt=ae.sessions)==null?void 0:mt.length)||0)+(((It=T[ae.name])==null?void 0:It.length)||0),kt=await He.sessions(ae.name,5,pt);if(!kt.ok)return;const le=await kt.json();W(pe=>({...pe,[ae.name]:[...pe[ae.name]||[],...le.sessions||[]]})),le.hasMore===!1&&D(pe=>({...pe,[ae.name]:!1}))}catch(pt){console.error("Error loading more sessions:",pt)}finally{k(pt=>({...pt,[ae.name]:!1}))}}},[T,$,X]),Ce=c.useCallback(ae=>{l(ae),g(ae)},[l,g]),ze=c.useCallback(async()=>{G(!0);try{await i()}finally{G(!1)}},[i]),Pe=c.useCallback(async(ae,ke,Be)=>{E(null),J("")},[]),_e=c.useCallback(()=>{p(!1)},[p]),Ke=c.useCallback(()=>{p(!0)},[p]);return{isSidebarCollapsed:ve,expandedProjects:h,editingProject:C,showNewProject:y,editingName:A,loadingSessions:$,additionalSessions:T,initialSessionsLoaded:U,currentTime:H,projectSortOrder:P,isRefreshing:F,editingSession:oe,editingSessionName:se,searchFilter:B,deletingProjects:V,deleteConfirmation:O,sessionDeleteConfirmation:me,showVersionModal:N,starredProjects:re,filteredProjects:ie,handleTouchClick:je,toggleProject:Ne,handleSessionClick:we,toggleStarProject:Ie,isProjectStarred:Re,getProjectSessions:Z,startEditing:De,cancelEditing:de,saveProjectName:$e,showDeleteSessionConfirmation:Le,confirmDeleteSession:Je,requestProjectDelete:Ve,confirmDeleteProject:ge,loadMoreSessions:Fe,handleProjectSelect:Ce,refreshProjects:ze,updateSessionSummary:Pe,collapseSidebar:_e,expandSidebar:Ke,setShowNewProject:v,setEditingName:M,setEditingSession:E,setEditingSessionName:J,setSearchFilter:K,setDeleteConfirmation:ne,setSessionDeleteConfirmation:q,setShowVersionModal:_}}function Xl({onExpand:t,onShowSettings:r,updateAvailable:s,onShowVersionModal:a,t:n}){return e.jsxs("div",{className:"h-full flex flex-col items-center py-3 gap-1 bg-background/80 backdrop-blur-sm w-12",children:[e.jsx("button",{onClick:t,className:"w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors group","aria-label":n("common:versionUpdate.ariaLabels.showSidebar"),title:n("common:versionUpdate.ariaLabels.showSidebar"),children:e.jsx(Di,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})}),e.jsx("div",{className:"nav-divider w-6 my-1"}),e.jsx("button",{onClick:r,className:"w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors group","aria-label":n("actions.settings"),title:n("actions.settings"),children:e.jsx(Qe,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})}),s&&e.jsxs("button",{onClick:a,className:"relative w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors","aria-label":n("common:versionUpdate.ariaLabels.updateAvailable"),title:n("common:versionUpdate.ariaLabels.updateAvailable"),children:[e.jsx(Ht,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"absolute top-1.5 right-1.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]})]})}function To(t){var r,s,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(r=0;r<n;r++)t[r]&&(s=To(t[r]))&&(a&&(a+=" "),a+=s)}else for(s in t)t[s]&&(a&&(a+=" "),a+=s);return a}function Io(){for(var t,r,s=0,a="",n=arguments.length;s<n;s++)(t=arguments[s])&&(r=To(t))&&(a&&(a+=" "),a+=r);return a}const Zl=(t,r)=>{const s=new Array(t.length+r.length);for(let a=0;a<t.length;a++)s[a]=t[a];for(let a=0;a<r.length;a++)s[t.length+a]=r[a];return s},ec=(t,r)=>({classGroupId:t,validator:r}),Ao=(t=new Map,r=null,s)=>({nextPart:t,validators:r,classGroupId:s}),js="-",cn=[],tc="arbitrary..",rc=t=>{const r=ac(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sc(i);const l=i.split(js),m=l[0]===""&&l.length>1?1:0;return Do(l,m,r)},getConflictingClassGroupIds:(i,l)=>{if(l){const m=a[i],d=s[i];return m?d?Zl(d,m):m:d||cn}return s[i]||cn}}},Do=(t,r,s)=>{if(t.length-r===0)return s.classGroupId;const n=t[r],o=s.nextPart.get(n);if(o){const d=Do(t,r+1,o);if(d)return d}const i=s.validators;if(i===null)return;const l=r===0?t.join(js):t.slice(r).join(js),m=i.length;for(let d=0;d<m;d++){const u=i[d];if(u.validator(l))return u.classGroupId}},sc=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=t.slice(1,-1),s=r.indexOf(":"),a=r.slice(0,s);return a?tc+a:void 0})(),ac=t=>{const{theme:r,classGroups:s}=t;return nc(s,r)},nc=(t,r)=>{const s=Ao();for(const a in t){const n=t[a];za(n,s,a,r)}return s},za=(t,r,s,a)=>{const n=t.length;for(let o=0;o<n;o++){const i=t[o];oc(i,r,s,a)}},oc=(t,r,s,a)=>{if(typeof t=="string"){ic(t,r,s);return}if(typeof t=="function"){lc(t,r,s,a);return}cc(t,r,s,a)},ic=(t,r,s)=>{const a=t===""?r:Mo(r,t);a.classGroupId=s},lc=(t,r,s,a)=>{if(dc(t)){za(t(a),r,s,a);return}r.validators===null&&(r.validators=[]),r.validators.push(ec(s,t))},cc=(t,r,s,a)=>{const n=Object.entries(t),o=n.length;for(let i=0;i<o;i++){const[l,m]=n[i];za(m,Mo(r,l),s,a)}},Mo=(t,r)=>{let s=t;const a=r.split(js),n=a.length;for(let o=0;o<n;o++){const i=a[o];let l=s.nextPart.get(i);l||(l=Ao(),s.nextPart.set(i,l)),s=l}return s},dc=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,mc=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,s=Object.create(null),a=Object.create(null);const n=(o,i)=>{s[o]=i,r++,r>t&&(r=0,a=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=a[o])!==void 0)return n(o,i),i},set(o,i){o in s?s[o]=i:n(o,i)}}},pa="!",dn=":",uc=[],mn=(t,r,s,a,n)=>({modifiers:t,hasImportantModifier:r,baseClassName:s,maybePostfixModifierPosition:a,isExternal:n}),pc=t=>{const{prefix:r,experimentalParseClassName:s}=t;let a=n=>{const o=[];let i=0,l=0,m=0,d;const u=n.length;for(let h=0;h<u;h++){const b=n[h];if(i===0&&l===0){if(b===dn){o.push(n.slice(m,h)),m=h+1;continue}if(b==="/"){d=h;continue}}b==="["?i++:b==="]"?i--:b==="("?l++:b===")"&&l--}const g=o.length===0?n:n.slice(m);let p=g,x=!1;g.endsWith(pa)?(p=g.slice(0,-1),x=!0):g.startsWith(pa)&&(p=g.slice(1),x=!0);const f=d&&d>m?d-m:void 0;return mn(o,x,p,f)};if(r){const n=r+dn,o=a;a=i=>i.startsWith(n)?o(i.slice(n.length)):mn(uc,!1,i,void 0,!0)}if(s){const n=a;a=o=>s({className:o,parseClassName:n})}return a},xc=t=>{const r=new Map;return t.orderSensitiveModifiers.forEach((s,a)=>{r.set(s,1e6+a)}),s=>{const a=[];let n=[];for(let o=0;o<s.length;o++){const i=s[o],l=i[0]==="[",m=r.has(i);l||m?(n.length>0&&(n.sort(),a.push(...n),n=[]),a.push(i)):n.push(i)}return n.length>0&&(n.sort(),a.push(...n)),a}},gc=t=>({cache:mc(t.cacheSize),parseClassName:pc(t),sortModifiers:xc(t),...rc(t)}),hc=/\s+/,fc=(t,r)=>{const{parseClassName:s,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:o}=r,i=[],l=t.trim().split(hc);let m="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:g,modifiers:p,hasImportantModifier:x,baseClassName:f,maybePostfixModifierPosition:h}=s(u);if(g){m=u+(m.length>0?" "+m:m);continue}let b=!!h,C=a(b?f.substring(0,h):f);if(!C){if(!b){m=u+(m.length>0?" "+m:m);continue}if(C=a(f),!C){m=u+(m.length>0?" "+m:m);continue}b=!1}const I=p.length===0?"":p.length===1?p[0]:o(p).join(":"),y=x?I+pa:I,v=y+C;if(i.indexOf(v)>-1)continue;i.push(v);const A=n(C,b);for(let M=0;M<A.length;++M){const $=A[M];i.push(y+$)}m=u+(m.length>0?" "+m:m)}return m},bc=(...t)=>{let r=0,s,a,n="";for(;r<t.length;)(s=t[r++])&&(a=$o(s))&&(n&&(n+=" "),n+=a);return n},$o=t=>{if(typeof t=="string")return t;let r,s="";for(let a=0;a<t.length;a++)t[a]&&(r=$o(t[a]))&&(s&&(s+=" "),s+=r);return s},yc=(t,...r)=>{let s,a,n,o;const i=m=>{const d=r.reduce((u,g)=>g(u),t());return s=gc(d),a=s.cache.get,n=s.cache.set,o=l,l(m)},l=m=>{const d=a(m);if(d)return d;const u=fc(m,s);return n(m,u),u};return o=i,(...m)=>o(bc(...m))},vc=[],ot=t=>{const r=s=>s[t]||vc;return r.isThemeGetter=!0,r},Lo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Nc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Sc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Jt=t=>kc.test(t),Oe=t=>!!t&&!Number.isNaN(Number(t)),Yt=t=>!!t&&Number.isInteger(Number(t)),Js=t=>t.endsWith("%")&&Oe(t.slice(0,-1)),Wt=t=>wc.test(t),Po=()=>!0,Ec=t=>jc.test(t)&&!Nc.test(t),Oa=()=>!1,Tc=t=>Cc.test(t),Ic=t=>Sc.test(t),Ac=t=>!he(t)&&!fe(t),Dc=t=>rr(t,Oo,Oa),he=t=>Lo.test(t),nr=t=>rr(t,Ro,Ec),un=t=>rr(t,Oc,Oe),Mc=t=>rr(t,Wo,Po),$c=t=>rr(t,Bo,Oa),pn=t=>rr(t,_o,Oa),Lc=t=>rr(t,zo,Ic),ns=t=>rr(t,Uo,Tc),fe=t=>Fo.test(t),zr=t=>pr(t,Ro),Fc=t=>pr(t,Bo),xn=t=>pr(t,_o),Pc=t=>pr(t,Oo),_c=t=>pr(t,zo),os=t=>pr(t,Uo,!0),zc=t=>pr(t,Wo,!0),rr=(t,r,s)=>{const a=Lo.exec(t);return a?a[1]?r(a[1]):s(a[2]):!1},pr=(t,r,s=!1)=>{const a=Fo.exec(t);return a?a[1]?r(a[1]):s:!1},_o=t=>t==="position"||t==="percentage",zo=t=>t==="image"||t==="url",Oo=t=>t==="length"||t==="size"||t==="bg-size",Ro=t=>t==="length",Oc=t=>t==="number",Bo=t=>t==="family-name",Wo=t=>t==="number"||t==="weight",Uo=t=>t==="shadow",Rc=()=>{const t=ot("color"),r=ot("font"),s=ot("text"),a=ot("font-weight"),n=ot("tracking"),o=ot("leading"),i=ot("breakpoint"),l=ot("container"),m=ot("spacing"),d=ot("radius"),u=ot("shadow"),g=ot("inset-shadow"),p=ot("text-shadow"),x=ot("drop-shadow"),f=ot("blur"),h=ot("perspective"),b=ot("aspect"),C=ot("ease"),I=ot("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...v(),fe,he],M=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[fe,he,m],T=()=>[Jt,"full","auto",...k()],W=()=>[Yt,"none","subgrid",fe,he],U=()=>["auto",{span:["full",Yt,fe,he]},Yt,fe,he],S=()=>[Yt,"auto",fe,he],H=()=>["auto","min","max","fr",fe,he],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...k()],F=()=>[Jt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],G=()=>[Jt,"screen","full","dvw","lvw","svw","min","max","fit",...k()],X=()=>[Jt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],D=()=>[t,fe,he],oe=()=>[...v(),xn,pn,{position:[fe,he]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",Pc,Dc,{size:[fe,he]}],J=()=>[Js,zr,nr],B=()=>["","none","full",d,fe,he],K=()=>["",Oe,zr,nr],V=()=>["solid","dashed","dotted","double"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[Oe,Js,xn,pn],ne=()=>["","none",f,fe,he],me=()=>["none",Oe,fe,he],q=()=>["none",Oe,fe,he],N=()=>[Oe,fe,he],_=()=>[Jt,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wt],breakpoint:[Wt],color:[Po],container:[Wt],"drop-shadow":[Wt],ease:["in","out","in-out"],font:[Ac],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wt],shadow:[Wt],spacing:["px",Oe],text:[Wt],"text-shadow":[Wt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Jt,he,fe,b]}],container:["container"],columns:[{columns:[Oe,he,fe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Yt,"auto",fe,he]}],basis:[{basis:[Jt,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Oe,Jt,"auto","initial","none",he]}],grow:[{grow:["",Oe,fe,he]}],shrink:[{shrink:["",Oe,fe,he]}],order:[{order:[Yt,"first","last","none",fe,he]}],"grid-cols":[{"grid-cols":W()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":W()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",s,zr,nr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,zc,Mc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Js,he]}],"font-family":[{font:[Fc,$c,r]}],"font-features":[{"font-features":[he]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,fe,he]}],"line-clamp":[{"line-clamp":[Oe,"none",fe,un]}],leading:[{leading:[o,...k()]}],"list-image":[{"list-image":["none",fe,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[Oe,"from-font","auto",fe,nr]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Oe,"auto",fe,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,he]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yt,fe,he],radial:["",fe,he],conic:[Yt,fe,he]},_c,Lc]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Oe,fe,he]}],"outline-w":[{outline:["",Oe,zr,nr]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",u,os,ns]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",g,os,ns]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Oe,nr]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",p,os,ns]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Oe,fe,he]}],"mix-blend":[{"mix-blend":[...z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[fe,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[Oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,he]}],filter:[{filter:["","none",fe,he]}],blur:[{blur:ne()}],brightness:[{brightness:[Oe,fe,he]}],contrast:[{contrast:[Oe,fe,he]}],"drop-shadow":[{"drop-shadow":["","none",x,os,ns]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Oe,fe,he]}],"hue-rotate":[{"hue-rotate":[Oe,fe,he]}],invert:[{invert:["",Oe,fe,he]}],saturate:[{saturate:[Oe,fe,he]}],sepia:[{sepia:["",Oe,fe,he]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,he]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Oe,fe,he]}],"backdrop-contrast":[{"backdrop-contrast":[Oe,fe,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Oe,fe,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Oe,fe,he]}],"backdrop-invert":[{"backdrop-invert":["",Oe,fe,he]}],"backdrop-opacity":[{"backdrop-opacity":[Oe,fe,he]}],"backdrop-saturate":[{"backdrop-saturate":[Oe,fe,he]}],"backdrop-sepia":[{"backdrop-sepia":["",Oe,fe,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Oe,"initial",fe,he]}],ease:[{ease:["linear","initial",C,fe,he]}],delay:[{delay:[Oe,fe,he]}],animate:[{animate:["none",I,fe,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,fe,he]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:q()}],"scale-x":[{"scale-x":q()}],"scale-y":[{"scale-y":q()}],"scale-z":[{"scale-z":q()}],"scale-3d":["scale-3d"],skew:[{skew:N()}],"skew-x":[{"skew-x":N()}],"skew-y":[{"skew-y":N()}],transform:[{transform:[fe,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_()}],"translate-x":[{"translate-x":_()}],"translate-y":[{"translate-y":_()}],"translate-z":[{"translate-z":_()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,he]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,he]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Oe,zr,nr,un]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Bc=yc(Rc);function be(...t){return Bc(Io(t))}function Wc(t){if(!t||typeof t!="string")return null;try{return JSON.parse(t)}catch{return null}}const Ra=c.forwardRef(({className:t,children:r,...s},a)=>e.jsx("div",{className:be(t,"relative overflow-hidden"),...s,children:e.jsx("div",{ref:a,className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Ra.displayName="ScrollArea";function Uc({updateAvailable:t,releaseInfo:r,latestVersion:s,onShowVersionModal:a,onShowSettings:n,t:o}){return e.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nav-divider"}),e.jsx("div",{className:"hidden md:block px-2 py-1.5",children:e.jsxs("button",{className:"w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-left hover:bg-blue-50/80 dark:hover:bg-blue-900/15 transition-colors group",onClick:a,children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Va,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-300 truncate block",children:(r==null?void 0:r.title)||`v${s}`}),e.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),e.jsx("div",{className:"md:hidden px-3 py-2",children:e.jsxs("button",{className:"w-full h-11 bg-blue-50/80 dark:bg-blue-900/15 border border-blue-200/60 dark:border-blue-700/40 rounded-xl flex items-center gap-3 px-3.5 active:scale-[0.98] transition-all",onClick:a,children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Va,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-300 truncate block",children:(r==null?void 0:r.title)||`v${s}`}),e.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),e.jsx("div",{className:"nav-divider"}),e.jsx("div",{className:"hidden md:block px-2 py-1.5",children:e.jsxs("button",{className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors",onClick:n,children:[e.jsx(Qe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),e.jsx("div",{className:"md:hidden p-3 pb-20",children:e.jsxs("button",{className:"w-full h-12 bg-muted/40 hover:bg-muted/60 rounded-xl flex items-center gap-3.5 px-4 active:scale-[0.98] transition-all",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-background/80 flex items-center justify-center",children:e.jsx(Qe,{className:"w-4.5 h-4.5 text-muted-foreground"})}),e.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const gn=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,hn=Io,Ho=(t,r)=>s=>{var a;if((r==null?void 0:r.variants)==null)return hn(t,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:n,defaultVariants:o}=r,i=Object.keys(n).map(d=>{const u=s==null?void 0:s[d],g=o==null?void 0:o[d];if(u===null)return null;const p=gn(u)||gn(g);return n[d][p]}),l=s&&Object.entries(s).reduce((d,u)=>{let[g,p]=u;return p===void 0||(d[g]=p),d},{}),m=r==null||(a=r.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:g,className:p,...x}=u;return Object.entries(x).every(f=>{let[h,b]=f;return Array.isArray(b)?b.includes({...o,...l}[h]):{...o,...l}[h]===b})?[...d,g,p]:d},[]);return hn(t,i,m,s==null?void 0:s.class,s==null?void 0:s.className)},Hc=Ho("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),xe=c.forwardRef(({className:t,variant:r,size:s,...a},n)=>e.jsx("button",{className:be(Hc({variant:r,size:s,className:t})),ref:n,...a}));xe.displayName="Button";const st=c.forwardRef(({className:t,type:r,...s},a)=>e.jsx("input",{type:r,className:be("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));st.displayName="Input";function Gc({isPWA:t,isMobile:r,isLoading:s,projectsCount:a,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,t:g}){const p=()=>e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("div",{className:"w-7 h-7 bg-primary/90 rounded-lg flex items-center justify-center shadow-sm flex-shrink-0",children:e.jsx("svg",{className:"w-3.5 h-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),e.jsx("h1",{className:"text-sm font-semibold text-foreground tracking-tight truncate",children:g("app.title")})]});return e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs("div",{className:"hidden md:block px-3 pt-3 pb-2",style:{},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(p,{}),e.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:l,disabled:m,title:g("tooltips.refresh"),children:e.jsx(Ut,{className:`w-3.5 h-3.5 ${m?"animate-spin":""}`})}),e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:d,title:g("tooltips.createProject"),children:e.jsx(lt,{className:"w-3.5 h-3.5"})}),e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:u,title:g("tooltips.hideSidebar"),children:e.jsx(Mi,{className:"w-3.5 h-3.5"})})]})]}),a>0&&!s&&e.jsxs("div",{className:"relative mt-2.5",children:[e.jsx(dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/50 pointer-events-none"}),e.jsx(st,{type:"text",placeholder:g("projects.searchPlaceholder"),value:n,onChange:x=>o(x.target.value),className:"nav-search-input pl-9 pr-8 h-9 text-sm rounded-xl border-0 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0 transition-all duration-200"}),n&&e.jsx("button",{onClick:i,className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 hover:bg-accent rounded-md",children:e.jsx(qe,{className:"w-3 h-3 text-muted-foreground"})})]})]}),e.jsx("div",{className:"hidden md:block nav-divider"}),e.jsxs("div",{className:"md:hidden p-3 pb-2",style:t&&r?{paddingTop:"16px"}:{},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(p,{}),e.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-muted/50 flex items-center justify-center active:scale-95 transition-all",onClick:l,disabled:m,children:e.jsx(Ut,{className:`w-4 h-4 text-muted-foreground ${m?"animate-spin":""}`})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/90 text-primary-foreground flex items-center justify-center active:scale-95 transition-all",onClick:d,children:e.jsx(xs,{className:"w-4 h-4"})})]})]}),a>0&&!s&&e.jsxs("div",{className:"relative mt-2.5",children:[e.jsx(dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 pointer-events-none"}),e.jsx(st,{type:"text",placeholder:g("projects.searchPlaceholder"),value:n,onChange:x=>o(x.target.value),className:"nav-search-input pl-10 pr-9 h-10 text-sm rounded-xl border-0 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0 transition-all duration-200"}),n&&e.jsx("button",{onClick:i,className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 hover:bg-accent rounded-md",children:e.jsx(qe,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})]}),e.jsx("div",{className:"md:hidden nav-divider"})]})}const qc=({status:t="not-configured",size:r="sm",className:s="",showLabel:a=!1})=>{const o=(()=>{switch(t){case"fully-configured":return{icon:Qr,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Qe,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:Ds,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:qe,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),i=o.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},m={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return a?e.jsxs("div",{className:be("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",o.bgColor,o.color,s),title:o.title,children:[e.jsx(i,{className:l[r]}),e.jsx("span",{className:"font-medium",children:o.label})]}):e.jsx("div",{className:be("inline-flex items-center justify-center rounded-full transition-colors",o.bgColor,m[r],s),title:o.title,children:e.jsx(i,{className:be(l[r],o.color)})})},Kc=Ho("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Dt({className:t,variant:r,...s}){return e.jsx("div",{className:be(Kc({variant:r}),t),...s})}const fn=(t,r,s)=>{const a=new Date(t),n=r;if(isNaN(a.getTime()))return s?s("status.unknown"):"Unknown";const o=n.getTime()-a.getTime(),i=Math.floor(o/1e3),l=Math.floor(o/(1e3*60)),m=Math.floor(o/(1e3*60*60)),d=Math.floor(o/(1e3*60*60*24));return i<60?s?s("time.justNow"):"Just now":l===1?s?s("time.oneMinuteAgo"):"1 min ago":l<60?s?s("time.minutesAgo",{count:l}):`${l} mins ago`:m===1?s?s("time.oneHourAgo"):"1 hour ago":m<24?s?s("time.hoursAgo",{count:m}):`${m} hours ago`:d===1?s?s("time.oneDayAgo"):"1 day ago":d<7?s?s("time.daysAgo",{count:d}):`${d} days ago`:a.toLocaleDateString()};function At({provider:t="claude",className:r="w-5 h-5"}){return t==="cursor"?e.jsx(il,{className:r}):t==="codex"?e.jsx(ll,{className:r}):e.jsx(cl,{className:r})}function Vc({project:t,session:r,selectedSession:s,currentTime:a,editingSession:n,editingSessionName:o,onEditingSessionNameChange:i,onStartEditingSession:l,onCancelEditingSession:m,onSaveEditingSession:d,onProjectSelect:u,onSessionSelect:g,onDeleteSession:p,touchHandlerFactory:x,t:f}){const h=ql(r,a,f),b=(s==null?void 0:s.id)===r.id,C=()=>{u(t),g(r,t.name)},I=()=>{d(t.name,r.id,o)},y=()=>{p(t.name,r.id,h.sessionName,r.__provider)};return e.jsxs("div",{className:"group relative",children:[h.isActive&&e.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:be("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",b?"bg-primary/5 border-primary/20":"",!b&&h.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:C,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:be("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",b?"bg-primary/10":"bg-muted/50"),children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:h.sessionName}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(qr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:fn(h.sessionTime,a,f)}),h.messageCount>0&&e.jsx(Dt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:h.messageCount}),e.jsx("span",{className:"ml-1 opacity-70",children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})})]})]}),!h.isCursorSession&&e.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:v=>{v.stopPropagation(),y()},children:e.jsx(ht,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx(xe,{variant:"ghost",className:be("w-full justify-start px-2 py-2.5 h-auto min-h-[48px] font-normal text-left hover:bg-accent/50 transition-colors duration-200",b&&"bg-accent text-accent-foreground"),onClick:()=>g(r,t.name),children:e.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full pr-14",children:[e.jsx(At,{provider:r.__provider,className:"w-3 h-3 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground leading-5",children:h.sessionName}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(qr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:fn(h.sessionTime,a,f)}),h.messageCount>0&&e.jsx(Dt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto group-hover:opacity-0 transition-opacity",children:h.messageCount}),e.jsx("span",{className:"ml-1 opacity-70 group-hover:opacity-0 transition-opacity",children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})})]})]})]})}),!h.isCursorSession&&e.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-all duration-200 bg-accent/80 backdrop-blur-sm rounded-md px-1 py-0.5",children:n===r.id&&!h.isCodexSession?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:o,onChange:v=>i(v.target.value),onKeyDown:v=>{v.stopPropagation(),v.key==="Enter"?I():v.key==="Escape"&&m()},onClick:v=>v.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),e.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),I()},title:f("tooltips.save"),children:e.jsx(Tt,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),m()},title:f("tooltips.cancel"),children:e.jsx(qe,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):e.jsxs(e.Fragment,{children:[!h.isCodexSession&&e.jsx("button",{className:"w-7 h-7 bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),l(r.id,r.summary||f("projects.newSession"))},title:f("tooltips.editSessionName"),children:e.jsx($i,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{className:"w-7 h-7 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),y()},title:f("tooltips.deleteSession"),children:e.jsx(ht,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]})}function Jc(){return e.jsx(e.Fragment,{children:Array.from({length:3}).map((t,r)=>e.jsx("div",{className:"p-2 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+r*15}%`}}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},r))})}function Yc({project:t,isExpanded:r,sessions:s,selectedSession:a,initialSessionsLoaded:n,isLoadingSessions:o,currentTime:i,editingSession:l,editingSessionName:m,onEditingSessionNameChange:d,onStartEditingSession:u,onCancelEditingSession:g,onSaveEditingSession:p,onProjectSelect:x,onSessionSelect:f,onDeleteSession:h,onLoadMoreSessions:b,onNewSession:C,touchHandlerFactory:I,t:y}){var M;if(!r)return null;const v=s.length>0,A=((M=t.sessionMeta)==null?void 0:M.hasMore)===!0;return e.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[n?!v&&!o?e.jsx("div",{className:"py-2 px-3 text-left",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):s.map($=>e.jsx(Vc,{project:t,session:$,selectedSession:a,currentTime:i,editingSession:l,editingSessionName:m,onEditingSessionNameChange:d,onStartEditingSession:u,onCancelEditingSession:g,onSaveEditingSession:p,onProjectSelect:x,onSessionSelect:f,onDeleteSession:h,touchHandlerFactory:I,t:y},$.id)):e.jsx(Jc,{}),v&&A&&e.jsx(xe,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>b(t),disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"w-3 h-3"}),y("sessions.showMore")]})}),e.jsx("div",{className:"md:hidden px-3 pb-2",children:e.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{x(t),C(t)},children:[e.jsx(lt,{className:"w-3 h-3"}),y("sessions.newSession")]})}),e.jsxs(xe,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>C(t),children:[e.jsx(lt,{className:"w-3 h-3"}),y("sessions.newSession")]})]})}const Qc=(t,r)=>{const s=t.length;return r&&s>=5?`${s}+`:`${s}`};function Xc({project:t,selectedProject:r,selectedSession:s,isExpanded:a,isDeleting:n,isStarred:o,editingProject:i,editingName:l,sessions:m,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:g,editingSession:p,editingSessionName:x,tasksEnabled:f,mcpServerStatus:h,onEditingNameChange:b,onToggleProject:C,onProjectSelect:I,onToggleStarProject:y,onStartEditingProject:v,onCancelEditingProject:A,onSaveProjectName:M,onDeleteProject:$,onSessionSelect:k,onDeleteSession:T,onLoadMoreSessions:W,onNewSession:U,onEditingSessionNameChange:S,onStartEditingSession:H,onCancelEditingSession:w,onSaveEditingSession:P,touchHandlerFactory:j,t:F}){var z;const G=(r==null?void 0:r.name)===t.name,X=i===t.name,D=((z=t.sessionMeta)==null?void 0:z.hasMore)===!0,oe=Qc(m,D),E=`${oe} session${m.length===1?"":"s"}`,se=Jl(t,h),J=()=>C(t.name),B=()=>y(t.name),K=()=>{M(t.name)},V=()=>{(r==null?void 0:r.name)!==t.name&&I(t),J()};return e.jsxs("div",{className:be("md:space-y-1",n&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"group md:group",children:[e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:be("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",G&&"bg-primary/5 border-primary/20",o&&!G&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:J,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:be("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",a?"bg-primary/10":"bg-muted"),children:a?e.jsx(er,{className:"w-4 h-4 text-primary"}):e.jsx(tr,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("div",{className:"min-w-0 flex-1",children:X?e.jsx("input",{type:"text",value:l,onChange:O=>b(O.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:O=>O.stopPropagation(),onKeyDown:O=>{O.key==="Enter"&&K(),O.key==="Escape"&&A()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.displayName}),f&&e.jsx(qc,{status:se,size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:E})]})})]}),e.jsx("div",{className:"flex items-center gap-1",children:X?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:O=>{O.stopPropagation(),K()},children:e.jsx(Tt,{className:"w-4 h-4 text-white"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:O=>{O.stopPropagation(),A()},children:e.jsx(qe,{className:"w-4 h-4 text-white"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:be("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",o?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:O=>{O.stopPropagation(),B()},title:F(o?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:e.jsx(Ja,{className:be("w-4 h-4 transition-colors",o?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:O=>{O.stopPropagation(),$(t)},children:e.jsx(ht,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:O=>{O.stopPropagation(),v(t)},children:e.jsx(Kr,{className:"w-4 h-4 text-primary"})}),e.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:a?e.jsx(vt,{className:"w-3 h-3 text-muted-foreground"}):e.jsx(Ot,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),e.jsxs(xe,{variant:"ghost",className:be("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",G&&"bg-accent text-accent-foreground",o&&!G&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:V,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a?e.jsx(er,{className:"w-4 h-4 text-primary flex-shrink-0"}):e.jsx(tr,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:X?e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:l,onChange:O=>b(O.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:O=>{O.key==="Enter"&&K(),O.key==="Escape"&&A()}}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",title:t.fullPath,children:t.fullPath})]}):e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:t.displayName,children:t.displayName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[oe,t.fullPath!==t.displayName&&e.jsxs("span",{className:"ml-1 opacity-60",title:t.fullPath,children:[" - ",t.fullPath.length>25?`...${t.fullPath.slice(-22)}`:t.fullPath]})]})]})})]}),e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:X?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:O=>{O.stopPropagation(),K()},children:e.jsx(Tt,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:O=>{O.stopPropagation(),A()},children:e.jsx(qe,{className:"w-3 h-3"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:be("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",o?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:O=>{O.stopPropagation(),B()},title:F(o?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:e.jsx(Ja,{className:be("w-3 h-3 transition-colors",o?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:O=>{O.stopPropagation(),v(t)},title:F("tooltips.renameProject"),children:e.jsx(Kr,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:O=>{O.stopPropagation(),$(t)},title:F("tooltips.deleteProject"),children:e.jsx(ht,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),a?e.jsx(vt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):e.jsx(Ot,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),e.jsx(Yc,{project:t,isExpanded:a,sessions:m,selectedSession:s,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:g,editingSession:p,editingSessionName:x,onEditingSessionNameChange:S,onStartEditingSession:H,onCancelEditingSession:w,onSaveEditingSession:P,onProjectSelect:I,onSessionSelect:k,onDeleteSession:T,onLoadMoreSessions:W,onNewSession:U,touchHandlerFactory:j,t:F})]})}function Zc({isLoading:t,loadingProgress:r,projectsCount:s,filteredProjectsCount:a,t:n}){const{isRelayConnected:o}=Ta();return t?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.loadingProjects")}),r&&r.total>0?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full transition-all duration-300 ease-out",style:{width:`${r.current/r.total*100}%`}})}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.current,"/",r.total," ",n("projects.projects")]}),r.currentProject&&e.jsx("p",{className:"text-xs text-muted-foreground/70 truncate max-w-[200px] mx-auto",title:r.currentProject,children:r.currentProject.split("-").slice(-2).join("/")})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.fetchingProjects")})]}):s===0?o?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(tr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.noProjects")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.runClaudeCli")})]}):e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(co,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No machine connected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your machine to see projects"})]}):a===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(dr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.noMatchingProjects")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.tryDifferentSearch")})]}):null}function ed({projects:t,filteredProjects:r,selectedProject:s,selectedSession:a,isLoading:n,loadingProgress:o,expandedProjects:i,editingProject:l,editingName:m,loadingSessions:d,initialSessionsLoaded:u,currentTime:g,editingSession:p,editingSessionName:x,deletingProjects:f,tasksEnabled:h,mcpServerStatus:b,getProjectSessions:C,isProjectStarred:I,onEditingNameChange:y,onToggleProject:v,onProjectSelect:A,onToggleStarProject:M,onStartEditingProject:$,onCancelEditingProject:k,onSaveProjectName:T,onDeleteProject:W,onSessionSelect:U,onDeleteSession:S,onLoadMoreSessions:H,onNewSession:w,onEditingSessionNameChange:P,onStartEditingSession:j,onCancelEditingSession:F,onSaveEditingSession:G,touchHandlerFactory:X,t:D}){const oe=e.jsx(Zc,{isLoading:n,loadingProgress:o,projectsCount:t.length,filteredProjectsCount:r.length,t:D}),E=!n&&t.length>0&&r.length>0;return e.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:E?r.map(se=>e.jsx(Xc,{project:se,selectedProject:s,selectedSession:a,isExpanded:i.has(se.name),isDeleting:f.has(se.name),isStarred:I(se.name),editingProject:l,editingName:m,sessions:C(se),initialSessionsLoaded:u.has(se.name),isLoadingSessions:!!d[se.name],currentTime:g,editingSession:p,editingSessionName:x,tasksEnabled:h,mcpServerStatus:b,onEditingNameChange:y,onToggleProject:v,onProjectSelect:A,onToggleStarProject:M,onStartEditingProject:$,onCancelEditingProject:k,onSaveProjectName:T,onDeleteProject:W,onSessionSelect:U,onDeleteSession:S,onLoadMoreSessions:H,onNewSession:w,onEditingSessionNameChange:P,onStartEditingSession:j,onCancelEditingSession:F,onSaveEditingSession:G,touchHandlerFactory:X,t:D},se.name)):oe})}function td({isPWA:t,isMobile:r,isLoading:s,projects:a,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,updateAvailable:g,releaseInfo:p,latestVersion:x,onShowVersionModal:f,onShowSettings:h,projectListProps:b,t:C}){return e.jsxs("div",{className:"h-full flex flex-col bg-background/80 backdrop-blur-sm md:select-none md:w-72",style:{},children:[e.jsx(Gc,{isPWA:t,isMobile:r,isLoading:s,projectsCount:a.length,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,t:C}),e.jsx(Ra,{className:"flex-1 md:px-1.5 md:py-2 overflow-y-auto overscroll-contain",children:e.jsx(ed,{...b})}),e.jsx(Uc,{updateAvailable:g,releaseInfo:p,latestVersion:x,onShowVersionModal:f,onShowSettings:h,t:C})]})}const rd=({onClose:t,onProjectCreated:r})=>{var Re;const{t:s}=Ge(),[a,n]=c.useState(1),[o,i]=c.useState("existing"),[l,m]=c.useState(""),[d,u]=c.useState(""),[g,p]=c.useState(""),[x,f]=c.useState("stored"),[h,b]=c.useState(""),[C,I]=c.useState(!1),[y,v]=c.useState(null),[A,M]=c.useState([]),[$,k]=c.useState(!1),[T,W]=c.useState([]),[U,S]=c.useState(!1),[H,w]=c.useState(!1),[P,j]=c.useState("~"),[F,G]=c.useState([]),[X,D]=c.useState(!1),[oe,E]=c.useState(!1),[se,J]=c.useState(!1),[B,K]=c.useState(""),[V,z]=c.useState(!1),[O,ne]=c.useState("");c.useEffect(()=>{a===2&&o==="new"&&d&&me()},[a,o,d]),c.useEffect(()=>{l.length>2?q(l):(W([]),S(!1))},[l]);const me=async()=>{try{k(!0);const Y=((await(await He.get("/settings/credentials?type=github_token")).json()).credentials||[]).filter(ie=>ie.is_active);M(Y),Y.length>0&&!g&&p(Y[0].id.toString())}catch(Z){console.error("Error loading GitHub tokens:",Z)}finally{k(!1)}},q=async Z=>{try{const ye=Z.lastIndexOf("/"),Y=ye>0?Z.substring(0,ye):"~",De=await(await He.browseFilesystem(Y)).json();if(De.suggestions){const de=De.suggestions.filter($e=>$e.path.toLowerCase().startsWith(Z.toLowerCase())&&$e.path.toLowerCase()!==Z.toLowerCase());W(de.slice(0,5)),S(de.length>0)}}catch(ye){console.error("Error loading path suggestions:",ye)}},N=()=>{if(v(null),a===1){if(!o){v(s("projectWizard.errors.selectType"));return}n(2)}else if(a===2){if(!l.trim()){v(s("projectWizard.errors.providePath"));return}n(3)}},_=()=>{v(null),n(a-1)},re=async()=>{I(!0),v(null),ne("");try{if(o==="new"&&d){const ie=new URLSearchParams({path:l.trim(),githubUrl:d.trim()});x==="stored"&&g?ie.append("githubTokenId",g):x==="new"&&h&&ie.append("newGithubToken",h.trim());const De=`/api/projects/clone-progress?${ie}`;await new Promise((de,$e)=>{const Le=new EventSource(De);Le.onmessage=Je=>{try{const Ve=JSON.parse(Je.data);Ve.type==="progress"?ne(Ve.message):Ve.type==="complete"?(Le.close(),r&&r(Ve.project),t(),de()):Ve.type==="error"&&(Le.close(),$e(new Error(Ve.message)))}catch(Ve){console.error("Error parsing SSE event:",Ve)}},Le.onerror=()=>{Le.close(),$e(new Error("Connection lost during clone"))}});return}const Z={workspaceType:o,path:l.trim()},ye=await He.createWorkspace(Z),Y=await ye.json();if(!ye.ok)throw new Error(Y.details||Y.error||s("projectWizard.errors.failedToCreate"));r&&r(Y.project),t()}catch(Z){console.error("Error creating workspace:",Z),v(Z.message||s("projectWizard.errors.failedToCreate"))}finally{I(!1)}},te=Z=>{m(Z.path),S(!1)},ve=async()=>{w(!0),await je("~")},je=async Z=>{try{D(!0);const Y=await(await He.browseFilesystem(Z)).json();j(Y.path||Z),G(Y.suggestions||[])}catch(ye){console.error("Error loading folders:",ye)}finally{D(!1)}},Ne=(Z,ye=!1)=>{m(Z),w(!1),ye&&n(3)},we=async Z=>{await je(Z)},Ie=async()=>{if(B.trim()){z(!0),v(null);try{const Z=P.includes("\\")?"\\":"/",ye=`${P}${Z}${B.trim()}`,Y=await He.createFolder(ye),ie=await Y.json();if(!Y.ok)throw new Error(ie.error||s("projectWizard.errors.failedToCreateFolder","Failed to create folder"));K(""),J(!1),await je(ie.path||ye)}catch(Z){console.error("Error creating folder:",Z),v(Z.message||s("projectWizard.errors.failedToCreateFolder","Failed to create folder"))}finally{z(!1)}}};return e.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-2xl border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(xs,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s("projectWizard.title")})]}),e.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:C,children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"px-6 pt-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-between",children:[1,2,3].map(Z=>e.jsxs(Ft.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm ${Z<a?"bg-green-500 text-white":Z===a?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-500"}`,children:Z<a?e.jsx(Tt,{className:"w-4 h-4"}):Z}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:inline",children:s(Z===1?"projectWizard.steps.type":Z===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),Z<3&&e.jsx("div",{className:`flex-1 h-1 mx-2 rounded ${Z<a?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},Z))})}),e.jsxs("div",{className:"p-6 space-y-6 min-h-[300px]",children:[y&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[e.jsx(Ds,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:y})})]}),a===1&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:s("projectWizard.step1.question")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx("button",{onClick:()=>i("existing"),className:`p-4 border-2 rounded-lg text-left transition-all ${o==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(xs,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:s("projectWizard.step1.existing.title")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step1.existing.description")})]})]})}),e.jsx("button",{onClick:()=>i("new"),className:`p-4 border-2 rounded-lg text-left transition-all ${o==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(Gt,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:s("projectWizard.step1.new.title")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step1.new.description")})]})]})})]})]})}),a===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s(o==="existing"?"projectWizard.step2.existingPath":"projectWizard.step2.newPath")}),e.jsxs("div",{className:"relative flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(st,{type:"text",value:l,onChange:Z=>m(Z.target.value),placeholder:o==="existing"?"/path/to/existing/workspace":"/path/to/new/workspace",className:"w-full"}),U&&T.length>0&&e.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:T.map((Z,ye)=>e.jsxs("button",{onClick:()=>te(Z),className:"w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 text-sm",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Z.path})]},ye))})]}),e.jsx(xe,{type:"button",variant:"outline",onClick:ve,className:"px-3",title:"Browse folders",children:e.jsx(er,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s(o==="existing"?"projectWizard.step2.existingHelp":"projectWizard.step2.newHelp")})]}),o==="new"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.githubUrl")}),e.jsx(st,{type:"text",value:d,onChange:Z=>u(Z.target.value),placeholder:"https://github.com/username/repository",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.githubHelp")})]}),d&&!d.startsWith("git@")&&!d.startsWith("ssh://")&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx(Aa,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-medium text-gray-900 dark:text-white mb-1",children:s("projectWizard.step2.githubAuth")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step2.githubAuthHelp")})]})]}),$?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(jr,{className:"w-4 h-4 animate-spin"}),s("projectWizard.step2.loadingTokens")]}):A.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[e.jsx("button",{onClick:()=>f("stored"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="stored"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.storedToken")}),e.jsx("button",{onClick:()=>f("new"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="new"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.newToken")}),e.jsx("button",{onClick:()=>{f("none"),p(""),b("")},className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="none"?"bg-green-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.nonePublic")})]}),x==="stored"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.selectToken")}),e.jsxs("select",{value:g,onChange:Z=>p(Z.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-sm",children:[e.jsx("option",{value:"",children:s("projectWizard.step2.selectTokenPlaceholder")}),A.map(Z=>e.jsx("option",{value:Z.id,children:Z.credential_name},Z.id))]})]}):x==="new"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.newToken")}),e.jsx(st,{type:"password",value:h,onChange:Z=>b(Z.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.tokenHelp")})]}):null]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:s("projectWizard.step2.publicRepoInfo")})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.optionalTokenPublic")}),e.jsx(st,{type:"password",value:h,onChange:Z=>b(Z.target.value),placeholder:s("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.noTokensHelp")})]})]})]})]})]}),a===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3",children:s("projectWizard.step3.reviewConfig")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.workspaceType")}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:s(o==="existing"?"projectWizard.step3.existingWorkspace":"projectWizard.step3.newWorkspace")})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.path")}),e.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:l})]}),o==="new"&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.cloneFrom")}),e.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:d})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.authentication")}),e.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:x==="stored"&&g?`${s("projectWizard.step3.usingStoredToken")} ${((Re=A.find(Z=>Z.id.toString()===g))==null?void 0:Re.credential_name)||"Unknown"}`:x==="new"&&h?s("projectWizard.step3.usingProvidedToken"):d.startsWith("git@")||d.startsWith("ssh://")?s("projectWizard.step3.sshKey","SSH Key"):s("projectWizard.step3.noAuthentication")})]})]})]})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:C&&O?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:s("projectWizard.step3.cloningRepository","Cloning repository...")}),e.jsx("code",{className:"block text-xs font-mono text-blue-700 dark:text-blue-300 whitespace-pre-wrap break-all",children:O})]}):e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:s(o==="existing"?"projectWizard.step3.existingInfo":d?"projectWizard.step3.newWithClone":"projectWizard.step3.newEmpty")})})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(xe,{variant:"outline",onClick:a===1?t:_,disabled:C,children:a===1?s("projectWizard.buttons.cancel"):e.jsxs(e.Fragment,{children:[e.jsx(mo,{className:"w-4 h-4 mr-1"}),s("projectWizard.buttons.back")]})}),e.jsx(xe,{onClick:a===3?re:N,disabled:C||a===1&&!o,children:C?e.jsxs(e.Fragment,{children:[e.jsx(jr,{className:"w-4 h-4 mr-2 animate-spin"}),d?s("projectWizard.buttons.cloning","Cloning..."):s("projectWizard.buttons.creating")]}):a===3?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{className:"w-4 h-4 mr-1"}),s("projectWizard.buttons.createProject")]}):e.jsxs(e.Fragment,{children:[s("projectWizard.buttons.next"),e.jsx(Ot,{className:"w-4 h-4 ml-1"})]})})]})]}),H&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[70] p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] border border-gray-200 dark:border-gray-700 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(er,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>E(!oe),className:`p-2 rounded-md transition-colors ${oe?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:oe?"Hide hidden folders":"Show hidden folders",children:oe?e.jsx(ur,{className:"w-5 h-5"}):e.jsx(uo,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>J(!se),className:`p-2 rounded-md transition-colors ${se?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Create new folder",children:e.jsx(lt,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>w(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(qe,{className:"w-5 h-5"})})]})]}),se&&e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-blue-50 dark:bg-blue-900/20",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{type:"text",value:B,onChange:Z=>K(Z.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:Z=>{Z.key==="Enter"&&Ie(),Z.key==="Escape"&&(J(!1),K(""))},autoFocus:!0}),e.jsx(xe,{size:"sm",onClick:Ie,disabled:!B.trim()||V,children:V?e.jsx(jr,{className:"w-4 h-4 animate-spin"}):"Create"}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>{J(!1),K("")},children:"Cancel"})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:X?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(jr,{className:"w-6 h-6 animate-spin text-gray-400"})}):e.jsxs("div",{className:"space-y-1",children:[P!=="~"&&P!=="/"&&!/^[A-Za-z]:\\?$/.test(P)&&e.jsxs("button",{onClick:()=>{const Z=Math.max(P.lastIndexOf("/"),P.lastIndexOf("\\"));let ye;Z<=0?ye="/":Z===2&&/^[A-Za-z]:/.test(P)?ye=P.substring(0,3):ye=P.substring(0,Z),we(ye)},className:"w-full px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[e.jsx(er,{className:"w-5 h-5 text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),F.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No subfolders found"}):F.filter(Z=>oe||!Z.name.startsWith(".")).sort((Z,ye)=>Z.name.toLowerCase().localeCompare(ye.name.toLowerCase())).map((Z,ye)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>we(Z.path),className:"flex-1 px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[e.jsx(xs,{className:"w-5 h-5 text-blue-500"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name})]}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>Ne(Z.path,o==="existing"),className:"text-xs px-3",children:"Select"})]},ye))]})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-900/50 flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white flex-1 truncate",children:P})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[e.jsx(xe,{variant:"outline",onClick:()=>{w(!1),J(!1),K("")},children:"Cancel"}),e.jsx(xe,{variant:"outline",onClick:()=>Ne(P,o==="existing"),children:"Use this folder"})]})]})]})})]})},sd="2.5.0";function ad(){const{t}=Ge("settings"),[r,s]=c.useState([]),[a,n]=c.useState([]),[o,i]=c.useState(!0),[l,m]=c.useState(!1),[d,u]=c.useState(!1),[g,p]=c.useState(""),[x,f]=c.useState(""),[h,b]=c.useState(""),[C,I]=c.useState(""),[y,v]=c.useState({}),[A,M]=c.useState(null),[$,k]=c.useState(null),{updateAvailable:T,latestVersion:W,releaseInfo:U}=So("thinqmesh","upfynai-code");c.useEffect(()=>{S()},[]);const S=async()=>{try{i(!0);const oe=await(await Ee("/api/settings/api-keys")).json();s(oe.apiKeys||[]);const se=await(await Ee("/api/settings/credentials?type=github_token")).json();n(se.credentials||[])}catch(D){console.error("Error fetching settings:",D)}finally{i(!1)}},H=async()=>{if(g.trim())try{const oe=await(await Ee("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:g})})).json();oe.success&&(k(oe.apiKey),p(""),m(!1),S())}catch(D){console.error("Error creating API key:",D)}},w=async D=>{if(confirm(t("apiKeys.confirmDelete")))try{await Ee(`/api/settings/api-keys/${D}`,{method:"DELETE"}),S()}catch(oe){console.error("Error deleting API key:",oe)}},P=async(D,oe)=>{try{await Ee(`/api/settings/api-keys/${D}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!oe})}),S()}catch(E){console.error("Error toggling API key:",E)}},j=async()=>{if(!(!x.trim()||!h.trim()))try{(await(await Ee("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:x,credentialType:"github_token",credentialValue:h,description:C})})).json()).success&&(f(""),b(""),I(""),u(!1),S())}catch(D){console.error("Error creating GitHub credential:",D)}},F=async D=>{if(confirm(t("apiKeys.github.confirmDelete")))try{await Ee(`/api/settings/credentials/${D}`,{method:"DELETE"}),S()}catch(oe){console.error("Error deleting GitHub credential:",oe)}},G=async(D,oe)=>{try{await Ee(`/api/settings/credentials/${D}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!oe})}),S()}catch(E){console.error("Error toggling GitHub credential:",E)}},X=(D,oe)=>{navigator.clipboard.writeText(D),M(oe),setTimeout(()=>M(null),2e3)};return o?e.jsx("div",{className:"text-muted-foreground",children:t("apiKeys.loading")}):e.jsxs("div",{className:"space-y-8",children:[$&&e.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[e.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:t("apiKeys.newKey.alertTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t("apiKeys.newKey.alertMessage")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:$.apiKey}),e.jsx(xe,{size:"sm",variant:"outline",onClick:()=>X($.apiKey,"new"),children:A==="new"?e.jsx(Tt,{className:"h-4 w-4"}):e.jsx(Da,{className:"h-4 w-4"})})]}),e.jsx(xe,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>k(null),children:t("apiKeys.newKey.iveSavedIt")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Aa,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("apiKeys.title")})]}),e.jsxs(xe,{size:"sm",onClick:()=>m(!l),children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),t("apiKeys.newButton")]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:t("apiKeys.description")}),e.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[t("apiKeys.apiDocsLink"),e.jsx(Ya,{className:"h-3 w-3"})]})]}),l&&e.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[e.jsx(st,{placeholder:t("apiKeys.form.placeholder"),value:g,onChange:D=>p(D.target.value),className:"mb-2"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(xe,{onClick:H,children:t("apiKeys.form.createButton")}),e.jsx(xe,{variant:"outline",onClick:()=>m(!1),children:t("apiKeys.form.cancelButton")})]})]}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:t("apiKeys.empty")}):r.map(D=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:D.key_name}),e.jsx("code",{className:"text-xs text-muted-foreground",children:D.api_key}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[t("apiKeys.list.created")," ",new Date(D.created_at).toLocaleDateString(),D.last_used&&` • ${t("apiKeys.list.lastUsed")} ${new Date(D.last_used).toLocaleDateString()}`]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{size:"sm",variant:D.is_active?"outline":"secondary",onClick:()=>P(D.id,D.is_active),children:D.is_active?t("apiKeys.status.active"):t("apiKeys.status.inactive")}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>w(D.id),children:e.jsx(ht,{className:"h-4 w-4"})})]})]},D.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Li,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("apiKeys.github.title")})]}),e.jsxs(xe,{size:"sm",onClick:()=>u(!d),children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),t("apiKeys.github.addButton")]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("apiKeys.github.descriptionAlt")}),d&&e.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[e.jsx(st,{placeholder:t("apiKeys.github.form.namePlaceholder"),value:x,onChange:D=>f(D.target.value)}),e.jsxs("div",{className:"relative",children:[e.jsx(st,{type:y.new?"text":"password",placeholder:t("apiKeys.github.form.tokenPlaceholder"),value:h,onChange:D=>b(D.target.value),className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>v({...y,new:!y.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:y.new?e.jsx(uo,{className:"h-4 w-4"}):e.jsx(ur,{className:"h-4 w-4"})})]}),e.jsx(st,{placeholder:t("apiKeys.github.form.descriptionPlaceholder"),value:C,onChange:D=>I(D.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(xe,{onClick:j,children:t("apiKeys.github.form.addButton")}),e.jsx(xe,{variant:"outline",onClick:()=>{u(!1),f(""),b(""),I("")},children:t("apiKeys.github.form.cancelButton")})]}),e.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:t("apiKeys.github.form.howToCreate")})]}),e.jsx("div",{className:"space-y-2",children:a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:t("apiKeys.github.empty")}):a.map(D=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:D.credential_name}),D.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:D.description}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[t("apiKeys.github.added")," ",new Date(D.created_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{size:"sm",variant:D.is_active?"outline":"secondary",onClick:()=>G(D.id,D.is_active),children:D.is_active?t("apiKeys.status.active"):t("apiKeys.status.inactive")}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>F(D.id),children:e.jsx(ht,{className:"h-4 w-4"})})]})]},D.id))})]}),e.jsx("div",{className:"pt-6 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[e.jsxs("a",{href:(U==null?void 0:U.htmlUrl)||"https://github.com/thinqmesh/upfynai-code/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",sd]}),T&&W&&e.jsxs("a",{href:(U==null?void 0:U.htmlUrl)||"https://github.com/thinqmesh/upfynai-code/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[e.jsx("span",{className:"text-[10px]",children:t("apiKeys.version.updateAvailable",{version:W})}),e.jsx(Ya,{className:"h-2.5 w-2.5"})]})]})})]})}function nd(){const{t}=Ge("settings"),[r,s]=c.useState(""),[a,n]=c.useState(""),[o,i]=c.useState(!1),[l,m]=c.useState(!1),[d,u]=c.useState(null);c.useEffect(()=>{g()},[]);const g=async()=>{try{i(!0);const x=await Ee("/api/user/git-config");if(x.ok){const f=await x.json();s(f.gitName||""),n(f.gitEmail||"")}}catch(x){console.error("Error loading git config:",x)}finally{i(!1)}},p=async()=>{try{m(!0);const x=await Ee("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:r,gitEmail:a})});if(x.ok)u("success"),setTimeout(()=>u(null),3e3);else{const f=await x.json();u("error"),console.error("Failed to save git config:",f.error)}}catch(x){console.error("Error saving git config:",x),u("error")}finally{m(!1)}};return e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Gt,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("git.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("git.description")}),e.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:t("git.name.label")}),e.jsx(st,{id:"settings-git-name",type:"text",value:r,onChange:x=>s(x.target.value),placeholder:"John Doe",disabled:o,className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("git.name.help")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:t("git.email.label")}),e.jsx(st,{id:"settings-git-email",type:"email",value:a,onChange:x=>n(x.target.value),placeholder:"john@example.com",disabled:o,className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("git.email.help")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{onClick:p,disabled:l||!r||!a,children:t(l?"git.actions.saving":"git.actions.save")}),d==="success"&&e.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),t("git.status.success")]})]})]})]})})}function od(){const{t}=Ge("settings"),{tasksEnabled:r,setTasksEnabled:s,isTaskMasterInstalled:a,isCheckingInstallation:n}=Yr();return e.jsx("div",{className:"space-y-8",children:n?e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t("tasks.checking")})]})}):e.jsxs(e.Fragment,{children:[!a&&e.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:t("tasks.notInstalled.title")}),e.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[e.jsx("p",{children:t("tasks.notInstalled.description")}),e.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:e.jsx("code",{children:t("tasks.notInstalled.installCommand")})}),e.jsx("div",{children:e.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),t("tasks.notInstalled.viewOnGitHub"),e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:t("tasks.notInstalled.afterInstallation")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[e.jsx("li",{children:t("tasks.notInstalled.steps.restart")}),e.jsx("li",{children:t("tasks.notInstalled.steps.autoAvailable")}),e.jsx("li",{children:t("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),a&&e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:t("tasks.settings.enableLabel")}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:t("tasks.settings.enableDescription")})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:o=>s(o.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}const id={claude:{name:"Claude",color:"blue"},cursor:{name:"Cursor",color:"purple"},codex:{name:"Codex",color:"gray"}},ld={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function wr({agentId:t,authStatus:r,isSelected:s,onClick:a,isMobile:n=!1}){const{t:o}=Ge("settings"),i=id[t],l=ld[i.color];return n?e.jsx("button",{onClick:a,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${s?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(At,{provider:t,className:"w-5 h-5"}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:i.name}),(r==null?void 0:r.authenticated)&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):e.jsxs("button",{onClick:a,className:`w-full text-left p-3 border-l-4 transition-colors ${s?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(At,{provider:t,className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:i.name})]}),e.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:r!=null&&r.loading?e.jsx("span",{className:"text-gray-400",children:o("agents.authStatus.checking")}):r!=null&&r.authenticated?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),e.jsx("span",{className:"truncate max-w-[120px]",title:r.email,children:r.email||o("agents.authStatus.connected")})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),e.jsx("span",{children:o("agents.authStatus.notConnected")})]})})]})}const cd={claude:{name:"Claude",description:"Anthropic Claude AI assistant",bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function dd({agent:t,authStatus:r,onLogin:s}){const{t:a}=Ge("settings"),n=cd[t];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(At,{provider:t,className:"w-6 h-6"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a(`agents.account.${t}.description`)})]})]}),e.jsx("div",{className:`${n.bgClass} border ${n.borderClass} rounded-lg p-4`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`font-medium ${n.textClass}`,children:a("agents.connectionStatus")}),e.jsx("div",{className:`text-sm ${n.subtextClass}`,children:r!=null&&r.loading?a("agents.authStatus.checkingAuth"):r!=null&&r.authenticated?a("agents.authStatus.loggedInAs",{email:r.email||a("agents.authStatus.authenticatedUser")}):a("agents.authStatus.notConnected")})]}),e.jsx("div",{children:r!=null&&r.loading?e.jsx(Dt,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:a("agents.authStatus.checking")}):r!=null&&r.authenticated?e.jsx(Dt,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:a("agents.authStatus.connected")}):e.jsx(Dt,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:a("agents.authStatus.disconnected")})})]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:`font-medium ${n.textClass}`,children:r!=null&&r.authenticated?a("agents.login.reAuthenticate"):a("agents.login.title")}),e.jsx("div",{className:`text-sm ${n.subtextClass}`,children:r!=null&&r.authenticated?a("agents.login.reAuthDescription"):a("agents.login.description",{agent:n.name})})]}),e.jsxs(xe,{onClick:s,className:`${n.buttonClass} text-white`,size:"sm",children:[e.jsx(Fi,{className:"w-4 h-4 mr-2"}),r!=null&&r.authenticated?a("agents.login.reLoginButton"):a("agents.login.button")]})]})}),(r==null?void 0:r.error)&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:a("agents.error",{error:r.error})})})]})})]})}const md=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],ud=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function pd({skipPermissions:t,setSkipPermissions:r,allowedTools:s,setAllowedTools:a,disallowedTools:n,setDisallowedTools:o,newAllowedTool:i,setNewAllowedTool:l,newDisallowedTool:m,setNewDisallowedTool:d}){const{t:u}=Ge("settings"),g=h=>{h&&!s.includes(h)&&(a([...s,h]),l(""))},p=h=>{a(s.filter(b=>b!==h))},x=h=>{h&&!n.includes(h)&&(o([...n,h]),d(""))},f=h=>{o(n.filter(b=>b!==h))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:h=>r(h.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.claudeDescription")})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedTools.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedTools.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:i,onChange:h=>l(h.target.value),placeholder:u("permissions.allowedTools.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),g(i))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>g(i),disabled:!i,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedTools.quickAdd")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:md.map(h=>e.jsx(xe,{variant:"outline",size:"sm",onClick:()=>g(h),disabled:s.includes(h),className:"text-xs h-8",children:h},h))})]}),e.jsxs("div",{className:"space-y-2",children:[s.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>p(h),className:"text-green-600 hover:text-green-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedTools.empty")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedTools.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedTools.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:m,onChange:h=>d(h.target.value),placeholder:u("permissions.blockedTools.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),x(m))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>x(m),disabled:!m,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[n.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>f(h),className:"text-red-600 hover:text-red-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),n.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedTools.empty")})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:u("permissions.toolExamples.title")}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",u("permissions.toolExamples.bashGitLog")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",u("permissions.toolExamples.bashGitDiff")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",u("permissions.toolExamples.write")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",u("permissions.toolExamples.bashRm")]})]})]})]})}function xd({skipPermissions:t,setSkipPermissions:r,allowedCommands:s,setAllowedCommands:a,disallowedCommands:n,setDisallowedCommands:o,newAllowedCommand:i,setNewAllowedCommand:l,newDisallowedCommand:m,setNewDisallowedCommand:d}){const{t:u}=Ge("settings"),g=h=>{h&&!s.includes(h)&&(a([...s,h]),l(""))},p=h=>{a(s.filter(b=>b!==h))},x=h=>{h&&!n.includes(h)&&(o([...n,h]),d(""))},f=h=>{o(n.filter(b=>b!==h))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:h=>r(h.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.cursorDescription")})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedCommands.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedCommands.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:i,onChange:h=>l(h.target.value),placeholder:u("permissions.allowedCommands.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),g(i))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>g(i),disabled:!i,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedCommands.quickAdd")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ud.map(h=>e.jsx(xe,{variant:"outline",size:"sm",onClick:()=>g(h),disabled:s.includes(h),className:"text-xs h-8",children:h},h))})]}),e.jsxs("div",{className:"space-y-2",children:[s.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>p(h),className:"text-green-600 hover:text-green-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedCommands.empty")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedCommands.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedCommands.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:m,onChange:h=>d(h.target.value),placeholder:u("permissions.blockedCommands.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),x(m))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>x(m),disabled:!m,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[n.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>f(h),className:"text-red-600 hover:text-red-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),n.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedCommands.empty")})]})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:u("permissions.shellExamples.title")}),e.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",u("permissions.shellExamples.ls")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",u("permissions.shellExamples.gitStatus")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",u("permissions.shellExamples.npmInstall")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",u("permissions.shellExamples.rmRf")]})]})]})]})}function gd({permissionMode:t,setPermissionMode:r}){const{t:s}=Ge("settings");return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:s("permissions.codex.permissionMode")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("permissions.codex.description")}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("default"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="default",onChange:()=>r("default"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:s("permissions.codex.modes.default.title")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("permissions.codex.modes.default.description")})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("acceptEdits"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="acceptEdits",onChange:()=>r("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:s("permissions.codex.modes.acceptEdits.title")}),e.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:s("permissions.codex.modes.acceptEdits.description")})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("bypassPermissions"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="bypassPermissions",onChange:()=>r("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[s("permissions.codex.modes.bypassPermissions.title"),e.jsx(qt,{className:"w-4 h-4"})]}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:s("permissions.codex.modes.bypassPermissions.description")})]})]})}),e.jsxs("details",{className:"text-sm",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:s("permissions.codex.technicalDetails")}),e.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.default.title"),":"]})," ",s("permissions.codex.technicalInfo.default")]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.acceptEdits.title"),":"]})," ",s("permissions.codex.technicalInfo.acceptEdits")]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.bypassPermissions.title"),":"]})," ",s("permissions.codex.technicalInfo.bypassPermissions")]}),e.jsx("p",{className:"text-xs opacity-75",children:s("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function Ys({agent:t,...r}){return t==="claude"?e.jsx(pd,{...r}):t==="cursor"?e.jsx(xd,{...r}):t==="codex"?e.jsx(gd,{...r}):null}const hd=t=>{switch(t){case"stdio":return e.jsx(ct,{className:"w-4 h-4"});case"sse":return e.jsx(cr,{className:"w-4 h-4"});case"http":return e.jsx(Vr,{className:"w-4 h-4"});default:return e.jsx(Ms,{className:"w-4 h-4"})}};function fd({servers:t,onAdd:r,onEdit:s,onDelete:a,onTest:n,onDiscoverTools:o,testResults:i,serverTools:l,toolsLoading:m}){const{t:d}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d("mcpServers.description.claude")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),d("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(u=>{var g,p,x,f;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[hd(u.type),e.jsx("span",{className:"font-medium text-foreground",children:u.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:u.type}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:u.scope==="local"?d("mcpServers.scope.local"):u.scope==="user"?d("mcpServers.scope.user"):u.scope})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[u.type==="stdio"&&((g=u.config)==null?void 0:g.command)&&e.jsxs("div",{children:[d("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.command})]}),(u.type==="sse"||u.type==="http")&&((p=u.config)==null?void 0:p.url)&&e.jsxs("div",{children:[d("mcpServers.config.url"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.url})]}),((x=u.config)==null?void 0:x.args)&&u.config.args.length>0&&e.jsxs("div",{children:[d("mcpServers.config.args"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.args.join(" ")})]})]}),(i==null?void 0:i[u.id])&&e.jsx("div",{className:`mt-2 p-2 rounded text-xs ${i[u.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:e.jsx("div",{className:"font-medium",children:i[u.id].message})}),(l==null?void 0:l[u.id])&&((f=l[u.id].tools)==null?void 0:f.length)>0&&e.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[e.jsxs("div",{className:"font-medium",children:[d("mcpServers.tools.title")," ",d("mcpServers.tools.count",{count:l[u.id].tools.length})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[u.id].tools.slice(0,5).map((h,b)=>e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:h.name},b)),l[u.id].tools.length>5&&e.jsx("span",{className:"text-xs opacity-75",children:d("mcpServers.tools.more",{count:l[u.id].tools.length-5})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(u),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:d("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(u.id,u.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:d("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},u.id)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:d("mcpServers.empty")})]})]})}function bd({servers:t,onAdd:r,onEdit:s,onDelete:a}){const{t:n}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("mcpServers.description.cursor")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),n("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(o=>{var i;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ct,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:o.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:"stdio"})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:((i=o.config)==null?void 0:i.command)&&e.jsxs("div",{children:[n("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.command})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(o),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:n("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(o.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:n("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},o.name||o.id)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("mcpServers.empty")})]})]})}function yd({servers:t,onAdd:r,onEdit:s,onDelete:a}){const{t:n}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("mcpServers.description.codex")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),n("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(o=>{var i,l,m;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ct,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:o.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:"stdio"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[((i=o.config)==null?void 0:i.command)&&e.jsxs("div",{children:[n("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.command})]}),((l=o.config)==null?void 0:l.args)&&o.config.args.length>0&&e.jsxs("div",{children:[n("mcpServers.config.args"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.args.join(" ")})]}),((m=o.config)==null?void 0:m.env)&&Object.keys(o.config.env).length>0&&e.jsxs("div",{children:[n("mcpServers.config.environment"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(o.config.env).map(([d,u])=>`${d}=${u}`).join(", ")})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(o),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:n("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(o.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:n("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},o.name)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("mcpServers.empty")})]}),e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:n("mcpServers.help.title")}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:n("mcpServers.help.description")})]})]})}function Qs({agent:t,...r}){return t==="claude"?e.jsx(fd,{...r}):t==="cursor"?e.jsx(bd,{...r}):t==="codex"?e.jsx(yd,{...r}):null}function Go({compact:t=!1}){const{i18n:r,t:s}=Ge("settings"),a=n=>{const o=n.target.value;r.changeLanguage(o)};return t?e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(po,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),s("account.language")]}),e.jsx("select",{value:r.language,onChange:a,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:Ka.map(n=>e.jsx("option",{value:n.value,children:n.nativeName},n.value))})]}):e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:s("account.languageLabel")}),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("account.languageDescription")})]}),e.jsx("select",{value:r.language,onChange:a,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:Ka.map(n=>e.jsx("option",{value:n.value,children:n.nativeName},n.value))})]})})}function vd({isOpen:t,onClose:r,projects:s=[],initialTab:a="agents"}){var Gs,ts,Ga,qa;const{isDarkMode:n,toggleDarkMode:o}=Ia(),{t:i}=Ge("settings"),{addToast:l}=mr(),[m,d]=c.useState([]),[u,g]=c.useState([]),[p,x]=c.useState(""),[f,h]=c.useState(""),[b,C]=c.useState(!1),[I,y]=c.useState(!1),[v,A]=c.useState(null),[M,$]=c.useState("name"),[k,T]=c.useState([]),[W,U]=c.useState(!1),[S,H]=c.useState(null),[w,P]=c.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[j,F]=c.useState(!1),[G,X]=c.useState({}),[D,oe]=c.useState({}),[E,se]=c.useState({}),[J,B]=c.useState(a),[K,V]=c.useState(""),[z,O]=c.useState("claude"),[ne,me]=c.useState("account"),[q,N]=c.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[_,re]=c.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[te,ve]=c.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[je,Ne]=c.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[we,Ie]=c.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[Re,Z]=c.useState([]),[ye,Y]=c.useState([]),[ie,De]=c.useState(!1),[de,$e]=c.useState(""),[Le,Je]=c.useState(""),[Ve,ge]=c.useState([]),[Fe,Ce]=c.useState([]),[ze,Pe]=c.useState("default"),[_e,Ke]=c.useState(!1),[ae,ke]=c.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Be,Ue]=c.useState(null),[mt,It]=c.useState(!1),[pt,kt]=c.useState(!1),[le,pe]=c.useState(""),[ue,Se]=c.useState(null),[We,Xe]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),[Ze,dt]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),[Mt,bt]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),wt=async()=>{try{const L=await Ee("/api/cursor/mcp");if(L.ok){const Q=await L.json();ge(Q.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(L){console.error("Error fetching Cursor MCP servers:",L)}},nt=async()=>{try{const L=await Ee("/api/codex/mcp/config/read");if(L.ok){const ce=await L.json();if(ce.success&&ce.servers){Ce(ce.servers);return}}const Q=await Ee("/api/codex/mcp/cli/list");if(Q.ok){const ce=await Q.json();if(ce.success&&ce.servers){const Te=ce.servers.map(tt=>({id:tt.name,name:tt.name,type:tt.type||"stdio",scope:"user",config:{command:tt.command||"",args:tt.args||[],env:tt.env||{}}}));Ce(Te)}}}catch(L){console.error("Error fetching Codex MCP servers:",L)}},at=async()=>{try{const L=await Ee("/api/mcp/config/read");if(L.ok){const Te=await L.json();if(Te.success&&Te.servers){T(Te.servers);return}}const Q=await Ee("/api/mcp/cli/list");if(Q.ok){const Te=await Q.json();if(Te.success&&Te.servers){const tt=Te.servers.map(ut=>({id:ut.name,name:ut.name,type:ut.type,scope:"user",config:{command:ut.command||"",args:ut.args||[],env:ut.env||{},url:ut.url||"",headers:ut.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));T(tt);return}}const ce=await Ee("/api/mcp/servers?scope=user");if(ce.ok){const Te=await ce.json();T(Te.servers||[])}else console.error("Failed to fetch MCP servers")}catch(L){console.error("Error fetching MCP servers:",L)}},Rt=async L=>{var Q,ce,Te,tt,ut;try{S&&await Bt(S.id,"user");const br=await Ee("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:L.name,type:L.type,scope:L.scope,projectPath:L.projectPath,command:(Q=L.config)==null?void 0:Q.command,args:((ce=L.config)==null?void 0:ce.args)||[],url:(Te=L.config)==null?void 0:Te.url,headers:((tt=L.config)==null?void 0:tt.headers)||{},env:((ut=L.config)==null?void 0:ut.env)||{}})});if(br.ok){const rs=await br.json();if(rs.success)return await at(),!0;throw new Error(rs.error||"Failed to save server via Claude CLI")}else{const rs=await br.json();throw new Error(rs.error||"Failed to save server")}}catch(br){throw console.error("Error saving MCP server:",br),br}},Bt=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/cli/remove/${L}?scope=${Q}`,{method:"DELETE"});if(ce.ok){const Te=await ce.json();if(Te.success)return await at(),!0;throw new Error(Te.error||"Failed to delete server via Claude CLI")}else{const Te=await ce.json();throw new Error(Te.error||"Failed to delete server")}}catch(ce){throw console.error("Error deleting MCP server:",ce),ce}},gr=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/servers/${L}/test?scope=${Q}`,{method:"POST"});if(ce.ok)return(await ce.json()).testResult;{const Te=await ce.json();throw new Error(Te.error||"Failed to test server")}}catch(ce){throw console.error("Error testing MCP server:",ce),ce}},hr=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/servers/${L}/tools?scope=${Q}`,{method:"POST"});if(ce.ok)return(await ce.json()).toolsResult;{const Te=await ce.json();throw new Error(Te.error||"Failed to discover tools")}}catch(ce){throw console.error("Error discovering MCP tools:",ce),ce}},R=async L=>{var Q,ce,Te;try{Be&&await ee(Be.id);const tt=await Ee("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:L.name,command:(Q=L.config)==null?void 0:Q.command,args:((ce=L.config)==null?void 0:ce.args)||[],env:((Te=L.config)==null?void 0:Te.env)||{}})});if(tt.ok){const ut=await tt.json();if(ut.success)return await nt(),!0;throw new Error(ut.error||"Failed to save Codex MCP server")}else{const ut=await tt.json();throw new Error(ut.error||"Failed to save server")}}catch(tt){throw console.error("Error saving Codex MCP server:",tt),tt}},ee=async L=>{try{const Q=await Ee(`/api/codex/mcp/cli/remove/${L}`,{method:"DELETE"});if(Q.ok){const ce=await Q.json();if(ce.success)return await nt(),!0;throw new Error(ce.error||"Failed to delete Codex MCP server")}else{const ce=await Q.json();throw new Error(ce.error||"Failed to delete server")}}catch(Q){throw console.error("Error deleting Codex MCP server:",Q),Q}},Ae=()=>{ke({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),Ue(null),Ke(!1)},et=(L=null)=>{var Q,ce,Te;L?(Ue(L),ke({name:L.name,type:L.type||"stdio",config:{command:((Q=L.config)==null?void 0:Q.command)||"",args:((ce=L.config)==null?void 0:ce.args)||[],env:((Te=L.config)==null?void 0:Te.env)||{}}})):Ae(),Ke(!0)},jt=async L=>{L.preventDefault(),It(!0);try{Be&&await ee(Be.name),await R(ae),Ae(),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}finally{It(!1)}},xt=async L=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await ee(L),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}};c.useEffect(()=>{t&&(_s(),Xr(),Zr(),es(),B(a))},[t,a]),c.useEffect(()=>{localStorage.setItem("codeEditorTheme",q),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[q]),c.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",_.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[_]),c.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",te.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[te]),c.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",je.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[je]),c.useEffect(()=>{localStorage.setItem("codeEditorFontSize",we),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[we]);const _s=async()=>{try{const L=localStorage.getItem("claude-settings");if(L){const Te=JSON.parse(L);d(Te.allowedTools||[]),g(Te.disallowedTools||[]),C(Te.skipPermissions||!1),$(Te.projectSortOrder||"name")}else d([]),g([]),C(!1),$("name");const Q=localStorage.getItem("cursor-tools-settings");if(Q){const Te=JSON.parse(Q);Z(Te.allowedCommands||[]),Y(Te.disallowedCommands||[]),De(Te.skipPermissions||!1)}else Z([]),Y([]),De(!1);const ce=localStorage.getItem("codex-settings");if(ce){const Te=JSON.parse(ce);Pe(Te.permissionMode||"default")}else Pe("default");await at(),await wt(),await nt()}catch(L){console.error("Error loading tool settings:",L),d([]),g([]),C(!1),$("name")}},Xr=async()=>{try{const L=await Ee("/api/cli/claude/status");if(L.ok){const Q=await L.json();Xe({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else Xe({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Claude auth status:",L),Xe({authenticated:!1,email:null,loading:!1,error:L.message})}},Zr=async()=>{try{const L=await Ee("/api/cli/cursor/status");if(L.ok){const Q=await L.json();dt({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else dt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Cursor auth status:",L),dt({authenticated:!1,email:null,loading:!1,error:L.message})}},es=async()=>{try{const L=await Ee("/api/cli/codex/status");if(L.ok){const Q=await L.json();bt({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else bt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Codex auth status:",L),bt({authenticated:!1,email:null,loading:!1,error:L.message})}},zs=()=>{pe("claude"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},Os=()=>{pe("cursor"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},Rs=()=>{pe("codex"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},fr=L=>{L===0&&(A("success"),le==="claude"?Xr():le==="cursor"?Zr():le==="codex"&&es())},Bs=()=>{y(!0),A(null);try{const L={allowedTools:m,disallowedTools:u,skipPermissions:b,projectSortOrder:M,lastUpdated:new Date().toISOString()},Q={allowedCommands:Re,disallowedCommands:ye,skipPermissions:ie,lastUpdated:new Date().toISOString()},ce={permissionMode:ze,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(L)),localStorage.setItem("cursor-tools-settings",JSON.stringify(Q)),localStorage.setItem("codex-settings",JSON.stringify(ce)),A("success"),setTimeout(()=>{r()},1e3)}catch(L){console.error("Error saving tool settings:",L),A("error")}finally{y(!1)}},ar=()=>{P({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),H(null),U(!1),V("")},Mr=(L=null)=>{L?(H(L),P({name:L.name,type:L.type,scope:L.scope,projectPath:L.projectPath||"",config:{...L.config},raw:L.raw,importMode:"form",jsonInput:""})):ar(),U(!0)},Ws=async L=>{L.preventDefault(),F(!0);try{if(w.importMode==="json"){const Q=await Ee("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:w.name,jsonConfig:w.jsonInput,scope:w.scope,projectPath:w.projectPath})});if(Q.ok){const ce=await Q.json();if(ce.success)await at(),ar(),A("success");else throw new Error(ce.error||"Failed to add server via JSON")}else{const ce=await Q.json();throw new Error(ce.error||"Failed to add server")}}else await Rt(w),ar(),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}finally{F(!1)}},Us=async(L,Q)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await Bt(L,Q),A("success")}catch(ce){l(`Error: ${ce.message}`,"error"),A("error")}},Hs=async(L,Q)=>{try{X({...G,[L]:{loading:!0}});const ce=await gr(L,Q);X({...G,[L]:ce})}catch(ce){X({...G,[L]:{success:!1,message:ce.message,details:[]}})}},Nt=async(L,Q)=>{try{se({...E,[L]:!0});const ce=await hr(L,Q);oe({...D,[L]:ce})}catch{oe({...D,[L]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{se({...E,[L]:!1})}},Et=(L,Q)=>{P(ce=>({...ce,config:{...ce.config,[L]:Q}}))};return t?e.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qe,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:i("title")})]}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"border-b border-border",children:e.jsxs("div",{className:"flex px-4 md:px-6",children:[e.jsx("button",{onClick:()=>B("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.agents")}),e.jsx("button",{onClick:()=>B("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.appearance")}),e.jsxs("button",{onClick:()=>B("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Gt,{className:"w-4 h-4 inline mr-2"}),i("mainTabs.git")]}),e.jsxs("button",{onClick:()=>B("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Aa,{className:"w-4 h-4 inline mr-2"}),i("mainTabs.apiTokens")]}),e.jsx("button",{onClick:()=>B("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.tasks")})]})}),e.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[J==="appearance"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:J==="appearance"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.darkMode.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.darkMode.description")})]}),e.jsxs("button",{onClick:o,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":n,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${n?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:n?e.jsx(oa,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(ia,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),e.jsx("div",{className:"space-y-4",children:e.jsx(Go,{})}),e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.projectSorting.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.projectSorting.description")})]}),e.jsxs("select",{value:M,onChange:L=>$(L.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[e.jsx("option",{value:"name",children:i("appearanceSettings.projectSorting.alphabetical")}),e.jsx("option",{value:"date",children:i("appearanceSettings.projectSorting.recentActivity")})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:i("appearanceSettings.codeEditor.title")}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.theme.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.theme.description")})]}),e.jsxs("button",{onClick:()=>N(q==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":q==="dark","aria-label":"Toggle editor theme",children:[e.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),e.jsx("span",{className:`${q==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:q==="dark"?e.jsx(oa,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(ia,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.wordWrap.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.wordWrap.description")})]}),e.jsxs("button",{onClick:()=>re(!_),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":_,"aria-label":"Toggle word wrap",children:[e.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),e.jsx("span",{className:`${_?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.showMinimap.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.showMinimap.description")})]}),e.jsxs("button",{onClick:()=>ve(!te),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":te,"aria-label":"Toggle minimap",children:[e.jsx("span",{className:"sr-only",children:"Toggle minimap"}),e.jsx("span",{className:`${te?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.lineNumbers.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.lineNumbers.description")})]}),e.jsxs("button",{onClick:()=>Ne(!je),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":je,"aria-label":"Toggle line numbers",children:[e.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),e.jsx("span",{className:`${je?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.fontSize.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.fontSize.description")})]}),e.jsxs("select",{value:we,onChange:L=>Ie(L.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[e.jsx("option",{value:"10",children:"10px"}),e.jsx("option",{value:"11",children:"11px"}),e.jsx("option",{value:"12",children:"12px"}),e.jsx("option",{value:"13",children:"13px"}),e.jsx("option",{value:"14",children:"14px"}),e.jsx("option",{value:"15",children:"15px"}),e.jsx("option",{value:"16",children:"16px"}),e.jsx("option",{value:"18",children:"18px"}),e.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),J==="git"&&e.jsx(nd,{}),J==="agents"&&e.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[e.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex",children:[e.jsx(wr,{agentId:"claude",authStatus:We,isSelected:z==="claude",onClick:()=>O("claude"),isMobile:!0}),e.jsx(wr,{agentId:"cursor",authStatus:Ze,isSelected:z==="cursor",onClick:()=>O("cursor"),isMobile:!0}),e.jsx(wr,{agentId:"codex",authStatus:Mt,isSelected:z==="codex",onClick:()=>O("codex"),isMobile:!0})]})}),e.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"p-2",children:[e.jsx(wr,{agentId:"claude",authStatus:We,isSelected:z==="claude",onClick:()=>O("claude")}),e.jsx(wr,{agentId:"cursor",authStatus:Ze,isSelected:z==="cursor",onClick:()=>O("cursor")}),e.jsx(wr,{agentId:"codex",authStatus:Mt,isSelected:z==="codex",onClick:()=>O("codex")})]})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[e.jsx("button",{onClick:()=>me("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.account")}),e.jsx("button",{onClick:()=>me("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.permissions")}),e.jsx("button",{onClick:()=>me("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.mcpServers")})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[ne==="account"&&e.jsx(dd,{agent:z,authStatus:z==="claude"?We:z==="cursor"?Ze:Mt,onLogin:z==="claude"?zs:z==="cursor"?Os:Rs}),ne==="permissions"&&z==="claude"&&e.jsx(Ys,{agent:"claude",skipPermissions:b,setSkipPermissions:C,allowedTools:m,setAllowedTools:d,disallowedTools:u,setDisallowedTools:g,newAllowedTool:p,setNewAllowedTool:x,newDisallowedTool:f,setNewDisallowedTool:h}),ne==="permissions"&&z==="cursor"&&e.jsx(Ys,{agent:"cursor",skipPermissions:ie,setSkipPermissions:De,allowedCommands:Re,setAllowedCommands:Z,disallowedCommands:ye,setDisallowedCommands:Y,newAllowedCommand:de,setNewAllowedCommand:$e,newDisallowedCommand:Le,setNewDisallowedCommand:Je}),ne==="permissions"&&z==="codex"&&e.jsx(Ys,{agent:"codex",permissionMode:ze,setPermissionMode:Pe}),ne==="mcp"&&z==="claude"&&e.jsx(Qs,{agent:"claude",servers:k,onAdd:()=>Mr(),onEdit:L=>Mr(L),onDelete:(L,Q)=>Us(L,Q),onTest:(L,Q)=>Hs(L,Q),onDiscoverTools:(L,Q)=>Nt(L,Q),testResults:G,serverTools:D,toolsLoading:E}),ne==="mcp"&&z==="cursor"&&e.jsx(Qs,{agent:"cursor",servers:Ve,onAdd:()=>{},onEdit:L=>{},onDelete:L=>{}}),ne==="mcp"&&z==="codex"&&e.jsx(Qs,{agent:"codex",servers:Fe,onAdd:()=>et(),onEdit:L=>et(L),onDelete:L=>xt(L)})]})]})]}),W&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:e.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(S?"mcpForm.title.edit":"mcpForm.title.add")}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:ar,children:e.jsx(qe,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:Ws,className:"p-4 space-y-4",children:[!S&&e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${w.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${w.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),w.importMode==="form"&&S&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:i("mcpForm.scope.label")}),e.jsxs("div",{className:"flex items-center gap-2",children:[w.scope==="user"?e.jsx(Vr,{className:"w-4 h-4"}):e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:w.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),w.scope==="local"&&w.projectPath&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",w.projectPath]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:i("mcpForm.scope.cannotChange")})]}),w.importMode==="form"&&!S&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.scope.label")," *"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${w.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Vr,{className:"w-4 h-4"}),e.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${w.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:w.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),w.scope==="local"&&!S&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.selectProject")," *"]}),e.jsxs("select",{value:w.projectPath,onChange:L=>P(Q=>({...Q,projectPath:L.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:w.scope==="local",children:[e.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),s.map(L=>e.jsx("option",{value:L.path||L.fullPath,children:L.displayName||L.name},L.name))]}),w.projectPath&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i("mcpForm.projectPath",{path:w.projectPath})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:w.importMode==="json"?"md:col-span-2":"",children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.serverName")," *"]}),e.jsx(st,{value:w.name,onChange:L=>{P(Q=>({...Q,name:L.target.value}))},placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),w.importMode==="form"&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.transportType")," *"]}),e.jsxs("select",{value:w.type,onChange:L=>{P(Q=>({...Q,type:L.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"sse",children:"SSE"}),e.jsx("option",{value:"http",children:"HTTP"})]})]})]}),S&&w.raw&&w.importMode==="form"&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:i("mcpForm.configDetails",{configFile:S.scope==="global"?"~/.claude.json":"project config"})}),e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(w.raw,null,2)})]}),w.importMode==="json"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.jsonConfig")," *"]}),e.jsx("textarea",{value:w.jsonInput,onChange:L=>{P(Q=>({...Q,jsonInput:L.target.value}));try{if(L.target.value.trim()){const Q=JSON.parse(L.target.value);Q.type?Q.type==="stdio"&&!Q.command?V(i("mcpForm.validation.stdioRequiresCommand")):(Q.type==="http"||Q.type==="sse")&&!Q.url?V(i("mcpForm.validation.httpRequiresUrl",{type:Q.type})):V(""):V(i("mcpForm.validation.missingType"))}}catch{L.target.value.trim()?V(i("mcpForm.validation.invalidJson")):V("")}},className:`w-full px-3 py-2 border ${K?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPreview-CYdvwJaV.js","assets/vendor-react-9mUTKBHH.js","assets/vendor-markdown-BXEi_H3G.js","assets/vendor-syntax-DnmwQQJF.js","assets/CanvasPanel-0u9QR7U-.js","assets/vendor-icons-Lb69KSFJ.js","assets/CanvasPanel-WhZulBJw.css","assets/WorkflowsPanel-CqlbEJA_.js","assets/index-ce18TYkg.js","assets/vendor-i18n-DCFGyhQR.js","assets/index-kQoJx-bc.css","assets/DashboardPanel-Dgqw1yZk.js"])))=>i.map(i=>d[i]);
2
+ import{r as c,j as e,v as Ft,e as ss,g as lo,u as Ti,f as Ii}from"./vendor-react-9mUTKBHH.js";import{e as mr,f as He,h as Ta,a as Ee,i as Yr,l as Ka,d as Ia,j as Ar,k as Ai}from"./index-ce18TYkg.js";import{y as Di,z as Qe,w as Ht,D as Va,f as Ut,P as lt,I as Mi,J as dr,X as qe,K as xs,r as Ds,l as Qr,n as qr,k as ht,C as Tt,j as $i,q as vt,N as er,O as tr,Q as Ja,V as Kr,c as Ot,W as co,G as Gt,Y as Aa,b as jr,a as mo,_ as ur,$ as uo,a0 as Da,E as Ya,a1 as Li,L as Fi,a2 as qt,a3 as Pt,a4 as Ms,T as ct,a5 as Vr,Z as cr,a6 as po,a7 as oa,a8 as ia,a9 as Pi,aa as _i,ab as Ma,ac as $s,ad as xo,ae as gs,F as it,af as Cr,ag as zi,S as fs,ah as Oi,ai as go,aj as $a,ak as ho,al as bs,p as fo,am as Ri,i as Bi,an as Wi,ao as Ui,ap as Xt,aq as Rr,ar as la,as as ca,B as da,at as Br,au as Nr,av as ma,aw as Sr,ax as ua,ay as Wr,az as bo,aA as yr,aB as vr,aC as $r,aD as Lr,aE as kr,aF as Hi,aG as Vt,aH as Qa,aI as Gi,aJ as Xa,aK as Fr,aL as Pr,aM as qi,aN as Ki,aO as _r,aP as Za,aQ as Vi,aR as Ji,aS as hs,aT as as,aU as ys,H as en,aV as qs,aW as Yi,e as Qi,g as La,aX as Xi,aY as yo,aZ as vo,a_ as Zi,a$ as el,b0 as tl,b1 as rl,b2 as sl,b3 as al,b4 as nl,b5 as tn,b6 as ol}from"./vendor-icons-Lb69KSFJ.js";import{a as il,b as ll,C as cl,u as Ge,L as dl,S as ko,c as ml}from"./LoginModal-CZDEzqjK.js";import{h as ul,p as pl,b as Ls}from"./vendor-syntax-DnmwQQJF.js";import{a as xl,b as gl,d as hl,M as fl}from"./vendor-markdown-BXEi_H3G.js";import{F as wo,E as Zt,S as bl,V as Fa,c as Er,a as yl,f as vl,u as kl,b as wl,T as rn,l as jl,h as sn,s as Nl,d as Cl,e as Sl,g as El,i as Ks,j as Tl,R as jo,o as No,k as Il,m as Co,n as Al,p as Dl,q as Ml,r as $l,t as Ll,v as Fl}from"./vendor-codemirror-D_s0aGBu.js";const an=t=>typeof window>"u"?!1:window.innerWidth<t,nn=()=>{if(typeof window>"u")return!1;const t=window.navigator;return window.matchMedia("(display-mode: standalone)").matches||!!t.standalone||document.referrer.includes("android-app://")};function Pa(t={}){const{mobileBreakpoint:r=768,trackMobile:s=!0,trackPWA:a=!0}=t,[n,o]=c.useState(()=>s?an(r):!1),[i,l]=c.useState(()=>a?nn():!1);return c.useEffect(()=>{if(!s||typeof window>"u")return;const m=()=>{o(an(r))};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[r,s]),c.useEffect(()=>{if(!a||typeof window>"u")return;const m=window.matchMedia("(display-mode: standalone)"),d=()=>{l(nn())};return d(),typeof m.addEventListener=="function"?(m.addEventListener("change",d),()=>{m.removeEventListener("change",d)}):(m.addListener(d),()=>{m.removeListener(d)})},[a]),{isMobile:n,isPWA:i}}const on="2.5.1",Pl=(t,r)=>{const s=t.split(".").map(Number),a=r.split(".").map(Number);for(let n=0;n<Math.max(s.length,a.length);n++){const o=s[n]||0,i=a[n]||0;if(o!==i)return o-i}return 0},So=(t,r)=>{const[s,a]=c.useState(!1),[n,o]=c.useState(null),[i,l]=c.useState(null);return c.useEffect(()=>{const m=async()=>{try{const g=await(await fetch(`https://api.github.com/repos/${t}/${r}/releases/latest`)).json();if(g.tag_name){const p=g.tag_name.replace(/^v/,"");o(p),a(Pl(p,on)>0),l({title:g.name||g.tag_name,body:g.body||"",htmlUrl:g.html_url||`https://github.com/${t}/${r}/releases/latest`,publishedAt:g.published_at})}else a(!1),o(null),l(null)}catch(u){console.error("Version check failed:",u),a(!1),o(null),l(null)}};m();const d=setInterval(m,300*1e3);return()=>clearInterval(d)},[t,r]),{updateAvailable:s,latestVersion:n,currentVersion:on,releaseInfo:i}},or={autoExpandTools:!1,showRawParameters:!1,showThinking:!0,autoScrollToBottom:!0,sendByCtrlEnter:!1,sidebarVisible:!0},vs=Object.keys(or),_l=new Set(vs),Vs="ui-preferences:sync",ks=(t,r)=>{if(typeof t=="boolean")return t;if(typeof t=="string"){if(t==="true")return!0;if(t==="false")return!1}return r},zl=(t,r)=>{try{const s=localStorage.getItem(t);if(s===null)return r;const a=JSON.parse(s);return ks(a,r)}catch{return r}},Ol=t=>{if(typeof window>"u")return or;try{const r=localStorage.getItem(t);if(r){const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)){const a=s;return vs.reduce((n,o)=>(n[o]=ks(a[o],or[o]),n),{...or})}}}catch{}return vs.reduce((r,s)=>(r[s]=zl(s,or[s]),r),{...or})};function Rl(t,r){switch(r.type){case"set":{const{key:s,value:a}=r;if(!_l.has(s))return t;const n=ks(a,t[s]);return t[s]===n?t:{...t,[s]:n}}case"set_many":{const s=r.value||{};let a=!1;const n={...t};for(const o of vs){if(!(o in s))continue;const i=s[o],l=ks(i,t[o]);n[o]!==l&&(n[o]=l,a=!0)}return a?n:t}case"reset":return{...or,...r.value||{}};default:return t}}function _a(t="uiPreferences"){const r=c.useRef(`ui-preferences-${Math.random().toString(36).slice(2)}`),[s,a]=c.useReducer(Rl,t,Ol);return c.useEffect(()=>{typeof window>"u"||(localStorage.setItem(t,JSON.stringify(s)),window.dispatchEvent(new CustomEvent(Vs,{detail:{storageKey:t,sourceId:r.current,value:s}})))},[s,t]),c.useEffect(()=>{if(typeof window>"u")return;const l=u=>{!u||typeof u!="object"||Array.isArray(u)||a({type:"set_many",value:u})},m=u=>{if(!(u.key!==t||u.newValue===null))try{const g=JSON.parse(u.newValue);l(g)}catch{}},d=u=>{const p=u.detail;!p||p.storageKey!==t||p.sourceId===r.current||l(p.value)};return window.addEventListener("storage",m),window.addEventListener(Vs,d),()=>{window.removeEventListener("storage",m),window.removeEventListener(Vs,d)}},[t]),{preferences:s,setPreference:(l,m)=>{a({type:"set",key:l,value:m})},setPreferences:l=>{a({type:"set_many",value:l})},resetPreferences:l=>{a({type:"reset",value:l})},dispatch:a}}const Bl=()=>{try{const t=localStorage.getItem("claude-settings");return t&&JSON.parse(t).projectSortOrder==="date"?"date":"name"}catch{return"name"}},Wl=()=>{try{const t=localStorage.getItem("starredProjects");return t?new Set(JSON.parse(t)):new Set}catch{return new Set}},Ul=t=>{try{localStorage.setItem("starredProjects",JSON.stringify([...t]))}catch{}},ws=t=>t.__provider==="cursor"?new Date(t.createdAt||0):t.__provider==="codex"?new Date(t.createdAt||t.lastActivity||0):new Date(t.lastActivity||0),Hl=(t,r)=>t.__provider==="cursor"?t.name||r("projects.untitledSession"):t.__provider==="codex"?t.summary||t.name||r("projects.codexSession"):t.summary||r("projects.newSession"),Gl=t=>t.__provider==="cursor"?String(t.createdAt||""):t.__provider==="codex"?String(t.createdAt||t.lastActivity||""):String(t.lastActivity||""),ql=(t,r,s)=>{const a=ws(t),n=Math.floor((r.getTime()-a.getTime())/(1e3*60));return{isCursorSession:t.__provider==="cursor",isCodexSession:t.__provider==="codex",isActive:n<10,sessionName:Hl(t,s),sessionTime:Gl(t),messageCount:Number(t.messageCount||0)}},Eo=(t,r)=>{const s=[...t.sessions||[],...r[t.name]||[]].map(o=>({...o,__provider:"claude"})),a=(t.cursorSessions||[]).map(o=>({...o,__provider:"cursor"})),n=(t.codexSessions||[]).map(o=>({...o,__provider:"codex"}));return[...s,...a,...n].sort((o,i)=>ws(i).getTime()-ws(o).getTime())},ln=(t,r)=>{const s=Eo(t,r);return s.length===0?new Date(0):s.reduce((a,n)=>{const o=ws(n);return o>a?o:a},new Date(0))},Kl=(t,r,s,a)=>{const n=[...t];return n.sort((o,i)=>{const l=s.has(o.name),m=s.has(i.name);return l&&!m?-1:!l&&m?1:r==="date"?ln(i,a).getTime()-ln(o,a).getTime():(o.displayName||o.name).localeCompare(i.displayName||i.name)}),n},Vl=(t,r)=>{const s=r.trim().toLowerCase();return s?t.filter(a=>{const n=(a.displayName||a.name).toLowerCase(),o=a.name.toLowerCase();return n.includes(s)||o.includes(s)}):t},Jl=(t,r)=>{var n;const s=!!((n=t.taskmaster)!=null&&n.hasTaskmaster),a=!!(r!=null&&r.hasMCPServer&&(r!=null&&r.isConfigured));return s&&a?"fully-configured":s?"taskmaster-only":a?"mcp-only":"not-configured"},Yl=t=>{const r=typeof t.fullPath=="string"&&t.fullPath.length>0?t.fullPath:typeof t.path=="string"?t.path:"";return{name:t.name,displayName:typeof t.displayName=="string"&&t.displayName.trim().length>0?t.displayName:t.name,fullPath:r,path:typeof t.path=="string"&&t.path.length>0?t.path:r}};function Ql({projects:t,selectedProject:r,selectedSession:s,isLoading:a,isMobile:n,t:o,onRefresh:i,onProjectSelect:l,onSessionSelect:m,onSessionDelete:d,onProjectDelete:u,setCurrentProject:g,setSidebarVisible:p,sidebarVisible:x}){const{addToast:f}=mr(),[h,b]=c.useState(new Set),[C,I]=c.useState(null),[y,v]=c.useState(!1),[A,M]=c.useState(""),[$,k]=c.useState({}),[T,W]=c.useState({}),[U,S]=c.useState(new Set),[H,w]=c.useState(new Date),[P,j]=c.useState("name"),[F,G]=c.useState(!1),[X,D]=c.useState({}),[oe,E]=c.useState(null),[se,J]=c.useState(""),[B,K]=c.useState(""),[V,z]=c.useState(new Set),[O,ne]=c.useState(null),[me,q]=c.useState(null),[N,_]=c.useState(!1),[re,te]=c.useState(()=>Wl()),ve=!n&&!x;c.useEffect(()=>{const ae=setInterval(()=>{w(new Date)},6e4);return()=>clearInterval(ae)},[]),c.useEffect(()=>{W({}),S(new Set),D({})},[t]),c.useEffect(()=>{r&&b(ae=>{if(ae.has(r.name))return ae;const ke=new Set(ae);return ke.add(r.name),ke})},[s,r]),c.useEffect(()=>{if(t.length>0&&!a){const ae=new Set;t.forEach(ke=>{ke.sessions&&ke.sessions.length>=0&&ae.add(ke.name)}),S(ae)}},[t,a]),c.useEffect(()=>{const ae=()=>{j(Bl())};ae();const ke=Ue=>{Ue.key==="claude-settings"&&ae()};window.addEventListener("storage",ke);const Be=setInterval(()=>{document.hasFocus()&&ae()},1e3);return()=>{window.removeEventListener("storage",ke),clearInterval(Be)}},[]);const je=c.useCallback(ae=>ke=>{const Be=ke.target;Be.closest(".overflow-y-auto")||Be.closest("[data-scroll-container]")||(ke.preventDefault(),ke.stopPropagation(),ae())},[]),Ne=c.useCallback(ae=>{b(ke=>{const Be=new Set;return ke.has(ae)||Be.add(ae),Be})},[]),we=c.useCallback((ae,ke)=>{m({...ae,__projectName:ke})},[m]),Ie=c.useCallback(ae=>{te(ke=>{const Be=new Set(ke);return Be.has(ae)?Be.delete(ae):Be.add(ae),Ul(Be),Be})},[]),Re=c.useCallback(ae=>re.has(ae),[re]),Z=c.useCallback(ae=>Eo(ae,T),[T]),ye=c.useMemo(()=>t.map(ae=>{const ke=X[ae.name];return ke===void 0?ae:{...ae,sessionMeta:{...ae.sessionMeta,hasMore:ke}}}),[X,t]),Y=c.useMemo(()=>Kl(ye,P,re,T),[T,P,ye,re]),ie=c.useMemo(()=>Vl(Y,B),[B,Y]),De=c.useCallback(ae=>{I(ae.name),M(ae.displayName)},[]),de=c.useCallback(()=>{I(null),M("")},[]),$e=c.useCallback(async ae=>{try{(await He.renameProject(ae,A)).ok?window.refreshProjects?await window.refreshProjects():window.location.reload():console.error("Failed to rename project")}catch(ke){console.error("Error renaming project:",ke)}finally{I(null),M("")}},[A]),Le=c.useCallback((ae,ke,Be,Ue="claude")=>{q({projectName:ae,sessionId:ke,sessionTitle:Be,provider:Ue})},[]),Je=c.useCallback(async()=>{if(!me)return;const{projectName:ae,sessionId:ke,provider:Be}=me;q(null),d==null||d(ke);try{const Ue=Be==="codex"?await He.deleteCodexSession(ke):await He.deleteSession(ae,ke);Ue.ok||console.error("[Sidebar] Failed to delete session:",Ue.status)}catch(Ue){console.error("[Sidebar] Error deleting session:",Ue)}},[d,me,o]),Ve=c.useCallback(ae=>{ne({project:ae,sessionCount:Z(ae).length})},[Z]),ge=c.useCallback(async()=>{if(!O)return;const{project:ae,sessionCount:ke}=O,Be=ke===0;ne(null),z(Ue=>new Set([...Ue,ae.name]));try{const Ue=await He.deleteProject(ae.name,!Be);if(Ue.ok)u==null||u(ae.name);else{const mt=await Ue.json();f(mt.error||o("messages.deleteProjectFailed"),"error")}}catch(Ue){console.error("Error deleting project:",Ue),f(o("messages.deleteProjectError"),"error")}finally{z(Ue=>{const mt=new Set(Ue);return mt.delete(ae.name),mt})}},[O,u,o]),Fe=c.useCallback(async ae=>{var Ue,mt,It;const ke=X[ae.name];if(!(!(ke!==void 0?ke:((Ue=ae.sessionMeta)==null?void 0:Ue.hasMore)===!0)||$[ae.name])){k(pt=>({...pt,[ae.name]:!0}));try{const pt=(((mt=ae.sessions)==null?void 0:mt.length)||0)+(((It=T[ae.name])==null?void 0:It.length)||0),kt=await He.sessions(ae.name,5,pt);if(!kt.ok)return;const le=await kt.json();W(pe=>({...pe,[ae.name]:[...pe[ae.name]||[],...le.sessions||[]]})),le.hasMore===!1&&D(pe=>({...pe,[ae.name]:!1}))}catch(pt){console.error("Error loading more sessions:",pt)}finally{k(pt=>({...pt,[ae.name]:!1}))}}},[T,$,X]),Ce=c.useCallback(ae=>{l(ae),g(ae)},[l,g]),ze=c.useCallback(async()=>{G(!0);try{await i()}finally{G(!1)}},[i]),Pe=c.useCallback(async(ae,ke,Be)=>{E(null),J("")},[]),_e=c.useCallback(()=>{p(!1)},[p]),Ke=c.useCallback(()=>{p(!0)},[p]);return{isSidebarCollapsed:ve,expandedProjects:h,editingProject:C,showNewProject:y,editingName:A,loadingSessions:$,additionalSessions:T,initialSessionsLoaded:U,currentTime:H,projectSortOrder:P,isRefreshing:F,editingSession:oe,editingSessionName:se,searchFilter:B,deletingProjects:V,deleteConfirmation:O,sessionDeleteConfirmation:me,showVersionModal:N,starredProjects:re,filteredProjects:ie,handleTouchClick:je,toggleProject:Ne,handleSessionClick:we,toggleStarProject:Ie,isProjectStarred:Re,getProjectSessions:Z,startEditing:De,cancelEditing:de,saveProjectName:$e,showDeleteSessionConfirmation:Le,confirmDeleteSession:Je,requestProjectDelete:Ve,confirmDeleteProject:ge,loadMoreSessions:Fe,handleProjectSelect:Ce,refreshProjects:ze,updateSessionSummary:Pe,collapseSidebar:_e,expandSidebar:Ke,setShowNewProject:v,setEditingName:M,setEditingSession:E,setEditingSessionName:J,setSearchFilter:K,setDeleteConfirmation:ne,setSessionDeleteConfirmation:q,setShowVersionModal:_}}function Xl({onExpand:t,onShowSettings:r,updateAvailable:s,onShowVersionModal:a,t:n}){return e.jsxs("div",{className:"h-full flex flex-col items-center py-3 gap-1 bg-background/80 backdrop-blur-sm w-12",children:[e.jsx("button",{onClick:t,className:"w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors group","aria-label":n("common:versionUpdate.ariaLabels.showSidebar"),title:n("common:versionUpdate.ariaLabels.showSidebar"),children:e.jsx(Di,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})}),e.jsx("div",{className:"nav-divider w-6 my-1"}),e.jsx("button",{onClick:r,className:"w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors group","aria-label":n("actions.settings"),title:n("actions.settings"),children:e.jsx(Qe,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})}),s&&e.jsxs("button",{onClick:a,className:"relative w-8 h-8 rounded-lg flex items-center justify-center hover:bg-accent/80 transition-colors","aria-label":n("common:versionUpdate.ariaLabels.updateAvailable"),title:n("common:versionUpdate.ariaLabels.updateAvailable"),children:[e.jsx(Ht,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"absolute top-1.5 right-1.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]})]})}function To(t){var r,s,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(r=0;r<n;r++)t[r]&&(s=To(t[r]))&&(a&&(a+=" "),a+=s)}else for(s in t)t[s]&&(a&&(a+=" "),a+=s);return a}function Io(){for(var t,r,s=0,a="",n=arguments.length;s<n;s++)(t=arguments[s])&&(r=To(t))&&(a&&(a+=" "),a+=r);return a}const Zl=(t,r)=>{const s=new Array(t.length+r.length);for(let a=0;a<t.length;a++)s[a]=t[a];for(let a=0;a<r.length;a++)s[t.length+a]=r[a];return s},ec=(t,r)=>({classGroupId:t,validator:r}),Ao=(t=new Map,r=null,s)=>({nextPart:t,validators:r,classGroupId:s}),js="-",cn=[],tc="arbitrary..",rc=t=>{const r=ac(t),{conflictingClassGroups:s,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sc(i);const l=i.split(js),m=l[0]===""&&l.length>1?1:0;return Do(l,m,r)},getConflictingClassGroupIds:(i,l)=>{if(l){const m=a[i],d=s[i];return m?d?Zl(d,m):m:d||cn}return s[i]||cn}}},Do=(t,r,s)=>{if(t.length-r===0)return s.classGroupId;const n=t[r],o=s.nextPart.get(n);if(o){const d=Do(t,r+1,o);if(d)return d}const i=s.validators;if(i===null)return;const l=r===0?t.join(js):t.slice(r).join(js),m=i.length;for(let d=0;d<m;d++){const u=i[d];if(u.validator(l))return u.classGroupId}},sc=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=t.slice(1,-1),s=r.indexOf(":"),a=r.slice(0,s);return a?tc+a:void 0})(),ac=t=>{const{theme:r,classGroups:s}=t;return nc(s,r)},nc=(t,r)=>{const s=Ao();for(const a in t){const n=t[a];za(n,s,a,r)}return s},za=(t,r,s,a)=>{const n=t.length;for(let o=0;o<n;o++){const i=t[o];oc(i,r,s,a)}},oc=(t,r,s,a)=>{if(typeof t=="string"){ic(t,r,s);return}if(typeof t=="function"){lc(t,r,s,a);return}cc(t,r,s,a)},ic=(t,r,s)=>{const a=t===""?r:Mo(r,t);a.classGroupId=s},lc=(t,r,s,a)=>{if(dc(t)){za(t(a),r,s,a);return}r.validators===null&&(r.validators=[]),r.validators.push(ec(s,t))},cc=(t,r,s,a)=>{const n=Object.entries(t),o=n.length;for(let i=0;i<o;i++){const[l,m]=n[i];za(m,Mo(r,l),s,a)}},Mo=(t,r)=>{let s=t;const a=r.split(js),n=a.length;for(let o=0;o<n;o++){const i=a[o];let l=s.nextPart.get(i);l||(l=Ao(),s.nextPart.set(i,l)),s=l}return s},dc=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,mc=t=>{if(t<1)return{get:()=>{},set:()=>{}};let r=0,s=Object.create(null),a=Object.create(null);const n=(o,i)=>{s[o]=i,r++,r>t&&(r=0,a=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=a[o])!==void 0)return n(o,i),i},set(o,i){o in s?s[o]=i:n(o,i)}}},pa="!",dn=":",uc=[],mn=(t,r,s,a,n)=>({modifiers:t,hasImportantModifier:r,baseClassName:s,maybePostfixModifierPosition:a,isExternal:n}),pc=t=>{const{prefix:r,experimentalParseClassName:s}=t;let a=n=>{const o=[];let i=0,l=0,m=0,d;const u=n.length;for(let h=0;h<u;h++){const b=n[h];if(i===0&&l===0){if(b===dn){o.push(n.slice(m,h)),m=h+1;continue}if(b==="/"){d=h;continue}}b==="["?i++:b==="]"?i--:b==="("?l++:b===")"&&l--}const g=o.length===0?n:n.slice(m);let p=g,x=!1;g.endsWith(pa)?(p=g.slice(0,-1),x=!0):g.startsWith(pa)&&(p=g.slice(1),x=!0);const f=d&&d>m?d-m:void 0;return mn(o,x,p,f)};if(r){const n=r+dn,o=a;a=i=>i.startsWith(n)?o(i.slice(n.length)):mn(uc,!1,i,void 0,!0)}if(s){const n=a;a=o=>s({className:o,parseClassName:n})}return a},xc=t=>{const r=new Map;return t.orderSensitiveModifiers.forEach((s,a)=>{r.set(s,1e6+a)}),s=>{const a=[];let n=[];for(let o=0;o<s.length;o++){const i=s[o],l=i[0]==="[",m=r.has(i);l||m?(n.length>0&&(n.sort(),a.push(...n),n=[]),a.push(i)):n.push(i)}return n.length>0&&(n.sort(),a.push(...n)),a}},gc=t=>({cache:mc(t.cacheSize),parseClassName:pc(t),sortModifiers:xc(t),...rc(t)}),hc=/\s+/,fc=(t,r)=>{const{parseClassName:s,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:o}=r,i=[],l=t.trim().split(hc);let m="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:g,modifiers:p,hasImportantModifier:x,baseClassName:f,maybePostfixModifierPosition:h}=s(u);if(g){m=u+(m.length>0?" "+m:m);continue}let b=!!h,C=a(b?f.substring(0,h):f);if(!C){if(!b){m=u+(m.length>0?" "+m:m);continue}if(C=a(f),!C){m=u+(m.length>0?" "+m:m);continue}b=!1}const I=p.length===0?"":p.length===1?p[0]:o(p).join(":"),y=x?I+pa:I,v=y+C;if(i.indexOf(v)>-1)continue;i.push(v);const A=n(C,b);for(let M=0;M<A.length;++M){const $=A[M];i.push(y+$)}m=u+(m.length>0?" "+m:m)}return m},bc=(...t)=>{let r=0,s,a,n="";for(;r<t.length;)(s=t[r++])&&(a=$o(s))&&(n&&(n+=" "),n+=a);return n},$o=t=>{if(typeof t=="string")return t;let r,s="";for(let a=0;a<t.length;a++)t[a]&&(r=$o(t[a]))&&(s&&(s+=" "),s+=r);return s},yc=(t,...r)=>{let s,a,n,o;const i=m=>{const d=r.reduce((u,g)=>g(u),t());return s=gc(d),a=s.cache.get,n=s.cache.set,o=l,l(m)},l=m=>{const d=a(m);if(d)return d;const u=fc(m,s);return n(m,u),u};return o=i,(...m)=>o(bc(...m))},vc=[],ot=t=>{const r=s=>s[t]||vc;return r.isThemeGetter=!0,r},Lo=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fo=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,jc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Nc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Sc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Jt=t=>kc.test(t),Oe=t=>!!t&&!Number.isNaN(Number(t)),Yt=t=>!!t&&Number.isInteger(Number(t)),Js=t=>t.endsWith("%")&&Oe(t.slice(0,-1)),Wt=t=>wc.test(t),Po=()=>!0,Ec=t=>jc.test(t)&&!Nc.test(t),Oa=()=>!1,Tc=t=>Cc.test(t),Ic=t=>Sc.test(t),Ac=t=>!he(t)&&!fe(t),Dc=t=>rr(t,Oo,Oa),he=t=>Lo.test(t),nr=t=>rr(t,Ro,Ec),un=t=>rr(t,Oc,Oe),Mc=t=>rr(t,Wo,Po),$c=t=>rr(t,Bo,Oa),pn=t=>rr(t,_o,Oa),Lc=t=>rr(t,zo,Ic),ns=t=>rr(t,Uo,Tc),fe=t=>Fo.test(t),zr=t=>pr(t,Ro),Fc=t=>pr(t,Bo),xn=t=>pr(t,_o),Pc=t=>pr(t,Oo),_c=t=>pr(t,zo),os=t=>pr(t,Uo,!0),zc=t=>pr(t,Wo,!0),rr=(t,r,s)=>{const a=Lo.exec(t);return a?a[1]?r(a[1]):s(a[2]):!1},pr=(t,r,s=!1)=>{const a=Fo.exec(t);return a?a[1]?r(a[1]):s:!1},_o=t=>t==="position"||t==="percentage",zo=t=>t==="image"||t==="url",Oo=t=>t==="length"||t==="size"||t==="bg-size",Ro=t=>t==="length",Oc=t=>t==="number",Bo=t=>t==="family-name",Wo=t=>t==="number"||t==="weight",Uo=t=>t==="shadow",Rc=()=>{const t=ot("color"),r=ot("font"),s=ot("text"),a=ot("font-weight"),n=ot("tracking"),o=ot("leading"),i=ot("breakpoint"),l=ot("container"),m=ot("spacing"),d=ot("radius"),u=ot("shadow"),g=ot("inset-shadow"),p=ot("text-shadow"),x=ot("drop-shadow"),f=ot("blur"),h=ot("perspective"),b=ot("aspect"),C=ot("ease"),I=ot("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],v=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],A=()=>[...v(),fe,he],M=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],k=()=>[fe,he,m],T=()=>[Jt,"full","auto",...k()],W=()=>[Yt,"none","subgrid",fe,he],U=()=>["auto",{span:["full",Yt,fe,he]},Yt,fe,he],S=()=>[Yt,"auto",fe,he],H=()=>["auto","min","max","fr",fe,he],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...k()],F=()=>[Jt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],G=()=>[Jt,"screen","full","dvw","lvw","svw","min","max","fit",...k()],X=()=>[Jt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],D=()=>[t,fe,he],oe=()=>[...v(),xn,pn,{position:[fe,he]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",Pc,Dc,{size:[fe,he]}],J=()=>[Js,zr,nr],B=()=>["","none","full",d,fe,he],K=()=>["",Oe,zr,nr],V=()=>["solid","dashed","dotted","double"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],O=()=>[Oe,Js,xn,pn],ne=()=>["","none",f,fe,he],me=()=>["none",Oe,fe,he],q=()=>["none",Oe,fe,he],N=()=>[Oe,fe,he],_=()=>[Jt,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Wt],breakpoint:[Wt],color:[Po],container:[Wt],"drop-shadow":[Wt],ease:["in","out","in-out"],font:[Ac],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Wt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Wt],shadow:[Wt],spacing:["px",Oe],text:[Wt],"text-shadow":[Wt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Jt,he,fe,b]}],container:["container"],columns:[{columns:[Oe,he,fe,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:A()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Yt,"auto",fe,he]}],basis:[{basis:[Jt,"full","auto",l,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Oe,Jt,"auto","initial","none",he]}],grow:[{grow:["",Oe,fe,he]}],shrink:[{shrink:["",Oe,fe,he]}],order:[{order:[Yt,"first","last","none",fe,he]}],"grid-cols":[{"grid-cols":W()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":W()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",s,zr,nr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,zc,Mc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Js,he]}],"font-family":[{font:[Fc,$c,r]}],"font-features":[{"font-features":[he]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,fe,he]}],"line-clamp":[{"line-clamp":[Oe,"none",fe,un]}],leading:[{leading:[o,...k()]}],"list-image":[{"list-image":["none",fe,he]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,he]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:[Oe,"from-font","auto",fe,nr]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[Oe,"auto",fe,he]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,he]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,he]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:oe()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yt,fe,he],radial:["",fe,he],conic:[Yt,fe,he]},_c,Lc]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:B()}],"rounded-s":[{"rounded-s":B()}],"rounded-e":[{"rounded-e":B()}],"rounded-t":[{"rounded-t":B()}],"rounded-r":[{"rounded-r":B()}],"rounded-b":[{"rounded-b":B()}],"rounded-l":[{"rounded-l":B()}],"rounded-ss":[{"rounded-ss":B()}],"rounded-se":[{"rounded-se":B()}],"rounded-ee":[{"rounded-ee":B()}],"rounded-es":[{"rounded-es":B()}],"rounded-tl":[{"rounded-tl":B()}],"rounded-tr":[{"rounded-tr":B()}],"rounded-br":[{"rounded-br":B()}],"rounded-bl":[{"rounded-bl":B()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...V(),"hidden","none"]}],"divide-style":[{divide:[...V(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-bs":[{"border-bs":D()}],"border-color-be":[{"border-be":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...V(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Oe,fe,he]}],"outline-w":[{outline:["",Oe,zr,nr]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",u,os,ns]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",g,os,ns]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[Oe,nr]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",p,os,ns]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[Oe,fe,he]}],"mix-blend":[{"mix-blend":[...z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":O()}],"mask-image-linear-to-pos":[{"mask-linear-to":O()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":O()}],"mask-image-t-to-pos":[{"mask-t-to":O()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":O()}],"mask-image-r-to-pos":[{"mask-r-to":O()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":O()}],"mask-image-b-to-pos":[{"mask-b-to":O()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":O()}],"mask-image-l-to-pos":[{"mask-l-to":O()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":O()}],"mask-image-x-to-pos":[{"mask-x-to":O()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":O()}],"mask-image-y-to-pos":[{"mask-y-to":O()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[fe,he]}],"mask-image-radial-from-pos":[{"mask-radial-from":O()}],"mask-image-radial-to-pos":[{"mask-radial-to":O()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":v()}],"mask-image-conic-pos":[{"mask-conic":[Oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":O()}],"mask-image-conic-to-pos":[{"mask-conic-to":O()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:oe()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,he]}],filter:[{filter:["","none",fe,he]}],blur:[{blur:ne()}],brightness:[{brightness:[Oe,fe,he]}],contrast:[{contrast:[Oe,fe,he]}],"drop-shadow":[{"drop-shadow":["","none",x,os,ns]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",Oe,fe,he]}],"hue-rotate":[{"hue-rotate":[Oe,fe,he]}],invert:[{invert:["",Oe,fe,he]}],saturate:[{saturate:[Oe,fe,he]}],sepia:[{sepia:["",Oe,fe,he]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,he]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Oe,fe,he]}],"backdrop-contrast":[{"backdrop-contrast":[Oe,fe,he]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Oe,fe,he]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Oe,fe,he]}],"backdrop-invert":[{"backdrop-invert":["",Oe,fe,he]}],"backdrop-opacity":[{"backdrop-opacity":[Oe,fe,he]}],"backdrop-saturate":[{"backdrop-saturate":[Oe,fe,he]}],"backdrop-sepia":[{"backdrop-sepia":["",Oe,fe,he]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,he]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Oe,"initial",fe,he]}],ease:[{ease:["linear","initial",C,fe,he]}],delay:[{delay:[Oe,fe,he]}],animate:[{animate:["none",I,fe,he]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,fe,he]}],"perspective-origin":[{"perspective-origin":A()}],rotate:[{rotate:me()}],"rotate-x":[{"rotate-x":me()}],"rotate-y":[{"rotate-y":me()}],"rotate-z":[{"rotate-z":me()}],scale:[{scale:q()}],"scale-x":[{"scale-x":q()}],"scale-y":[{"scale-y":q()}],"scale-z":[{"scale-z":q()}],"scale-3d":["scale-3d"],skew:[{skew:N()}],"skew-x":[{"skew-x":N()}],"skew-y":[{"skew-y":N()}],transform:[{transform:[fe,he,"","none","gpu","cpu"]}],"transform-origin":[{origin:A()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_()}],"translate-x":[{"translate-x":_()}],"translate-y":[{"translate-y":_()}],"translate-z":[{"translate-z":_()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,he]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,he]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[Oe,zr,nr,un]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Bc=yc(Rc);function be(...t){return Bc(Io(t))}function Wc(t){if(!t||typeof t!="string")return null;try{return JSON.parse(t)}catch{return null}}const Ra=c.forwardRef(({className:t,children:r,...s},a)=>e.jsx("div",{className:be(t,"relative overflow-hidden"),...s,children:e.jsx("div",{ref:a,className:"h-full w-full rounded-[inherit] overflow-auto",style:{WebkitOverflowScrolling:"touch",touchAction:"pan-y"},children:r})}));Ra.displayName="ScrollArea";function Uc({updateAvailable:t,releaseInfo:r,latestVersion:s,onShowVersionModal:a,onShowSettings:n,t:o}){return e.jsxs("div",{className:"flex-shrink-0",style:{paddingBottom:"env(safe-area-inset-bottom, 0)"},children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nav-divider"}),e.jsx("div",{className:"hidden md:block px-2 py-1.5",children:e.jsxs("button",{className:"w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-left hover:bg-blue-50/80 dark:hover:bg-blue-900/15 transition-colors group",onClick:a,children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Va,{className:"w-4 h-4 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-300 truncate block",children:(r==null?void 0:r.title)||`v${s}`}),e.jsx("span",{className:"text-[10px] text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})}),e.jsx("div",{className:"md:hidden px-3 py-2",children:e.jsxs("button",{className:"w-full h-11 bg-blue-50/80 dark:bg-blue-900/15 border border-blue-200/60 dark:border-blue-700/40 rounded-xl flex items-center gap-3 px-3.5 active:scale-[0.98] transition-all",onClick:a,children:[e.jsxs("div",{className:"relative flex-shrink-0",children:[e.jsx(Va,{className:"w-4.5 h-4.5 text-blue-500 dark:text-blue-400"}),e.jsx("span",{className:"absolute -top-0.5 -right-0.5 w-1.5 h-1.5 bg-blue-500 rounded-full animate-pulse"})]}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"text-sm font-medium text-blue-600 dark:text-blue-300 truncate block",children:(r==null?void 0:r.title)||`v${s}`}),e.jsx("span",{className:"text-xs text-blue-500/70 dark:text-blue-400/60",children:o("version.updateAvailable")})]})]})})]}),e.jsx("div",{className:"nav-divider"}),e.jsx("div",{className:"hidden md:block px-2 py-1.5",children:e.jsxs("button",{className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors",onClick:n,children:[e.jsx(Qe,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"text-sm",children:o("actions.settings")})]})}),e.jsx("div",{className:"md:hidden p-3 pb-20",children:e.jsxs("button",{className:"w-full h-12 bg-muted/40 hover:bg-muted/60 rounded-xl flex items-center gap-3.5 px-4 active:scale-[0.98] transition-all",onClick:n,children:[e.jsx("div",{className:"w-8 h-8 rounded-xl bg-background/80 flex items-center justify-center",children:e.jsx(Qe,{className:"w-4.5 h-4.5 text-muted-foreground"})}),e.jsx("span",{className:"text-base font-medium text-foreground",children:o("actions.settings")})]})})]})}const gn=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,hn=Io,Ho=(t,r)=>s=>{var a;if((r==null?void 0:r.variants)==null)return hn(t,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:n,defaultVariants:o}=r,i=Object.keys(n).map(d=>{const u=s==null?void 0:s[d],g=o==null?void 0:o[d];if(u===null)return null;const p=gn(u)||gn(g);return n[d][p]}),l=s&&Object.entries(s).reduce((d,u)=>{let[g,p]=u;return p===void 0||(d[g]=p),d},{}),m=r==null||(a=r.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:g,className:p,...x}=u;return Object.entries(x).every(f=>{let[h,b]=f;return Array.isArray(b)?b.includes({...o,...l}[h]):{...o,...l}[h]===b})?[...d,g,p]:d},[]);return hn(t,i,m,s==null?void 0:s.class,s==null?void 0:s.className)},Hc=Ho("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),xe=c.forwardRef(({className:t,variant:r,size:s,...a},n)=>e.jsx("button",{className:be(Hc({variant:r,size:s,className:t})),ref:n,...a}));xe.displayName="Button";const st=c.forwardRef(({className:t,type:r,...s},a)=>e.jsx("input",{type:r,className:be("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));st.displayName="Input";function Gc({isPWA:t,isMobile:r,isLoading:s,projectsCount:a,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,t:g}){const p=()=>e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("div",{className:"w-7 h-7 bg-primary/90 rounded-lg flex items-center justify-center shadow-sm flex-shrink-0",children:e.jsx("svg",{className:"w-3.5 h-3.5 text-primary-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),e.jsx("h1",{className:"text-sm font-semibold text-foreground tracking-tight truncate",children:g("app.title")})]});return e.jsxs("div",{className:"flex-shrink-0",children:[e.jsxs("div",{className:"hidden md:block px-3 pt-3 pb-2",style:{},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(p,{}),e.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:l,disabled:m,title:g("tooltips.refresh"),children:e.jsx(Ut,{className:`w-3.5 h-3.5 ${m?"animate-spin":""}`})}),e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:d,title:g("tooltips.createProject"),children:e.jsx(lt,{className:"w-3.5 h-3.5"})}),e.jsx(xe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground hover:bg-accent/80 rounded-lg",onClick:u,title:g("tooltips.hideSidebar"),children:e.jsx(Mi,{className:"w-3.5 h-3.5"})})]})]}),a>0&&!s&&e.jsxs("div",{className:"relative mt-2.5",children:[e.jsx(dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground/50 pointer-events-none"}),e.jsx(st,{type:"text",placeholder:g("projects.searchPlaceholder"),value:n,onChange:x=>o(x.target.value),className:"nav-search-input pl-9 pr-8 h-9 text-sm rounded-xl border-0 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0 transition-all duration-200"}),n&&e.jsx("button",{onClick:i,className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-0.5 hover:bg-accent rounded-md",children:e.jsx(qe,{className:"w-3 h-3 text-muted-foreground"})})]})]}),e.jsx("div",{className:"hidden md:block nav-divider"}),e.jsxs("div",{className:"md:hidden p-3 pb-2",style:t&&r?{paddingTop:"16px"}:{},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(p,{}),e.jsxs("div",{className:"flex gap-1.5 flex-shrink-0",children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-muted/50 flex items-center justify-center active:scale-95 transition-all",onClick:l,disabled:m,children:e.jsx(Ut,{className:`w-4 h-4 text-muted-foreground ${m?"animate-spin":""}`})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/90 text-primary-foreground flex items-center justify-center active:scale-95 transition-all",onClick:d,children:e.jsx(xs,{className:"w-4 h-4"})})]})]}),a>0&&!s&&e.jsxs("div",{className:"relative mt-2.5",children:[e.jsx(dr,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 pointer-events-none"}),e.jsx(st,{type:"text",placeholder:g("projects.searchPlaceholder"),value:n,onChange:x=>o(x.target.value),className:"nav-search-input pl-10 pr-9 h-10 text-sm rounded-xl border-0 placeholder:text-muted-foreground/40 focus-visible:ring-0 focus-visible:ring-offset-0 transition-all duration-200"}),n&&e.jsx("button",{onClick:i,className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 hover:bg-accent rounded-md",children:e.jsx(qe,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})]}),e.jsx("div",{className:"md:hidden nav-divider"})]})}const qc=({status:t="not-configured",size:r="sm",className:s="",showLabel:a=!1})=>{const o=(()=>{switch(t){case"fully-configured":return{icon:Qr,color:"text-green-500 dark:text-green-400",bgColor:"bg-green-50 dark:bg-green-950",label:"TaskMaster Ready",title:"TaskMaster fully configured with MCP server"};case"taskmaster-only":return{icon:Qe,color:"text-blue-500 dark:text-blue-400",bgColor:"bg-blue-50 dark:bg-blue-950",label:"TaskMaster Init",title:"TaskMaster initialized, MCP server needs setup"};case"mcp-only":return{icon:Ds,color:"text-amber-500 dark:text-amber-400",bgColor:"bg-amber-50 dark:bg-amber-950",label:"MCP Ready",title:"MCP server configured, TaskMaster needs initialization"};case"not-configured":case"error":default:return{icon:qe,color:"text-gray-400 dark:text-gray-500",bgColor:"bg-gray-50 dark:bg-gray-900",label:"No TaskMaster",title:"TaskMaster not configured"}}})(),i=o.icon,l={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},m={xs:"p-0.5",sm:"p-1",md:"p-1.5",lg:"p-2"};return a?e.jsxs("div",{className:be("inline-flex items-center gap-1.5 text-xs rounded-md px-2 py-1 transition-colors",o.bgColor,o.color,s),title:o.title,children:[e.jsx(i,{className:l[r]}),e.jsx("span",{className:"font-medium",children:o.label})]}):e.jsx("div",{className:be("inline-flex items-center justify-center rounded-full transition-colors",o.bgColor,m[r],s),title:o.title,children:e.jsx(i,{className:be(l[r],o.color)})})},Kc=Ho("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Dt({className:t,variant:r,...s}){return e.jsx("div",{className:be(Kc({variant:r}),t),...s})}const fn=(t,r,s)=>{const a=new Date(t),n=r;if(isNaN(a.getTime()))return s?s("status.unknown"):"Unknown";const o=n.getTime()-a.getTime(),i=Math.floor(o/1e3),l=Math.floor(o/(1e3*60)),m=Math.floor(o/(1e3*60*60)),d=Math.floor(o/(1e3*60*60*24));return i<60?s?s("time.justNow"):"Just now":l===1?s?s("time.oneMinuteAgo"):"1 min ago":l<60?s?s("time.minutesAgo",{count:l}):`${l} mins ago`:m===1?s?s("time.oneHourAgo"):"1 hour ago":m<24?s?s("time.hoursAgo",{count:m}):`${m} hours ago`:d===1?s?s("time.oneDayAgo"):"1 day ago":d<7?s?s("time.daysAgo",{count:d}):`${d} days ago`:a.toLocaleDateString()};function At({provider:t="claude",className:r="w-5 h-5"}){return t==="cursor"?e.jsx(il,{className:r}):t==="codex"?e.jsx(ll,{className:r}):e.jsx(cl,{className:r})}function Vc({project:t,session:r,selectedSession:s,currentTime:a,editingSession:n,editingSessionName:o,onEditingSessionNameChange:i,onStartEditingSession:l,onCancelEditingSession:m,onSaveEditingSession:d,onProjectSelect:u,onSessionSelect:g,onDeleteSession:p,touchHandlerFactory:x,t:f}){const h=ql(r,a,f),b=(s==null?void 0:s.id)===r.id,C=()=>{u(t),g(r,t.name)},I=()=>{d(t.name,r.id,o)},y=()=>{p(t.name,r.id,h.sessionName,r.__provider)};return e.jsxs("div",{className:"group relative",children:[h.isActive&&e.jsx("div",{className:"absolute left-0 top-1/2 transform -translate-y-1/2 -translate-x-1",children:e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"})}),e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:be("p-2 mx-3 my-0.5 rounded-md bg-card border active:scale-[0.98] transition-all duration-150 relative",b?"bg-primary/5 border-primary/20":"",!b&&h.isActive?"border-green-500/30 bg-green-50/5 dark:bg-green-900/5":"border-border/30"),onClick:C,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:be("w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0",b?"bg-primary/10":"bg-muted/50"),children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground",children:h.sessionName}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(qr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:fn(h.sessionTime,a,f)}),h.messageCount>0&&e.jsx(Dt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto",children:h.messageCount}),e.jsx("span",{className:"ml-1 opacity-70",children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})})]})]}),!h.isCursorSession&&e.jsx("button",{className:"w-5 h-5 rounded-md bg-red-50 dark:bg-red-900/20 flex items-center justify-center active:scale-95 transition-transform opacity-70 ml-1",onClick:v=>{v.stopPropagation(),y()},children:e.jsx(ht,{className:"w-2.5 h-2.5 text-red-600 dark:text-red-400"})})]})})}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx(xe,{variant:"ghost",className:be("w-full justify-start px-2 py-2.5 h-auto min-h-[48px] font-normal text-left hover:bg-accent/50 transition-colors duration-200",b&&"bg-accent text-accent-foreground"),onClick:()=>g(r,t.name),children:e.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full pr-14",children:[e.jsx(At,{provider:r.__provider,className:"w-3 h-3 mt-1 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-medium truncate text-foreground leading-5",children:h.sessionName}),e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx(qr,{className:"w-2.5 h-2.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:fn(h.sessionTime,a,f)}),h.messageCount>0&&e.jsx(Dt,{variant:"secondary",className:"text-xs px-1 py-0 ml-auto group-hover:opacity-0 transition-opacity",children:h.messageCount}),e.jsx("span",{className:"ml-1 opacity-70 group-hover:opacity-0 transition-opacity",children:e.jsx(At,{provider:r.__provider,className:"w-3 h-3"})})]})]})]})}),!h.isCursorSession&&e.jsx("div",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1.5 opacity-0 group-hover:opacity-100 transition-all duration-200 bg-accent/80 backdrop-blur-sm rounded-md px-1 py-0.5",children:n===r.id&&!h.isCodexSession?e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",value:o,onChange:v=>i(v.target.value),onKeyDown:v=>{v.stopPropagation(),v.key==="Enter"?I():v.key==="Escape"&&m()},onClick:v=>v.stopPropagation(),className:"w-32 px-2 py-1 text-xs border border-border rounded bg-background focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0}),e.jsx("button",{className:"w-6 h-6 bg-green-50 hover:bg-green-100 dark:bg-green-900/20 dark:hover:bg-green-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),I()},title:f("tooltips.save"),children:e.jsx(Tt,{className:"w-3 h-3 text-green-600 dark:text-green-400"})}),e.jsx("button",{className:"w-6 h-6 bg-gray-50 hover:bg-gray-100 dark:bg-gray-900/20 dark:hover:bg-gray-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),m()},title:f("tooltips.cancel"),children:e.jsx(qe,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})})]}):e.jsxs(e.Fragment,{children:[!h.isCodexSession&&e.jsx("button",{className:"w-7 h-7 bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),l(r.id,r.summary||f("projects.newSession"))},title:f("tooltips.editSessionName"),children:e.jsx($i,{className:"w-3 h-3 text-gray-600 dark:text-gray-400"})}),e.jsx("button",{className:"w-7 h-7 bg-red-50 hover:bg-red-100 dark:bg-red-900/20 dark:hover:bg-red-900/40 rounded flex items-center justify-center",onClick:v=>{v.stopPropagation(),y()},title:f("tooltips.deleteSession"),children:e.jsx(ht,{className:"w-3 h-3 text-red-600 dark:text-red-400"})})]})})]})]})}function Jc(){return e.jsx(e.Fragment,{children:Array.from({length:3}).map((t,r)=>e.jsx("div",{className:"p-2 rounded-md",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"w-3 h-3 bg-muted rounded-full animate-pulse mt-0.5"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"h-3 bg-muted rounded animate-pulse",style:{width:`${60+r*15}%`}}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-1/2"})]})]})},r))})}function Yc({project:t,isExpanded:r,sessions:s,selectedSession:a,initialSessionsLoaded:n,isLoadingSessions:o,currentTime:i,editingSession:l,editingSessionName:m,onEditingSessionNameChange:d,onStartEditingSession:u,onCancelEditingSession:g,onSaveEditingSession:p,onProjectSelect:x,onSessionSelect:f,onDeleteSession:h,onLoadMoreSessions:b,onNewSession:C,touchHandlerFactory:I,t:y}){var M;if(!r)return null;const v=s.length>0,A=((M=t.sessionMeta)==null?void 0:M.hasMore)===!0;return e.jsxs("div",{className:"ml-3 space-y-1 border-l border-border pl-3",children:[n?!v&&!o?e.jsx("div",{className:"py-2 px-3 text-left",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:y("sessions.noSessions")})}):s.map($=>e.jsx(Vc,{project:t,session:$,selectedSession:a,currentTime:i,editingSession:l,editingSessionName:m,onEditingSessionNameChange:d,onStartEditingSession:u,onCancelEditingSession:g,onSaveEditingSession:p,onProjectSelect:x,onSessionSelect:f,onDeleteSession:h,touchHandlerFactory:I,t:y},$.id)):e.jsx(Jc,{}),v&&A&&e.jsx(xe,{variant:"ghost",size:"sm",className:"w-full justify-center gap-2 mt-2 text-muted-foreground",onClick:()=>b(t),disabled:o,children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-3 h-3 animate-spin rounded-full border border-muted-foreground border-t-transparent"}),y("sessions.loading")]}):e.jsxs(e.Fragment,{children:[e.jsx(vt,{className:"w-3 h-3"}),y("sessions.showMore")]})}),e.jsx("div",{className:"md:hidden px-3 pb-2",children:e.jsxs("button",{className:"w-full h-8 bg-primary hover:bg-primary/90 text-primary-foreground rounded-md flex items-center justify-center gap-2 font-medium text-xs active:scale-[0.98] transition-all duration-150",onClick:()=>{x(t),C(t)},children:[e.jsx(lt,{className:"w-3 h-3"}),y("sessions.newSession")]})}),e.jsxs(xe,{variant:"default",size:"sm",className:"hidden md:flex w-full justify-start gap-2 mt-1 h-8 text-xs font-medium bg-primary hover:bg-primary/90 text-primary-foreground transition-colors",onClick:()=>C(t),children:[e.jsx(lt,{className:"w-3 h-3"}),y("sessions.newSession")]})]})}const Qc=(t,r)=>{const s=t.length;return r&&s>=5?`${s}+`:`${s}`};function Xc({project:t,selectedProject:r,selectedSession:s,isExpanded:a,isDeleting:n,isStarred:o,editingProject:i,editingName:l,sessions:m,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:g,editingSession:p,editingSessionName:x,tasksEnabled:f,mcpServerStatus:h,onEditingNameChange:b,onToggleProject:C,onProjectSelect:I,onToggleStarProject:y,onStartEditingProject:v,onCancelEditingProject:A,onSaveProjectName:M,onDeleteProject:$,onSessionSelect:k,onDeleteSession:T,onLoadMoreSessions:W,onNewSession:U,onEditingSessionNameChange:S,onStartEditingSession:H,onCancelEditingSession:w,onSaveEditingSession:P,touchHandlerFactory:j,t:F}){var z;const G=(r==null?void 0:r.name)===t.name,X=i===t.name,D=((z=t.sessionMeta)==null?void 0:z.hasMore)===!0,oe=Qc(m,D),E=`${oe} session${m.length===1?"":"s"}`,se=Jl(t,h),J=()=>C(t.name),B=()=>y(t.name),K=()=>{M(t.name)},V=()=>{(r==null?void 0:r.name)!==t.name&&I(t),J()};return e.jsxs("div",{className:be("md:space-y-1",n&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"group md:group",children:[e.jsx("div",{className:"md:hidden",children:e.jsx("div",{className:be("p-3 mx-3 my-1 rounded-lg bg-card border border-border/50 active:scale-[0.98] transition-all duration-150",G&&"bg-primary/5 border-primary/20",o&&!G&&"bg-yellow-50/50 dark:bg-yellow-900/5 border-yellow-200/30 dark:border-yellow-800/30"),onClick:J,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:be("w-8 h-8 rounded-lg flex items-center justify-center transition-colors",a?"bg-primary/10":"bg-muted"),children:a?e.jsx(er,{className:"w-4 h-4 text-primary"}):e.jsx(tr,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("div",{className:"min-w-0 flex-1",children:X?e.jsx("input",{type:"text",value:l,onChange:O=>b(O.target.value),className:"w-full px-3 py-2 text-sm border-2 border-primary/40 focus:border-primary rounded-lg bg-background text-foreground shadow-sm focus:shadow-md transition-all duration-200 focus:outline-none",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,autoComplete:"off",onClick:O=>O.stopPropagation(),onKeyDown:O=>{O.key==="Enter"&&K(),O.key==="Escape"&&A()},style:{fontSize:"16px",WebkitAppearance:"none",borderRadius:"8px"}}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:t.displayName}),f&&e.jsx(qc,{status:se,size:"xs",className:"hidden md:inline-flex flex-shrink-0 ml-2"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:E})]})})]}),e.jsx("div",{className:"flex items-center gap-1",children:X?e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"w-8 h-8 rounded-lg bg-green-500 dark:bg-green-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:O=>{O.stopPropagation(),K()},children:e.jsx(Tt,{className:"w-4 h-4 text-white"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-gray-500 dark:bg-gray-600 flex items-center justify-center active:scale-90 transition-all duration-150 shadow-sm active:shadow-none",onClick:O=>{O.stopPropagation(),A()},children:e.jsx(qe,{className:"w-4 h-4 text-white"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:be("w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border",o?"bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800":"bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800"),onClick:O=>{O.stopPropagation(),B()},title:F(o?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:e.jsx(Ja,{className:be("w-4 h-4 transition-colors",o?"text-yellow-600 dark:text-yellow-400 fill-current":"text-gray-600 dark:text-gray-400")})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-red-500/10 dark:bg-red-900/30 flex items-center justify-center active:scale-90 border border-red-200 dark:border-red-800",onClick:O=>{O.stopPropagation(),$(t)},children:e.jsx(ht,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),e.jsx("button",{className:"w-8 h-8 rounded-lg bg-primary/10 dark:bg-primary/20 flex items-center justify-center active:scale-90 border border-primary/20 dark:border-primary/30",onClick:O=>{O.stopPropagation(),v(t)},children:e.jsx(Kr,{className:"w-4 h-4 text-primary"})}),e.jsx("div",{className:"w-6 h-6 rounded-md bg-muted/30 flex items-center justify-center",children:a?e.jsx(vt,{className:"w-3 h-3 text-muted-foreground"}):e.jsx(Ot,{className:"w-3 h-3 text-muted-foreground"})})]})})]})})}),e.jsxs(xe,{variant:"ghost",className:be("hidden md:flex w-full justify-between p-2 h-auto font-normal hover:bg-accent/50",G&&"bg-accent text-accent-foreground",o&&!G&&"bg-yellow-50/50 dark:bg-yellow-900/10 hover:bg-yellow-100/50 dark:hover:bg-yellow-900/20"),onClick:V,children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[a?e.jsx(er,{className:"w-4 h-4 text-primary flex-shrink-0"}):e.jsx(tr,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"}),e.jsx("div",{className:"min-w-0 flex-1 text-left",children:X?e.jsxs("div",{className:"space-y-1",children:[e.jsx("input",{type:"text",value:l,onChange:O=>b(O.target.value),className:"w-full px-2 py-1 text-sm border border-border rounded bg-background text-foreground focus:ring-2 focus:ring-primary/20",placeholder:F("projects.projectNamePlaceholder"),autoFocus:!0,onKeyDown:O=>{O.key==="Enter"&&K(),O.key==="Escape"&&A()}}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",title:t.fullPath,children:t.fullPath})]}):e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-semibold truncate text-foreground",title:t.displayName,children:t.displayName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[oe,t.fullPath!==t.displayName&&e.jsxs("span",{className:"ml-1 opacity-60",title:t.fullPath,children:[" - ",t.fullPath.length>25?`...${t.fullPath.slice(-22)}`:t.fullPath]})]})]})})]}),e.jsx("div",{className:"flex items-center gap-1 flex-shrink-0",children:X?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-6 h-6 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-900/20 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:O=>{O.stopPropagation(),K()},children:e.jsx(Tt,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 text-gray-500 hover:text-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center justify-center rounded cursor-pointer transition-colors",onClick:O=>{O.stopPropagation(),A()},children:e.jsx(qe,{className:"w-3 h-3"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:be("w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100",o?"hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100":"hover:bg-accent"),onClick:O=>{O.stopPropagation(),B()},title:F(o?"tooltips.removeFromFavorites":"tooltips.addToFavorites"),children:e.jsx(Ja,{className:be("w-3 h-3 transition-colors",o?"text-yellow-600 dark:text-yellow-400 fill-current":"text-muted-foreground")})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-accent flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:O=>{O.stopPropagation(),v(t)},title:F("tooltips.renameProject"),children:e.jsx(Kr,{className:"w-3 h-3"})}),e.jsx("div",{className:"w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 hover:bg-red-50 dark:hover:bg-red-900/20 flex items-center justify-center rounded cursor-pointer touch:opacity-100",onClick:O=>{O.stopPropagation(),$(t)},title:F("tooltips.deleteProject"),children:e.jsx(ht,{className:"w-3 h-3 text-red-600 dark:text-red-400"})}),a?e.jsx(vt,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"}):e.jsx(Ot,{className:"w-4 h-4 text-muted-foreground group-hover:text-foreground transition-colors"})]})})]})]}),e.jsx(Yc,{project:t,isExpanded:a,sessions:m,selectedSession:s,initialSessionsLoaded:d,isLoadingSessions:u,currentTime:g,editingSession:p,editingSessionName:x,onEditingSessionNameChange:S,onStartEditingSession:H,onCancelEditingSession:w,onSaveEditingSession:P,onProjectSelect:I,onSessionSelect:k,onDeleteSession:T,onLoadMoreSessions:W,onNewSession:U,touchHandlerFactory:j,t:F})]})}function Zc({isLoading:t,loadingProgress:r,projectsCount:s,filteredProjectsCount:a,t:n}){const{isRelayConnected:o}=Ta();return t?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.loadingProjects")}),r&&r.total>0?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"w-full bg-muted rounded-full h-2 overflow-hidden",children:e.jsx("div",{className:"bg-primary h-full transition-all duration-300 ease-out",style:{width:`${r.current/r.total*100}%`}})}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.current,"/",r.total," ",n("projects.projects")]}),r.currentProject&&e.jsx("p",{className:"text-xs text-muted-foreground/70 truncate max-w-[200px] mx-auto",title:r.currentProject,children:r.currentProject.split("-").slice(-2).join("/")})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.fetchingProjects")})]}):s===0?o?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(tr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.noProjects")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.runClaudeCli")})]}):e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(co,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:"No machine connected"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your machine to see projects"})]}):a===0?e.jsxs("div",{className:"text-center py-12 md:py-8 px-4",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-4 md:mb-3",children:e.jsx(dr,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-medium text-foreground mb-2 md:mb-1",children:n("projects.noMatchingProjects")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("projects.tryDifferentSearch")})]}):null}function ed({projects:t,filteredProjects:r,selectedProject:s,selectedSession:a,isLoading:n,loadingProgress:o,expandedProjects:i,editingProject:l,editingName:m,loadingSessions:d,initialSessionsLoaded:u,currentTime:g,editingSession:p,editingSessionName:x,deletingProjects:f,tasksEnabled:h,mcpServerStatus:b,getProjectSessions:C,isProjectStarred:I,onEditingNameChange:y,onToggleProject:v,onProjectSelect:A,onToggleStarProject:M,onStartEditingProject:$,onCancelEditingProject:k,onSaveProjectName:T,onDeleteProject:W,onSessionSelect:U,onDeleteSession:S,onLoadMoreSessions:H,onNewSession:w,onEditingSessionNameChange:P,onStartEditingSession:j,onCancelEditingSession:F,onSaveEditingSession:G,touchHandlerFactory:X,t:D}){const oe=e.jsx(Zc,{isLoading:n,loadingProgress:o,projectsCount:t.length,filteredProjectsCount:r.length,t:D}),E=!n&&t.length>0&&r.length>0;return e.jsx("div",{className:"md:space-y-1 pb-safe-area-inset-bottom",children:E?r.map(se=>e.jsx(Xc,{project:se,selectedProject:s,selectedSession:a,isExpanded:i.has(se.name),isDeleting:f.has(se.name),isStarred:I(se.name),editingProject:l,editingName:m,sessions:C(se),initialSessionsLoaded:u.has(se.name),isLoadingSessions:!!d[se.name],currentTime:g,editingSession:p,editingSessionName:x,tasksEnabled:h,mcpServerStatus:b,onEditingNameChange:y,onToggleProject:v,onProjectSelect:A,onToggleStarProject:M,onStartEditingProject:$,onCancelEditingProject:k,onSaveProjectName:T,onDeleteProject:W,onSessionSelect:U,onDeleteSession:S,onLoadMoreSessions:H,onNewSession:w,onEditingSessionNameChange:P,onStartEditingSession:j,onCancelEditingSession:F,onSaveEditingSession:G,touchHandlerFactory:X,t:D},se.name)):oe})}function td({isPWA:t,isMobile:r,isLoading:s,projects:a,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,updateAvailable:g,releaseInfo:p,latestVersion:x,onShowVersionModal:f,onShowSettings:h,projectListProps:b,t:C}){return e.jsxs("div",{className:"h-full flex flex-col bg-background/80 backdrop-blur-sm md:select-none md:w-72",style:{},children:[e.jsx(Gc,{isPWA:t,isMobile:r,isLoading:s,projectsCount:a.length,searchFilter:n,onSearchFilterChange:o,onClearSearchFilter:i,onRefresh:l,isRefreshing:m,onCreateProject:d,onCollapseSidebar:u,t:C}),e.jsx(Ra,{className:"flex-1 md:px-1.5 md:py-2 overflow-y-auto overscroll-contain",children:e.jsx(ed,{...b})}),e.jsx(Uc,{updateAvailable:g,releaseInfo:p,latestVersion:x,onShowVersionModal:f,onShowSettings:h,t:C})]})}const rd=({onClose:t,onProjectCreated:r})=>{var Re;const{t:s}=Ge(),[a,n]=c.useState(1),[o,i]=c.useState("existing"),[l,m]=c.useState(""),[d,u]=c.useState(""),[g,p]=c.useState(""),[x,f]=c.useState("stored"),[h,b]=c.useState(""),[C,I]=c.useState(!1),[y,v]=c.useState(null),[A,M]=c.useState([]),[$,k]=c.useState(!1),[T,W]=c.useState([]),[U,S]=c.useState(!1),[H,w]=c.useState(!1),[P,j]=c.useState("~"),[F,G]=c.useState([]),[X,D]=c.useState(!1),[oe,E]=c.useState(!1),[se,J]=c.useState(!1),[B,K]=c.useState(""),[V,z]=c.useState(!1),[O,ne]=c.useState("");c.useEffect(()=>{a===2&&o==="new"&&d&&me()},[a,o,d]),c.useEffect(()=>{l.length>2?q(l):(W([]),S(!1))},[l]);const me=async()=>{try{k(!0);const Y=((await(await He.get("/settings/credentials?type=github_token")).json()).credentials||[]).filter(ie=>ie.is_active);M(Y),Y.length>0&&!g&&p(Y[0].id.toString())}catch(Z){console.error("Error loading GitHub tokens:",Z)}finally{k(!1)}},q=async Z=>{try{const ye=Z.lastIndexOf("/"),Y=ye>0?Z.substring(0,ye):"~",De=await(await He.browseFilesystem(Y)).json();if(De.suggestions){const de=De.suggestions.filter($e=>$e.path.toLowerCase().startsWith(Z.toLowerCase())&&$e.path.toLowerCase()!==Z.toLowerCase());W(de.slice(0,5)),S(de.length>0)}}catch(ye){console.error("Error loading path suggestions:",ye)}},N=()=>{if(v(null),a===1){if(!o){v(s("projectWizard.errors.selectType"));return}n(2)}else if(a===2){if(!l.trim()){v(s("projectWizard.errors.providePath"));return}n(3)}},_=()=>{v(null),n(a-1)},re=async()=>{I(!0),v(null),ne("");try{if(o==="new"&&d){const ie=new URLSearchParams({path:l.trim(),githubUrl:d.trim()});x==="stored"&&g?ie.append("githubTokenId",g):x==="new"&&h&&ie.append("newGithubToken",h.trim());const De=`/api/projects/clone-progress?${ie}`;await new Promise((de,$e)=>{const Le=new EventSource(De);Le.onmessage=Je=>{try{const Ve=JSON.parse(Je.data);Ve.type==="progress"?ne(Ve.message):Ve.type==="complete"?(Le.close(),r&&r(Ve.project),t(),de()):Ve.type==="error"&&(Le.close(),$e(new Error(Ve.message)))}catch(Ve){console.error("Error parsing SSE event:",Ve)}},Le.onerror=()=>{Le.close(),$e(new Error("Connection lost during clone"))}});return}const Z={workspaceType:o,path:l.trim()},ye=await He.createWorkspace(Z),Y=await ye.json();if(!ye.ok)throw new Error(Y.details||Y.error||s("projectWizard.errors.failedToCreate"));r&&r(Y.project),t()}catch(Z){console.error("Error creating workspace:",Z),v(Z.message||s("projectWizard.errors.failedToCreate"))}finally{I(!1)}},te=Z=>{m(Z.path),S(!1)},ve=async()=>{w(!0),await je("~")},je=async Z=>{try{D(!0);const Y=await(await He.browseFilesystem(Z)).json();j(Y.path||Z),G(Y.suggestions||[])}catch(ye){console.error("Error loading folders:",ye)}finally{D(!1)}},Ne=(Z,ye=!1)=>{m(Z),w(!1),ye&&n(3)},we=async Z=>{await je(Z)},Ie=async()=>{if(B.trim()){z(!0),v(null);try{const Z=P.includes("\\")?"\\":"/",ye=`${P}${Z}${B.trim()}`,Y=await He.createFolder(ye),ie=await Y.json();if(!Y.ok)throw new Error(ie.error||s("projectWizard.errors.failedToCreateFolder","Failed to create folder"));K(""),J(!1),await je(ie.path||ye)}catch(Z){console.error("Error creating folder:",Z),v(Z.message||s("projectWizard.errors.failedToCreateFolder","Failed to create folder"))}finally{z(!1)}}};return e.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[60] p-0 sm:p-4",children:[e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-none sm:rounded-lg shadow-xl w-full h-full sm:h-auto sm:max-w-2xl border-0 sm:border border-gray-200 dark:border-gray-700 overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(xs,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:s("projectWizard.title")})]}),e.jsx("button",{onClick:t,className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",disabled:C,children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"px-6 pt-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-between",children:[1,2,3].map(Z=>e.jsxs(Ft.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center font-medium text-sm ${Z<a?"bg-green-500 text-white":Z===a?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-500"}`,children:Z<a?e.jsx(Tt,{className:"w-4 h-4"}):Z}),e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 hidden sm:inline",children:s(Z===1?"projectWizard.steps.type":Z===2?"projectWizard.steps.configure":"projectWizard.steps.confirm")})]}),Z<3&&e.jsx("div",{className:`flex-1 h-1 mx-2 rounded ${Z<a?"bg-green-500":"bg-gray-200 dark:bg-gray-700"}`})]},Z))})}),e.jsxs("div",{className:"p-6 space-y-6 min-h-[300px]",children:[y&&e.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4 flex items-start gap-3",children:[e.jsx(Ds,{className:"w-5 h-5 text-red-600 dark:text-red-400 flex-shrink-0 mt-0.5"}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm text-red-800 dark:text-red-200",children:y})})]}),a===1&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-gray-300 mb-3",children:s("projectWizard.step1.question")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx("button",{onClick:()=>i("existing"),className:`p-4 border-2 rounded-lg text-left transition-all ${o==="existing"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(xs,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:s("projectWizard.step1.existing.title")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step1.existing.description")})]})]})}),e.jsx("button",{onClick:()=>i("new"),className:`p-4 border-2 rounded-lg text-left transition-all ${o==="new"?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0",children:e.jsx(Gt,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-semibold text-gray-900 dark:text-white mb-1",children:s("projectWizard.step1.new.title")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step1.new.description")})]})]})})]})]})}),a===2&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s(o==="existing"?"projectWizard.step2.existingPath":"projectWizard.step2.newPath")}),e.jsxs("div",{className:"relative flex gap-2",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(st,{type:"text",value:l,onChange:Z=>m(Z.target.value),placeholder:o==="existing"?"/path/to/existing/workspace":"/path/to/new/workspace",className:"w-full"}),U&&T.length>0&&e.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg max-h-60 overflow-y-auto",children:T.map((Z,ye)=>e.jsxs("button",{onClick:()=>te(Z),className:"w-full px-4 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-700 text-sm",children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-white",children:Z.name}),e.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:Z.path})]},ye))})]}),e.jsx(xe,{type:"button",variant:"outline",onClick:ve,className:"px-3",title:"Browse folders",children:e.jsx(er,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s(o==="existing"?"projectWizard.step2.existingHelp":"projectWizard.step2.newHelp")})]}),o==="new"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.githubUrl")}),e.jsx(st,{type:"text",value:d,onChange:Z=>u(Z.target.value),placeholder:"https://github.com/username/repository",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.githubHelp")})]}),d&&!d.startsWith("git@")&&!d.startsWith("ssh://")&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-4",children:[e.jsx(Aa,{className:"w-5 h-5 text-gray-600 dark:text-gray-400 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h5",{className:"font-medium text-gray-900 dark:text-white mb-1",children:s("projectWizard.step2.githubAuth")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("projectWizard.step2.githubAuthHelp")})]})]}),$?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[e.jsx(jr,{className:"w-4 h-4 animate-spin"}),s("projectWizard.step2.loadingTokens")]}):A.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[e.jsx("button",{onClick:()=>f("stored"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="stored"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.storedToken")}),e.jsx("button",{onClick:()=>f("new"),className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="new"?"bg-blue-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.newToken")}),e.jsx("button",{onClick:()=>{f("none"),p(""),b("")},className:`px-3 py-2 text-sm font-medium rounded-lg transition-colors ${x==="none"?"bg-green-500 text-white":"bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:s("projectWizard.step2.nonePublic")})]}),x==="stored"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.selectToken")}),e.jsxs("select",{value:g,onChange:Z=>p(Z.target.value),className:"w-full px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-sm",children:[e.jsx("option",{value:"",children:s("projectWizard.step2.selectTokenPlaceholder")}),A.map(Z=>e.jsx("option",{value:Z.id,children:Z.credential_name},Z.id))]})]}):x==="new"?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.newToken")}),e.jsx(st,{type:"password",value:h,onChange:Z=>b(Z.target.value),placeholder:"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.tokenHelp")})]}):null]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-3 border border-blue-200 dark:border-blue-800",children:e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:s("projectWizard.step2.publicRepoInfo")})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:s("projectWizard.step2.optionalTokenPublic")}),e.jsx(st,{type:"password",value:h,onChange:Z=>b(Z.target.value),placeholder:s("projectWizard.step2.tokenPublicPlaceholder"),className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:s("projectWizard.step2.noTokensHelp")})]})]})]})]})]}),a===3&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 rounded-lg p-4 border border-gray-200 dark:border-gray-700",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-3",children:s("projectWizard.step3.reviewConfig")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.workspaceType")}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:s(o==="existing"?"projectWizard.step3.existingWorkspace":"projectWizard.step3.newWorkspace")})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.path")}),e.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:l})]}),o==="new"&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.cloneFrom")}),e.jsx("span",{className:"font-mono text-xs text-gray-900 dark:text-white break-all",children:d})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-gray-600 dark:text-gray-400",children:s("projectWizard.step3.authentication")}),e.jsx("span",{className:"text-xs text-gray-900 dark:text-white",children:x==="stored"&&g?`${s("projectWizard.step3.usingStoredToken")} ${((Re=A.find(Z=>Z.id.toString()===g))==null?void 0:Re.credential_name)||"Unknown"}`:x==="new"&&h?s("projectWizard.step3.usingProvidedToken"):d.startsWith("git@")||d.startsWith("ssh://")?s("projectWizard.step3.sshKey","SSH Key"):s("projectWizard.step3.noAuthentication")})]})]})]})]}),e.jsx("div",{className:"bg-blue-50 dark:bg-blue-900/20 rounded-lg p-4 border border-blue-200 dark:border-blue-800",children:C&&O?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-blue-800 dark:text-blue-200",children:s("projectWizard.step3.cloningRepository","Cloning repository...")}),e.jsx("code",{className:"block text-xs font-mono text-blue-700 dark:text-blue-300 whitespace-pre-wrap break-all",children:O})]}):e.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:s(o==="existing"?"projectWizard.step3.existingInfo":d?"projectWizard.step3.newWithClone":"projectWizard.step3.newEmpty")})})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 dark:border-gray-700",children:[e.jsx(xe,{variant:"outline",onClick:a===1?t:_,disabled:C,children:a===1?s("projectWizard.buttons.cancel"):e.jsxs(e.Fragment,{children:[e.jsx(mo,{className:"w-4 h-4 mr-1"}),s("projectWizard.buttons.back")]})}),e.jsx(xe,{onClick:a===3?re:N,disabled:C||a===1&&!o,children:C?e.jsxs(e.Fragment,{children:[e.jsx(jr,{className:"w-4 h-4 mr-2 animate-spin"}),d?s("projectWizard.buttons.cloning","Cloning..."):s("projectWizard.buttons.creating")]}):a===3?e.jsxs(e.Fragment,{children:[e.jsx(Tt,{className:"w-4 h-4 mr-1"}),s("projectWizard.buttons.createProject")]}):e.jsxs(e.Fragment,{children:[s("projectWizard.buttons.next"),e.jsx(Ot,{className:"w-4 h-4 ml-1"})]})})]})]}),H&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-[70] p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] border border-gray-200 dark:border-gray-700 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900/50 rounded-lg flex items-center justify-center",children:e.jsx(er,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Select Folder"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>E(!oe),className:`p-2 rounded-md transition-colors ${oe?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:oe?"Hide hidden folders":"Show hidden folders",children:oe?e.jsx(ur,{className:"w-5 h-5"}):e.jsx(uo,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>J(!se),className:`p-2 rounded-md transition-colors ${se?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,title:"Create new folder",children:e.jsx(lt,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>w(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(qe,{className:"w-5 h-5"})})]})]}),se&&e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-blue-50 dark:bg-blue-900/20",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{type:"text",value:B,onChange:Z=>K(Z.target.value),placeholder:"New folder name",className:"flex-1",onKeyDown:Z=>{Z.key==="Enter"&&Ie(),Z.key==="Escape"&&(J(!1),K(""))},autoFocus:!0}),e.jsx(xe,{size:"sm",onClick:Ie,disabled:!B.trim()||V,children:V?e.jsx(jr,{className:"w-4 h-4 animate-spin"}):"Create"}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>{J(!1),K("")},children:"Cancel"})]})}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:X?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(jr,{className:"w-6 h-6 animate-spin text-gray-400"})}):e.jsxs("div",{className:"space-y-1",children:[P!=="~"&&P!=="/"&&!/^[A-Za-z]:\\?$/.test(P)&&e.jsxs("button",{onClick:()=>{const Z=Math.max(P.lastIndexOf("/"),P.lastIndexOf("\\"));let ye;Z<=0?ye="/":Z===2&&/^[A-Za-z]:/.test(P)?ye=P.substring(0,3):ye=P.substring(0,Z),we(ye)},className:"w-full px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[e.jsx(er,{className:"w-5 h-5 text-gray-400"}),e.jsx("span",{className:"font-medium text-gray-700 dark:text-gray-300",children:".."})]}),F.length===0?e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No subfolders found"}):F.filter(Z=>oe||!Z.name.startsWith(".")).sort((Z,ye)=>Z.name.toLowerCase().localeCompare(ye.name.toLowerCase())).map((Z,ye)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>we(Z.path),className:"flex-1 px-4 py-3 text-left hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg flex items-center gap-3",children:[e.jsx(xs,{className:"w-5 h-5 text-blue-500"}),e.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Z.name})]}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>Ne(Z.path,o==="existing"),className:"text-xs px-3",children:"Select"})]},ye))]})}),e.jsxs("div",{className:"border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"px-4 py-3 bg-gray-50 dark:bg-gray-900/50 flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Path:"}),e.jsx("code",{className:"text-sm font-mono text-gray-900 dark:text-white flex-1 truncate",children:P})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 p-4",children:[e.jsx(xe,{variant:"outline",onClick:()=>{w(!1),J(!1),K("")},children:"Cancel"}),e.jsx(xe,{variant:"outline",onClick:()=>Ne(P,o==="existing"),children:"Use this folder"})]})]})]})})]})},sd="2.5.1";function ad(){const{t}=Ge("settings"),[r,s]=c.useState([]),[a,n]=c.useState([]),[o,i]=c.useState(!0),[l,m]=c.useState(!1),[d,u]=c.useState(!1),[g,p]=c.useState(""),[x,f]=c.useState(""),[h,b]=c.useState(""),[C,I]=c.useState(""),[y,v]=c.useState({}),[A,M]=c.useState(null),[$,k]=c.useState(null),{updateAvailable:T,latestVersion:W,releaseInfo:U}=So("thinqmesh","upfynai-code");c.useEffect(()=>{S()},[]);const S=async()=>{try{i(!0);const oe=await(await Ee("/api/settings/api-keys")).json();s(oe.apiKeys||[]);const se=await(await Ee("/api/settings/credentials?type=github_token")).json();n(se.credentials||[])}catch(D){console.error("Error fetching settings:",D)}finally{i(!1)}},H=async()=>{if(g.trim())try{const oe=await(await Ee("/api/settings/api-keys",{method:"POST",body:JSON.stringify({keyName:g})})).json();oe.success&&(k(oe.apiKey),p(""),m(!1),S())}catch(D){console.error("Error creating API key:",D)}},w=async D=>{if(confirm(t("apiKeys.confirmDelete")))try{await Ee(`/api/settings/api-keys/${D}`,{method:"DELETE"}),S()}catch(oe){console.error("Error deleting API key:",oe)}},P=async(D,oe)=>{try{await Ee(`/api/settings/api-keys/${D}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!oe})}),S()}catch(E){console.error("Error toggling API key:",E)}},j=async()=>{if(!(!x.trim()||!h.trim()))try{(await(await Ee("/api/settings/credentials",{method:"POST",body:JSON.stringify({credentialName:x,credentialType:"github_token",credentialValue:h,description:C})})).json()).success&&(f(""),b(""),I(""),u(!1),S())}catch(D){console.error("Error creating GitHub credential:",D)}},F=async D=>{if(confirm(t("apiKeys.github.confirmDelete")))try{await Ee(`/api/settings/credentials/${D}`,{method:"DELETE"}),S()}catch(oe){console.error("Error deleting GitHub credential:",oe)}},G=async(D,oe)=>{try{await Ee(`/api/settings/credentials/${D}/toggle`,{method:"PATCH",body:JSON.stringify({isActive:!oe})}),S()}catch(E){console.error("Error toggling GitHub credential:",E)}},X=(D,oe)=>{navigator.clipboard.writeText(D),M(oe),setTimeout(()=>M(null),2e3)};return o?e.jsx("div",{className:"text-muted-foreground",children:t("apiKeys.loading")}):e.jsxs("div",{className:"space-y-8",children:[$&&e.jsxs("div",{className:"p-4 bg-yellow-500/10 border border-yellow-500/20 rounded-lg",children:[e.jsx("h4",{className:"font-semibold text-yellow-500 mb-2",children:t("apiKeys.newKey.alertTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:t("apiKeys.newKey.alertMessage")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 bg-background/50 rounded font-mono text-sm break-all",children:$.apiKey}),e.jsx(xe,{size:"sm",variant:"outline",onClick:()=>X($.apiKey,"new"),children:A==="new"?e.jsx(Tt,{className:"h-4 w-4"}):e.jsx(Da,{className:"h-4 w-4"})})]}),e.jsx(xe,{size:"sm",variant:"ghost",className:"mt-3",onClick:()=>k(null),children:t("apiKeys.newKey.iveSavedIt")})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Aa,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("apiKeys.title")})]}),e.jsxs(xe,{size:"sm",onClick:()=>m(!l),children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),t("apiKeys.newButton")]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:t("apiKeys.description")}),e.jsxs("a",{href:"/api-docs.html",target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline inline-flex items-center gap-1",children:[t("apiKeys.apiDocsLink"),e.jsx(Ya,{className:"h-3 w-3"})]})]}),l&&e.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card",children:[e.jsx(st,{placeholder:t("apiKeys.form.placeholder"),value:g,onChange:D=>p(D.target.value),className:"mb-2"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(xe,{onClick:H,children:t("apiKeys.form.createButton")}),e.jsx(xe,{variant:"outline",onClick:()=>m(!1),children:t("apiKeys.form.cancelButton")})]})]}),e.jsx("div",{className:"space-y-2",children:r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:t("apiKeys.empty")}):r.map(D=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:D.key_name}),e.jsx("code",{className:"text-xs text-muted-foreground",children:D.api_key}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[t("apiKeys.list.created")," ",new Date(D.created_at).toLocaleDateString(),D.last_used&&` • ${t("apiKeys.list.lastUsed")} ${new Date(D.last_used).toLocaleDateString()}`]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{size:"sm",variant:D.is_active?"outline":"secondary",onClick:()=>P(D.id,D.is_active),children:D.is_active?t("apiKeys.status.active"):t("apiKeys.status.inactive")}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>w(D.id),children:e.jsx(ht,{className:"h-4 w-4"})})]})]},D.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Li,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("apiKeys.github.title")})]}),e.jsxs(xe,{size:"sm",onClick:()=>u(!d),children:[e.jsx(lt,{className:"h-4 w-4 mr-1"}),t("apiKeys.github.addButton")]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("apiKeys.github.descriptionAlt")}),d&&e.jsxs("div",{className:"mb-4 p-4 border rounded-lg bg-card space-y-3",children:[e.jsx(st,{placeholder:t("apiKeys.github.form.namePlaceholder"),value:x,onChange:D=>f(D.target.value)}),e.jsxs("div",{className:"relative",children:[e.jsx(st,{type:y.new?"text":"password",placeholder:t("apiKeys.github.form.tokenPlaceholder"),value:h,onChange:D=>b(D.target.value),className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>v({...y,new:!y.new}),className:"absolute right-3 top-2.5 text-muted-foreground hover:text-foreground",children:y.new?e.jsx(uo,{className:"h-4 w-4"}):e.jsx(ur,{className:"h-4 w-4"})})]}),e.jsx(st,{placeholder:t("apiKeys.github.form.descriptionPlaceholder"),value:C,onChange:D=>I(D.target.value)}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(xe,{onClick:j,children:t("apiKeys.github.form.addButton")}),e.jsx(xe,{variant:"outline",onClick:()=>{u(!1),f(""),b(""),I("")},children:t("apiKeys.github.form.cancelButton")})]}),e.jsx("a",{href:"https://github.com/settings/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline block",children:t("apiKeys.github.form.howToCreate")})]}),e.jsx("div",{className:"space-y-2",children:a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:t("apiKeys.github.empty")}):a.map(D=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:D.credential_name}),D.description&&e.jsx("div",{className:"text-xs text-muted-foreground",children:D.description}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[t("apiKeys.github.added")," ",new Date(D.created_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{size:"sm",variant:D.is_active?"outline":"secondary",onClick:()=>G(D.id,D.is_active),children:D.is_active?t("apiKeys.status.active"):t("apiKeys.status.inactive")}),e.jsx(xe,{size:"sm",variant:"ghost",onClick:()=>F(D.id),children:e.jsx(ht,{className:"h-4 w-4"})})]})]},D.id))})]}),e.jsx("div",{className:"pt-6 border-t border-border/50",children:e.jsxs("div",{className:"flex items-center justify-between text-xs italic text-muted-foreground/60",children:[e.jsxs("a",{href:(U==null?void 0:U.htmlUrl)||"https://github.com/thinqmesh/upfynai-code/releases",target:"_blank",rel:"noopener noreferrer",className:"hover:text-muted-foreground transition-colors",children:["v",sd]}),T&&W&&e.jsxs("a",{href:(U==null?void 0:U.htmlUrl)||"https://github.com/thinqmesh/upfynai-code/releases",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-2 py-0.5 bg-green-500/10 text-green-600 dark:text-green-400 rounded-full hover:bg-green-500/20 transition-colors not-italic font-medium",children:[e.jsx("span",{className:"text-[10px]",children:t("apiKeys.version.updateAvailable",{version:W})}),e.jsx(Ya,{className:"h-2.5 w-2.5"})]})]})})]})}function nd(){const{t}=Ge("settings"),[r,s]=c.useState(""),[a,n]=c.useState(""),[o,i]=c.useState(!1),[l,m]=c.useState(!1),[d,u]=c.useState(null);c.useEffect(()=>{g()},[]);const g=async()=>{try{i(!0);const x=await Ee("/api/user/git-config");if(x.ok){const f=await x.json();s(f.gitName||""),n(f.gitEmail||"")}}catch(x){console.error("Error loading git config:",x)}finally{i(!1)}},p=async()=>{try{m(!0);const x=await Ee("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:r,gitEmail:a})});if(x.ok)u("success"),setTimeout(()=>u(null),3e3);else{const f=await x.json();u("error"),console.error("Failed to save git config:",f.error)}}catch(x){console.error("Error saving git config:",x),u("error")}finally{m(!1)}};return e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Gt,{className:"h-5 w-5"}),e.jsx("h3",{className:"text-lg font-semibold",children:t("git.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("git.description")}),e.jsxs("div",{className:"p-4 border rounded-lg bg-card space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"settings-git-name",className:"block text-sm font-medium text-foreground mb-2",children:t("git.name.label")}),e.jsx(st,{id:"settings-git-name",type:"text",value:r,onChange:x=>s(x.target.value),placeholder:"John Doe",disabled:o,className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("git.name.help")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"settings-git-email",className:"block text-sm font-medium text-foreground mb-2",children:t("git.email.label")}),e.jsx(st,{id:"settings-git-email",type:"email",value:a,onChange:x=>n(x.target.value),placeholder:"john@example.com",disabled:o,className:"w-full"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("git.email.help")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xe,{onClick:p,disabled:l||!r||!a,children:t(l?"git.actions.saving":"git.actions.save")}),d==="success"&&e.jsxs("div",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[e.jsx(Tt,{className:"w-4 h-4"}),t("git.status.success")]})]})]})]})})}function od(){const{t}=Ge("settings"),{tasksEnabled:r,setTasksEnabled:s,isTaskMasterInstalled:a,isCheckingInstallation:n}=Yr();return e.jsx("div",{className:"space-y-8",children:n?e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:t("tasks.checking")})]})}):e.jsxs(e.Fragment,{children:[!a&&e.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:t("tasks.notInstalled.title")}),e.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[e.jsx("p",{children:t("tasks.notInstalled.description")}),e.jsx("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:e.jsx("code",{children:t("tasks.notInstalled.installCommand")})}),e.jsx("div",{children:e.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium text-sm",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),t("tasks.notInstalled.viewOnGitHub"),e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"font-medium",children:t("tasks.notInstalled.afterInstallation")}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[e.jsx("li",{children:t("tasks.notInstalled.steps.restart")}),e.jsx("li",{children:t("tasks.notInstalled.steps.autoAvailable")}),e.jsx("li",{children:t("tasks.notInstalled.steps.initCommand")})]})]})]})]})]})}),a&&e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:t("tasks.settings.enableLabel")}),e.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:t("tasks.settings.enableDescription")})]}),e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:r,onChange:o=>s(o.target.checked),className:"sr-only peer"}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"})]})]})})})]})})}const id={claude:{name:"Claude",color:"blue"},cursor:{name:"Cursor",color:"purple"},codex:{name:"Codex",color:"gray"}},ld={blue:{border:"border-l-blue-500 md:border-l-blue-500",borderBottom:"border-b-blue-500",bg:"bg-blue-50 dark:bg-blue-900/20",dot:"bg-blue-500"},purple:{border:"border-l-purple-500 md:border-l-purple-500",borderBottom:"border-b-purple-500",bg:"bg-purple-50 dark:bg-purple-900/20",dot:"bg-purple-500"},gray:{border:"border-l-gray-700 dark:border-l-gray-300",borderBottom:"border-b-gray-700 dark:border-b-gray-300",bg:"bg-gray-100 dark:bg-gray-800/50",dot:"bg-gray-700 dark:bg-gray-300"}};function wr({agentId:t,authStatus:r,isSelected:s,onClick:a,isMobile:n=!1}){const{t:o}=Ge("settings"),i=id[t],l=ld[i.color];return n?e.jsx("button",{onClick:a,className:`flex-1 text-center py-3 px-2 border-b-2 transition-colors ${s?`${l.borderBottom} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx(At,{provider:t,className:"w-5 h-5"}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:i.name}),(r==null?void 0:r.authenticated)&&e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`})]})}):e.jsxs("button",{onClick:a,className:`w-full text-left p-3 border-l-4 transition-colors ${s?`${l.border} ${l.bg}`:"border-transparent hover:bg-gray-50 dark:hover:bg-gray-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(At,{provider:t,className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:i.name})]}),e.jsx("div",{className:"text-xs text-muted-foreground pl-6",children:r!=null&&r.loading?e.jsx("span",{className:"text-gray-400",children:o("agents.authStatus.checking")}):r!=null&&r.authenticated?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${l.dot}`}),e.jsx("span",{className:"truncate max-w-[120px]",title:r.email,children:r.email||o("agents.authStatus.connected")})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400"}),e.jsx("span",{children:o("agents.authStatus.notConnected")})]})})]})}const cd={claude:{name:"Claude",description:"Anthropic Claude AI assistant",bgClass:"bg-blue-50 dark:bg-blue-900/20",borderClass:"border-blue-200 dark:border-blue-800",textClass:"text-blue-900 dark:text-blue-100",subtextClass:"text-blue-700 dark:text-blue-300",buttonClass:"bg-blue-600 hover:bg-blue-700"},cursor:{name:"Cursor",description:"Cursor AI-powered code editor",bgClass:"bg-purple-50 dark:bg-purple-900/20",borderClass:"border-purple-200 dark:border-purple-800",textClass:"text-purple-900 dark:text-purple-100",subtextClass:"text-purple-700 dark:text-purple-300",buttonClass:"bg-purple-600 hover:bg-purple-700"},codex:{name:"Codex",description:"OpenAI Codex AI assistant",bgClass:"bg-gray-100 dark:bg-gray-800/50",borderClass:"border-gray-300 dark:border-gray-600",textClass:"text-gray-900 dark:text-gray-100",subtextClass:"text-gray-700 dark:text-gray-300",buttonClass:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600"}};function dd({agent:t,authStatus:r,onLogin:s}){const{t:a}=Ge("settings"),n=cd[t];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(At,{provider:t,className:"w-6 h-6"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a(`agents.account.${t}.description`)})]})]}),e.jsx("div",{className:`${n.bgClass} border ${n.borderClass} rounded-lg p-4`,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:`font-medium ${n.textClass}`,children:a("agents.connectionStatus")}),e.jsx("div",{className:`text-sm ${n.subtextClass}`,children:r!=null&&r.loading?a("agents.authStatus.checkingAuth"):r!=null&&r.authenticated?a("agents.authStatus.loggedInAs",{email:r.email||a("agents.authStatus.authenticatedUser")}):a("agents.authStatus.notConnected")})]}),e.jsx("div",{children:r!=null&&r.loading?e.jsx(Dt,{variant:"secondary",className:"bg-gray-100 dark:bg-gray-800",children:a("agents.authStatus.checking")}):r!=null&&r.authenticated?e.jsx(Dt,{variant:"success",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",children:a("agents.authStatus.connected")}):e.jsx(Dt,{variant:"secondary",className:"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300",children:a("agents.authStatus.disconnected")})})]}),e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:`font-medium ${n.textClass}`,children:r!=null&&r.authenticated?a("agents.login.reAuthenticate"):a("agents.login.title")}),e.jsx("div",{className:`text-sm ${n.subtextClass}`,children:r!=null&&r.authenticated?a("agents.login.reAuthDescription"):a("agents.login.description",{agent:n.name})})]}),e.jsxs(xe,{onClick:s,className:`${n.buttonClass} text-white`,size:"sm",children:[e.jsx(Fi,{className:"w-4 h-4 mr-2"}),r!=null&&r.authenticated?a("agents.login.reLoginButton"):a("agents.login.button")]})]})}),(r==null?void 0:r.error)&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 pt-4",children:e.jsx("div",{className:"text-sm text-red-600 dark:text-red-400",children:a("agents.error",{error:r.error})})})]})})]})}const md=["Bash(git log:*)","Bash(git diff:*)","Bash(git status:*)","Write","Read","Edit","Glob","Grep","MultiEdit","Task","TodoWrite","TodoRead","WebFetch","WebSearch"],ud=["Shell(ls)","Shell(mkdir)","Shell(cd)","Shell(cat)","Shell(echo)","Shell(git status)","Shell(git diff)","Shell(git log)","Shell(npm install)","Shell(npm run)","Shell(python)","Shell(node)"];function pd({skipPermissions:t,setSkipPermissions:r,allowedTools:s,setAllowedTools:a,disallowedTools:n,setDisallowedTools:o,newAllowedTool:i,setNewAllowedTool:l,newDisallowedTool:m,setNewDisallowedTool:d}){const{t:u}=Ge("settings"),g=h=>{h&&!s.includes(h)&&(a([...s,h]),l(""))},p=h=>{a(s.filter(b=>b!==h))},x=h=>{h&&!n.includes(h)&&(o([...n,h]),d(""))},f=h=>{o(n.filter(b=>b!==h))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:h=>r(h.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.claudeDescription")})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedTools.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedTools.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:i,onChange:h=>l(h.target.value),placeholder:u("permissions.allowedTools.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),g(i))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>g(i),disabled:!i,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedTools.quickAdd")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:md.map(h=>e.jsx(xe,{variant:"outline",size:"sm",onClick:()=>g(h),disabled:s.includes(h),className:"text-xs h-8",children:h},h))})]}),e.jsxs("div",{className:"space-y-2",children:[s.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>p(h),className:"text-green-600 hover:text-green-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedTools.empty")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedTools.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedTools.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:m,onChange:h=>d(h.target.value),placeholder:u("permissions.blockedTools.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),x(m))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>x(m),disabled:!m,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[n.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>f(h),className:"text-red-600 hover:text-red-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),n.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedTools.empty")})]})]}),e.jsxs("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:u("permissions.toolExamples.title")}),e.jsxs("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git log:*)"'})," ",u("permissions.toolExamples.bashGitLog")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(git diff:*)"'})," ",u("permissions.toolExamples.bashGitDiff")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Write"'})," ",u("permissions.toolExamples.write")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:'"Bash(rm:*)"'})," ",u("permissions.toolExamples.bashRm")]})]})]})]})}function xd({skipPermissions:t,setSkipPermissions:r,allowedCommands:s,setAllowedCommands:a,disallowedCommands:n,setDisallowedCommands:o,newAllowedCommand:i,setNewAllowedCommand:l,newDisallowedCommand:m,setNewDisallowedCommand:d}){const{t:u}=Ge("settings"),g=h=>{h&&!s.includes(h)&&(a([...s,h]),l(""))},p=h=>{a(s.filter(b=>b!==h))},x=h=>{h&&!n.includes(h)&&(o([...n,h]),d(""))},f=h=>{o(n.filter(b=>b!==h))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-orange-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.title")})]}),e.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:e.jsxs("label",{className:"flex items-center gap-3",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:h=>r(h.target.checked),className:"w-4 h-4 text-purple-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-purple-500 focus:ring-2"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:u("permissions.skipPermissions.label")}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:u("permissions.skipPermissions.cursorDescription")})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.allowedCommands.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.allowedCommands.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:i,onChange:h=>l(h.target.value),placeholder:u("permissions.allowedCommands.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),g(i))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>g(i),disabled:!i,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:u("permissions.allowedCommands.quickAdd")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ud.map(h=>e.jsx(xe,{variant:"outline",size:"sm",onClick:()=>g(h),disabled:s.includes(h),className:"text-xs h-8",children:h},h))})]}),e.jsxs("div",{className:"space-y-2",children:[s.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>p(h),className:"text-green-600 hover:text-green-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),s.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.allowedCommands.empty")})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(qt,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:u("permissions.blockedCommands.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:u("permissions.blockedCommands.description")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx(st,{value:m,onChange:h=>d(h.target.value),placeholder:u("permissions.blockedCommands.placeholder"),onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),x(m))},className:"flex-1 h-10"}),e.jsxs(xe,{onClick:()=>x(m),disabled:!m,size:"sm",className:"h-10 px-4",children:[e.jsx(lt,{className:"w-4 h-4 mr-2 sm:mr-0"}),e.jsx("span",{className:"sm:hidden",children:u("permissions.actions.add")})]})]}),e.jsxs("div",{className:"space-y-2",children:[n.map(h=>e.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[e.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:h}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>f(h),className:"text-red-600 hover:text-red-700",children:e.jsx(qe,{className:"w-4 h-4"})})]},h)),n.length===0&&e.jsx("div",{className:"text-center py-6 text-gray-500 dark:text-gray-400",children:u("permissions.blockedCommands.empty")})]})]}),e.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:u("permissions.shellExamples.title")}),e.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," ",u("permissions.shellExamples.ls")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," ",u("permissions.shellExamples.gitStatus")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(npm install)"'})," ",u("permissions.shellExamples.npmInstall")]}),e.jsxs("li",{children:[e.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(rm -rf)"'})," ",u("permissions.shellExamples.rmRf")]})]})]})]})}function gd({permissionMode:t,setPermissionMode:r}){const{t:s}=Ge("settings");return e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Pt,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:s("permissions.codex.permissionMode")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("permissions.codex.description")}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="default"?"bg-gray-100 dark:bg-gray-800 border-gray-400 dark:border-gray-500":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("default"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="default",onChange:()=>r("default"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:s("permissions.codex.modes.default.title")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s("permissions.codex.modes.default.description")})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="acceptEdits"?"bg-green-50 dark:bg-green-900/20 border-green-400 dark:border-green-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("acceptEdits"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="acceptEdits",onChange:()=>r("acceptEdits"),className:"mt-1 w-4 h-4 text-green-600"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-green-900 dark:text-green-100",children:s("permissions.codex.modes.acceptEdits.title")}),e.jsx("div",{className:"text-sm text-green-700 dark:text-green-300",children:s("permissions.codex.modes.acceptEdits.description")})]})]})}),e.jsx("div",{className:`border rounded-lg p-4 cursor-pointer transition-all ${t==="bypassPermissions"?"bg-orange-50 dark:bg-orange-900/20 border-orange-400 dark:border-orange-600":"bg-gray-50 dark:bg-gray-900/50 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"}`,onClick:()=>r("bypassPermissions"),children:e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"codexPermissionMode",checked:t==="bypassPermissions",onChange:()=>r("bypassPermissions"),className:"mt-1 w-4 h-4 text-orange-600"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-orange-900 dark:text-orange-100 flex items-center gap-2",children:[s("permissions.codex.modes.bypassPermissions.title"),e.jsx(qt,{className:"w-4 h-4"})]}),e.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:s("permissions.codex.modes.bypassPermissions.description")})]})]})}),e.jsxs("details",{className:"text-sm",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:s("permissions.codex.technicalDetails")}),e.jsxs("div",{className:"mt-2 p-3 bg-gray-50 dark:bg-gray-900/50 rounded-lg text-xs text-muted-foreground space-y-2",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.default.title"),":"]})," ",s("permissions.codex.technicalInfo.default")]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.acceptEdits.title"),":"]})," ",s("permissions.codex.technicalInfo.acceptEdits")]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[s("permissions.codex.modes.bypassPermissions.title"),":"]})," ",s("permissions.codex.technicalInfo.bypassPermissions")]}),e.jsx("p",{className:"text-xs opacity-75",children:s("permissions.codex.technicalInfo.overrideNote")})]})]})]})})}function Ys({agent:t,...r}){return t==="claude"?e.jsx(pd,{...r}):t==="cursor"?e.jsx(xd,{...r}):t==="codex"?e.jsx(gd,{...r}):null}const hd=t=>{switch(t){case"stdio":return e.jsx(ct,{className:"w-4 h-4"});case"sse":return e.jsx(cr,{className:"w-4 h-4"});case"http":return e.jsx(Vr,{className:"w-4 h-4"});default:return e.jsx(Ms,{className:"w-4 h-4"})}};function fd({servers:t,onAdd:r,onEdit:s,onDelete:a,onTest:n,onDiscoverTools:o,testResults:i,serverTools:l,toolsLoading:m}){const{t:d}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:d("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d("mcpServers.description.claude")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),d("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(u=>{var g,p,x,f;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[hd(u.type),e.jsx("span",{className:"font-medium text-foreground",children:u.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:u.type}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:u.scope==="local"?d("mcpServers.scope.local"):u.scope==="user"?d("mcpServers.scope.user"):u.scope})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[u.type==="stdio"&&((g=u.config)==null?void 0:g.command)&&e.jsxs("div",{children:[d("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.command})]}),(u.type==="sse"||u.type==="http")&&((p=u.config)==null?void 0:p.url)&&e.jsxs("div",{children:[d("mcpServers.config.url"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.url})]}),((x=u.config)==null?void 0:x.args)&&u.config.args.length>0&&e.jsxs("div",{children:[d("mcpServers.config.args"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:u.config.args.join(" ")})]})]}),(i==null?void 0:i[u.id])&&e.jsx("div",{className:`mt-2 p-2 rounded text-xs ${i[u.id].success?"bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200":"bg-red-50 dark:bg-red-900/20 text-red-800 dark:text-red-200"}`,children:e.jsx("div",{className:"font-medium",children:i[u.id].message})}),(l==null?void 0:l[u.id])&&((f=l[u.id].tools)==null?void 0:f.length)>0&&e.jsxs("div",{className:"mt-2 p-2 rounded text-xs bg-blue-50 dark:bg-blue-900/20 text-blue-800 dark:text-blue-200",children:[e.jsxs("div",{className:"font-medium",children:[d("mcpServers.tools.title")," ",d("mcpServers.tools.count",{count:l[u.id].tools.length})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-1",children:[l[u.id].tools.slice(0,5).map((h,b)=>e.jsx("code",{className:"bg-blue-100 dark:bg-blue-800 px-1 rounded",children:h.name},b)),l[u.id].tools.length>5&&e.jsx("span",{className:"text-xs opacity-75",children:d("mcpServers.tools.more",{count:l[u.id].tools.length-5})})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(u),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:d("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(u.id,u.scope),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:d("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},u.id)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:d("mcpServers.empty")})]})]})}function bd({servers:t,onAdd:r,onEdit:s,onDelete:a}){const{t:n}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-purple-500"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("mcpServers.description.cursor")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),n("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(o=>{var i;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ct,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:o.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:"stdio"})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:((i=o.config)==null?void 0:i.command)&&e.jsxs("div",{children:[n("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.command})]})})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(o),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:n("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(o.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:n("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},o.name||o.id)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("mcpServers.empty")})]})]})}function yd({servers:t,onAdd:r,onEdit:s,onDelete:a}){const{t:n}=Ge("settings");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ms,{className:"w-5 h-5 text-gray-700 dark:text-gray-300"}),e.jsx("h3",{className:"text-lg font-medium text-foreground",children:n("mcpServers.title")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n("mcpServers.description.codex")}),e.jsx("div",{className:"flex justify-between items-center",children:e.jsxs(xe,{onClick:r,className:"bg-gray-800 hover:bg-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 text-white",size:"sm",children:[e.jsx(lt,{className:"w-4 h-4 mr-2"}),n("mcpServers.addButton")]})}),e.jsxs("div",{className:"space-y-2",children:[t.map(o=>{var i,l,m;return e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(ct,{className:"w-4 h-4"}),e.jsx("span",{className:"font-medium text-foreground",children:o.name}),e.jsx(Dt,{variant:"outline",className:"text-xs",children:"stdio"})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[((i=o.config)==null?void 0:i.command)&&e.jsxs("div",{children:[n("mcpServers.config.command"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.command})]}),((l=o.config)==null?void 0:l.args)&&o.config.args.length>0&&e.jsxs("div",{children:[n("mcpServers.config.args"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:o.config.args.join(" ")})]}),((m=o.config)==null?void 0:m.env)&&Object.keys(o.config.env).length>0&&e.jsxs("div",{children:[n("mcpServers.config.environment"),": ",e.jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1 rounded text-xs",children:Object.entries(o.config.env).map(([d,u])=>`${d}=${u}`).join(", ")})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 ml-4",children:[e.jsx(xe,{onClick:()=>s(o),variant:"ghost",size:"sm",className:"text-gray-600 hover:text-gray-700",title:n("mcpServers.actions.edit"),children:e.jsx(Kr,{className:"w-4 h-4"})}),e.jsx(xe,{onClick:()=>a(o.name),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-700",title:n("mcpServers.actions.delete"),children:e.jsx(ht,{className:"w-4 h-4"})})]})]})},o.name)}),t.length===0&&e.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:n("mcpServers.empty")})]}),e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-800/50 border border-gray-300 dark:border-gray-600 rounded-lg p-4",children:[e.jsx("h4",{className:"font-medium text-gray-900 dark:text-gray-100 mb-2",children:n("mcpServers.help.title")}),e.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:n("mcpServers.help.description")})]})]})}function Qs({agent:t,...r}){return t==="claude"?e.jsx(fd,{...r}):t==="cursor"?e.jsx(bd,{...r}):t==="codex"?e.jsx(yd,{...r}):null}function Go({compact:t=!1}){const{i18n:r,t:s}=Ge("settings"),a=n=>{const o=n.target.value;r.changeLanguage(o)};return t?e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[e.jsx(po,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),s("account.language")]}),e.jsx("select",{value:r.language,onChange:a,className:"w-[100px] text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400",children:Ka.map(n=>e.jsx("option",{value:n.value,children:n.nativeName},n.value))})]}):e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-gray-900 dark:text-gray-100 mb-1",children:s("account.languageLabel")}),e.jsx("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:s("account.languageDescription")})]}),e.jsx("select",{value:r.language,onChange:a,className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-36",children:Ka.map(n=>e.jsx("option",{value:n.value,children:n.nativeName},n.value))})]})})}function vd({isOpen:t,onClose:r,projects:s=[],initialTab:a="agents"}){var Gs,ts,Ga,qa;const{isDarkMode:n,toggleDarkMode:o}=Ia(),{t:i}=Ge("settings"),{addToast:l}=mr(),[m,d]=c.useState([]),[u,g]=c.useState([]),[p,x]=c.useState(""),[f,h]=c.useState(""),[b,C]=c.useState(!1),[I,y]=c.useState(!1),[v,A]=c.useState(null),[M,$]=c.useState("name"),[k,T]=c.useState([]),[W,U]=c.useState(!1),[S,H]=c.useState(null),[w,P]=c.useState({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),[j,F]=c.useState(!1),[G,X]=c.useState({}),[D,oe]=c.useState({}),[E,se]=c.useState({}),[J,B]=c.useState(a),[K,V]=c.useState(""),[z,O]=c.useState("claude"),[ne,me]=c.useState("account"),[q,N]=c.useState(()=>localStorage.getItem("codeEditorTheme")||"dark"),[_,re]=c.useState(()=>localStorage.getItem("codeEditorWordWrap")==="true"),[te,ve]=c.useState(()=>localStorage.getItem("codeEditorShowMinimap")!=="false"),[je,Ne]=c.useState(()=>localStorage.getItem("codeEditorLineNumbers")!=="false"),[we,Ie]=c.useState(()=>localStorage.getItem("codeEditorFontSize")||"14"),[Re,Z]=c.useState([]),[ye,Y]=c.useState([]),[ie,De]=c.useState(!1),[de,$e]=c.useState(""),[Le,Je]=c.useState(""),[Ve,ge]=c.useState([]),[Fe,Ce]=c.useState([]),[ze,Pe]=c.useState("default"),[_e,Ke]=c.useState(!1),[ae,ke]=c.useState({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),[Be,Ue]=c.useState(null),[mt,It]=c.useState(!1),[pt,kt]=c.useState(!1),[le,pe]=c.useState(""),[ue,Se]=c.useState(null),[We,Xe]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),[Ze,dt]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),[Mt,bt]=c.useState({authenticated:!1,email:null,loading:!0,error:null}),wt=async()=>{try{const L=await Ee("/api/cursor/mcp");if(L.ok){const Q=await L.json();ge(Q.servers||[])}else console.error("Failed to fetch Cursor MCP servers")}catch(L){console.error("Error fetching Cursor MCP servers:",L)}},nt=async()=>{try{const L=await Ee("/api/codex/mcp/config/read");if(L.ok){const ce=await L.json();if(ce.success&&ce.servers){Ce(ce.servers);return}}const Q=await Ee("/api/codex/mcp/cli/list");if(Q.ok){const ce=await Q.json();if(ce.success&&ce.servers){const Te=ce.servers.map(tt=>({id:tt.name,name:tt.name,type:tt.type||"stdio",scope:"user",config:{command:tt.command||"",args:tt.args||[],env:tt.env||{}}}));Ce(Te)}}}catch(L){console.error("Error fetching Codex MCP servers:",L)}},at=async()=>{try{const L=await Ee("/api/mcp/config/read");if(L.ok){const Te=await L.json();if(Te.success&&Te.servers){T(Te.servers);return}}const Q=await Ee("/api/mcp/cli/list");if(Q.ok){const Te=await Q.json();if(Te.success&&Te.servers){const tt=Te.servers.map(ut=>({id:ut.name,name:ut.name,type:ut.type,scope:"user",config:{command:ut.command||"",args:ut.args||[],env:ut.env||{},url:ut.url||"",headers:ut.headers||{},timeout:3e4},created:new Date().toISOString(),updated:new Date().toISOString()}));T(tt);return}}const ce=await Ee("/api/mcp/servers?scope=user");if(ce.ok){const Te=await ce.json();T(Te.servers||[])}else console.error("Failed to fetch MCP servers")}catch(L){console.error("Error fetching MCP servers:",L)}},Rt=async L=>{var Q,ce,Te,tt,ut;try{S&&await Bt(S.id,"user");const br=await Ee("/api/mcp/cli/add",{method:"POST",body:JSON.stringify({name:L.name,type:L.type,scope:L.scope,projectPath:L.projectPath,command:(Q=L.config)==null?void 0:Q.command,args:((ce=L.config)==null?void 0:ce.args)||[],url:(Te=L.config)==null?void 0:Te.url,headers:((tt=L.config)==null?void 0:tt.headers)||{},env:((ut=L.config)==null?void 0:ut.env)||{}})});if(br.ok){const rs=await br.json();if(rs.success)return await at(),!0;throw new Error(rs.error||"Failed to save server via Claude CLI")}else{const rs=await br.json();throw new Error(rs.error||"Failed to save server")}}catch(br){throw console.error("Error saving MCP server:",br),br}},Bt=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/cli/remove/${L}?scope=${Q}`,{method:"DELETE"});if(ce.ok){const Te=await ce.json();if(Te.success)return await at(),!0;throw new Error(Te.error||"Failed to delete server via Claude CLI")}else{const Te=await ce.json();throw new Error(Te.error||"Failed to delete server")}}catch(ce){throw console.error("Error deleting MCP server:",ce),ce}},gr=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/servers/${L}/test?scope=${Q}`,{method:"POST"});if(ce.ok)return(await ce.json()).testResult;{const Te=await ce.json();throw new Error(Te.error||"Failed to test server")}}catch(ce){throw console.error("Error testing MCP server:",ce),ce}},hr=async(L,Q="user")=>{try{const ce=await Ee(`/api/mcp/servers/${L}/tools?scope=${Q}`,{method:"POST"});if(ce.ok)return(await ce.json()).toolsResult;{const Te=await ce.json();throw new Error(Te.error||"Failed to discover tools")}}catch(ce){throw console.error("Error discovering MCP tools:",ce),ce}},R=async L=>{var Q,ce,Te;try{Be&&await ee(Be.id);const tt=await Ee("/api/codex/mcp/cli/add",{method:"POST",body:JSON.stringify({name:L.name,command:(Q=L.config)==null?void 0:Q.command,args:((ce=L.config)==null?void 0:ce.args)||[],env:((Te=L.config)==null?void 0:Te.env)||{}})});if(tt.ok){const ut=await tt.json();if(ut.success)return await nt(),!0;throw new Error(ut.error||"Failed to save Codex MCP server")}else{const ut=await tt.json();throw new Error(ut.error||"Failed to save server")}}catch(tt){throw console.error("Error saving Codex MCP server:",tt),tt}},ee=async L=>{try{const Q=await Ee(`/api/codex/mcp/cli/remove/${L}`,{method:"DELETE"});if(Q.ok){const ce=await Q.json();if(ce.success)return await nt(),!0;throw new Error(ce.error||"Failed to delete Codex MCP server")}else{const ce=await Q.json();throw new Error(ce.error||"Failed to delete server")}}catch(Q){throw console.error("Error deleting Codex MCP server:",Q),Q}},Ae=()=>{ke({name:"",type:"stdio",config:{command:"",args:[],env:{}}}),Ue(null),Ke(!1)},et=(L=null)=>{var Q,ce,Te;L?(Ue(L),ke({name:L.name,type:L.type||"stdio",config:{command:((Q=L.config)==null?void 0:Q.command)||"",args:((ce=L.config)==null?void 0:ce.args)||[],env:((Te=L.config)==null?void 0:Te.env)||{}}})):Ae(),Ke(!0)},jt=async L=>{L.preventDefault(),It(!0);try{Be&&await ee(Be.name),await R(ae),Ae(),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}finally{It(!1)}},xt=async L=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await ee(L),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}};c.useEffect(()=>{t&&(_s(),Xr(),Zr(),es(),B(a))},[t,a]),c.useEffect(()=>{localStorage.setItem("codeEditorTheme",q),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[q]),c.useEffect(()=>{localStorage.setItem("codeEditorWordWrap",_.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[_]),c.useEffect(()=>{localStorage.setItem("codeEditorShowMinimap",te.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[te]),c.useEffect(()=>{localStorage.setItem("codeEditorLineNumbers",je.toString()),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[je]),c.useEffect(()=>{localStorage.setItem("codeEditorFontSize",we),window.dispatchEvent(new Event("codeEditorSettingsChanged"))},[we]);const _s=async()=>{try{const L=localStorage.getItem("claude-settings");if(L){const Te=JSON.parse(L);d(Te.allowedTools||[]),g(Te.disallowedTools||[]),C(Te.skipPermissions||!1),$(Te.projectSortOrder||"name")}else d([]),g([]),C(!1),$("name");const Q=localStorage.getItem("cursor-tools-settings");if(Q){const Te=JSON.parse(Q);Z(Te.allowedCommands||[]),Y(Te.disallowedCommands||[]),De(Te.skipPermissions||!1)}else Z([]),Y([]),De(!1);const ce=localStorage.getItem("codex-settings");if(ce){const Te=JSON.parse(ce);Pe(Te.permissionMode||"default")}else Pe("default");await at(),await wt(),await nt()}catch(L){console.error("Error loading tool settings:",L),d([]),g([]),C(!1),$("name")}},Xr=async()=>{try{const L=await Ee("/api/cli/claude/status");if(L.ok){const Q=await L.json();Xe({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else Xe({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Claude auth status:",L),Xe({authenticated:!1,email:null,loading:!1,error:L.message})}},Zr=async()=>{try{const L=await Ee("/api/cli/cursor/status");if(L.ok){const Q=await L.json();dt({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else dt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Cursor auth status:",L),dt({authenticated:!1,email:null,loading:!1,error:L.message})}},es=async()=>{try{const L=await Ee("/api/cli/codex/status");if(L.ok){const Q=await L.json();bt({authenticated:Q.authenticated,email:Q.email,loading:!1,error:Q.error||null})}else bt({authenticated:!1,email:null,loading:!1,error:"Failed to check authentication status"})}catch(L){console.error("Error checking Codex auth status:",L),bt({authenticated:!1,email:null,loading:!1,error:L.message})}},zs=()=>{pe("claude"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},Os=()=>{pe("cursor"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},Rs=()=>{pe("codex"),Se((s==null?void 0:s[0])||{name:"default",fullPath:process.cwd()}),kt(!0)},fr=L=>{L===0&&(A("success"),le==="claude"?Xr():le==="cursor"?Zr():le==="codex"&&es())},Bs=()=>{y(!0),A(null);try{const L={allowedTools:m,disallowedTools:u,skipPermissions:b,projectSortOrder:M,lastUpdated:new Date().toISOString()},Q={allowedCommands:Re,disallowedCommands:ye,skipPermissions:ie,lastUpdated:new Date().toISOString()},ce={permissionMode:ze,lastUpdated:new Date().toISOString()};localStorage.setItem("claude-settings",JSON.stringify(L)),localStorage.setItem("cursor-tools-settings",JSON.stringify(Q)),localStorage.setItem("codex-settings",JSON.stringify(ce)),A("success"),setTimeout(()=>{r()},1e3)}catch(L){console.error("Error saving tool settings:",L),A("error")}finally{y(!1)}},ar=()=>{P({name:"",type:"stdio",scope:"user",projectPath:"",config:{command:"",args:[],env:{},url:"",headers:{},timeout:3e4},jsonInput:"",importMode:"form"}),H(null),U(!1),V("")},Mr=(L=null)=>{L?(H(L),P({name:L.name,type:L.type,scope:L.scope,projectPath:L.projectPath||"",config:{...L.config},raw:L.raw,importMode:"form",jsonInput:""})):ar(),U(!0)},Ws=async L=>{L.preventDefault(),F(!0);try{if(w.importMode==="json"){const Q=await Ee("/api/mcp/cli/add-json",{method:"POST",body:JSON.stringify({name:w.name,jsonConfig:w.jsonInput,scope:w.scope,projectPath:w.projectPath})});if(Q.ok){const ce=await Q.json();if(ce.success)await at(),ar(),A("success");else throw new Error(ce.error||"Failed to add server via JSON")}else{const ce=await Q.json();throw new Error(ce.error||"Failed to add server")}}else await Rt(w),ar(),A("success")}catch(Q){l(`Error: ${Q.message}`,"error"),A("error")}finally{F(!1)}},Us=async(L,Q)=>{if(confirm("Are you sure you want to delete this MCP server?"))try{await Bt(L,Q),A("success")}catch(ce){l(`Error: ${ce.message}`,"error"),A("error")}},Hs=async(L,Q)=>{try{X({...G,[L]:{loading:!0}});const ce=await gr(L,Q);X({...G,[L]:ce})}catch(ce){X({...G,[L]:{success:!1,message:ce.message,details:[]}})}},Nt=async(L,Q)=>{try{se({...E,[L]:!0});const ce=await hr(L,Q);oe({...D,[L]:ce})}catch{oe({...D,[L]:{success:!1,tools:[],resources:[],prompts:[]}})}finally{se({...E,[L]:!1})}},Et=(L,Q)=>{P(ce=>({...ce,config:{...ce.config,[L]:Q}}))};return t?e.jsxs("div",{className:"modal-backdrop fixed inset-0 flex items-center justify-center z-[9999] md:p-4 bg-background/95",children:[e.jsxs("div",{className:"bg-background border border-border md:rounded-lg shadow-xl w-full md:max-w-4xl h-full md:h-[90vh] flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 md:p-6 border-b border-border flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Qe,{className:"w-5 h-5 md:w-6 md:h-6 text-blue-600"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold text-foreground",children:i("title")})]}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground touch-manipulation",children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[e.jsx("div",{className:"border-b border-border",children:e.jsxs("div",{className:"flex px-4 md:px-6",children:[e.jsx("button",{onClick:()=>B("agents"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="agents"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.agents")}),e.jsx("button",{onClick:()=>B("appearance"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="appearance"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.appearance")}),e.jsxs("button",{onClick:()=>B("git"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="git"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Gt,{className:"w-4 h-4 inline mr-2"}),i("mainTabs.git")]}),e.jsxs("button",{onClick:()=>B("api"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="api"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Aa,{className:"w-4 h-4 inline mr-2"}),i("mainTabs.apiTokens")]}),e.jsx("button",{onClick:()=>B("tasks"),className:`px-4 py-3 text-sm font-medium border-b-2 transition-colors ${J==="tasks"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("mainTabs.tasks")})]})}),e.jsxs("div",{className:"p-4 md:p-6 space-y-6 md:space-y-8 pb-safe-area-inset-bottom",children:[J==="appearance"&&e.jsx("div",{className:"space-y-6 md:space-y-8",children:J==="appearance"&&e.jsxs("div",{className:"space-y-6 md:space-y-8",children:[e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.darkMode.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.darkMode.description")})]}),e.jsxs("button",{onClick:o,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":n,"aria-label":"Toggle dark mode",children:[e.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),e.jsx("span",{className:`${n?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:n?e.jsx(oa,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(ia,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})})}),e.jsx("div",{className:"space-y-4",children:e.jsx(Go,{})}),e.jsx("div",{className:"space-y-4",children:e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.projectSorting.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.projectSorting.description")})]}),e.jsxs("select",{value:M,onChange:L=>$(L.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-32",children:[e.jsx("option",{value:"name",children:i("appearanceSettings.projectSorting.alphabetical")}),e.jsx("option",{value:"date",children:i("appearanceSettings.projectSorting.recentActivity")})]})]})})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:i("appearanceSettings.codeEditor.title")}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.theme.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.theme.description")})]}),e.jsxs("button",{onClick:()=>N(q==="dark"?"light":"dark"),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":q==="dark","aria-label":"Toggle editor theme",children:[e.jsx("span",{className:"sr-only",children:"Toggle editor theme"}),e.jsx("span",{className:`${q==="dark"?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:q==="dark"?e.jsx(oa,{className:"w-3.5 h-3.5 text-gray-700"}):e.jsx(ia,{className:"w-3.5 h-3.5 text-yellow-500"})})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.wordWrap.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.wordWrap.description")})]}),e.jsxs("button",{onClick:()=>re(!_),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":_,"aria-label":"Toggle word wrap",children:[e.jsx("span",{className:"sr-only",children:"Toggle word wrap"}),e.jsx("span",{className:`${_?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.showMinimap.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.showMinimap.description")})]}),e.jsxs("button",{onClick:()=>ve(!te),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":te,"aria-label":"Toggle minimap",children:[e.jsx("span",{className:"sr-only",children:"Toggle minimap"}),e.jsx("span",{className:`${te?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.lineNumbers.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.lineNumbers.description")})]}),e.jsxs("button",{onClick:()=>Ne(!je),className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":je,"aria-label":"Toggle line numbers",children:[e.jsx("span",{className:"sr-only",children:"Toggle line numbers"}),e.jsx("span",{className:`${je?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200`})]})]})}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-foreground",children:i("appearanceSettings.codeEditor.fontSize.label")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:i("appearanceSettings.codeEditor.fontSize.description")})]}),e.jsxs("select",{value:we,onChange:L=>Ie(L.target.value),className:"text-sm bg-gray-50 dark:bg-gray-800 border border-gray-300 dark:border-gray-600 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 p-2 w-24",children:[e.jsx("option",{value:"10",children:"10px"}),e.jsx("option",{value:"11",children:"11px"}),e.jsx("option",{value:"12",children:"12px"}),e.jsx("option",{value:"13",children:"13px"}),e.jsx("option",{value:"14",children:"14px"}),e.jsx("option",{value:"15",children:"15px"}),e.jsx("option",{value:"16",children:"16px"}),e.jsx("option",{value:"18",children:"18px"}),e.jsx("option",{value:"20",children:"20px"})]})]})})]})]})}),J==="git"&&e.jsx(nd,{}),J==="agents"&&e.jsxs("div",{className:"flex flex-col md:flex-row h-full min-h-[400px] md:min-h-[500px]",children:[e.jsx("div",{className:"md:hidden border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex",children:[e.jsx(wr,{agentId:"claude",authStatus:We,isSelected:z==="claude",onClick:()=>O("claude"),isMobile:!0}),e.jsx(wr,{agentId:"cursor",authStatus:Ze,isSelected:z==="cursor",onClick:()=>O("cursor"),isMobile:!0}),e.jsx(wr,{agentId:"codex",authStatus:Mt,isSelected:z==="codex",onClick:()=>O("codex"),isMobile:!0})]})}),e.jsx("div",{className:"hidden md:block w-48 border-r border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"p-2",children:[e.jsx(wr,{agentId:"claude",authStatus:We,isSelected:z==="claude",onClick:()=>O("claude")}),e.jsx(wr,{agentId:"cursor",authStatus:Ze,isSelected:z==="cursor",onClick:()=>O("cursor")}),e.jsx(wr,{agentId:"codex",authStatus:Mt,isSelected:z==="codex",onClick:()=>O("codex")})]})}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsx("div",{className:"border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:e.jsxs("div",{className:"flex px-2 md:px-4 overflow-x-auto",children:[e.jsx("button",{onClick:()=>me("account"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="account"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.account")}),e.jsx("button",{onClick:()=>me("permissions"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="permissions"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.permissions")}),e.jsx("button",{onClick:()=>me("mcp"),className:`px-3 md:px-4 py-2 md:py-3 text-xs md:text-sm font-medium border-b-2 transition-colors whitespace-nowrap ${ne==="mcp"?"border-blue-600 text-blue-600 dark:text-blue-400":"border-transparent text-muted-foreground hover:text-foreground"}`,children:i("tabs.mcpServers")})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3 md:p-4",children:[ne==="account"&&e.jsx(dd,{agent:z,authStatus:z==="claude"?We:z==="cursor"?Ze:Mt,onLogin:z==="claude"?zs:z==="cursor"?Os:Rs}),ne==="permissions"&&z==="claude"&&e.jsx(Ys,{agent:"claude",skipPermissions:b,setSkipPermissions:C,allowedTools:m,setAllowedTools:d,disallowedTools:u,setDisallowedTools:g,newAllowedTool:p,setNewAllowedTool:x,newDisallowedTool:f,setNewDisallowedTool:h}),ne==="permissions"&&z==="cursor"&&e.jsx(Ys,{agent:"cursor",skipPermissions:ie,setSkipPermissions:De,allowedCommands:Re,setAllowedCommands:Z,disallowedCommands:ye,setDisallowedCommands:Y,newAllowedCommand:de,setNewAllowedCommand:$e,newDisallowedCommand:Le,setNewDisallowedCommand:Je}),ne==="permissions"&&z==="codex"&&e.jsx(Ys,{agent:"codex",permissionMode:ze,setPermissionMode:Pe}),ne==="mcp"&&z==="claude"&&e.jsx(Qs,{agent:"claude",servers:k,onAdd:()=>Mr(),onEdit:L=>Mr(L),onDelete:(L,Q)=>Us(L,Q),onTest:(L,Q)=>Hs(L,Q),onDiscoverTools:(L,Q)=>Nt(L,Q),testResults:G,serverTools:D,toolsLoading:E}),ne==="mcp"&&z==="cursor"&&e.jsx(Qs,{agent:"cursor",servers:Ve,onAdd:()=>{},onEdit:L=>{},onDelete:L=>{}}),ne==="mcp"&&z==="codex"&&e.jsx(Qs,{agent:"codex",servers:Fe,onAdd:()=>et(),onEdit:L=>et(L),onDelete:L=>xt(L)})]})]})]}),W&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[110] p-4",children:e.jsxs("div",{className:"bg-background border border-border rounded-lg w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[e.jsx("h3",{className:"text-lg font-medium text-foreground",children:i(S?"mcpForm.title.edit":"mcpForm.title.add")}),e.jsx(xe,{variant:"ghost",size:"sm",onClick:ar,children:e.jsx(qe,{className:"w-4 h-4"})})]}),e.jsxs("form",{onSubmit:Ws,className:"p-4 space-y-4",children:[!S&&e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,importMode:"form"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${w.importMode==="form"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.form")}),e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,importMode:"json"})),className:`px-4 py-2 rounded-lg font-medium transition-colors ${w.importMode==="json"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:i("mcpForm.importMode.json")})]}),w.importMode==="form"&&S&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-3",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:i("mcpForm.scope.label")}),e.jsxs("div",{className:"flex items-center gap-2",children:[w.scope==="user"?e.jsx(Vr,{className:"w-4 h-4"}):e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm",children:w.scope==="user"?i("mcpForm.scope.userGlobal"):i("mcpForm.scope.projectLocal")}),w.scope==="local"&&w.projectPath&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["- ",w.projectPath]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:i("mcpForm.scope.cannotChange")})]}),w.importMode==="form"&&!S&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.scope.label")," *"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,scope:"user",projectPath:""})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${w.scope==="user"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(Vr,{className:"w-4 h-4"}),e.jsx("span",{children:i("mcpForm.scope.userGlobal")})]})}),e.jsx("button",{type:"button",onClick:()=>P(L=>({...L,scope:"local"})),className:`flex-1 px-4 py-2 rounded-lg font-medium transition-colors ${w.scope==="local"?"bg-blue-600 text-white":"bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(er,{className:"w-4 h-4"}),e.jsx("span",{children:i("mcpForm.scope.projectLocal")})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:w.scope==="user"?i("mcpForm.scope.userDescription"):i("mcpForm.scope.projectDescription")})]}),w.scope==="local"&&!S&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.selectProject")," *"]}),e.jsxs("select",{value:w.projectPath,onChange:L=>P(Q=>({...Q,projectPath:L.target.value})),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",required:w.scope==="local",children:[e.jsxs("option",{value:"",children:[i("mcpForm.fields.selectProject"),"..."]}),s.map(L=>e.jsx("option",{value:L.path||L.fullPath,children:L.displayName||L.name},L.name))]}),w.projectPath&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:i("mcpForm.projectPath",{path:w.projectPath})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:w.importMode==="json"?"md:col-span-2":"",children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.serverName")," *"]}),e.jsx(st,{value:w.name,onChange:L=>{P(Q=>({...Q,name:L.target.value}))},placeholder:i("mcpForm.placeholders.serverName"),required:!0})]}),w.importMode==="form"&&e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.transportType")," *"]}),e.jsxs("select",{value:w.type,onChange:L=>{P(Q=>({...Q,type:L.target.value}))},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"sse",children:"SSE"}),e.jsx("option",{value:"http",children:"HTTP"})]})]})]}),S&&w.raw&&w.importMode==="form"&&e.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:i("mcpForm.configDetails",{configFile:S.scope==="global"?"~/.claude.json":"project config"})}),e.jsx("pre",{className:"text-xs bg-gray-100 dark:bg-gray-800 p-3 rounded overflow-x-auto",children:JSON.stringify(w.raw,null,2)})]}),w.importMode==="json"&&e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-foreground mb-2",children:[i("mcpForm.fields.jsonConfig")," *"]}),e.jsx("textarea",{value:w.jsonInput,onChange:L=>{P(Q=>({...Q,jsonInput:L.target.value}));try{if(L.target.value.trim()){const Q=JSON.parse(L.target.value);Q.type?Q.type==="stdio"&&!Q.command?V(i("mcpForm.validation.stdioRequiresCommand")):(Q.type==="http"||Q.type==="sse")&&!Q.url?V(i("mcpForm.validation.httpRequiresUrl",{type:Q.type})):V(""):V(i("mcpForm.validation.missingType"))}}catch{L.target.value.trim()?V(i("mcpForm.validation.invalidJson")):V("")}},className:`w-full px-3 py-2 border ${K?"border-red-500":"border-gray-300 dark:border-gray-600"} bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500 font-mono text-sm`,rows:"8",placeholder:`{
3
3
  "type": "stdio",
4
4
  "command": "/path/to/server",
5
5
  "args": ["--api-key", "abc123"],
@@ -510,4 +510,4 @@ File: ${(t==null?void 0:t.name)||"New PRD"}
510
510
  Path: ${(t==null?void 0:t.path)||"Not saved yet"}
511
511
 
512
512
  ${F}`)}finally{g(!1)}})()},[t,s,o]),c.useEffect(()=>{(async()=>{if(!(a!=null&&a.name)){console.log("No project name available:",a);return}try{console.log("Fetching PRDs for project:",a.name);const B=await He.get(`/taskmaster/prd/${encodeURIComponent(a.name)}`);if(B.ok){const K=await B.json();console.log("Fetched existing PRDs:",K.prds),P(K.prds||[])}else console.log("Failed to fetch PRDs:",B.status,B.statusText)}catch(B){console.error("Error fetching existing PRDs:",B)}})()},[a==null?void 0:a.name]);const G=async()=>{if(!m.trim()){l("Please add content before saving.","warning");return}if(!k.trim()){l("Please provide a filename for the PRD.","warning");return}const J=k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,B=w.find(K=>K.name===J);if(console.log("Save check:",{fullFileName:J,existingPRDs:w,existingFile:B,isExisting:t==null?void 0:t.isExisting,fileObject:t,shouldShowModal:B&&!(t!=null&&t.isExisting)}),B&&!(t!=null&&t.isExisting)){console.log("Showing overwrite confirmation modal"),H(!0);return}await X()},X=async()=>{x(!0);try{const J=k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,B=await Ee(`/api/taskmaster/prd/${encodeURIComponent(a==null?void 0:a.name)}`,{method:"POST",body:JSON.stringify({fileName:J,content:m})});if(!B.ok){const V=await B.json();throw new Error(V.message||`Save failed: ${B.status}`)}y(!0),setTimeout(()=>y(!1),2e3);const K=await He.get(`/taskmaster/prd/${encodeURIComponent(a.name)}`);if(K.ok){const V=await K.json();P(V.prds||[])}i&&await i()}catch(J){console.error("Error saving PRD:",J),l(`Error saving PRD: ${J.message}`,"error")}finally{x(!1)}},D=()=>{const J=new Blob([m],{type:"text/markdown"}),B=URL.createObjectURL(J),K=document.createElement("a");K.href=B;const V=k?`${k}.txt`:"prd.txt";K.download=V,document.body.appendChild(K),K.click(),document.body.removeChild(K),URL.revokeObjectURL(B)},oe=async()=>{if(!m.trim()){l("Please add content to the PRD before generating tasks.","warning");return}U(!0)},E=()=>{h(!f)};c.useEffect(()=>{const J=B=>{(B.ctrlKey||B.metaKey)&&(B.key==="s"?(B.preventDefault(),G()):B.key==="Escape"&&(B.preventDefault(),r()))};return document.addEventListener("keydown",J),()=>document.removeEventListener("keydown",J)},[m]);const se=J=>J.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/^\- (.*$)/gim,"<li>$1</li>").replace(/(<li>.*<\/li>)/gims,"<ul>$1</ul>").replace(/\n\n/gim,"</p><p>").replace(/^(?!<[h|u|l])(.*$)/gim,"<p>$1</p>").replace(/<\/ul>\s*<ul>/gim,"");return u?e.jsx("div",{className:"fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center",children:e.jsx("div",{className:"w-full h-full md:rounded-lg md:w-auto md:h-auto p-8 flex items-center justify-center bg-white dark:bg-gray-900",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"text-gray-900 dark:text-white",children:"Loading PRD..."})]})})}):e.jsxs("div",{className:`fixed inset-0 z-[200] md:bg-black/50 md:flex md:items-center md:justify-center md:p-4 ${f?"md:p-0":""}`,children:[e.jsxs("div",{className:be("bg-white dark:bg-gray-900 shadow-2xl flex flex-col","w-full h-full md:rounded-lg md:shadow-2xl",f?"md:w-full md:h-full md:rounded-none":"md:w-full md:max-w-6xl md:h-[85vh] md:max-h-[85vh]"),children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-600 rounded flex items-center justify-center flex-shrink-0",children:e.jsx(it,{className:"w-4 h-4 text-white"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center min-w-0 flex-1 bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 rounded-md px-3 py-2 focus-within:ring-2 focus-within:ring-purple-500 focus-within:border-purple-500 dark:focus-within:ring-purple-400 dark:focus-within:border-purple-400",children:[e.jsx("input",{type:"text",value:k,onChange:J=>{const B=J.target.value.replace(/[<>:"/\\|?*]/g,"");T(B)},className:"font-medium text-gray-900 dark:text-white bg-transparent border-none outline-none min-w-0 flex-1 text-base sm:text-sm placeholder-gray-400 dark:placeholder-gray-500",placeholder:"Enter PRD filename",maxLength:100}),e.jsx("span",{className:"text-sm sm:text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap ml-1",children:".txt"})]}),e.jsx("button",{onClick:()=>{var J;return(J=document.querySelector('input[placeholder="Enter PRD filename"]'))==null?void 0:J.focus()},className:"p-1 text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors",title:"Click to edit filename",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"})})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx("span",{className:"text-xs bg-purple-100 dark:bg-purple-900 text-purple-600 dark:text-purple-300 px-2 py-1 rounded whitespace-nowrap",children:"📋 PRD"}),o&&e.jsx("span",{className:"text-xs bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300 px-2 py-1 rounded whitespace-nowrap",children:"✨ New"})]})]}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400 truncate mt-1",children:"Product Requirements Document"})]})]}),e.jsxs("div",{className:"flex items-center gap-1 md:gap-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>A(!v),className:be("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",v?"text-purple-600 dark:text-purple-400 bg-purple-50 dark:bg-purple-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:v?"Switch to edit mode":"Preview markdown",children:e.jsx(ur,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsx("button",{onClick:()=>$(!M),className:be("p-2 md:p-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800","min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",M?"text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"),title:M?"Disable word wrap":"Enable word wrap",children:e.jsx("span",{className:"text-sm md:text-xs font-mono font-bold",children:"↵"})}),e.jsx("button",{onClick:()=>C(!b),className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Toggle theme",children:e.jsx("span",{className:"text-lg md:text-base",children:b?"☀️":"🌙"})}),e.jsx("button",{onClick:D,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Download PRD",children:e.jsx(ys,{className:"w-5 h-5 md:w-4 md:h-4"})}),e.jsxs("button",{onClick:oe,disabled:!m.trim(),className:be("px-3 py-2 rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors text-sm font-medium","bg-purple-600 hover:bg-purple-700 text-white","min-h-[44px] md:min-h-0"),title:"Generate tasks from PRD content",children:[e.jsx(Ht,{className:"w-4 h-4"}),e.jsx("span",{className:"hidden md:inline",children:"Generate Tasks"})]}),e.jsx("button",{onClick:G,disabled:p,className:be("px-3 py-2 text-white rounded-md disabled:opacity-50 flex items-center gap-2 transition-colors","min-h-[44px] md:min-h-0",I?"bg-green-600 hover:bg-green-700":"bg-purple-600 hover:bg-purple-700"),children:I?e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"w-5 h-5 md:w-4 md:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"hidden sm:inline",children:"Saved!"})]}):e.jsxs(e.Fragment,{children:[e.jsx(fs,{className:"w-5 h-5 md:w-4 md:h-4"}),e.jsx("span",{className:"hidden sm:inline",children:p?"Saving...":"Save PRD"})]})}),e.jsx("button",{onClick:E,className:"hidden md:flex p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 items-center justify-center",title:f?"Exit fullscreen":"Fullscreen",children:f?e.jsx(vo,{className:"w-4 h-4"}):e.jsx(Ma,{className:"w-4 h-4"})}),e.jsx("button",{onClick:r,className:"p-2 md:p-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-md hover:bg-gray-100 dark:hover:bg-gray-800 min-w-[44px] min-h-[44px] md:min-w-0 md:min-h-0 flex items-center justify-center",title:"Close",children:e.jsx(qe,{className:"w-6 h-6 md:w-4 md:h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:v?e.jsx("div",{className:"h-full overflow-y-auto p-6 prose prose-gray dark:prose-invert max-w-none",children:e.jsx("div",{className:"markdown-preview",dangerouslySetInnerHTML:{__html:se(m)}})}):e.jsx(jo,{ref:j,value:m,onChange:d,extensions:[Co(),...M?[Zt.lineWrapping]:[]],theme:b?No:void 0,height:"100%",style:{fontSize:"14px",height:"100%"},basicSetup:{lineNumbers:!0,foldGutter:!0,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,highlightSelectionMatches:!0,searchKeymap:!0}})}),e.jsxs("div",{className:"flex items-center justify-between p-3 border-t border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 dark:text-gray-400",children:[e.jsxs("span",{children:["Lines: ",m.split(`
513
- `).length]}),e.jsxs("span",{children:["Characters: ",m.length]}),e.jsxs("span",{children:["Words: ",m.split(/\s+/).filter(J=>J.length>0).length]}),e.jsx("span",{children:"Format: Markdown"})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),W&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Ht,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),e.jsx("button",{onClick:()=>U(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(Ht,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Your AI Assistant Directly!"}),e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask your AI assistant in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),e.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),e.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[e.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),e.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),e.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),e.jsx("div",{className:"pt-4",children:e.jsx("button",{onClick:()=>U(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask my AI assistant directly"})})]})]})}),S&&e.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>H(!1)}),e.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:e.jsx(qt,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>H(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:async()=>{H(!1),await X()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[e.jsx(fs,{className:"w-4 h-4"}),e.jsx("span",{children:"Overwrite"})]})]})]})})]})]})},rx=ex,sx=Yo,ax=tx,nx="PRD saved successfully!";function ox(t){return t.prdFiles||t.prds||[]}function ix({isVisible:t}){const{tasks:r=[],currentProject:s,refreshTasks:a}=Ar(),[n,o]=c.useState(null),[i,l]=c.useState(!1),[m,d]=c.useState(!1),[u,g]=c.useState(null),[p,x]=c.useState([]),[f,h]=c.useState(null),b=c.useRef(null),C=c.useCallback(W=>{b.current&&clearTimeout(b.current),h(W),b.current=setTimeout(()=>{h(null),b.current=null},3e3)},[]),I=c.useCallback(async()=>{if(!(s!=null&&s.name)){x([]);return}try{const W=await He.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(!W.ok){x([]);return}const U=await W.json();x(ox(U))}catch(W){console.error("Failed to load existing PRDs:",W),x([])}},[s==null?void 0:s.name]),y=c.useCallback(async(W=!1)=>{await I(),W&&C(nx)},[I,C]);c.useEffect(()=>{I()},[I]),c.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const v=c.useCallback(W=>{if(!(!W||typeof W!="object"||!("id"in W))){if(!("title"in W)||!W.title){const U=r.find(S=>String(S.id)===String(W.id));U&&(o(U),l(!0));return}o(W),l(!0)}},[r]),A=c.useCallback(()=>{l(!1),o(null)},[]),M=c.useCallback((W,U)=>{console.log("Update task status:",W,U),a==null||a()},[a]),$=c.useCallback((W=null)=>{g(W),d(!0)},[]),k=c.useCallback(()=>{d(!1),g(null)},[]),T=c.useCallback(async()=>{k(),await y(!0),a==null||a()},[k,y,a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`h-full ${t?"block":"hidden"}`,children:e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(rx,{tasks:r,onTaskClick:v,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:s,onTaskCreated:a||void 0,onShowPRDEditor:$,existingPRDs:p,onRefreshPRDs:(W=!1)=>{y(W)}})})}),i&&n&&e.jsx(sx,{task:n,isOpen:i,onClose:A,onStatusChange:M,onTaskClick:v}),m&&e.jsx(ax,{project:s,projectPath:(s==null?void 0:s.fullPath)||(s==null?void 0:s.path),onClose:k,isNewFile:!(u!=null&&u.isExisting),file:{name:(u==null?void 0:u.name)||"prd.txt",content:(u==null?void 0:u.content)||""},onSave:T}),f&&e.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:e.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"font-medium",children:f})]})})]})}function lx(){const{isRelayConnected:t,isChecking:r}=Ta(),[s,a]=c.useState(null),[n,o]=c.useState(!1),[i,l]=c.useState(!1),[m,d]=c.useState(!1),[u,g]=c.useState(!1);c.useEffect(()=>{if(t||g(!0),t&&u){d(!0),a(null);const h=setTimeout(()=>d(!1),3e3);return()=>clearTimeout(h)}},[t,u]);const p=c.useCallback(async()=>{try{o(!0);const h=await He.relay.createToken(`web-${Date.now()}`);if(h.ok){const b=await h.json();a(b.token)}}catch{}finally{o(!1)}},[]),x=window.location.origin,f=c.useCallback(()=>{if(!s)return;const h=`npx upfynai-code connect --server ${x} --key ${s}`;navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),2e3)},[s,x]);return r||t&&!m?null:t&&m?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-500/10 border-b border-green-500/20 text-green-400 text-sm",children:[e.jsx(tn,{className:"w-4 h-4"}),e.jsx("span",{children:"Machine connected"})]}):e.jsxs("div",{className:"border-b border-amber-500/20 bg-amber-500/10",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(co,{className:"w-4 h-4 text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-amber-300",children:"Connect your machine to get started"}),!s&&e.jsxs("button",{onClick:p,disabled:n,className:"ml-auto flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 transition-colors disabled:opacity-50",children:[n?e.jsx(jr,{className:"w-3 h-3 animate-spin"}):e.jsx(tn,{className:"w-3 h-3"}),"Start Listening"]})]}),s&&e.jsxs("div",{className:"px-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-background/50 rounded-md border border-border p-2",children:[e.jsxs("code",{className:"text-xs text-foreground flex-1 overflow-x-auto whitespace-nowrap",children:["npx upfynai-code connect --server ",x," --key ",s]}),e.jsx("button",{onClick:f,className:"flex-shrink-0 p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:"Copy command",children:i?e.jsx(Tt,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(Da,{className:"w-3.5 h-3.5"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"Run this command in your terminal to connect"})]})]})}function ps({children:t,fallback:r,bypass:s}){const{isRelayConnected:a}=Ta();return s||a?e.jsx(e.Fragment,{children:t}):e.jsxs("div",{className:"relative h-full w-full",children:[e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/60 backdrop-blur-sm",children:r}),e.jsx("div",{className:"h-full w-full opacity-30 pointer-events-none select-none","aria-hidden":!0,children:t})]})}function Ps({icon:t,label:r}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[e.jsx(t,{className:"w-10 h-10 opacity-40"}),e.jsxs("p",{className:"text-sm font-medium",children:[r," requires a connected machine"]}),e.jsx("p",{className:"text-xs opacity-60",children:"Connect your machine to get started"})]})}function cx(){return e.jsx(Ps,{icon:La,label:"Chat"})}function dx(){return e.jsx(Ps,{icon:ct,label:"Shell"})}function mx(){return e.jsx(Ps,{icon:ol,label:"Files"})}function ux(){return e.jsx(Ps,{icon:Gt,label:"Git"})}function px({selectedProject:t,isMobile:r,initialWidth:s=600}){const[a,n]=c.useState(null),[o,i]=c.useState(s),[l,m]=c.useState(!1),[d,u]=c.useState(!1),g=c.useRef(null),p=c.useCallback((b,C=null)=>{const y=b.replace(/\\/g,"/").split("/").pop()||b;n({name:y,path:b,projectName:t==null?void 0:t.name,diffInfo:C})},[t==null?void 0:t.name]),x=c.useCallback(()=>{n(null),m(!1)},[]),f=c.useCallback(()=>{m(b=>!b)},[]),h=c.useCallback(b=>{r||(u(!0),b.preventDefault())},[r]);return c.useEffect(()=>{const b=I=>{var k;if(!d)return;const y=(k=g.current)==null?void 0:k.parentElement;if(!y)return;const v=y.getBoundingClientRect(),A=v.right-I.clientX,M=300,$=v.width*.8;A>=M&&A<=$&&i(A)},C=()=>{u(!1)};return d&&(document.addEventListener("mousemove",b),document.addEventListener("mouseup",C),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""}},[d]),{editingFile:a,editorWidth:o,editorExpanded:l,resizeHandleRef:g,handleFileOpen:p,handleCloseEditor:x,handleToggleEditorExpand:f,handleResizeStart:h}}const xx=c.lazy(()=>Ls(()=>import("./CanvasPanel-CB4sweQq.js"),__vite__mapDeps([4,3,1,2,5,6]))),gx=c.lazy(()=>Ls(()=>import("./WorkflowsPanel-CO5g5yGG.js"),__vite__mapDeps([7,1,8,3,2,5,9,10]))),hx=c.lazy(()=>Ls(()=>import("./DashboardPanel-BXaA-b9z.js"),__vite__mapDeps([11,1,8,3,2,5,9,10]))),fx=ml,bx=Ip;function yx({selectedProject:t,selectedSession:r,activeTab:s,setActiveTab:a,ws:n,sendMessage:o,latestMessage:i,isMobile:l,onMenuClick:m,isLoading:d,onInputFocusChange:u,onSessionActive:g,onSessionInactive:p,onSessionProcessing:x,onSessionNotProcessing:f,processingSessions:h,onReplaceTemporarySession:b,onNavigateToSession:C,onShowSettings:I,externalMessageUpdate:y}){const{preferences:v}=_a(),{autoExpandTools:A,showRawParameters:M,showThinking:$,autoScrollToBottom:k,sendByCtrlEnter:T}=v,{currentProject:W,setCurrentProject:U}=Ar(),{tasksEnabled:S,isTaskMasterInstalled:H}=Yr(),w=S!==!1,{editingFile:P,editorWidth:j,editorExpanded:F,resizeHandleRef:G,handleFileOpen:X,handleCloseEditor:D,handleToggleEditorExpand:oe,handleResizeStart:E}=px({selectedProject:t,isMobile:l});return c.useEffect(()=>{t&&t!==W&&(U==null||U(t))},[t,W,U]),c.useEffect(()=>{!w&&s==="tasks"&&a("chat")},[w,s,a]),d?e.jsx(to,{mode:"loading",isMobile:l,onMenuClick:m}):t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Pp,{activeTab:s,setActiveTab:a,selectedProject:t,selectedSession:r,shouldShowTasksTab:w,isMobile:l,onMenuClick:m}),e.jsx(lx,{}),e.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[e.jsxs("div",{className:`flex flex-col min-h-0 overflow-hidden ${F?"hidden":""} ${s==="files"&&P?"w-[280px] flex-shrink-0":"flex-1"}`,children:[s==="dashboard"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading dashboard..."}),children:e.jsx(hx,{selectedProject:t})})}),e.jsx("div",{className:`h-full ${s==="chat"?"block":"hidden"}`,children:e.jsx(ps,{fallback:e.jsx(cx,{}),children:e.jsx(Zn,{showDetails:!0,children:e.jsx(Np,{selectedProject:t,selectedSession:r,ws:n,sendMessage:o,latestMessage:i,onFileOpen:X,onInputFocusChange:u,onSessionActive:g,onSessionInactive:p,onSessionProcessing:x,onSessionNotProcessing:f,processingSessions:h,onReplaceTemporarySession:b,onNavigateToSession:C,onShowSettings:I,autoExpandTools:A,showRawParameters:M,showThinking:$,autoScrollToBottom:k,sendByCtrlEnter:T,externalMessageUpdate:y,onShowAllTasks:S?()=>a("tasks"):null,setActiveTab:a})})})}),s==="canvas"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(Zn,{showDetails:!0,children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading canvas..."}),children:e.jsx(xx,{selectedProject:t,ws:n,sendMessage:o,latestMessage:i})})})}),s==="files"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(mx,{}),children:e.jsx(Tp,{selectedProject:t,onFileOpen:X})})}),s==="shell"&&e.jsx("div",{className:"h-full w-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(dx,{}),children:e.jsx(fx,{project:t,session:r,showHeader:!1,multiTab:!0})})}),s==="git"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(ux,{}),children:e.jsx(bx,{selectedProject:t,isMobile:l,onFileOpen:X})})}),s==="workflows"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading workflows..."}),children:e.jsx(gx,{selectedProject:t})})}),w&&e.jsx(ix,{isVisible:s==="tasks"}),e.jsx("div",{className:`h-full overflow-hidden ${s==="preview"?"block":"hidden"}`})]}),e.jsx(Xp,{editingFile:P,isMobile:l,editorExpanded:F,editorWidth:j,resizeHandleRef:G,onResizeStart:E,onCloseEditor:D,onToggleEditorExpand:oe,projectPath:t.path,fillSpace:s==="files"})]})]}):e.jsx(to,{mode:"empty",isMobile:l,onMenuClick:m})}const vx=Ft.memo(yx);function kx({activeTab:t,setActiveTab:r,isInputFocused:s}){const{tasksEnabled:a,isTaskMasterInstalled:n}=Yr(),i=[{id:"chat",icon:La,label:"Chat",onClick:()=>r("chat")},{id:"shell",icon:ct,label:"Shell",onClick:()=>r("shell")},{id:"files",icon:tr,label:"Files",onClick:()=>r("files")},{id:"git",icon:Gt,label:"Git",onClick:()=>r("git")},{id:"workflows",icon:cr,label:"Workflows",onClick:()=>r("workflows")},...!!(a&&n)?[{id:"tasks",icon:yo,label:"Tasks",onClick:()=>r("tasks")}]:[]];return e.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 px-3 pb-[max(8px,env(safe-area-inset-bottom))] transform transition-transform duration-300 ease-in-out ${s?"translate-y-full":"translate-y-0"}`,children:e.jsx("div",{className:"nav-glass mobile-nav-float rounded-2xl border border-border/30",children:e.jsx("div",{className:"flex items-center justify-around px-1 py-1.5 gap-0.5",children:i.map(l=>{const m=l.icon,d=t===l.id;return e.jsxs("button",{onClick:l.onClick,onTouchStart:u=>{u.preventDefault(),l.onClick()},className:`flex flex-col items-center justify-center gap-0.5 px-3 py-2 rounded-xl flex-1 relative touch-manipulation transition-all duration-200 active:scale-95 ${d?"text-primary":"text-muted-foreground hover:text-foreground"}`,"aria-label":l.label,"aria-current":d?"page":void 0,children:[d&&e.jsx("div",{className:"absolute inset-0 bg-primary/8 dark:bg-primary/12 rounded-xl"}),e.jsx(m,{className:`relative z-10 transition-all duration-200 ${d?"w-5 h-5":"w-[18px] h-[18px]"}`,strokeWidth:d?2.4:1.8}),e.jsx("span",{className:`relative z-10 text-[10px] font-medium transition-all duration-200 ${d?"opacity-100":"opacity-60"}`,children:l.label})]},l.id)})})})})}function wx(){const[t,r]=c.useState(new Set),[s,a]=c.useState(new Set),n=c.useCallback(d=>{d&&r(u=>new Set([...u,d]))},[]),o=c.useCallback(d=>{d&&r(u=>{const g=new Set(u);return g.delete(d),g})},[]),i=c.useCallback(d=>{d&&a(u=>new Set([...u,d]))},[]),l=c.useCallback(d=>{d&&a(u=>{const g=new Set(u);return g.delete(d),g})},[]),m=c.useCallback(d=>{d&&r(u=>{const g=new Set;for(const p of u)p.startsWith("new-session-")||g.add(p);return g.add(d),g})},[]);return{activeSessions:t,processingSessions:s,markSessionAsActive:n,markSessionAsInactive:o,markSessionAsProcessing:i,markSessionAsNotProcessing:l,replaceTemporarySession:m}}const yt=t=>JSON.stringify(t??null),io=(t,r,s)=>t.length!==r.length?!0:r.some((a,n)=>{const o=t[n];return!o||a.name!==o.name||a.displayName!==o.displayName||a.fullPath!==o.fullPath||yt(a.sessionMeta)!==yt(o.sessionMeta)||yt(a.sessions)!==yt(o.sessions)?!0:yt(a.cursorSessions)!==yt(o.cursorSessions)||yt(a.codexSessions)!==yt(o.codexSessions)}),As=t=>[...t.sessions??[],...t.codexSessions??[],...t.cursorSessions??[]],jx=(t,r,s,a)=>{if(!s||!a)return!0;const n=t.find(m=>m.name===s.name),o=r.find(m=>m.name===s.name);if(!n||!o)return!1;const i=As(n).find(m=>m.id===a.id),l=As(o).find(m=>m.id===a.id);return!i||!l?!1:i.id===l.id&&i.title===l.title&&i.created_at===l.created_at&&i.updated_at===l.updated_at};function Nx({sessionId:t,navigate:r,latestMessage:s,isMobile:a,activeSessions:n}){const[o,i]=c.useState([]),[l,m]=c.useState(null),[d,u]=c.useState(null),[g,p]=c.useState("chat"),[x,f]=c.useState(!1),[h,b]=c.useState(!0),[C,I]=c.useState(null),[y,v]=c.useState(!1),[A,M]=c.useState(!1),[$,k]=c.useState("agents"),[T,W]=c.useState(0),U=c.useRef(null),S=c.useRef(new Set),H=c.useCallback(async()=>{try{b(!0);const se=await(await He.projects()).json();i(J=>J.length===0||io(J,se,!0)?se:J)}catch(E){console.error("Error fetching projects:",E)}finally{b(!1)}},[]),w=c.useCallback((E="tools")=>{k(E),M(!0)},[]);c.useEffect(()=>{H()},[H]),c.useEffect(()=>{!h&&o.length===1&&!l&&!t&&m(o[0])},[h,o,l,t]),c.useEffect(()=>{if(!s)return;if(s.type==="loading_progress"){U.current&&(clearTimeout(U.current),U.current=null),I(s),s.phase==="complete"&&(U.current=setTimeout(()=>{I(null),U.current=null},500));return}if(s.type!=="projects_updated")return;const E=s;if(E.changedFile&&d&&l){const z=E.changedFile.replace(/\\/g,"/").split("/");z.length>=2&&z[z.length-1].replace(".jsonl","")===d.id&&(n.has(d.id)||W(q=>q+1))}const se=d&&n.has(d.id)||n.size>0&&Array.from(n).some(V=>V.startsWith("new-session-")),J=E.projects;if(se&&!jx(o,J,l,d)||(i(J),!l))return;const B=J.find(V=>V.name===l.name);if(!B||(yt(B)!==yt(l)&&m(B),!d))return;As(B).find(V=>V.id===d.id)||u(null)},[s,l,d,n,o]),c.useEffect(()=>()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),c.useEffect(()=>{var se,J,B;if(!t||o.length===0)return;const E=!d||d.id!==t;for(const K of o){const V=(se=K.sessions)==null?void 0:se.find(ne=>ne.id===t);if(V){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="claude";ne&&m(K),me&&u({...V,__provider:"claude"}),E&&p("chat");return}const z=(J=K.cursorSessions)==null?void 0:J.find(ne=>ne.id===t);if(z){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="cursor";ne&&m(K),me&&u({...z,__provider:"cursor"}),E&&p("chat");return}const O=(B=K.codexSessions)==null?void 0:B.find(ne=>ne.id===t);if(O){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="codex";ne&&m(K),me&&u({...O,__provider:"codex"}),E&&p("chat");return}}},[t,o,l==null?void 0:l.name,d==null?void 0:d.id,d==null?void 0:d.__provider]);const P=c.useCallback(E=>{m(E),u(null),r("/"),a&&f(!1)},[a,r]),j=c.useCallback(E=>{if(u(E),g!=="git"&&g!=="preview"&&p("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",E.id),a){const J=E.__projectName,B=l==null?void 0:l.name;J!==B&&f(!1)}r(`/session/${E.id}`)},[g,a,r,l==null?void 0:l.name]),F=c.useCallback(E=>{m(E),u(null),p("chat"),r("/"),a&&f(!1)},[a,r]),G=c.useCallback(E=>{S.current.add(E),setTimeout(()=>S.current.delete(E),3e4),(d==null?void 0:d.id)===E&&(u(null),r("/")),i(se=>se.map(J=>{var B,K;return{...J,sessions:((B=J.sessions)==null?void 0:B.filter(V=>V.id!==E))??[],sessionMeta:{...J.sessionMeta,total:Math.max(0,(((K=J.sessionMeta)==null?void 0:K.total)??0)-1)}}}))},[r,d==null?void 0:d.id]),X=c.useCallback(async()=>{try{let se=await(await He.projects()).json();if(S.current.size>0&&(se=se.map(K=>{var V;return{...K,sessions:((V=K.sessions)==null?void 0:V.filter(z=>!S.current.has(z.id)))??[]}})),i(K=>io(K,se,!0)?se:K),!l)return;const J=se.find(K=>K.name===l.name);if(!J||(yt(J)!==yt(l)&&m(J),!d))return;const B=As(J).find(K=>K.id===d.id);if(B){const K=B.__provider||!d.__provider?B:{...B,__provider:d.__provider};yt(K)!==yt(d)&&u(K)}}catch(E){console.error("Error refreshing sidebar:",E)}},[l,d]),D=c.useCallback(E=>{(l==null?void 0:l.name)===E&&(m(null),u(null),r("/")),i(se=>se.filter(J=>J.name!==E))},[r,l==null?void 0:l.name]),oe=c.useMemo(()=>({projects:o,selectedProject:l,selectedSession:d,onProjectSelect:P,onSessionSelect:j,onNewSession:F,onSessionDelete:G,onProjectDelete:D,isLoading:h,loadingProgress:C,onRefresh:X,onShowSettings:()=>M(!0),showSettings:A,settingsInitialTab:$,onCloseSettings:()=>M(!1),isMobile:a}),[F,D,P,G,j,X,h,a,C,o,$,l,d,A]);return{projects:o,selectedProject:l,selectedSession:d,activeTab:g,sidebarOpen:x,isLoadingProjects:h,loadingProgress:C,isInputFocused:y,showSettings:A,settingsInitialTab:$,externalMessageUpdate:T,setActiveTab:p,setSidebarOpen:f,setIsInputFocused:v,setShowSettings:M,openSettings:w,fetchProjects:H,sidebarSharedProps:oe,handleProjectSelect:P,handleSessionSelect:j,handleNewSession:F,handleSessionDelete:G,handleProjectDelete:D,handleSidebarRefresh:X}}function Cx(){const t=Ti(),{sessionId:r}=Ii(),{t:s}=Ge("common"),{isMobile:a}=Pa({trackPWA:!1}),{ws:n,sendMessage:o,latestMessage:i}=Ai(),{activeSessions:l,processingSessions:m,markSessionAsActive:d,markSessionAsInactive:u,markSessionAsProcessing:g,markSessionAsNotProcessing:p,replaceTemporarySession:x}=wx(),{selectedProject:f,selectedSession:h,activeTab:b,sidebarOpen:C,isLoadingProjects:I,isInputFocused:y,externalMessageUpdate:v,setActiveTab:A,setSidebarOpen:M,setIsInputFocused:$,setShowSettings:k,openSettings:T,fetchProjects:W,sidebarSharedProps:U}=Nx({sessionId:r,navigate:t,latestMessage:i,isMobile:a,activeSessions:l});return c.useEffect(()=>(window.refreshProjects=W,()=>{window.refreshProjects===W&&delete window.refreshProjects}),[W]),c.useEffect(()=>(window.openSettings=T,()=>{window.openSettings===T&&delete window.openSettings}),[T]),e.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[a?e.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${C?"opacity-100 visible":"opacity-0 invisible"}`,children:[e.jsx("button",{className:"fixed inset-0 bg-background/60 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:S=>{S.stopPropagation(),M(!1)},onTouchStart:S=>{S.preventDefault(),S.stopPropagation(),M(!1)},"aria-label":s("versionUpdate.ariaLabels.closeSidebar")}),e.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border/40 transform transition-transform duration-150 ease-out ${C?"translate-x-0":"-translate-x-full"}`,onClick:S=>S.stopPropagation(),onTouchStart:S=>S.stopPropagation(),children:e.jsx(bn,{...U})})]}):e.jsx("div",{className:"h-full flex-shrink-0 border-r border-border/50",children:e.jsx(bn,{...U})}),e.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${a?"pb-mobile-nav":""}`,children:e.jsx(vx,{selectedProject:f,selectedSession:h,activeTab:b,setActiveTab:A,ws:n,sendMessage:o,latestMessage:i,isMobile:a,onMenuClick:()=>M(!0),isLoading:I,onInputFocusChange:$,onSessionActive:d,onSessionInactive:u,onSessionProcessing:g,onSessionNotProcessing:p,processingSessions:m,onReplaceTemporarySession:x,onNavigateToSession:S=>t(`/session/${S}`),onShowSettings:()=>k(!0),externalMessageUpdate:v})}),a&&e.jsx(kx,{activeTab:b,setActiveTab:A,isInputFocused:y})]})}const Fx=Object.freeze(Object.defineProperty({__proto__:null,default:Cx},Symbol.toStringTag,{value:"Module"}));export{Fx as A,In as _,$x as a,Lx as b};
513
+ `).length]}),e.jsxs("span",{children:["Characters: ",m.length]}),e.jsxs("span",{children:["Words: ",m.split(/\s+/).filter(J=>J.length>0).length]}),e.jsx("span",{children:"Format: Markdown"})]}),e.jsx("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"Press Ctrl+S to save • Esc to close"})]})]}),W&&e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-md border border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center",children:e.jsx(Ht,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Generate Tasks from PRD"})]}),e.jsx("button",{onClick:()=>U(!1),className:"p-2 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 rounded-md hover:bg-gray-100 dark:hover:bg-gray-700",children:e.jsx(qe,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 rounded-lg p-4 border border-purple-200 dark:border-purple-800",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-purple-100 dark:bg-purple-900/50 rounded-lg flex items-center justify-center flex-shrink-0 mt-0.5",children:e.jsx(Ht,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-semibold text-purple-900 dark:text-purple-100 mb-2",children:"💡 Pro Tip: Ask Your AI Assistant Directly!"}),e.jsx("p",{className:"text-sm text-purple-800 dark:text-purple-200 mb-3",children:"You can simply ask your AI assistant in the chat to parse your PRD and generate tasks. The AI assistant will automatically save your PRD and create detailed tasks with implementation details."}),e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded border border-purple-200 dark:border-purple-700 p-3 mb-3",children:[e.jsx("p",{className:"text-xs font-medium text-gray-600 dark:text-gray-400 mb-1",children:"💬 Example:"}),e.jsxs("p",{className:"text-xs text-gray-900 dark:text-white font-mono",children:[`"I've just initialized a new project with Claude Task Master. I have a PRD at .taskmaster/docs/`,k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,'. Can you help me parse it and set up the initial tasks?"']})]}),e.jsxs("p",{className:"text-xs text-purple-700 dark:text-purple-300",children:[e.jsx("strong",{children:"This will:"})," Save your PRD, analyze its content, and generate structured tasks with subtasks, dependencies, and implementation details."]})]})]})}),e.jsxs("div",{className:"text-center pt-4 border-t border-gray-200 dark:border-gray-700",children:[e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:"For more examples and advanced usage patterns:"}),e.jsx("a",{href:"https://github.com/eyaltoledano/claude-task-master/blob/main/docs/examples.md",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-sm text-purple-600 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-300 underline font-medium",children:"View TaskMaster Documentation →"})]}),e.jsx("div",{className:"pt-4",children:e.jsx("button",{onClick:()=>U(!1),className:"w-full px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Got it, I'll ask my AI assistant directly"})})]})]})}),S&&e.jsxs("div",{className:"fixed inset-0 z-[300] flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50",onClick:()=>H(!1)}),e.jsx("div",{className:"relative bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md w-full border border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:"p-2 rounded-full mr-3 bg-yellow-100 dark:bg-yellow-900",children:e.jsx(qt,{className:"w-5 h-5 text-yellow-600 dark:text-yellow-400"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"File Already Exists"})]}),e.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-6",children:['A PRD file named "',k.endsWith(".txt")||k.endsWith(".md")?k:`${k}.txt`,'" already exists. Do you want to overwrite it with the current content?']}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>H(!1),className:"px-4 py-2 text-sm text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors",children:"Cancel"}),e.jsxs("button",{onClick:async()=>{H(!1),await X()},className:"px-4 py-2 text-sm text-white bg-yellow-600 hover:bg-yellow-700 rounded-md flex items-center space-x-2 transition-colors",children:[e.jsx(fs,{className:"w-4 h-4"}),e.jsx("span",{children:"Overwrite"})]})]})]})})]})]})},rx=ex,sx=Yo,ax=tx,nx="PRD saved successfully!";function ox(t){return t.prdFiles||t.prds||[]}function ix({isVisible:t}){const{tasks:r=[],currentProject:s,refreshTasks:a}=Ar(),[n,o]=c.useState(null),[i,l]=c.useState(!1),[m,d]=c.useState(!1),[u,g]=c.useState(null),[p,x]=c.useState([]),[f,h]=c.useState(null),b=c.useRef(null),C=c.useCallback(W=>{b.current&&clearTimeout(b.current),h(W),b.current=setTimeout(()=>{h(null),b.current=null},3e3)},[]),I=c.useCallback(async()=>{if(!(s!=null&&s.name)){x([]);return}try{const W=await He.get(`/taskmaster/prd/${encodeURIComponent(s.name)}`);if(!W.ok){x([]);return}const U=await W.json();x(ox(U))}catch(W){console.error("Failed to load existing PRDs:",W),x([])}},[s==null?void 0:s.name]),y=c.useCallback(async(W=!1)=>{await I(),W&&C(nx)},[I,C]);c.useEffect(()=>{I()},[I]),c.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const v=c.useCallback(W=>{if(!(!W||typeof W!="object"||!("id"in W))){if(!("title"in W)||!W.title){const U=r.find(S=>String(S.id)===String(W.id));U&&(o(U),l(!0));return}o(W),l(!0)}},[r]),A=c.useCallback(()=>{l(!1),o(null)},[]),M=c.useCallback((W,U)=>{console.log("Update task status:",W,U),a==null||a()},[a]),$=c.useCallback((W=null)=>{g(W),d(!0)},[]),k=c.useCallback(()=>{d(!1),g(null)},[]),T=c.useCallback(async()=>{k(),await y(!0),a==null||a()},[k,y,a]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`h-full ${t?"block":"hidden"}`,children:e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx(rx,{tasks:r,onTaskClick:v,showParentTasks:!0,className:"flex-1 overflow-y-auto p-4",currentProject:s,onTaskCreated:a||void 0,onShowPRDEditor:$,existingPRDs:p,onRefreshPRDs:(W=!1)=>{y(W)}})})}),i&&n&&e.jsx(sx,{task:n,isOpen:i,onClose:A,onStatusChange:M,onTaskClick:v}),m&&e.jsx(ax,{project:s,projectPath:(s==null?void 0:s.fullPath)||(s==null?void 0:s.path),onClose:k,isNewFile:!(u!=null&&u.isExisting),file:{name:(u==null?void 0:u.name)||"prd.txt",content:(u==null?void 0:u.content)||""},onSave:T}),f&&e.jsx("div",{className:"fixed bottom-4 right-4 z-50 animate-in slide-in-from-bottom-2 duration-300",children:e.jsxs("div",{className:"bg-green-600 text-white px-4 py-3 rounded-lg shadow-lg flex items-center gap-3",children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("span",{className:"font-medium",children:f})]})})]})}function lx(){const{isRelayConnected:t,isChecking:r}=Ta(),[s,a]=c.useState(null),[n,o]=c.useState(!1),[i,l]=c.useState(!1),[m,d]=c.useState(!1),[u,g]=c.useState(!1);c.useEffect(()=>{if(t||g(!0),t&&u){d(!0),a(null);const h=setTimeout(()=>d(!1),3e3);return()=>clearTimeout(h)}},[t,u]);const p=c.useCallback(async()=>{try{o(!0);const h=await He.relay.createToken(`web-${Date.now()}`);if(h.ok){const b=await h.json();a(b.token)}}catch{}finally{o(!1)}},[]),x=window.location.origin,f=c.useCallback(()=>{if(!s)return;const h=`npx upfynai-code connect --server ${x} --key ${s}`;navigator.clipboard.writeText(h),l(!0),setTimeout(()=>l(!1),2e3)},[s,x]);return r||t&&!m?null:t&&m?e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-500/10 border-b border-green-500/20 text-green-400 text-sm",children:[e.jsx(tn,{className:"w-4 h-4"}),e.jsx("span",{children:"Machine connected"})]}):e.jsxs("div",{className:"border-b border-amber-500/20 bg-amber-500/10",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(co,{className:"w-4 h-4 text-amber-400 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-amber-300",children:"Connect your machine to get started"}),!s&&e.jsxs("button",{onClick:p,disabled:n,className:"ml-auto flex items-center gap-1.5 px-3 py-1 text-xs font-medium rounded-md bg-amber-500/20 hover:bg-amber-500/30 text-amber-300 transition-colors disabled:opacity-50",children:[n?e.jsx(jr,{className:"w-3 h-3 animate-spin"}):e.jsx(tn,{className:"w-3 h-3"}),"Start Listening"]})]}),s&&e.jsxs("div",{className:"px-4 pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-background/50 rounded-md border border-border p-2",children:[e.jsxs("code",{className:"text-xs text-foreground flex-1 overflow-x-auto whitespace-nowrap",children:["npx upfynai-code connect --server ",x," --key ",s]}),e.jsx("button",{onClick:f,className:"flex-shrink-0 p-1.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:"Copy command",children:i?e.jsx(Tt,{className:"w-3.5 h-3.5 text-green-400"}):e.jsx(Da,{className:"w-3.5 h-3.5"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1.5",children:"Run this command in your terminal to connect"})]})]})}function ps({children:t,fallback:r,bypass:s}){const{isRelayConnected:a}=Ta();return s||a?e.jsx(e.Fragment,{children:t}):e.jsxs("div",{className:"relative h-full w-full",children:[e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-background/60 backdrop-blur-sm",children:r}),e.jsx("div",{className:"h-full w-full opacity-30 pointer-events-none select-none","aria-hidden":!0,children:t})]})}function Ps({icon:t,label:r}){return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",children:[e.jsx(t,{className:"w-10 h-10 opacity-40"}),e.jsxs("p",{className:"text-sm font-medium",children:[r," requires a connected machine"]}),e.jsx("p",{className:"text-xs opacity-60",children:"Connect your machine to get started"})]})}function cx(){return e.jsx(Ps,{icon:La,label:"Chat"})}function dx(){return e.jsx(Ps,{icon:ct,label:"Shell"})}function mx(){return e.jsx(Ps,{icon:ol,label:"Files"})}function ux(){return e.jsx(Ps,{icon:Gt,label:"Git"})}function px({selectedProject:t,isMobile:r,initialWidth:s=600}){const[a,n]=c.useState(null),[o,i]=c.useState(s),[l,m]=c.useState(!1),[d,u]=c.useState(!1),g=c.useRef(null),p=c.useCallback((b,C=null)=>{const y=b.replace(/\\/g,"/").split("/").pop()||b;n({name:y,path:b,projectName:t==null?void 0:t.name,diffInfo:C})},[t==null?void 0:t.name]),x=c.useCallback(()=>{n(null),m(!1)},[]),f=c.useCallback(()=>{m(b=>!b)},[]),h=c.useCallback(b=>{r||(u(!0),b.preventDefault())},[r]);return c.useEffect(()=>{const b=I=>{var k;if(!d)return;const y=(k=g.current)==null?void 0:k.parentElement;if(!y)return;const v=y.getBoundingClientRect(),A=v.right-I.clientX,M=300,$=v.width*.8;A>=M&&A<=$&&i(A)},C=()=>{u(!1)};return d&&(document.addEventListener("mousemove",b),document.addEventListener("mouseup",C),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",C),document.body.style.cursor="",document.body.style.userSelect=""}},[d]),{editingFile:a,editorWidth:o,editorExpanded:l,resizeHandleRef:g,handleFileOpen:p,handleCloseEditor:x,handleToggleEditorExpand:f,handleResizeStart:h}}const xx=c.lazy(()=>Ls(()=>import("./CanvasPanel-0u9QR7U-.js"),__vite__mapDeps([4,3,1,2,5,6]))),gx=c.lazy(()=>Ls(()=>import("./WorkflowsPanel-CqlbEJA_.js"),__vite__mapDeps([7,1,8,3,2,5,9,10]))),hx=c.lazy(()=>Ls(()=>import("./DashboardPanel-Dgqw1yZk.js"),__vite__mapDeps([11,1,8,3,2,5,9,10]))),fx=ml,bx=Ip;function yx({selectedProject:t,selectedSession:r,activeTab:s,setActiveTab:a,ws:n,sendMessage:o,latestMessage:i,isMobile:l,onMenuClick:m,isLoading:d,onInputFocusChange:u,onSessionActive:g,onSessionInactive:p,onSessionProcessing:x,onSessionNotProcessing:f,processingSessions:h,onReplaceTemporarySession:b,onNavigateToSession:C,onShowSettings:I,externalMessageUpdate:y}){const{preferences:v}=_a(),{autoExpandTools:A,showRawParameters:M,showThinking:$,autoScrollToBottom:k,sendByCtrlEnter:T}=v,{currentProject:W,setCurrentProject:U}=Ar(),{tasksEnabled:S,isTaskMasterInstalled:H}=Yr(),w=S!==!1,{editingFile:P,editorWidth:j,editorExpanded:F,resizeHandleRef:G,handleFileOpen:X,handleCloseEditor:D,handleToggleEditorExpand:oe,handleResizeStart:E}=px({selectedProject:t,isMobile:l});return c.useEffect(()=>{t&&t!==W&&(U==null||U(t))},[t,W,U]),c.useEffect(()=>{!w&&s==="tasks"&&a("chat")},[w,s,a]),d?e.jsx(to,{mode:"loading",isMobile:l,onMenuClick:m}):t?e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsx(Pp,{activeTab:s,setActiveTab:a,selectedProject:t,selectedSession:r,shouldShowTasksTab:w,isMobile:l,onMenuClick:m}),e.jsx(lx,{}),e.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[e.jsxs("div",{className:`flex flex-col min-h-0 overflow-hidden ${F?"hidden":""} ${s==="files"&&P?"w-[280px] flex-shrink-0":"flex-1"}`,children:[s==="dashboard"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading dashboard..."}),children:e.jsx(hx,{selectedProject:t})})}),e.jsx("div",{className:`h-full ${s==="chat"?"block":"hidden"}`,children:e.jsx(ps,{fallback:e.jsx(cx,{}),children:e.jsx(Zn,{showDetails:!0,children:e.jsx(Np,{selectedProject:t,selectedSession:r,ws:n,sendMessage:o,latestMessage:i,onFileOpen:X,onInputFocusChange:u,onSessionActive:g,onSessionInactive:p,onSessionProcessing:x,onSessionNotProcessing:f,processingSessions:h,onReplaceTemporarySession:b,onNavigateToSession:C,onShowSettings:I,autoExpandTools:A,showRawParameters:M,showThinking:$,autoScrollToBottom:k,sendByCtrlEnter:T,externalMessageUpdate:y,onShowAllTasks:S?()=>a("tasks"):null,setActiveTab:a})})})}),s==="canvas"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(Zn,{showDetails:!0,children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading canvas..."}),children:e.jsx(xx,{selectedProject:t,ws:n,sendMessage:o,latestMessage:i})})})}),s==="files"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(mx,{}),children:e.jsx(Tp,{selectedProject:t,onFileOpen:X})})}),s==="shell"&&e.jsx("div",{className:"h-full w-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(dx,{}),children:e.jsx(fx,{project:t,session:r,showHeader:!1,multiTab:!0})})}),s==="git"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(ps,{fallback:e.jsx(ux,{}),children:e.jsx(bx,{selectedProject:t,isMobile:l,onFileOpen:X})})}),s==="workflows"&&e.jsx("div",{className:"h-full overflow-hidden",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading workflows..."}),children:e.jsx(gx,{selectedProject:t})})}),w&&e.jsx(ix,{isVisible:s==="tasks"}),e.jsx("div",{className:`h-full overflow-hidden ${s==="preview"?"block":"hidden"}`})]}),e.jsx(Xp,{editingFile:P,isMobile:l,editorExpanded:F,editorWidth:j,resizeHandleRef:G,onResizeStart:E,onCloseEditor:D,onToggleEditorExpand:oe,projectPath:t.path,fillSpace:s==="files"})]})]}):e.jsx(to,{mode:"empty",isMobile:l,onMenuClick:m})}const vx=Ft.memo(yx);function kx({activeTab:t,setActiveTab:r,isInputFocused:s}){const{tasksEnabled:a,isTaskMasterInstalled:n}=Yr(),i=[{id:"chat",icon:La,label:"Chat",onClick:()=>r("chat")},{id:"shell",icon:ct,label:"Shell",onClick:()=>r("shell")},{id:"files",icon:tr,label:"Files",onClick:()=>r("files")},{id:"git",icon:Gt,label:"Git",onClick:()=>r("git")},{id:"workflows",icon:cr,label:"Workflows",onClick:()=>r("workflows")},...!!(a&&n)?[{id:"tasks",icon:yo,label:"Tasks",onClick:()=>r("tasks")}]:[]];return e.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 px-3 pb-[max(8px,env(safe-area-inset-bottom))] transform transition-transform duration-300 ease-in-out ${s?"translate-y-full":"translate-y-0"}`,children:e.jsx("div",{className:"nav-glass mobile-nav-float rounded-2xl border border-border/30",children:e.jsx("div",{className:"flex items-center justify-around px-1 py-1.5 gap-0.5",children:i.map(l=>{const m=l.icon,d=t===l.id;return e.jsxs("button",{onClick:l.onClick,onTouchStart:u=>{u.preventDefault(),l.onClick()},className:`flex flex-col items-center justify-center gap-0.5 px-3 py-2 rounded-xl flex-1 relative touch-manipulation transition-all duration-200 active:scale-95 ${d?"text-primary":"text-muted-foreground hover:text-foreground"}`,"aria-label":l.label,"aria-current":d?"page":void 0,children:[d&&e.jsx("div",{className:"absolute inset-0 bg-primary/8 dark:bg-primary/12 rounded-xl"}),e.jsx(m,{className:`relative z-10 transition-all duration-200 ${d?"w-5 h-5":"w-[18px] h-[18px]"}`,strokeWidth:d?2.4:1.8}),e.jsx("span",{className:`relative z-10 text-[10px] font-medium transition-all duration-200 ${d?"opacity-100":"opacity-60"}`,children:l.label})]},l.id)})})})})}function wx(){const[t,r]=c.useState(new Set),[s,a]=c.useState(new Set),n=c.useCallback(d=>{d&&r(u=>new Set([...u,d]))},[]),o=c.useCallback(d=>{d&&r(u=>{const g=new Set(u);return g.delete(d),g})},[]),i=c.useCallback(d=>{d&&a(u=>new Set([...u,d]))},[]),l=c.useCallback(d=>{d&&a(u=>{const g=new Set(u);return g.delete(d),g})},[]),m=c.useCallback(d=>{d&&r(u=>{const g=new Set;for(const p of u)p.startsWith("new-session-")||g.add(p);return g.add(d),g})},[]);return{activeSessions:t,processingSessions:s,markSessionAsActive:n,markSessionAsInactive:o,markSessionAsProcessing:i,markSessionAsNotProcessing:l,replaceTemporarySession:m}}const yt=t=>JSON.stringify(t??null),io=(t,r,s)=>t.length!==r.length?!0:r.some((a,n)=>{const o=t[n];return!o||a.name!==o.name||a.displayName!==o.displayName||a.fullPath!==o.fullPath||yt(a.sessionMeta)!==yt(o.sessionMeta)||yt(a.sessions)!==yt(o.sessions)?!0:yt(a.cursorSessions)!==yt(o.cursorSessions)||yt(a.codexSessions)!==yt(o.codexSessions)}),As=t=>[...t.sessions??[],...t.codexSessions??[],...t.cursorSessions??[]],jx=(t,r,s,a)=>{if(!s||!a)return!0;const n=t.find(m=>m.name===s.name),o=r.find(m=>m.name===s.name);if(!n||!o)return!1;const i=As(n).find(m=>m.id===a.id),l=As(o).find(m=>m.id===a.id);return!i||!l?!1:i.id===l.id&&i.title===l.title&&i.created_at===l.created_at&&i.updated_at===l.updated_at};function Nx({sessionId:t,navigate:r,latestMessage:s,isMobile:a,activeSessions:n}){const[o,i]=c.useState([]),[l,m]=c.useState(null),[d,u]=c.useState(null),[g,p]=c.useState("chat"),[x,f]=c.useState(!1),[h,b]=c.useState(!0),[C,I]=c.useState(null),[y,v]=c.useState(!1),[A,M]=c.useState(!1),[$,k]=c.useState("agents"),[T,W]=c.useState(0),U=c.useRef(null),S=c.useRef(new Set),H=c.useCallback(async()=>{try{b(!0);const se=await(await He.projects()).json();i(J=>J.length===0||io(J,se,!0)?se:J)}catch(E){console.error("Error fetching projects:",E)}finally{b(!1)}},[]),w=c.useCallback((E="tools")=>{k(E),M(!0)},[]);c.useEffect(()=>{H()},[H]),c.useEffect(()=>{!h&&o.length===1&&!l&&!t&&m(o[0])},[h,o,l,t]),c.useEffect(()=>{if(!s)return;if(s.type==="loading_progress"){U.current&&(clearTimeout(U.current),U.current=null),I(s),s.phase==="complete"&&(U.current=setTimeout(()=>{I(null),U.current=null},500));return}if(s.type!=="projects_updated")return;const E=s;if(E.changedFile&&d&&l){const z=E.changedFile.replace(/\\/g,"/").split("/");z.length>=2&&z[z.length-1].replace(".jsonl","")===d.id&&(n.has(d.id)||W(q=>q+1))}const se=d&&n.has(d.id)||n.size>0&&Array.from(n).some(V=>V.startsWith("new-session-")),J=E.projects;if(se&&!jx(o,J,l,d)||(i(J),!l))return;const B=J.find(V=>V.name===l.name);if(!B||(yt(B)!==yt(l)&&m(B),!d))return;As(B).find(V=>V.id===d.id)||u(null)},[s,l,d,n,o]),c.useEffect(()=>()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),c.useEffect(()=>{var se,J,B;if(!t||o.length===0)return;const E=!d||d.id!==t;for(const K of o){const V=(se=K.sessions)==null?void 0:se.find(ne=>ne.id===t);if(V){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="claude";ne&&m(K),me&&u({...V,__provider:"claude"}),E&&p("chat");return}const z=(J=K.cursorSessions)==null?void 0:J.find(ne=>ne.id===t);if(z){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="cursor";ne&&m(K),me&&u({...z,__provider:"cursor"}),E&&p("chat");return}const O=(B=K.codexSessions)==null?void 0:B.find(ne=>ne.id===t);if(O){const ne=(l==null?void 0:l.name)!==K.name,me=(d==null?void 0:d.id)!==t||d.__provider!=="codex";ne&&m(K),me&&u({...O,__provider:"codex"}),E&&p("chat");return}}},[t,o,l==null?void 0:l.name,d==null?void 0:d.id,d==null?void 0:d.__provider]);const P=c.useCallback(E=>{m(E),u(null),r("/"),a&&f(!1)},[a,r]),j=c.useCallback(E=>{if(u(E),g!=="git"&&g!=="preview"&&p("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",E.id),a){const J=E.__projectName,B=l==null?void 0:l.name;J!==B&&f(!1)}r(`/session/${E.id}`)},[g,a,r,l==null?void 0:l.name]),F=c.useCallback(E=>{m(E),u(null),p("chat"),r("/"),a&&f(!1)},[a,r]),G=c.useCallback(E=>{S.current.add(E),setTimeout(()=>S.current.delete(E),3e4),(d==null?void 0:d.id)===E&&(u(null),r("/")),i(se=>se.map(J=>{var B,K;return{...J,sessions:((B=J.sessions)==null?void 0:B.filter(V=>V.id!==E))??[],sessionMeta:{...J.sessionMeta,total:Math.max(0,(((K=J.sessionMeta)==null?void 0:K.total)??0)-1)}}}))},[r,d==null?void 0:d.id]),X=c.useCallback(async()=>{try{let se=await(await He.projects()).json();if(S.current.size>0&&(se=se.map(K=>{var V;return{...K,sessions:((V=K.sessions)==null?void 0:V.filter(z=>!S.current.has(z.id)))??[]}})),i(K=>io(K,se,!0)?se:K),!l)return;const J=se.find(K=>K.name===l.name);if(!J||(yt(J)!==yt(l)&&m(J),!d))return;const B=As(J).find(K=>K.id===d.id);if(B){const K=B.__provider||!d.__provider?B:{...B,__provider:d.__provider};yt(K)!==yt(d)&&u(K)}}catch(E){console.error("Error refreshing sidebar:",E)}},[l,d]),D=c.useCallback(E=>{(l==null?void 0:l.name)===E&&(m(null),u(null),r("/")),i(se=>se.filter(J=>J.name!==E))},[r,l==null?void 0:l.name]),oe=c.useMemo(()=>({projects:o,selectedProject:l,selectedSession:d,onProjectSelect:P,onSessionSelect:j,onNewSession:F,onSessionDelete:G,onProjectDelete:D,isLoading:h,loadingProgress:C,onRefresh:X,onShowSettings:()=>M(!0),showSettings:A,settingsInitialTab:$,onCloseSettings:()=>M(!1),isMobile:a}),[F,D,P,G,j,X,h,a,C,o,$,l,d,A]);return{projects:o,selectedProject:l,selectedSession:d,activeTab:g,sidebarOpen:x,isLoadingProjects:h,loadingProgress:C,isInputFocused:y,showSettings:A,settingsInitialTab:$,externalMessageUpdate:T,setActiveTab:p,setSidebarOpen:f,setIsInputFocused:v,setShowSettings:M,openSettings:w,fetchProjects:H,sidebarSharedProps:oe,handleProjectSelect:P,handleSessionSelect:j,handleNewSession:F,handleSessionDelete:G,handleProjectDelete:D,handleSidebarRefresh:X}}function Cx(){const t=Ti(),{sessionId:r}=Ii(),{t:s}=Ge("common"),{isMobile:a}=Pa({trackPWA:!1}),{ws:n,sendMessage:o,latestMessage:i}=Ai(),{activeSessions:l,processingSessions:m,markSessionAsActive:d,markSessionAsInactive:u,markSessionAsProcessing:g,markSessionAsNotProcessing:p,replaceTemporarySession:x}=wx(),{selectedProject:f,selectedSession:h,activeTab:b,sidebarOpen:C,isLoadingProjects:I,isInputFocused:y,externalMessageUpdate:v,setActiveTab:A,setSidebarOpen:M,setIsInputFocused:$,setShowSettings:k,openSettings:T,fetchProjects:W,sidebarSharedProps:U}=Nx({sessionId:r,navigate:t,latestMessage:i,isMobile:a,activeSessions:l});return c.useEffect(()=>(window.refreshProjects=W,()=>{window.refreshProjects===W&&delete window.refreshProjects}),[W]),c.useEffect(()=>(window.openSettings=T,()=>{window.openSettings===T&&delete window.openSettings}),[T]),e.jsxs("div",{className:"fixed inset-0 flex bg-background",children:[a?e.jsxs("div",{className:`fixed inset-0 z-50 flex transition-all duration-150 ease-out ${C?"opacity-100 visible":"opacity-0 invisible"}`,children:[e.jsx("button",{className:"fixed inset-0 bg-background/60 backdrop-blur-sm transition-opacity duration-150 ease-out",onClick:S=>{S.stopPropagation(),M(!1)},onTouchStart:S=>{S.preventDefault(),S.stopPropagation(),M(!1)},"aria-label":s("versionUpdate.ariaLabels.closeSidebar")}),e.jsx("div",{className:`relative w-[85vw] max-w-sm sm:w-80 h-full bg-card border-r border-border/40 transform transition-transform duration-150 ease-out ${C?"translate-x-0":"-translate-x-full"}`,onClick:S=>S.stopPropagation(),onTouchStart:S=>S.stopPropagation(),children:e.jsx(bn,{...U})})]}):e.jsx("div",{className:"h-full flex-shrink-0 border-r border-border/50",children:e.jsx(bn,{...U})}),e.jsx("div",{className:`flex-1 flex flex-col min-w-0 ${a?"pb-mobile-nav":""}`,children:e.jsx(vx,{selectedProject:f,selectedSession:h,activeTab:b,setActiveTab:A,ws:n,sendMessage:o,latestMessage:i,isMobile:a,onMenuClick:()=>M(!0),isLoading:I,onInputFocusChange:$,onSessionActive:d,onSessionInactive:u,onSessionProcessing:g,onSessionNotProcessing:p,processingSessions:m,onReplaceTemporarySession:x,onNavigateToSession:S=>t(`/session/${S}`),onShowSettings:()=>k(!0),externalMessageUpdate:v})}),a&&e.jsx(kx,{activeTab:b,setActiveTab:A,isInputFocused:y})]})}const Fx=Object.freeze(Object.defineProperty({__proto__:null,default:Cx},Symbol.toStringTag,{value:"Module"}));export{Fx as A,In as _,$x as a,Lx as b};