codeplane-darwin-x64-baseline 31.0.1 → 31.0.2

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 (110) hide show
  1. package/bin/codeplane +0 -0
  2. package/bin/runtime/tui/{_baseUniq-D-gQv_o8-6k2k7rvy.js → _baseUniq-CAHbz7Vw-2ztfx65y.js} +1 -1
  3. package/bin/runtime/tui/{ar-CbghpXZr-xddskc2p.js → ar-BbgtuTrY-bv1aww1m.js} +1 -1
  4. package/bin/runtime/tui/{ar-6lpISk3N-64dnfqsp.js → ar-C8SrRDNy-fbxpscav.js} +1 -1
  5. package/bin/runtime/tui/{arc-BzEzntkX-xyx1p9x4.js → arc-BUWBfD8e-fqt6ycj7.js} +1 -1
  6. package/bin/runtime/tui/{architectureDiagram-Q4EWVU46-DUv_-p3o-yqttrhbq.js → architectureDiagram-Q4EWVU46-Cu3HYpWu-3pd84xzw.js} +1 -1
  7. package/bin/runtime/tui/{blockDiagram-DXYQGD6D-C-lzBEXN-fm1z4h19.js → blockDiagram-DXYQGD6D-C4qQLg4H-5rkf6ctp.js} +1 -1
  8. package/bin/runtime/tui/{br-DozJlpWI-rryvz7br.js → br-B3RxJiel-d306rf4n.js} +1 -1
  9. package/bin/runtime/tui/{br-DfDnqTzr-13zepykq.js → br-CBQyYD9J-neq0jpk8.js} +1 -1
  10. package/bin/runtime/tui/{bs-DNy4pDZz-a656x48s.js → bs-CIPDWPQK-9bdbdnst.js} +1 -1
  11. package/bin/runtime/tui/{bs-lzZZtt8a-0yd4h9v9.js → bs-LO_2RWv4-a7k6p4qs.js} +1 -1
  12. package/bin/runtime/tui/{c4Diagram-AHTNJAMY-Ci4SWFS5-6qk5kfvd.js → c4Diagram-AHTNJAMY-DOpUTLNX-s8rn9dpa.js} +1 -1
  13. package/bin/runtime/tui/channel-GiEB6w-E-2nb30ajw.js +1 -0
  14. package/bin/runtime/tui/{chunk-4BX2VUAB-BP0mg7Rb-59rv569g.js → chunk-4BX2VUAB-C65wii7K-fre08j7v.js} +1 -1
  15. package/bin/runtime/tui/{chunk-4TB4RGXK-DLoa18Qf-9k5ss598.js → chunk-4TB4RGXK-BVU_JG2u-v2zb95b1.js} +1 -1
  16. package/bin/runtime/tui/{chunk-55IACEB6-ILfxGSj5-aws2cev1.js → chunk-55IACEB6-EM5kgdgK-ak4a0m4y.js} +1 -1
  17. package/bin/runtime/tui/{chunk-EDXVE4YY-BYL2xRIm-swgnfmwf.js → chunk-EDXVE4YY-DNduO0Fn-7wve5zdn.js} +1 -1
  18. package/bin/runtime/tui/{chunk-FMBD7UC4-C_NiDIt4-tf5sfemn.js → chunk-FMBD7UC4-BmlWtyCS-hh4whbqk.js} +1 -1
  19. package/bin/runtime/tui/{chunk-OYMX7WX6-DX7zpdsd-h8899q0d.js → chunk-OYMX7WX6-DThOJ-6Z-8pdqhasv.js} +1 -1
  20. package/bin/runtime/tui/{chunk-QZHKN3VN-Cmbc9lB2-pkgna22w.js → chunk-QZHKN3VN-D3CJETi2-ahtyqrm3.js} +1 -1
  21. package/bin/runtime/tui/{chunk-YZCP3GAM-DVFM985d-5ss4f6ed.js → chunk-YZCP3GAM-Bhm-OX49-4e25de50.js} +1 -1
  22. package/bin/runtime/tui/classDiagram-6PBFFD2Q-Ei1SJWaE-97wy26sf.js +1 -0
  23. package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-Ei1SJWaE-97wy26sf.js +1 -0
  24. package/bin/runtime/tui/clone-B29TqGNh-gchsffwq.js +1 -0
  25. package/bin/runtime/tui/{cose-bilkent-S5V4N54A-CIi3p276-rqahypy0.js → cose-bilkent-S5V4N54A-DW13KQrW-mq7f6zbz.js} +1 -1
  26. package/bin/runtime/tui/{da-Be7PTuQJ-4y3yz8t5.js → da-BiwsKlvx-5e5eegfr.js} +1 -1
  27. package/bin/runtime/tui/{da-BCXGvqgR-h04h93gd.js → da-BlF8NGyE-g63ktq2g.js} +1 -1
  28. package/bin/runtime/tui/{dagre-KV5264BT-DZBwY33--kje8nqgj.js → dagre-KV5264BT-i_ujfCr--krwrfr3q.js} +1 -1
  29. package/bin/runtime/tui/{de-CL_kB-Ax-pdg5x2ms.js → de-Bm8YHQlH-79s02k4b.js} +1 -1
  30. package/bin/runtime/tui/{de-arLXL6UN-yw4e0xhn.js → de-D9p4fNmQ-f8epqzpf.js} +1 -1
  31. package/bin/runtime/tui/{diagram-5BDNPKRD-Dy-5aNbc-a8dd1tht.js → diagram-5BDNPKRD-CIuTAdP6-e3dsxh76.js} +1 -1
  32. package/bin/runtime/tui/{diagram-G4DWMVQ6-C44HlM6u-w6pr5ttc.js → diagram-G4DWMVQ6-x7rg761j-q8ckwb9x.js} +1 -1
  33. package/bin/runtime/tui/{diagram-MMDJMWI5-VtNEOU5V-zrghyk85.js → diagram-MMDJMWI5-B7ayT4w--q01z552a.js} +1 -1
  34. package/bin/runtime/tui/{diagram-TYMM5635-Cp0xfvtn-bwe6s7d4.js → diagram-TYMM5635-BFMCIZt3-dgyjnk5q.js} +1 -1
  35. package/bin/runtime/tui/{dialog-connect-provider-CN5IekW4-23k1we1x.js → dialog-connect-provider-Dx4RsF3a-9wy3ykeg.js} +2 -2
  36. package/bin/runtime/tui/{dialog-edit-project-BaDQYiCn-damkx3tv.js → dialog-edit-project-C3Ts6T46-yjhfend3.js} +1 -1
  37. package/bin/runtime/tui/{dialog-fork-ns7D-us_-b14y5m81.js → dialog-fork-DbAXHShi-mfwtra9v.js} +1 -1
  38. package/bin/runtime/tui/{dialog-manage-models-CDgTo3qi-1g3783qp.js → dialog-manage-models-BfxyBBJY-g53c0rkm.js} +1 -1
  39. package/bin/runtime/tui/{dialog-quick-switcher-pFYrhZ-f-6k95zzj4.js → dialog-quick-switcher-CexwhOml-5qn8x92k.js} +1 -1
  40. package/bin/runtime/tui/{dialog-select-directory-DzIjIMPs-hsd0xjfj.js → dialog-select-directory-DPAdW3ye-d0gmhesc.js} +1 -1
  41. package/bin/runtime/tui/{dialog-select-file-cn6fWKzC-a96wk8tz.js → dialog-select-file-95w_PqLP-svf8qe9x.js} +1 -1
  42. package/bin/runtime/tui/{dialog-select-mcp-KEE2ouTn-7svbeepw.js → dialog-select-mcp-WppljhbD-rmzrydtt.js} +1 -1
  43. package/bin/runtime/tui/{dialog-select-model-unpaid-DMwf_9yO-6ntwdjaq.js → dialog-select-model-unpaid-C_5dQVCz-7x7sjcsb.js} +2 -2
  44. package/bin/runtime/tui/{dialog-select-provider-74lMvL8g-jdhe1tjv.js → dialog-select-provider-DrIJ2cy4-tf4hkhqf.js} +1 -1
  45. package/bin/runtime/tui/{dialog-select-server-DrDwIvfa-8b7qpqvj.js → dialog-select-server-BznUeGih-1xydahht.js} +1 -1
  46. package/bin/runtime/tui/{erDiagram-SMLLAGMA-BiyXjR3_-npgpwsmj.js → erDiagram-SMLLAGMA-BNXDmiVE-gwztvsf3.js} +1 -1
  47. package/bin/runtime/tui/{es-VIN200QX-jbpfw78w.js → es-BUr5ZLRi-vrkrnt3c.js} +1 -1
  48. package/bin/runtime/tui/{es-CTzSjQIr-ycjt1qe7.js → es-DszcL9ow-jbam3c91.js} +1 -1
  49. package/bin/runtime/tui/{file-icon-Dm4kclYJ-3q8v5p17.js → file-icon-ERmEtnvf-36dyzwcc.js} +1 -1
  50. package/bin/runtime/tui/{flowDiagram-DWJPFMVM-DBzobYVV-4cj7ej0y.js → flowDiagram-DWJPFMVM-BqnDLkSA-0en8pzyq.js} +1 -1
  51. package/bin/runtime/tui/{fr-CJa19T6u-9s8h33zx.js → fr-C1f5tlDN-srfgbfy2.js} +1 -1
  52. package/bin/runtime/tui/{fr-DzMUS_ii-y0fbafxh.js → fr-DdTRG8PS-wrrphk88.js} +1 -1
  53. package/bin/runtime/tui/{ganttDiagram-T4ZO3ILL-DEz8pXJ3-8dgccj3k.js → ganttDiagram-T4ZO3ILL-Jumvk3JC-by7h568t.js} +1 -1
  54. package/bin/runtime/tui/{ghostty-web-CCdQQkL7-vcgsxfbc.js → ghostty-web-D6Di0TIV-tr98stsw.js} +1 -1
  55. package/bin/runtime/tui/{gitGraphDiagram-UUTBAWPF-B1xy3eyT-rm797zm4.js → gitGraphDiagram-UUTBAWPF-DPvs1hqN-4yxbasq6.js} +1 -1
  56. package/bin/runtime/tui/{graph-DvL8RI7R-t9err57x.js → graph-C6_QFoWn-zgbj1krx.js} +1 -1
  57. package/bin/runtime/tui/{home-DmuoxI-n-cbq58d0z.js → home-Tnq043rk-wqxsrnaf.js} +1 -1
  58. package/bin/runtime/tui/{index-9ak87jz6.html → index-1c3bmck8.html} +1 -1
  59. package/bin/runtime/tui/{index-D48wTpzk-szaxbs1f.js → index-BYGEr28T-79q2xqte.js} +7 -7
  60. package/bin/runtime/tui/{infoDiagram-42DDH7IO-CY9a-T0--59697tzy.js → infoDiagram-42DDH7IO-EW3wbn9T-4esgtj78.js} +1 -1
  61. package/bin/runtime/tui/{ishikawaDiagram-UXIWVN3A-B_zWGeIb-nhxjv6ss.js → ishikawaDiagram-UXIWVN3A-rIoEgmiV-t73vg52f.js} +1 -1
  62. package/bin/runtime/tui/{ja-C_rqNeyK-d5m11qwp.js → ja-Cj8jQmok-kk1mfg41.js} +1 -1
  63. package/bin/runtime/tui/{ja-W0HyNRpZ-p7vnmt5z.js → ja-Cl4E1_M7-1q9rsxcv.js} +1 -1
  64. package/bin/runtime/tui/{journeyDiagram-VCZTEJTY-COocfWw3-f1vhrm05.js → journeyDiagram-VCZTEJTY-D3pXisUW-y3bgz57t.js} +1 -1
  65. package/bin/runtime/tui/{kanban-definition-6JOO6SKY-BgGSdigx-9sn2agv0.js → kanban-definition-6JOO6SKY-D3yikjoM-acd1vpfa.js} +1 -1
  66. package/bin/runtime/tui/{ko-BKwHV3vR-cwtt2e1y.js → ko-DCOoR8nb-xxmb9eka.js} +1 -1
  67. package/bin/runtime/tui/{ko-DqkeoNPv-jncv5w2a.js → ko-DKWKg5l0-5kt5rv4n.js} +1 -1
  68. package/bin/runtime/tui/{layout-DcTrawCj-7ymma8jn.js → layout-DyD1y-LU-adxmbwxk.js} +1 -1
  69. package/bin/runtime/tui/{linear-BXvbBpfd-68kdcp26.js → linear-Mg6JBvsP-yn2m1xrq.js} +1 -1
  70. package/bin/runtime/tui/{list-BhXg9dyU-fkk1cmff.js → list-Clic9hNL-bzxccg7x.js} +1 -1
  71. package/bin/runtime/tui/{mermaid.core-Dsy-0un3-qgkgx3rh.js → mermaid.core-BBuk9zib-v1pg1bac.js} +5 -5
  72. package/bin/runtime/tui/{min-DlkmFtOU-qgzj2239.js → min-BI2lsGvT-0e4csnjp.js} +1 -1
  73. package/bin/runtime/tui/{mindmap-definition-QFDTVHPH-CHIWweIj-3psfws1p.js → mindmap-definition-QFDTVHPH-CN9OJK8d-0y5dm85d.js} +1 -1
  74. package/bin/runtime/tui/{no-rQ37yaFw-5egj9f84.js → no-BRXk9xy7-0d14mpz3.js} +1 -1
  75. package/bin/runtime/tui/{no-B5JtAosN-mrnnf4v9.js → no-DFWXB4Cq-0vwfsvrd.js} +1 -1
  76. package/bin/runtime/tui/node-main.js +2 -2
  77. package/bin/runtime/tui/{notifications-Dbohk8s9-dr75zv25.js → notifications-BCwX5WR0-f6pfj6rk.js} +1 -1
  78. package/bin/runtime/tui/{pieDiagram-DEJITSTG-CgnyIsOv-1kvkw7fy.js → pieDiagram-DEJITSTG-Dob4Rv1z-k6jwv6pe.js} +1 -1
  79. package/bin/runtime/tui/{pl-Cfp4mT9v-3dbwbhrv.js → pl-CRFIGIaj-v335a8zj.js} +1 -1
  80. package/bin/runtime/tui/{pl-C0zTM4jx-fwk2w5wr.js → pl-Cbs-5hry-3cndq089.js} +1 -1
  81. package/bin/runtime/tui/{provider-icon-CNc0gQ9T-fgt112yp.js → provider-icon-Cu61Vlk5-f79dwcb4.js} +1 -1
  82. package/bin/runtime/tui/{quadrantDiagram-34T5L4WZ-p8cjFAs7-ze4qg7fq.js → quadrantDiagram-34T5L4WZ-BZtHChLt-1p86yvtd.js} +1 -1
  83. package/bin/runtime/tui/{requirementDiagram-MS252O5E-B2A8ibYP-n4nc4jb7.js → requirementDiagram-MS252O5E-DB1jsNXq-fp5em4dm.js} +1 -1
  84. package/bin/runtime/tui/{ru-B2NdDoEN-7gpbawbj.js → ru-BYT4vXMJ-3zvyt0a7.js} +1 -1
  85. package/bin/runtime/tui/{ru-8z35hSrI-yke2f0ta.js → ru-CVWtyMAI-szax1993.js} +1 -1
  86. package/bin/runtime/tui/{sankeyDiagram-XADWPNL6-CRgs2pSV-5j5z1kva.js → sankeyDiagram-XADWPNL6-C5hsF3oz-6jg206gc.js} +1 -1
  87. package/bin/runtime/tui/{sequenceDiagram-FGHM5R23-mbiaStyX-hdf421b1.js → sequenceDiagram-FGHM5R23-Dq1S1gyk-fs8t2j20.js} +1 -1
  88. package/bin/runtime/tui/{session-B4xi1_Zm-hs4dm2me.js → session-DWPkCj4g-2d28j65a.js} +6 -6
  89. package/bin/runtime/tui/{settings-BNckNfnG-8wsh8k4g.js → settings-DUWDvVXr-9ttkw898.js} +1 -1
  90. package/bin/runtime/tui/{stateDiagram-FHFEXIEX-DgTGC1_9-qxjpk0tg.js → stateDiagram-FHFEXIEX-B7eGkSw_-gqh2e0x8.js} +1 -1
  91. package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-DYhFFGNP-pr2fp0nm.js +1 -0
  92. package/bin/runtime/tui/{th-C6_Mrk5R-rj7jegja.js → th-B_pp2URV-fd6mnvh5.js} +1 -1
  93. package/bin/runtime/tui/{th-DTVxE1A--0bat8941.js → th-CAnW1OhO-bqeag5r2.js} +1 -1
  94. package/bin/runtime/tui/{timeline-definition-GMOUNBTQ-BvLbQOXe-q7d8q78n.js → timeline-definition-GMOUNBTQ-x0gQcFKs-zycbzjtn.js} +1 -1
  95. package/bin/runtime/tui/{tr-mnO_Sfr1-h18r7218.js → tr-CySPu43v-2phr3dxj.js} +1 -1
  96. package/bin/runtime/tui/{tr-C7NpHcnh-8pk6ps2y.js → tr-DpR8rZo9-mxevbymp.js} +1 -1
  97. package/bin/runtime/tui/{vennDiagram-DHZGUBPP-CJZiKs9J-7fsy77ja.js → vennDiagram-DHZGUBPP-BDU6DOW_-dz5hgta7.js} +1 -1
  98. package/bin/runtime/tui/{wardley-RL74JXVD-CRbS-hCM-5x57rspa.js → wardley-RL74JXVD-BlOnmaAF-732nnyx7.js} +1 -1
  99. package/bin/runtime/tui/{wardleyDiagram-NUSXRM2D-JvDWOoUK-jb93zgb1.js → wardleyDiagram-NUSXRM2D-DOSfbHIu-yezq8nd0.js} +1 -1
  100. package/bin/runtime/tui/{xychartDiagram-5P7HB3ND-DwgA9txK-mx375259.js → xychartDiagram-5P7HB3ND-B-wnNK_O-wqydm474.js} +1 -1
  101. package/bin/runtime/tui/{zh-BVW2efjH-v46tsbh3.js → zh-BBvy3TYC-abymwbw6.js} +1 -1
  102. package/bin/runtime/tui/{zh-nLHDAlnH-q9z5y0f7.js → zh-CoAGjE_j-2ngscf86.js} +1 -1
  103. package/bin/runtime/tui/{zht-C-wpCE8R-9ybym8c5.js → zht-C4aW5SLs-se3vap7v.js} +1 -1
  104. package/bin/runtime/tui/{zht-BvnLB218-26w1bm9e.js → zht-QWx3VtcS-3axa3ytf.js} +1 -1
  105. package/package.json +1 -1
  106. package/bin/runtime/tui/channel-DKMYbmLw-37g899qw.js +0 -1
  107. package/bin/runtime/tui/classDiagram-6PBFFD2Q-owKAn3mE-xeggsnrr.js +0 -1
  108. package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-owKAn3mE-xeggsnrr.js +0 -1
  109. package/bin/runtime/tui/clone-DTTN6RlV-d9ayj751.js +0 -1
  110. package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-18eXPx8Y-9gmztxef.js +0 -1
@@ -1 +1 @@
1
- import{l as i,y as w,aF as vt,f as q,aG as bt,C as ee,aH as tt,aI as xt,e as je,b as Z,E as ge,J as Te,j as M,m as n,q as F,N as Q,O as G,aJ as ve,a3 as K,B as O,p as A,T as U,aK as wt,aL as kt,aM as $t,aN as yt,aO as _t,aP as Ct,X as Ie,z as N,aQ as St,aR as Dt,aS as Et,aT as Pt,t as ce,v as be,aU as jt,Q as Ae,al as zt,h as me,o as It,L as X,V as Ft,aV as Lt,aE as Mt,ao as Ot,I as Y,R as ie,a7 as rt,aa as De,a8 as te,i as re,aq as ae,w as nt,aW as it,aj as Ee,aX as st,c as lt,a4 as Rt,u as Ut,k as Nt,aY as Tt,aZ as At,a_ as Kt,a$ as qt,b0 as Wt}from"./index-D48wTpzk.js";import{f as Vt}from"./list-BhXg9dyU.js";import{P as ke}from"./provider-icon-CNc0gQ9T.js";import{D as Bt}from"./dialog-connect-provider-CN5IekW4.js";import{a as Gt,D as Ht}from"./dialog-select-provider-74lMvL8g.js";function Pe(e){return e.granted||e.restartRequired===!0}function ne(e){return!Pe(e)||e.restartRequired?!1:e.active!==!1}function ye(e){return Pe(e)&&!ne(e)}var Jt=w('<div class="bg-surface-base px-4 rounded-lg">');const le=e=>(()=>{var t=Jt();return i(t,()=>e.children),t})();var Qt=w("<div data-action=settings-auto-accept-permissions>"),Xt=w("<div data-action=settings-codeplane-coauthor>"),Yt=w("<div data-action=settings-feed-reasoning-summaries>"),Zt=w("<div data-action=settings-feed-shell-tool-parts-expanded>"),er=w("<div data-action=settings-feed-edit-tool-parts-expanded>"),tr=w("<div data-action=settings-show-session-progress-bar>"),rr=w("<div data-action=settings-browser-use>"),nr=w("<div data-action=settings-computer-use>"),ir=w("<div data-action=settings-debug-logging>"),sr=w('<div class="flex flex-col gap-1">'),lr=w("<div data-action=settings-show-file-tree>"),or=w("<div data-action=settings-show-navigation>"),ar=w("<div data-action=settings-show-search>"),cr=w("<div data-action=settings-show-terminal>"),dr=w("<div data-action=settings-show-status>"),_e=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Fe=w('<div class="w-full sm:w-[220px]">'),ur=w("<div data-action=settings-notifications-agent>"),gr=w("<div data-action=settings-notifications-permissions>"),mr=w("<div data-action=settings-notifications-errors>"),pr=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2"></h3><div class=pt-2>'),fr=w('<div data-action=settings-check-update class="flex gap-2 items-center">'),hr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">'),vr=w('<div><div class="flex flex-col gap-8 w-full">'),br=w('<p class="text-12-regular text-text-weak leading-relaxed">'),xr=w('<div class="flex w-full flex-col gap-4 px-5 pb-5"><p class="text-14-regular text-text-base leading-relaxed"></p><div class="flex items-center justify-between gap-3"><span></span></div><div class="flex flex-col gap-2"></div><div class="flex flex-col-reverse gap-2 border-t border-border-weak-base pt-3 sm:flex-row sm:items-center sm:justify-between"><div class="flex flex-col-reverse gap-2 sm:flex-row sm:items-center">'),wr=w('<div class="sm:shrink-0 sm:pt-0.5">'),kr=w('<div><div class="flex min-w-0 flex-1 flex-col gap-1.5"><div class="flex items-center gap-2"><span class="text-14-medium text-text-strong"></span><span></span></div><span class="text-12-regular text-text-weak leading-relaxed">'),$r=w('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let oe={cleanup:void 0,timeout:void 0,run:0};const ot=()=>{oe.run+=1,oe.cleanup&&oe.cleanup(),clearTimeout(oe.timeout),oe.cleanup=void 0},Ve=e=>{if(ot(),!e)return;const t=++oe.run;oe.timeout=setTimeout(()=>{jt(e).then(r=>{if(oe.run!==t){r?.();return}oe.cleanup=r})},100)},yr=e=>{const t=vt(),r=q(),u=bt(),a=ee(),o=tt(),f=xt(),l=je(),c=Z(),[h,k]=ge(!1),b=async()=>{k(!0);try{return await f.recheck(!1)}finally{k(!1)}},D=()=>f.status();Te(()=>{b(),(a.data.config.tools?.browser===void 0||a.data.config.tools?.computer===void 0)&&a.updateConfig({tools:{...a.data.config.tools,browser:a.data.config.tools?.browser??o.general.browserUse(),computer:a.data.config.tools?.computer??o.general.computerUse()}})});const m=M(()=>u.isGlobalAutoAccept()),S=E=>u.setGlobalAutoAccept(E),v=M(()=>a.data.config.commit?.coauthor===!0),s=E=>a.updateConfig({commit:{coauthor:E}}),g=M(()=>a.data.config.tools?.browser??o.general.browserUse()),d=M(()=>a.data.config.tools?.computer??o.general.computerUse()),_=M(()=>{const E=l.serverManager;if(!E)return;const C=E.currentKey??E.defaultKey??E.instances[0]?.key;return E.instances.find(y=>y.key===C)}),[$,x]=ge(!1),p=(E,C)=>{if(E==="browser"){o.general.setBrowserUse(C),a.updateConfig({tools:{browser:C}});return}if(!C){o.general.setComputerUse(!1),a.updateConfig({tools:{computer:!1}});return}(async()=>{if(!l.systemPermissions){o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}});return}if((await l.systemPermissions.check()).permissions.filter(W=>!ne(W)).length===0){o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}});return}c.show(()=>n(Cr,{tool:"computer",onConfirmEnable:()=>{o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}})}}))})()},z=()=>{const E=_();!E?.local||!l.serverManager||(x(!0),l.serverManager.openLogDir(E.id).then(C=>{if(!C)throw new Error(r.t("settings.general.row.instanceLogs.unavailable"))}).catch(C=>{N({variant:"error",title:r.t("common.requestFailed"),description:C instanceof Error?C.message:String(C)})}).finally(()=>x(!1)))},j=M(()=>[{value:"system",label:r.t("theme.scheme.system")},{value:"light",label:r.t("theme.scheme.light")},{value:"dark",label:r.t("theme.scheme.dark")}]),P=M(()=>r.locales.map(E=>({value:E,label:r.label(E)}))),L=M(()=>[{value:"queue",label:r.t("settings.general.row.followup.option.queue")},{value:"steer",label:r.t("settings.general.row.followup.option.steer")}]),V=M(()=>[{value:"short",label:"Short"},{value:"full",label:"Full"},{value:"off",label:"Off"}]),I={id:"none",label:"sound.option.none"},H=[I,...Pt],pe=()=>Dt(o.appearance.font()),de=()=>St(o.appearance.uiFont()),B=()=>Et(o.appearance.terminalFont()),se=()=>e.layout==="page",fe=(E,C,y,R)=>({options:H,current:E()?H.find(W=>W.id===C())??I:I,value:W=>W.id,label:W=>r.t(W.label),onHighlight:W=>{W&&Ve(W.id==="none"?void 0:W.id)},onSelect:W=>{if(W){if(W.id==="none"){y(!1),ot();return}y(!0),R(W.id),Ve(W.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),J=()=>(()=>{var E=sr();return i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.language.title")},get description(){return r.t("settings.general.row.language.description")},get children(){return n(ve,{"data-action":"settings-language",get options(){return P()},get current(){return P().find(C=>C.value===r.locale())},value:C=>C.value,label:C=>C.label,onSelect:C=>C&&r.setLocale(C.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),n(T,{get title(){return r.t("command.permissions.autoaccept.enable")},get description(){return r.t("toast.permissions.autoaccept.on.description")},get children(){var C=Qt();return i(C,n(K,{get checked(){return m()},onChange:S})),C}}),n(T,{get title(){return r.t("settings.general.row.followup.title")},get description(){return r.t("settings.general.row.followup.description")},get children(){return n(ve,{"data-action":"settings-followup-behavior",get options(){return L()},get current(){return L().find(C=>C.value===o.general.followup())},value:C=>C.value,label:C=>C.label,onSelect:C=>C&&o.general.setFollowup(C.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),n(T,{get title(){return r.t("settings.general.row.codeplaneCoauthor.title")},get description(){return r.t("settings.general.row.codeplaneCoauthor.description")},get children(){var C=Xt();return i(C,n(K,{get checked(){return v()},onChange:y=>void s(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.reasoningSummaries.title")},get description(){return r.t("settings.general.row.reasoningSummaries.description")},get children(){var C=Yt();return i(C,n(ve,{get options(){return V()},get current(){return V().find(y=>y.value===o.general.reasoningDisplay())},value:y=>y.value,label:y=>y.label,onSelect:y=>y&&o.general.setReasoningDisplay(y.value),variant:"secondary",size:"small",triggerVariant:"settings"})),C}}),n(T,{get title(){return r.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return r.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var C=Zt();return i(C,n(K,{get checked(){return o.general.shellToolPartsExpanded()},onChange:y=>o.general.setShellToolPartsExpanded(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.editToolPartsExpanded.title")},get description(){return r.t("settings.general.row.editToolPartsExpanded.description")},get children(){var C=er();return i(C,n(K,{get checked(){return o.general.editToolPartsExpanded()},onChange:y=>o.general.setEditToolPartsExpanded(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.showSessionProgressBar.title")},get description(){return r.t("settings.general.row.showSessionProgressBar.description")},get children(){var C=tr();return i(C,n(K,{get checked(){return o.general.showSessionProgressBar()},onChange:y=>o.general.setShowSessionProgressBar(y)})),C}}),n(F,{get when(){return f.hasDesktopBridge()},get children(){return[n(T,{get title(){return r.t("settings.general.row.browserUse.title")},get description(){return r.t("settings.general.row.browserUse.description")},get children(){var C=rr();return i(C,n(K,{get checked(){return g()},onChange:y=>p("browser",y)})),C}}),n(T,{get title(){return r.t("settings.general.row.computerUse.title")},get description(){return r.t("settings.general.row.computerUse.description")},get children(){var C=nr();return i(C,n(K,{get checked(){return d()},onChange:y=>p("computer",y)})),C}}),n(T,{get title(){return r.t("settings.general.row.debugLogging.title")},get description(){return r.t("settings.general.row.debugLogging.description")},get children(){var C=ir();return i(C,n(K,{get checked(){return o.general.debugLogging()},onChange:y=>o.general.setDebugLogging(y)})),C}}),n(F,{get when(){return _()?.local},get children(){return n(T,{get title(){return r.t("settings.general.row.instanceLogs.title")},get description(){return r.t("settings.general.row.instanceLogs.description")},get children(){return n(O,{type:"button",size:"small",variant:"secondary",icon:"folder","data-action":"settings-open-instance-logs",onClick:C=>{C.preventDefault(),z()},get disabled(){return $()},get children(){return A(()=>!!$())()?r.t("settings.general.row.instanceLogs.action.opening"):r.t("settings.general.row.instanceLogs.action.open")}})}})}})]}})]}})),E})(),he=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.advanced")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.showFileTree.title")},get description(){return r.t("settings.general.row.showFileTree.description")},get children(){var y=lr();return i(y,n(K,{get checked(){return o.general.showFileTree()},onChange:R=>o.general.setShowFileTree(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showNavigation.title")},get description(){return r.t("settings.general.row.showNavigation.description")},get children(){var y=or();return i(y,n(K,{get checked(){return o.general.showNavigation()},onChange:R=>o.general.setShowNavigation(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showSearch.title")},get description(){return r.t("settings.general.row.showSearch.description")},get children(){var y=ar();return i(y,n(K,{get checked(){return o.general.showSearch()},onChange:R=>o.general.setShowSearch(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showTerminal.title")},get description(){return r.t("settings.general.row.showTerminal.description")},get children(){var y=cr();return i(y,n(K,{get checked(){return o.general.showTerminal()},onChange:R=>o.general.setShowTerminal(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showStatus.title")},get description(){return r.t("settings.general.row.showStatus.description")},get children(){var y=dr();return i(y,n(K,{get checked(){return o.general.showStatus()},onChange:R=>o.general.setShowStatus(R)})),y}})]}}),null),E})(),we=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.appearance")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.colorScheme.title")},get description(){return r.t("settings.general.row.colorScheme.description")},get children(){return n(ve,{"data-action":"settings-color-scheme",get options(){return j()},get current(){return j().find(y=>y.value===t.colorScheme())},value:y=>y.value,label:y=>y.label,onSelect:y=>y&&t.setColorScheme(y.value),onHighlight:y=>{if(y)return t.previewColorScheme(y.value),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),n(T,{get title(){return r.t("settings.general.row.uiFont.title")},get description(){return r.t("settings.general.row.uiFont.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-ui-font",get label(){return r.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return de()},onChange:R=>o.appearance.setUIFont(R),placeholder:wt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":kt(o.appearance.uiFont())}}})),y}}),n(T,{get title(){return r.t("settings.general.row.font.title")},get description(){return r.t("settings.general.row.font.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-code-font",get label(){return r.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return pe()},onChange:R=>o.appearance.setFont(R),placeholder:$t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":yt(o.appearance.font())}}})),y}}),n(T,{get title(){return r.t("settings.general.row.terminalFont.title")},get description(){return r.t("settings.general.row.terminalFont.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-terminal-font",get label(){return r.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return B()},onChange:R=>o.appearance.setTerminalFont(R),placeholder:_t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ct(o.appearance.terminalFont())}}})),y}})]}}),null),E})(),dt=async()=>{if(typeof window>"u")return!1;const E=window.codeplaneDesktop;return E?.notifications?.isSupported?await E.notifications.isSupported().catch(()=>!1):"Notification"in window?Notification.permission==="granted"?!0:Notification.permission==="denied"?!1:await Notification.requestPermission().catch(()=>"denied")==="granted":!1},ze=(E,C)=>async y=>{if(!y){C(!1);return}if(!await dt()){C(!1);return}C(!0)},ut=()=>{l.notify?.(r.t("settings.general.notifications.test.title"),r.t("settings.general.notifications.test.body"),"/").catch(()=>{})},gt=()=>(()=>{var E=pr(),C=E.firstChild,y=C.nextSibling;return i(C,()=>r.t("settings.general.section.notifications")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.notifications.agent.title")},get description(){return r.t("settings.general.notifications.agent.description")},get children(){var R=ur();return i(R,n(K,{get checked(){return o.notifications.agent()},get onChange(){return ze(o.notifications.agent(),W=>o.notifications.setAgent(W))}})),R}}),n(T,{get title(){return r.t("settings.general.notifications.permissions.title")},get description(){return r.t("settings.general.notifications.permissions.description")},get children(){var R=gr();return i(R,n(K,{get checked(){return o.notifications.permissions()},get onChange(){return ze(o.notifications.permissions(),W=>o.notifications.setPermissions(W))}})),R}}),n(T,{get title(){return r.t("settings.general.notifications.errors.title")},get description(){return r.t("settings.general.notifications.errors.description")},get children(){var R=mr();return i(R,n(K,{get checked(){return o.notifications.errors()},get onChange(){return ze(o.notifications.errors(),W=>o.notifications.setErrors(W))}})),R}})]}}),y),i(y,n(O,{variant:"secondary",size:"small",onClick:ut,"data-action":"settings-notifications-test",get children(){return r.t("settings.general.notifications.test.button")}})),E})(),mt=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.sounds")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.sounds.agent.title")},get description(){return r.t("settings.general.sounds.agent.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-agent"},()=>fe(()=>o.sounds.agentEnabled(),()=>o.sounds.agent(),y=>o.sounds.setAgentEnabled(y),y=>o.sounds.setAgent(y))))}}),n(T,{get title(){return r.t("settings.general.sounds.permissions.title")},get description(){return r.t("settings.general.sounds.permissions.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-permissions"},()=>fe(()=>o.sounds.permissionsEnabled(),()=>o.sounds.permissions(),y=>o.sounds.setPermissionsEnabled(y),y=>o.sounds.setPermissions(y))))}}),n(T,{get title(){return r.t("settings.general.sounds.errors.title")},get description(){return r.t("settings.general.sounds.errors.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-errors"},()=>fe(()=>o.sounds.errorsEnabled(),()=>o.sounds.errors(),y=>o.sounds.setErrorsEnabled(y),y=>o.sounds.setErrors(y))))}})]}}),null),E})(),pt=()=>{const E=D();if(!E&&h()||!E)return r.t("settings.general.row.version.descriptionLoading");const C=E.current==="local"||E.current==="dev"?r.t("settings.general.row.version.developmentBuild"):E.current;return E.method==="desktop"&&!f.hasDesktopBridge()?r.t("settings.general.row.version.descriptionDesktopManaged",{current:C}):E.method==="managed-local"?r.t("settings.general.row.version.descriptionManagedLocal",{current:C}):E.method==="unknown"?r.t("settings.general.row.version.descriptionUnknownMethod",{current:C}):E.hasUpdate&&E.latest?r.t("settings.general.row.version.descriptionHasUpdate",{current:C,latest:E.latest}):r.t("settings.general.row.version.descriptionUpToDate",{current:C})},ft=()=>{const E=D();return!(!E?.hasUpdate||!E.latest||E.method==="unknown"||E.method==="managed-local"||E.method==="desktop"&&!f.hasDesktopBridge())},ht=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.updates")),i(E,n(le,{get children(){return n(T,{get title(){return r.t("settings.general.row.version.title")},get description(){return pt()},get children(){var y=fr();return i(y,n(F,{get when(){return A(()=>!!D()?.current)()&&/^\d+\.\d+\.\d+/.test(D().current)},get children(){return n(O,{type:"button",size:"small",variant:"ghost",onClick:R=>{R.preventDefault(),f.openWhatsNew(D()?.current)},get disabled(){return f.isUpgrading()},get children(){return r.t("settings.general.row.version.action.whatsNew")}})}}),null),i(y,n(F,{get when(){return ft()},get fallback(){return n(O,{type:"button",size:"small",variant:"secondary",onClick:R=>{R.preventDefault(),b()},get disabled(){return h()||f.isUpgrading()},get children(){return A(()=>!!h())()?r.t("settings.general.row.version.action.checking"):r.t("settings.general.row.version.action.check")}})},get children(){return n(O,{type:"button",size:"small",variant:"primary",icon:"download",onClick:async R=>{R.preventDefault(),await f.startUpgrade(D()?.latest??void 0),await b()},get disabled(){return f.isUpgrading()},get children(){return A(()=>!!f.isUpgrading())()?r.t("settings.general.row.version.action.updating"):r.t("settings.general.row.version.action.update")}})}}),null),y}})}}),null),E})();return(()=>{var E=vr(),C=E.firstChild;return i(E,n(F,{get when(){return!se()},get children(){var y=hr(),R=y.firstChild,W=R.firstChild;return i(W,()=>r.t("settings.tab.general")),y}}),C),i(C,n(J,{}),null),i(C,n(we,{}),null),i(C,n(gt,{}),null),i(C,n(mt,{}),null),i(C,n(ht,{}),null),i(C,n(F,{get when(){return!1},get children(){return n(he,{})}}),null),Q(y=>G(E,{"flex flex-col":!0,"w-full":se(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!se()},y)),E})()};function _r(e){switch(e){case"accessibility":return"settings.general.row.computerUse.permissionDescription.accessibility";case"screen-recording":return"settings.general.row.computerUse.permissionDescription.screenRecording";default:return"settings.general.row.computerUse.permissionDescription.generic"}}function Cr(e){const t=q(),r=je(),u=Z(),[a,o]=ge(null),[f,l]=ge(!1),[c,h]=ge([]),[k,b]=ge(!1),D=async()=>{const x=await r.systemPermissions?.check();x&&h(x.permissions)};Te(()=>{D();const x=setInterval(()=>void D(),2e3),p=()=>void D();return window.addEventListener("focus",p),()=>{clearInterval(x),window.removeEventListener("focus",p)}});const m=()=>{e.onClose?.(),u.close()},S=async x=>{o(x);try{await r.systemPermissions?.request(x)}finally{o(null)}},v=async()=>{l(!0);try{await D()}finally{setTimeout(()=>l(!1),250)}},s=async()=>{b(!0);try{(await r.relaunchShell?.()??!1)||N({variant:"default",title:t.t("settings.general.row.computerUse.relaunchUnavailable.title"),description:t.t("settings.general.row.computerUse.relaunchUnavailable.description")})}finally{b(!1)}},g=()=>e.tool==="browser"?t.t("settings.general.row.browserUse.title"):t.t("settings.general.row.computerUse.title"),d=M(()=>c().length>0&&c().every(ne)),_=M(()=>c().some(ye)),$=M(()=>c().filter(ne).length);return n(be,{get title(){return t.t("settings.general.row.computerUse.permissionsTitle",{tool:g()})},fit:!0,class:"w-[calc(100vw-2rem)] max-w-[40rem]",transition:!0,get children(){var x=xr(),p=x.firstChild,z=p.nextSibling,j=z.firstChild,P=z.nextSibling,L=P.nextSibling,V=L.firstChild;return i(p,()=>t.t("settings.general.row.computerUse.permissionsBody",{tool:g(),count:String(c().length)})),i(j,n(ce,{get name(){return A(()=>!!d())()?"circle-check":_()?"reset":"circle-ban-sign"},class:"h-3.5 w-3.5"}),null),i(j,(()=>{var I=A(()=>!!d());return()=>I()?t.t("settings.general.row.computerUse.statusAllGranted"):A(()=>!!_())()?t.t("settings.general.row.computerUse.statusRelaunchRequired"):t.t("settings.general.row.computerUse.statusActivePartial",{active:String($()),total:String(c().length)})})(),null),i(z,n(O,{size:"small",variant:"ghost",get disabled(){return f()},onClick:I=>{I.preventDefault(),v()},get children(){return A(()=>!!f())()?t.t("settings.general.row.computerUse.recheckLoading"):t.t("settings.general.row.computerUse.recheck")}}),null),i(P,()=>c().map(I=>(()=>{var H=kr(),pe=H.firstChild,de=pe.firstChild,B=de.firstChild,se=B.nextSibling,fe=de.nextSibling;return i(de,n(ce,{get name(){return A(()=>!!ne(I))()?"circle-check":ye(I)?"reset":"circle-ban-sign"},get classList(){return{"h-4 w-4 shrink-0":!0,"text-text-on-success-strong":ne(I),"text-text-on-warning-strong":!ne(I)}}}),B),i(B,()=>I.label),i(se,(()=>{var J=A(()=>!!ne(I));return()=>J()?t.t("settings.general.row.computerUse.permissionGranted"):A(()=>!!ye(I))()?t.t("settings.general.row.computerUse.permissionRelaunchRequired"):t.t("settings.general.row.computerUse.permissionMissing")})()),i(fe,()=>t.t(_r(I.key))),i(H,n(F,{get when(){return!Pe(I)},get children(){var J=wr();return i(J,n(O,{size:"small",variant:"secondary",get disabled(){return a()===I.key},onClick:he=>{he.preventDefault(),S(I.key)},get children(){return A(()=>a()===I.key)()?t.t("settings.general.row.computerUse.permissionOpening"):t.t("settings.general.row.computerUse.permissionOpenSettings")}})),J}}),null),Q(J=>{var he={"flex flex-col gap-2 rounded-lg border px-3.5 py-3 sm:flex-row sm:items-start sm:justify-between":!0,"border-border-success-base bg-surface-success-weak/40":ne(I),"border-border-warning-base bg-surface-warning-weak/40":ye(I),"border-border-weak-base":!Pe(I)},we={"rounded-full px-1.5 py-0.5 text-11-medium":!0,"bg-surface-success-weak text-text-on-success-strong":ne(I),"bg-surface-warning-weak text-text-on-warning-strong":!ne(I)};return J.e=G(H,he,J.e),J.t=G(se,we,J.t),J},{e:void 0,t:void 0}),H})())),i(x,n(F,{get when(){return!d()},get children(){var I=br();return i(I,()=>t.t(_()?"settings.general.row.computerUse.permissionsRelaunchFooter":"settings.general.row.computerUse.permissionsFooter")),I}}),L),i(L,n(O,{variant:"ghost",size:"normal",onClick:m,get children(){return t.t("settings.general.row.computerUse.permissionDone")}}),V),i(V,n(F,{get when(){return A(()=>!!e.onConfirmEnable)()&&!d()},get children(){return n(O,{variant:"ghost",size:"normal",onClick:I=>{I.preventDefault(),e.onConfirmEnable?.(),m()},get children(){return t.t("settings.general.row.computerUse.enableAnyway")}})}}),null),i(V,n(F,{get when(){return A(()=>!!r.relaunchShell)()&&!d()},get children(){return n(O,{get variant(){return e.onConfirmEnable?"ghost":"primary"},size:"normal",get disabled(){return k()},onClick:I=>{I.preventDefault(),s()},get children(){return A(()=>!!k())()?t.t("settings.general.row.computerUse.relaunchPending"):t.t("settings.general.row.computerUse.relaunch")}})}}),null),i(V,n(F,{get when(){return A(()=>!!d())()&&e.onConfirmEnable},get children(){return n(O,{variant:"primary",size:"normal",onClick:I=>{I.preventDefault(),e.onConfirmEnable?.(),m()},get children(){return t.t("settings.general.row.computerUse.enableNow")}})}}),null),Q(I=>G(j,{"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-12-medium":!0,"bg-surface-success-weak text-text-on-success-strong":d(),"bg-surface-warning-weak text-text-on-warning-strong":!d()},I)),x}})}const T=e=>(()=>{var t=$r(),r=t.firstChild,u=r.firstChild,a=u.nextSibling,o=r.nextSibling;return i(u,()=>e.title),i(a,()=>e.description),i(o,()=>e.children),t})();var Sr=w('<h2 class="text-16-medium text-text-strong">'),Dr=w('<div class="flex flex-col gap-4 max-w-[720px]"><div></div><div class="flex h-10 items-center gap-2 rounded-lg bg-surface-base px-3">'),Er=w('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Pr=w('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),jr=w('<div><div class="flex flex-col gap-8 max-w-[720px]">'),zr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="pt-6 pb-6">'),Ir=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Fr=w('<div class="flex items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><span class="text-14-regular text-text-strong"></span><button type=button>');const Le=typeof navigator=="object"&&/(Mac|iPod|iPhone|iPad)/.test(navigator.platform),xe="command.palette",Lr="mod+shift+p",$e=["General","Session","Navigation","Model and agent","Terminal","Prompt"],Mr={General:"settings.shortcuts.group.general",Session:"settings.shortcuts.group.session",Navigation:"settings.shortcuts.group.navigation","Model and agent":"settings.shortcuts.group.modelAndAgent",Terminal:"settings.shortcuts.group.terminal",Prompt:"settings.shortcuts.group.prompt"};function Me(e){return e===xe?"General":e.startsWith("terminal.")?"Terminal":e.startsWith("model.")||e.startsWith("agent.")||e.startsWith("mcp.")?"Model and agent":e.startsWith("file.")||e.startsWith("fileTree.")?"Navigation":e.startsWith("prompt.")?"Prompt":e.startsWith("session.")||e.startsWith("message.")||e.startsWith("permissions.")||e.startsWith("steps.")||e.startsWith("review.")?"Session":"General"}function Or(e){return e==="Shift"||e==="Control"||e==="Alt"||e==="Meta"}function Rr(e){return e===","?"comma":e==="+"?"plus":e===" "?"space":e.toLowerCase()}function Ur(e){if(Or(e.key))return;const t=[];(Le?e.metaKey:e.ctrlKey)&&t.push("mod"),Le&&e.ctrlKey&&t.push("ctrl"),!Le&&e.metaKey&&t.push("meta"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift");const u=Rr(e.key);if(u)return t.push(u),t.join("+")}function Ne(e){if(!e)return[];const t=[];for(const r of Lt(e)){const u=[];r.ctrl&&u.push("ctrl"),r.alt&&u.push("alt"),r.shift&&u.push("shift"),r.meta&&u.push("meta"),r.key&&u.push(r.key),u.length!==0&&t.push(u.join("+"))}return t}function Nr(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Tr(e,t,r){const u=new Map;u.set(xe,{title:r,group:"General"});for(const a of e.catalog)a.id.startsWith("suggested.")||u.set(a.id,{title:a.title,group:Me(a.id)});for(const a of e.options)a.id.startsWith("suggested.")||u.set(a.id,{title:a.title,group:Me(a.id)});for(const[a,o]of Object.entries(t))typeof o=="string"&&(u.has(a)||u.set(a,{title:a,group:Me(a)}));return u}function Ar(e){const t=new Map;for(const r of $e)t.set(r,[]);for(const[r,u]of e){const a=t.get(u.group);a&&a.push(r)}for(const r of $e){const u=t.get(r);u&&u.sort((a,o)=>(e.get(a)?.title??"").localeCompare(e.get(o)?.title??""))}return t}function Kr(e,t,r,u){const a=e.toLowerCase().trim();if(!a)return r;const o=new Map;for(const c of $e)o.set(c,[]);const f=Array.from(t.entries()).map(([c,h])=>({id:c,title:h.title,group:h.group,keybind:u(c)})),l=Vt.go(a,f,{keys:["title","keybind"],threshold:-1e4});for(const c of l){const h=o.get(c.obj.group);h&&h.push(c.obj.id)}return o}function qr(e){Te(()=>{Mt(document,"keydown",r=>{const u=e.active();if(!u)return;if(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),r.key==="Escape"){e.stop();return}if((r.key==="Backspace"||r.key==="Delete")&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&!r.shiftKey){e.set(u,"none"),e.stop();return}const o=Ur(r);if(!o)return;const f=new Map;for(const l of Ne(o))for(const c of e.used().get(l)??[])c.id!==u&&f.set(c.id,c.title);if(f.size>0){N({title:e.language.t("settings.shortcuts.conflict.title"),description:e.language.t("settings.shortcuts.conflict.description",{keybind:Ot(o,e.language.t),titles:[...f.values()].join(", ")})});return}e.set(u,o),e.stop()},{capture:!0})})}const Wr=e=>{const t=zt(),r=q(),u=tt(),[a,o]=me({active:null,filter:""}),f=()=>{a.active&&(o("active",null),t.keybinds(!0))},l=$=>{if(a.active===$){f();return}a.active&&f(),o("active",$),t.keybinds(!1)},c=M(()=>Nr(u.current.keybinds)),h=M(()=>Object.values(c()).some($=>typeof $=="string")),k=()=>{f(),u.keybinds.resetAll(),N({title:r.t("settings.shortcuts.reset.toast.title"),description:r.t("settings.shortcuts.reset.toast.description")})},b=M(()=>(r.locale(),Tr(t,c(),r.t("command.palette")))),D=$=>b().get($)?.title??"",m=M(()=>Ar(b())),S=M(()=>Kr(a.filter,b(),m(),$=>t.keybind($)||"")),v=M(()=>{for(const $ of $e)if((S().get($)??[]).length>0)return!0;return!1}),s=M(()=>{const $=new Map,x=(j,P)=>{const L=$.get(j);if(!L){$.set(j,[P]);return}L.push(P)},p=u.keybinds.get(xe)??Lr;for(const j of Ne(p))x(j,{id:xe,title:D(xe)});const z=j=>{const P=u.keybinds.get(j);if(typeof P=="string")return P;const L=t.options.find(I=>I.id===j);return L?.keybind?L.keybind:t.catalog.find(I=>I.id===j)?.keybind};for(const j of b().keys())if(j!==xe)for(const P of Ne(z(j)))x(P,{id:j,title:D(j)});return $}),g=($,x)=>u.keybinds.set($,x),d=()=>e.layout==="page";qr({active:()=>a.active,stop:f,set:g,used:s,language:r}),It(()=>{a.active&&t.keybinds(!0)});const _=()=>(()=>{var $=Dr(),x=$.firstChild,p=x.nextSibling;return i(x,n(F,{get when(){return!d()},get children(){var z=Sr();return i(z,()=>r.t("settings.shortcuts.title")),z}}),null),i(x,n(O,{size:"small",variant:"secondary",onClick:k,get disabled(){return!h()},get children(){return r.t("settings.shortcuts.reset.button")}}),null),i(p,n(ce,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),i(p,n(U,{variant:"ghost",type:"text",get value(){return a.filter},onChange:z=>o("filter",z),get placeholder(){return r.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),i(p,n(F,{get when(){return a.filter},get children(){return n(Y,{icon:"circle-x",variant:"ghost",onClick:()=>o("filter","")})}}),null),Q(z=>G(x,{"flex items-center gap-4":!0,"justify-end":d(),"justify-between":!d()},z)),$})();return(()=>{var $=jr(),x=$.firstChild;return i($,n(F,{get when(){return d()},get fallback(){return(()=>{var p=zr(),z=p.firstChild;return i(z,n(_,{})),p})()},get children(){return n(_,{})}}),x),i(x,n(X,{each:$e,children:p=>n(F,{get when(){return(S().get(p)??[]).length>0},get children(){var z=Ir(),j=z.firstChild;return i(j,()=>r.t(Mr[p])),i(z,n(le,{get children(){return n(X,{get each(){return S().get(p)??[]},children:P=>(()=>{var L=Fr(),V=L.firstChild,I=V.nextSibling;return i(V,()=>D(P)),I.$$click=()=>l(P),Ft(I,"data-keybind-id",P),i(I,n(F,{get when(){return a.active===P},get fallback(){return t.keybind(P)||r.t("settings.shortcuts.unassigned")},get children(){return r.t("settings.shortcuts.pressKeys")}})),Q(H=>G(I,{"h-8 px-3 rounded-md text-12-regular":!0,"bg-surface-base text-text-subtle hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active":a.active!==P,"border border-border-weak-base bg-surface-inset-base text-text-weak":a.active===P},H)),L})()})}}),null),z}})}),null),i(x,n(F,{get when(){return A(()=>!!a.filter)()&&!v()},get children(){var p=Pr(),z=p.firstChild;return i(z,()=>r.t("settings.shortcuts.search.empty")),i(p,n(F,{get when(){return a.filter},get children(){var j=Er(),P=j.firstChild,L=P.nextSibling;return L.nextSibling,i(j,()=>a.filter,L),j}}),null),p}}),null),Q(p=>G($,{"flex flex-col":!0,"w-full gap-6":d(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!d()},p)),$})()};Ae(["click"]);function Ke(e){if(e.catalog&&Object.keys(e.catalog.models).length>0)return{models:e.catalog.models,providerCatalog:!0};const t=new Map(Object.values(e.provider.models).map(r=>[r.id,r]));return e.catalogs?.forEach(r=>{Object.values(r.models).forEach(u=>{t.has(u.id)||t.set(u.id,u)})}),{models:Object.fromEntries(t),providerCatalog:!1}}function Vr(e){const t=Ke(e),r=Object.keys(t.models),u=new Set(r);return e.config?.whitelist?.length?new Set(e.config.whitelist.filter(a=>u.has(a))):e.config?.blacklist?.length?new Set(r.filter(a=>!e.config?.blacklist?.includes(a))):t.providerCatalog?new Set(r):new Set(Object.keys(e.provider.models).filter(a=>u.has(a)))}function Br(e){const t=Ke(e),r=Vr(e);return Object.values(t.models).map(u=>({id:u.id,model:u,selected:r.has(u.id)})).sort((u,a)=>u.model.name.localeCompare(a.model.name)||u.id.localeCompare(a.id))}function Gr(e,t){const r=t.trim().toLowerCase();return r?e.filter(u=>u.id.toLowerCase().includes(r)||u.model.name.toLowerCase().includes(r)):e}function Hr(e){const t=e.limit.context&&e.limit.output?{limit:{context:e.limit.context,output:e.limit.output,...e.limit.input!==void 0?{input:e.limit.input}:{}}}:{};return{name:e.name,temperature:e.capabilities.temperature,reasoning:e.capabilities.reasoning,attachment:e.capabilities.attachment,tool_call:e.capabilities.toolcall,...e.family?{family:e.family}:{},...e.release_date?{release_date:e.release_date}:{},...t}}function Jr(e,t,r=[],u={}){const a=new Set(u.includeModelIDs??[]),o=u.includeModels||a.size>0?Object.fromEntries(t.map(l=>{if(!u.includeModels&&!a.has(l))return;const c=r.find(h=>h.id===l);if(c)return[l,Hr(c.model)]}).filter(l=>!!l)):void 0,f=o?{...o,...e?.models??{}}:e?.models;return{...e??{},whitelist:t.slice().sort((l,c)=>l.localeCompare(c)),blacklist:[],...f?{models:f}:{}}}var Qr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong">'),Xr=w('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Yr=w('<div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Zr=w('<div class="py-4 text-14-regular text-text-weak">'),en=w('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate"></span></div><div class="flex shrink-0 items-center gap-2">'),tn=w('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),rn=w('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),nn=w('<span class="text-12-regular text-text-weak pl-8">'),sn=w('<div class="pt-2 text-12-regular text-text-danger-base">'),ln=w('<div class="flex flex-col gap-5 px-2.5 pb-3 overflow-y-auto max-h-[70vh]"><div class="px-2.5 flex items-center justify-between gap-4"><div class="flex items-center gap-3 min-w-0"><div class=min-w-0><div class="text-16-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak"></div></div></div><div class="flex shrink-0 items-center gap-2"></div></div><div class=mx-2.5></div><form class="mx-2.5 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-2"></form><div class=px-2.5></div><div class="flex justify-end gap-2 px-2.5">'),on=w('<div class="px-4 py-10 text-center text-12-regular text-text-weak">'),an=w('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span><span class="text-12-regular text-text-weak truncate block">');const cn=[{match:e=>e==="codeplane",key:"dialog.provider.codeplane.note"},{match:e=>e==="anthropic",key:"dialog.provider.anthropic.note"},{match:e=>e.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:e=>e==="openai",key:"dialog.provider.openai.note"},{match:e=>e==="google",key:"dialog.provider.google.note"},{match:e=>e==="openrouter",key:"dialog.provider.openrouter.note"},{match:e=>e==="vercel",key:"dialog.provider.vercel.note"}],dn=e=>{const t=Z(),r=q(),u=ie(),a=ee(),o=rt(),f=M(()=>o.connected().filter(s=>s.id!=="codeplane"||Object.values(s.models).find(g=>g.cost?.input))),l=M(()=>{const s=new Set(f().map(d=>d.id)),g=o.popular().filter(d=>!s.has(d.id)).slice();return g.sort((d,_)=>De.indexOf(d.id)-De.indexOf(_.id)),g}),c=s=>{if(!("source"in s))return;const g=s.source;if(g==="env"||g==="api"||g==="config"||g==="custom")return g},h=s=>{const g=c(s);return g==="env"?r.t("settings.providers.tag.environment"):g==="api"?r.t("provider.connect.method.apiKey"):g==="config"?D(s.id)?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.config"):g==="custom"?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.other")},k=s=>c(s)!=="env",b=s=>cn.find(g=>g.match(s))?.key,D=s=>{const g=a.data.config.provider?.[s];return!(!g||g.npm!=="@ai-sdk/openai-compatible"||!g.models||Object.keys(g.models).length===0)},m=()=>e.layout==="page",S=async(s,g)=>{const d=a.data.config.disabled_providers??[],_=d.includes(s)?d:[...d,s];a.set("config","disabled_providers",_),await a.updateConfig({disabled_providers:_}).then(()=>{N({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch($=>{a.set("config","disabled_providers",d);const x=$ instanceof Error?$.message:String($);N({title:r.t("common.requestFailed"),description:x})})},v=async(s,g)=>{if(D(s)){await u.client.auth.remove({providerID:s}).catch(()=>{}),await S(s,g);return}await u.client.auth.remove({providerID:s}).then(async()=>{await u.client.global.dispose(),N({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(d=>{const _=d instanceof Error?d.message:String(d);N({title:r.t("common.requestFailed"),description:_})})};return(()=>{var s=Yr(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=d.nextSibling,x=$.firstChild;return i(s,n(F,{get when(){return!m()},get children(){var p=Qr(),z=p.firstChild,j=z.firstChild;return i(j,()=>r.t("settings.providers.title")),p}}),g),i(_,()=>r.t("settings.providers.section.connected")),i(d,n(le,{get children(){return n(F,{get when(){return f().length>0},get fallback(){return(()=>{var p=Zr();return i(p,()=>r.t("settings.providers.connected.empty")),p})()},get children(){return n(X,{get each(){return f()},children:p=>(()=>{var z=en(),j=z.firstChild,P=j.firstChild,L=j.nextSibling;return i(j,n(ke,{get id(){return p.id},class:"size-5 shrink-0 icon-strong-base"}),P),i(P,()=>p.name),i(j,n(te,{get children(){return h(p)}}),null),i(L,n(O,{size:"large",variant:"ghost",icon:"edit",onClick:()=>t.show(()=>n(un,{provider:p})),get children(){return r.t("settings.providers.models.edit")}}),null),i(L,n(F,{get when(){return k(p)},get fallback(){return(()=>{var V=tn();return i(V,()=>r.t("settings.providers.connected.environmentDescription")),V})()},get children(){return n(O,{size:"large",variant:"ghost",onClick:()=>void v(p.id,p.name),get children(){return r.t("common.disconnect")}})}}),null),z})()})}})}}),null),i(x,()=>r.t("settings.providers.section.popular")),i($,n(le,{get children(){return[n(X,{get each(){return l()},children:p=>(()=>{var z=rn(),j=z.firstChild,P=j.firstChild,L=P.firstChild;return i(P,n(ke,{get id(){return p.id},class:"size-5 shrink-0 icon-strong-base"}),L),i(L,()=>p.name),i(P,n(F,{get when(){return p.id==="codeplane"},get children(){return n(te,{get children(){return r.t("dialog.provider.tag.recommended")}})}}),null),i(j,n(F,{get when(){return b(p.id)},keyed:!0,children:V=>(()=>{var I=nn();return i(I,()=>r.t(V)),I})()}),null),i(z,n(O,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>n(Bt,{get provider(){return p.id}}))},get children(){return r.t("common.connect")}}),null),z})()}),(()=>{var p=Xr(),z=p.firstChild,j=z.firstChild,P=j.firstChild,L=j.nextSibling;return i(j,n(ke,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),P),i(P,()=>r.t("provider.custom.title")),i(j,n(te,{get children(){return r.t("settings.providers.tag.custom")}}),null),i(L,()=>r.t("settings.providers.custom.description")),i(p,n(O,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>n(Gt,{back:"close"}))},get children(){return r.t("common.connect")}}),null),p})()]}}),null),i($,n(O,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>{t.show(()=>n(Ht,{}))},get children(){return r.t("dialog.provider.viewAll")}}),null),Q(p=>G(s,{"flex flex-col":!0,"w-full":m(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!m()},p)),s})()};function un(e){const t=Z(),r=ie(),u=ee(),a=q(),o=M(()=>u.data.provider.catalog.find(x=>x.id===e.provider.id)),f=M(()=>Ke({provider:e.provider,catalog:o(),catalogs:u.data.provider.catalog})),l=M(()=>u.data.config.provider?.[e.provider.id]),c=M(()=>Br({provider:e.provider,catalog:o(),catalogs:u.data.provider.catalog,config:l()})),[h,k]=me({selected:Object.fromEntries(c().map(x=>[x.id,x.selected])),added:{},addModelID:"",addModelName:"",search:"",addError:"",error:""}),b=M(()=>Object.values(h.added).map(x=>({id:x.id,model:x,selected:!!h.selected[x.id]}))),D=M(()=>{const x=new Set(c().map(p=>p.id));return[...c(),...b().filter(p=>x.has(p.id)?!1:(x.add(p.id),!0))].sort((p,z)=>p.model.name.localeCompare(z.model.name)||p.id.localeCompare(z.id))}),m=M(()=>Gr(D(),h.search)),S=M(()=>D().filter(x=>h.selected[x.id]).map(x=>x.id)),v=x=>{k("selected",Object.fromEntries(D().map(p=>[p.id,x]))),k("error","")},s=(x,p)=>{k("selected",x,p),k("error","")},g=x=>{for(const p of u.data.provider.catalog){const z=p.models[x];if(z)return z}},d=(x,p)=>g(x)??{id:x,providerID:e.provider.id,api:{id:x,url:Object.values(e.provider.models)[0]?.api.url??"",npm:Object.values(e.provider.models)[0]?.api.npm??"@ai-sdk/openai-compatible"},name:p,capabilities:{temperature:!0,reasoning:!1,attachment:!1,toolcall:!0,input:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:0,output:0},status:"active",options:{},headers:{},release_date:""},_=x=>{x.preventDefault();const p=h.addModelID.trim();if(!p){k("addError",a.t("settings.providers.models.add.error.id"));return}if(D().find(P=>P.id===p)){k("selected",p,!0),k("addModelID",""),k("addModelName",""),k("addError","");return}const j=d(p,h.addModelName.trim()||p);k("added",p,j),k("selected",p,!0),k("addModelID",""),k("addModelName",""),k("addError",""),k("error","")},$=re(()=>({mutationFn:async()=>{const x=S();if(x.length===0){k("error",a.t("settings.providers.models.error.required"));return}await u.updateConfig({provider:{[e.provider.id]:Jr(l(),x,D(),{includeModels:!f().providerCatalog,includeModelIDs:Object.keys(h.added)})}}),await r.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:a.t("settings.providers.models.toast.updated",{provider:e.provider.name})}),t.close()},onError:x=>{N({variant:"error",title:a.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}}));return n(be,{get title(){return a.t("settings.providers.models.title",{provider:e.provider.name})},transition:!0,get children(){var x=ln(),p=x.firstChild,z=p.firstChild,j=z.firstChild,P=j.firstChild,L=P.nextSibling,V=z.nextSibling,I=p.nextSibling,H=I.nextSibling,pe=H.nextSibling,de=pe.nextSibling;return i(z,n(ke,{get id(){return e.provider.id},class:"size-5 shrink-0 icon-strong-base"}),j),i(P,()=>e.provider.name),i(L,()=>a.t("settings.providers.models.count",{selected:S().length,total:D().length})),i(V,n(O,{type:"button",size:"small",variant:"ghost",onClick:()=>v(!0),get children(){return a.t("settings.providers.models.selectAll")}}),null),i(V,n(O,{type:"button",size:"small",variant:"ghost",onClick:()=>v(!1),get children(){return a.t("settings.providers.models.clear")}}),null),i(I,n(U,{variant:"normal",type:"search",get value(){return h.search},onChange:B=>k("search",B),get placeholder(){return a.t("common.search.placeholder")},get label(){return a.t("common.search.placeholder")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"})),H.addEventListener("submit",_),i(H,n(U,{variant:"normal",type:"text",get value(){return h.addModelID},onChange:B=>{k("addModelID",B),k("addError","")},get placeholder(){return a.t("settings.providers.models.add.id")},get label(){return a.t("settings.providers.models.add.id")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get error(){return h.addError},get validationState(){return h.addError?"invalid":void 0}}),null),i(H,n(U,{variant:"normal",type:"text",get value(){return h.addModelName},onChange:B=>k("addModelName",B),get placeholder(){return a.t("settings.providers.models.add.name")},get label(){return a.t("settings.providers.models.add.name")},hideLabel:!0}),null),i(H,n(O,{type:"submit",size:"large",variant:"secondary",icon:"plus-small",get children(){return a.t("settings.providers.models.add.submit")}}),null),i(pe,n(le,{get children(){return n(F,{get when(){return m().length>0},get fallback(){return(()=>{var B=on();return i(B,()=>a.t("settings.providers.models.empty")),B})()},get children(){return n(X,{get each(){return m()},children:B=>(()=>{var se=an(),fe=se.firstChild,J=fe.firstChild,he=J.nextSibling;return i(J,()=>B.model.name),i(he,()=>B.id),i(se,n(K,{get checked(){return!!h.selected[B.id]},onChange:we=>s(B.id,we),hideLabel:!0,get children(){return B.model.name}}),null),se})()})}})}}),null),i(pe,n(F,{get when(){return h.error},get children(){var B=sn();return i(B,()=>h.error),B}}),null),i(de,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>t.close(),get children(){return a.t("common.cancel")}}),null),i(de,n(O,{type:"button",variant:"primary",size:"large",get disabled(){return $.isPending},onClick:()=>$.mutate(),get children(){return A(()=>!!$.isPending)()?a.t("common.saving"):a.t("common.save")}}),null),x}})}var gn=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),mn=w("<div>"),pn=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),fn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),hn=w('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),vn=w('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),bn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),xn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-3 gap-3"></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">');const Be=e=>!!e&&typeof e=="object"&&!Array.isArray(e),wn=e=>e?{name:e.name,description:e.config.description??"",model:e.config.model??"",prompt:e.config.prompt??"",temperature:e.config.temperature!==void 0?String(e.config.temperature):"",topP:e.config.top_p!==void 0?String(e.config.top_p):"",steps:e.config.steps!==void 0?String(e.config.steps):"",hidden:!!e.config.hidden,disable:!!e.config.disable,errors:{}}:{name:"",description:"",model:"",prompt:"",temperature:"",topP:"",steps:"",hidden:!1,disable:!1,errors:{}};function kn(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",f=M(()=>{const b=r.data.config.mode??{},D=new Set(Object.keys(b));return[...Object.entries(b).filter(m=>Be(m[1])).map(([m,S])=>({name:m,config:S,source:"mode"})),...Object.entries(r.data.config.agent??{}).filter(m=>Be(m[1])).filter(([m,S])=>!D.has(m)&&(S.mode??"primary")!=="subagent").map(([m,S])=>({name:m,config:S,source:"agent"}))].sort((m,S)=>m.name.localeCompare(S.name))}),l=M(()=>f().filter(b=>b.config.disable!==!0).length),c=(b,D)=>b==="mode"?r.updateConfig({mode:D}):r.updateConfig({agent:D}),h=re(()=>({mutationFn:async b=>{const D={...b.mode.source==="mode"?r.data.config.mode:r.data.config.agent};D[b.mode.name]={...D[b.mode.name]??{},disable:!b.enabled},await c(b.mode.source,D),await u.client.global.dispose().catch(()=>{})},onError:b=>{N({variant:"error",title:t.t("common.requestFailed"),description:b instanceof Error?b.message:String(b)})}})),k=b=>{a.show(()=>n(yn,{entry:b}))};return[(()=>{var b=mn();return i(b,n(F,{get when(){return!o()},get children(){var D=gn(),m=D.firstChild,S=m.nextSibling;return i(m,()=>t.t("modes.page.title")),i(S,()=>t.t("modes.page.subtitle",{enabled:l(),total:f().length})),D}}),null),i(b,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>k(),get children(){return t.t("modes.page.add")}}),null),Q(D=>G(b,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},D)),b})(),n(F,{get when(){return f().length>0},get fallback(){return(()=>{var b=fn();return i(b,()=>t.t("modes.page.empty")),b})()},get children(){var b=pn();return i(b,n(X,{get each(){return f()},children:D=>n($n,{mode:D,toggling:()=>h.isPending&&h.variables?.mode.name===D.name,onToggle:m=>h.mutate({mode:D,enabled:m}),onEdit:()=>k(D)})})),b}})]}function $n(e){const t=q(),r=()=>e.mode.config.disable!==!0,u=()=>e.mode.config.model,a=()=>e.mode.source==="mode"?"primary":e.mode.config.mode==="all"?"all":"primary";return(()=>{var o=bn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=l.nextSibling;return i(c,n(ce,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.mode.name),i(c,n(te,{get children(){return t.t(`modes.kind.${a()}`)}}),null),i(c,n(F,{get when(){return e.mode.source==="mode"},get children(){return n(te,{get children(){return t.t("modes.source.legacy")}})}}),null),i(c,n(F,{get when(){return e.mode.config.hidden},get children(){return n(te,{get children(){return t.t("modes.tag.hidden")}})}}),null),i(c,n(F,{get when(){return!r()},get children(){return n(te,{get children(){return t.t("modes.tag.disabled")}})}}),null),i(l,n(F,{get when(){return e.mode.config.description},get children(){var b=hn();return i(b,()=>e.mode.config.description),b}}),null),i(l,n(F,{get when(){return u()},get children(){var b=vn();return i(b,u),b}}),null),i(k,n(K,{get checked(){return r()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),o})()}function yn(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,[f,l]=me(wn(e.entry)),c=()=>{const m={},S=f.name.trim();return S||(m.name=t.t("modes.editor.error.name")),!o&&(r.data.config.mode&&S in r.data.config.mode||r.data.config.agent&&S in r.data.config.agent)&&(m.name=t.t("modes.editor.error.duplicate")),l("errors",m),Object.keys(m).length===0},h=m=>{const S=m.trim();if(!S)return;const v=Number(S);if(!Number.isNaN(v))return v},k=()=>({mode:"primary",hidden:f.hidden,disable:f.disable,...f.description.trim()?{description:f.description.trim()}:{},...f.model.trim()?{model:f.model.trim()}:{},...f.prompt.trim()?{prompt:f.prompt}:{},...h(f.temperature)!==void 0?{temperature:h(f.temperature)}:{},...h(f.topP)!==void 0?{top_p:h(f.topP)}:{},...h(f.steps)!==void 0?{steps:h(f.steps)}:{}}),b=re(()=>({mutationFn:async()=>{if(!c())return;const m=e.entry?.source??"agent",S={...m==="mode"?r.data.config.mode:r.data.config.agent};S[f.name.trim()]=k(),m==="mode"?await r.updateConfig({mode:S}):await r.updateConfig({agent:S}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("modes.toast.updated"):t.t("modes.toast.added")}),a.close()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{m.preventDefault(),!b.isPending&&b.mutate()};return n(be,{get title(){return o?t.t("modes.editor.title.edit"):t.t("modes.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var m=xn(),S=m.firstChild,v=S.firstChild,s=v.nextSibling,g=s.firstChild,d=g.firstChild,_=d.nextSibling,$=s.nextSibling,x=$.firstChild,p=x.firstChild,z=p.nextSibling,j=S.nextSibling;return m.addEventListener("submit",D),i(S,n(U,{autofocus:!0,get label(){return t.t("modes.editor.name")},placeholder:"review",get value(){return f.name},onChange:P=>ae(()=>{l("name",P),l("errors","name",void 0)}),get error(){return f.errors.name},disabled:o,spellcheck:!1,class:"font-mono text-xs"}),v),i(S,n(U,{get label(){return t.t("modes.editor.description")},get placeholder(){return t.t("modes.editor.description.placeholder")},get value(){return f.description},onChange:P=>l("description",P)}),v),i(S,n(U,{get label(){return t.t("modes.editor.model")},get description(){return t.t("modes.editor.model.description")},placeholder:"anthropic/claude-sonnet-4-5",get value(){return f.model},onChange:P=>l("model",P),spellcheck:!1,class:"font-mono text-xs"}),v),i(S,n(U,{multiline:!0,get label(){return t.t("modes.editor.prompt")},get description(){return t.t("modes.editor.prompt.description")},get placeholder(){return t.t("modes.editor.prompt.placeholder")},get value(){return f.prompt},onChange:P=>l("prompt",P),spellcheck:!1,class:"max-h-40 w-full overflow-y-auto font-mono text-xs"}),v),i(v,n(U,{get label(){return t.t("modes.editor.temperature")},placeholder:"0.7",get value(){return f.temperature},onChange:P=>l("temperature",P.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),i(v,n(U,{get label(){return t.t("modes.editor.topP")},placeholder:"1",get value(){return f.topP},onChange:P=>l("topP",P.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),i(v,n(U,{get label(){return t.t("modes.editor.steps")},placeholder:"50",get value(){return f.steps},onChange:P=>l("steps",P.replace(/[^0-9]/g,"")),inputmode:"numeric"}),null),i(d,()=>t.t("modes.editor.hidden")),i(_,()=>t.t("modes.editor.hidden.description")),i(s,n(K,{get checked(){return f.hidden},onChange:P=>l("hidden",P),hideLabel:!0,get children(){return t.t("modes.editor.hidden")}}),null),i(p,()=>t.t("modes.editor.disable")),i(z,()=>t.t("modes.editor.disable.description")),i($,n(K,{get checked(){return f.disable},onChange:P=>l("disable",P),hideLabel:!0,get children(){return t.t("modes.editor.disable")}}),null),i(j,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(j,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),m}})}var _n=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Cn=w('<div><div class="flex items-center gap-2">'),Sn=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Dn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),En=w('<span class="text-11-regular text-text-weak">'),Pn=w('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),jn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),zn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">'),In=w("<button type=button>"),Fn=w('<span class="text-11-regular text-text-weaker">'),Ln=w('<div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span></div><div class="flex flex-col gap-1.5">'),Mn=w('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const ue=()=>({key:"",value:""}),On={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled",needs_client_registration:"mcp.status.needs_auth"};function Rn(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",[f,l]=nt(async()=>(await u.client.mcp.status().catch(()=>null))?.data??{}),c=M(()=>{const m=r.data.config.mcp??{},S=f()??{},v=[];for(const[s,g]of Object.entries(m))!g||typeof g!="object"||"type"in g&&v.push({name:s,config:g,status:S[s]});return v.sort((s,g)=>s.name.localeCompare(g.name))}),h=M(()=>c().filter(m=>m.config.enabled!==!1).length),k=re(()=>({mutationFn:async({name:m,enabled:S})=>{const v=r.data.config.mcp??{},s=v[m];if(!s||!("type"in s))throw new Error("not found");const g={...v,[m]:{...s,enabled:S}};await r.updateConfig({mcp:g}),S?await u.client.mcp.connect({name:m}).catch(()=>{}):await u.client.mcp.disconnect({name:m}).catch(()=>{}),l.refetch()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),b=re(()=>({mutationFn:async m=>{const S={...r.data.config.mcp??{}};delete S[m],await r.updateConfig({mcp:S}),l.refetch()},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("mcp.toast.removed")})},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{a.show(()=>n(Nn,{entry:m}))};return[(()=>{var m=Cn(),S=m.firstChild;return i(m,n(F,{get when(){return!o()},get children(){var v=_n(),s=v.firstChild,g=s.nextSibling;return i(s,()=>t.t("mcp.page.title")),i(g,()=>t.t("mcp.page.subtitle",{enabled:h(),total:c().length})),v}}),S),i(S,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>D(),get children(){return t.t("mcp.page.add")}})),Q(v=>G(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},v)),m})(),n(F,{get when(){return c().length>0},get fallback(){return(()=>{var m=Dn();return i(m,()=>t.t("mcp.page.empty")),m})()},get children(){var m=Sn();return i(m,n(X,{get each(){return c()},children:S=>n(Un,{server:S,toggling:()=>k.isPending&&k.variables?.name===S.name,onToggle:v=>k.mutate({name:S.name,enabled:v}),onEdit:()=>D(S),onRemove:()=>{window.confirm(t.t("mcp.page.confirm.remove",{name:S.name}))&&b.mutate(S.name)}})})),m}})]}function Un(e){const t=q(),r=()=>{const o=e.server.config.enabled===!1?"disabled":e.server.status?.status;if(!o)return;const f=On[o];return f?t.t(f):o},u=()=>e.server.config.enabled!==!1,a=()=>e.server.config.type==="remote"?e.server.config.url:e.server.config.type==="local"&&Array.isArray(e.server.config.command)?e.server.config.command.join(" "):"";return(()=>{var o=jn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=l.nextSibling;return i(c,n(ce,{name:"mcp",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.server.name),i(c,n(te,{get children(){return e.server.config.type}}),null),i(c,n(F,{get when(){return r()},get children(){var b=En();return i(b,r),b}}),null),i(l,n(F,{get when(){return a()},get children(){var b=Pn();return i(b,a),b}}),null),i(k,n(K,{get checked(){return u()},get disabled(){return e.toggling()},onChange:b=>e.onToggle(b),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(k,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),o})()}function Nn(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,f=()=>{const s=e.entry;if(!s)return{name:"",kind:"local",enabled:!0,command:"",url:"",timeout:"",environment:[ue()],headers:[ue()],errors:{}};const g=s.config;return g.type==="local"?{name:s.name,kind:"local",enabled:g.enabled!==!1,command:Array.isArray(g.command)?g.command.join(" "):"",url:"",timeout:g.timeout?String(g.timeout):"",environment:Object.entries(g.environment??{}).map(([d,_])=>({key:d,value:_}))||[ue()],headers:[ue()],errors:{}}:{name:s.name,kind:"remote",enabled:g.enabled!==!1,command:"",url:g.url,timeout:g.timeout?String(g.timeout):"",environment:[ue()],headers:Object.entries(g.headers??{}).map(([d,_])=>({key:d,value:_}))||[ue()],errors:{}}},[l,c]=me(f()),h=()=>{const s={};if(l.name.trim()||(s.name=t.t("mcp.editor.error.name")),!o&&r.data.config.mcp&&l.name.trim()in r.data.config.mcp&&(s.name=t.t("mcp.editor.error.duplicate")),l.kind==="local"&&!l.command.trim()&&(s.command=t.t("mcp.editor.error.command")),l.kind==="remote"){const g=l.url.trim();g?/^https?:\/\//i.test(g)||(s.url=t.t("mcp.editor.error.urlInvalid")):s.url=t.t("mcp.editor.error.url")}return c("errors",s),Object.keys(s).length===0},k=()=>{const s=l.timeout.trim()?Number(l.timeout.trim()):void 0;if(l.kind==="local"){const d={};for(const _ of l.environment){const $=_.key.trim();$&&(d[$]=_.value)}return{type:"local",command:l.command.trim().split(/\s+/).filter(_=>_.length>0),enabled:l.enabled,...Object.keys(d).length>0?{environment:d}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}}const g={};for(const d of l.headers){const _=d.key.trim();_&&(g[_]=d.value)}return{type:"remote",url:l.url.trim(),enabled:l.enabled,...Object.keys(g).length>0?{headers:g}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}},b=re(()=>({mutationFn:async()=>{if(!h())return;const s=k(),g=l.name.trim(),d={...r.data.config.mcp??{}},_=o&&e.entry?e.entry.name:void 0;_&&_!==g&&delete d[_],d[g]=s,await r.updateConfig({mcp:d}),_&&await u.client.mcp.disconnect({name:_}).catch(()=>{}),l.enabled?await u.client.mcp.add({name:g,config:s}).catch(()=>u.client.mcp.connect({name:g}).catch(()=>{})):await u.client.mcp.disconnect({name:g}).catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("mcp.toast.updated"):t.t("mcp.toast.added")}),a.close()},onError:s=>{N({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),D=s=>{s.preventDefault(),!b.isPending&&b.mutate()},m=(s,g,d,_)=>{c(s,g,d,_)},S=s=>{c(s,Ee(g=>g.push(ue())))},v=(s,g)=>{c(s,Ee(d=>{d.splice(g,1),d.length===0&&d.push(ue())}))};return n(be,{get title(){return o?t.t("mcp.editor.title.edit"):t.t("mcp.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=zn(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=_.nextSibling,x=d.nextSibling,p=x.firstChild,z=p.firstChild,j=z.nextSibling,P=g.nextSibling;return s.addEventListener("submit",D),i(g,n(U,{autofocus:!0,get label(){return t.t("mcp.editor.name")},placeholder:"my-server",get value(){return l.name},onChange:L=>ae(()=>{c("name",L),c("errors","name",void 0)}),get error(){return l.errors.name},disabled:o}),d),i(_,()=>t.t("mcp.editor.type")),i($,n(Ge,{get active(){return l.kind==="local"},get label(){return t.t("mcp.editor.type.local")},onClick:()=>c("kind","local")}),null),i($,n(Ge,{get active(){return l.kind==="remote"},get label(){return t.t("mcp.editor.type.remote")},onClick:()=>c("kind","remote")}),null),i(g,n(F,{get when(){return l.kind==="local"},get children(){return[n(U,{get label(){return t.t("mcp.editor.command")},get description(){return t.t("mcp.editor.command.description")},placeholder:"npx -y my-mcp-server",get value(){return l.command},onChange:L=>ae(()=>{c("command",L),c("errors","command",void 0)}),get error(){return l.errors.command},spellcheck:!1,class:"font-mono text-xs"}),n(He,{get title(){return t.t("mcp.editor.environment")},get description(){return t.t("mcp.editor.environment.description")},get rows(){return l.environment},secret:!0,onChange:(L,V,I)=>m("environment",L,V,I),onAdd:()=>S("environment"),onRemove:L=>v("environment",L)})]}}),x),i(g,n(F,{get when(){return l.kind==="remote"},get children(){return[n(U,{get label(){return t.t("mcp.editor.url")},placeholder:"https://example.com/mcp",get value(){return l.url},onChange:L=>ae(()=>{c("url",L),c("errors","url",void 0)}),get error(){return l.errors.url},spellcheck:!1}),n(He,{get title(){return t.t("mcp.editor.headers")},get description(){return t.t("mcp.editor.headers.description")},get rows(){return l.headers},secret:!0,onChange:(L,V,I)=>m("headers",L,V,I),onAdd:()=>S("headers"),onRemove:L=>v("headers",L)})]}}),x),i(g,n(U,{get label(){return t.t("mcp.editor.timeout")},get description(){return t.t("mcp.editor.timeout.description")},placeholder:"5000",get value(){return l.timeout},onChange:L=>c("timeout",L.replace(/[^0-9]/g,"")),inputmode:"numeric"}),x),i(z,()=>t.t("mcp.editor.enabled")),i(j,()=>t.t("mcp.editor.enabled.description")),i(x,n(K,{get checked(){return l.enabled},onChange:L=>c("enabled",L),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(P,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(P,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function Ge(e){return(()=>{var t=In();return it(t,"click",e.onClick,!0),i(t,()=>e.label),Q(r=>G(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},r)),t})()}function He(e){const t=q();return(()=>{var r=Ln(),u=r.firstChild,a=u.firstChild,o=u.nextSibling;return i(a,()=>e.title),i(u,n(F,{get when(){return e.description},get children(){var f=Fn();return i(f,()=>e.description),f}}),null),i(o,n(X,{get each(){return e.rows},children:(f,l)=>n(Tn,{row:f,get secret(){return e.secret},onKeyChange:c=>e.onChange(l(),"key",c),onValueChange:c=>e.onChange(l(),"value",c),onRemove:()=>e.onRemove(l())})})),i(r,n(O,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",get onClick(){return e.onAdd},get children(){return t.t("mcp.editor.row.add")}}),null),r})()}function Tn(e){const t=q(),[r,u]=ge(!1);let a;const o=()=>e.secret&&!r()?"password":"text",f=()=>{a&&clearTimeout(a),u(!0),a=setTimeout(()=>u(!1),1500)},l=c=>{e.secret&&c.key==="Enter"&&(c.preventDefault(),f())};return(()=>{var c=Mn(),h=c.firstChild,k=h.nextSibling;return i(h,n(U,{variant:"ghost",get placeholder(){return t.t("mcp.editor.row.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),i(k,n(U,{variant:"ghost",get type(){return o()},get placeholder(){return t.t("mcp.editor.row.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:l,spellcheck:!1,class:"font-mono text-xs"})),i(c,n(F,{get when(){return e.secret},get children(){return n(Y,{type:"button",variant:"ghost",size:"normal",get icon(){return r()?"eye":"shield"},get"aria-label"(){return t.t(r()?"mcp.editor.row.hide":"mcp.editor.row.reveal")},onPointerDown:()=>{a&&clearTimeout(a),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),i(c,n(Y,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),c})()}Ae(["click"]);var An=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Kn=w('<div><div></div><div class="flex flex-col gap-8">'),qn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Wn=w('<li class="border-b border-border-weak-base last:border-b-0">'),Vn=w('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong"></span></div><ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Bn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Gn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-3 gap-3"></div><div class="flex flex-col gap-2"><span class="text-12-medium text-text-weak"></span><div class="grid grid-cols-2 gap-2"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Hn=w('<div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><span class="text-13-medium text-text-strong">');const Jn=40,Oe=e=>e===void 0||e===0?"":String(e),Re=e=>{const t=e.trim();if(!t)return;const r=Number(t);if(!Number.isNaN(r))return r},Ue=e=>e.replace(/[^0-9]/g,""),Qn=(e,t)=>e?.models?.[t],Xn=(e,t)=>{const r=De.indexOf(e.id),u=De.indexOf(t.id),a=r>=0,o=u>=0;return a&&!o?-1:!a&&o?1:a&&o?r-u:e.name.localeCompare(t.name)},Yn=e=>e?{providerID:e.provider.id,modelID:e.model.id,apiModelID:e.config?.id??e.model.api.id,name:e.config?.name??e.model.name,family:e.config?.family??e.model.family??"",releaseDate:e.config?.release_date??e.model.release_date??"",context:Oe(e.config?.limit?.context??e.model.limit.context),input:Oe(e.config?.limit?.input??e.model.limit.input),output:Oe(e.config?.limit?.output??e.model.limit.output),temperature:e.config?.temperature??e.model.capabilities.temperature,reasoning:e.config?.reasoning??e.model.capabilities.reasoning,attachment:e.config?.attachment??e.model.capabilities.attachment,toolCall:e.config?.tool_call??e.model.capabilities.toolcall,errors:{}}:{providerID:"",modelID:"",apiModelID:"",name:"",family:"",releaseDate:"",context:"",input:"",output:"",temperature:!0,reasoning:!1,attachment:!1,toolCall:!0,errors:{}};function Zn(e={}){const t=q(),r=ee(),u=st(),a=Z(),o=()=>e.layout==="page",f=()=>e.layout==="dialog",[l,c]=me({expanded:{}}),h=M(()=>u.list().map(v=>{const s=Qn(r.data.config.provider?.[v.provider.id],v.id);return{provider:v.provider,model:v,config:s,custom:v.provider.source==="config"||v.provider.source==="custom"||!!s}}).sort((v,s)=>{const g=Xn(v.provider,s.provider);return g!==0?g:v.model.name.localeCompare(s.model.name)})),k=M(()=>h().reduce((v,s)=>{const g=v.find(d=>d.provider.id===s.provider.id);return g?(g.entries.push(s),v):(v.push({provider:s.provider,entries:[s]}),v)},[])),b=M(()=>h().filter(v=>u.visible({providerID:v.provider.id,modelID:v.model.id})).length),D=v=>{a.show(()=>n(ti,{entry:v}))},m=v=>u.visible({providerID:v.provider.id,modelID:v.model.id}),S=v=>{if(l.expanded[v.provider.id])return v.entries;const s=[];for(const g of v.entries)if(m(g)&&(s.push(g),s.length>=Jn))return s;return s};return(()=>{var v=Kn(),s=v.firstChild,g=s.nextSibling;return i(s,n(F,{get when(){return!o()},get children(){var d=An(),_=d.firstChild,$=_.nextSibling;return i(_,()=>t.t("models.page.title")),i($,()=>t.t("models.page.subtitle",{shown:b(),total:h().length})),d}}),null),i(s,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>D(),get children(){return t.t("models.page.add")}}),null),i(g,n(F,{get when(){return k().length>0},get fallback(){return(()=>{var d=qn();return i(d,()=>t.t("models.page.empty")),d})()},get children(){return n(X,{get each(){return k()},children:d=>{const _=M(()=>S(d)),$=M(()=>d.entries.length-_().length);return(()=>{var x=Vn(),p=x.firstChild,z=p.firstChild,j=p.nextSibling;return i(p,n(ke,{get id(){return d.provider.id},class:"size-5 shrink-0 icon-strong-base"}),z),i(z,()=>d.provider.name),i(j,n(X,{get each(){return _()},children:P=>n(ei,{entry:P,onEdit:()=>D(P)})}),null),i(j,n(F,{get when(){return $()>0},get children(){var P=Wn();return i(P,n(O,{variant:"ghost",size:"normal",class:"w-full justify-start px-4 py-3 text-13-medium text-text-interactive-base hover:bg-surface-base-hover active:bg-surface-base-active",onClick:()=>c("expanded",d.provider.id,!0),get children(){return[A(()=>t.t("common.loadMore")),A(()=>t.t("common.moreCountSuffix",{count:$()}))]}})),P}}),null),x})()}})}})),Q(d=>{var _={"flex flex-col gap-6":!0,"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":f()},$={"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()};return d.e=G(v,_,d.e),d.t=G(s,$,d.t),d},{e:void 0,t:void 0}),v})()}function ei(e){const t=q(),r=st(),u=()=>({providerID:e.entry.provider.id,modelID:e.entry.model.id}),a=()=>r.visible(u());return(()=>{var o=Bn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=c.nextSibling,b=l.nextSibling;return i(c,n(ce,{name:"models",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.entry.model.name),i(k,()=>e.entry.model.id),i(b,n(K,{get checked(){return a()},onChange:D=>r.setVisibility(u(),D),hideLabel:!0,get children(){return t.t("models.row.shown")}}),null),i(b,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),o})()}function ti(e){const t=q(),r=ee(),u=ie(),a=rt(),o=Z(),f=!!e.entry,[l,c]=me(Yn(e.entry)),h=()=>{const m={},S=l.providerID.trim(),v=l.modelID.trim();return S||(m.providerID=t.t("models.editor.error.provider")),v||(m.modelID=t.t("models.editor.error.model")),l.name.trim()||(m.name=t.t("models.editor.error.name")),!f&&a.all().some(s=>s.id===S&&!!s.models[v])&&(m.modelID=t.t("models.editor.error.duplicate")),c("errors",m),Object.keys(m).length===0},k=()=>{const m=l.modelID.trim(),S=l.apiModelID.trim(),v=Re(l.context),s=Re(l.input),g=Re(l.output),d=v!==void 0&&g!==void 0?{context:v,output:g,...s!==void 0?{input:s}:{}}:void 0;return{...S&&S!==m?{id:S}:{},name:l.name.trim(),temperature:l.temperature,reasoning:l.reasoning,attachment:l.attachment,tool_call:l.toolCall,...l.family.trim()?{family:l.family.trim()}:{},...l.releaseDate.trim()?{release_date:l.releaseDate.trim()}:{},...d?{limit:d}:{}}},b=re(()=>({mutationFn:async()=>{if(!h())return;const m=l.providerID.trim(),S=l.modelID.trim(),v=r.data.config.provider?.[m]??{};await r.updateConfig({provider:{[m]:{...v,models:{...v.models??{},[S]:k()}}}}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:f?t.t("models.toast.updated"):t.t("models.toast.added")}),o.close()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{m.preventDefault(),!b.isPending&&b.mutate()};return n(be,{get title(){return f?t.t("models.editor.title.edit"):t.t("models.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var m=Gn(),S=m.firstChild,v=S.firstChild,s=v.nextSibling,g=s.nextSibling,d=g.nextSibling,_=d.firstChild,$=_.nextSibling,x=S.nextSibling;return m.addEventListener("submit",D),i(v,n(U,{autofocus:!0,get label(){return t.t("models.editor.provider")},placeholder:"anthropic",get value(){return l.providerID},onChange:p=>ae(()=>{c("providerID",p),c("errors","providerID",void 0)}),get error(){return l.errors.providerID},disabled:f,spellcheck:!1,class:"font-mono text-xs"}),null),i(v,n(U,{get label(){return t.t("models.editor.model")},placeholder:"claude-sonnet-4-5",get value(){return l.modelID},onChange:p=>ae(()=>{c("modelID",p),c("errors","modelID",void 0)}),get error(){return l.errors.modelID},disabled:f,spellcheck:!1,class:"font-mono text-xs"}),null),i(S,n(U,{get label(){return t.t("models.editor.name")},placeholder:"Claude Sonnet 4.5",get value(){return l.name},onChange:p=>ae(()=>{c("name",p),c("errors","name",void 0)}),get error(){return l.errors.name}}),s),i(S,n(U,{get label(){return t.t("models.editor.apiModel")},get description(){return t.t("models.editor.apiModel.description")},get placeholder(){return l.modelID||"provider-model-id"},get value(){return l.apiModelID},onChange:p=>c("apiModelID",p),spellcheck:!1,class:"font-mono text-xs"}),s),i(s,n(U,{get label(){return t.t("models.editor.family")},placeholder:"claude",get value(){return l.family},onChange:p=>c("family",p)}),null),i(s,n(U,{get label(){return t.t("models.editor.releaseDate")},placeholder:"2026-01-01",get value(){return l.releaseDate},onChange:p=>c("releaseDate",p),spellcheck:!1}),null),i(g,n(U,{get label(){return t.t("models.editor.context")},placeholder:"200000",get value(){return l.context},onChange:p=>c("context",Ue(p)),inputmode:"numeric"}),null),i(g,n(U,{get label(){return t.t("models.editor.input")},placeholder:"200000",get value(){return l.input},onChange:p=>c("input",Ue(p)),inputmode:"numeric"}),null),i(g,n(U,{get label(){return t.t("models.editor.output")},placeholder:"8192",get value(){return l.output},onChange:p=>c("output",Ue(p)),inputmode:"numeric"}),null),i(_,()=>t.t("models.editor.capabilities")),i($,n(Ce,{get label(){return t.t("models.editor.temperature")},get checked(){return l.temperature},onChange:p=>c("temperature",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.reasoning")},get checked(){return l.reasoning},onChange:p=>c("reasoning",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.attachment")},get checked(){return l.attachment},onChange:p=>c("attachment",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.toolCall")},get checked(){return l.toolCall},onChange:p=>c("toolCall",p)}),null),i(x,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>o.close(),get children(){return t.t("common.cancel")}}),null),i(x,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),m}})}function Ce(e){return(()=>{var t=Hn(),r=t.firstChild;return i(r,()=>e.label),i(t,n(K,{get checked(){return e.checked},get onChange(){return e.onChange},hideLabel:!0,get children(){return e.label}}),null),t})()}var ri=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),ni=w("<div>"),ii=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),si=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),li=w('<span class="text-11-regular text-text-weak">'),oi=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),ai=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span><span class="text-11-regular text-text-weaker"></span></div><div class="flex flex-col gap-1.5"></div></div></div><div class="flex justify-end gap-2 pt-1">'),ci=w('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const di=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("file://"),ui=e=>/^https?:\/\//.test(e),gi=e=>/(token|secret|password|apikey|api[_-]?key|auth)/i.test(e),Se=()=>({key:"",value:""}),mi=e=>{if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}},pi=e=>{const t=e.trim();if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;if(/^-?\d+(\.\d+)?$/.test(t)){const r=Number(t);if(!Number.isNaN(r))return r}if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")||t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{}return e};function fi(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",f=M(()=>(r.data.config.plugin??[]).map((k,b)=>Array.isArray(k)?{index:b,spec:k,specifier:k[0],options:k[1]}:{index:b,spec:k,specifier:k,options:{}})),l=re(()=>({mutationFn:async h=>{const k=(r.data.config.plugin??[]).slice();k.splice(h,1),await r.updateConfig({plugin:k}),await u.client.global.dispose().catch(()=>{})},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("plugins.toast.removed")})},onError:h=>{N({variant:"error",title:t.t("common.requestFailed"),description:h instanceof Error?h.message:String(h)})}})),c=h=>{a.show(()=>n(vi,{entry:h}))};return[(()=>{var h=ni();return i(h,n(F,{get when(){return!o()},get children(){var k=ri(),b=k.firstChild,D=b.nextSibling;return i(b,()=>t.t("plugins.page.title")),i(D,()=>t.t("plugins.page.subtitle",{count:f().length})),k}}),null),i(h,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>c(),get children(){return t.t("plugins.page.add")}}),null),Q(k=>G(h,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},k)),h})(),n(F,{get when(){return f().length>0},get fallback(){return(()=>{var h=si();return i(h,()=>t.t("plugins.page.empty")),h})()},get children(){var h=ii();return i(h,n(X,{get each(){return f()},children:k=>n(hi,{plugin:k,onEdit:()=>c(k),onRemove:()=>{window.confirm(t.t("plugins.page.confirm.remove",{name:k.specifier}))&&l.mutate(k.index)}})})),h}})]}function hi(e){const t=q(),r=()=>di(e.plugin.specifier)?t.t("plugins.kind.local"):ui(e.plugin.specifier)?t.t("plugins.kind.remote"):t.t("plugins.kind.package"),u=()=>Object.keys(e.plugin.options).length;return(()=>{var a=oi(),o=a.firstChild,f=o.firstChild,l=f.firstChild,c=l.firstChild,h=f.nextSibling;return i(l,n(ce,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),c),i(c,()=>e.plugin.specifier),i(l,n(te,{get children(){return r()}}),null),i(l,n(F,{get when(){return u()>0},get children(){var k=li();return i(k,()=>t.t("plugins.row.optionCount",{count:u()})),k}}),null),i(h,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(h,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),a})()}function vi(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,f=()=>{const s=e.entry;if(!s)return{specifier:"",options:[Se()],errors:{}};const g=Object.entries(s.options).map(([d,_])=>({key:d,value:mi(_)}));return{specifier:s.specifier,options:g.length>0?g:[Se()],errors:{}}},[l,c]=me(f()),h=()=>{const s={};return l.specifier.trim()||(s.specifier=t.t("plugins.editor.error.specifier")),c("errors",s),Object.keys(s).length===0},k=()=>{const s=l.specifier.trim(),g={};for(const d of l.options){const _=d.key.trim();_&&(g[_]=pi(d.value))}return Object.keys(g).length===0?s:[s,g]},b=re(()=>({mutationFn:async()=>{if(!h())return;const s=k(),g=(r.data.config.plugin??[]).slice();o&&e.entry?g[e.entry.index]=s:g.push(s),await r.updateConfig({plugin:g}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("plugins.toast.updated"):t.t("plugins.toast.added")}),a.close()},onError:s=>{N({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),D=s=>{s.preventDefault(),!b.isPending&&b.mutate()},m=(s,g,d)=>{c("options",s,g,d)},S=()=>{c("options",Ee(s=>s.push(Se())))},v=s=>{c("options",Ee(g=>{g.splice(s,1),g.length===0&&g.push(Se())}))};return n(be,{get title(){return o?t.t("plugins.editor.title.edit"):t.t("plugins.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=ai(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=_.firstChild,x=$.nextSibling,p=_.nextSibling,z=g.nextSibling;return s.addEventListener("submit",D),i(g,n(U,{autofocus:!0,get label(){return t.t("plugins.editor.specifier")},get description(){return t.t("plugins.editor.specifier.description")},placeholder:"@my-org/my-plugin",get value(){return l.specifier},onChange:j=>ae(()=>{c("specifier",j),c("errors","specifier",void 0)}),get error(){return l.errors.specifier},spellcheck:!1,class:"font-mono text-xs"}),d),i($,()=>t.t("plugins.editor.options")),i(x,()=>t.t("plugins.editor.options.description")),i(p,n(X,{get each(){return l.options},children:(j,P)=>n(bi,{row:j,onKeyChange:L=>m(P(),"key",L),onValueChange:L=>m(P(),"value",L),onRemove:()=>v(P())})})),i(d,n(O,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",onClick:S,get children(){return t.t("plugins.editor.option.add")}}),null),i(z,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(z,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function bi(e){const t=q(),[r,u]=ge(!1);let a;const o=M(()=>gi(e.row.key)),f=()=>o()&&!r()?"password":"text",l=()=>{a&&clearTimeout(a),u(!0),a=setTimeout(()=>u(!1),1500)},c=h=>{o()&&h.key==="Enter"&&(h.preventDefault(),l())};return(()=>{var h=ci(),k=h.firstChild,b=k.nextSibling;return i(k,n(U,{variant:"ghost",get placeholder(){return t.t("plugins.editor.option.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),i(b,n(U,{variant:"ghost",get type(){return f()},get placeholder(){return t.t("plugins.editor.option.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:c,spellcheck:!1,class:"font-mono text-xs"})),i(h,n(F,{get when(){return o()},get children(){return n(Y,{type:"button",variant:"ghost",size:"normal",get icon(){return r()?"eye":"shield"},get"aria-label"(){return t.t(r()?"plugins.editor.option.hide":"plugins.editor.option.reveal")},onPointerDown:()=>{a&&clearTimeout(a),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),i(h,n(Y,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),h})()}var xi=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),wi=w("<div>"),Je=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Qe=w('<div class="flex flex-col gap-3"><div class="text-12-medium text-text-weak">'),ki=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-6 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Xe=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),$i=w('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),yi=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),_i=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),Ci=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-end gap-2"><div class="min-w-0 flex-1"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Si=w("<button type=button>");const qe=e=>e==="allow"||e==="ask"||e==="deny",at=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(qe),We=e=>e?typeof e=="string"?{"*":e}:{...e}:{},Ye=(e,t)=>new RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(t),Di=e=>Object.entries(We(e)).flatMap(([t,r])=>qe(r)?[{permission:t,pattern:"*",action:r}]:at(r)?Object.entries(r).map(([u,a])=>({permission:t,pattern:u,action:a})):[]),Ze=(e,t)=>Di(e).slice().reverse().find(r=>Ye(r.permission,"skill")&&Ye(r.pattern,t))?.action??"allow",Ei=e=>{const t=We(e).skill;return qe(t)?{"*":t}:at(t)?{...t}:{}},ct=e=>({paths:e.paths,urls:e.urls});function Pi(e={}){const t=q(),r=ee(),u=ie(),a=je(),o=lt(),f=Z(),l=()=>e.layout==="page",[c,h]=nt(()=>u.client.app.skills().then(d=>d.data??[]).catch(()=>[])),k=M(()=>{const d=c();return Array.isArray(d)?d.slice().sort((_,$)=>_.name.localeCompare($.name)):[]}),b=M(()=>[...(r.data.config.skills?.paths??[]).map((d,_)=>({kind:"path",index:_,value:d})),...(r.data.config.skills?.urls??[]).map((d,_)=>({kind:"url",index:_,value:d}))]),D=M(()=>k().filter(d=>Ze(r.data.config.permission,d.name)!=="deny").length),m=M(()=>!!o.isLocal()&&!!a.openPath),S=re(()=>({mutationFn:async d=>{const _=We(r.data.config.permission),$=Ei(_);delete $[d.name],$[d.name]=d.enabled?"allow":"deny",delete _.skill,_.skill=$,await r.updateConfig({permission:_}),await u.client.global.dispose().catch(()=>{}),h.refetch()},onError:d=>{N({variant:"error",title:t.t("common.requestFailed"),description:d instanceof Error?d.message:String(d)})}})),v=re(()=>({mutationFn:async d=>{const _=(r.data.config.skills?.paths??[]).slice(),$=(r.data.config.skills?.urls??[]).slice();d.kind==="path"&&_.splice(d.index,1),d.kind==="url"&&$.splice(d.index,1),await r.updateConfig({skills:ct({paths:_,urls:$})}),await u.client.global.dispose().catch(()=>{}),h.refetch()},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("skills.toast.sourceRemoved")})},onError:d=>{N({variant:"error",title:t.t("common.requestFailed"),description:d instanceof Error?d.message:String(d)})}})),s=d=>{f.show(()=>n(Ii,{entry:d,onSaved:()=>void h.refetch()}))},g=d=>{!a.openPath||!m()||a.openPath(d.location)};return[(()=>{var d=wi();return i(d,n(F,{get when(){return!l()},get children(){var _=xi(),$=_.firstChild,x=$.nextSibling;return i($,()=>t.t("skills.page.title")),i(x,()=>t.t("skills.page.subtitle",{enabled:D(),total:k().length,sources:b().length})),_}}),null),i(d,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>s(),get children(){return t.t("skills.page.addSource")}}),null),Q(_=>G(d,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!l(),"justify-end":l()},_)),d})(),(()=>{var d=Qe(),_=d.firstChild;return i(_,()=>t.t("skills.section.sources")),i(d,n(F,{get when(){return b().length>0},get fallback(){return(()=>{var $=ki();return i($,()=>t.t("skills.sources.empty")),$})()},get children(){var $=Je();return i($,n(X,{get each(){return b()},children:x=>n(zi,{source:x,onEdit:()=>s(x),onRemove:()=>{window.confirm(t.t("skills.sources.confirm.remove",{source:x.value}))&&v.mutate(x)}})})),$}}),null),d})(),(()=>{var d=Qe(),_=d.firstChild;return i(_,()=>t.t("skills.section.available")),i(d,n(F,{get when(){return!c.loading},get fallback(){return(()=>{var $=Xe();return i($,()=>t.t("common.loading")),$})()},get children(){return n(F,{get when(){return k().length>0},get fallback(){return(()=>{var $=Xe();return i($,()=>t.t("skills.page.empty")),$})()},get children(){var $=Je();return i($,n(X,{get each(){return k()},children:x=>n(ji,{skill:x,enabled:()=>Ze(r.data.config.permission,x.name)!=="deny",toggling:()=>S.isPending&&S.variables?.name===x.name,canOpen:m,onToggle:p=>S.mutate({name:x.name,enabled:p}),onOpen:()=>g(x)})})),$}})}}),null),d})()]}function ji(e){const t=q(),r=()=>e.skill.location.replace(/\\/g,"/"),u=()=>{const a=r();return a.includes("/.claude/skills/")?t.t("skills.kind.claude"):a.includes("/.agents/skills/")?t.t("skills.kind.agents"):a.includes("/.codeplane/")?t.t("skills.kind.codeplane"):t.t("skills.kind.local")};return(()=>{var a=yi(),o=a.firstChild,f=o.firstChild,l=f.firstChild,c=l.firstChild,h=l.nextSibling,k=f.nextSibling;return i(l,n(ce,{name:"checklist",size:"small",class:"icon-strong-base shrink-0"}),c),i(c,()=>e.skill.name),i(l,n(te,{get children(){return u()}}),null),i(l,n(F,{get when(){return!e.enabled()},get children(){return n(te,{get children(){return t.t("skills.tag.disabled")}})}}),null),i(f,n(F,{get when(){return e.skill.description},get children(){var b=$i();return i(b,()=>e.skill.description),b}}),h),i(h,()=>e.skill.location),i(k,n(K,{get checked(){return e.enabled()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("skills.row.openFile")},get disabled(){return!e.canOpen()},get onClick(){return e.onOpen}}),null),a})()}function zi(e){const t=q(),r=()=>e.source.kind==="path"?t.t("skills.source.path"):t.t("skills.source.url");return(()=>{var u=_i(),a=u.firstChild,o=a.firstChild,f=o.firstChild,l=f.firstChild,c=o.nextSibling;return i(f,n(ce,{get name(){return e.source.kind==="path"?"folder":"link"},size:"small",class:"icon-strong-base shrink-0"}),l),i(l,()=>e.source.value),i(f,n(te,{get children(){return r()}}),null),i(c,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(c,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),u})()}function Ii(e){const t=q(),r=ee(),u=ie(),a=je(),o=lt(),f=Z(),l=!!e.entry,[c,h]=me({kind:e.entry?.kind??"path",value:e.entry?.value??"",errors:{}}),k=()=>c.kind==="path"&&!!a.openDirectoryPickerDialog&&o.isLocal(),b=()=>{const v=c.value.trim(),s={};return v||(s.value=t.t("skills.editor.error.value")),c.kind==="url"&&v&&!/^https?:\/\//i.test(v)&&(s.value=t.t("skills.editor.error.url")),h("errors",s),Object.keys(s).length===0},D=re(()=>({mutationFn:async()=>{if(!b())return;const v=(r.data.config.skills?.paths??[]).slice(),s=(r.data.config.skills?.urls??[]).slice();e.entry?.kind==="path"&&v.splice(e.entry.index,1),e.entry?.kind==="url"&&s.splice(e.entry.index,1);const g=c.kind==="path"?v:s;if(g.includes(c.value.trim())){h("errors","value",t.t("skills.editor.error.duplicate"));return}e.entry&&e.entry.kind===c.kind?g.splice(e.entry.index,0,c.value.trim()):g.push(c.value.trim()),await r.updateConfig({skills:ct({paths:v,urls:s})}),await u.client.global.dispose().catch(()=>{}),e.onSaved(),N({variant:"success",icon:"circle-check",title:l?t.t("skills.toast.sourceUpdated"):t.t("skills.toast.sourceAdded")}),f.close()},onError:v=>{N({variant:"error",title:t.t("common.requestFailed"),description:v instanceof Error?v.message:String(v)})}})),m=()=>{!k()||!a.openDirectoryPickerDialog||a.openDirectoryPickerDialog({title:t.t("skills.editor.browse.title")}).then(v=>{v&&h("value",Array.isArray(v)?v[0]??"":v)})},S=v=>{v.preventDefault(),!D.isPending&&D.mutate()};return n(be,{get title(){return l?t.t("skills.editor.title.edit"):t.t("skills.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var v=Ci(),s=v.firstChild,g=s.firstChild,d=g.firstChild,_=d.nextSibling,$=g.nextSibling,x=$.firstChild,p=s.nextSibling;return v.addEventListener("submit",S),i(d,()=>t.t("skills.editor.type")),i(_,n(et,{get active(){return c.kind==="path"},get label(){return t.t("skills.source.path")},onClick:()=>h("kind","path")}),null),i(_,n(et,{get active(){return c.kind==="url"},get label(){return t.t("skills.source.url")},onClick:()=>h("kind","url")}),null),i(x,n(U,{autofocus:!0,get label(){return A(()=>c.kind==="path")()?t.t("skills.editor.path"):t.t("skills.editor.url")},get description(){return A(()=>c.kind==="path")()?t.t("skills.editor.path.description"):t.t("skills.editor.url.description")},get placeholder(){return c.kind==="path"?"~/.codeplane/skills":"https://example.com/.well-known/skills/"},get value(){return c.value},onChange:z=>ae(()=>{h("value",z),h("errors","value",void 0)}),get error(){return c.errors.value},spellcheck:!1,class:"font-mono text-xs"})),i($,n(F,{get when(){return k()},get children(){return n(O,{type:"button",variant:"secondary",size:"large",icon:"folder",onClick:m,get children(){return t.t("skills.editor.browse")}})}}),null),i(p,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>f.close(),get children(){return t.t("common.cancel")}}),null),i(p,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return D.isPending},get children(){return A(()=>!!D.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),v}})}function et(e){return(()=>{var t=Si();return it(t,"click",e.onClick,!0),i(t,()=>e.label),Q(r=>G(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},r)),t})()}Ae(["click"]);var Fi=w('<div class=size-full><div><div class="shrink-0 flex items-center justify-between gap-4 border-b border-border-weak-base pb-4"><div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Li=w('<div class="h-full min-h-[240px]">');const Mi={general:{component:yr},shortcuts:{component:Wr},providers:{component:dn},modes:{component:kn},models:{component:Zn},mcp:{component:Rn},plugins:{component:fi},skills:{component:Pi}};function Ai(){const e=q(),t=Rt(),r=Ut(),u=M(()=>At(t.tab)),a=M(()=>Kt(u())),o=M(()=>Mi[u()]),f=M(()=>o().component);return Nt(()=>{t.tab&&t.tab!==u()&&r(Tt(u()),{replace:!0})}),(()=>{var l=Fi(),c=l.firstChild,h=c.firstChild,k=h.firstChild,b=k.firstChild,D=b.nextSibling;return i(b,()=>e.t(a().titleKey)),i(D,()=>e.t(a().descriptionKey)),i(c,n(Wt,{get fallback(){return Li()},get children(){return n(qt,{get component(){return f()},layout:"page"})}}),null),Q(m=>{var S=!!o().contentScroll,v=!o().contentScroll,s={"mx-auto flex w-full max-w-3xl flex-col gap-6 px-6 py-8":!0,"h-full min-h-0":o().contentScroll,"min-h-full":!o().contentScroll};return S!==m.e&&l.classList.toggle("overflow-hidden",m.e=S),v!==m.t&&l.classList.toggle("overflow-y-auto",m.t=v),m.a=G(c,s,m.a),m},{e:void 0,t:void 0,a:void 0}),l})()}export{Ai as default};
1
+ import{l as i,y as w,aF as vt,f as q,aG as bt,C as ee,aH as tt,aI as xt,e as je,b as Z,E as ge,J as Te,j as M,m as n,q as F,N as Q,O as G,aJ as ve,a3 as K,B as O,p as A,T as U,aK as wt,aL as kt,aM as $t,aN as yt,aO as _t,aP as Ct,X as Ie,z as N,aQ as St,aR as Dt,aS as Et,aT as Pt,t as ce,v as be,aU as jt,Q as Ae,al as zt,h as me,o as It,L as X,V as Ft,aV as Lt,aE as Mt,ao as Ot,I as Y,R as ie,a7 as rt,aa as De,a8 as te,i as re,aq as ae,w as nt,aW as it,aj as Ee,aX as st,c as lt,a4 as Rt,u as Ut,k as Nt,aY as Tt,aZ as At,a_ as Kt,a$ as qt,b0 as Wt}from"./index-BYGEr28T.js";import{f as Vt}from"./list-Clic9hNL.js";import{P as ke}from"./provider-icon-Cu61Vlk5.js";import{D as Bt}from"./dialog-connect-provider-Dx4RsF3a.js";import{a as Gt,D as Ht}from"./dialog-select-provider-DrIJ2cy4.js";function Pe(e){return e.granted||e.restartRequired===!0}function ne(e){return!Pe(e)||e.restartRequired?!1:e.active!==!1}function ye(e){return Pe(e)&&!ne(e)}var Jt=w('<div class="bg-surface-base px-4 rounded-lg">');const le=e=>(()=>{var t=Jt();return i(t,()=>e.children),t})();var Qt=w("<div data-action=settings-auto-accept-permissions>"),Xt=w("<div data-action=settings-codeplane-coauthor>"),Yt=w("<div data-action=settings-feed-reasoning-summaries>"),Zt=w("<div data-action=settings-feed-shell-tool-parts-expanded>"),er=w("<div data-action=settings-feed-edit-tool-parts-expanded>"),tr=w("<div data-action=settings-show-session-progress-bar>"),rr=w("<div data-action=settings-browser-use>"),nr=w("<div data-action=settings-computer-use>"),ir=w("<div data-action=settings-debug-logging>"),sr=w('<div class="flex flex-col gap-1">'),lr=w("<div data-action=settings-show-file-tree>"),or=w("<div data-action=settings-show-navigation>"),ar=w("<div data-action=settings-show-search>"),cr=w("<div data-action=settings-show-terminal>"),dr=w("<div data-action=settings-show-status>"),_e=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Fe=w('<div class="w-full sm:w-[220px]">'),ur=w("<div data-action=settings-notifications-agent>"),gr=w("<div data-action=settings-notifications-permissions>"),mr=w("<div data-action=settings-notifications-errors>"),pr=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2"></h3><div class=pt-2>'),fr=w('<div data-action=settings-check-update class="flex gap-2 items-center">'),hr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">'),vr=w('<div><div class="flex flex-col gap-8 w-full">'),br=w('<p class="text-12-regular text-text-weak leading-relaxed">'),xr=w('<div class="flex w-full flex-col gap-4 px-5 pb-5"><p class="text-14-regular text-text-base leading-relaxed"></p><div class="flex items-center justify-between gap-3"><span></span></div><div class="flex flex-col gap-2"></div><div class="flex flex-col-reverse gap-2 border-t border-border-weak-base pt-3 sm:flex-row sm:items-center sm:justify-between"><div class="flex flex-col-reverse gap-2 sm:flex-row sm:items-center">'),wr=w('<div class="sm:shrink-0 sm:pt-0.5">'),kr=w('<div><div class="flex min-w-0 flex-1 flex-col gap-1.5"><div class="flex items-center gap-2"><span class="text-14-medium text-text-strong"></span><span></span></div><span class="text-12-regular text-text-weak leading-relaxed">'),$r=w('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let oe={cleanup:void 0,timeout:void 0,run:0};const ot=()=>{oe.run+=1,oe.cleanup&&oe.cleanup(),clearTimeout(oe.timeout),oe.cleanup=void 0},Ve=e=>{if(ot(),!e)return;const t=++oe.run;oe.timeout=setTimeout(()=>{jt(e).then(r=>{if(oe.run!==t){r?.();return}oe.cleanup=r})},100)},yr=e=>{const t=vt(),r=q(),u=bt(),a=ee(),o=tt(),f=xt(),l=je(),c=Z(),[h,k]=ge(!1),b=async()=>{k(!0);try{return await f.recheck(!1)}finally{k(!1)}},D=()=>f.status();Te(()=>{b(),(a.data.config.tools?.browser===void 0||a.data.config.tools?.computer===void 0)&&a.updateConfig({tools:{...a.data.config.tools,browser:a.data.config.tools?.browser??o.general.browserUse(),computer:a.data.config.tools?.computer??o.general.computerUse()}})});const m=M(()=>u.isGlobalAutoAccept()),S=E=>u.setGlobalAutoAccept(E),v=M(()=>a.data.config.commit?.coauthor===!0),s=E=>a.updateConfig({commit:{coauthor:E}}),g=M(()=>a.data.config.tools?.browser??o.general.browserUse()),d=M(()=>a.data.config.tools?.computer??o.general.computerUse()),_=M(()=>{const E=l.serverManager;if(!E)return;const C=E.currentKey??E.defaultKey??E.instances[0]?.key;return E.instances.find(y=>y.key===C)}),[$,x]=ge(!1),p=(E,C)=>{if(E==="browser"){o.general.setBrowserUse(C),a.updateConfig({tools:{browser:C}});return}if(!C){o.general.setComputerUse(!1),a.updateConfig({tools:{computer:!1}});return}(async()=>{if(!l.systemPermissions){o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}});return}if((await l.systemPermissions.check()).permissions.filter(W=>!ne(W)).length===0){o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}});return}c.show(()=>n(Cr,{tool:"computer",onConfirmEnable:()=>{o.general.setComputerUse(!0),a.updateConfig({tools:{computer:!0}})}}))})()},z=()=>{const E=_();!E?.local||!l.serverManager||(x(!0),l.serverManager.openLogDir(E.id).then(C=>{if(!C)throw new Error(r.t("settings.general.row.instanceLogs.unavailable"))}).catch(C=>{N({variant:"error",title:r.t("common.requestFailed"),description:C instanceof Error?C.message:String(C)})}).finally(()=>x(!1)))},j=M(()=>[{value:"system",label:r.t("theme.scheme.system")},{value:"light",label:r.t("theme.scheme.light")},{value:"dark",label:r.t("theme.scheme.dark")}]),P=M(()=>r.locales.map(E=>({value:E,label:r.label(E)}))),L=M(()=>[{value:"queue",label:r.t("settings.general.row.followup.option.queue")},{value:"steer",label:r.t("settings.general.row.followup.option.steer")}]),V=M(()=>[{value:"short",label:"Short"},{value:"full",label:"Full"},{value:"off",label:"Off"}]),I={id:"none",label:"sound.option.none"},H=[I,...Pt],pe=()=>Dt(o.appearance.font()),de=()=>St(o.appearance.uiFont()),B=()=>Et(o.appearance.terminalFont()),se=()=>e.layout==="page",fe=(E,C,y,R)=>({options:H,current:E()?H.find(W=>W.id===C())??I:I,value:W=>W.id,label:W=>r.t(W.label),onHighlight:W=>{W&&Ve(W.id==="none"?void 0:W.id)},onSelect:W=>{if(W){if(W.id==="none"){y(!1),ot();return}y(!0),R(W.id),Ve(W.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),J=()=>(()=>{var E=sr();return i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.language.title")},get description(){return r.t("settings.general.row.language.description")},get children(){return n(ve,{"data-action":"settings-language",get options(){return P()},get current(){return P().find(C=>C.value===r.locale())},value:C=>C.value,label:C=>C.label,onSelect:C=>C&&r.setLocale(C.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),n(T,{get title(){return r.t("command.permissions.autoaccept.enable")},get description(){return r.t("toast.permissions.autoaccept.on.description")},get children(){var C=Qt();return i(C,n(K,{get checked(){return m()},onChange:S})),C}}),n(T,{get title(){return r.t("settings.general.row.followup.title")},get description(){return r.t("settings.general.row.followup.description")},get children(){return n(ve,{"data-action":"settings-followup-behavior",get options(){return L()},get current(){return L().find(C=>C.value===o.general.followup())},value:C=>C.value,label:C=>C.label,onSelect:C=>C&&o.general.setFollowup(C.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),n(T,{get title(){return r.t("settings.general.row.codeplaneCoauthor.title")},get description(){return r.t("settings.general.row.codeplaneCoauthor.description")},get children(){var C=Xt();return i(C,n(K,{get checked(){return v()},onChange:y=>void s(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.reasoningSummaries.title")},get description(){return r.t("settings.general.row.reasoningSummaries.description")},get children(){var C=Yt();return i(C,n(ve,{get options(){return V()},get current(){return V().find(y=>y.value===o.general.reasoningDisplay())},value:y=>y.value,label:y=>y.label,onSelect:y=>y&&o.general.setReasoningDisplay(y.value),variant:"secondary",size:"small",triggerVariant:"settings"})),C}}),n(T,{get title(){return r.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return r.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var C=Zt();return i(C,n(K,{get checked(){return o.general.shellToolPartsExpanded()},onChange:y=>o.general.setShellToolPartsExpanded(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.editToolPartsExpanded.title")},get description(){return r.t("settings.general.row.editToolPartsExpanded.description")},get children(){var C=er();return i(C,n(K,{get checked(){return o.general.editToolPartsExpanded()},onChange:y=>o.general.setEditToolPartsExpanded(y)})),C}}),n(T,{get title(){return r.t("settings.general.row.showSessionProgressBar.title")},get description(){return r.t("settings.general.row.showSessionProgressBar.description")},get children(){var C=tr();return i(C,n(K,{get checked(){return o.general.showSessionProgressBar()},onChange:y=>o.general.setShowSessionProgressBar(y)})),C}}),n(F,{get when(){return f.hasDesktopBridge()},get children(){return[n(T,{get title(){return r.t("settings.general.row.browserUse.title")},get description(){return r.t("settings.general.row.browserUse.description")},get children(){var C=rr();return i(C,n(K,{get checked(){return g()},onChange:y=>p("browser",y)})),C}}),n(T,{get title(){return r.t("settings.general.row.computerUse.title")},get description(){return r.t("settings.general.row.computerUse.description")},get children(){var C=nr();return i(C,n(K,{get checked(){return d()},onChange:y=>p("computer",y)})),C}}),n(T,{get title(){return r.t("settings.general.row.debugLogging.title")},get description(){return r.t("settings.general.row.debugLogging.description")},get children(){var C=ir();return i(C,n(K,{get checked(){return o.general.debugLogging()},onChange:y=>o.general.setDebugLogging(y)})),C}}),n(F,{get when(){return _()?.local},get children(){return n(T,{get title(){return r.t("settings.general.row.instanceLogs.title")},get description(){return r.t("settings.general.row.instanceLogs.description")},get children(){return n(O,{type:"button",size:"small",variant:"secondary",icon:"folder","data-action":"settings-open-instance-logs",onClick:C=>{C.preventDefault(),z()},get disabled(){return $()},get children(){return A(()=>!!$())()?r.t("settings.general.row.instanceLogs.action.opening"):r.t("settings.general.row.instanceLogs.action.open")}})}})}})]}})]}})),E})(),he=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.advanced")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.showFileTree.title")},get description(){return r.t("settings.general.row.showFileTree.description")},get children(){var y=lr();return i(y,n(K,{get checked(){return o.general.showFileTree()},onChange:R=>o.general.setShowFileTree(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showNavigation.title")},get description(){return r.t("settings.general.row.showNavigation.description")},get children(){var y=or();return i(y,n(K,{get checked(){return o.general.showNavigation()},onChange:R=>o.general.setShowNavigation(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showSearch.title")},get description(){return r.t("settings.general.row.showSearch.description")},get children(){var y=ar();return i(y,n(K,{get checked(){return o.general.showSearch()},onChange:R=>o.general.setShowSearch(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showTerminal.title")},get description(){return r.t("settings.general.row.showTerminal.description")},get children(){var y=cr();return i(y,n(K,{get checked(){return o.general.showTerminal()},onChange:R=>o.general.setShowTerminal(R)})),y}}),n(T,{get title(){return r.t("settings.general.row.showStatus.title")},get description(){return r.t("settings.general.row.showStatus.description")},get children(){var y=dr();return i(y,n(K,{get checked(){return o.general.showStatus()},onChange:R=>o.general.setShowStatus(R)})),y}})]}}),null),E})(),we=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.appearance")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.row.colorScheme.title")},get description(){return r.t("settings.general.row.colorScheme.description")},get children(){return n(ve,{"data-action":"settings-color-scheme",get options(){return j()},get current(){return j().find(y=>y.value===t.colorScheme())},value:y=>y.value,label:y=>y.label,onSelect:y=>y&&t.setColorScheme(y.value),onHighlight:y=>{if(y)return t.previewColorScheme(y.value),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),n(T,{get title(){return r.t("settings.general.row.uiFont.title")},get description(){return r.t("settings.general.row.uiFont.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-ui-font",get label(){return r.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return de()},onChange:R=>o.appearance.setUIFont(R),placeholder:wt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":kt(o.appearance.uiFont())}}})),y}}),n(T,{get title(){return r.t("settings.general.row.font.title")},get description(){return r.t("settings.general.row.font.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-code-font",get label(){return r.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return pe()},onChange:R=>o.appearance.setFont(R),placeholder:$t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":yt(o.appearance.font())}}})),y}}),n(T,{get title(){return r.t("settings.general.row.terminalFont.title")},get description(){return r.t("settings.general.row.terminalFont.description")},get children(){var y=Fe();return i(y,n(U,{"data-action":"settings-terminal-font",get label(){return r.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return B()},onChange:R=>o.appearance.setTerminalFont(R),placeholder:_t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ct(o.appearance.terminalFont())}}})),y}})]}}),null),E})(),dt=async()=>{if(typeof window>"u")return!1;const E=window.codeplaneDesktop;return E?.notifications?.isSupported?await E.notifications.isSupported().catch(()=>!1):"Notification"in window?Notification.permission==="granted"?!0:Notification.permission==="denied"?!1:await Notification.requestPermission().catch(()=>"denied")==="granted":!1},ze=(E,C)=>async y=>{if(!y){C(!1);return}if(!await dt()){C(!1);return}C(!0)},ut=()=>{l.notify?.(r.t("settings.general.notifications.test.title"),r.t("settings.general.notifications.test.body"),"/").catch(()=>{})},gt=()=>(()=>{var E=pr(),C=E.firstChild,y=C.nextSibling;return i(C,()=>r.t("settings.general.section.notifications")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.notifications.agent.title")},get description(){return r.t("settings.general.notifications.agent.description")},get children(){var R=ur();return i(R,n(K,{get checked(){return o.notifications.agent()},get onChange(){return ze(o.notifications.agent(),W=>o.notifications.setAgent(W))}})),R}}),n(T,{get title(){return r.t("settings.general.notifications.permissions.title")},get description(){return r.t("settings.general.notifications.permissions.description")},get children(){var R=gr();return i(R,n(K,{get checked(){return o.notifications.permissions()},get onChange(){return ze(o.notifications.permissions(),W=>o.notifications.setPermissions(W))}})),R}}),n(T,{get title(){return r.t("settings.general.notifications.errors.title")},get description(){return r.t("settings.general.notifications.errors.description")},get children(){var R=mr();return i(R,n(K,{get checked(){return o.notifications.errors()},get onChange(){return ze(o.notifications.errors(),W=>o.notifications.setErrors(W))}})),R}})]}}),y),i(y,n(O,{variant:"secondary",size:"small",onClick:ut,"data-action":"settings-notifications-test",get children(){return r.t("settings.general.notifications.test.button")}})),E})(),mt=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.sounds")),i(E,n(le,{get children(){return[n(T,{get title(){return r.t("settings.general.sounds.agent.title")},get description(){return r.t("settings.general.sounds.agent.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-agent"},()=>fe(()=>o.sounds.agentEnabled(),()=>o.sounds.agent(),y=>o.sounds.setAgentEnabled(y),y=>o.sounds.setAgent(y))))}}),n(T,{get title(){return r.t("settings.general.sounds.permissions.title")},get description(){return r.t("settings.general.sounds.permissions.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-permissions"},()=>fe(()=>o.sounds.permissionsEnabled(),()=>o.sounds.permissions(),y=>o.sounds.setPermissionsEnabled(y),y=>o.sounds.setPermissions(y))))}}),n(T,{get title(){return r.t("settings.general.sounds.errors.title")},get description(){return r.t("settings.general.sounds.errors.description")},get children(){return n(ve,Ie({"data-action":"settings-sounds-errors"},()=>fe(()=>o.sounds.errorsEnabled(),()=>o.sounds.errors(),y=>o.sounds.setErrorsEnabled(y),y=>o.sounds.setErrors(y))))}})]}}),null),E})(),pt=()=>{const E=D();if(!E&&h()||!E)return r.t("settings.general.row.version.descriptionLoading");const C=E.current==="local"||E.current==="dev"?r.t("settings.general.row.version.developmentBuild"):E.current;return E.method==="desktop"&&!f.hasDesktopBridge()?r.t("settings.general.row.version.descriptionDesktopManaged",{current:C}):E.method==="managed-local"?r.t("settings.general.row.version.descriptionManagedLocal",{current:C}):E.method==="unknown"?r.t("settings.general.row.version.descriptionUnknownMethod",{current:C}):E.hasUpdate&&E.latest?r.t("settings.general.row.version.descriptionHasUpdate",{current:C,latest:E.latest}):r.t("settings.general.row.version.descriptionUpToDate",{current:C})},ft=()=>{const E=D();return!(!E?.hasUpdate||!E.latest||E.method==="unknown"||E.method==="managed-local"||E.method==="desktop"&&!f.hasDesktopBridge())},ht=()=>(()=>{var E=_e(),C=E.firstChild;return i(C,()=>r.t("settings.general.section.updates")),i(E,n(le,{get children(){return n(T,{get title(){return r.t("settings.general.row.version.title")},get description(){return pt()},get children(){var y=fr();return i(y,n(F,{get when(){return A(()=>!!D()?.current)()&&/^\d+\.\d+\.\d+/.test(D().current)},get children(){return n(O,{type:"button",size:"small",variant:"ghost",onClick:R=>{R.preventDefault(),f.openWhatsNew(D()?.current)},get disabled(){return f.isUpgrading()},get children(){return r.t("settings.general.row.version.action.whatsNew")}})}}),null),i(y,n(F,{get when(){return ft()},get fallback(){return n(O,{type:"button",size:"small",variant:"secondary",onClick:R=>{R.preventDefault(),b()},get disabled(){return h()||f.isUpgrading()},get children(){return A(()=>!!h())()?r.t("settings.general.row.version.action.checking"):r.t("settings.general.row.version.action.check")}})},get children(){return n(O,{type:"button",size:"small",variant:"primary",icon:"download",onClick:async R=>{R.preventDefault(),await f.startUpgrade(D()?.latest??void 0),await b()},get disabled(){return f.isUpgrading()},get children(){return A(()=>!!f.isUpgrading())()?r.t("settings.general.row.version.action.updating"):r.t("settings.general.row.version.action.update")}})}}),null),y}})}}),null),E})();return(()=>{var E=vr(),C=E.firstChild;return i(E,n(F,{get when(){return!se()},get children(){var y=hr(),R=y.firstChild,W=R.firstChild;return i(W,()=>r.t("settings.tab.general")),y}}),C),i(C,n(J,{}),null),i(C,n(we,{}),null),i(C,n(gt,{}),null),i(C,n(mt,{}),null),i(C,n(ht,{}),null),i(C,n(F,{get when(){return!1},get children(){return n(he,{})}}),null),Q(y=>G(E,{"flex flex-col":!0,"w-full":se(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!se()},y)),E})()};function _r(e){switch(e){case"accessibility":return"settings.general.row.computerUse.permissionDescription.accessibility";case"screen-recording":return"settings.general.row.computerUse.permissionDescription.screenRecording";default:return"settings.general.row.computerUse.permissionDescription.generic"}}function Cr(e){const t=q(),r=je(),u=Z(),[a,o]=ge(null),[f,l]=ge(!1),[c,h]=ge([]),[k,b]=ge(!1),D=async()=>{const x=await r.systemPermissions?.check();x&&h(x.permissions)};Te(()=>{D();const x=setInterval(()=>void D(),2e3),p=()=>void D();return window.addEventListener("focus",p),()=>{clearInterval(x),window.removeEventListener("focus",p)}});const m=()=>{e.onClose?.(),u.close()},S=async x=>{o(x);try{await r.systemPermissions?.request(x)}finally{o(null)}},v=async()=>{l(!0);try{await D()}finally{setTimeout(()=>l(!1),250)}},s=async()=>{b(!0);try{(await r.relaunchShell?.()??!1)||N({variant:"default",title:t.t("settings.general.row.computerUse.relaunchUnavailable.title"),description:t.t("settings.general.row.computerUse.relaunchUnavailable.description")})}finally{b(!1)}},g=()=>e.tool==="browser"?t.t("settings.general.row.browserUse.title"):t.t("settings.general.row.computerUse.title"),d=M(()=>c().length>0&&c().every(ne)),_=M(()=>c().some(ye)),$=M(()=>c().filter(ne).length);return n(be,{get title(){return t.t("settings.general.row.computerUse.permissionsTitle",{tool:g()})},fit:!0,class:"w-[calc(100vw-2rem)] max-w-[40rem]",transition:!0,get children(){var x=xr(),p=x.firstChild,z=p.nextSibling,j=z.firstChild,P=z.nextSibling,L=P.nextSibling,V=L.firstChild;return i(p,()=>t.t("settings.general.row.computerUse.permissionsBody",{tool:g(),count:String(c().length)})),i(j,n(ce,{get name(){return A(()=>!!d())()?"circle-check":_()?"reset":"circle-ban-sign"},class:"h-3.5 w-3.5"}),null),i(j,(()=>{var I=A(()=>!!d());return()=>I()?t.t("settings.general.row.computerUse.statusAllGranted"):A(()=>!!_())()?t.t("settings.general.row.computerUse.statusRelaunchRequired"):t.t("settings.general.row.computerUse.statusActivePartial",{active:String($()),total:String(c().length)})})(),null),i(z,n(O,{size:"small",variant:"ghost",get disabled(){return f()},onClick:I=>{I.preventDefault(),v()},get children(){return A(()=>!!f())()?t.t("settings.general.row.computerUse.recheckLoading"):t.t("settings.general.row.computerUse.recheck")}}),null),i(P,()=>c().map(I=>(()=>{var H=kr(),pe=H.firstChild,de=pe.firstChild,B=de.firstChild,se=B.nextSibling,fe=de.nextSibling;return i(de,n(ce,{get name(){return A(()=>!!ne(I))()?"circle-check":ye(I)?"reset":"circle-ban-sign"},get classList(){return{"h-4 w-4 shrink-0":!0,"text-text-on-success-strong":ne(I),"text-text-on-warning-strong":!ne(I)}}}),B),i(B,()=>I.label),i(se,(()=>{var J=A(()=>!!ne(I));return()=>J()?t.t("settings.general.row.computerUse.permissionGranted"):A(()=>!!ye(I))()?t.t("settings.general.row.computerUse.permissionRelaunchRequired"):t.t("settings.general.row.computerUse.permissionMissing")})()),i(fe,()=>t.t(_r(I.key))),i(H,n(F,{get when(){return!Pe(I)},get children(){var J=wr();return i(J,n(O,{size:"small",variant:"secondary",get disabled(){return a()===I.key},onClick:he=>{he.preventDefault(),S(I.key)},get children(){return A(()=>a()===I.key)()?t.t("settings.general.row.computerUse.permissionOpening"):t.t("settings.general.row.computerUse.permissionOpenSettings")}})),J}}),null),Q(J=>{var he={"flex flex-col gap-2 rounded-lg border px-3.5 py-3 sm:flex-row sm:items-start sm:justify-between":!0,"border-border-success-base bg-surface-success-weak/40":ne(I),"border-border-warning-base bg-surface-warning-weak/40":ye(I),"border-border-weak-base":!Pe(I)},we={"rounded-full px-1.5 py-0.5 text-11-medium":!0,"bg-surface-success-weak text-text-on-success-strong":ne(I),"bg-surface-warning-weak text-text-on-warning-strong":!ne(I)};return J.e=G(H,he,J.e),J.t=G(se,we,J.t),J},{e:void 0,t:void 0}),H})())),i(x,n(F,{get when(){return!d()},get children(){var I=br();return i(I,()=>t.t(_()?"settings.general.row.computerUse.permissionsRelaunchFooter":"settings.general.row.computerUse.permissionsFooter")),I}}),L),i(L,n(O,{variant:"ghost",size:"normal",onClick:m,get children(){return t.t("settings.general.row.computerUse.permissionDone")}}),V),i(V,n(F,{get when(){return A(()=>!!e.onConfirmEnable)()&&!d()},get children(){return n(O,{variant:"ghost",size:"normal",onClick:I=>{I.preventDefault(),e.onConfirmEnable?.(),m()},get children(){return t.t("settings.general.row.computerUse.enableAnyway")}})}}),null),i(V,n(F,{get when(){return A(()=>!!r.relaunchShell)()&&!d()},get children(){return n(O,{get variant(){return e.onConfirmEnable?"ghost":"primary"},size:"normal",get disabled(){return k()},onClick:I=>{I.preventDefault(),s()},get children(){return A(()=>!!k())()?t.t("settings.general.row.computerUse.relaunchPending"):t.t("settings.general.row.computerUse.relaunch")}})}}),null),i(V,n(F,{get when(){return A(()=>!!d())()&&e.onConfirmEnable},get children(){return n(O,{variant:"primary",size:"normal",onClick:I=>{I.preventDefault(),e.onConfirmEnable?.(),m()},get children(){return t.t("settings.general.row.computerUse.enableNow")}})}}),null),Q(I=>G(j,{"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-12-medium":!0,"bg-surface-success-weak text-text-on-success-strong":d(),"bg-surface-warning-weak text-text-on-warning-strong":!d()},I)),x}})}const T=e=>(()=>{var t=$r(),r=t.firstChild,u=r.firstChild,a=u.nextSibling,o=r.nextSibling;return i(u,()=>e.title),i(a,()=>e.description),i(o,()=>e.children),t})();var Sr=w('<h2 class="text-16-medium text-text-strong">'),Dr=w('<div class="flex flex-col gap-4 max-w-[720px]"><div></div><div class="flex h-10 items-center gap-2 rounded-lg bg-surface-base px-3">'),Er=w('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Pr=w('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),jr=w('<div><div class="flex flex-col gap-8 max-w-[720px]">'),zr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="pt-6 pb-6">'),Ir=w('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Fr=w('<div class="flex items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><span class="text-14-regular text-text-strong"></span><button type=button>');const Le=typeof navigator=="object"&&/(Mac|iPod|iPhone|iPad)/.test(navigator.platform),xe="command.palette",Lr="mod+shift+p",$e=["General","Session","Navigation","Model and agent","Terminal","Prompt"],Mr={General:"settings.shortcuts.group.general",Session:"settings.shortcuts.group.session",Navigation:"settings.shortcuts.group.navigation","Model and agent":"settings.shortcuts.group.modelAndAgent",Terminal:"settings.shortcuts.group.terminal",Prompt:"settings.shortcuts.group.prompt"};function Me(e){return e===xe?"General":e.startsWith("terminal.")?"Terminal":e.startsWith("model.")||e.startsWith("agent.")||e.startsWith("mcp.")?"Model and agent":e.startsWith("file.")||e.startsWith("fileTree.")?"Navigation":e.startsWith("prompt.")?"Prompt":e.startsWith("session.")||e.startsWith("message.")||e.startsWith("permissions.")||e.startsWith("steps.")||e.startsWith("review.")?"Session":"General"}function Or(e){return e==="Shift"||e==="Control"||e==="Alt"||e==="Meta"}function Rr(e){return e===","?"comma":e==="+"?"plus":e===" "?"space":e.toLowerCase()}function Ur(e){if(Or(e.key))return;const t=[];(Le?e.metaKey:e.ctrlKey)&&t.push("mod"),Le&&e.ctrlKey&&t.push("ctrl"),!Le&&e.metaKey&&t.push("meta"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift");const u=Rr(e.key);if(u)return t.push(u),t.join("+")}function Ne(e){if(!e)return[];const t=[];for(const r of Lt(e)){const u=[];r.ctrl&&u.push("ctrl"),r.alt&&u.push("alt"),r.shift&&u.push("shift"),r.meta&&u.push("meta"),r.key&&u.push(r.key),u.length!==0&&t.push(u.join("+"))}return t}function Nr(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Tr(e,t,r){const u=new Map;u.set(xe,{title:r,group:"General"});for(const a of e.catalog)a.id.startsWith("suggested.")||u.set(a.id,{title:a.title,group:Me(a.id)});for(const a of e.options)a.id.startsWith("suggested.")||u.set(a.id,{title:a.title,group:Me(a.id)});for(const[a,o]of Object.entries(t))typeof o=="string"&&(u.has(a)||u.set(a,{title:a,group:Me(a)}));return u}function Ar(e){const t=new Map;for(const r of $e)t.set(r,[]);for(const[r,u]of e){const a=t.get(u.group);a&&a.push(r)}for(const r of $e){const u=t.get(r);u&&u.sort((a,o)=>(e.get(a)?.title??"").localeCompare(e.get(o)?.title??""))}return t}function Kr(e,t,r,u){const a=e.toLowerCase().trim();if(!a)return r;const o=new Map;for(const c of $e)o.set(c,[]);const f=Array.from(t.entries()).map(([c,h])=>({id:c,title:h.title,group:h.group,keybind:u(c)})),l=Vt.go(a,f,{keys:["title","keybind"],threshold:-1e4});for(const c of l){const h=o.get(c.obj.group);h&&h.push(c.obj.id)}return o}function qr(e){Te(()=>{Mt(document,"keydown",r=>{const u=e.active();if(!u)return;if(r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation(),r.key==="Escape"){e.stop();return}if((r.key==="Backspace"||r.key==="Delete")&&!r.ctrlKey&&!r.metaKey&&!r.altKey&&!r.shiftKey){e.set(u,"none"),e.stop();return}const o=Ur(r);if(!o)return;const f=new Map;for(const l of Ne(o))for(const c of e.used().get(l)??[])c.id!==u&&f.set(c.id,c.title);if(f.size>0){N({title:e.language.t("settings.shortcuts.conflict.title"),description:e.language.t("settings.shortcuts.conflict.description",{keybind:Ot(o,e.language.t),titles:[...f.values()].join(", ")})});return}e.set(u,o),e.stop()},{capture:!0})})}const Wr=e=>{const t=zt(),r=q(),u=tt(),[a,o]=me({active:null,filter:""}),f=()=>{a.active&&(o("active",null),t.keybinds(!0))},l=$=>{if(a.active===$){f();return}a.active&&f(),o("active",$),t.keybinds(!1)},c=M(()=>Nr(u.current.keybinds)),h=M(()=>Object.values(c()).some($=>typeof $=="string")),k=()=>{f(),u.keybinds.resetAll(),N({title:r.t("settings.shortcuts.reset.toast.title"),description:r.t("settings.shortcuts.reset.toast.description")})},b=M(()=>(r.locale(),Tr(t,c(),r.t("command.palette")))),D=$=>b().get($)?.title??"",m=M(()=>Ar(b())),S=M(()=>Kr(a.filter,b(),m(),$=>t.keybind($)||"")),v=M(()=>{for(const $ of $e)if((S().get($)??[]).length>0)return!0;return!1}),s=M(()=>{const $=new Map,x=(j,P)=>{const L=$.get(j);if(!L){$.set(j,[P]);return}L.push(P)},p=u.keybinds.get(xe)??Lr;for(const j of Ne(p))x(j,{id:xe,title:D(xe)});const z=j=>{const P=u.keybinds.get(j);if(typeof P=="string")return P;const L=t.options.find(I=>I.id===j);return L?.keybind?L.keybind:t.catalog.find(I=>I.id===j)?.keybind};for(const j of b().keys())if(j!==xe)for(const P of Ne(z(j)))x(P,{id:j,title:D(j)});return $}),g=($,x)=>u.keybinds.set($,x),d=()=>e.layout==="page";qr({active:()=>a.active,stop:f,set:g,used:s,language:r}),It(()=>{a.active&&t.keybinds(!0)});const _=()=>(()=>{var $=Dr(),x=$.firstChild,p=x.nextSibling;return i(x,n(F,{get when(){return!d()},get children(){var z=Sr();return i(z,()=>r.t("settings.shortcuts.title")),z}}),null),i(x,n(O,{size:"small",variant:"secondary",onClick:k,get disabled(){return!h()},get children(){return r.t("settings.shortcuts.reset.button")}}),null),i(p,n(ce,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),i(p,n(U,{variant:"ghost",type:"text",get value(){return a.filter},onChange:z=>o("filter",z),get placeholder(){return r.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),i(p,n(F,{get when(){return a.filter},get children(){return n(Y,{icon:"circle-x",variant:"ghost",onClick:()=>o("filter","")})}}),null),Q(z=>G(x,{"flex items-center gap-4":!0,"justify-end":d(),"justify-between":!d()},z)),$})();return(()=>{var $=jr(),x=$.firstChild;return i($,n(F,{get when(){return d()},get fallback(){return(()=>{var p=zr(),z=p.firstChild;return i(z,n(_,{})),p})()},get children(){return n(_,{})}}),x),i(x,n(X,{each:$e,children:p=>n(F,{get when(){return(S().get(p)??[]).length>0},get children(){var z=Ir(),j=z.firstChild;return i(j,()=>r.t(Mr[p])),i(z,n(le,{get children(){return n(X,{get each(){return S().get(p)??[]},children:P=>(()=>{var L=Fr(),V=L.firstChild,I=V.nextSibling;return i(V,()=>D(P)),I.$$click=()=>l(P),Ft(I,"data-keybind-id",P),i(I,n(F,{get when(){return a.active===P},get fallback(){return t.keybind(P)||r.t("settings.shortcuts.unassigned")},get children(){return r.t("settings.shortcuts.pressKeys")}})),Q(H=>G(I,{"h-8 px-3 rounded-md text-12-regular":!0,"bg-surface-base text-text-subtle hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active":a.active!==P,"border border-border-weak-base bg-surface-inset-base text-text-weak":a.active===P},H)),L})()})}}),null),z}})}),null),i(x,n(F,{get when(){return A(()=>!!a.filter)()&&!v()},get children(){var p=Pr(),z=p.firstChild;return i(z,()=>r.t("settings.shortcuts.search.empty")),i(p,n(F,{get when(){return a.filter},get children(){var j=Er(),P=j.firstChild,L=P.nextSibling;return L.nextSibling,i(j,()=>a.filter,L),j}}),null),p}}),null),Q(p=>G($,{"flex flex-col":!0,"w-full gap-6":d(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!d()},p)),$})()};Ae(["click"]);function Ke(e){if(e.catalog&&Object.keys(e.catalog.models).length>0)return{models:e.catalog.models,providerCatalog:!0};const t=new Map(Object.values(e.provider.models).map(r=>[r.id,r]));return e.catalogs?.forEach(r=>{Object.values(r.models).forEach(u=>{t.has(u.id)||t.set(u.id,u)})}),{models:Object.fromEntries(t),providerCatalog:!1}}function Vr(e){const t=Ke(e),r=Object.keys(t.models),u=new Set(r);return e.config?.whitelist?.length?new Set(e.config.whitelist.filter(a=>u.has(a))):e.config?.blacklist?.length?new Set(r.filter(a=>!e.config?.blacklist?.includes(a))):t.providerCatalog?new Set(r):new Set(Object.keys(e.provider.models).filter(a=>u.has(a)))}function Br(e){const t=Ke(e),r=Vr(e);return Object.values(t.models).map(u=>({id:u.id,model:u,selected:r.has(u.id)})).sort((u,a)=>u.model.name.localeCompare(a.model.name)||u.id.localeCompare(a.id))}function Gr(e,t){const r=t.trim().toLowerCase();return r?e.filter(u=>u.id.toLowerCase().includes(r)||u.model.name.toLowerCase().includes(r)):e}function Hr(e){const t=e.limit.context&&e.limit.output?{limit:{context:e.limit.context,output:e.limit.output,...e.limit.input!==void 0?{input:e.limit.input}:{}}}:{};return{name:e.name,temperature:e.capabilities.temperature,reasoning:e.capabilities.reasoning,attachment:e.capabilities.attachment,tool_call:e.capabilities.toolcall,...e.family?{family:e.family}:{},...e.release_date?{release_date:e.release_date}:{},...t}}function Jr(e,t,r=[],u={}){const a=new Set(u.includeModelIDs??[]),o=u.includeModels||a.size>0?Object.fromEntries(t.map(l=>{if(!u.includeModels&&!a.has(l))return;const c=r.find(h=>h.id===l);if(c)return[l,Hr(c.model)]}).filter(l=>!!l)):void 0,f=o?{...o,...e?.models??{}}:e?.models;return{...e??{},whitelist:t.slice().sort((l,c)=>l.localeCompare(c)),blacklist:[],...f?{models:f}:{}}}var Qr=w('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong">'),Xr=w('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Yr=w('<div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Zr=w('<div class="py-4 text-14-regular text-text-weak">'),en=w('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate"></span></div><div class="flex shrink-0 items-center gap-2">'),tn=w('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),rn=w('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),nn=w('<span class="text-12-regular text-text-weak pl-8">'),sn=w('<div class="pt-2 text-12-regular text-text-danger-base">'),ln=w('<div class="flex flex-col gap-5 px-2.5 pb-3 overflow-y-auto max-h-[70vh]"><div class="px-2.5 flex items-center justify-between gap-4"><div class="flex items-center gap-3 min-w-0"><div class=min-w-0><div class="text-16-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak"></div></div></div><div class="flex shrink-0 items-center gap-2"></div></div><div class=mx-2.5></div><form class="mx-2.5 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-2"></form><div class=px-2.5></div><div class="flex justify-end gap-2 px-2.5">'),on=w('<div class="px-4 py-10 text-center text-12-regular text-text-weak">'),an=w('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span><span class="text-12-regular text-text-weak truncate block">');const cn=[{match:e=>e==="codeplane",key:"dialog.provider.codeplane.note"},{match:e=>e==="anthropic",key:"dialog.provider.anthropic.note"},{match:e=>e.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:e=>e==="openai",key:"dialog.provider.openai.note"},{match:e=>e==="google",key:"dialog.provider.google.note"},{match:e=>e==="openrouter",key:"dialog.provider.openrouter.note"},{match:e=>e==="vercel",key:"dialog.provider.vercel.note"}],dn=e=>{const t=Z(),r=q(),u=ie(),a=ee(),o=rt(),f=M(()=>o.connected().filter(s=>s.id!=="codeplane"||Object.values(s.models).find(g=>g.cost?.input))),l=M(()=>{const s=new Set(f().map(d=>d.id)),g=o.popular().filter(d=>!s.has(d.id)).slice();return g.sort((d,_)=>De.indexOf(d.id)-De.indexOf(_.id)),g}),c=s=>{if(!("source"in s))return;const g=s.source;if(g==="env"||g==="api"||g==="config"||g==="custom")return g},h=s=>{const g=c(s);return g==="env"?r.t("settings.providers.tag.environment"):g==="api"?r.t("provider.connect.method.apiKey"):g==="config"?D(s.id)?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.config"):g==="custom"?r.t("settings.providers.tag.custom"):r.t("settings.providers.tag.other")},k=s=>c(s)!=="env",b=s=>cn.find(g=>g.match(s))?.key,D=s=>{const g=a.data.config.provider?.[s];return!(!g||g.npm!=="@ai-sdk/openai-compatible"||!g.models||Object.keys(g.models).length===0)},m=()=>e.layout==="page",S=async(s,g)=>{const d=a.data.config.disabled_providers??[],_=d.includes(s)?d:[...d,s];a.set("config","disabled_providers",_),await a.updateConfig({disabled_providers:_}).then(()=>{N({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch($=>{a.set("config","disabled_providers",d);const x=$ instanceof Error?$.message:String($);N({title:r.t("common.requestFailed"),description:x})})},v=async(s,g)=>{if(D(s)){await u.client.auth.remove({providerID:s}).catch(()=>{}),await S(s,g);return}await u.client.auth.remove({providerID:s}).then(async()=>{await u.client.global.dispose(),N({variant:"success",icon:"circle-check",title:r.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:r.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(d=>{const _=d instanceof Error?d.message:String(d);N({title:r.t("common.requestFailed"),description:_})})};return(()=>{var s=Yr(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=d.nextSibling,x=$.firstChild;return i(s,n(F,{get when(){return!m()},get children(){var p=Qr(),z=p.firstChild,j=z.firstChild;return i(j,()=>r.t("settings.providers.title")),p}}),g),i(_,()=>r.t("settings.providers.section.connected")),i(d,n(le,{get children(){return n(F,{get when(){return f().length>0},get fallback(){return(()=>{var p=Zr();return i(p,()=>r.t("settings.providers.connected.empty")),p})()},get children(){return n(X,{get each(){return f()},children:p=>(()=>{var z=en(),j=z.firstChild,P=j.firstChild,L=j.nextSibling;return i(j,n(ke,{get id(){return p.id},class:"size-5 shrink-0 icon-strong-base"}),P),i(P,()=>p.name),i(j,n(te,{get children(){return h(p)}}),null),i(L,n(O,{size:"large",variant:"ghost",icon:"edit",onClick:()=>t.show(()=>n(un,{provider:p})),get children(){return r.t("settings.providers.models.edit")}}),null),i(L,n(F,{get when(){return k(p)},get fallback(){return(()=>{var V=tn();return i(V,()=>r.t("settings.providers.connected.environmentDescription")),V})()},get children(){return n(O,{size:"large",variant:"ghost",onClick:()=>void v(p.id,p.name),get children(){return r.t("common.disconnect")}})}}),null),z})()})}})}}),null),i(x,()=>r.t("settings.providers.section.popular")),i($,n(le,{get children(){return[n(X,{get each(){return l()},children:p=>(()=>{var z=rn(),j=z.firstChild,P=j.firstChild,L=P.firstChild;return i(P,n(ke,{get id(){return p.id},class:"size-5 shrink-0 icon-strong-base"}),L),i(L,()=>p.name),i(P,n(F,{get when(){return p.id==="codeplane"},get children(){return n(te,{get children(){return r.t("dialog.provider.tag.recommended")}})}}),null),i(j,n(F,{get when(){return b(p.id)},keyed:!0,children:V=>(()=>{var I=nn();return i(I,()=>r.t(V)),I})()}),null),i(z,n(O,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>n(Bt,{get provider(){return p.id}}))},get children(){return r.t("common.connect")}}),null),z})()}),(()=>{var p=Xr(),z=p.firstChild,j=z.firstChild,P=j.firstChild,L=j.nextSibling;return i(j,n(ke,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),P),i(P,()=>r.t("provider.custom.title")),i(j,n(te,{get children(){return r.t("settings.providers.tag.custom")}}),null),i(L,()=>r.t("settings.providers.custom.description")),i(p,n(O,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>n(Gt,{back:"close"}))},get children(){return r.t("common.connect")}}),null),p})()]}}),null),i($,n(O,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>{t.show(()=>n(Ht,{}))},get children(){return r.t("dialog.provider.viewAll")}}),null),Q(p=>G(s,{"flex flex-col":!0,"w-full":m(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!m()},p)),s})()};function un(e){const t=Z(),r=ie(),u=ee(),a=q(),o=M(()=>u.data.provider.catalog.find(x=>x.id===e.provider.id)),f=M(()=>Ke({provider:e.provider,catalog:o(),catalogs:u.data.provider.catalog})),l=M(()=>u.data.config.provider?.[e.provider.id]),c=M(()=>Br({provider:e.provider,catalog:o(),catalogs:u.data.provider.catalog,config:l()})),[h,k]=me({selected:Object.fromEntries(c().map(x=>[x.id,x.selected])),added:{},addModelID:"",addModelName:"",search:"",addError:"",error:""}),b=M(()=>Object.values(h.added).map(x=>({id:x.id,model:x,selected:!!h.selected[x.id]}))),D=M(()=>{const x=new Set(c().map(p=>p.id));return[...c(),...b().filter(p=>x.has(p.id)?!1:(x.add(p.id),!0))].sort((p,z)=>p.model.name.localeCompare(z.model.name)||p.id.localeCompare(z.id))}),m=M(()=>Gr(D(),h.search)),S=M(()=>D().filter(x=>h.selected[x.id]).map(x=>x.id)),v=x=>{k("selected",Object.fromEntries(D().map(p=>[p.id,x]))),k("error","")},s=(x,p)=>{k("selected",x,p),k("error","")},g=x=>{for(const p of u.data.provider.catalog){const z=p.models[x];if(z)return z}},d=(x,p)=>g(x)??{id:x,providerID:e.provider.id,api:{id:x,url:Object.values(e.provider.models)[0]?.api.url??"",npm:Object.values(e.provider.models)[0]?.api.npm??"@ai-sdk/openai-compatible"},name:p,capabilities:{temperature:!0,reasoning:!1,attachment:!1,toolcall:!0,input:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:0,output:0},status:"active",options:{},headers:{},release_date:""},_=x=>{x.preventDefault();const p=h.addModelID.trim();if(!p){k("addError",a.t("settings.providers.models.add.error.id"));return}if(D().find(P=>P.id===p)){k("selected",p,!0),k("addModelID",""),k("addModelName",""),k("addError","");return}const j=d(p,h.addModelName.trim()||p);k("added",p,j),k("selected",p,!0),k("addModelID",""),k("addModelName",""),k("addError",""),k("error","")},$=re(()=>({mutationFn:async()=>{const x=S();if(x.length===0){k("error",a.t("settings.providers.models.error.required"));return}await u.updateConfig({provider:{[e.provider.id]:Jr(l(),x,D(),{includeModels:!f().providerCatalog,includeModelIDs:Object.keys(h.added)})}}),await r.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:a.t("settings.providers.models.toast.updated",{provider:e.provider.name})}),t.close()},onError:x=>{N({variant:"error",title:a.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}}));return n(be,{get title(){return a.t("settings.providers.models.title",{provider:e.provider.name})},transition:!0,get children(){var x=ln(),p=x.firstChild,z=p.firstChild,j=z.firstChild,P=j.firstChild,L=P.nextSibling,V=z.nextSibling,I=p.nextSibling,H=I.nextSibling,pe=H.nextSibling,de=pe.nextSibling;return i(z,n(ke,{get id(){return e.provider.id},class:"size-5 shrink-0 icon-strong-base"}),j),i(P,()=>e.provider.name),i(L,()=>a.t("settings.providers.models.count",{selected:S().length,total:D().length})),i(V,n(O,{type:"button",size:"small",variant:"ghost",onClick:()=>v(!0),get children(){return a.t("settings.providers.models.selectAll")}}),null),i(V,n(O,{type:"button",size:"small",variant:"ghost",onClick:()=>v(!1),get children(){return a.t("settings.providers.models.clear")}}),null),i(I,n(U,{variant:"normal",type:"search",get value(){return h.search},onChange:B=>k("search",B),get placeholder(){return a.t("common.search.placeholder")},get label(){return a.t("common.search.placeholder")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"})),H.addEventListener("submit",_),i(H,n(U,{variant:"normal",type:"text",get value(){return h.addModelID},onChange:B=>{k("addModelID",B),k("addError","")},get placeholder(){return a.t("settings.providers.models.add.id")},get label(){return a.t("settings.providers.models.add.id")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get error(){return h.addError},get validationState(){return h.addError?"invalid":void 0}}),null),i(H,n(U,{variant:"normal",type:"text",get value(){return h.addModelName},onChange:B=>k("addModelName",B),get placeholder(){return a.t("settings.providers.models.add.name")},get label(){return a.t("settings.providers.models.add.name")},hideLabel:!0}),null),i(H,n(O,{type:"submit",size:"large",variant:"secondary",icon:"plus-small",get children(){return a.t("settings.providers.models.add.submit")}}),null),i(pe,n(le,{get children(){return n(F,{get when(){return m().length>0},get fallback(){return(()=>{var B=on();return i(B,()=>a.t("settings.providers.models.empty")),B})()},get children(){return n(X,{get each(){return m()},children:B=>(()=>{var se=an(),fe=se.firstChild,J=fe.firstChild,he=J.nextSibling;return i(J,()=>B.model.name),i(he,()=>B.id),i(se,n(K,{get checked(){return!!h.selected[B.id]},onChange:we=>s(B.id,we),hideLabel:!0,get children(){return B.model.name}}),null),se})()})}})}}),null),i(pe,n(F,{get when(){return h.error},get children(){var B=sn();return i(B,()=>h.error),B}}),null),i(de,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>t.close(),get children(){return a.t("common.cancel")}}),null),i(de,n(O,{type:"button",variant:"primary",size:"large",get disabled(){return $.isPending},onClick:()=>$.mutate(),get children(){return A(()=>!!$.isPending)()?a.t("common.saving"):a.t("common.save")}}),null),x}})}var gn=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),mn=w("<div>"),pn=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),fn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),hn=w('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),vn=w('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),bn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),xn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-3 gap-3"></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">');const Be=e=>!!e&&typeof e=="object"&&!Array.isArray(e),wn=e=>e?{name:e.name,description:e.config.description??"",model:e.config.model??"",prompt:e.config.prompt??"",temperature:e.config.temperature!==void 0?String(e.config.temperature):"",topP:e.config.top_p!==void 0?String(e.config.top_p):"",steps:e.config.steps!==void 0?String(e.config.steps):"",hidden:!!e.config.hidden,disable:!!e.config.disable,errors:{}}:{name:"",description:"",model:"",prompt:"",temperature:"",topP:"",steps:"",hidden:!1,disable:!1,errors:{}};function kn(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",f=M(()=>{const b=r.data.config.mode??{},D=new Set(Object.keys(b));return[...Object.entries(b).filter(m=>Be(m[1])).map(([m,S])=>({name:m,config:S,source:"mode"})),...Object.entries(r.data.config.agent??{}).filter(m=>Be(m[1])).filter(([m,S])=>!D.has(m)&&(S.mode??"primary")!=="subagent").map(([m,S])=>({name:m,config:S,source:"agent"}))].sort((m,S)=>m.name.localeCompare(S.name))}),l=M(()=>f().filter(b=>b.config.disable!==!0).length),c=(b,D)=>b==="mode"?r.updateConfig({mode:D}):r.updateConfig({agent:D}),h=re(()=>({mutationFn:async b=>{const D={...b.mode.source==="mode"?r.data.config.mode:r.data.config.agent};D[b.mode.name]={...D[b.mode.name]??{},disable:!b.enabled},await c(b.mode.source,D),await u.client.global.dispose().catch(()=>{})},onError:b=>{N({variant:"error",title:t.t("common.requestFailed"),description:b instanceof Error?b.message:String(b)})}})),k=b=>{a.show(()=>n(yn,{entry:b}))};return[(()=>{var b=mn();return i(b,n(F,{get when(){return!o()},get children(){var D=gn(),m=D.firstChild,S=m.nextSibling;return i(m,()=>t.t("modes.page.title")),i(S,()=>t.t("modes.page.subtitle",{enabled:l(),total:f().length})),D}}),null),i(b,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>k(),get children(){return t.t("modes.page.add")}}),null),Q(D=>G(b,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},D)),b})(),n(F,{get when(){return f().length>0},get fallback(){return(()=>{var b=fn();return i(b,()=>t.t("modes.page.empty")),b})()},get children(){var b=pn();return i(b,n(X,{get each(){return f()},children:D=>n($n,{mode:D,toggling:()=>h.isPending&&h.variables?.mode.name===D.name,onToggle:m=>h.mutate({mode:D,enabled:m}),onEdit:()=>k(D)})})),b}})]}function $n(e){const t=q(),r=()=>e.mode.config.disable!==!0,u=()=>e.mode.config.model,a=()=>e.mode.source==="mode"?"primary":e.mode.config.mode==="all"?"all":"primary";return(()=>{var o=bn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=l.nextSibling;return i(c,n(ce,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.mode.name),i(c,n(te,{get children(){return t.t(`modes.kind.${a()}`)}}),null),i(c,n(F,{get when(){return e.mode.source==="mode"},get children(){return n(te,{get children(){return t.t("modes.source.legacy")}})}}),null),i(c,n(F,{get when(){return e.mode.config.hidden},get children(){return n(te,{get children(){return t.t("modes.tag.hidden")}})}}),null),i(c,n(F,{get when(){return!r()},get children(){return n(te,{get children(){return t.t("modes.tag.disabled")}})}}),null),i(l,n(F,{get when(){return e.mode.config.description},get children(){var b=hn();return i(b,()=>e.mode.config.description),b}}),null),i(l,n(F,{get when(){return u()},get children(){var b=vn();return i(b,u),b}}),null),i(k,n(K,{get checked(){return r()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),o})()}function yn(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,[f,l]=me(wn(e.entry)),c=()=>{const m={},S=f.name.trim();return S||(m.name=t.t("modes.editor.error.name")),!o&&(r.data.config.mode&&S in r.data.config.mode||r.data.config.agent&&S in r.data.config.agent)&&(m.name=t.t("modes.editor.error.duplicate")),l("errors",m),Object.keys(m).length===0},h=m=>{const S=m.trim();if(!S)return;const v=Number(S);if(!Number.isNaN(v))return v},k=()=>({mode:"primary",hidden:f.hidden,disable:f.disable,...f.description.trim()?{description:f.description.trim()}:{},...f.model.trim()?{model:f.model.trim()}:{},...f.prompt.trim()?{prompt:f.prompt}:{},...h(f.temperature)!==void 0?{temperature:h(f.temperature)}:{},...h(f.topP)!==void 0?{top_p:h(f.topP)}:{},...h(f.steps)!==void 0?{steps:h(f.steps)}:{}}),b=re(()=>({mutationFn:async()=>{if(!c())return;const m=e.entry?.source??"agent",S={...m==="mode"?r.data.config.mode:r.data.config.agent};S[f.name.trim()]=k(),m==="mode"?await r.updateConfig({mode:S}):await r.updateConfig({agent:S}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("modes.toast.updated"):t.t("modes.toast.added")}),a.close()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{m.preventDefault(),!b.isPending&&b.mutate()};return n(be,{get title(){return o?t.t("modes.editor.title.edit"):t.t("modes.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var m=xn(),S=m.firstChild,v=S.firstChild,s=v.nextSibling,g=s.firstChild,d=g.firstChild,_=d.nextSibling,$=s.nextSibling,x=$.firstChild,p=x.firstChild,z=p.nextSibling,j=S.nextSibling;return m.addEventListener("submit",D),i(S,n(U,{autofocus:!0,get label(){return t.t("modes.editor.name")},placeholder:"review",get value(){return f.name},onChange:P=>ae(()=>{l("name",P),l("errors","name",void 0)}),get error(){return f.errors.name},disabled:o,spellcheck:!1,class:"font-mono text-xs"}),v),i(S,n(U,{get label(){return t.t("modes.editor.description")},get placeholder(){return t.t("modes.editor.description.placeholder")},get value(){return f.description},onChange:P=>l("description",P)}),v),i(S,n(U,{get label(){return t.t("modes.editor.model")},get description(){return t.t("modes.editor.model.description")},placeholder:"anthropic/claude-sonnet-4-5",get value(){return f.model},onChange:P=>l("model",P),spellcheck:!1,class:"font-mono text-xs"}),v),i(S,n(U,{multiline:!0,get label(){return t.t("modes.editor.prompt")},get description(){return t.t("modes.editor.prompt.description")},get placeholder(){return t.t("modes.editor.prompt.placeholder")},get value(){return f.prompt},onChange:P=>l("prompt",P),spellcheck:!1,class:"max-h-40 w-full overflow-y-auto font-mono text-xs"}),v),i(v,n(U,{get label(){return t.t("modes.editor.temperature")},placeholder:"0.7",get value(){return f.temperature},onChange:P=>l("temperature",P.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),i(v,n(U,{get label(){return t.t("modes.editor.topP")},placeholder:"1",get value(){return f.topP},onChange:P=>l("topP",P.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),i(v,n(U,{get label(){return t.t("modes.editor.steps")},placeholder:"50",get value(){return f.steps},onChange:P=>l("steps",P.replace(/[^0-9]/g,"")),inputmode:"numeric"}),null),i(d,()=>t.t("modes.editor.hidden")),i(_,()=>t.t("modes.editor.hidden.description")),i(s,n(K,{get checked(){return f.hidden},onChange:P=>l("hidden",P),hideLabel:!0,get children(){return t.t("modes.editor.hidden")}}),null),i(p,()=>t.t("modes.editor.disable")),i(z,()=>t.t("modes.editor.disable.description")),i($,n(K,{get checked(){return f.disable},onChange:P=>l("disable",P),hideLabel:!0,get children(){return t.t("modes.editor.disable")}}),null),i(j,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(j,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),m}})}var _n=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Cn=w('<div><div class="flex items-center gap-2">'),Sn=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Dn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),En=w('<span class="text-11-regular text-text-weak">'),Pn=w('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),jn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),zn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">'),In=w("<button type=button>"),Fn=w('<span class="text-11-regular text-text-weaker">'),Ln=w('<div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span></div><div class="flex flex-col gap-1.5">'),Mn=w('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const ue=()=>({key:"",value:""}),On={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled",needs_client_registration:"mcp.status.needs_auth"};function Rn(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",[f,l]=nt(async()=>(await u.client.mcp.status().catch(()=>null))?.data??{}),c=M(()=>{const m=r.data.config.mcp??{},S=f()??{},v=[];for(const[s,g]of Object.entries(m))!g||typeof g!="object"||"type"in g&&v.push({name:s,config:g,status:S[s]});return v.sort((s,g)=>s.name.localeCompare(g.name))}),h=M(()=>c().filter(m=>m.config.enabled!==!1).length),k=re(()=>({mutationFn:async({name:m,enabled:S})=>{const v=r.data.config.mcp??{},s=v[m];if(!s||!("type"in s))throw new Error("not found");const g={...v,[m]:{...s,enabled:S}};await r.updateConfig({mcp:g}),S?await u.client.mcp.connect({name:m}).catch(()=>{}):await u.client.mcp.disconnect({name:m}).catch(()=>{}),l.refetch()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),b=re(()=>({mutationFn:async m=>{const S={...r.data.config.mcp??{}};delete S[m],await r.updateConfig({mcp:S}),l.refetch()},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("mcp.toast.removed")})},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{a.show(()=>n(Nn,{entry:m}))};return[(()=>{var m=Cn(),S=m.firstChild;return i(m,n(F,{get when(){return!o()},get children(){var v=_n(),s=v.firstChild,g=s.nextSibling;return i(s,()=>t.t("mcp.page.title")),i(g,()=>t.t("mcp.page.subtitle",{enabled:h(),total:c().length})),v}}),S),i(S,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>D(),get children(){return t.t("mcp.page.add")}})),Q(v=>G(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},v)),m})(),n(F,{get when(){return c().length>0},get fallback(){return(()=>{var m=Dn();return i(m,()=>t.t("mcp.page.empty")),m})()},get children(){var m=Sn();return i(m,n(X,{get each(){return c()},children:S=>n(Un,{server:S,toggling:()=>k.isPending&&k.variables?.name===S.name,onToggle:v=>k.mutate({name:S.name,enabled:v}),onEdit:()=>D(S),onRemove:()=>{window.confirm(t.t("mcp.page.confirm.remove",{name:S.name}))&&b.mutate(S.name)}})})),m}})]}function Un(e){const t=q(),r=()=>{const o=e.server.config.enabled===!1?"disabled":e.server.status?.status;if(!o)return;const f=On[o];return f?t.t(f):o},u=()=>e.server.config.enabled!==!1,a=()=>e.server.config.type==="remote"?e.server.config.url:e.server.config.type==="local"&&Array.isArray(e.server.config.command)?e.server.config.command.join(" "):"";return(()=>{var o=jn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=l.nextSibling;return i(c,n(ce,{name:"mcp",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.server.name),i(c,n(te,{get children(){return e.server.config.type}}),null),i(c,n(F,{get when(){return r()},get children(){var b=En();return i(b,r),b}}),null),i(l,n(F,{get when(){return a()},get children(){var b=Pn();return i(b,a),b}}),null),i(k,n(K,{get checked(){return u()},get disabled(){return e.toggling()},onChange:b=>e.onToggle(b),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(k,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),o})()}function Nn(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,f=()=>{const s=e.entry;if(!s)return{name:"",kind:"local",enabled:!0,command:"",url:"",timeout:"",environment:[ue()],headers:[ue()],errors:{}};const g=s.config;return g.type==="local"?{name:s.name,kind:"local",enabled:g.enabled!==!1,command:Array.isArray(g.command)?g.command.join(" "):"",url:"",timeout:g.timeout?String(g.timeout):"",environment:Object.entries(g.environment??{}).map(([d,_])=>({key:d,value:_}))||[ue()],headers:[ue()],errors:{}}:{name:s.name,kind:"remote",enabled:g.enabled!==!1,command:"",url:g.url,timeout:g.timeout?String(g.timeout):"",environment:[ue()],headers:Object.entries(g.headers??{}).map(([d,_])=>({key:d,value:_}))||[ue()],errors:{}}},[l,c]=me(f()),h=()=>{const s={};if(l.name.trim()||(s.name=t.t("mcp.editor.error.name")),!o&&r.data.config.mcp&&l.name.trim()in r.data.config.mcp&&(s.name=t.t("mcp.editor.error.duplicate")),l.kind==="local"&&!l.command.trim()&&(s.command=t.t("mcp.editor.error.command")),l.kind==="remote"){const g=l.url.trim();g?/^https?:\/\//i.test(g)||(s.url=t.t("mcp.editor.error.urlInvalid")):s.url=t.t("mcp.editor.error.url")}return c("errors",s),Object.keys(s).length===0},k=()=>{const s=l.timeout.trim()?Number(l.timeout.trim()):void 0;if(l.kind==="local"){const d={};for(const _ of l.environment){const $=_.key.trim();$&&(d[$]=_.value)}return{type:"local",command:l.command.trim().split(/\s+/).filter(_=>_.length>0),enabled:l.enabled,...Object.keys(d).length>0?{environment:d}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}}const g={};for(const d of l.headers){const _=d.key.trim();_&&(g[_]=d.value)}return{type:"remote",url:l.url.trim(),enabled:l.enabled,...Object.keys(g).length>0?{headers:g}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}},b=re(()=>({mutationFn:async()=>{if(!h())return;const s=k(),g=l.name.trim(),d={...r.data.config.mcp??{}},_=o&&e.entry?e.entry.name:void 0;_&&_!==g&&delete d[_],d[g]=s,await r.updateConfig({mcp:d}),_&&await u.client.mcp.disconnect({name:_}).catch(()=>{}),l.enabled?await u.client.mcp.add({name:g,config:s}).catch(()=>u.client.mcp.connect({name:g}).catch(()=>{})):await u.client.mcp.disconnect({name:g}).catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("mcp.toast.updated"):t.t("mcp.toast.added")}),a.close()},onError:s=>{N({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),D=s=>{s.preventDefault(),!b.isPending&&b.mutate()},m=(s,g,d,_)=>{c(s,g,d,_)},S=s=>{c(s,Ee(g=>g.push(ue())))},v=(s,g)=>{c(s,Ee(d=>{d.splice(g,1),d.length===0&&d.push(ue())}))};return n(be,{get title(){return o?t.t("mcp.editor.title.edit"):t.t("mcp.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=zn(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=_.nextSibling,x=d.nextSibling,p=x.firstChild,z=p.firstChild,j=z.nextSibling,P=g.nextSibling;return s.addEventListener("submit",D),i(g,n(U,{autofocus:!0,get label(){return t.t("mcp.editor.name")},placeholder:"my-server",get value(){return l.name},onChange:L=>ae(()=>{c("name",L),c("errors","name",void 0)}),get error(){return l.errors.name},disabled:o}),d),i(_,()=>t.t("mcp.editor.type")),i($,n(Ge,{get active(){return l.kind==="local"},get label(){return t.t("mcp.editor.type.local")},onClick:()=>c("kind","local")}),null),i($,n(Ge,{get active(){return l.kind==="remote"},get label(){return t.t("mcp.editor.type.remote")},onClick:()=>c("kind","remote")}),null),i(g,n(F,{get when(){return l.kind==="local"},get children(){return[n(U,{get label(){return t.t("mcp.editor.command")},get description(){return t.t("mcp.editor.command.description")},placeholder:"npx -y my-mcp-server",get value(){return l.command},onChange:L=>ae(()=>{c("command",L),c("errors","command",void 0)}),get error(){return l.errors.command},spellcheck:!1,class:"font-mono text-xs"}),n(He,{get title(){return t.t("mcp.editor.environment")},get description(){return t.t("mcp.editor.environment.description")},get rows(){return l.environment},secret:!0,onChange:(L,V,I)=>m("environment",L,V,I),onAdd:()=>S("environment"),onRemove:L=>v("environment",L)})]}}),x),i(g,n(F,{get when(){return l.kind==="remote"},get children(){return[n(U,{get label(){return t.t("mcp.editor.url")},placeholder:"https://example.com/mcp",get value(){return l.url},onChange:L=>ae(()=>{c("url",L),c("errors","url",void 0)}),get error(){return l.errors.url},spellcheck:!1}),n(He,{get title(){return t.t("mcp.editor.headers")},get description(){return t.t("mcp.editor.headers.description")},get rows(){return l.headers},secret:!0,onChange:(L,V,I)=>m("headers",L,V,I),onAdd:()=>S("headers"),onRemove:L=>v("headers",L)})]}}),x),i(g,n(U,{get label(){return t.t("mcp.editor.timeout")},get description(){return t.t("mcp.editor.timeout.description")},placeholder:"5000",get value(){return l.timeout},onChange:L=>c("timeout",L.replace(/[^0-9]/g,"")),inputmode:"numeric"}),x),i(z,()=>t.t("mcp.editor.enabled")),i(j,()=>t.t("mcp.editor.enabled.description")),i(x,n(K,{get checked(){return l.enabled},onChange:L=>c("enabled",L),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(P,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(P,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function Ge(e){return(()=>{var t=In();return it(t,"click",e.onClick,!0),i(t,()=>e.label),Q(r=>G(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},r)),t})()}function He(e){const t=q();return(()=>{var r=Ln(),u=r.firstChild,a=u.firstChild,o=u.nextSibling;return i(a,()=>e.title),i(u,n(F,{get when(){return e.description},get children(){var f=Fn();return i(f,()=>e.description),f}}),null),i(o,n(X,{get each(){return e.rows},children:(f,l)=>n(Tn,{row:f,get secret(){return e.secret},onKeyChange:c=>e.onChange(l(),"key",c),onValueChange:c=>e.onChange(l(),"value",c),onRemove:()=>e.onRemove(l())})})),i(r,n(O,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",get onClick(){return e.onAdd},get children(){return t.t("mcp.editor.row.add")}}),null),r})()}function Tn(e){const t=q(),[r,u]=ge(!1);let a;const o=()=>e.secret&&!r()?"password":"text",f=()=>{a&&clearTimeout(a),u(!0),a=setTimeout(()=>u(!1),1500)},l=c=>{e.secret&&c.key==="Enter"&&(c.preventDefault(),f())};return(()=>{var c=Mn(),h=c.firstChild,k=h.nextSibling;return i(h,n(U,{variant:"ghost",get placeholder(){return t.t("mcp.editor.row.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),i(k,n(U,{variant:"ghost",get type(){return o()},get placeholder(){return t.t("mcp.editor.row.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:l,spellcheck:!1,class:"font-mono text-xs"})),i(c,n(F,{get when(){return e.secret},get children(){return n(Y,{type:"button",variant:"ghost",size:"normal",get icon(){return r()?"eye":"shield"},get"aria-label"(){return t.t(r()?"mcp.editor.row.hide":"mcp.editor.row.reveal")},onPointerDown:()=>{a&&clearTimeout(a),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),i(c,n(Y,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),c})()}Ae(["click"]);var An=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Kn=w('<div><div></div><div class="flex flex-col gap-8">'),qn=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Wn=w('<li class="border-b border-border-weak-base last:border-b-0">'),Vn=w('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong"></span></div><ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Bn=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Gn=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-3 gap-3"></div><div class="flex flex-col gap-2"><span class="text-12-medium text-text-weak"></span><div class="grid grid-cols-2 gap-2"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Hn=w('<div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><span class="text-13-medium text-text-strong">');const Jn=40,Oe=e=>e===void 0||e===0?"":String(e),Re=e=>{const t=e.trim();if(!t)return;const r=Number(t);if(!Number.isNaN(r))return r},Ue=e=>e.replace(/[^0-9]/g,""),Qn=(e,t)=>e?.models?.[t],Xn=(e,t)=>{const r=De.indexOf(e.id),u=De.indexOf(t.id),a=r>=0,o=u>=0;return a&&!o?-1:!a&&o?1:a&&o?r-u:e.name.localeCompare(t.name)},Yn=e=>e?{providerID:e.provider.id,modelID:e.model.id,apiModelID:e.config?.id??e.model.api.id,name:e.config?.name??e.model.name,family:e.config?.family??e.model.family??"",releaseDate:e.config?.release_date??e.model.release_date??"",context:Oe(e.config?.limit?.context??e.model.limit.context),input:Oe(e.config?.limit?.input??e.model.limit.input),output:Oe(e.config?.limit?.output??e.model.limit.output),temperature:e.config?.temperature??e.model.capabilities.temperature,reasoning:e.config?.reasoning??e.model.capabilities.reasoning,attachment:e.config?.attachment??e.model.capabilities.attachment,toolCall:e.config?.tool_call??e.model.capabilities.toolcall,errors:{}}:{providerID:"",modelID:"",apiModelID:"",name:"",family:"",releaseDate:"",context:"",input:"",output:"",temperature:!0,reasoning:!1,attachment:!1,toolCall:!0,errors:{}};function Zn(e={}){const t=q(),r=ee(),u=st(),a=Z(),o=()=>e.layout==="page",f=()=>e.layout==="dialog",[l,c]=me({expanded:{}}),h=M(()=>u.list().map(v=>{const s=Qn(r.data.config.provider?.[v.provider.id],v.id);return{provider:v.provider,model:v,config:s,custom:v.provider.source==="config"||v.provider.source==="custom"||!!s}}).sort((v,s)=>{const g=Xn(v.provider,s.provider);return g!==0?g:v.model.name.localeCompare(s.model.name)})),k=M(()=>h().reduce((v,s)=>{const g=v.find(d=>d.provider.id===s.provider.id);return g?(g.entries.push(s),v):(v.push({provider:s.provider,entries:[s]}),v)},[])),b=M(()=>h().filter(v=>u.visible({providerID:v.provider.id,modelID:v.model.id})).length),D=v=>{a.show(()=>n(ti,{entry:v}))},m=v=>u.visible({providerID:v.provider.id,modelID:v.model.id}),S=v=>{if(l.expanded[v.provider.id])return v.entries;const s=[];for(const g of v.entries)if(m(g)&&(s.push(g),s.length>=Jn))return s;return s};return(()=>{var v=Kn(),s=v.firstChild,g=s.nextSibling;return i(s,n(F,{get when(){return!o()},get children(){var d=An(),_=d.firstChild,$=_.nextSibling;return i(_,()=>t.t("models.page.title")),i($,()=>t.t("models.page.subtitle",{shown:b(),total:h().length})),d}}),null),i(s,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>D(),get children(){return t.t("models.page.add")}}),null),i(g,n(F,{get when(){return k().length>0},get fallback(){return(()=>{var d=qn();return i(d,()=>t.t("models.page.empty")),d})()},get children(){return n(X,{get each(){return k()},children:d=>{const _=M(()=>S(d)),$=M(()=>d.entries.length-_().length);return(()=>{var x=Vn(),p=x.firstChild,z=p.firstChild,j=p.nextSibling;return i(p,n(ke,{get id(){return d.provider.id},class:"size-5 shrink-0 icon-strong-base"}),z),i(z,()=>d.provider.name),i(j,n(X,{get each(){return _()},children:P=>n(ei,{entry:P,onEdit:()=>D(P)})}),null),i(j,n(F,{get when(){return $()>0},get children(){var P=Wn();return i(P,n(O,{variant:"ghost",size:"normal",class:"w-full justify-start px-4 py-3 text-13-medium text-text-interactive-base hover:bg-surface-base-hover active:bg-surface-base-active",onClick:()=>c("expanded",d.provider.id,!0),get children(){return[A(()=>t.t("common.loadMore")),A(()=>t.t("common.moreCountSuffix",{count:$()}))]}})),P}}),null),x})()}})}})),Q(d=>{var _={"flex flex-col gap-6":!0,"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":f()},$={"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()};return d.e=G(v,_,d.e),d.t=G(s,$,d.t),d},{e:void 0,t:void 0}),v})()}function ei(e){const t=q(),r=st(),u=()=>({providerID:e.entry.provider.id,modelID:e.entry.model.id}),a=()=>r.visible(u());return(()=>{var o=Bn(),f=o.firstChild,l=f.firstChild,c=l.firstChild,h=c.firstChild,k=c.nextSibling,b=l.nextSibling;return i(c,n(ce,{name:"models",size:"small",class:"icon-strong-base shrink-0"}),h),i(h,()=>e.entry.model.name),i(k,()=>e.entry.model.id),i(b,n(K,{get checked(){return a()},onChange:D=>r.setVisibility(u(),D),hideLabel:!0,get children(){return t.t("models.row.shown")}}),null),i(b,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),o})()}function ti(e){const t=q(),r=ee(),u=ie(),a=rt(),o=Z(),f=!!e.entry,[l,c]=me(Yn(e.entry)),h=()=>{const m={},S=l.providerID.trim(),v=l.modelID.trim();return S||(m.providerID=t.t("models.editor.error.provider")),v||(m.modelID=t.t("models.editor.error.model")),l.name.trim()||(m.name=t.t("models.editor.error.name")),!f&&a.all().some(s=>s.id===S&&!!s.models[v])&&(m.modelID=t.t("models.editor.error.duplicate")),c("errors",m),Object.keys(m).length===0},k=()=>{const m=l.modelID.trim(),S=l.apiModelID.trim(),v=Re(l.context),s=Re(l.input),g=Re(l.output),d=v!==void 0&&g!==void 0?{context:v,output:g,...s!==void 0?{input:s}:{}}:void 0;return{...S&&S!==m?{id:S}:{},name:l.name.trim(),temperature:l.temperature,reasoning:l.reasoning,attachment:l.attachment,tool_call:l.toolCall,...l.family.trim()?{family:l.family.trim()}:{},...l.releaseDate.trim()?{release_date:l.releaseDate.trim()}:{},...d?{limit:d}:{}}},b=re(()=>({mutationFn:async()=>{if(!h())return;const m=l.providerID.trim(),S=l.modelID.trim(),v=r.data.config.provider?.[m]??{};await r.updateConfig({provider:{[m]:{...v,models:{...v.models??{},[S]:k()}}}}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:f?t.t("models.toast.updated"):t.t("models.toast.added")}),o.close()},onError:m=>{N({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),D=m=>{m.preventDefault(),!b.isPending&&b.mutate()};return n(be,{get title(){return f?t.t("models.editor.title.edit"):t.t("models.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var m=Gn(),S=m.firstChild,v=S.firstChild,s=v.nextSibling,g=s.nextSibling,d=g.nextSibling,_=d.firstChild,$=_.nextSibling,x=S.nextSibling;return m.addEventListener("submit",D),i(v,n(U,{autofocus:!0,get label(){return t.t("models.editor.provider")},placeholder:"anthropic",get value(){return l.providerID},onChange:p=>ae(()=>{c("providerID",p),c("errors","providerID",void 0)}),get error(){return l.errors.providerID},disabled:f,spellcheck:!1,class:"font-mono text-xs"}),null),i(v,n(U,{get label(){return t.t("models.editor.model")},placeholder:"claude-sonnet-4-5",get value(){return l.modelID},onChange:p=>ae(()=>{c("modelID",p),c("errors","modelID",void 0)}),get error(){return l.errors.modelID},disabled:f,spellcheck:!1,class:"font-mono text-xs"}),null),i(S,n(U,{get label(){return t.t("models.editor.name")},placeholder:"Claude Sonnet 4.5",get value(){return l.name},onChange:p=>ae(()=>{c("name",p),c("errors","name",void 0)}),get error(){return l.errors.name}}),s),i(S,n(U,{get label(){return t.t("models.editor.apiModel")},get description(){return t.t("models.editor.apiModel.description")},get placeholder(){return l.modelID||"provider-model-id"},get value(){return l.apiModelID},onChange:p=>c("apiModelID",p),spellcheck:!1,class:"font-mono text-xs"}),s),i(s,n(U,{get label(){return t.t("models.editor.family")},placeholder:"claude",get value(){return l.family},onChange:p=>c("family",p)}),null),i(s,n(U,{get label(){return t.t("models.editor.releaseDate")},placeholder:"2026-01-01",get value(){return l.releaseDate},onChange:p=>c("releaseDate",p),spellcheck:!1}),null),i(g,n(U,{get label(){return t.t("models.editor.context")},placeholder:"200000",get value(){return l.context},onChange:p=>c("context",Ue(p)),inputmode:"numeric"}),null),i(g,n(U,{get label(){return t.t("models.editor.input")},placeholder:"200000",get value(){return l.input},onChange:p=>c("input",Ue(p)),inputmode:"numeric"}),null),i(g,n(U,{get label(){return t.t("models.editor.output")},placeholder:"8192",get value(){return l.output},onChange:p=>c("output",Ue(p)),inputmode:"numeric"}),null),i(_,()=>t.t("models.editor.capabilities")),i($,n(Ce,{get label(){return t.t("models.editor.temperature")},get checked(){return l.temperature},onChange:p=>c("temperature",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.reasoning")},get checked(){return l.reasoning},onChange:p=>c("reasoning",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.attachment")},get checked(){return l.attachment},onChange:p=>c("attachment",p)}),null),i($,n(Ce,{get label(){return t.t("models.editor.toolCall")},get checked(){return l.toolCall},onChange:p=>c("toolCall",p)}),null),i(x,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>o.close(),get children(){return t.t("common.cancel")}}),null),i(x,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),m}})}function Ce(e){return(()=>{var t=Hn(),r=t.firstChild;return i(r,()=>e.label),i(t,n(K,{get checked(){return e.checked},get onChange(){return e.onChange},hideLabel:!0,get children(){return e.label}}),null),t})()}var ri=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),ni=w("<div>"),ii=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),si=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),li=w('<span class="text-11-regular text-text-weak">'),oi=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),ai=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span><span class="text-11-regular text-text-weaker"></span></div><div class="flex flex-col gap-1.5"></div></div></div><div class="flex justify-end gap-2 pt-1">'),ci=w('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const di=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("file://"),ui=e=>/^https?:\/\//.test(e),gi=e=>/(token|secret|password|apikey|api[_-]?key|auth)/i.test(e),Se=()=>({key:"",value:""}),mi=e=>{if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}},pi=e=>{const t=e.trim();if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;if(/^-?\d+(\.\d+)?$/.test(t)){const r=Number(t);if(!Number.isNaN(r))return r}if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")||t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{}return e};function fi(e={}){const t=q(),r=ee(),u=ie(),a=Z(),o=()=>e.layout==="page",f=M(()=>(r.data.config.plugin??[]).map((k,b)=>Array.isArray(k)?{index:b,spec:k,specifier:k[0],options:k[1]}:{index:b,spec:k,specifier:k,options:{}})),l=re(()=>({mutationFn:async h=>{const k=(r.data.config.plugin??[]).slice();k.splice(h,1),await r.updateConfig({plugin:k}),await u.client.global.dispose().catch(()=>{})},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("plugins.toast.removed")})},onError:h=>{N({variant:"error",title:t.t("common.requestFailed"),description:h instanceof Error?h.message:String(h)})}})),c=h=>{a.show(()=>n(vi,{entry:h}))};return[(()=>{var h=ni();return i(h,n(F,{get when(){return!o()},get children(){var k=ri(),b=k.firstChild,D=b.nextSibling;return i(b,()=>t.t("plugins.page.title")),i(D,()=>t.t("plugins.page.subtitle",{count:f().length})),k}}),null),i(h,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>c(),get children(){return t.t("plugins.page.add")}}),null),Q(k=>G(h,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},k)),h})(),n(F,{get when(){return f().length>0},get fallback(){return(()=>{var h=si();return i(h,()=>t.t("plugins.page.empty")),h})()},get children(){var h=ii();return i(h,n(X,{get each(){return f()},children:k=>n(hi,{plugin:k,onEdit:()=>c(k),onRemove:()=>{window.confirm(t.t("plugins.page.confirm.remove",{name:k.specifier}))&&l.mutate(k.index)}})})),h}})]}function hi(e){const t=q(),r=()=>di(e.plugin.specifier)?t.t("plugins.kind.local"):ui(e.plugin.specifier)?t.t("plugins.kind.remote"):t.t("plugins.kind.package"),u=()=>Object.keys(e.plugin.options).length;return(()=>{var a=oi(),o=a.firstChild,f=o.firstChild,l=f.firstChild,c=l.firstChild,h=f.nextSibling;return i(l,n(ce,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),c),i(c,()=>e.plugin.specifier),i(l,n(te,{get children(){return r()}}),null),i(l,n(F,{get when(){return u()>0},get children(){var k=li();return i(k,()=>t.t("plugins.row.optionCount",{count:u()})),k}}),null),i(h,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(h,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),a})()}function vi(e){const t=q(),r=ee(),u=ie(),a=Z(),o=!!e.entry,f=()=>{const s=e.entry;if(!s)return{specifier:"",options:[Se()],errors:{}};const g=Object.entries(s.options).map(([d,_])=>({key:d,value:mi(_)}));return{specifier:s.specifier,options:g.length>0?g:[Se()],errors:{}}},[l,c]=me(f()),h=()=>{const s={};return l.specifier.trim()||(s.specifier=t.t("plugins.editor.error.specifier")),c("errors",s),Object.keys(s).length===0},k=()=>{const s=l.specifier.trim(),g={};for(const d of l.options){const _=d.key.trim();_&&(g[_]=pi(d.value))}return Object.keys(g).length===0?s:[s,g]},b=re(()=>({mutationFn:async()=>{if(!h())return;const s=k(),g=(r.data.config.plugin??[]).slice();o&&e.entry?g[e.entry.index]=s:g.push(s),await r.updateConfig({plugin:g}),await u.client.global.dispose().catch(()=>{}),N({variant:"success",icon:"circle-check",title:o?t.t("plugins.toast.updated"):t.t("plugins.toast.added")}),a.close()},onError:s=>{N({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),D=s=>{s.preventDefault(),!b.isPending&&b.mutate()},m=(s,g,d)=>{c("options",s,g,d)},S=()=>{c("options",Ee(s=>s.push(Se())))},v=s=>{c("options",Ee(g=>{g.splice(s,1),g.length===0&&g.push(Se())}))};return n(be,{get title(){return o?t.t("plugins.editor.title.edit"):t.t("plugins.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=ai(),g=s.firstChild,d=g.firstChild,_=d.firstChild,$=_.firstChild,x=$.nextSibling,p=_.nextSibling,z=g.nextSibling;return s.addEventListener("submit",D),i(g,n(U,{autofocus:!0,get label(){return t.t("plugins.editor.specifier")},get description(){return t.t("plugins.editor.specifier.description")},placeholder:"@my-org/my-plugin",get value(){return l.specifier},onChange:j=>ae(()=>{c("specifier",j),c("errors","specifier",void 0)}),get error(){return l.errors.specifier},spellcheck:!1,class:"font-mono text-xs"}),d),i($,()=>t.t("plugins.editor.options")),i(x,()=>t.t("plugins.editor.options.description")),i(p,n(X,{get each(){return l.options},children:(j,P)=>n(bi,{row:j,onKeyChange:L=>m(P(),"key",L),onValueChange:L=>m(P(),"value",L),onRemove:()=>v(P())})})),i(d,n(O,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",onClick:S,get children(){return t.t("plugins.editor.option.add")}}),null),i(z,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),i(z,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return A(()=>!!b.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function bi(e){const t=q(),[r,u]=ge(!1);let a;const o=M(()=>gi(e.row.key)),f=()=>o()&&!r()?"password":"text",l=()=>{a&&clearTimeout(a),u(!0),a=setTimeout(()=>u(!1),1500)},c=h=>{o()&&h.key==="Enter"&&(h.preventDefault(),l())};return(()=>{var h=ci(),k=h.firstChild,b=k.nextSibling;return i(k,n(U,{variant:"ghost",get placeholder(){return t.t("plugins.editor.option.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),i(b,n(U,{variant:"ghost",get type(){return f()},get placeholder(){return t.t("plugins.editor.option.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:c,spellcheck:!1,class:"font-mono text-xs"})),i(h,n(F,{get when(){return o()},get children(){return n(Y,{type:"button",variant:"ghost",size:"normal",get icon(){return r()?"eye":"shield"},get"aria-label"(){return t.t(r()?"plugins.editor.option.hide":"plugins.editor.option.reveal")},onPointerDown:()=>{a&&clearTimeout(a),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),i(h,n(Y,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),h})()}var xi=w('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),wi=w("<div>"),Je=w('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Qe=w('<div class="flex flex-col gap-3"><div class="text-12-medium text-text-weak">'),ki=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-6 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Xe=w('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),$i=w('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),yi=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),_i=w('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),Ci=w('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-end gap-2"><div class="min-w-0 flex-1"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Si=w("<button type=button>");const qe=e=>e==="allow"||e==="ask"||e==="deny",at=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(qe),We=e=>e?typeof e=="string"?{"*":e}:{...e}:{},Ye=(e,t)=>new RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(t),Di=e=>Object.entries(We(e)).flatMap(([t,r])=>qe(r)?[{permission:t,pattern:"*",action:r}]:at(r)?Object.entries(r).map(([u,a])=>({permission:t,pattern:u,action:a})):[]),Ze=(e,t)=>Di(e).slice().reverse().find(r=>Ye(r.permission,"skill")&&Ye(r.pattern,t))?.action??"allow",Ei=e=>{const t=We(e).skill;return qe(t)?{"*":t}:at(t)?{...t}:{}},ct=e=>({paths:e.paths,urls:e.urls});function Pi(e={}){const t=q(),r=ee(),u=ie(),a=je(),o=lt(),f=Z(),l=()=>e.layout==="page",[c,h]=nt(()=>u.client.app.skills().then(d=>d.data??[]).catch(()=>[])),k=M(()=>{const d=c();return Array.isArray(d)?d.slice().sort((_,$)=>_.name.localeCompare($.name)):[]}),b=M(()=>[...(r.data.config.skills?.paths??[]).map((d,_)=>({kind:"path",index:_,value:d})),...(r.data.config.skills?.urls??[]).map((d,_)=>({kind:"url",index:_,value:d}))]),D=M(()=>k().filter(d=>Ze(r.data.config.permission,d.name)!=="deny").length),m=M(()=>!!o.isLocal()&&!!a.openPath),S=re(()=>({mutationFn:async d=>{const _=We(r.data.config.permission),$=Ei(_);delete $[d.name],$[d.name]=d.enabled?"allow":"deny",delete _.skill,_.skill=$,await r.updateConfig({permission:_}),await u.client.global.dispose().catch(()=>{}),h.refetch()},onError:d=>{N({variant:"error",title:t.t("common.requestFailed"),description:d instanceof Error?d.message:String(d)})}})),v=re(()=>({mutationFn:async d=>{const _=(r.data.config.skills?.paths??[]).slice(),$=(r.data.config.skills?.urls??[]).slice();d.kind==="path"&&_.splice(d.index,1),d.kind==="url"&&$.splice(d.index,1),await r.updateConfig({skills:ct({paths:_,urls:$})}),await u.client.global.dispose().catch(()=>{}),h.refetch()},onSuccess:()=>{N({variant:"success",icon:"circle-check",title:t.t("skills.toast.sourceRemoved")})},onError:d=>{N({variant:"error",title:t.t("common.requestFailed"),description:d instanceof Error?d.message:String(d)})}})),s=d=>{f.show(()=>n(Ii,{entry:d,onSaved:()=>void h.refetch()}))},g=d=>{!a.openPath||!m()||a.openPath(d.location)};return[(()=>{var d=wi();return i(d,n(F,{get when(){return!l()},get children(){var _=xi(),$=_.firstChild,x=$.nextSibling;return i($,()=>t.t("skills.page.title")),i(x,()=>t.t("skills.page.subtitle",{enabled:D(),total:k().length,sources:b().length})),_}}),null),i(d,n(O,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>s(),get children(){return t.t("skills.page.addSource")}}),null),Q(_=>G(d,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!l(),"justify-end":l()},_)),d})(),(()=>{var d=Qe(),_=d.firstChild;return i(_,()=>t.t("skills.section.sources")),i(d,n(F,{get when(){return b().length>0},get fallback(){return(()=>{var $=ki();return i($,()=>t.t("skills.sources.empty")),$})()},get children(){var $=Je();return i($,n(X,{get each(){return b()},children:x=>n(zi,{source:x,onEdit:()=>s(x),onRemove:()=>{window.confirm(t.t("skills.sources.confirm.remove",{source:x.value}))&&v.mutate(x)}})})),$}}),null),d})(),(()=>{var d=Qe(),_=d.firstChild;return i(_,()=>t.t("skills.section.available")),i(d,n(F,{get when(){return!c.loading},get fallback(){return(()=>{var $=Xe();return i($,()=>t.t("common.loading")),$})()},get children(){return n(F,{get when(){return k().length>0},get fallback(){return(()=>{var $=Xe();return i($,()=>t.t("skills.page.empty")),$})()},get children(){var $=Je();return i($,n(X,{get each(){return k()},children:x=>n(ji,{skill:x,enabled:()=>Ze(r.data.config.permission,x.name)!=="deny",toggling:()=>S.isPending&&S.variables?.name===x.name,canOpen:m,onToggle:p=>S.mutate({name:x.name,enabled:p}),onOpen:()=>g(x)})})),$}})}}),null),d})()]}function ji(e){const t=q(),r=()=>e.skill.location.replace(/\\/g,"/"),u=()=>{const a=r();return a.includes("/.claude/skills/")?t.t("skills.kind.claude"):a.includes("/.agents/skills/")?t.t("skills.kind.agents"):a.includes("/.codeplane/")?t.t("skills.kind.codeplane"):t.t("skills.kind.local")};return(()=>{var a=yi(),o=a.firstChild,f=o.firstChild,l=f.firstChild,c=l.firstChild,h=l.nextSibling,k=f.nextSibling;return i(l,n(ce,{name:"checklist",size:"small",class:"icon-strong-base shrink-0"}),c),i(c,()=>e.skill.name),i(l,n(te,{get children(){return u()}}),null),i(l,n(F,{get when(){return!e.enabled()},get children(){return n(te,{get children(){return t.t("skills.tag.disabled")}})}}),null),i(f,n(F,{get when(){return e.skill.description},get children(){var b=$i();return i(b,()=>e.skill.description),b}}),h),i(h,()=>e.skill.location),i(k,n(K,{get checked(){return e.enabled()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),i(k,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("skills.row.openFile")},get disabled(){return!e.canOpen()},get onClick(){return e.onOpen}}),null),a})()}function zi(e){const t=q(),r=()=>e.source.kind==="path"?t.t("skills.source.path"):t.t("skills.source.url");return(()=>{var u=_i(),a=u.firstChild,o=a.firstChild,f=o.firstChild,l=f.firstChild,c=o.nextSibling;return i(f,n(ce,{get name(){return e.source.kind==="path"?"folder":"link"},size:"small",class:"icon-strong-base shrink-0"}),l),i(l,()=>e.source.value),i(f,n(te,{get children(){return r()}}),null),i(c,n(Y,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),i(c,n(Y,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),u})()}function Ii(e){const t=q(),r=ee(),u=ie(),a=je(),o=lt(),f=Z(),l=!!e.entry,[c,h]=me({kind:e.entry?.kind??"path",value:e.entry?.value??"",errors:{}}),k=()=>c.kind==="path"&&!!a.openDirectoryPickerDialog&&o.isLocal(),b=()=>{const v=c.value.trim(),s={};return v||(s.value=t.t("skills.editor.error.value")),c.kind==="url"&&v&&!/^https?:\/\//i.test(v)&&(s.value=t.t("skills.editor.error.url")),h("errors",s),Object.keys(s).length===0},D=re(()=>({mutationFn:async()=>{if(!b())return;const v=(r.data.config.skills?.paths??[]).slice(),s=(r.data.config.skills?.urls??[]).slice();e.entry?.kind==="path"&&v.splice(e.entry.index,1),e.entry?.kind==="url"&&s.splice(e.entry.index,1);const g=c.kind==="path"?v:s;if(g.includes(c.value.trim())){h("errors","value",t.t("skills.editor.error.duplicate"));return}e.entry&&e.entry.kind===c.kind?g.splice(e.entry.index,0,c.value.trim()):g.push(c.value.trim()),await r.updateConfig({skills:ct({paths:v,urls:s})}),await u.client.global.dispose().catch(()=>{}),e.onSaved(),N({variant:"success",icon:"circle-check",title:l?t.t("skills.toast.sourceUpdated"):t.t("skills.toast.sourceAdded")}),f.close()},onError:v=>{N({variant:"error",title:t.t("common.requestFailed"),description:v instanceof Error?v.message:String(v)})}})),m=()=>{!k()||!a.openDirectoryPickerDialog||a.openDirectoryPickerDialog({title:t.t("skills.editor.browse.title")}).then(v=>{v&&h("value",Array.isArray(v)?v[0]??"":v)})},S=v=>{v.preventDefault(),!D.isPending&&D.mutate()};return n(be,{get title(){return l?t.t("skills.editor.title.edit"):t.t("skills.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var v=Ci(),s=v.firstChild,g=s.firstChild,d=g.firstChild,_=d.nextSibling,$=g.nextSibling,x=$.firstChild,p=s.nextSibling;return v.addEventListener("submit",S),i(d,()=>t.t("skills.editor.type")),i(_,n(et,{get active(){return c.kind==="path"},get label(){return t.t("skills.source.path")},onClick:()=>h("kind","path")}),null),i(_,n(et,{get active(){return c.kind==="url"},get label(){return t.t("skills.source.url")},onClick:()=>h("kind","url")}),null),i(x,n(U,{autofocus:!0,get label(){return A(()=>c.kind==="path")()?t.t("skills.editor.path"):t.t("skills.editor.url")},get description(){return A(()=>c.kind==="path")()?t.t("skills.editor.path.description"):t.t("skills.editor.url.description")},get placeholder(){return c.kind==="path"?"~/.codeplane/skills":"https://example.com/.well-known/skills/"},get value(){return c.value},onChange:z=>ae(()=>{h("value",z),h("errors","value",void 0)}),get error(){return c.errors.value},spellcheck:!1,class:"font-mono text-xs"})),i($,n(F,{get when(){return k()},get children(){return n(O,{type:"button",variant:"secondary",size:"large",icon:"folder",onClick:m,get children(){return t.t("skills.editor.browse")}})}}),null),i(p,n(O,{type:"button",variant:"ghost",size:"large",onClick:()=>f.close(),get children(){return t.t("common.cancel")}}),null),i(p,n(O,{type:"submit",variant:"primary",size:"large",get disabled(){return D.isPending},get children(){return A(()=>!!D.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),v}})}function et(e){return(()=>{var t=Si();return it(t,"click",e.onClick,!0),i(t,()=>e.label),Q(r=>G(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},r)),t})()}Ae(["click"]);var Fi=w('<div class=size-full><div><div class="shrink-0 flex items-center justify-between gap-4 border-b border-border-weak-base pb-4"><div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Li=w('<div class="h-full min-h-[240px]">');const Mi={general:{component:yr},shortcuts:{component:Wr},providers:{component:dn},modes:{component:kn},models:{component:Zn},mcp:{component:Rn},plugins:{component:fi},skills:{component:Pi}};function Ai(){const e=q(),t=Rt(),r=Ut(),u=M(()=>At(t.tab)),a=M(()=>Kt(u())),o=M(()=>Mi[u()]),f=M(()=>o().component);return Nt(()=>{t.tab&&t.tab!==u()&&r(Tt(u()),{replace:!0})}),(()=>{var l=Fi(),c=l.firstChild,h=c.firstChild,k=h.firstChild,b=k.firstChild,D=b.nextSibling;return i(b,()=>e.t(a().titleKey)),i(D,()=>e.t(a().descriptionKey)),i(c,n(Wt,{get fallback(){return Li()},get children(){return n(qt,{get component(){return f()},layout:"page"})}}),null),Q(m=>{var S=!!o().contentScroll,v=!o().contentScroll,s={"mx-auto flex w-full max-w-3xl flex-col gap-6 px-6 py-8":!0,"h-full min-h-0":o().contentScroll,"min-h-full":!o().contentScroll};return S!==m.e&&l.classList.toggle("overflow-hidden",m.e=S),v!==m.t&&l.classList.toggle("overflow-y-auto",m.t=v),m.a=G(c,s,m.a),m},{e:void 0,t:void 0,a:void 0}),l})()}export{Ai as default};