turtlecode 0.1.0 → 0.1.3

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 (127) hide show
  1. package/assets/assets/{_basePickBy-B_7ShcHh.js → _basePickBy-BcOvpC5b.js} +1 -1
  2. package/assets/assets/{_baseUniq-BsW7XEuT.js → _baseUniq-D9AKNI-S.js} +1 -1
  3. package/assets/assets/{arc-BbW57NUb.js → arc-ClcBVsDq.js} +1 -1
  4. package/assets/assets/architectureDiagram-2XIMDMQ5-CRV28Qi0.js +36 -0
  5. package/assets/assets/{auth-callback-C2n64Qcj.js → auth-callback-D7CK9pHp.js} +1 -1
  6. package/assets/assets/{blockDiagram-WCTKOSBZ-C1Ni5oSK.js → blockDiagram-WCTKOSBZ-CL-sI8NU.js} +2 -2
  7. package/assets/assets/{c4Diagram-IC4MRINW-g8EmnUUA.js → c4Diagram-IC4MRINW-AFG5p1yt.js} +2 -2
  8. package/assets/assets/channel-BXqEQVGi.js +1 -0
  9. package/assets/assets/{chunk-4BX2VUAB-CGR6NDgJ.js → chunk-4BX2VUAB-CgNy2Qqu.js} +1 -1
  10. package/assets/assets/chunk-55IACEB6-Bsz0SHtO.js +1 -0
  11. package/assets/assets/{chunk-FMBD7UC4-CBSUaebz.js → chunk-FMBD7UC4-BRuwu34q.js} +1 -1
  12. package/assets/assets/chunk-JSJVCQXG-Bt0GkrjS.js +1 -0
  13. package/assets/assets/{chunk-KX2RTZJC-D_r6FHlr.js → chunk-KX2RTZJC-BiUvn-D7.js} +1 -1
  14. package/assets/assets/{chunk-NQ4KR5QH-_-NyPl-E.js → chunk-NQ4KR5QH-DH4YUQE9.js} +1 -1
  15. package/assets/assets/{chunk-QZHKN3VN-CMDZeFvi.js → chunk-QZHKN3VN-CrLB363X.js} +1 -1
  16. package/assets/assets/chunk-VVM5DH6Z-D2vG_ZPx.js +1 -0
  17. package/assets/assets/{chunk-WL4C6EOR-p1mj0O6S.js → chunk-WL4C6EOR-913dgDB-.js} +1 -1
  18. package/assets/assets/classDiagram-VBA2DB6C-gcpKg8SN.js +1 -0
  19. package/assets/assets/classDiagram-v2-RAHNMMFH-gcpKg8SN.js +1 -0
  20. package/assets/assets/clone-oMsF326O.js +1 -0
  21. package/assets/assets/{connection-popover-Sip4k8lc.js → connection-popover-D2MEtT6z.js} +1 -1
  22. package/assets/assets/{context-popover-jX8NoD9w.js → context-popover-C1ZDT4aK.js} +1 -1
  23. package/assets/assets/cose-bilkent-S5V4N54A-DRWnwV5H.js +1 -0
  24. package/assets/assets/{cssMode-xHiM5mcb.js → cssMode-DX-s2EC8.js} +2 -2
  25. package/assets/assets/dagre-KLK3FWXG-CN4ule0l.js +4 -0
  26. package/assets/assets/diagram-E7M64L7V-docJyJu4.js +24 -0
  27. package/assets/assets/diagram-IFDJBPK2-ChVpZldk.js +43 -0
  28. package/assets/assets/diagram-P4PSJMXO-Bf1-kRnd.js +24 -0
  29. package/assets/assets/dialog-clone-project-B1wF7jYQ.js +1 -0
  30. package/assets/assets/{dialog-connect-provider-BEqcXIot.js → dialog-connect-provider-Ot6Qr5dL.js} +2 -2
  31. package/assets/assets/dialog-create-project-BUc4DxX6.js +1 -0
  32. package/assets/assets/{dialog-edit-project-BfeaBlLZ.js → dialog-edit-project-BrkjzrGe.js} +1 -1
  33. package/assets/assets/{dialog-fork-D0oj4IQ5.js → dialog-fork-CyeKjf0e.js} +1 -1
  34. package/assets/assets/{dialog-manage-models-mDJUOPob.js → dialog-manage-models-CoiwPdu-.js} +1 -1
  35. package/assets/assets/{dialog-select-directory-BocFiQ9d.js → dialog-select-directory-K0nOY5Ky.js} +3 -3
  36. package/assets/assets/{dialog-select-file-CifFpv3x.js → dialog-select-file-Dx0Bny2E.js} +1 -1
  37. package/assets/assets/{dialog-select-mcp-Bz0DoDof.js → dialog-select-mcp-ehJzhdpz.js} +1 -1
  38. package/assets/assets/{dialog-select-model-unpaid-Da_CQzO4.js → dialog-select-model-unpaid-IVl97Sa_.js} +2 -2
  39. package/assets/assets/{dialog-select-provider-2iOfyWxy.js → dialog-select-provider-CBq6hNDx.js} +1 -1
  40. package/assets/assets/{dialog-select-server-DBhmJ2f8.js → dialog-select-server-DA5hATxx.js} +1 -1
  41. package/assets/assets/{dialog-settings-gGxknIbS.js → dialog-settings-BoOPbXZp.js} +1 -1
  42. package/assets/assets/{erDiagram-INFDFZHY-7L6v8ikj.js → erDiagram-INFDFZHY-kDj6gvOH.js} +2 -2
  43. package/assets/assets/{file-icon-CgbvTpIc.js → file-icon-DVEMs7Sx.js} +1 -1
  44. package/assets/assets/{flowDiagram-PKNHOUZH-aJT2T3cx.js → flowDiagram-PKNHOUZH-CsQeJUub.js} +2 -2
  45. package/assets/assets/{freemarker2-BgcPHQt-.js → freemarker2-B_-gEFnj.js} +2 -2
  46. package/assets/assets/ganttDiagram-A5KZAMGK-D1W7NciY.js +292 -0
  47. package/assets/assets/{ghostty-web-CyXMoQwm.js → ghostty-web-BQl0ls6m.js} +1 -1
  48. package/assets/assets/gitGraphDiagram-K3NZZRJ6-D4eeLV-l.js +65 -0
  49. package/assets/assets/{graph-CFcaDaoV.js → graph-KGuLNbW2.js} +1 -1
  50. package/assets/assets/{handlebars-DSpGDIPh.js → handlebars-DlnQtQmF.js} +2 -2
  51. package/assets/assets/{home-6Va-8zmR.js → home-BnHPimua.js} +1 -1
  52. package/assets/assets/{html-CNWh6Ln_.js → html-DrjCwvQg.js} +2 -2
  53. package/assets/assets/{htmlMode-LcU-TZaJ.js → htmlMode-C1xX0YwN.js} +3 -3
  54. package/assets/assets/index-DKwABhnu.js +2584 -0
  55. package/assets/assets/{index-DpJDxStT.css → index-DTxAHLat.css} +1 -1
  56. package/assets/assets/infoDiagram-LFFYTUFH-DsQ9EVx0.js +2 -0
  57. package/assets/assets/{ishikawaDiagram-PHBUUO56-y62OJXdI.js → ishikawaDiagram-PHBUUO56-MzetUfFK.js} +6 -6
  58. package/assets/assets/{javascript-CTmFPESg.js → javascript-CBQQIA5q.js} +2 -2
  59. package/assets/assets/{jobs-popover-DRbIcR2O.js → jobs-popover-DQmVz-e0.js} +1 -1
  60. package/assets/assets/{journeyDiagram-4ABVD52K-Bi9XcKs5.js → journeyDiagram-4ABVD52K-BkKgSN_9.js} +2 -2
  61. package/assets/assets/{jsonMode-CW1XLtuQ.js → jsonMode-B2Ye6w7y.js} +3 -3
  62. package/assets/assets/{kanban-definition-K7BYSVSG-DE01LQ5I.js → kanban-definition-K7BYSVSG-DIJz6AsI.js} +4 -4
  63. package/assets/assets/{layout-C6rurAvx.js → layout-BZKpv2Gr.js} +1 -1
  64. package/assets/assets/linear-COY9pyF4.js +1 -0
  65. package/assets/assets/{liquid-DB5uFXiY.js → liquid-CQXVmj19.js} +2 -2
  66. package/assets/assets/{list-BPk4NMWt.js → list-DPJi0fzr.js} +1 -1
  67. package/assets/assets/{mdx-Q7_EfF7H.js → mdx-QuCI1OJC.js} +2 -2
  68. package/assets/assets/{mermaid.core-DdXWHS-1.js → mermaid.core-bhqKFRxj.js} +10 -10
  69. package/assets/assets/{mindmap-definition-YRQLILUH-BajbwusW.js → mindmap-definition-YRQLILUH-CVv44i-B.js} +2 -2
  70. package/assets/assets/pieDiagram-SKSYHLDU-2ekrtn6z.js +30 -0
  71. package/assets/assets/{python-B3qjyNJj.js → python-Bx2b-xP4.js} +2 -2
  72. package/assets/assets/{quadrantDiagram-337W2JSQ-CZMB9UKV.js → quadrantDiagram-337W2JSQ-BoTofVsV.js} +2 -2
  73. package/assets/assets/{razor-CJkx1qh1.js → razor-2zgukQRj.js} +2 -2
  74. package/assets/assets/{requirementDiagram-Z7DCOOCP-BlyteLn_.js → requirementDiagram-Z7DCOOCP-LSodooxy.js} +2 -2
  75. package/assets/assets/sankeyDiagram-WA2Y5GQK-DUXSSMar.js +10 -0
  76. package/assets/assets/{select-CEKfrTm2.js → select-BbwOgh1Q.js} +1 -1
  77. package/assets/assets/{sequenceDiagram-2WXFIKYE-B2cOVhRx.js → sequenceDiagram-2WXFIKYE-C01qZdHR.js} +11 -11
  78. package/assets/assets/{server-row-BhbnbNJy.js → server-row-mRVGCgvL.js} +1 -1
  79. package/assets/assets/session-BXKBDkSI.js +34 -0
  80. package/assets/assets/stateDiagram-RAJIS63D-BuPj1Py4.js +1 -0
  81. package/assets/assets/stateDiagram-v2-FVOUBMTO-CjYACBI3.js +1 -0
  82. package/assets/assets/{status-popover-body-DkLpfJ2k.js → status-popover-body-9YRn8z8W.js} +2 -2
  83. package/assets/assets/{switch-DPq0vsit.js → switch-CHySmW8J.js} +1 -1
  84. package/assets/assets/{tabs-dF68ik4J.js → tabs-CKNlwTKd.js} +1 -1
  85. package/assets/assets/{tag--BCZ5q7_.js → tag-C4xikCZp.js} +1 -1
  86. package/assets/assets/{timeline-definition-YZTLITO2-C18tfizI.js → timeline-definition-YZTLITO2-CPcDqVYw.js} +2 -2
  87. package/assets/assets/transform-BwXaE9hv.js +1 -0
  88. package/assets/assets/{treemap-KZPCXAKY-C7fWdgj-.js → treemap-KZPCXAKY-Bin819KW.js} +1 -1
  89. package/assets/assets/{trellis-6YKi26t8.js → trellis-Csm7WAqm.js} +217 -231
  90. package/assets/assets/{trellis-badge-demo-BDa3ILpo.js → trellis-badge-demo-nxtlIRoh.js} +1 -1
  91. package/assets/assets/{trellis-op-icon-5x1lMwNH.js → trellis-op-icon-CzIuo5X7.js} +1 -1
  92. package/assets/assets/{tsMode-Bg19hQiu.js → tsMode-qOM514sL.js} +2 -2
  93. package/assets/assets/{typescript-8CtqEj8t.js → typescript-XOJMwr_m.js} +2 -2
  94. package/assets/assets/{vennDiagram-LZ73GAT5-DWmAgqdE.js → vennDiagram-LZ73GAT5-BDAdfrV5.js} +2 -2
  95. package/assets/assets/{xml-BKjz9euG.js → xml-BIwomT_0.js} +2 -2
  96. package/assets/assets/{xychartDiagram-JWTSCODW-Ckcyhr_q.js → xychartDiagram-JWTSCODW-Be2x0vdX.js} +2 -2
  97. package/assets/assets/{yaml-jJWTWPtR.js → yaml-BZMZa-4Z.js} +2 -2
  98. package/assets/index.html +2 -4
  99. package/assets/oc-theme-preload.js +0 -2
  100. package/bin/cli.mjs +203 -25
  101. package/package.json +1 -1
  102. package/assets/assets/architectureDiagram-2XIMDMQ5-DVePwAIo.js +0 -36
  103. package/assets/assets/channel-CPcPUiyc.js +0 -1
  104. package/assets/assets/chunk-55IACEB6-CuagpIkW.js +0 -1
  105. package/assets/assets/chunk-JSJVCQXG-DK5RSVJJ.js +0 -1
  106. package/assets/assets/chunk-VVM5DH6Z-COaOSPgd.js +0 -1
  107. package/assets/assets/classDiagram-VBA2DB6C-BAnp4Zaa.js +0 -1
  108. package/assets/assets/classDiagram-v2-RAHNMMFH-BAnp4Zaa.js +0 -1
  109. package/assets/assets/clone-Cf5BTVxd.js +0 -1
  110. package/assets/assets/cose-bilkent-S5V4N54A-C5LXU9pd.js +0 -1
  111. package/assets/assets/dagre-KLK3FWXG-m-9cmD-w.js +0 -4
  112. package/assets/assets/diagram-E7M64L7V-Cn-5LVpt.js +0 -24
  113. package/assets/assets/diagram-IFDJBPK2-CD8BK0Gp.js +0 -43
  114. package/assets/assets/diagram-P4PSJMXO-JVUlmg7w.js +0 -24
  115. package/assets/assets/dialog-clone-project-BgrtjUcd.js +0 -1
  116. package/assets/assets/dialog-create-project-TcSOut-3.js +0 -1
  117. package/assets/assets/ganttDiagram-A5KZAMGK-C5vwClxA.js +0 -292
  118. package/assets/assets/gitGraphDiagram-K3NZZRJ6-CI0SeLE3.js +0 -65
  119. package/assets/assets/index-bSvs-Qh3.js +0 -2544
  120. package/assets/assets/infoDiagram-LFFYTUFH-H6835-cD.js +0 -2
  121. package/assets/assets/linear-ilW0Y4uJ.js +0 -1
  122. package/assets/assets/pieDiagram-SKSYHLDU-DxK57epR.js +0 -30
  123. package/assets/assets/purify.es-A66Cw1IH.js +0 -2
  124. package/assets/assets/sankeyDiagram-WA2Y5GQK-DrdtRBZz.js +0 -10
  125. package/assets/assets/session-CdcUAq9-.js +0 -60
  126. package/assets/assets/stateDiagram-RAJIS63D-C4udRYnl.js +0 -1
  127. package/assets/assets/stateDiagram-v2-FVOUBMTO-CECUON5A.js +0 -1
@@ -1 +1 @@
1
- import{c as te,z as re,u as ae,f as oe,i as A,C as ie,H as ne,L as le,m as l,l as o,p as F,S as I,q as L,y as j,Z as P,$ as R,a0 as G,I as K,j as se,F as ce,V as M,B as T,n as de,G as ue,t as p,v as ve}from"./index-bSvs-Qh3.js";var ge=p('<img class="size-full object-cover">'),fe=p('<div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5">'),me=p('<form class="flex flex-col gap-6 p-6 pt-0"><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-3 items-start"><div class=relative><div class="relative size-16 rounded-md transition-colors cursor-pointer"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div></div><input id=icon-upload type=file accept=image/* class=hidden><div class="flex flex-col gap-1.5 text-12-regular text-text-weak self-center"><span></span><span></span></div></div></div></div><div class="flex justify-end gap-2">'),pe=p('<div class="size-full flex items-center justify-center">'),be=p("<button type=button>");const xe=["pink","mint","orange","purple","cyan","lime"];function je(s){const y=te(),B=re(),_=ae(),i=oe(),w=A(()=>ie(s.project.worktree)),k=A(()=>s.project.name||w()),[e,c]=ne({name:k(),color:s.project.icon?.color||"pink",iconUrl:s.project.icon?.override||"",startup:s.project.commands?.start??"",dragOver:!1,iconHover:!1});let U;function z(r){if(!r.type.startsWith("image/"))return;const a=new FileReader;a.onload=g=>{c("iconUrl",g.target?.result),c("iconHover",!1)},a.readAsDataURL(r)}function N(r){r.preventDefault(),c("dragOver",!1);const a=r.dataTransfer?.files[0];a&&z(a)}function V(r){r.preventDefault(),c("dragOver",!0)}function q(){c("dragOver",!1)}function W(r){const g=r.target.files?.[0];g&&z(g)}function Y(){c("iconUrl","")}const b=le(()=>({mutationFn:async()=>{const r=e.name.trim()===w()?"":e.name.trim(),a=e.startup.trim();if(s.project.id&&s.project.id!=="global"){await B.client.project.update({projectID:s.project.id,directory:s.project.worktree,name:r,icon:{color:e.color,override:e.iconUrl},commands:{start:a}}),_.project.icon(s.project.worktree,e.iconUrl||void 0),y.close();return}_.project.meta(s.project.worktree,{name:r,icon:{color:e.color,override:e.iconUrl||void 0},commands:{start:a||void 0}}),y.close()}}));function Z(r){r.preventDefault(),!b.isPending&&b.mutate()}return l(ue,{get title(){return i.t("dialog.project.edit.title")},class:"w-full max-w-[480px] mx-auto",get children(){var r=me(),a=r.firstChild,g=a.firstChild,C=g.firstChild,J=C.nextSibling,x=J.firstChild,f=x.firstChild,h=f.nextSibling,$=h.nextSibling,S=x.nextSibling,Q=S.nextSibling,D=Q.firstChild,X=D.nextSibling,E=a.nextSibling;return r.addEventListener("submit",Z),o(a,l(F,{autofocus:!0,type:"text",get label(){return i.t("dialog.project.edit.name")},get placeholder(){return w()},get value(){return e.name},onChange:t=>c("name",t)}),g),o(C,()=>i.t("dialog.project.edit.icon")),x.addEventListener("mouseleave",()=>c("iconHover",!1)),x.addEventListener("mouseenter",()=>c("iconHover",!0)),f.$$click=()=>{e.iconUrl&&e.iconHover?Y():U?.click()},f.addEventListener("dragleave",q),f.addEventListener("dragover",V),f.addEventListener("drop",N),o(f,l(I,{get when(){return e.iconUrl},get fallback(){return(()=>{var t=pe();return o(t,l(P,R({get fallback(){return e.name||k()}},()=>G(e.color),{class:"size-full text-[32px]"}))),t})()},get children(){var t=ge();return L(d=>{var m=e.iconUrl,n=i.t("dialog.project.edit.icon.alt");return m!==d.e&&j(t,"src",d.e=m),n!==d.t&&j(t,"alt",d.t=n),d},{e:void 0,t:void 0}),t}})),o(h,l(K,{name:"cloud-upload",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),o($,l(K,{name:"trash",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),S.addEventListener("change",W),se(t=>{U=t},S),o(D,()=>i.t("dialog.project.edit.icon.hint")),o(X,()=>i.t("dialog.project.edit.icon.recommended")),o(a,l(I,{get when(){return!e.iconUrl},get children(){var t=fe(),d=t.firstChild,m=d.nextSibling;return o(d,()=>i.t("dialog.project.edit.color")),o(m,l(ce,{each:xe,children:n=>(()=>{var v=be();return v.$$click=()=>c("color",n),o(v,l(P,R({get fallback(){return e.name||k()}},()=>G(n),{class:"size-full rounded"}))),L(u=>{var H=i.t("dialog.project.edit.color.select",{color:n}),O=e.color===n,ee={"flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-default":!0,"bg-transparent border-2 border-icon-strong-base hover:bg-surface-base-hover":e.color===n,"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":e.color!==n};return H!==u.e&&j(v,"aria-label",u.e=H),O!==u.t&&j(v,"aria-pressed",u.t=O),u.a=M(v,ee,u.a),u},{e:void 0,t:void 0,a:void 0}),v})()})),t}}),null),o(a,l(F,{multiline:!0,get label(){return i.t("dialog.project.edit.worktree.startup")},get description(){return i.t("dialog.project.edit.worktree.startup.description")},get placeholder(){return i.t("dialog.project.edit.worktree.startup.placeholder")},get value(){return e.startup},onChange:t=>c("startup",t),spellcheck:!1,class:"max-h-14 w-full overflow-y-auto font-mono text-xs"}),null),o(E,l(T,{type:"button",variant:"ghost",size:"large",onClick:()=>y.close(),get children(){return i.t("common.cancel")}}),null),o(E,l(T,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return de(()=>!!b.isPending)()?i.t("common.saving"):i.t("common.save")}}),null),L(t=>{var d={"border-text-interactive-base bg-surface-info-base/20":e.dragOver,"border-border-base hover:border-border-strong":!e.dragOver,"overflow-hidden":!!e.iconUrl},m=!!(e.iconHover&&!e.iconUrl),n=!(e.iconHover&&!e.iconUrl),v=!!(e.iconHover&&e.iconUrl),u=!(e.iconHover&&e.iconUrl);return t.e=M(f,d,t.e),m!==t.t&&h.classList.toggle("opacity-100",t.t=m),n!==t.a&&h.classList.toggle("opacity-0",t.a=n),v!==t.o&&$.classList.toggle("opacity-100",t.o=v),u!==t.i&&$.classList.toggle("opacity-0",t.i=u),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r}})}ve(["click"]);export{je as DialogEditProject};
1
+ import{c as te,z as re,u as ae,f as oe,i as A,C as ie,H as ne,L as le,m as l,l as o,p as F,S as I,q as L,y as j,Z as P,$ as R,a0 as G,I as K,j as se,F as ce,V as M,B as T,n as de,G as ue,t as p,v as ve}from"./index-DKwABhnu.js";var ge=p('<img class="size-full object-cover">'),fe=p('<div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5">'),me=p('<form class="flex flex-col gap-6 p-6 pt-0"><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-3 items-start"><div class=relative><div class="relative size-16 rounded-md transition-colors cursor-pointer"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div><div class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"></div></div><input id=icon-upload type=file accept=image/* class=hidden><div class="flex flex-col gap-1.5 text-12-regular text-text-weak self-center"><span></span><span></span></div></div></div></div><div class="flex justify-end gap-2">'),pe=p('<div class="size-full flex items-center justify-center">'),be=p("<button type=button>");const xe=["pink","mint","orange","purple","cyan","lime"];function je(s){const y=te(),B=re(),_=ae(),i=oe(),w=A(()=>ie(s.project.worktree)),k=A(()=>s.project.name||w()),[e,c]=ne({name:k(),color:s.project.icon?.color||"pink",iconUrl:s.project.icon?.override||"",startup:s.project.commands?.start??"",dragOver:!1,iconHover:!1});let U;function z(r){if(!r.type.startsWith("image/"))return;const a=new FileReader;a.onload=g=>{c("iconUrl",g.target?.result),c("iconHover",!1)},a.readAsDataURL(r)}function N(r){r.preventDefault(),c("dragOver",!1);const a=r.dataTransfer?.files[0];a&&z(a)}function V(r){r.preventDefault(),c("dragOver",!0)}function q(){c("dragOver",!1)}function W(r){const g=r.target.files?.[0];g&&z(g)}function Y(){c("iconUrl","")}const b=le(()=>({mutationFn:async()=>{const r=e.name.trim()===w()?"":e.name.trim(),a=e.startup.trim();if(s.project.id&&s.project.id!=="global"){await B.client.project.update({projectID:s.project.id,directory:s.project.worktree,name:r,icon:{color:e.color,override:e.iconUrl},commands:{start:a}}),_.project.icon(s.project.worktree,e.iconUrl||void 0),y.close();return}_.project.meta(s.project.worktree,{name:r,icon:{color:e.color,override:e.iconUrl||void 0},commands:{start:a||void 0}}),y.close()}}));function Z(r){r.preventDefault(),!b.isPending&&b.mutate()}return l(ue,{get title(){return i.t("dialog.project.edit.title")},class:"w-full max-w-[480px] mx-auto",get children(){var r=me(),a=r.firstChild,g=a.firstChild,C=g.firstChild,J=C.nextSibling,x=J.firstChild,f=x.firstChild,h=f.nextSibling,$=h.nextSibling,S=x.nextSibling,Q=S.nextSibling,D=Q.firstChild,X=D.nextSibling,E=a.nextSibling;return r.addEventListener("submit",Z),o(a,l(F,{autofocus:!0,type:"text",get label(){return i.t("dialog.project.edit.name")},get placeholder(){return w()},get value(){return e.name},onChange:t=>c("name",t)}),g),o(C,()=>i.t("dialog.project.edit.icon")),x.addEventListener("mouseleave",()=>c("iconHover",!1)),x.addEventListener("mouseenter",()=>c("iconHover",!0)),f.$$click=()=>{e.iconUrl&&e.iconHover?Y():U?.click()},f.addEventListener("dragleave",q),f.addEventListener("dragover",V),f.addEventListener("drop",N),o(f,l(I,{get when(){return e.iconUrl},get fallback(){return(()=>{var t=pe();return o(t,l(P,R({get fallback(){return e.name||k()}},()=>G(e.color),{class:"size-full text-[32px]"}))),t})()},get children(){var t=ge();return L(d=>{var m=e.iconUrl,n=i.t("dialog.project.edit.icon.alt");return m!==d.e&&j(t,"src",d.e=m),n!==d.t&&j(t,"alt",d.t=n),d},{e:void 0,t:void 0}),t}})),o(h,l(K,{name:"cloud-upload",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),o($,l(K,{name:"trash",size:"large",class:"text-icon-on-interactive-base drop-shadow-sm"})),S.addEventListener("change",W),se(t=>{U=t},S),o(D,()=>i.t("dialog.project.edit.icon.hint")),o(X,()=>i.t("dialog.project.edit.icon.recommended")),o(a,l(I,{get when(){return!e.iconUrl},get children(){var t=fe(),d=t.firstChild,m=d.nextSibling;return o(d,()=>i.t("dialog.project.edit.color")),o(m,l(ce,{each:xe,children:n=>(()=>{var v=be();return v.$$click=()=>c("color",n),o(v,l(P,R({get fallback(){return e.name||k()}},()=>G(n),{class:"size-full rounded"}))),L(u=>{var H=i.t("dialog.project.edit.color.select",{color:n}),O=e.color===n,ee={"flex items-center justify-center size-10 p-0.5 rounded-lg overflow-hidden transition-colors cursor-default":!0,"bg-transparent border-2 border-icon-strong-base hover:bg-surface-base-hover":e.color===n,"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":e.color!==n};return H!==u.e&&j(v,"aria-label",u.e=H),O!==u.t&&j(v,"aria-pressed",u.t=O),u.a=M(v,ee,u.a),u},{e:void 0,t:void 0,a:void 0}),v})()})),t}}),null),o(a,l(F,{multiline:!0,get label(){return i.t("dialog.project.edit.worktree.startup")},get description(){return i.t("dialog.project.edit.worktree.startup.description")},get placeholder(){return i.t("dialog.project.edit.worktree.startup.placeholder")},get value(){return e.startup},onChange:t=>c("startup",t),spellcheck:!1,class:"max-h-14 w-full overflow-y-auto font-mono text-xs"}),null),o(E,l(T,{type:"button",variant:"ghost",size:"large",onClick:()=>y.close(),get children(){return i.t("common.cancel")}}),null),o(E,l(T,{type:"submit",variant:"primary",size:"large",get disabled(){return b.isPending},get children(){return de(()=>!!b.isPending)()?i.t("common.saving"):i.t("common.save")}}),null),L(t=>{var d={"border-text-interactive-base bg-surface-info-base/20":e.dragOver,"border-border-base hover:border-border-strong":!e.dragOver,"overflow-hidden":!!e.iconUrl},m=!!(e.iconHover&&!e.iconUrl),n=!(e.iconHover&&!e.iconUrl),v=!!(e.iconHover&&e.iconUrl),u=!(e.iconHover&&e.iconUrl);return t.e=M(f,d,t.e),m!==t.t&&h.classList.toggle("opacity-100",t.t=m),n!==t.a&&h.classList.toggle("opacity-0",t.a=n),v!==t.o&&$.classList.toggle("opacity-100",t.o=v),u!==t.i&&$.classList.toggle("opacity-0",t.i=u),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),r}})}ve(["click"]);export{je as DialogEditProject};
@@ -1 +1 @@
1
- import{a4 as v,d as D,a1 as S,a2 as k,a5 as _,c as $,f as w,i as P,m as d,l as p,G as F,r as L,J as u,t as I}from"./index-bSvs-Qh3.js";import{L as T}from"./list-BPk4NMWt.js";import{e as b}from"./session-CdcUAq9-.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";import"./tabs-dF68ik4J.js";import"./select-CEKfrTm2.js";import"./trellis-6YKi26t8.js";import"./trellis-op-icon-5x1lMwNH.js";import"./purify.es-A66Cw1IH.js";import"./tag--BCZ5q7_.js";import"./file-icon-CgbvTpIc.js";var q=I('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function C(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const O=()=>{const i=v(),g=D(),c=S(),l=k(),f=_(),h=$(),r=w(),x=P(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(n=>n.type==="text"&&!n.synthetic&&!n.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:C(new Date(s.time.created))})}return o.reverse()}),y=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=b(o,{directory:l.directory,attachmentName:r.t("common.attachment")}),m=L(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){u({title:r.t("common.requestFailed")});return}h.close(),f.set(s,void 0,{dir:m,id:e.data.id}),g(`/${m}/session/${e.data.id}`)}).catch(e=>{const n=e instanceof Error?e.message:String(e);u({title:r.t("common.requestFailed"),description:n})})};return d(F,{get title(){return r.t("command.session.fork")},get children(){return d(T,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:r.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return r.t("dialog.fork.empty")},key:t=>t.id,items:x,filterKeys:["text"],onSelect:y,children:t=>(()=>{var a=q(),o=a.firstChild,s=o.nextSibling;return p(o,()=>t.text),p(s,()=>t.time),a})()})}})};export{O as DialogFork};
1
+ import{a4 as v,d as D,a1 as S,a2 as k,a5 as _,c as $,f as w,i as P,m as d,l as p,G as F,r as L,J as u,t as I}from"./index-DKwABhnu.js";import{L as T}from"./list-DPJi0fzr.js";import{e as b}from"./session-BXKBDkSI.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";import"./tabs-CKNlwTKd.js";import"./select-BbwOgh1Q.js";import"./trellis-Csm7WAqm.js";import"./transform-BwXaE9hv.js";import"./trellis-op-icon-CzIuo5X7.js";import"./tag-C4xikCZp.js";import"./file-icon-DVEMs7Sx.js";var q=I('<div class="w-full flex items-center gap-2"><span class="truncate flex-1 min-w-0 text-left font-normal"></span><span class="text-text-weak shrink-0 font-normal">');function C(i){return i.toLocaleTimeString(void 0,{timeStyle:"short"})}const O=()=>{const i=v(),g=D(),c=S(),l=k(),f=_(),h=$(),r=w(),x=P(()=>{const t=i.id;if(!t)return[];const a=c.data.message[t]??[],o=[];for(const s of a){if(s.role!=="user")continue;const e=(c.data.part[s.id]??[]).find(n=>n.type==="text"&&!n.synthetic&&!n.ignored);e&&o.push({id:s.id,text:e.text.replace(/\n/g," ").slice(0,200),time:C(new Date(s.time.created))})}return o.reverse()}),y=t=>{if(!t)return;const a=i.id;if(!a)return;const o=c.data.part[t.id]??[],s=b(o,{directory:l.directory,attachmentName:r.t("common.attachment")}),m=L(l.directory);l.client.session.fork({sessionID:a,messageID:t.id}).then(e=>{if(!e.data){u({title:r.t("common.requestFailed")});return}h.close(),f.set(s,void 0,{dir:m,id:e.data.id}),g(`/${m}/session/${e.data.id}`)}).catch(e=>{const n=e instanceof Error?e.message:String(e);u({title:r.t("common.requestFailed"),description:n})})};return d(F,{get title(){return r.t("command.session.fork")},get children(){return d(T,{class:"flex-1 min-h-0 [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:min-h-0",get search(){return{placeholder:r.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return r.t("dialog.fork.empty")},key:t=>t.id,items:x,filterKeys:["text"],onSelect:y,children:t=>(()=>{var a=q(),o=a.firstChild,s=o.nextSibling;return p(o,()=>t.text),p(s,()=>t.time),a})()})}})};export{O as DialogFork};
@@ -1 +1 @@
1
- import{a6 as y,f as D,c as b,m as o,l as n,Y as I,B as k,G as $,t as g,a8 as C,v as P}from"./index-bSvs-Qh3.js";import{L}from"./list-BPk4NMWt.js";import{S as c}from"./switch-DPq0vsit.js";import{D as _}from"./dialog-select-provider-2iOfyWxy.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";import"./tag--BCZ5q7_.js";import"./dialog-connect-provider-BEqcXIot.js";var B=g("<span>"),S=g('<div class="w-full flex items-center justify-between gap-x-3"><span></span><div>');const j=()=>{const t=y(),d=D(),u=b(),v=()=>{u.show(()=>o(_,{}))},s=e=>C.indexOf(e),m=e=>t.model.list().filter(r=>r.provider.id===e),h=e=>m(e).every(r=>t.model.visible({modelID:r.id,providerID:r.provider.id})),f=(e,r)=>{m(e).forEach(i=>{t.model.setVisibility({modelID:i.id,providerID:i.provider.id},r)})};return o($,{get title(){return d.t("dialog.model.manage")},get description(){return d.t("dialog.model.manage.description")},get action(){return o(k,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:v,get children(){return d.t("command.provider.connect")}})},get children(){return o(L,{get search(){return{placeholder:d.t("dialog.model.search.placeholder"),autofocus:!0}},get emptyMessage(){return d.t("dialog.model.empty")},key:e=>`${e?.provider?.id}:${e?.id}`,get items(){return t.model.list()},filterKeys:["provider.name","name","id"],sortBy:(e,r)=>e.name.localeCompare(r.name),groupBy:e=>e.provider.id,groupHeader:e=>{const r=e.items[0].provider;return[(()=>{var i=B();return n(i,()=>r.name),i})(),o(I,{placement:"top",get value(){return d.t("dialog.model.manage.provider.toggle",{provider:r.name})},get children(){return o(c,{class:"-mr-1",get checked(){return h(r.id)},onChange:i=>f(r.id,i),hideLabel:!0,get children(){return r.name}})}})]},sortGroupsBy:(e,r)=>{const i=s(e.items[0].provider.id),l=s(r.items[0].provider.id),a=i>=0,p=l>=0;return a&&!p?-1:!a&&p?1:i-l},onSelect:e=>{if(!e)return;const r={modelID:e.id,providerID:e.provider.id};t.model.setVisibility(r,!t.model.visible(r))},children:e=>(()=>{var r=S(),i=r.firstChild,l=i.nextSibling;return n(i,()=>e.name),l.$$click=a=>a.stopPropagation(),n(l,o(c,{get checked(){return!!t.model.visible({modelID:e.id,providerID:e.provider.id})},onChange:a=>{t.model.setVisibility({modelID:e.id,providerID:e.provider.id},a)}})),r})()})}})};P(["click"]);export{j as DialogManageModels};
1
+ import{a6 as y,f as D,c as b,m as o,l as n,Y as I,B as k,G as $,t as g,a8 as C,v as P}from"./index-DKwABhnu.js";import{L}from"./list-DPJi0fzr.js";import{S as c}from"./switch-CHySmW8J.js";import{D as _}from"./dialog-select-provider-CBq6hNDx.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";import"./tag-C4xikCZp.js";import"./dialog-connect-provider-Ot6Qr5dL.js";var B=g("<span>"),S=g('<div class="w-full flex items-center justify-between gap-x-3"><span></span><div>');const j=()=>{const t=y(),d=D(),u=b(),v=()=>{u.show(()=>o(_,{}))},s=e=>C.indexOf(e),m=e=>t.model.list().filter(r=>r.provider.id===e),h=e=>m(e).every(r=>t.model.visible({modelID:r.id,providerID:r.provider.id})),f=(e,r)=>{m(e).forEach(i=>{t.model.setVisibility({modelID:i.id,providerID:i.provider.id},r)})};return o($,{get title(){return d.t("dialog.model.manage")},get description(){return d.t("dialog.model.manage.description")},get action(){return o(k,{class:"h-7 -my-1 text-14-medium",icon:"plus-small",tabIndex:-1,onClick:v,get children(){return d.t("command.provider.connect")}})},get children(){return o(L,{get search(){return{placeholder:d.t("dialog.model.search.placeholder"),autofocus:!0}},get emptyMessage(){return d.t("dialog.model.empty")},key:e=>`${e?.provider?.id}:${e?.id}`,get items(){return t.model.list()},filterKeys:["provider.name","name","id"],sortBy:(e,r)=>e.name.localeCompare(r.name),groupBy:e=>e.provider.id,groupHeader:e=>{const r=e.items[0].provider;return[(()=>{var i=B();return n(i,()=>r.name),i})(),o(I,{placement:"top",get value(){return d.t("dialog.model.manage.provider.toggle",{provider:r.name})},get children(){return o(c,{class:"-mr-1",get checked(){return h(r.id)},onChange:i=>f(r.id,i),hideLabel:!0,get children(){return r.name}})}})]},sortGroupsBy:(e,r)=>{const i=s(e.items[0].provider.id),l=s(r.items[0].provider.id),a=i>=0,p=l>=0;return a&&!p?-1:!a&&p?1:i-l},onSelect:e=>{if(!e)return;const r={modelID:e.id,providerID:e.provider.id};t.model.setVisibility(r,!t.model.visible(r))},children:e=>(()=>{var r=S(),i=r.firstChild,l=i.nextSibling;return n(i,()=>e.name),l.$$click=a=>a.stopPropagation(),n(l,o(c,{get checked(){return!!t.model.visible({modelID:e.id,providerID:e.provider.id})},onChange:a=>{t.model.setVisibility({modelID:e.id,providerID:e.provider.id},a)}})),r})()})}})};P(["click"]);export{j as DialogManageModels};
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-create-project-TcSOut-3.js","assets/index-bSvs-Qh3.js","assets/index-DpJDxStT.css","assets/dialog-clone-project-BgrtjUcd.js"])))=>i.map(i=>d[i]);
2
- import{u as J,z as Q,a as U,c as X,f as tt,h as et,i as C,A as rt,C as D,m as _,l as b,I as M,E as nt,_ as Z,G as st,t as T}from"./index-bSvs-Qh3.js";import{F as B}from"./file-icon-CgbvTpIc.js";import{L as ot,f as it}from"./list-BPk4NMWt.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";var G=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><span class="text-14-regular text-text-interactive-base">'),at=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),ct=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');const I="__clone__";function H(n){return((n??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function lt(n){const t=n.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function x(n){const t=lt(n);return/^[A-Za-z]:$/.test(t)?t+"/":t}function p(n){const t=x(n);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function ut(n,t){const o=p(n??""),a=p(t).replace(/^\/+/,"");return o?a?o.endsWith("/")?o+a:o+"/"+a:o:a}function O(n){const t=x(n);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function ft(n){const t=p(n);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function dt(n){const t=x(n.trim());return t?t.startsWith("~")?"tilde":O(t)?"absolute":"relative":"relative"}function N(n,t){const o=p(n);if(!t)return"";const a=p(t),g=o.toLowerCase(),l=a.toLowerCase();return g===l?"~":g.startsWith(l+"/")?"~"+o.slice(a.length):""}function V(n,t,o){const a=p(n);return dt(t)==="absolute"?a:N(a,o)||a}function q(n,t,o){const a=p(n),g=N(a,t),l=c=>c?c.endsWith("/")?c:c+"/":"",w=Array.from(new Set([a,l(a),g,l(g),D(a)].filter(Boolean))).join(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-create-project-BUc4DxX6.js","assets/index-DKwABhnu.js","assets/index-DTxAHLat.css","assets/dialog-clone-project-B1wF7jYQ.js"])))=>i.map(i=>d[i]);
2
+ import{u as J,z as Q,a as U,c as X,f as tt,h as et,i as C,A as rt,C as D,m as _,l as b,I as M,E as nt,_ as Z,G as st,t as T}from"./index-DKwABhnu.js";import{F as B}from"./file-icon-DVEMs7Sx.js";import{L as ot,f as it}from"./list-DPJi0fzr.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";var G=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><span class="text-14-regular text-text-interactive-base">'),at=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-strong whitespace-nowrap">~</span><span class="text-text-weak whitespace-nowrap">/'),ct=T('<div class="w-full flex items-center justify-between rounded-md"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular min-w-0"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap"></span><span class="text-text-weak whitespace-nowrap">/');const I="__clone__";function H(n){return((n??"").split(/\r?\n/)[0]??"").replace(/[\u0000-\u001F\u007F]/g,"").trim()}function lt(n){const t=n.replaceAll("\\","/");return t.startsWith("//")&&!t.startsWith("///")?"//"+t.slice(2).replace(/\/+/g,"/"):t.replace(/\/+/g,"/")}function x(n){const t=lt(n);return/^[A-Za-z]:$/.test(t)?t+"/":t}function p(n){const t=x(n);return t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t)?t:t.replace(/\/+$/,"")}function ut(n,t){const o=p(n??""),a=p(t).replace(/^\/+/,"");return o?a?o.endsWith("/")?o+a:o+"/"+a:o:a}function O(n){const t=x(n);return t.startsWith("//")?"//":t.startsWith("/")?"/":/^[A-Za-z]:\//.test(t)?t.slice(0,3):""}function ft(n){const t=p(n);if(t==="/"||t==="//"||/^[A-Za-z]:\/$/.test(t))return t;const o=t.lastIndexOf("/");return o<=0?"/":o===2&&/^[A-Za-z]:/.test(t)?t.slice(0,3):t.slice(0,o)}function dt(n){const t=x(n.trim());return t?t.startsWith("~")?"tilde":O(t)?"absolute":"relative":"relative"}function N(n,t){const o=p(n);if(!t)return"";const a=p(t),g=o.toLowerCase(),l=a.toLowerCase();return g===l?"~":g.startsWith(l+"/")?"~"+o.slice(a.length):""}function V(n,t,o){const a=p(n);return dt(t)==="absolute"?a:N(a,o)||a}function q(n,t,o){const a=p(n),g=N(a,t),l=c=>c?c.endsWith("/")?c:c+"/":"",w=Array.from(new Set([a,l(a),g,l(g),D(a)].filter(Boolean))).join(`
3
3
  `);return{absolute:a,search:w,group:o}}function ht(n){const t=new Set;return n.filter(o=>t.has(o.absolute)?!1:(t.add(o.absolute),!0))}function pt(n){const t=new Map;let o=0;const a=w=>{const c=n.start();if(!c)return;const i=x(w);if(!i)return{directory:p(c),path:""};const y=n.home();if(i==="~")return{directory:p(y||c),path:""};if(i.startsWith("~/"))return{directory:p(y||c),path:i.slice(2)};const u=O(i);return u?{directory:p(u),path:i.slice(u.length)}:{directory:p(c),path:i}},g=async w=>{const c=p(w),i=t.get(c);if(i)return i;const y=n.sdk.client.file.list({directory:c,path:""}).then(u=>u.data??[]).catch(()=>[]).then(u=>u.filter(d=>d.type==="directory").map(d=>({name:d.name,absolute:p(x(d.absolute))})));return t.set(c,y),y},l=async(w,c,i)=>{const y=await g(w);return c?it.go(c,y,{key:"name",limit:i}).map(u=>u.obj.absolute):y.slice(0,i).map(u=>u.absolute)};return async w=>{const c=++o,i=()=>c===o,y=H(w),u=a(y);if(!u)return[];const d=x(y),W=d.startsWith("~")||!!O(d)||d.includes("/"),z=x(u.path),L=()=>n.sdk.client.find.files({directory:u.directory,query:z,type:"directory",limit:50}).then(m=>m.data??[]).catch(()=>[]);if(!W){const m=await L();return i()?m.map(F=>ut(u.directory,F)).slice(0,50):[]}const v=z.replace(/^\/+/,"").split("/"),R=v.slice(0,v.length-1).filter(m=>m&&m!=="."),S=v[v.length-1]??"",E=12,P=4;let e=[u.directory];for(const m of R){if(!i())return[];if(m===".."){e=e.map(ft);continue}const F=(await Promise.all(e.map(Y=>l(Y,m,P)))).flat();if(!i())return[];if(e=Array.from(new Set(F)).slice(0,E),e.length===0)return[]}const f=(await Promise.all(e.map(m=>l(m,S,50)))).flat();if(!i())return[];const r=Array.from(new Set(f)),s=d.startsWith("~")?p(u.directory):"";if(!!d.endsWith("/")||!S)return(s?Array.from(new Set([s,...r])):r).slice(0,50);const $=S.toLowerCase(),k=r.filter(m=>D(m).toLowerCase()===$)[0];if(!k)return r.slice(0,50);const j=await l(k,"",30);if(!i())return[];const K=Array.from(new Set([...r,...j]));return(s?Array.from(new Set([s,...K])):K).slice(0,50)}}function _t(n){const t=J(),o=Q(),a=U(),g=X(),l=tt(),[w,c]=et("");let i;const y=C(()=>!(t.data.path.home||t.data.path.directory)),[u]=rt(()=>y()?!0:void 0,async()=>o.client.path.get().then(e=>e.data).catch(()=>{}),{initialValue:void 0}),d=C(()=>t.data.path.home||u()?.home||""),W=C(()=>d()+"/.turtlecode"),z=C(()=>W()),L=pt({sdk:o,home:d,start:z}),v=C(()=>{const e=a.projects.list(),f=new Map;for(const r of e){let s=0;const h=[r.worktree,...r.sandboxes??[]];for(const $ of h){const A=t.child($,{bootstrap:!1})[0].session;for(const k of A){if(k.time.archived)continue;const j=k.time.updated??k.time.created;j>s&&(s=j)}}f.set(r.worktree,s)}return e.map((r,s)=>({project:r,at:f.get(r.worktree)??0,index:s})).sort((r,s)=>s.at-r.at||r.index-s.index).slice(0,5).map(({project:r})=>{const s=q(r.worktree,d(),"recent"),h=r.name||D(r.worktree);return{...s,search:`${s.search}
4
4
  ${h}`}})}),R={absolute:"__create__",search:l.t("dialog.directory.create")+`
5
5
  new blank project`,group:"create"},S={absolute:I,search:l.t("dialog.clone.title")+`
6
- clone github import`,group:"create"},E=async e=>{const r=(await L(e)).map(s=>q(s,d(),"folders"));return[R,S,...ht([...v(),...r])]};function P(e){n.onSelect(n.multiple?[e]:e),g.close()}return _(st,{get title(){return n.title??l.t("command.project.open")},get children(){return _(ot,{get search(){return{placeholder:l.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.directory.empty")},get loadingMessage(){return l.t("common.loading")},items:E,key:e=>e.absolute,filterKeys:["search"],groupBy:e=>e.group,sortGroupsBy:(e,f)=>e.category===f.category?0:e.category==="create"?-1:f.category==="create"?1:e.category==="recent"?-1:1,groupHeader:e=>{if(e.category!=="create")return e.category==="recent"?l.t("home.recentProjects"):l.t("command.project.open")},ref:e=>i=e,onFilter:e=>c(H(e)),onKeyEvent:(e,f)=>{if(e.key!=="Tab"||e.shiftKey||!f)return;e.preventDefault(),e.stopPropagation();const r=V(f.absolute,w(),d());i?.setFilter(r.endsWith("/")?r:r+"/")},onSelect:e=>{if(e){if(e.absolute==="__create__"){g.close(),setTimeout(()=>{Z(()=>import("./dialog-create-project-TcSOut-3.js"),__vite__mapDeps([0,1,2])).then(f=>{g.show(()=>_(f.DialogCreateProject,{get multiple(){return n.multiple},get onSelect(){return n.onSelect}}),()=>n.onSelect(null))})});return}if(e.absolute===I){g.close(),setTimeout(()=>{Z(()=>import("./dialog-clone-project-BgrtjUcd.js"),__vite__mapDeps([3,1,2])).then(f=>{g.show(()=>_(f.DialogCloneProject,{onSelect:r=>r&&P(r)}),()=>n.onSelect(null))})});return}P(e.absolute)}},children:e=>{if(e.absolute==="__create__")return(()=>{var r=G(),s=r.firstChild,h=s.firstChild;return b(s,_(M,{name:"plus",size:"small",class:"shrink-0 size-4 text-icon-interactive-base"}),h),b(h,()=>l.t("dialog.directory.create")),r})();if(e.absolute===I)return(()=>{var r=G(),s=r.firstChild,h=s.firstChild;return b(s,_(M,{name:"branch",size:"small",class:"shrink-0 size-4 text-icon-interactive-base"}),h),b(h,()=>l.t("dialog.clone.title")),r})();const f=V(e.absolute,w(),d());return f==="~"?(()=>{var r=at(),s=r.firstChild,h=s.firstChild;return b(s,_(B,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),h),r})():(()=>{var r=ct(),s=r.firstChild,h=s.firstChild,$=h.firstChild,A=$.nextSibling;return b(s,_(B,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),h),b($,()=>nt(f)),b(A,()=>D(f)),r})()}})}})}export{_t as DialogSelectDirectory};
6
+ clone github import`,group:"create"},E=async e=>{const r=(await L(e)).map(s=>q(s,d(),"folders"));return[R,S,...ht([...v(),...r])]};function P(e){n.onSelect(n.multiple?[e]:e),g.close()}return _(st,{get title(){return n.title??l.t("command.project.open")},get children(){return _(ot,{get search(){return{placeholder:l.t("dialog.directory.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.directory.empty")},get loadingMessage(){return l.t("common.loading")},items:E,key:e=>e.absolute,filterKeys:["search"],groupBy:e=>e.group,sortGroupsBy:(e,f)=>e.category===f.category?0:e.category==="create"?-1:f.category==="create"?1:e.category==="recent"?-1:1,groupHeader:e=>{if(e.category!=="create")return e.category==="recent"?l.t("home.recentProjects"):l.t("command.project.open")},ref:e=>i=e,onFilter:e=>c(H(e)),onKeyEvent:(e,f)=>{if(e.key!=="Tab"||e.shiftKey||!f)return;e.preventDefault(),e.stopPropagation();const r=V(f.absolute,w(),d());i?.setFilter(r.endsWith("/")?r:r+"/")},onSelect:e=>{if(e){if(e.absolute==="__create__"){g.close(),setTimeout(()=>{Z(()=>import("./dialog-create-project-BUc4DxX6.js"),__vite__mapDeps([0,1,2])).then(f=>{g.show(()=>_(f.DialogCreateProject,{get multiple(){return n.multiple},get onSelect(){return n.onSelect}}),()=>n.onSelect(null))})});return}if(e.absolute===I){g.close(),setTimeout(()=>{Z(()=>import("./dialog-clone-project-B1wF7jYQ.js"),__vite__mapDeps([3,1,2])).then(f=>{g.show(()=>_(f.DialogCloneProject,{onSelect:r=>r&&P(r)}),()=>n.onSelect(null))})});return}P(e.absolute)}},children:e=>{if(e.absolute==="__create__")return(()=>{var r=G(),s=r.firstChild,h=s.firstChild;return b(s,_(M,{name:"plus",size:"small",class:"shrink-0 size-4 text-icon-interactive-base"}),h),b(h,()=>l.t("dialog.directory.create")),r})();if(e.absolute===I)return(()=>{var r=G(),s=r.firstChild,h=s.firstChild;return b(s,_(M,{name:"branch",size:"small",class:"shrink-0 size-4 text-icon-interactive-base"}),h),b(h,()=>l.t("dialog.clone.title")),r})();const f=V(e.absolute,w(),d());return f==="~"?(()=>{var r=at(),s=r.firstChild,h=s.firstChild;return b(s,_(B,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),h),r})():(()=>{var r=ct(),s=r.firstChild,h=s.firstChild,$=h.firstChild,A=$.nextSibling;return b(s,_(B,{get node(){return{path:e.absolute,type:"directory"}},class:"shrink-0 size-4"}),h),b($,()=>nt(f)),b(A,()=>D(f)),r})()}})}})}export{_t as DialogSelectDirectory};
@@ -1 +1 @@
1
- import{l as g,q as T,V as Q,t as S,aH as U,f as X,a as Z,aI as ee,c as te,d as ne,z as se,u as re,h as ae,i as b,P as oe,m as y,aJ as ie,aB as ce,aC as K,S as M,aK as le,I as de,E as ue,C as O,G as fe,r as ge}from"./index-bSvs-Qh3.js";import{F as he}from"./file-icon-CgbvTpIc.js";import{L as me}from"./list-BPk4NMWt.js";import{u as pe}from"./trellis-6YKi26t8.js";import{c as we}from"./session-CdcUAq9-.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";import"./select-CEKfrTm2.js";import"./trellis-op-icon-5x1lMwNH.js";import"./tabs-dF68ik4J.js";import"./purify.es-A66Cw1IH.js";import"./tag--BCZ5q7_.js";var ye=S("<span data-component=keybind>");function ve(t){return(()=>{var n=ye();return g(n,()=>t.children),T(a=>Q(n,{...t.classList??{},[t.class??""]:!!t.class},a)),n})()}function be(t,n){const a=new Date(t),r=new Date().getTime()-a.getTime(),c=Math.floor(r/1e3),u=Math.floor(c/60),o=Math.floor(u/60),f=Math.floor(o/24);return c<60?n("common.time.justNow"):u<60?n("common.time.minutesAgo.short",{count:u}):o<24?n("common.time.hoursAgo.short",{count:o}):n("common.time.daysAgo.short",{count:f})}var P=S('<span class="text-14-regular text-text-weak truncate">'),xe=S('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),$e=S('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),ke=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Se=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const E=5,_e=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],q=t=>{const n=new Set,a=[];for(const h of t)n.has(h.id)||(n.add(h.id),a.push(h));return a},A=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),D=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Ce=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function Me(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(r=>!r.disabled&&!r.id.startsWith("suggested.")&&r.id!=="file.open")),a=b(()=>{const r=t.language.t("palette.group.commands");return n().map(c=>A(c,r))}),h=b(()=>{const r=n(),c=new Map(_e.map((i,l)=>[i,l])),u=r.filter(i=>c.has(i.id)),o=u.length?u:r.slice(0,E),f=u.length?[...o].sort((i,l)=>(c.get(i.id)??0)-(c.get(l.id)??0)):o,v=t.language.t("palette.group.commands");return f.map(i=>A(i,v))});return{allowed:n,list:a,picks:h}}function De(t){const n=we({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:r=>r.startsWith("file://")?t.file.tab(r):r}),a=b(()=>{const r=n.openedTabs(),c=n.activeFileTab(),u=c?[c,...r.filter(i=>i!==c)]:r,o=new Set,f=t.language.t("palette.group.files"),v=[];for(const i of u){const l=t.file.pathFromTab(i);l&&(o.has(l)||(o.add(l),v.push(D(l,f))))}return v.slice(0,E)}),h=b(()=>{const r=t.language.t("palette.group.files");return t.file.tree.children("").filter(o=>o.type==="file").map(o=>o.path).sort((o,f)=>o.localeCompare(f)).slice(0,E).map(o=>D(o,r))});return{recent:a,root:h}}function Fe(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:h=>{if(!h.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const c=n.token,u=t.workspaces();return u.length===0?[]:(n.inflight=Promise.all(u.map(o=>{const f=t.label(o);return t.globalSDK.client.session.list({directory:o,roots:!0}).then(v=>(v.data??[]).filter(i=>!!i?.id).map(i=>({id:i.id,title:i.title??t.language.t("command.session.new"),description:f,directory:o,archived:i.time?.archived,updated:i.time?.updated}))).catch(()=>[])})).then(o=>{if(n.token!==c)return[];const f=new Set,v=t.language.t("command.category.session"),i=o.flat().filter(l=>{const $=`${l.directory}:${l.id}`;return f.has($)?!1:(f.add($),!0)}).map(l=>Ce(l,v));return n.cached=i,i}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function ze(t){const n=U(),a=X(),h=Z(),r=ee(),c=te(),u=ne(),o=se(),f=re(),{params:v,tabs:i,view:l}=pe(),$=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[N,z]=ae(!1),I=Me({filesOnly:$,command:n,language:a}),_=De({file:r,tabs:i,language:a}),L=b(()=>ie(v.dir)??""),j=b(()=>{const e=L();if(e)return h.projects.list().find(s=>s.worktree===e||s.sandboxes?.includes(e))}),G=b(()=>{const e=L(),s=j();if(!s)return e?[e]:[];const d=[s.worktree,...s.sandboxes??[]];return e&&!d.includes(e)?[...d,e]:d}),H=b(()=>f.data.path.home),R=e=>{const s=j(),d=s&&e===s.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=f.child(e,{bootstrap:!1}),m=H(),w=m?e.replace(m,"~"):e,x=p.vcs?.branch??O(e);return`${d} : ${x||w}`},{sessions:B}=Fe({workspaces:G,label:R,globalSDK:o,language:a}),W=async e=>{const s=e.trim();if(z(s.length>0),!s&&$()){const x=r.tree.state("")?.loaded,F=x?Promise.resolve():r.tree.list(""),C=q([..._.recent(),..._.root()]);return x||C.length>0?C:(await F,q([..._.recent(),..._.root()]))}if(!s)return[...I.picks(),..._.recent()];if($()){const x=await r.searchFiles(s),F=a.t("palette.group.files");return x.map(C=>D(C,F))}const[d,p]=await Promise.all([r.searchFiles(s),Promise.resolve(B(s))]),m=a.t("palette.group.files"),w=d.map(x=>D(x,m));return[...I.list(),...p,...w]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},V=e=>{const s=r.tab(e);i().open(s),r.load(e),l().reviewPanel.opened()||l().reviewPanel.open(),h.fileTree.setTab("all"),t.onOpenFile?.(e),i().setActive(s)},Y=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,c.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;u(`/${ge(e.directory)}/session/${e.sessionID}`);return}e.path&&V(e.path)}};return oe(()=>{k.committed||k.cleanup?.()}),y(fe,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return y(me,{get search(){return{placeholder:$()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:W,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return N()?e=>e.category:()=>""},onMove:J,onSelect:Y,children:e=>y(ce,{get fallback(){return(()=>{var s=Se(),d=s.firstChild,p=d.firstChild,m=p.firstChild,w=m.nextSibling;return g(d,y(he,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),p),g(m,()=>ue(e.path??"")),g(w,()=>O(e.path??"")),s})()},get children(){return[y(K,{get when(){return e.type==="command"},get children(){var s=xe(),d=s.firstChild,p=d.firstChild;return g(p,()=>e.title),g(d,y(M,{get when(){return e.description},get children(){var m=P();return g(m,()=>e.description),m}}),null),g(s,y(M,{get when(){return e.keybind},get children(){return y(ve,{class:"rounded-[4px]",get children(){return le(e.keybind??"",a.t)}})}}),null),s}}),y(K,{get when(){return e.type==="session"},get children(){var s=ke(),d=s.firstChild,p=d.firstChild,m=p.firstChild;return g(d,y(de,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),p),g(m,()=>e.title),g(p,y(M,{get when(){return e.description},get children(){var w=P();return g(w,()=>e.description),T(()=>w.classList.toggle("opacity-70",!!e.archived)),w}}),null),g(s,y(M,{get when(){return e.updated},get children(){var w=$e();return g(w,()=>be(new Date(e.updated).toISOString(),a.t)),w}}),null),T(()=>m.classList.toggle("opacity-70",!!e.archived)),s}})]}})})}})}export{ze as DialogSelectFile};
1
+ import{l as g,q as T,V as Q,t as S,aI as U,f as X,a as Z,aJ as ee,c as te,d as ne,z as se,u as re,h as ae,i as b,P as oe,m as y,aK as ie,aC as ce,aD as K,S as D,aL as le,I as de,E as ue,C as O,G as fe,r as ge}from"./index-DKwABhnu.js";import{F as he}from"./file-icon-DVEMs7Sx.js";import{L as me}from"./list-DPJi0fzr.js";import{u as pe}from"./trellis-Csm7WAqm.js";import{c as we}from"./session-BXKBDkSI.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";import"./select-BbwOgh1Q.js";import"./transform-BwXaE9hv.js";import"./trellis-op-icon-CzIuo5X7.js";import"./tabs-CKNlwTKd.js";import"./tag-C4xikCZp.js";var ye=S("<span data-component=keybind>");function ve(t){return(()=>{var n=ye();return g(n,()=>t.children),T(a=>Q(n,{...t.classList??{},[t.class??""]:!!t.class},a)),n})()}function be(t,n){const a=new Date(t),r=new Date().getTime()-a.getTime(),c=Math.floor(r/1e3),u=Math.floor(c/60),o=Math.floor(u/60),f=Math.floor(o/24);return c<60?n("common.time.justNow"):u<60?n("common.time.minutesAgo.short",{count:u}):o<24?n("common.time.hoursAgo.short",{count:o}):n("common.time.daysAgo.short",{count:f})}var P=S('<span class="text-14-regular text-text-weak truncate">'),xe=S('<div class="w-full flex items-center justify-between gap-4"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong whitespace-nowrap">'),$e=S('<span class="text-12-regular text-text-weak whitespace-nowrap ml-2">'),ke=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center gap-2 min-w-0"><span class="text-14-regular text-text-strong truncate">'),Se=S('<div class="w-full flex items-center justify-between rounded-md pl-1"><div class="flex items-center gap-x-3 grow min-w-0"><div class="flex items-center text-14-regular"><span class="text-text-weak whitespace-nowrap overflow-hidden overflow-ellipsis truncate min-w-0"></span><span class="text-text-strong whitespace-nowrap">');const E=5,_e=["session.new","workspace.new","session.previous","session.next","terminal.toggle","review.toggle"],q=t=>{const n=new Set,a=[];for(const h of t)n.has(h.id)||(n.add(h.id),a.push(h));return a},A=(t,n)=>({id:"command:"+t.id,type:"command",title:t.title,description:t.description,keybind:t.keybind,category:n,option:t}),M=(t,n)=>({id:"file:"+t,type:"file",title:t,category:n,path:t}),Ce=(t,n)=>({id:`session:${t.directory}:${t.id}`,type:"session",title:t.title,description:t.description,category:n,directory:t.directory,sessionID:t.id,archived:t.archived,updated:t.updated});function De(t){const n=b(()=>t.filesOnly()?[]:t.command.options.filter(r=>!r.disabled&&!r.id.startsWith("suggested.")&&r.id!=="file.open")),a=b(()=>{const r=t.language.t("palette.group.commands");return n().map(c=>A(c,r))}),h=b(()=>{const r=n(),c=new Map(_e.map((i,l)=>[i,l])),u=r.filter(i=>c.has(i.id)),o=u.length?u:r.slice(0,E),f=u.length?[...o].sort((i,l)=>(c.get(i.id)??0)-(c.get(l.id)??0)):o,v=t.language.t("palette.group.commands");return f.map(i=>A(i,v))});return{allowed:n,list:a,picks:h}}function Me(t){const n=we({tabs:t.tabs,pathFromTab:t.file.pathFromTab,normalizeTab:r=>r.startsWith("file://")?t.file.tab(r):r}),a=b(()=>{const r=n.openedTabs(),c=n.activeFileTab(),u=c?[c,...r.filter(i=>i!==c)]:r,o=new Set,f=t.language.t("palette.group.files"),v=[];for(const i of u){const l=t.file.pathFromTab(i);l&&(o.has(l)||(o.add(l),v.push(M(l,f))))}return v.slice(0,E)}),h=b(()=>{const r=t.language.t("palette.group.files");return t.file.tree.children("").filter(o=>o.type==="file").map(o=>o.path).sort((o,f)=>o.localeCompare(f)).slice(0,E).map(o=>M(o,r))});return{recent:a,root:h}}function Fe(t){const n={token:0,inflight:void 0,cached:void 0};return{sessions:h=>{if(!h.trim())return n.token+=1,n.inflight=void 0,n.cached=void 0,[];if(n.cached)return n.cached;if(n.inflight)return n.inflight;const c=n.token,u=t.workspaces();return u.length===0?[]:(n.inflight=Promise.all(u.map(o=>{const f=t.label(o);return t.globalSDK.client.session.list({directory:o,roots:!0}).then(v=>(v.data??[]).filter(i=>!!i?.id).map(i=>({id:i.id,title:i.title??t.language.t("command.session.new"),description:f,directory:o,archived:i.time?.archived,updated:i.time?.updated}))).catch(()=>[])})).then(o=>{if(n.token!==c)return[];const f=new Set,v=t.language.t("command.category.session"),i=o.flat().filter(l=>{const $=`${l.directory}:${l.id}`;return f.has($)?!1:(f.add($),!0)}).map(l=>Ce(l,v));return n.cached=i,i}).catch(()=>[]).finally(()=>{n.inflight=void 0}),n.inflight)}}}function ze(t){const n=U(),a=X(),h=Z(),r=ee(),c=te(),u=ne(),o=se(),f=re(),{params:v,tabs:i,view:l}=pe(),$=()=>t.mode==="files",k={cleanup:void 0,committed:!1},[N,z]=ae(!1),I=De({filesOnly:$,command:n,language:a}),_=Me({file:r,tabs:i,language:a}),L=b(()=>ie(v.dir)??""),j=b(()=>{const e=L();if(e)return h.projects.list().find(s=>s.worktree===e||s.sandboxes?.includes(e))}),G=b(()=>{const e=L(),s=j();if(!s)return e?[e]:[];const d=[s.worktree,...s.sandboxes??[]];return e&&!d.includes(e)?[...d,e]:d}),R=b(()=>f.data.path.home),H=e=>{const s=j(),d=s&&e===s.worktree?a.t("workspace.type.local"):a.t("workspace.type.sandbox"),[p]=f.child(e,{bootstrap:!1}),m=R(),w=m?e.replace(m,"~"):e,x=p.vcs?.branch??O(e);return`${d} : ${x||w}`},{sessions:W}=Fe({workspaces:G,label:H,globalSDK:o,language:a}),B=async e=>{const s=e.trim();if(z(s.length>0),!s&&$()){const x=r.tree.state("")?.loaded,F=x?Promise.resolve():r.tree.list(""),C=q([..._.recent(),..._.root()]);return x||C.length>0?C:(await F,q([..._.recent(),..._.root()]))}if(!s)return[...I.picks(),..._.recent()];if($()){const x=await r.searchFiles(s),F=a.t("palette.group.files");return x.map(C=>M(C,F))}const[d,p]=await Promise.all([r.searchFiles(s),Promise.resolve(W(s))]),m=a.t("palette.group.files"),w=d.map(x=>M(x,m));return[...I.list(),...p,...w]},J=e=>{k.cleanup?.(),e&&e.type==="command"&&(k.cleanup=e.option?.onHighlight?.())},V=e=>{const s=r.tab(e);i().open(s),r.load(e),l().reviewPanel.opened()||l().reviewPanel.open(),h.fileTree.setTab("all"),t.onOpenFile?.(e),i().setActive(s)},Y=e=>{if(e){if(k.committed=!0,k.cleanup=void 0,c.close(),e.type==="command"){e.option?.onSelect?.("palette");return}if(e.type==="session"){if(!e.directory||!e.sessionID)return;u(`/${ge(e.directory)}/session/${e.sessionID}`);return}e.path&&V(e.path)}};return oe(()=>{k.committed||k.cleanup?.()}),y(fe,{class:"pt-3 pb-0 !max-h-[480px]",transition:!0,get children(){return y(me,{get search(){return{placeholder:$()?a.t("session.header.searchFiles"):a.t("palette.search.placeholder"),autofocus:!0,hideIcon:!0}},get emptyMessage(){return a.t("palette.empty")},get loadingMessage(){return a.t("common.loading")},items:B,key:e=>e.id,filterKeys:["title","description","category"],get groupBy(){return N()?e=>e.category:()=>""},onMove:J,onSelect:Y,children:e=>y(ce,{get fallback(){return(()=>{var s=Se(),d=s.firstChild,p=d.firstChild,m=p.firstChild,w=m.nextSibling;return g(d,y(he,{get node(){return{path:e.path??"",type:"file"}},class:"shrink-0 size-4"}),p),g(m,()=>ue(e.path??"")),g(w,()=>O(e.path??"")),s})()},get children(){return[y(K,{get when(){return e.type==="command"},get children(){var s=xe(),d=s.firstChild,p=d.firstChild;return g(p,()=>e.title),g(d,y(D,{get when(){return e.description},get children(){var m=P();return g(m,()=>e.description),m}}),null),g(s,y(D,{get when(){return e.keybind},get children(){return y(ve,{class:"rounded-[4px]",get children(){return le(e.keybind??"",a.t)}})}}),null),s}}),y(K,{get when(){return e.type==="session"},get children(){var s=ke(),d=s.firstChild,p=d.firstChild,m=p.firstChild;return g(d,y(de,{name:"bubble-5",size:"small",class:"shrink-0 text-icon-weak"}),p),g(m,()=>e.title),g(p,y(D,{get when(){return e.description},get children(){var w=P();return g(w,()=>e.description),T(()=>w.classList.toggle("opacity-70",!!e.archived)),w}}),null),g(s,y(D,{get when(){return e.updated},get children(){var w=$e();return g(w,()=>be(new Date(e.updated).toISOString(),a.t)),w}}),null),T(()=>m.classList.toggle("opacity-70",!!e.archived)),s}})]}})})}})}export{ze as DialogSelectFile};
@@ -1 +1 @@
1
- import{a1 as P,a2 as M,f as D,H as E,O as $,a3 as j,J as F,i as h,L as K,m as u,v as O,l as c,S as v,n as b,G as q,t as m}from"./index-bSvs-Qh3.js";import{L as B}from"./list-BPk4NMWt.js";import{S as G}from"./switch-DPq0vsit.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";var H=m('<span class="text-11-regular text-text-weaker">'),J=m('<span class="text-11-regular text-text-weak">'),T=m('<span class="text-11-regular text-text-weaker truncate">'),z=m('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div>');const A={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},U=()=>{const s=P(),d=M(),l=D(),[_,o]=E({done:!1,loading:!1});$(j(()=>s.data.mcp_ready,(e,t)=>{!e&&t&&o("done",!1)},{defer:!0})),$(()=>{if(!(_.done||_.loading)){if(s.data.mcp_ready){o("done",!0);return}o("loading",!0),d.client.mcp.status().then(e=>{s.set("mcp",e.data??{}),s.set("mcp_ready",!0),o("done",!0)}).catch(e=>{o("done",!0),F({variant:"error",title:l.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}).finally(()=>{o("loading",!1)})}});const p=h(()=>Object.entries(s.data.mcp??{}).map(([e,t])=>({name:e,status:t.status})).sort((e,t)=>e.name.localeCompare(t.name))),n=K(()=>({mutationFn:async e=>{s.data.mcp[e]?.status==="connected"?await d.client.mcp.disconnect({name:e}):await d.client.mcp.connect({name:e});const i=await d.client.mcp.status();i.data&&s.set("mcp",i.data)}})),S=h(()=>p().filter(e=>e.status==="connected").length),k=h(()=>p().length);return u(q,{get title(){return l.t("dialog.mcp.title")},get description(){return l.t("dialog.mcp.description",{enabled:S(),total:k()})},get children(){return u(B,{get search(){return{placeholder:l.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.mcp.empty")},key:e=>e?.name??"",items:p,filterKeys:["name","status"],sortBy:(e,t)=>e.name.localeCompare(t.name),onSelect:e=>{!e||n.isPending||n.mutate(e.name)},children:e=>{const t=()=>s.data.mcp[e.name],i=()=>t()?.status,w=()=>{const r=i()?A[i()]:void 0;if(r)return l.t(r)},x=()=>{const r=t();return r?.status==="failed"?r.error:void 0},C=()=>i()==="connected";return(()=>{var r=z(),g=r.firstChild,f=g.firstChild,L=f.firstChild,y=g.nextSibling;return c(L,()=>e.name),c(f,u(v,{get when(){return w()},get children(){var a=H();return c(a,w),a}}),null),c(f,u(v,{get when(){return b(()=>!!n.isPending)()&&n.variables===e.name},get children(){var a=J();return c(a,()=>l.t("common.loading.ellipsis")),a}}),null),c(g,u(v,{get when(){return x()},get children(){var a=T();return c(a,x),a}}),null),y.$$click=a=>a.stopPropagation(),c(y,u(G,{get checked(){return C()},get disabled(){return b(()=>!!n.isPending)()&&n.variables===e.name},onChange:()=>{n.isPending||n.mutate(e.name)}})),r})()}})}})};O(["click"]);export{U as DialogSelectMcp};
1
+ import{a1 as P,a2 as M,f as D,H as E,O as $,a3 as j,J as F,i as h,L as K,m as u,v as O,l as c,S as v,n as b,G as q,t as m}from"./index-DKwABhnu.js";import{L as B}from"./list-DPJi0fzr.js";import{S as G}from"./switch-CHySmW8J.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";var H=m('<span class="text-11-regular text-text-weaker">'),J=m('<span class="text-11-regular text-text-weak">'),T=m('<span class="text-11-regular text-text-weaker truncate">'),z=m('<div class="w-full flex items-center justify-between gap-x-3"><div class="flex flex-col gap-0.5 min-w-0"><div class="flex items-center gap-2"><span class=truncate></span></div></div><div>');const A={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled"},U=()=>{const s=P(),d=M(),l=D(),[_,o]=E({done:!1,loading:!1});$(j(()=>s.data.mcp_ready,(e,t)=>{!e&&t&&o("done",!1)},{defer:!0})),$(()=>{if(!(_.done||_.loading)){if(s.data.mcp_ready){o("done",!0);return}o("loading",!0),d.client.mcp.status().then(e=>{s.set("mcp",e.data??{}),s.set("mcp_ready",!0),o("done",!0)}).catch(e=>{o("done",!0),F({variant:"error",title:l.t("common.requestFailed"),description:e instanceof Error?e.message:String(e)})}).finally(()=>{o("loading",!1)})}});const p=h(()=>Object.entries(s.data.mcp??{}).map(([e,t])=>({name:e,status:t.status})).sort((e,t)=>e.name.localeCompare(t.name))),n=K(()=>({mutationFn:async e=>{s.data.mcp[e]?.status==="connected"?await d.client.mcp.disconnect({name:e}):await d.client.mcp.connect({name:e});const i=await d.client.mcp.status();i.data&&s.set("mcp",i.data)}})),S=h(()=>p().filter(e=>e.status==="connected").length),k=h(()=>p().length);return u(q,{get title(){return l.t("dialog.mcp.title")},get description(){return l.t("dialog.mcp.description",{enabled:S(),total:k()})},get children(){return u(B,{get search(){return{placeholder:l.t("common.search.placeholder"),autofocus:!0}},get emptyMessage(){return l.t("dialog.mcp.empty")},key:e=>e?.name??"",items:p,filterKeys:["name","status"],sortBy:(e,t)=>e.name.localeCompare(t.name),onSelect:e=>{!e||n.isPending||n.mutate(e.name)},children:e=>{const t=()=>s.data.mcp[e.name],i=()=>t()?.status,w=()=>{const r=i()?A[i()]:void 0;if(r)return l.t(r)},x=()=>{const r=t();return r?.status==="failed"?r.error:void 0},C=()=>i()==="connected";return(()=>{var r=z(),g=r.firstChild,f=g.firstChild,L=f.firstChild,y=g.nextSibling;return c(L,()=>e.name),c(f,u(v,{get when(){return w()},get children(){var a=H();return c(a,w),a}}),null),c(f,u(v,{get when(){return b(()=>!!n.isPending)()&&n.variables===e.name},get children(){var a=J();return c(a,()=>l.t("common.loading.ellipsis")),a}}),null),c(g,u(v,{get when(){return x()},get children(){var a=T();return c(a,x),a}}),null),y.$$click=a=>a.stopPropagation(),c(y,u(G,{get checked(){return C()},get disabled(){return b(()=>!!n.isPending)()&&n.variables===e.name},onChange:()=>{n.isPending||n.mutate(e.name)}})),r})()}})}})};O(["click"]);export{U as DialogSelectMcp};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-connect-provider-BEqcXIot.js","assets/index-bSvs-Qh3.js","assets/index-DpJDxStT.css","assets/list-BPk4NMWt.js","assets/chunk-VVM5DH6Z-COaOSPgd.js","assets/tag--BCZ5q7_.js","assets/dialog-select-provider-2iOfyWxy.js"])))=>i.map(i=>d[i]);
2
- import{a6 as k,c as S,a7 as E,f as I,m as t,l as r,S as c,Y as L,n as T,a8 as g,B as M,G as O,t as u,_ as w,v as A}from"./index-bSvs-Qh3.js";import{L as $}from"./list-BPk4NMWt.js";import{T as m,P as B}from"./tag--BCZ5q7_.js";import{M as R}from"./session-CdcUAq9-.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";import"./tabs-dF68ik4J.js";import"./select-CEKfrTm2.js";import"./trellis-6YKi26t8.js";import"./trellis-op-icon-5x1lMwNH.js";import"./purify.es-A66Cw1IH.js";import"./file-icon-CgbvTpIc.js";var G=u('<div class="flex flex-col gap-3 px-2.5"><div class="text-14-medium text-text-base px-2.5">'),K=u('<div class="px-1.5 pb-1.5"><div class="w-full rounded-sm border border-border-weak-base bg-surface-raised-base"><div class="w-full flex flex-col items-start gap-4 px-1.5 pt-4 pb-4"><div class="px-2 text-14-medium text-text-base"></div><div class=w-full>'),V=u('<div class="w-full flex items-center gap-x-2.5"><span>'),h=u('<div class="text-14-regular text-text-weak">'),j=u('<div class="w-full flex items-center gap-x-3"><span>');const Z=b=>{const v=b.model??k().model,f=S(),y=E(),i=I(),D=l=>{w(()=>import("./dialog-connect-provider-BEqcXIot.js").then(s=>s.d),__vite__mapDeps([0,1,2,3,4,5])).then(s=>{f.show(()=>t(s.DialogConnectProvider,{provider:l}))})},C=()=>{w(()=>import("./dialog-select-provider-2iOfyWxy.js").then(l=>l.d),__vite__mapDeps([6,1,2,3,4,5,0])).then(l=>{f.show(()=>t(l.DialogSelectProvider,{}))})};let _;const P=l=>{l.key!=="Escape"&&_?.onKeyDown(l)};return t(O,{get title(){return i.t("dialog.model.select.title")},class:"overflow-y-auto [&_[data-slot=dialog-body]]:overflow-visible [&_[data-slot=dialog-body]]:flex-none",get children(){return[(()=>{var l=G(),s=l.firstChild;return l.$$keydown=P,r(s,()=>i.t("dialog.model.unpaid.freeModels.title")),r(l,t($,{class:"[&_[data-slot=list-scroll]]:overflow-visible",ref:e=>_=e,get items(){return v.list},get current(){return v.current()},key:e=>`${e.provider.id}:${e.id}`,itemWrapper:(e,d)=>t(L,{class:"w-full",placement:"right-start",gutter:12,get value(){return t(R,{model:e,get latest(){return e.latest},get free(){return T(()=>e.provider.id==="opencode")()&&(!e.cost||e.cost.input===0)}})},children:d}),onSelect:e=>{v.set(e?{modelID:e.id,providerID:e.provider.id}:void 0,{recent:!0}),f.close()},children:e=>(()=>{var d=V(),p=d.firstChild;return r(p,()=>e.name),r(d,t(m,{get children(){return i.t("model.tag.free")}}),null),r(d,t(c,{get when(){return e.latest},get children(){return t(m,{get children(){return i.t("model.tag.latest")}})}}),null),d})()}),null),l})(),(()=>{var l=K(),s=l.firstChild,e=s.firstChild,d=e.firstChild,p=d.nextSibling;return r(d,()=>i.t("dialog.model.unpaid.addMore.title")),r(p,t($,{class:"w-full px-0",key:o=>o?.id,get items(){return y.popular},activeIcon:"plus-small",sortBy:(o,n)=>g.includes(o.id)&&g.includes(n.id)?g.indexOf(o.id)-g.indexOf(n.id):o.name.localeCompare(n.name),onSelect:o=>{o&&D(o.id)},children:o=>(()=>{var n=j(),x=n.firstChild;return r(n,t(B,{"data-slot":"list-item-extra-icon",get id(){return o.id}}),x),r(x,()=>o.name),r(n,t(c,{get when(){return o.id==="opencode"},get children(){var a=h();return r(a,()=>i.t("dialog.provider.opencode.tagline")),a}}),null),r(n,t(c,{get when(){return o.id==="opencode"},get children(){return t(m,{get children(){return i.t("dialog.provider.tag.recommended")}})}}),null),r(n,t(c,{get when(){return o.id==="opencode-go"},get children(){return[(()=>{var a=h();return r(a,()=>i.t("dialog.provider.opencodeGo.tagline")),a})(),t(m,{get children(){return i.t("dialog.provider.tag.recommended")}})]}}),null),r(n,t(c,{get when(){return o.id==="anthropic"},get children(){var a=h();return r(a,()=>i.t("dialog.provider.anthropic.note")),a}}),null),n})()}),null),r(p,t(M,{variant:"ghost",class:"w-full justify-start px-[11px] py-3.5 gap-4.5 text-14-medium",icon:"dot-grid",onClick:C,get children(){return i.t("dialog.provider.viewAll")}}),null),l})()]}})};A(["keydown"]);export{Z as DialogSelectModelUnpaid};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialog-connect-provider-Ot6Qr5dL.js","assets/index-DKwABhnu.js","assets/index-DTxAHLat.css","assets/list-DPJi0fzr.js","assets/chunk-VVM5DH6Z-D2vG_ZPx.js","assets/tag-C4xikCZp.js","assets/dialog-select-provider-CBq6hNDx.js"])))=>i.map(i=>d[i]);
2
+ import{a6 as k,c as S,a7 as E,f as I,m as t,l as r,S as c,Y as L,n as T,a8 as g,B as M,G as O,t as u,_ as w,v as A}from"./index-DKwABhnu.js";import{L as $}from"./list-DPJi0fzr.js";import{T as m,P as B}from"./tag-C4xikCZp.js";import{M as R}from"./session-BXKBDkSI.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";import"./tabs-CKNlwTKd.js";import"./select-BbwOgh1Q.js";import"./trellis-Csm7WAqm.js";import"./transform-BwXaE9hv.js";import"./trellis-op-icon-CzIuo5X7.js";import"./file-icon-DVEMs7Sx.js";var G=u('<div class="flex flex-col gap-3 px-2.5"><div class="text-14-medium text-text-base px-2.5">'),K=u('<div class="px-1.5 pb-1.5"><div class="w-full rounded-sm border border-border-weak-base bg-surface-raised-base"><div class="w-full flex flex-col items-start gap-4 px-1.5 pt-4 pb-4"><div class="px-2 text-14-medium text-text-base"></div><div class=w-full>'),V=u('<div class="w-full flex items-center gap-x-2.5"><span>'),h=u('<div class="text-14-regular text-text-weak">'),j=u('<div class="w-full flex items-center gap-x-3"><span>');const Z=b=>{const v=b.model??k().model,f=S(),y=E(),i=I(),D=l=>{w(()=>import("./dialog-connect-provider-Ot6Qr5dL.js").then(s=>s.d),__vite__mapDeps([0,1,2,3,4,5])).then(s=>{f.show(()=>t(s.DialogConnectProvider,{provider:l}))})},C=()=>{w(()=>import("./dialog-select-provider-CBq6hNDx.js").then(l=>l.d),__vite__mapDeps([6,1,2,3,4,5,0])).then(l=>{f.show(()=>t(l.DialogSelectProvider,{}))})};let _;const P=l=>{l.key!=="Escape"&&_?.onKeyDown(l)};return t(O,{get title(){return i.t("dialog.model.select.title")},class:"overflow-y-auto [&_[data-slot=dialog-body]]:overflow-visible [&_[data-slot=dialog-body]]:flex-none",get children(){return[(()=>{var l=G(),s=l.firstChild;return l.$$keydown=P,r(s,()=>i.t("dialog.model.unpaid.freeModels.title")),r(l,t($,{class:"[&_[data-slot=list-scroll]]:overflow-visible",ref:e=>_=e,get items(){return v.list},get current(){return v.current()},key:e=>`${e.provider.id}:${e.id}`,itemWrapper:(e,d)=>t(L,{class:"w-full",placement:"right-start",gutter:12,get value(){return t(R,{model:e,get latest(){return e.latest},get free(){return T(()=>e.provider.id==="opencode")()&&(!e.cost||e.cost.input===0)}})},children:d}),onSelect:e=>{v.set(e?{modelID:e.id,providerID:e.provider.id}:void 0,{recent:!0}),f.close()},children:e=>(()=>{var d=V(),p=d.firstChild;return r(p,()=>e.name),r(d,t(m,{get children(){return i.t("model.tag.free")}}),null),r(d,t(c,{get when(){return e.latest},get children(){return t(m,{get children(){return i.t("model.tag.latest")}})}}),null),d})()}),null),l})(),(()=>{var l=K(),s=l.firstChild,e=s.firstChild,d=e.firstChild,p=d.nextSibling;return r(d,()=>i.t("dialog.model.unpaid.addMore.title")),r(p,t($,{class:"w-full px-0",key:o=>o?.id,get items(){return y.popular},activeIcon:"plus-small",sortBy:(o,n)=>g.includes(o.id)&&g.includes(n.id)?g.indexOf(o.id)-g.indexOf(n.id):o.name.localeCompare(n.name),onSelect:o=>{o&&D(o.id)},children:o=>(()=>{var n=j(),x=n.firstChild;return r(n,t(B,{"data-slot":"list-item-extra-icon",get id(){return o.id}}),x),r(x,()=>o.name),r(n,t(c,{get when(){return o.id==="opencode"},get children(){var a=h();return r(a,()=>i.t("dialog.provider.opencode.tagline")),a}}),null),r(n,t(c,{get when(){return o.id==="opencode"},get children(){return t(m,{get children(){return i.t("dialog.provider.tag.recommended")}})}}),null),r(n,t(c,{get when(){return o.id==="opencode-go"},get children(){return[(()=>{var a=h();return r(a,()=>i.t("dialog.provider.opencodeGo.tagline")),a})(),t(m,{get children(){return i.t("dialog.provider.tag.recommended")}})]}}),null),r(n,t(c,{get when(){return o.id==="anthropic"},get children(){var a=h();return r(a,()=>i.t("dialog.provider.anthropic.note")),a}}),null),n})()}),null),r(p,t(M,{variant:"ghost",class:"w-full justify-start px-[11px] py-3.5 gap-4.5 text-14-medium",icon:"dot-grid",onClick:C,get children(){return i.t("dialog.provider.viewAll")}}),null),l})()]}})};A(["keydown"]);export{Z as DialogSelectModelUnpaid};
@@ -1 +1 @@
1
- import{c as Z,u as le,z as ne,f as ee,H as se,L as de,J as A,m as o,l as a,p as k,F as V,Q as F,q as J,y as N,B as T,n as ce,G as re,t as B,aG as j,aE as q,a7 as ue,S as U,a8 as K}from"./index-bSvs-Qh3.js";import{L as ve}from"./list-BPk4NMWt.js";import{P as te,T as H}from"./tag--BCZ5q7_.js";import{L as me,D as pe}from"./dialog-connect-provider-BEqcXIot.js";const ge=/^[a-z0-9][a-z0-9-_]*$/,he="@ai-sdk/openai-compatible";function fe(n){const h=n.form.providerID.trim(),s=n.form.name.trim(),y=n.form.baseURL.trim(),r=n.form.apiKey.trim(),d=r.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),v=r&&!d?r:void 0,t=h?ge.test(h)?void 0:n.t("provider.custom.error.providerID.format"):n.t("provider.custom.error.providerID.required"),u=s?void 0:n.t("provider.custom.error.name.required"),g=y?/^https?:\/\//.test(y)?void 0:n.t("provider.custom.error.baseURL.format"):n.t("provider.custom.error.baseURL.required"),x=n.disabledProviders.includes(h),_=t?void 0:n.existingProviderIDs.has(h)&&!x?n.t("provider.custom.error.providerID.exists"):void 0,w=new Set,I=n.form.models.map(l=>{const p=l.id.trim(),f=p?w.has(p)?n.t("provider.custom.error.duplicate"):(()=>{w.add(p)})():n.t("provider.custom.error.required"),P=l.name.trim()?void 0:n.t("provider.custom.error.required");return{id:f,name:P}}),M=I.every(l=>!l.id&&!l.name),z=Object.fromEntries(n.form.models.map(l=>[l.id.trim(),{name:l.name.trim()}])),D=new Set,L=n.form.headers.map(l=>{const p=l.key.trim(),f=l.value.trim();if(!p&&!f)return{};const P=p?D.has(p.toLowerCase())?n.t("provider.custom.error.duplicate"):(()=>{D.add(p.toLowerCase())})():n.t("provider.custom.error.required"),E=f?void 0:n.t("provider.custom.error.required");return{key:P,value:E}}),e=L.every(l=>!l.key&&!l.value),i=Object.fromEntries(n.form.headers.map(l=>({key:l.key.trim(),value:l.value.trim()})).filter(l=>!!l.key&&!!l.value).map(l=>[l.key,l.value])),m={providerID:t??_,name:u,baseURL:g};return!t&&!_&&!u&&!g&&M&&e?{err:m,models:I,headers:L,result:{providerID:h,name:s,key:v,config:{npm:he,name:s,...d?{env:[d]}:{},options:{baseURL:y,...Object.keys(i).length?{headers:i}:{}},models:z}}}:{err:m,models:I,headers:L}}let be=0;const oe=()=>`row-${be++}`,Q=()=>({row:oe(),id:"",name:"",err:{}}),W=()=>({row:oe(),key:"",value:"",err:{}});var ye=B('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak"></label></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),X=B('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function xe(n){const h=Z(),s=le(),y=ne(),r=ee(),[d,v]=se({providerID:"",name:"",baseURL:"",apiKey:"",models:[Q()],headers:[W()],err:{}}),t=()=>{if(n.back==="close"){h.close();return}h.show(()=>o(ae,{}))},u=()=>{v("models",q(e=>{e.push(Q())}))},g=e=>{d.models.length<=1||v("models",q(i=>{i.splice(e,1)}))},x=()=>{v("headers",q(e=>{e.push(W())}))},_=e=>{d.headers.length<=1||v("headers",q(i=>{i.splice(e,1)}))},w=(e,i)=>{v(e,i),e!=="apiKey"&&v("err",e,void 0)},I=(e,i,m)=>{j(()=>{v("models",e,i,m),v("models",e,"err",i,void 0)})},M=(e,i,m)=>{j(()=>{v("headers",e,i,m),v("headers",e,"err",i,void 0)})},z=()=>{const e=fe({form:d,t:r.t,disabledProviders:s.data.config.disabled_providers??[],existingProviderIDs:new Set(s.data.provider.all.map(i=>i.id))});return j(()=>{v("err",e.err),e.models.forEach((i,m)=>v("models",m,"err",i)),e.headers.forEach((i,m)=>v("headers",m,"err",i))}),e.result},D=de(()=>({mutationFn:async e=>{const m=(s.data.config.disabled_providers??[]).filter($=>$!==e.providerID);return e.key&&await y.client.auth.set({providerID:e.providerID,auth:{type:"api",key:e.key}}),await s.updateConfig({provider:{[e.providerID]:e.config},disabled_providers:m}),e},onSuccess:e=>{h.close(),A({variant:"success",icon:"circle-check",title:r.t("provider.connect.toast.connected.title",{provider:e.name}),description:r.t("provider.connect.toast.connected.description",{provider:e.name})})},onError:e=>{const i=e instanceof Error?e.message:String(e);A({title:r.t("common.requestFailed"),description:i})}})),L=e=>{if(e.preventDefault(),D.isPending)return;const i=z();i&&D.mutate(i)};return o(re,{get title(){return o(F,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:t,get"aria-label"(){return r.t("common.goBack")}})},transition:!0,get children(){var e=ye(),i=e.firstChild,m=i.firstChild,$=i.nextSibling,l=$.firstChild,p=l.nextSibling,f=p.nextSibling,P=f.firstChild,E=f.nextSibling,ie=E.firstChild;return a(i,o(te,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),m),a(m,()=>r.t("provider.custom.title")),$.addEventListener("submit",L),a(l,()=>r.t("provider.custom.description.prefix"),null),a(l,o(me,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return r.t("provider.custom.description.link")}}),null),a(l,()=>r.t("provider.custom.description.suffix"),null),a(p,o(k,{autofocus:!0,get label(){return r.t("provider.custom.field.providerID.label")},get placeholder(){return r.t("provider.custom.field.providerID.placeholder")},get description(){return r.t("provider.custom.field.providerID.description")},get value(){return d.providerID},onChange:c=>w("providerID",c),get validationState(){return d.err.providerID?"invalid":void 0},get error(){return d.err.providerID}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.name.label")},get placeholder(){return r.t("provider.custom.field.name.placeholder")},get value(){return d.name},onChange:c=>w("name",c),get validationState(){return d.err.name?"invalid":void 0},get error(){return d.err.name}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.baseURL.label")},get placeholder(){return r.t("provider.custom.field.baseURL.placeholder")},get value(){return d.baseURL},onChange:c=>w("baseURL",c),get validationState(){return d.err.baseURL?"invalid":void 0},get error(){return d.err.baseURL}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.apiKey.label")},get placeholder(){return r.t("provider.custom.field.apiKey.placeholder")},get description(){return r.t("provider.custom.field.apiKey.description")},get value(){return d.apiKey},onChange:c=>w("apiKey",c)}),null),a(P,()=>r.t("provider.custom.models.label")),a(f,o(V,{get each(){return d.models},children:(c,C)=>(()=>{var b=X(),R=b.firstChild,G=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.id.placeholder")},get value(){return c.id},onChange:S=>I(C(),"id",S),get validationState(){return c.err.id?"invalid":void 0},get error(){return c.err.id}})),a(G,o(k,{get label(){return r.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.name.placeholder")},get value(){return c.name},onChange:S=>I(C(),"name",S),get validationState(){return c.err.name?"invalid":void 0},get error(){return c.err.name}})),a(b,o(F,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>g(C()),get disabled(){return d.models.length<=1},get"aria-label"(){return r.t("provider.custom.models.remove")}}),null),J(()=>N(b,"data-row",c.row)),b})()}),null),a(f,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:u,class:"self-start",get children(){return r.t("provider.custom.models.add")}}),null),a(ie,()=>r.t("provider.custom.headers.label")),a(E,o(V,{get each(){return d.headers},children:(c,C)=>(()=>{var b=X(),R=b.firstChild,G=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.key.placeholder")},get value(){return c.key},onChange:S=>M(C(),"key",S),get validationState(){return c.err.key?"invalid":void 0},get error(){return c.err.key}})),a(G,o(k,{get label(){return r.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.value.placeholder")},get value(){return c.value},onChange:S=>M(C(),"value",S),get validationState(){return c.err.value?"invalid":void 0},get error(){return c.err.value}})),a(b,o(F,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>_(C()),get disabled(){return d.headers.length<=1},get"aria-label"(){return r.t("provider.custom.headers.remove")}}),null),J(()=>N(b,"data-row",c.row)),b})()}),null),a(E,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:x,class:"self-start",get children(){return r.t("provider.custom.headers.add")}}),null),a($,o(T,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return D.isPending},get children(){return ce(()=>!!D.isPending)()?r.t("common.saving"):r.t("common.submit")}}),null),e}})}var Y=B('<div class="text-14-regular text-text-weak">'),ke=B('<div class="px-1.25 w-full flex items-center gap-x-3"><span>');const O="_custom",ae=()=>{const n=Z(),h=ue(),s=ee(),y=()=>s.t("dialog.provider.group.popular"),r=()=>s.t("dialog.provider.group.other"),d=()=>s.t("settings.providers.tag.custom"),v=t=>{if(t==="anthropic")return s.t("dialog.provider.anthropic.note");if(t==="openai")return s.t("dialog.provider.openai.note");if(t.startsWith("github-copilot"))return s.t("dialog.provider.copilot.note");if(t==="opencode-go")return s.t("dialog.provider.opencodeGo.tagline")};return o(re,{get title(){return s.t("command.provider.connect")},transition:!0,get children(){return o(ve,{get search(){return{placeholder:s.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return s.t("dialog.provider.empty")},activeIcon:"plus-small",key:t=>t?.id,items:()=>(s.locale(),[{id:O,name:d()},...h.all()]),filterKeys:["id","name"],groupBy:t=>K.includes(t.id)?y():r(),sortBy:(t,u)=>t.id===O?-1:u.id===O?1:K.includes(t.id)&&K.includes(u.id)?K.indexOf(t.id)-K.indexOf(u.id):t.name.localeCompare(u.name),sortGroupsBy:(t,u)=>{const g=y();return t.category===g&&u.category!==g?-1:u.category===g&&t.category!==g?1:0},onSelect:t=>{if(t){if(t.id===O){n.show(()=>o(xe,{back:"providers"}));return}n.show(()=>o(pe,{get provider(){return t.id}}))}},children:t=>(()=>{var u=ke(),g=u.firstChild;return a(u,o(te,{"data-slot":"list-item-extra-icon",get id(){return t.id}}),g),a(g,()=>t.name),a(u,o(U,{get when(){return t.id==="opencode"},get children(){var x=Y();return a(x,()=>s.t("dialog.provider.opencode.tagline")),x}}),null),a(u,o(U,{get when(){return t.id===O},get children(){return o(H,{get children(){return s.t("settings.providers.tag.custom")}})}}),null),a(u,o(U,{get when(){return t.id==="opencode"},get children(){return o(H,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),a(u,o(U,{get when(){return v(t.id)},children:x=>(()=>{var _=Y();return a(_,x),_})()}),null),a(u,o(U,{get when(){return t.id==="opencode-go"},get children(){return o(H,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),u})()})}})},Se=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectProvider:ae},Symbol.toStringTag,{value:"Module"}));export{ae as D,xe as a,Se as d};
1
+ import{c as Z,u as le,z as ne,f as ee,H as se,L as de,J as A,m as o,l as a,p as k,F as V,Q as G,q as J,y as N,B as T,n as ce,G as re,t as B,aH as H,aF as q,a7 as ue,S as U,a8 as K}from"./index-DKwABhnu.js";import{L as ve}from"./list-DPJi0fzr.js";import{P as te,T as j}from"./tag-C4xikCZp.js";import{L as me,D as pe}from"./dialog-connect-provider-Ot6Qr5dL.js";const ge=/^[a-z0-9][a-z0-9-_]*$/,he="@ai-sdk/openai-compatible";function fe(n){const h=n.form.providerID.trim(),s=n.form.name.trim(),y=n.form.baseURL.trim(),r=n.form.apiKey.trim(),d=r.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),v=r&&!d?r:void 0,t=h?ge.test(h)?void 0:n.t("provider.custom.error.providerID.format"):n.t("provider.custom.error.providerID.required"),u=s?void 0:n.t("provider.custom.error.name.required"),g=y?/^https?:\/\//.test(y)?void 0:n.t("provider.custom.error.baseURL.format"):n.t("provider.custom.error.baseURL.required"),x=n.disabledProviders.includes(h),_=t?void 0:n.existingProviderIDs.has(h)&&!x?n.t("provider.custom.error.providerID.exists"):void 0,w=new Set,I=n.form.models.map(l=>{const p=l.id.trim(),f=p?w.has(p)?n.t("provider.custom.error.duplicate"):(()=>{w.add(p)})():n.t("provider.custom.error.required"),P=l.name.trim()?void 0:n.t("provider.custom.error.required");return{id:f,name:P}}),M=I.every(l=>!l.id&&!l.name),z=Object.fromEntries(n.form.models.map(l=>[l.id.trim(),{name:l.name.trim()}])),D=new Set,L=n.form.headers.map(l=>{const p=l.key.trim(),f=l.value.trim();if(!p&&!f)return{};const P=p?D.has(p.toLowerCase())?n.t("provider.custom.error.duplicate"):(()=>{D.add(p.toLowerCase())})():n.t("provider.custom.error.required"),E=f?void 0:n.t("provider.custom.error.required");return{key:P,value:E}}),e=L.every(l=>!l.key&&!l.value),i=Object.fromEntries(n.form.headers.map(l=>({key:l.key.trim(),value:l.value.trim()})).filter(l=>!!l.key&&!!l.value).map(l=>[l.key,l.value])),m={providerID:t??_,name:u,baseURL:g};return!t&&!_&&!u&&!g&&M&&e?{err:m,models:I,headers:L,result:{providerID:h,name:s,key:v,config:{npm:he,name:s,...d?{env:[d]}:{},options:{baseURL:y,...Object.keys(i).length?{headers:i}:{}},models:z}}}:{err:m,models:I,headers:L}}let be=0;const oe=()=>`row-${be++}`,Q=()=>({row:oe(),id:"",name:"",err:{}}),W=()=>({row:oe(),key:"",value:"",err:{}});var ye=B('<div class="flex flex-col gap-6 px-2.5 pb-3 overflow-y-auto max-h-[60vh]"><div class="px-2.5 flex gap-4 items-center"><div class="text-16-medium text-text-strong"></div></div><form class="px-2.5 pb-6 flex flex-col gap-6"><p class="text-14-regular text-text-base"></p><div class="flex flex-col gap-4"></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak"></label></div><div class="flex flex-col gap-3"><label class="text-12-medium text-text-weak">'),X=B('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function xe(n){const h=Z(),s=le(),y=ne(),r=ee(),[d,v]=se({providerID:"",name:"",baseURL:"",apiKey:"",models:[Q()],headers:[W()],err:{}}),t=()=>{if(n.back==="close"){h.close();return}h.show(()=>o(ae,{}))},u=()=>{v("models",q(e=>{e.push(Q())}))},g=e=>{d.models.length<=1||v("models",q(i=>{i.splice(e,1)}))},x=()=>{v("headers",q(e=>{e.push(W())}))},_=e=>{d.headers.length<=1||v("headers",q(i=>{i.splice(e,1)}))},w=(e,i)=>{v(e,i),e!=="apiKey"&&v("err",e,void 0)},I=(e,i,m)=>{H(()=>{v("models",e,i,m),v("models",e,"err",i,void 0)})},M=(e,i,m)=>{H(()=>{v("headers",e,i,m),v("headers",e,"err",i,void 0)})},z=()=>{const e=fe({form:d,t:r.t,disabledProviders:s.data.config.disabled_providers??[],existingProviderIDs:new Set(s.data.provider.all.map(i=>i.id))});return H(()=>{v("err",e.err),e.models.forEach((i,m)=>v("models",m,"err",i)),e.headers.forEach((i,m)=>v("headers",m,"err",i))}),e.result},D=de(()=>({mutationFn:async e=>{const m=(s.data.config.disabled_providers??[]).filter($=>$!==e.providerID);return e.key&&await y.client.auth.set({providerID:e.providerID,auth:{type:"api",key:e.key}}),await s.updateConfig({provider:{[e.providerID]:e.config},disabled_providers:m}),e},onSuccess:e=>{h.close(),A({variant:"success",icon:"circle-check",title:r.t("provider.connect.toast.connected.title",{provider:e.name}),description:r.t("provider.connect.toast.connected.description",{provider:e.name})})},onError:e=>{const i=e instanceof Error?e.message:String(e);A({title:r.t("common.requestFailed"),description:i})}})),L=e=>{if(e.preventDefault(),D.isPending)return;const i=z();i&&D.mutate(i)};return o(re,{get title(){return o(G,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:t,get"aria-label"(){return r.t("common.goBack")}})},transition:!0,get children(){var e=ye(),i=e.firstChild,m=i.firstChild,$=i.nextSibling,l=$.firstChild,p=l.nextSibling,f=p.nextSibling,P=f.firstChild,E=f.nextSibling,ie=E.firstChild;return a(i,o(te,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),m),a(m,()=>r.t("provider.custom.title")),$.addEventListener("submit",L),a(l,()=>r.t("provider.custom.description.prefix"),null),a(l,o(me,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return r.t("provider.custom.description.link")}}),null),a(l,()=>r.t("provider.custom.description.suffix"),null),a(p,o(k,{autofocus:!0,get label(){return r.t("provider.custom.field.providerID.label")},get placeholder(){return r.t("provider.custom.field.providerID.placeholder")},get description(){return r.t("provider.custom.field.providerID.description")},get value(){return d.providerID},onChange:c=>w("providerID",c),get validationState(){return d.err.providerID?"invalid":void 0},get error(){return d.err.providerID}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.name.label")},get placeholder(){return r.t("provider.custom.field.name.placeholder")},get value(){return d.name},onChange:c=>w("name",c),get validationState(){return d.err.name?"invalid":void 0},get error(){return d.err.name}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.baseURL.label")},get placeholder(){return r.t("provider.custom.field.baseURL.placeholder")},get value(){return d.baseURL},onChange:c=>w("baseURL",c),get validationState(){return d.err.baseURL?"invalid":void 0},get error(){return d.err.baseURL}}),null),a(p,o(k,{get label(){return r.t("provider.custom.field.apiKey.label")},get placeholder(){return r.t("provider.custom.field.apiKey.placeholder")},get description(){return r.t("provider.custom.field.apiKey.description")},get value(){return d.apiKey},onChange:c=>w("apiKey",c)}),null),a(P,()=>r.t("provider.custom.models.label")),a(f,o(V,{get each(){return d.models},children:(c,C)=>(()=>{var b=X(),R=b.firstChild,F=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.id.placeholder")},get value(){return c.id},onChange:S=>I(C(),"id",S),get validationState(){return c.err.id?"invalid":void 0},get error(){return c.err.id}})),a(F,o(k,{get label(){return r.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.models.name.placeholder")},get value(){return c.name},onChange:S=>I(C(),"name",S),get validationState(){return c.err.name?"invalid":void 0},get error(){return c.err.name}})),a(b,o(G,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>g(C()),get disabled(){return d.models.length<=1},get"aria-label"(){return r.t("provider.custom.models.remove")}}),null),J(()=>N(b,"data-row",c.row)),b})()}),null),a(f,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:u,class:"self-start",get children(){return r.t("provider.custom.models.add")}}),null),a(ie,()=>r.t("provider.custom.headers.label")),a(E,o(V,{get each(){return d.headers},children:(c,C)=>(()=>{var b=X(),R=b.firstChild,F=R.nextSibling;return a(R,o(k,{get label(){return r.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.key.placeholder")},get value(){return c.key},onChange:S=>M(C(),"key",S),get validationState(){return c.err.key?"invalid":void 0},get error(){return c.err.key}})),a(F,o(k,{get label(){return r.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return r.t("provider.custom.headers.value.placeholder")},get value(){return c.value},onChange:S=>M(C(),"value",S),get validationState(){return c.err.value?"invalid":void 0},get error(){return c.err.value}})),a(b,o(G,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>_(C()),get disabled(){return d.headers.length<=1},get"aria-label"(){return r.t("provider.custom.headers.remove")}}),null),J(()=>N(b,"data-row",c.row)),b})()}),null),a(E,o(T,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:x,class:"self-start",get children(){return r.t("provider.custom.headers.add")}}),null),a($,o(T,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return D.isPending},get children(){return ce(()=>!!D.isPending)()?r.t("common.saving"):r.t("common.submit")}}),null),e}})}var Y=B('<div class="text-14-regular text-text-weak">'),ke=B('<div class="px-1.25 w-full flex items-center gap-x-3"><span>');const O="_custom",ae=()=>{const n=Z(),h=ue(),s=ee(),y=()=>s.t("dialog.provider.group.popular"),r=()=>s.t("dialog.provider.group.other"),d=()=>s.t("settings.providers.tag.custom"),v=t=>{if(t==="anthropic")return s.t("dialog.provider.anthropic.note");if(t==="openai")return s.t("dialog.provider.openai.note");if(t.startsWith("github-copilot"))return s.t("dialog.provider.copilot.note");if(t==="opencode-go")return s.t("dialog.provider.opencodeGo.tagline")};return o(re,{get title(){return s.t("command.provider.connect")},transition:!0,get children(){return o(ve,{get search(){return{placeholder:s.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return s.t("dialog.provider.empty")},activeIcon:"plus-small",key:t=>t?.id,items:()=>(s.locale(),[{id:O,name:d()},...h.all()]),filterKeys:["id","name"],groupBy:t=>K.includes(t.id)?y():r(),sortBy:(t,u)=>t.id===O?-1:u.id===O?1:K.includes(t.id)&&K.includes(u.id)?K.indexOf(t.id)-K.indexOf(u.id):t.name.localeCompare(u.name),sortGroupsBy:(t,u)=>{const g=y();return t.category===g&&u.category!==g?-1:u.category===g&&t.category!==g?1:0},onSelect:t=>{if(t){if(t.id===O){n.show(()=>o(xe,{back:"providers"}));return}n.show(()=>o(pe,{get provider(){return t.id}}))}},children:t=>(()=>{var u=ke(),g=u.firstChild;return a(u,o(te,{"data-slot":"list-item-extra-icon",get id(){return t.id}}),g),a(g,()=>t.name),a(u,o(U,{get when(){return t.id==="opencode"},get children(){var x=Y();return a(x,()=>s.t("dialog.provider.opencode.tagline")),x}}),null),a(u,o(U,{get when(){return t.id===O},get children(){return o(j,{get children(){return s.t("settings.providers.tag.custom")}})}}),null),a(u,o(U,{get when(){return t.id==="opencode"},get children(){return o(j,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),a(u,o(U,{get when(){return v(t.id)},children:x=>(()=>{var _=Y();return a(_,x),_})()}),null),a(u,o(U,{get when(){return t.id==="opencode-go"},get children(){return o(j,{get children(){return s.t("dialog.provider.tag.recommended")}})}}),null),u})()})}})},Se=Object.freeze(Object.defineProperty({__proto__:null,DialogSelectProvider:ae},Symbol.toStringTag,{value:"Module"}));export{ae as D,xe as a,Se as d};
@@ -1 +1 @@
1
- import{d as me,c as he,e as fe,b as Y,f as R,K as Z,H as pe,L as O,M as L,N as h,i as C,O as Q,P as Se,l as S,m as a,Q as V,n as w,S as $,I as we,R as p,B as W,G as ye,A as be,U as ke,t as F,p as N,J as Ce}from"./index-bSvs-Qh3.js";import{L as xe}from"./list-BPk4NMWt.js";import{S as Pe,a as _e}from"./server-row-BhbnbNJy.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";var De=F('<div class=px-5><div class="bg-surface-base rounded-md p-5 flex flex-col gap-3"><div class="flex-1 min-w-0 [&amp;_[data-slot=input-wrapper]]:relative"></div><div class="grid grid-cols-2 gap-2 min-w-0">'),$e=F('<div class="flex items-center gap-2 -ml-2"><span>'),Ie=F('<div class="flex flex-col gap-2"><div class="px-5 pb-5">'),Ae=F('<div class="flex items-center gap-3 min-w-0 flex-1 w-full group/item"><div class="flex flex-col h-full items-start w-5"></div><div class="flex items-center justify-center gap-4 pl-4">'),Ee=F('<span class="text-text-base bg-surface-base text-14-regular px-1.5 rounded-xs">');const K="opencode";function X(i,l){Ce({variant:"error",title:i.t("common.requestFailed"),description:l instanceof Error?l.message:String(l)})}function Fe(){const i=R(),l=Y(),[o,u]=be(async()=>{try{const g=await l.getDefaultServer?.();return g||null}catch(g){return X(i,g),null}},{initialValue:null}),s=C(()=>!!l.getDefaultServer&&!!l.setDefaultServer);return{defaultKey:o,canDefault:s,setDefault:async g=>{try{await l.setDefaultServer?.(g),u.mutate(g)}catch(x){X(i,x)}}}}function Me(){const i=Z(),l=u=>{const s=L(u);if(!s)return!1;const m=s.replace(/^https?:\/\//,"").split("/")[0];return m?m.includes("localhost")||m.startsWith("127.0.0.1")?!0:m.includes(".")||m.includes(":"):!1};return{previewStatus:async(u,s,m,g)=>{if(g(void 0),!l(u))return;const x=L(u);if(!x)return;const y={url:x};s&&(y.username=s),m&&(y.password=m);const E=await i(y);g(E.healthy)}}}function Ne(i){const l=R(),o=u=>{if(u.stopPropagation(),u.key==="Escape"){u.preventDefault(),i.onBack();return}u.key!=="Enter"||u.isComposing||(u.preventDefault(),i.onSubmit())};return(()=>{var u=De(),s=u.firstChild,m=s.firstChild,g=m.nextSibling;return S(m,a(N,{type:"text",get label(){return l.t("dialog.server.add.url")},get placeholder(){return i.placeholder},get value(){return i.value},autofocus:!0,get validationState(){return i.error?"invalid":"valid"},get error(){return i.error},get disabled(){return i.busy},get onChange(){return i.onChange},onKeyDown:o})),S(s,a(N,{type:"text",get label(){return l.t("dialog.server.add.name")},get placeholder(){return l.t("dialog.server.add.namePlaceholder")},get value(){return i.name},get disabled(){return i.busy},get onChange(){return i.onNameChange},onKeyDown:o}),g),S(g,a(N,{type:"text",get label(){return l.t("dialog.server.add.username")},get placeholder(){return l.t("dialog.server.add.usernamePlaceholder")},get value(){return i.username},get disabled(){return i.busy},get onChange(){return i.onUsernameChange},onKeyDown:o}),null),S(g,a(N,{type:"password",get label(){return l.t("dialog.server.add.password")},get placeholder(){return l.t("dialog.server.add.passwordPlaceholder")},get value(){return i.password},get disabled(){return i.busy},get onChange(){return i.onPasswordChange},onKeyDown:o}),null),u})()}function Ke(){const i=me(),l=he(),o=fe(),u=Y(),s=R(),{defaultKey:m,canDefault:g,setDefault:x}=Fe(),{previewStatus:y}=Me(),E=Z(),[r,d]=pe({status:{},addServer:{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0},editServer:{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0}}),M=()=>{d("addServer",{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0})},I=()=>{d("editServer",{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0})},P=O(()=>({mutationFn:async e=>{const t=L(e);if(!t){M();return}const n={type:"http",http:{url:t}};if(r.addServer.name.trim()&&(n.displayName=r.addServer.name.trim()),r.addServer.password&&(n.http.password=r.addServer.password),r.addServer.password&&r.addServer.username&&(n.http.username=r.addServer.username),!(await E(n.http)).healthy){d("addServer",{error:s.t("dialog.server.add.error")});return}M(),await q(n,!0)}})),_=O(()=>({mutationFn:async e=>{if(e.original.type!=="http")return;const t=L(e.value);if(!t){I();return}const n=r.editServer.name.trim()||void 0,v=r.editServer.username||void 0,c=r.editServer.password||void 0,b=e.original.displayName;if(t===e.original.http.url&&n===b&&v===e.original.http.username&&c===e.original.http.password){I();return}const k={type:"http",displayName:n,http:{url:t,username:v,password:c}};if(!(await E(k.http)).healthy){d("editServer",{error:s.t("dialog.server.add.error")});return}t===e.original.http.url?o.add(k):ee(e.original,k),I()}})),ee=(e,t)=>{const n=o.key,v=o.add(t);if(!v)return;const c=n===h.key(e)?h.key(v):n;c&&o.setActive(c),o.remove(h.key(e))},A=C(()=>{const e=o.current,t=o.list;return e?t.includes(e)?[e,...t.filter(n=>n!==e)]:[e,...t]:t}),H=C(()=>A().find(e=>h.key(e)===o.key)??A()[0]),re=C(()=>{const e=A();if(!e.length)return e;const t=H(),n=new Map(e.map((c,b)=>[c,b])),v=c=>c?.healthy===!0?0:c?.healthy===!1?2:1;return e.slice().sort((c,b)=>{if(c===t)return-1;if(b===t)return 1;const k=v(r.status[h.key(c)])-v(r.status[h.key(b)]);return k!==0?k:(n.get(c)??0)-(n.get(b)??0)})});async function T(){const e={};await Promise.all(A().map(async t=>{e[h.key(t)]=await E(t.http)})),d("status",ke(e))}Q(()=>{A(),T();const e=setInterval(T,1e4);Se(()=>clearInterval(e))});async function q(e,t){if(!(!t&&r.status[h.key(e)]?.healthy===!1)){if(l.close(),t&&e.type==="http"){o.add(e),i("/");return}i("/"),queueMicrotask(()=>o.setActive(h.key(e)))}}const te=e=>{P.isPending||(d("addServer",{url:e,error:""}),y(e,r.addServer.username,r.addServer.password,t=>d("addServer",{status:t})))},ae=e=>{P.isPending||d("addServer",{name:e,error:""})},ne=e=>{P.isPending||(d("addServer",{username:e,error:""}),y(r.addServer.url,e,r.addServer.password,t=>d("addServer",{status:t})))},se=e=>{P.isPending||(d("addServer",{password:e,error:""}),y(r.addServer.url,r.addServer.username,e,t=>d("addServer",{status:t})))},ie=e=>{_.isPending||(d("editServer",{value:e,error:""}),y(e,r.editServer.username,r.editServer.password,t=>d("editServer",{status:t})))},de=e=>{_.isPending||d("editServer",{name:e,error:""})},le=e=>{_.isPending||(d("editServer",{username:e,error:""}),y(r.editServer.value,e,r.editServer.password,t=>d("editServer",{status:t})))},oe=e=>{_.isPending||(d("editServer",{password:e,error:""}),y(r.editServer.value,r.editServer.username,e,t=>d("editServer",{status:t})))},U=C(()=>r.editServer.id?"edit":r.addServer.showForm?"add":"list"),j=C(()=>{if(r.editServer.id)return A().find(e=>e.type==="http"&&e.http.url===r.editServer.id)}),G=()=>{M(),I()},ue=()=>{I(),d("addServer",{showForm:!0,url:"",name:"",username:K,password:"",error:"",status:void 0})},ce=e=>{M(),d("editServer",{id:e.http.url,value:e.http.url,name:e.displayName??"",username:e.http.username??"",password:e.http.password??"",error:"",status:r.status[h.key(e)]?.healthy})},J=()=>{if(U()==="add"){if(P.isPending)return;d("addServer",{error:""}),P.mutate(r.addServer.url);return}const e=j();e&&(_.isPending||(d("editServer",{error:""}),_.mutate({original:e,value:r.editServer.value})))},z=C(()=>U()!=="list"),f=C(()=>U()==="add"),B=C(()=>f()?P.isPending:_.isPending),ge=C(()=>z()?(()=>{var e=$e(),t=e.firstChild;return S(e,a(V,{icon:"arrow-left",variant:"ghost",onClick:G,get"aria-label"(){return s.t("common.goBack")}}),t),S(t,(()=>{var n=w(()=>!!f());return()=>n()?s.t("dialog.server.add.title"):s.t("dialog.server.edit.title")})()),e})():s.t("dialog.server.title"));Q(()=>{r.editServer.id&&(j()||I())});async function ve(e){o.remove(e),await u.getDefaultServer?.()===e&&u.setDefaultServer?.(null)}return a(ye,{get title(){return ge()},get children(){var e=Ie(),t=e.firstChild;return S(e,a($,{get when(){return!z()},get fallback(){return a(Ne,{get value(){return w(()=>!!f())()?r.addServer.url:r.editServer.value},get name(){return w(()=>!!f())()?r.addServer.name:r.editServer.name},get username(){return w(()=>!!f())()?r.addServer.username:r.editServer.username},get password(){return w(()=>!!f())()?r.addServer.password:r.editServer.password},get placeholder(){return s.t("dialog.server.add.placeholder")},get busy(){return B()},get error(){return w(()=>!!f())()?r.addServer.error:r.editServer.error},get status(){return w(()=>!!f())()?r.addServer.status:r.editServer.status},get onChange(){return f()?te:ie},get onNameChange(){return f()?ae:de},get onUsernameChange(){return f()?ne:le},get onPasswordChange(){return f()?se:oe},onSubmit:J,onBack:G})},get children(){return a(xe,{get search(){return{placeholder:s.t("dialog.server.search.placeholder"),autofocus:!1}},noInitialSelection:!0,get emptyMessage(){return s.t("dialog.server.empty")},items:re,key:n=>n.http.url,onSelect:n=>{n&&q(n)},divider:!0,class:"px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent",children:n=>{const v=h.key(n);return(()=>{var c=Ae(),b=c.firstChild,k=b.nextSibling;return S(b,a(Pe,{get health(){return r.status[v]}})),S(c,a(_e,{conn:n,get dimmed(){return r.status[v]?.healthy===!1},get status(){return r.status[v]},class:"flex items-center gap-3 min-w-0 flex-1",get badge(){return a($,{get when(){return m()===h.key(n)},get children(){var D=Ee();return S(D,()=>s.t("dialog.server.status.default")),D}})},showCredentials:!0}),k),S(k,a($,{get when(){return h.key(H())===v},get children(){return a(we,{name:"check",class:"h-6"})}}),null),S(k,a($,{get when(){return n.type==="http"},get children(){return a(p,{get children(){return[a(p.Trigger,{as:V,icon:"dot-grid",variant:"ghost",class:"shrink-0 size-8 hover:bg-surface-base-hover data-[expanded]:bg-surface-base-active",onClick:D=>D.stopPropagation(),onPointerDown:D=>D.stopPropagation()}),a(p.Portal,{get children(){return a(p.Content,{class:"mt-1",get children(){return[a(p.Item,{onSelect:()=>{n.type==="http"&&ce(n)},get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.edit")}})}}),a($,{get when(){return w(()=>!!g())()&&m()!==v},get children(){return a(p.Item,{onSelect:()=>x(v),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.default")}})}})}}),a($,{get when(){return w(()=>!!g())()&&m()===v},get children(){return a(p.Item,{onSelect:()=>x(null),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.defaultRemove")}})}})}}),a(p.Separator,{}),a(p.Item,{onSelect:()=>ve(h.key(n)),class:"text-text-on-critical-base hover:bg-surface-critical-weak",get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.delete")}})}})]}})}})]}})}}),null),c})()}})}}),t),S(t,a($,{get when(){return z()},get fallback(){return a(W,{variant:"secondary",icon:"plus-small",size:"large",onClick:ue,class:"py-1.5 pl-1.5 pr-3 flex items-center gap-1.5",get children(){return s.t("dialog.server.add.button")}})},get children(){return a(W,{variant:"primary",size:"large",onClick:J,get disabled(){return B()},class:"px-3 py-1.5",get children(){return w(()=>!!B())()?s.t("dialog.server.add.checking"):w(()=>!!f())()?s.t("dialog.server.add.button"):s.t("common.save")}})}})),e}})}export{Ke as DialogSelectServer};
1
+ import{d as me,c as he,e as fe,b as Y,f as R,K as Z,H as pe,L as O,M as L,N as h,i as C,O as Q,P as Se,l as S,m as a,Q as V,n as w,S as $,I as we,R as p,B as W,G as ye,A as be,U as ke,t as F,p as N,J as Ce}from"./index-DKwABhnu.js";import{L as xe}from"./list-DPJi0fzr.js";import{S as Pe,a as _e}from"./server-row-mRVGCgvL.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";var De=F('<div class=px-5><div class="bg-surface-base rounded-md p-5 flex flex-col gap-3"><div class="flex-1 min-w-0 [&amp;_[data-slot=input-wrapper]]:relative"></div><div class="grid grid-cols-2 gap-2 min-w-0">'),$e=F('<div class="flex items-center gap-2 -ml-2"><span>'),Ie=F('<div class="flex flex-col gap-2"><div class="px-5 pb-5">'),Ae=F('<div class="flex items-center gap-3 min-w-0 flex-1 w-full group/item"><div class="flex flex-col h-full items-start w-5"></div><div class="flex items-center justify-center gap-4 pl-4">'),Ee=F('<span class="text-text-base bg-surface-base text-14-regular px-1.5 rounded-xs">');const K="opencode";function X(i,l){Ce({variant:"error",title:i.t("common.requestFailed"),description:l instanceof Error?l.message:String(l)})}function Fe(){const i=R(),l=Y(),[o,u]=be(async()=>{try{const g=await l.getDefaultServer?.();return g||null}catch(g){return X(i,g),null}},{initialValue:null}),s=C(()=>!!l.getDefaultServer&&!!l.setDefaultServer);return{defaultKey:o,canDefault:s,setDefault:async g=>{try{await l.setDefaultServer?.(g),u.mutate(g)}catch(x){X(i,x)}}}}function Me(){const i=Z(),l=u=>{const s=L(u);if(!s)return!1;const m=s.replace(/^https?:\/\//,"").split("/")[0];return m?m.includes("localhost")||m.startsWith("127.0.0.1")?!0:m.includes(".")||m.includes(":"):!1};return{previewStatus:async(u,s,m,g)=>{if(g(void 0),!l(u))return;const x=L(u);if(!x)return;const y={url:x};s&&(y.username=s),m&&(y.password=m);const E=await i(y);g(E.healthy)}}}function Ne(i){const l=R(),o=u=>{if(u.stopPropagation(),u.key==="Escape"){u.preventDefault(),i.onBack();return}u.key!=="Enter"||u.isComposing||(u.preventDefault(),i.onSubmit())};return(()=>{var u=De(),s=u.firstChild,m=s.firstChild,g=m.nextSibling;return S(m,a(N,{type:"text",get label(){return l.t("dialog.server.add.url")},get placeholder(){return i.placeholder},get value(){return i.value},autofocus:!0,get validationState(){return i.error?"invalid":"valid"},get error(){return i.error},get disabled(){return i.busy},get onChange(){return i.onChange},onKeyDown:o})),S(s,a(N,{type:"text",get label(){return l.t("dialog.server.add.name")},get placeholder(){return l.t("dialog.server.add.namePlaceholder")},get value(){return i.name},get disabled(){return i.busy},get onChange(){return i.onNameChange},onKeyDown:o}),g),S(g,a(N,{type:"text",get label(){return l.t("dialog.server.add.username")},get placeholder(){return l.t("dialog.server.add.usernamePlaceholder")},get value(){return i.username},get disabled(){return i.busy},get onChange(){return i.onUsernameChange},onKeyDown:o}),null),S(g,a(N,{type:"password",get label(){return l.t("dialog.server.add.password")},get placeholder(){return l.t("dialog.server.add.passwordPlaceholder")},get value(){return i.password},get disabled(){return i.busy},get onChange(){return i.onPasswordChange},onKeyDown:o}),null),u})()}function Ke(){const i=me(),l=he(),o=fe(),u=Y(),s=R(),{defaultKey:m,canDefault:g,setDefault:x}=Fe(),{previewStatus:y}=Me(),E=Z(),[r,d]=pe({status:{},addServer:{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0},editServer:{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0}}),M=()=>{d("addServer",{url:"",name:"",username:K,password:"",error:"",showForm:!1,status:void 0})},I=()=>{d("editServer",{id:void 0,value:"",name:"",username:"",password:"",error:"",status:void 0})},P=O(()=>({mutationFn:async e=>{const t=L(e);if(!t){M();return}const n={type:"http",http:{url:t}};if(r.addServer.name.trim()&&(n.displayName=r.addServer.name.trim()),r.addServer.password&&(n.http.password=r.addServer.password),r.addServer.password&&r.addServer.username&&(n.http.username=r.addServer.username),!(await E(n.http)).healthy){d("addServer",{error:s.t("dialog.server.add.error")});return}M(),await q(n,!0)}})),_=O(()=>({mutationFn:async e=>{if(e.original.type!=="http")return;const t=L(e.value);if(!t){I();return}const n=r.editServer.name.trim()||void 0,v=r.editServer.username||void 0,c=r.editServer.password||void 0,b=e.original.displayName;if(t===e.original.http.url&&n===b&&v===e.original.http.username&&c===e.original.http.password){I();return}const k={type:"http",displayName:n,http:{url:t,username:v,password:c}};if(!(await E(k.http)).healthy){d("editServer",{error:s.t("dialog.server.add.error")});return}t===e.original.http.url?o.add(k):ee(e.original,k),I()}})),ee=(e,t)=>{const n=o.key,v=o.add(t);if(!v)return;const c=n===h.key(e)?h.key(v):n;c&&o.setActive(c),o.remove(h.key(e))},A=C(()=>{const e=o.current,t=o.list;return e?t.includes(e)?[e,...t.filter(n=>n!==e)]:[e,...t]:t}),H=C(()=>A().find(e=>h.key(e)===o.key)??A()[0]),re=C(()=>{const e=A();if(!e.length)return e;const t=H(),n=new Map(e.map((c,b)=>[c,b])),v=c=>c?.healthy===!0?0:c?.healthy===!1?2:1;return e.slice().sort((c,b)=>{if(c===t)return-1;if(b===t)return 1;const k=v(r.status[h.key(c)])-v(r.status[h.key(b)]);return k!==0?k:(n.get(c)??0)-(n.get(b)??0)})});async function T(){const e={};await Promise.all(A().map(async t=>{e[h.key(t)]=await E(t.http)})),d("status",ke(e))}Q(()=>{A(),T();const e=setInterval(T,1e4);Se(()=>clearInterval(e))});async function q(e,t){if(!(!t&&r.status[h.key(e)]?.healthy===!1)){if(l.close(),t&&e.type==="http"){o.add(e),i("/");return}i("/"),queueMicrotask(()=>o.setActive(h.key(e)))}}const te=e=>{P.isPending||(d("addServer",{url:e,error:""}),y(e,r.addServer.username,r.addServer.password,t=>d("addServer",{status:t})))},ae=e=>{P.isPending||d("addServer",{name:e,error:""})},ne=e=>{P.isPending||(d("addServer",{username:e,error:""}),y(r.addServer.url,e,r.addServer.password,t=>d("addServer",{status:t})))},se=e=>{P.isPending||(d("addServer",{password:e,error:""}),y(r.addServer.url,r.addServer.username,e,t=>d("addServer",{status:t})))},ie=e=>{_.isPending||(d("editServer",{value:e,error:""}),y(e,r.editServer.username,r.editServer.password,t=>d("editServer",{status:t})))},de=e=>{_.isPending||d("editServer",{name:e,error:""})},le=e=>{_.isPending||(d("editServer",{username:e,error:""}),y(r.editServer.value,e,r.editServer.password,t=>d("editServer",{status:t})))},oe=e=>{_.isPending||(d("editServer",{password:e,error:""}),y(r.editServer.value,r.editServer.username,e,t=>d("editServer",{status:t})))},U=C(()=>r.editServer.id?"edit":r.addServer.showForm?"add":"list"),j=C(()=>{if(r.editServer.id)return A().find(e=>e.type==="http"&&e.http.url===r.editServer.id)}),G=()=>{M(),I()},ue=()=>{I(),d("addServer",{showForm:!0,url:"",name:"",username:K,password:"",error:"",status:void 0})},ce=e=>{M(),d("editServer",{id:e.http.url,value:e.http.url,name:e.displayName??"",username:e.http.username??"",password:e.http.password??"",error:"",status:r.status[h.key(e)]?.healthy})},J=()=>{if(U()==="add"){if(P.isPending)return;d("addServer",{error:""}),P.mutate(r.addServer.url);return}const e=j();e&&(_.isPending||(d("editServer",{error:""}),_.mutate({original:e,value:r.editServer.value})))},z=C(()=>U()!=="list"),f=C(()=>U()==="add"),B=C(()=>f()?P.isPending:_.isPending),ge=C(()=>z()?(()=>{var e=$e(),t=e.firstChild;return S(e,a(V,{icon:"arrow-left",variant:"ghost",onClick:G,get"aria-label"(){return s.t("common.goBack")}}),t),S(t,(()=>{var n=w(()=>!!f());return()=>n()?s.t("dialog.server.add.title"):s.t("dialog.server.edit.title")})()),e})():s.t("dialog.server.title"));Q(()=>{r.editServer.id&&(j()||I())});async function ve(e){o.remove(e),await u.getDefaultServer?.()===e&&u.setDefaultServer?.(null)}return a(ye,{get title(){return ge()},get children(){var e=Ie(),t=e.firstChild;return S(e,a($,{get when(){return!z()},get fallback(){return a(Ne,{get value(){return w(()=>!!f())()?r.addServer.url:r.editServer.value},get name(){return w(()=>!!f())()?r.addServer.name:r.editServer.name},get username(){return w(()=>!!f())()?r.addServer.username:r.editServer.username},get password(){return w(()=>!!f())()?r.addServer.password:r.editServer.password},get placeholder(){return s.t("dialog.server.add.placeholder")},get busy(){return B()},get error(){return w(()=>!!f())()?r.addServer.error:r.editServer.error},get status(){return w(()=>!!f())()?r.addServer.status:r.editServer.status},get onChange(){return f()?te:ie},get onNameChange(){return f()?ae:de},get onUsernameChange(){return f()?ne:le},get onPasswordChange(){return f()?se:oe},onSubmit:J,onBack:G})},get children(){return a(xe,{get search(){return{placeholder:s.t("dialog.server.search.placeholder"),autofocus:!1}},noInitialSelection:!0,get emptyMessage(){return s.t("dialog.server.empty")},items:re,key:n=>n.http.url,onSelect:n=>{n&&q(n)},divider:!0,class:"px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent",children:n=>{const v=h.key(n);return(()=>{var c=Ae(),b=c.firstChild,k=b.nextSibling;return S(b,a(Pe,{get health(){return r.status[v]}})),S(c,a(_e,{conn:n,get dimmed(){return r.status[v]?.healthy===!1},get status(){return r.status[v]},class:"flex items-center gap-3 min-w-0 flex-1",get badge(){return a($,{get when(){return m()===h.key(n)},get children(){var D=Ee();return S(D,()=>s.t("dialog.server.status.default")),D}})},showCredentials:!0}),k),S(k,a($,{get when(){return h.key(H())===v},get children(){return a(we,{name:"check",class:"h-6"})}}),null),S(k,a($,{get when(){return n.type==="http"},get children(){return a(p,{get children(){return[a(p.Trigger,{as:V,icon:"dot-grid",variant:"ghost",class:"shrink-0 size-8 hover:bg-surface-base-hover data-[expanded]:bg-surface-base-active",onClick:D=>D.stopPropagation(),onPointerDown:D=>D.stopPropagation()}),a(p.Portal,{get children(){return a(p.Content,{class:"mt-1",get children(){return[a(p.Item,{onSelect:()=>{n.type==="http"&&ce(n)},get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.edit")}})}}),a($,{get when(){return w(()=>!!g())()&&m()!==v},get children(){return a(p.Item,{onSelect:()=>x(v),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.default")}})}})}}),a($,{get when(){return w(()=>!!g())()&&m()===v},get children(){return a(p.Item,{onSelect:()=>x(null),get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.defaultRemove")}})}})}}),a(p.Separator,{}),a(p.Item,{onSelect:()=>ve(h.key(n)),class:"text-text-on-critical-base hover:bg-surface-critical-weak",get children(){return a(p.ItemLabel,{get children(){return s.t("dialog.server.menu.delete")}})}})]}})}})]}})}}),null),c})()}})}}),t),S(t,a($,{get when(){return z()},get fallback(){return a(W,{variant:"secondary",icon:"plus-small",size:"large",onClick:ue,class:"py-1.5 pl-1.5 pr-3 flex items-center gap-1.5",get children(){return s.t("dialog.server.add.button")}})},get children(){return a(W,{variant:"primary",size:"large",onClick:J,get disabled(){return B()},class:"px-3 py-1.5",get children(){return w(()=>!!B())()?s.t("dialog.server.add.checking"):w(()=>!!f())()?s.t("dialog.server.add.button"):s.t("common.save")}})}})),e}})}export{Ke as DialogSelectServer};
@@ -1 +1 @@
1
- import{l as s,t as p,bl as Se,f as ee,b as he,bm as me,o as ve,H as ce,i as O,m as t,A as Ce,Y as Pe,I as B,S as C,n as V,p as se,bn as Te,bo as Ee,bp as ze,bq as je,$ as ie,B as J,br as Ae,bs as Fe,bt as De,J as R,bu as Ke,v as be,aH as Oe,P as xe,Q as $e,F as q,y as Le,q as H,V as Ie,bv as We,aK as Me,c as Ne,z as Ge,u as Re,a7 as Be,a8 as ne,bw as Ve,a2 as qe,h as ue,O as Ue,bx as He,by as Ye,bz as Je,bA as Qe,s as Xe,bB as Ze,bC as et,bD as tt,bE as rt,G as st}from"./index-bSvs-Qh3.js";import{T as L}from"./tabs-dF68ik4J.js";import{S as U}from"./select-CEKfrTm2.js";import{S as M}from"./switch-DPq0vsit.js";import{L as nt,D as it}from"./dialog-connect-provider-BEqcXIot.js";import{f as lt,u as at}from"./list-BPk4NMWt.js";import{P as re,T as te}from"./tag--BCZ5q7_.js";import{a as ot,D as ct}from"./dialog-select-provider-2iOfyWxy.js";import"./chunk-VVM5DH6Z-COaOSPgd.js";var dt=p('<div class="bg-surface-base px-4 rounded-lg">');const N=r=>(()=>{var e=dt();return s(e,()=>r.children),e})();var ut=p("<div data-action=settings-feed-reasoning-summaries>"),gt=p("<div data-action=settings-feed-shell-tool-parts-expanded>"),pt=p("<div data-action=settings-feed-edit-tool-parts-expanded>"),ft=p('<div class="flex flex-col gap-1">'),ge=p('<div class="w-full sm:w-[220px]">'),X=p('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ht=p("<div data-action=settings-notifications-agent>"),mt=p("<div data-action=settings-notifications-permissions>"),vt=p("<div data-action=settings-notifications-errors>"),bt=p("<div data-action=settings-updates-startup>"),xt=p("<div data-action=settings-release-notes>"),$t=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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"></h2></div></div><div class="flex flex-col gap-8 w-full">'),_t=p("<div data-action=settings-wayland>"),wt=p("<span class=text-text-weak>"),yt=p('<div class="flex items-center gap-2"><span>'),kt=p('<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 G={cleanup:void 0,timeout:void 0,run:0};const _e=()=>{G.run+=1,G.cleanup&&G.cleanup(),clearTimeout(G.timeout),G.cleanup=void 0},pe=r=>{if(_e(),!r)return;const e=++G.run;G.timeout=setTimeout(()=>{Ke(r).then(l=>{if(G.run!==e){l?.();return}G.cleanup=l})},100)},St=()=>{const r=Se(),e=ee(),l=he(),n=me();ve(()=>{r.loadThemes()});const[o,f]=ce({checking:!1}),y=O(()=>l.platform==="desktop"&&l.os==="linux"),x=()=>{l.checkUpdate&&(f("checking",!0),l.checkUpdate().then(c=>{if(!c.updateAvailable){R({variant:"success",icon:"circle-check",title:e.t("settings.updates.toast.latest.title"),description:e.t("settings.updates.toast.latest.description",{version:l.version??""})});return}const a=l.update&&l.restart?[{label:e.t("toast.update.action.installRestart"),onClick:async()=>{await l.update(),await l.restart()}},{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}]:[{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}];R({persistent:!0,icon:"download",title:e.t("toast.update.title"),description:e.t("toast.update.description",{version:c.version??""}),actions:a})}).catch(c=>{const a=c instanceof Error?c.message:String(c);R({title:e.t("common.requestFailed"),description:a})}).finally(()=>f("checking",!1)))},b=O(()=>r.ids().map(c=>({id:c,name:r.name(c)}))),$=O(()=>[{value:"system",label:e.t("theme.scheme.system")},{value:"light",label:e.t("theme.scheme.light")},{value:"dark",label:e.t("theme.scheme.dark")}]),P=O(()=>[{value:"queue",label:e.t("settings.general.row.followup.option.queue")},{value:"steer",label:e.t("settings.general.row.followup.option.steer")}]),j=O(()=>e.locales.map(c=>({value:c,label:e.label(c)}))),F={id:"none",label:"sound.option.none"},D=[F,...De],v=()=>Fe(n.appearance.font()),h=()=>Ae(n.appearance.uiFont()),d=(c,a,i,u)=>({options:D,current:c()?D.find(g=>g.id===a())??F:F,value:g=>g.id,label:g=>e.t(g.label),onHighlight:g=>{g&&pe(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){i(!1),_e();return}i(!0),u(g.id),pe(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),m=()=>(()=>{var c=ft();return s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.row.language.title")},get description(){return e.t("settings.general.row.language.description")},get children(){return t(U,{"data-action":"settings-language",get options(){return j()},get current(){return j().find(a=>a.value===e.locale())},value:a=>a.value,label:a=>a.label,onSelect:a=>a&&e.setLocale(a.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),t(E,{get title(){return e.t("settings.general.row.reasoningSummaries.title")},get description(){return e.t("settings.general.row.reasoningSummaries.description")},get children(){var a=ut();return s(a,t(M,{get checked(){return n.general.showReasoningSummaries()},onChange:i=>n.general.setShowReasoningSummaries(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return e.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var a=gt();return s(a,t(M,{get checked(){return n.general.shellToolPartsExpanded()},onChange:i=>n.general.setShellToolPartsExpanded(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.editToolPartsExpanded.title")},get description(){return e.t("settings.general.row.editToolPartsExpanded.description")},get children(){var a=pt();return s(a,t(M,{get checked(){return n.general.editToolPartsExpanded()},onChange:i=>n.general.setEditToolPartsExpanded(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.followup.title")},get description(){return e.t("settings.general.row.followup.description")},get children(){return t(U,{"data-action":"settings-followup",get options(){return P()},get current(){return P().find(a=>a.value===n.general.followup())},value:a=>a.value,label:a=>a.label,onSelect:a=>a&&n.general.setFollowup(a.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}})]}})),c})(),k=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.appearance")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.row.colorScheme.title")},get description(){return e.t("settings.general.row.colorScheme.description")},get children(){return t(U,{"data-action":"settings-color-scheme",get options(){return $()},get current(){return $().find(i=>i.value===r.colorScheme())},value:i=>i.value,label:i=>i.label,onSelect:i=>i&&r.setColorScheme(i.value),onHighlight:i=>{if(i)return r.previewColorScheme(i.value),()=>r.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),t(E,{get title(){return e.t("settings.general.row.theme.title")},get description(){return[V(()=>e.t("settings.general.row.theme.description"))," ",t(nt,{href:"https://opencode.ai/docs/themes/",get children(){return e.t("common.learnMore")}})]},get children(){return t(U,{"data-action":"settings-theme",get options(){return b()},get current(){return b().find(i=>i.id===r.themeId())},value:i=>i.id,label:i=>i.name,onSelect:i=>{i&&r.setTheme(i.id)},onHighlight:i=>{if(i)return r.previewTheme(i.id),()=>r.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings"})}}),t(E,{get title(){return e.t("settings.general.row.uiFont.title")},get description(){return e.t("settings.general.row.uiFont.description")},get children(){var i=ge();return s(i,t(se,{"data-action":"settings-ui-font",get label(){return e.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return h()},onChange:u=>n.appearance.setUIFont(u),placeholder:Te,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ee(n.appearance.uiFont())}}})),i}}),t(E,{get title(){return e.t("settings.general.row.font.title")},get description(){return e.t("settings.general.row.font.description")},get children(){var i=ge();return s(i,t(se,{"data-action":"settings-code-font",get label(){return e.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return v()},onChange:u=>n.appearance.setFont(u),placeholder:ze,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":je(n.appearance.font())}}})),i}})]}}),null),c})(),A=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.notifications")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.notifications.agent.title")},get description(){return e.t("settings.general.notifications.agent.description")},get children(){var i=ht();return s(i,t(M,{get checked(){return n.notifications.agent()},onChange:u=>n.notifications.setAgent(u)})),i}}),t(E,{get title(){return e.t("settings.general.notifications.permissions.title")},get description(){return e.t("settings.general.notifications.permissions.description")},get children(){var i=mt();return s(i,t(M,{get checked(){return n.notifications.permissions()},onChange:u=>n.notifications.setPermissions(u)})),i}}),t(E,{get title(){return e.t("settings.general.notifications.errors.title")},get description(){return e.t("settings.general.notifications.errors.description")},get children(){var i=vt();return s(i,t(M,{get checked(){return n.notifications.errors()},onChange:u=>n.notifications.setErrors(u)})),i}})]}}),null),c})(),S=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.sounds")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.sounds.agent.title")},get description(){return e.t("settings.general.sounds.agent.description")},get children(){return t(U,ie({"data-action":"settings-sounds-agent"},()=>d(()=>n.sounds.agentEnabled(),()=>n.sounds.agent(),i=>n.sounds.setAgentEnabled(i),i=>n.sounds.setAgent(i))))}}),t(E,{get title(){return e.t("settings.general.sounds.permissions.title")},get description(){return e.t("settings.general.sounds.permissions.description")},get children(){return t(U,ie({"data-action":"settings-sounds-permissions"},()=>d(()=>n.sounds.permissionsEnabled(),()=>n.sounds.permissions(),i=>n.sounds.setPermissionsEnabled(i),i=>n.sounds.setPermissions(i))))}}),t(E,{get title(){return e.t("settings.general.sounds.errors.title")},get description(){return e.t("settings.general.sounds.errors.description")},get children(){return t(U,ie({"data-action":"settings-sounds-errors"},()=>d(()=>n.sounds.errorsEnabled(),()=>n.sounds.errors(),i=>n.sounds.setErrorsEnabled(i),i=>n.sounds.setErrors(i))))}})]}}),null),c})(),_=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.updates")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.updates.row.startup.title")},get description(){return e.t("settings.updates.row.startup.description")},get children(){var i=bt();return s(i,t(M,{get checked(){return n.updates.startup()},get disabled(){return!l.checkUpdate},onChange:u=>n.updates.setStartup(u)})),i}}),t(E,{get title(){return e.t("settings.general.row.releaseNotes.title")},get description(){return e.t("settings.general.row.releaseNotes.description")},get children(){var i=xt();return s(i,t(M,{get checked(){return n.general.releaseNotes()},onChange:u=>n.general.setReleaseNotes(u)})),i}}),t(E,{get title(){return e.t("settings.updates.row.check.title")},get description(){return e.t("settings.updates.row.check.description")},get children(){return t(J,{size:"small",variant:"secondary",get disabled(){return o.checking||!l.checkUpdate},onClick:x,get children(){return V(()=>!!o.checking)()?e.t("settings.updates.action.checking"):e.t("settings.updates.action.checkNow")}})}})]}}),null),c})();return(()=>{var c=$t(),a=c.firstChild,i=a.firstChild,u=i.firstChild,g=a.nextSibling;return s(u,()=>e.t("settings.tab.general")),s(g,t(m,{}),null),s(g,t(k,{}),null),s(g,t(A,{}),null),s(g,t(S,{}),null),s(g,t(_,{}),null),s(g,t(C,{get when(){return y()},children:w=>{const[z,K]=Ce(()=>l.getDisplayBackend?.()),I=()=>z.state==="pending"?void 0:z.latest,T=W=>l.setDisplayBackend?.(W?"wayland":"auto").finally(()=>K.refetch());return(()=>{var W=X(),ye=W.firstChild;return s(ye,()=>e.t("settings.general.section.display")),s(W,t(N,{get children(){return t(E,{get title(){return(()=>{var Y=yt(),ke=Y.firstChild;return s(ke,()=>e.t("settings.general.row.wayland.title")),s(Y,t(Pe,{get value(){return e.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var de=wt();return s(de,t(B,{name:"help",size:"small"})),de}}),null),Y})()},get description(){return e.t("settings.general.row.wayland.description")},get children(){var Y=_t();return s(Y,t(M,{get checked(){return I()==="wayland"},onChange:T})),Y}})}}),null),W})()}}),null),c})()},E=r=>(()=>{var e=kt(),l=e.firstChild,n=l.firstChild,o=n.nextSibling,f=l.nextSibling;return s(n,()=>r.title),s(o,()=>r.description),s(f,()=>r.children),e})();var Ct=p('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Pt=p('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Tt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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-4 pt-6 pb-6 max-w-[720px]"><div class="flex items-center justify-between gap-4"><h2 class="text-16-medium text-text-strong"></h2></div><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),Et=p('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),zt=p('<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),Q="command.palette",jt="mod+shift+p",Z=["General","Session","Navigation","Model and agent","Terminal","Prompt","Editor","File","View","App"],At={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",Editor:"settings.shortcuts.group.editor",File:"settings.shortcuts.group.file",View:"settings.shortcuts.group.view",App:"settings.shortcuts.group.app"};function ae(r){return r===Q?"General":r.startsWith("terminal.")?"Terminal":r.startsWith("model.")||r.startsWith("agent.")||r.startsWith("mcp.")?"Model and agent":r.startsWith("file.")||r.startsWith("fileTree.")||r.startsWith("folder.")?"File":r.startsWith("prompt.")?"Prompt":r.startsWith("editor.")?"Editor":r.startsWith("view.")?"View":r.startsWith("app.")?"App":r.startsWith("tab.")?"Navigation":r.startsWith("session.")||r.startsWith("message.")||r.startsWith("permissions.")||r.startsWith("steps.")||r.startsWith("review.")?"Session":"General"}function Ft(r){return r==="Shift"||r==="Control"||r==="Alt"||r==="Meta"}function Dt(r){return r===","?"comma":r==="+"?"plus":r===" "?"space":r.toLowerCase()}function Kt(r){if(Ft(r.key))return;const e=[];(le?r.metaKey:r.ctrlKey)&&e.push("mod"),le&&r.ctrlKey&&e.push("ctrl"),!le&&r.metaKey&&e.push("meta"),r.altKey&&e.push("alt"),r.shiftKey&&e.push("shift");const n=Dt(r.key);if(n)return e.push(n),e.join("+")}function oe(r){if(!r)return[];const e=[];for(const l of We(r)){const n=[];l.ctrl&&n.push("ctrl"),l.alt&&n.push("alt"),l.shift&&n.push("shift"),l.meta&&n.push("meta"),l.key&&n.push(l.key),n.length!==0&&e.push(n.join("+"))}return e}function Ot(r){return!r||typeof r!="object"||Array.isArray(r)?{}:r}function Lt(r,e,l){const n=new Map;n.set(Q,{title:l,group:"General"});for(const o of r.catalog)o.id.startsWith("suggested.")||n.set(o.id,{title:o.title,group:ae(o.id)});for(const o of r.options)o.id.startsWith("suggested.")||n.set(o.id,{title:o.title,group:ae(o.id)});for(const[o,f]of Object.entries(e))typeof f=="string"&&(n.has(o)||n.set(o,{title:o,group:ae(o)}));return n}function It(r){const e=new Map;for(const l of Z)e.set(l,[]);for(const[l,n]of r){const o=e.get(n.group);o&&o.push(l)}for(const l of Z){const n=e.get(l);n&&n.sort((o,f)=>(r.get(o)?.title??"").localeCompare(r.get(f)?.title??""))}return e}function Wt(r,e,l,n){const o=r.toLowerCase().trim();if(!o)return l;const f=new Map;for(const b of Z)f.set(b,[]);const y=Array.from(e.entries()).map(([b,$])=>({id:b,title:$.title,group:$.group,keybind:n(b)})),x=lt.go(o,y,{keys:["title","keybind"],threshold:-1e4});for(const b of x){const $=f.get(b.obj.group);$&&$.push(b.obj.id)}return f}function Mt(r){ve(()=>{const e=l=>{const n=r.active();if(!n)return;if(l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),l.key==="Escape"){r.stop();return}if((l.key==="Backspace"||l.key==="Delete")&&!l.ctrlKey&&!l.metaKey&&!l.altKey&&!l.shiftKey){r.set(n,"none"),r.stop();return}const f=Kt(l);if(!f)return;const y=new Map;for(const x of oe(f))for(const b of r.used().get(x)??[])b.id!==n&&y.set(b.id,b.title);if(y.size>0){R({title:r.language.t("settings.shortcuts.conflict.title"),description:r.language.t("settings.shortcuts.conflict.description",{keybind:Me(f,r.language.t),titles:[...y.values()].join(", ")})});return}r.set(n,f),r.stop()};document.addEventListener("keydown",e,!0),xe(()=>document.removeEventListener("keydown",e,!0))})}const Nt=()=>{const r=Oe(),e=ee(),l=me(),[n,o]=ce({active:null,filter:""}),f=()=>{n.active&&(o("active",null),r.keybinds(!0))},y=m=>{if(n.active===m){f();return}n.active&&f(),o("active",m),r.keybinds(!1)},x=O(()=>Ot(l.current.keybinds)),b=O(()=>Object.values(x()).some(m=>typeof m=="string")),$=()=>{f(),l.keybinds.resetAll(),R({title:e.t("settings.shortcuts.reset.toast.title"),description:e.t("settings.shortcuts.reset.toast.description")})},P=O(()=>(e.locale(),Lt(r,x(),e.t("command.palette")))),j=m=>P().get(m)?.title??"",F=O(()=>It(P())),D=O(()=>Wt(n.filter,P(),F(),m=>r.keybind(m)||"")),v=O(()=>{for(const m of Z)if((D().get(m)??[]).length>0)return!0;return!1}),h=O(()=>{const m=new Map,k=(_,c)=>{const a=m.get(_);if(!a){m.set(_,[c]);return}a.push(c)},A=l.keybinds.get(Q)??jt;for(const _ of oe(A))k(_,{id:Q,title:j(Q)});const S=_=>{const c=l.keybinds.get(_);if(typeof c=="string")return c;const a=r.options.find(u=>u.id===_);return a?.keybind?a.keybind:r.catalog.find(u=>u.id===_)?.keybind};for(const _ of P().keys())if(_!==Q)for(const c of oe(S(_)))k(c,{id:_,title:j(_)});return m});return Mt({active:()=>n.active,stop:f,set:(m,k)=>l.keybinds.set(m,k),used:h,language:e}),xe(()=>{n.active&&r.keybinds(!0)}),(()=>{var m=Tt(),k=m.firstChild,A=k.firstChild,S=A.firstChild,_=S.firstChild,c=S.nextSibling,a=k.nextSibling;return s(_,()=>e.t("settings.shortcuts.title")),s(S,t(J,{size:"small",variant:"secondary",onClick:$,get disabled(){return!b()},get children(){return e.t("settings.shortcuts.reset.button")}}),null),s(c,t(B,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),s(c,t(se,{variant:"ghost",type:"text",get value(){return n.filter},onChange:i=>o("filter",i),get placeholder(){return e.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),s(c,t(C,{get when(){return n.filter},get children(){return t($e,{icon:"circle-x",variant:"ghost",onClick:()=>o("filter","")})}}),null),s(a,t(q,{each:Z,children:i=>t(C,{get when(){return(D().get(i)??[]).length>0},get children(){var u=Et(),g=u.firstChild;return s(g,()=>e.t(At[i])),s(u,t(N,{get children(){return t(q,{get each(){return D().get(i)??[]},children:w=>(()=>{var z=zt(),K=z.firstChild,I=K.nextSibling;return s(K,()=>j(w)),I.$$click=()=>y(w),Le(I,"data-keybind-id",w),s(I,t(C,{get when(){return n.active===w},get fallback(){return r.keybind(w)||e.t("settings.shortcuts.unassigned")},get children(){return e.t("settings.shortcuts.pressKeys")}})),H(T=>Ie(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":n.active!==w,"border border-border-weak-base bg-surface-inset-base text-text-weak":n.active===w},T)),z})()})}}),null),u}})}),null),s(a,t(C,{get when(){return V(()=>!!n.filter)()&&!v()},get children(){var i=Pt(),u=i.firstChild;return s(u,()=>e.t("settings.shortcuts.search.empty")),s(i,t(C,{get when(){return n.filter},get children(){var g=Ct(),w=g.firstChild,z=w.nextSibling;return z.nextSibling,s(g,()=>n.filter,z),g}}),null),i}}),null),m})()};be(["click"]);var Gt=p('<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">'),Rt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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"></h2></div></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">'),Bt=p('<div class="py-4 text-14-regular text-text-weak">'),Vt=p('<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">'),qt=p('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Ut=p('<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">'),Ht=p('<span class="text-12-regular text-text-weak pl-8">');const Yt=[{match:r=>r==="opencode",key:"dialog.provider.opencode.note"},{match:r=>r==="opencode-go",key:"dialog.provider.opencodeGo.tagline"},{match:r=>r==="anthropic",key:"dialog.provider.anthropic.note"},{match:r=>r.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:r=>r==="openai",key:"dialog.provider.openai.note"},{match:r=>r==="google",key:"dialog.provider.google.note"},{match:r=>r==="openrouter",key:"dialog.provider.openrouter.note"},{match:r=>r==="vercel",key:"dialog.provider.vercel.note"}],Jt=()=>{const r=Ne(),e=ee(),l=Ge(),n=Re(),o=Be(),f=O(()=>o.connected().filter(v=>v.id!=="opencode"||Object.values(v.models).find(h=>h.cost?.input))),y=O(()=>{const v=new Set(f().map(d=>d.id)),h=o.popular().filter(d=>!v.has(d.id)).slice();return h.sort((d,m)=>ne.indexOf(d.id)-ne.indexOf(m.id)),h}),x=v=>{if(!("source"in v))return;const h=v.source;if(h==="env"||h==="api"||h==="config"||h==="custom")return h},b=v=>{const h=x(v);return h==="env"?e.t("settings.providers.tag.environment"):h==="api"?e.t("provider.connect.method.apiKey"):h==="config"?j(v.id)?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.config"):h==="custom"?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.other")},$=v=>x(v)!=="env",P=v=>Yt.find(h=>h.match(v))?.key,j=v=>{const h=n.data.config.provider?.[v];return!(!h||h.npm!=="@ai-sdk/openai-compatible"||!h.models||Object.keys(h.models).length===0)},F=async(v,h)=>{const d=n.data.config.disabled_providers??[],m=d.includes(v)?d:[...d,v];n.set("config","disabled_providers",m),await n.updateConfig({disabled_providers:m}).then(()=>{R({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(k=>{n.set("config","disabled_providers",d);const A=k instanceof Error?k.message:String(k);R({title:e.t("common.requestFailed"),description:A})})},D=async(v,h)=>{if(j(v)){await l.client.auth.remove({providerID:v}).catch(()=>{}),await F(v,h);return}await l.client.auth.remove({providerID:v}).then(async()=>{await l.client.global.dispose(),R({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(d=>{const m=d instanceof Error?d.message:String(d);R({title:e.t("common.requestFailed"),description:m})})};return(()=>{var v=Rt(),h=v.firstChild,d=h.firstChild,m=d.firstChild,k=h.nextSibling,A=k.firstChild,S=A.firstChild,_=A.nextSibling,c=_.firstChild;return s(m,()=>e.t("settings.providers.title")),s(S,()=>e.t("settings.providers.section.connected")),s(A,t(N,{get children(){return t(C,{get when(){return f().length>0},get fallback(){return(()=>{var a=Bt();return s(a,()=>e.t("settings.providers.connected.empty")),a})()},get children(){return t(q,{get each(){return f()},children:a=>(()=>{var i=Vt(),u=i.firstChild,g=u.firstChild;return s(u,t(re,{get id(){return a.id},class:"size-5 shrink-0 icon-strong-base"}),g),s(g,()=>a.name),s(u,t(te,{get children(){return b(a)}}),null),s(i,t(C,{get when(){return $(a)},get fallback(){return(()=>{var w=qt();return s(w,()=>e.t("settings.providers.connected.environmentDescription")),w})()},get children(){return t(J,{size:"large",variant:"ghost",onClick:()=>void D(a.id,a.name),get children(){return e.t("common.disconnect")}})}}),null),i})()})}})}}),null),s(c,()=>e.t("settings.providers.section.popular")),s(_,t(N,{get children(){return[t(q,{get each(){return y()},children:a=>(()=>{var i=Ut(),u=i.firstChild,g=u.firstChild,w=g.firstChild;return s(g,t(re,{get id(){return a.id},class:"size-5 shrink-0 icon-strong-base"}),w),s(w,()=>a.name),s(g,t(C,{get when(){return a.id==="opencode"},get children(){return t(te,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),s(g,t(C,{get when(){return a.id==="opencode-go"},get children(){return t(te,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),s(u,t(C,{get when(){return P(a.id)},children:z=>(()=>{var K=Ht();return s(K,()=>e.t(z())),K})()}),null),s(i,t(J,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{r.show(()=>t(it,{get provider(){return a.id}}))},get children(){return e.t("common.connect")}}),null),i})()}),(()=>{var a=Gt(),i=a.firstChild,u=i.firstChild,g=u.firstChild,w=u.nextSibling;return s(u,t(re,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),g),s(g,()=>e.t("provider.custom.title")),s(u,t(te,{get children(){return e.t("settings.providers.tag.custom")}}),null),s(w,()=>e.t("settings.providers.custom.description")),s(a,t(J,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{r.show(()=>t(ot,{back:"close"}))},get children(){return e.t("common.connect")}}),null),a})()]}}),null),s(_,t(J,{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:()=>{r.show(()=>t(ct,{}))},get children(){return e.t("dialog.provider.viewAll")}}),null),v})()};var we=p('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Qt=p('<span class="text-14-regular text-text-strong mt-1">&quot;<!>&quot;'),Xt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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-4 pt-6 pb-6 max-w-[720px]"><h2 class="text-16-medium text-text-strong"></h2><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),Zt=p('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),er=p('<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></div><div class=flex-shrink-0>');const tr=r=>(()=>{var e=we(),l=e.firstChild;return s(l,()=>r.label),e})(),rr=r=>(()=>{var e=we(),l=e.firstChild;return s(l,()=>r.message),s(e,t(C,{get when(){return r.filter},get children(){var n=Qt(),o=n.firstChild,f=o.nextSibling;return f.nextSibling,s(n,()=>r.filter,f),n}}),null),e})(),sr=()=>{const r=ee(),e=Ve(),l=at({items:n=>e.list(),key:n=>`${n.provider.id}:${n.id}`,filterKeys:["provider.name","name","id"],sortBy:(n,o)=>n.name.localeCompare(o.name),groupBy:n=>n.provider.id,sortGroupsBy:(n,o)=>{const f=ne.indexOf(n.category),y=ne.indexOf(o.category),x=f>=0,b=y>=0;if(x&&!b)return-1;if(!x&&b)return 1;if(x&&b)return f-y;const $=n.items[0].provider.name,P=o.items[0].provider.name;return $.localeCompare(P)}});return(()=>{var n=Xt(),o=n.firstChild,f=o.firstChild,y=f.firstChild,x=y.nextSibling,b=o.nextSibling;return s(y,()=>r.t("settings.models.title")),s(x,t(B,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),s(x,t(se,{variant:"ghost",type:"text",get value(){return l.filter()},get onChange(){return l.onInput},get placeholder(){return r.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),s(x,t(C,{get when(){return l.filter()},get children(){return t($e,{icon:"circle-x",variant:"ghost",get onClick(){return l.clear}})}}),null),s(b,t(C,{get when(){return!l.grouped.loading},get fallback(){return t(tr,{get label(){return`${r.t("common.loading")}${r.t("common.loading.ellipsis")}`}})},get children(){return t(C,{get when(){return l.flat().length>0},get fallback(){return t(rr,{get message(){return r.t("dialog.model.empty")},get filter(){return l.filter()}})},get children(){return t(q,{get each(){return l.grouped.latest},children:$=>(()=>{var P=Zt(),j=P.firstChild,F=j.firstChild;return s(j,t(re,{get id(){return $.category},class:"size-5 shrink-0 icon-strong-base"}),F),s(F,()=>$.items[0].provider.name),s(P,t(N,{get children(){return t(q,{get each(){return $.items},children:D=>{const v={providerID:D.provider.id,modelID:D.id};return(()=>{var h=er(),d=h.firstChild,m=d.firstChild,k=d.nextSibling;return s(m,()=>D.name),s(k,t(M,{get checked(){return e.visible(v)},onChange:A=>{e.setVisibility(v,A)},hideLabel:!0,get children(){return D.name}})),h})()}})}}),null),P})()})}})}})),n})()};var fe=p("<div class=settings-services-list>"),nr=p("<div class=settings-services-drafts-title>New services (add to opencode.jsonc)"),ir=p('<div class=settings-services-hint>Copy the configuration above into your <code>opencode.jsonc</code> under the <code>"preview"</code> key.'),lr=p("<div class=settings-services-empty>No preview services configured. Click <strong>Auto-detect</strong> to scan your project or <strong>Add</strong> to configure manually."),ar=p("<div class=settings-services><div class=settings-services-header><div><div class=settings-services-title>Preview Services</div><div class=settings-services-desc>Configure dev servers and preview services for this project.</div></div><div class=settings-services-actions><button class=settings-services-btn></button><button class=settings-services-btn>Add"),or=p("<span class=settings-services-port>:"),cr=p("<button class=settings-services-icon-btn title=Stop>"),dr=p("<button class=settings-services-icon-btn title=Start>"),ur=p("<div class=settings-services-item><span class=settings-services-dot></span><span class=settings-services-name></span><span class=settings-services-cmd></span><div class=settings-services-item-actions>"),gr=p('<div class=settings-services-draft><input class="settings-services-input settings-services-input--name"placeholder=name><select class=settings-services-select><option value=web>web</option><option value=api>api</option><option value=terminal>terminal</option></select><input class="settings-services-input settings-services-input--port"placeholder=port type=number><input class="settings-services-input settings-services-input--cmd"placeholder=command><button class="settings-services-icon-btn settings-services-rm">');function pr(){const r=qe(),e=O(()=>`?directory=${encodeURIComponent(r.directory)}`),[l,n]=ue([]),[o,f]=ce([]),[y,x]=ue(!1),b=async()=>{try{const d=await fetch(`${r.url}/preview/services${e()}`);d.ok&&n(await d.json())}catch{}};Ue(()=>{b()});const $=async d=>{await fetch(`${r.url}/preview/services/${d}/start${e()}`,{method:"POST"}),await b()},P=async d=>{await fetch(`${r.url}/preview/services/${d}/stop${e()}`,{method:"POST"}),await b()},j=async()=>{x(!0);try{const d=await fetch(`${r.url}/preview/infer${e()}`,{method:"POST"});if(d.ok){const m=await d.json(),k=new Set(l().map(S=>S.name)),A=m.filter(S=>!k.has(S.name)).map(S=>({name:S.name,port:String(S.port),type:S.type,command:S.command}));f([...o,...A])}}finally{x(!1)}},F=()=>f([...o,{name:"",port:"3000",type:"web",command:""}]),D=d=>f(o.filter((m,k)=>k!==d)),v=d=>d==="web"?et:d==="api"?tt:rt,h=d=>d==="running"?"var(--color-green-500)":d==="starting"?"var(--color-yellow-500)":d==="error"?"var(--color-red-500)":"var(--text-weaker)";return(()=>{var d=ar(),m=d.firstChild,k=m.firstChild,A=k.nextSibling,S=A.firstChild,_=S.nextSibling,c=_.firstChild;return S.$$click=()=>void j(),s(S,t(He,{class:"size-3.5"}),null),s(S,()=>y()?"Scanning…":"Auto-detect",null),_.$$click=F,s(_,t(Ye,{class:"size-3.5"}),c),s(d,t(C,{get when(){return l().length>0},get children(){var a=fe();return s(a,t(q,{get each(){return l()},children:i=>{const u=v(i.type);return(()=>{var g=ur(),w=g.firstChild,z=w.nextSibling,K=z.nextSibling,I=K.nextSibling;return s(g,t(u,{class:"size-3.5 text-icon-weak"}),z),s(z,()=>i.name),s(g,t(C,{get when(){return i.port},get children(){var T=or();return T.firstChild,s(T,()=>i.port,null),T}}),K),s(K,()=>i.command),s(I,t(C,{get when(){return i.status==="running"},get children(){var T=cr();return T.$$click=()=>void P(i.name),s(T,t(Je,{class:"size-3.5"})),T}}),null),s(I,t(C,{get when(){return i.status==="stopped"},get children(){var T=dr();return T.$$click=()=>void $(i.name),s(T,t(Qe,{class:"size-3.5"})),T}}),null),H(T=>Xe(w,"background",h(i.status))),g})()}})),a}}),null),s(d,t(C,{get when(){return o.length>0},get children(){return[nr(),(()=>{var a=fe();return s(a,t(q,{each:o,children:(i,u)=>(()=>{var g=gr(),w=g.firstChild,z=w.nextSibling,K=z.nextSibling,I=K.nextSibling,T=I.nextSibling;return w.$$input=W=>f(u(),"name",W.currentTarget.value),z.addEventListener("change",W=>f(u(),"type",W.currentTarget.value)),K.$$input=W=>f(u(),"port",W.currentTarget.value),I.$$input=W=>f(u(),"command",W.currentTarget.value),T.$$click=()=>D(u()),s(T,t(Ze,{class:"size-3.5"})),H(()=>w.value=i.name),H(()=>z.value=i.type),H(()=>K.value=i.port),H(()=>I.value=i.command),g})()})),a})(),ir()]}}),null),s(d,t(C,{get when(){return V(()=>l().length===0)()&&o.length===0},get children(){return lr()}}),null),H(()=>S.disabled=y()),d})()}be(["click","input"]);var fr=p('<div class="flex flex-col justify-between h-full w-full"><div class="flex flex-col gap-3 w-full pt-3"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class="flex flex-col gap-1 pl-1 py-1 text-12-medium text-text-weak"><span></span><span class=text-11-regular>v');const kr=r=>{const e=ee(),l=he();return t(st,{size:"x-large",transition:!0,get children(){return t(L,{orientation:"vertical",variant:"settings",get defaultValue(){return r.tab??"general"},class:"h-full settings-dialog",get children(){return[t(L.List,{get children(){var n=fr(),o=n.firstChild,f=o.firstChild,y=f.firstChild,x=y.firstChild,b=y.nextSibling,$=b.firstChild,P=o.nextSibling,j=P.firstChild,F=j.nextSibling;return F.firstChild,s(y,t(L.SectionTitle,{get children(){return e.t("settings.section.desktop")}}),x),s(x,t(L.Trigger,{value:"general",get children(){return[t(B,{name:"sliders"}),V(()=>e.t("settings.tab.general"))]}}),null),s(x,t(L.Trigger,{value:"shortcuts",get children(){return[t(B,{name:"keyboard"}),V(()=>e.t("settings.tab.shortcuts"))]}}),null),s(b,t(L.SectionTitle,{get children(){return e.t("settings.section.server")}}),$),s($,t(L.Trigger,{value:"providers",get children(){return[t(B,{name:"providers"}),V(()=>e.t("settings.providers.title"))]}}),null),s($,t(L.Trigger,{value:"models",get children(){return[t(B,{name:"models"}),V(()=>e.t("settings.models.title"))]}}),null),s($,t(L.Trigger,{value:"services",get children(){return[t(B,{name:"terminal"}),"Services"]}}),null),s(j,()=>e.t("app.name.desktop")),s(F,()=>l.version,null),n}}),t(L.Content,{value:"general",class:"no-scrollbar",get children(){return t(St,{})}}),t(L.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return t(Nt,{})}}),t(L.Content,{value:"providers",class:"no-scrollbar",get children(){return t(Jt,{})}}),t(L.Content,{value:"models",class:"no-scrollbar",get children(){return t(sr,{})}}),t(L.Content,{value:"services",class:"no-scrollbar",get children(){return t(pr,{})}})]}})}})};export{kr as DialogSettings};
1
+ import{l as s,t as p,bm as Se,f as ee,b as he,bn as me,o as ve,H as ce,i as O,m as t,A as Ce,Y as Pe,I as B,S as C,n as V,p as se,bo as Te,bp as Ee,bq as ze,br as Fe,$ as ie,B as J,bs as je,bt as Ae,bu as De,J as R,bv as Ke,v as be,aI as Oe,P as xe,Q as $e,F as q,y as Le,q as H,V as Ie,bw as We,aL as Me,c as Ne,z as Ge,u as Re,a7 as Be,a8 as ne,bx as Ve,a2 as qe,h as ue,O as Ue,by as He,bz as Ye,bA as Je,bB as Qe,s as Xe,bC as Ze,bD as et,bE as tt,bF as rt,G as st}from"./index-DKwABhnu.js";import{T as L}from"./tabs-CKNlwTKd.js";import{S as U}from"./select-BbwOgh1Q.js";import{S as M}from"./switch-CHySmW8J.js";import{L as nt,D as it}from"./dialog-connect-provider-Ot6Qr5dL.js";import{f as lt,u as at}from"./list-DPJi0fzr.js";import{P as re,T as te}from"./tag-C4xikCZp.js";import{a as ot,D as ct}from"./dialog-select-provider-CBq6hNDx.js";import"./chunk-VVM5DH6Z-D2vG_ZPx.js";var dt=p('<div class="bg-surface-base px-4 rounded-lg">');const N=r=>(()=>{var e=dt();return s(e,()=>r.children),e})();var ut=p("<div data-action=settings-feed-reasoning-summaries>"),gt=p("<div data-action=settings-feed-shell-tool-parts-expanded>"),pt=p("<div data-action=settings-feed-edit-tool-parts-expanded>"),ft=p('<div class="flex flex-col gap-1">'),ge=p('<div class="w-full sm:w-[220px]">'),X=p('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ht=p("<div data-action=settings-notifications-agent>"),mt=p("<div data-action=settings-notifications-permissions>"),vt=p("<div data-action=settings-notifications-errors>"),bt=p("<div data-action=settings-updates-startup>"),xt=p("<div data-action=settings-release-notes>"),$t=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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"></h2></div></div><div class="flex flex-col gap-8 w-full">'),_t=p("<div data-action=settings-wayland>"),wt=p("<span class=text-text-weak>"),yt=p('<div class="flex items-center gap-2"><span>'),kt=p('<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 G={cleanup:void 0,timeout:void 0,run:0};const _e=()=>{G.run+=1,G.cleanup&&G.cleanup(),clearTimeout(G.timeout),G.cleanup=void 0},pe=r=>{if(_e(),!r)return;const e=++G.run;G.timeout=setTimeout(()=>{Ke(r).then(l=>{if(G.run!==e){l?.();return}G.cleanup=l})},100)},St=()=>{const r=Se(),e=ee(),l=he(),n=me();ve(()=>{r.loadThemes()});const[o,f]=ce({checking:!1}),y=O(()=>l.platform==="desktop"&&l.os==="linux"),x=()=>{l.checkUpdate&&(f("checking",!0),l.checkUpdate().then(c=>{if(!c.updateAvailable){R({variant:"success",icon:"circle-check",title:e.t("settings.updates.toast.latest.title"),description:e.t("settings.updates.toast.latest.description",{version:l.version??""})});return}const a=l.update&&l.restart?[{label:e.t("toast.update.action.installRestart"),onClick:async()=>{await l.update(),await l.restart()}},{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}]:[{label:e.t("toast.update.action.notYet"),onClick:"dismiss"}];R({persistent:!0,icon:"download",title:e.t("toast.update.title"),description:e.t("toast.update.description",{version:c.version??""}),actions:a})}).catch(c=>{const a=c instanceof Error?c.message:String(c);R({title:e.t("common.requestFailed"),description:a})}).finally(()=>f("checking",!1)))},b=O(()=>r.ids().map(c=>({id:c,name:r.name(c)}))),$=O(()=>[{value:"system",label:e.t("theme.scheme.system")},{value:"light",label:e.t("theme.scheme.light")},{value:"dark",label:e.t("theme.scheme.dark")}]),P=O(()=>[{value:"queue",label:e.t("settings.general.row.followup.option.queue")},{value:"steer",label:e.t("settings.general.row.followup.option.steer")}]),F=O(()=>e.locales.map(c=>({value:c,label:e.label(c)}))),A={id:"none",label:"sound.option.none"},D=[A,...De],v=()=>Ae(n.appearance.font()),h=()=>je(n.appearance.uiFont()),d=(c,a,i,u)=>({options:D,current:c()?D.find(g=>g.id===a())??A:A,value:g=>g.id,label:g=>e.t(g.label),onHighlight:g=>{g&&pe(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){i(!1),_e();return}i(!0),u(g.id),pe(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),m=()=>(()=>{var c=ft();return s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.row.language.title")},get description(){return e.t("settings.general.row.language.description")},get children(){return t(U,{"data-action":"settings-language",get options(){return F()},get current(){return F().find(a=>a.value===e.locale())},value:a=>a.value,label:a=>a.label,onSelect:a=>a&&e.setLocale(a.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),t(E,{get title(){return e.t("settings.general.row.reasoningSummaries.title")},get description(){return e.t("settings.general.row.reasoningSummaries.description")},get children(){var a=ut();return s(a,t(M,{get checked(){return n.general.showReasoningSummaries()},onChange:i=>n.general.setShowReasoningSummaries(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return e.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var a=gt();return s(a,t(M,{get checked(){return n.general.shellToolPartsExpanded()},onChange:i=>n.general.setShellToolPartsExpanded(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.editToolPartsExpanded.title")},get description(){return e.t("settings.general.row.editToolPartsExpanded.description")},get children(){var a=pt();return s(a,t(M,{get checked(){return n.general.editToolPartsExpanded()},onChange:i=>n.general.setEditToolPartsExpanded(i)})),a}}),t(E,{get title(){return e.t("settings.general.row.followup.title")},get description(){return e.t("settings.general.row.followup.description")},get children(){return t(U,{"data-action":"settings-followup",get options(){return P()},get current(){return P().find(a=>a.value===n.general.followup())},value:a=>a.value,label:a=>a.label,onSelect:a=>a&&n.general.setFollowup(a.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}})]}})),c})(),k=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.appearance")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.row.colorScheme.title")},get description(){return e.t("settings.general.row.colorScheme.description")},get children(){return t(U,{"data-action":"settings-color-scheme",get options(){return $()},get current(){return $().find(i=>i.value===r.colorScheme())},value:i=>i.value,label:i=>i.label,onSelect:i=>i&&r.setColorScheme(i.value),onHighlight:i=>{if(i)return r.previewColorScheme(i.value),()=>r.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),t(E,{get title(){return e.t("settings.general.row.theme.title")},get description(){return[V(()=>e.t("settings.general.row.theme.description"))," ",t(nt,{href:"https://opencode.ai/docs/themes/",get children(){return e.t("common.learnMore")}})]},get children(){return t(U,{"data-action":"settings-theme",get options(){return b()},get current(){return b().find(i=>i.id===r.themeId())},value:i=>i.id,label:i=>i.name,onSelect:i=>{i&&r.setTheme(i.id)},onHighlight:i=>{if(i)return r.previewTheme(i.id),()=>r.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings"})}}),t(E,{get title(){return e.t("settings.general.row.uiFont.title")},get description(){return e.t("settings.general.row.uiFont.description")},get children(){var i=ge();return s(i,t(se,{"data-action":"settings-ui-font",get label(){return e.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return h()},onChange:u=>n.appearance.setUIFont(u),placeholder:Te,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ee(n.appearance.uiFont())}}})),i}}),t(E,{get title(){return e.t("settings.general.row.font.title")},get description(){return e.t("settings.general.row.font.description")},get children(){var i=ge();return s(i,t(se,{"data-action":"settings-code-font",get label(){return e.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return v()},onChange:u=>n.appearance.setFont(u),placeholder:ze,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Fe(n.appearance.font())}}})),i}})]}}),null),c})(),j=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.notifications")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.notifications.agent.title")},get description(){return e.t("settings.general.notifications.agent.description")},get children(){var i=ht();return s(i,t(M,{get checked(){return n.notifications.agent()},onChange:u=>n.notifications.setAgent(u)})),i}}),t(E,{get title(){return e.t("settings.general.notifications.permissions.title")},get description(){return e.t("settings.general.notifications.permissions.description")},get children(){var i=mt();return s(i,t(M,{get checked(){return n.notifications.permissions()},onChange:u=>n.notifications.setPermissions(u)})),i}}),t(E,{get title(){return e.t("settings.general.notifications.errors.title")},get description(){return e.t("settings.general.notifications.errors.description")},get children(){var i=vt();return s(i,t(M,{get checked(){return n.notifications.errors()},onChange:u=>n.notifications.setErrors(u)})),i}})]}}),null),c})(),S=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.sounds")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.general.sounds.agent.title")},get description(){return e.t("settings.general.sounds.agent.description")},get children(){return t(U,ie({"data-action":"settings-sounds-agent"},()=>d(()=>n.sounds.agentEnabled(),()=>n.sounds.agent(),i=>n.sounds.setAgentEnabled(i),i=>n.sounds.setAgent(i))))}}),t(E,{get title(){return e.t("settings.general.sounds.permissions.title")},get description(){return e.t("settings.general.sounds.permissions.description")},get children(){return t(U,ie({"data-action":"settings-sounds-permissions"},()=>d(()=>n.sounds.permissionsEnabled(),()=>n.sounds.permissions(),i=>n.sounds.setPermissionsEnabled(i),i=>n.sounds.setPermissions(i))))}}),t(E,{get title(){return e.t("settings.general.sounds.errors.title")},get description(){return e.t("settings.general.sounds.errors.description")},get children(){return t(U,ie({"data-action":"settings-sounds-errors"},()=>d(()=>n.sounds.errorsEnabled(),()=>n.sounds.errors(),i=>n.sounds.setErrorsEnabled(i),i=>n.sounds.setErrors(i))))}})]}}),null),c})(),_=()=>(()=>{var c=X(),a=c.firstChild;return s(a,()=>e.t("settings.general.section.updates")),s(c,t(N,{get children(){return[t(E,{get title(){return e.t("settings.updates.row.startup.title")},get description(){return e.t("settings.updates.row.startup.description")},get children(){var i=bt();return s(i,t(M,{get checked(){return n.updates.startup()},get disabled(){return!l.checkUpdate},onChange:u=>n.updates.setStartup(u)})),i}}),t(E,{get title(){return e.t("settings.general.row.releaseNotes.title")},get description(){return e.t("settings.general.row.releaseNotes.description")},get children(){var i=xt();return s(i,t(M,{get checked(){return n.general.releaseNotes()},onChange:u=>n.general.setReleaseNotes(u)})),i}}),t(E,{get title(){return e.t("settings.updates.row.check.title")},get description(){return e.t("settings.updates.row.check.description")},get children(){return t(J,{size:"small",variant:"secondary",get disabled(){return o.checking||!l.checkUpdate},onClick:x,get children(){return V(()=>!!o.checking)()?e.t("settings.updates.action.checking"):e.t("settings.updates.action.checkNow")}})}})]}}),null),c})();return(()=>{var c=$t(),a=c.firstChild,i=a.firstChild,u=i.firstChild,g=a.nextSibling;return s(u,()=>e.t("settings.tab.general")),s(g,t(m,{}),null),s(g,t(k,{}),null),s(g,t(j,{}),null),s(g,t(S,{}),null),s(g,t(_,{}),null),s(g,t(C,{get when(){return y()},children:w=>{const[z,K]=Ce(()=>l.getDisplayBackend?.()),I=()=>z.state==="pending"?void 0:z.latest,T=W=>l.setDisplayBackend?.(W?"wayland":"auto").finally(()=>K.refetch());return(()=>{var W=X(),ye=W.firstChild;return s(ye,()=>e.t("settings.general.section.display")),s(W,t(N,{get children(){return t(E,{get title(){return(()=>{var Y=yt(),ke=Y.firstChild;return s(ke,()=>e.t("settings.general.row.wayland.title")),s(Y,t(Pe,{get value(){return e.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var de=wt();return s(de,t(B,{name:"help",size:"small"})),de}}),null),Y})()},get description(){return e.t("settings.general.row.wayland.description")},get children(){var Y=_t();return s(Y,t(M,{get checked(){return I()==="wayland"},onChange:T})),Y}})}}),null),W})()}}),null),c})()},E=r=>(()=>{var e=kt(),l=e.firstChild,n=l.firstChild,o=n.nextSibling,f=l.nextSibling;return s(n,()=>r.title),s(o,()=>r.description),s(f,()=>r.children),e})();var Ct=p('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Pt=p('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Tt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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-4 pt-6 pb-6 max-w-[720px]"><div class="flex items-center justify-between gap-4"><h2 class="text-16-medium text-text-strong"></h2></div><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),Et=p('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),zt=p('<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),Q="command.palette",Ft="mod+shift+p",Z=["General","Session","Navigation","Model and agent","Terminal","Prompt","Editor","File","View","App"],jt={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",Editor:"settings.shortcuts.group.editor",File:"settings.shortcuts.group.file",View:"settings.shortcuts.group.view",App:"settings.shortcuts.group.app"};function ae(r){return r===Q?"General":r.startsWith("terminal.")?"Terminal":r.startsWith("model.")||r.startsWith("agent.")||r.startsWith("mcp.")?"Model and agent":r.startsWith("file.")||r.startsWith("fileTree.")||r.startsWith("folder.")?"File":r.startsWith("prompt.")?"Prompt":r.startsWith("editor.")?"Editor":r.startsWith("view.")?"View":r.startsWith("app.")?"App":r.startsWith("tab.")?"Navigation":r.startsWith("session.")||r.startsWith("message.")||r.startsWith("permissions.")||r.startsWith("steps.")||r.startsWith("review.")?"Session":"General"}function At(r){return r==="Shift"||r==="Control"||r==="Alt"||r==="Meta"}function Dt(r){return r===","?"comma":r==="+"?"plus":r===" "?"space":r.toLowerCase()}function Kt(r){if(At(r.key))return;const e=[];(le?r.metaKey:r.ctrlKey)&&e.push("mod"),le&&r.ctrlKey&&e.push("ctrl"),!le&&r.metaKey&&e.push("meta"),r.altKey&&e.push("alt"),r.shiftKey&&e.push("shift");const n=Dt(r.key);if(n)return e.push(n),e.join("+")}function oe(r){if(!r)return[];const e=[];for(const l of We(r)){const n=[];l.ctrl&&n.push("ctrl"),l.alt&&n.push("alt"),l.shift&&n.push("shift"),l.meta&&n.push("meta"),l.key&&n.push(l.key),n.length!==0&&e.push(n.join("+"))}return e}function Ot(r){return!r||typeof r!="object"||Array.isArray(r)?{}:r}function Lt(r,e,l){const n=new Map;n.set(Q,{title:l,group:"General"});for(const o of r.catalog)o.id.startsWith("suggested.")||n.set(o.id,{title:o.title,group:ae(o.id)});for(const o of r.options)o.id.startsWith("suggested.")||n.set(o.id,{title:o.title,group:ae(o.id)});for(const[o,f]of Object.entries(e))typeof f=="string"&&(n.has(o)||n.set(o,{title:o,group:ae(o)}));return n}function It(r){const e=new Map;for(const l of Z)e.set(l,[]);for(const[l,n]of r){const o=e.get(n.group);o&&o.push(l)}for(const l of Z){const n=e.get(l);n&&n.sort((o,f)=>(r.get(o)?.title??"").localeCompare(r.get(f)?.title??""))}return e}function Wt(r,e,l,n){const o=r.toLowerCase().trim();if(!o)return l;const f=new Map;for(const b of Z)f.set(b,[]);const y=Array.from(e.entries()).map(([b,$])=>({id:b,title:$.title,group:$.group,keybind:n(b)})),x=lt.go(o,y,{keys:["title","keybind"],threshold:-1e4});for(const b of x){const $=f.get(b.obj.group);$&&$.push(b.obj.id)}return f}function Mt(r){ve(()=>{const e=l=>{const n=r.active();if(!n)return;if(l.preventDefault(),l.stopPropagation(),l.stopImmediatePropagation(),l.key==="Escape"){r.stop();return}if((l.key==="Backspace"||l.key==="Delete")&&!l.ctrlKey&&!l.metaKey&&!l.altKey&&!l.shiftKey){r.set(n,"none"),r.stop();return}const f=Kt(l);if(!f)return;const y=new Map;for(const x of oe(f))for(const b of r.used().get(x)??[])b.id!==n&&y.set(b.id,b.title);if(y.size>0){R({title:r.language.t("settings.shortcuts.conflict.title"),description:r.language.t("settings.shortcuts.conflict.description",{keybind:Me(f,r.language.t),titles:[...y.values()].join(", ")})});return}r.set(n,f),r.stop()};document.addEventListener("keydown",e,!0),xe(()=>document.removeEventListener("keydown",e,!0))})}const Nt=()=>{const r=Oe(),e=ee(),l=me(),[n,o]=ce({active:null,filter:""}),f=()=>{n.active&&(o("active",null),r.keybinds(!0))},y=m=>{if(n.active===m){f();return}n.active&&f(),o("active",m),r.keybinds(!1)},x=O(()=>Ot(l.current.keybinds)),b=O(()=>Object.values(x()).some(m=>typeof m=="string")),$=()=>{f(),l.keybinds.resetAll(),R({title:e.t("settings.shortcuts.reset.toast.title"),description:e.t("settings.shortcuts.reset.toast.description")})},P=O(()=>(e.locale(),Lt(r,x(),e.t("command.palette")))),F=m=>P().get(m)?.title??"",A=O(()=>It(P())),D=O(()=>Wt(n.filter,P(),A(),m=>r.keybind(m)||"")),v=O(()=>{for(const m of Z)if((D().get(m)??[]).length>0)return!0;return!1}),h=O(()=>{const m=new Map,k=(_,c)=>{const a=m.get(_);if(!a){m.set(_,[c]);return}a.push(c)},j=l.keybinds.get(Q)??Ft;for(const _ of oe(j))k(_,{id:Q,title:F(Q)});const S=_=>{const c=l.keybinds.get(_);if(typeof c=="string")return c;const a=r.options.find(u=>u.id===_);return a?.keybind?a.keybind:r.catalog.find(u=>u.id===_)?.keybind};for(const _ of P().keys())if(_!==Q)for(const c of oe(S(_)))k(c,{id:_,title:F(_)});return m});return Mt({active:()=>n.active,stop:f,set:(m,k)=>l.keybinds.set(m,k),used:h,language:e}),xe(()=>{n.active&&r.keybinds(!0)}),(()=>{var m=Tt(),k=m.firstChild,j=k.firstChild,S=j.firstChild,_=S.firstChild,c=S.nextSibling,a=k.nextSibling;return s(_,()=>e.t("settings.shortcuts.title")),s(S,t(J,{size:"small",variant:"secondary",onClick:$,get disabled(){return!b()},get children(){return e.t("settings.shortcuts.reset.button")}}),null),s(c,t(B,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),s(c,t(se,{variant:"ghost",type:"text",get value(){return n.filter},onChange:i=>o("filter",i),get placeholder(){return e.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),s(c,t(C,{get when(){return n.filter},get children(){return t($e,{icon:"circle-x",variant:"ghost",onClick:()=>o("filter","")})}}),null),s(a,t(q,{each:Z,children:i=>t(C,{get when(){return(D().get(i)??[]).length>0},get children(){var u=Et(),g=u.firstChild;return s(g,()=>e.t(jt[i])),s(u,t(N,{get children(){return t(q,{get each(){return D().get(i)??[]},children:w=>(()=>{var z=zt(),K=z.firstChild,I=K.nextSibling;return s(K,()=>F(w)),I.$$click=()=>y(w),Le(I,"data-keybind-id",w),s(I,t(C,{get when(){return n.active===w},get fallback(){return r.keybind(w)||e.t("settings.shortcuts.unassigned")},get children(){return e.t("settings.shortcuts.pressKeys")}})),H(T=>Ie(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":n.active!==w,"border border-border-weak-base bg-surface-inset-base text-text-weak":n.active===w},T)),z})()})}}),null),u}})}),null),s(a,t(C,{get when(){return V(()=>!!n.filter)()&&!v()},get children(){var i=Pt(),u=i.firstChild;return s(u,()=>e.t("settings.shortcuts.search.empty")),s(i,t(C,{get when(){return n.filter},get children(){var g=Ct(),w=g.firstChild,z=w.nextSibling;return z.nextSibling,s(g,()=>n.filter,z),g}}),null),i}}),null),m})()};be(["click"]);var Gt=p('<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">'),Rt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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"></h2></div></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">'),Bt=p('<div class="py-4 text-14-regular text-text-weak">'),Vt=p('<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">'),qt=p('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Ut=p('<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">'),Ht=p('<span class="text-12-regular text-text-weak pl-8">');const Yt=[{match:r=>r==="opencode",key:"dialog.provider.opencode.note"},{match:r=>r==="opencode-go",key:"dialog.provider.opencodeGo.tagline"},{match:r=>r==="anthropic",key:"dialog.provider.anthropic.note"},{match:r=>r.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:r=>r==="openai",key:"dialog.provider.openai.note"},{match:r=>r==="google",key:"dialog.provider.google.note"},{match:r=>r==="openrouter",key:"dialog.provider.openrouter.note"},{match:r=>r==="vercel",key:"dialog.provider.vercel.note"}],Jt=()=>{const r=Ne(),e=ee(),l=Ge(),n=Re(),o=Be(),f=O(()=>o.connected().filter(v=>v.id!=="opencode"||Object.values(v.models).find(h=>h.cost?.input))),y=O(()=>{const v=new Set(f().map(d=>d.id)),h=o.popular().filter(d=>!v.has(d.id)).slice();return h.sort((d,m)=>ne.indexOf(d.id)-ne.indexOf(m.id)),h}),x=v=>{if(!("source"in v))return;const h=v.source;if(h==="env"||h==="api"||h==="config"||h==="custom")return h},b=v=>{const h=x(v);return h==="env"?e.t("settings.providers.tag.environment"):h==="api"?e.t("provider.connect.method.apiKey"):h==="config"?F(v.id)?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.config"):h==="custom"?e.t("settings.providers.tag.custom"):e.t("settings.providers.tag.other")},$=v=>x(v)!=="env",P=v=>Yt.find(h=>h.match(v))?.key,F=v=>{const h=n.data.config.provider?.[v];return!(!h||h.npm!=="@ai-sdk/openai-compatible"||!h.models||Object.keys(h.models).length===0)},A=async(v,h)=>{const d=n.data.config.disabled_providers??[],m=d.includes(v)?d:[...d,v];n.set("config","disabled_providers",m),await n.updateConfig({disabled_providers:m}).then(()=>{R({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(k=>{n.set("config","disabled_providers",d);const j=k instanceof Error?k.message:String(k);R({title:e.t("common.requestFailed"),description:j})})},D=async(v,h)=>{if(F(v)){await l.client.auth.remove({providerID:v}).catch(()=>{}),await A(v,h);return}await l.client.auth.remove({providerID:v}).then(async()=>{await l.client.global.dispose(),R({variant:"success",icon:"circle-check",title:e.t("provider.disconnect.toast.disconnected.title",{provider:h}),description:e.t("provider.disconnect.toast.disconnected.description",{provider:h})})}).catch(d=>{const m=d instanceof Error?d.message:String(d);R({title:e.t("common.requestFailed"),description:m})})};return(()=>{var v=Rt(),h=v.firstChild,d=h.firstChild,m=d.firstChild,k=h.nextSibling,j=k.firstChild,S=j.firstChild,_=j.nextSibling,c=_.firstChild;return s(m,()=>e.t("settings.providers.title")),s(S,()=>e.t("settings.providers.section.connected")),s(j,t(N,{get children(){return t(C,{get when(){return f().length>0},get fallback(){return(()=>{var a=Bt();return s(a,()=>e.t("settings.providers.connected.empty")),a})()},get children(){return t(q,{get each(){return f()},children:a=>(()=>{var i=Vt(),u=i.firstChild,g=u.firstChild;return s(u,t(re,{get id(){return a.id},class:"size-5 shrink-0 icon-strong-base"}),g),s(g,()=>a.name),s(u,t(te,{get children(){return b(a)}}),null),s(i,t(C,{get when(){return $(a)},get fallback(){return(()=>{var w=qt();return s(w,()=>e.t("settings.providers.connected.environmentDescription")),w})()},get children(){return t(J,{size:"large",variant:"ghost",onClick:()=>void D(a.id,a.name),get children(){return e.t("common.disconnect")}})}}),null),i})()})}})}}),null),s(c,()=>e.t("settings.providers.section.popular")),s(_,t(N,{get children(){return[t(q,{get each(){return y()},children:a=>(()=>{var i=Ut(),u=i.firstChild,g=u.firstChild,w=g.firstChild;return s(g,t(re,{get id(){return a.id},class:"size-5 shrink-0 icon-strong-base"}),w),s(w,()=>a.name),s(g,t(C,{get when(){return a.id==="opencode"},get children(){return t(te,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),s(g,t(C,{get when(){return a.id==="opencode-go"},get children(){return t(te,{get children(){return e.t("dialog.provider.tag.recommended")}})}}),null),s(u,t(C,{get when(){return P(a.id)},children:z=>(()=>{var K=Ht();return s(K,()=>e.t(z())),K})()}),null),s(i,t(J,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{r.show(()=>t(it,{get provider(){return a.id}}))},get children(){return e.t("common.connect")}}),null),i})()}),(()=>{var a=Gt(),i=a.firstChild,u=i.firstChild,g=u.firstChild,w=u.nextSibling;return s(u,t(re,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),g),s(g,()=>e.t("provider.custom.title")),s(u,t(te,{get children(){return e.t("settings.providers.tag.custom")}}),null),s(w,()=>e.t("settings.providers.custom.description")),s(a,t(J,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{r.show(()=>t(ot,{back:"close"}))},get children(){return e.t("common.connect")}}),null),a})()]}}),null),s(_,t(J,{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:()=>{r.show(()=>t(ct,{}))},get children(){return e.t("dialog.provider.viewAll")}}),null),v})()};var we=p('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Qt=p('<span class="text-14-regular text-text-strong mt-1">&quot;<!>&quot;'),Xt=p('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><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-4 pt-6 pb-6 max-w-[720px]"><h2 class="text-16-medium text-text-strong"></h2><div class="flex items-center gap-2 px-3 h-9 rounded-lg bg-surface-base"></div></div></div><div class="flex flex-col gap-8 max-w-[720px]">'),Zt=p('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),er=p('<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></div><div class=flex-shrink-0>');const tr=r=>(()=>{var e=we(),l=e.firstChild;return s(l,()=>r.label),e})(),rr=r=>(()=>{var e=we(),l=e.firstChild;return s(l,()=>r.message),s(e,t(C,{get when(){return r.filter},get children(){var n=Qt(),o=n.firstChild,f=o.nextSibling;return f.nextSibling,s(n,()=>r.filter,f),n}}),null),e})(),sr=()=>{const r=ee(),e=Ve(),l=at({items:n=>e.list(),key:n=>`${n.provider.id}:${n.id}`,filterKeys:["provider.name","name","id"],sortBy:(n,o)=>n.name.localeCompare(o.name),groupBy:n=>n.provider.id,sortGroupsBy:(n,o)=>{const f=ne.indexOf(n.category),y=ne.indexOf(o.category),x=f>=0,b=y>=0;if(x&&!b)return-1;if(!x&&b)return 1;if(x&&b)return f-y;const $=n.items[0].provider.name,P=o.items[0].provider.name;return $.localeCompare(P)}});return(()=>{var n=Xt(),o=n.firstChild,f=o.firstChild,y=f.firstChild,x=y.nextSibling,b=o.nextSibling;return s(y,()=>r.t("settings.models.title")),s(x,t(B,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),s(x,t(se,{variant:"ghost",type:"text",get value(){return l.filter()},get onChange(){return l.onInput},get placeholder(){return r.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),s(x,t(C,{get when(){return l.filter()},get children(){return t($e,{icon:"circle-x",variant:"ghost",get onClick(){return l.clear}})}}),null),s(b,t(C,{get when(){return!l.grouped.loading},get fallback(){return t(tr,{get label(){return`${r.t("common.loading")}${r.t("common.loading.ellipsis")}`}})},get children(){return t(C,{get when(){return l.flat().length>0},get fallback(){return t(rr,{get message(){return r.t("dialog.model.empty")},get filter(){return l.filter()}})},get children(){return t(q,{get each(){return l.grouped.latest},children:$=>(()=>{var P=Zt(),F=P.firstChild,A=F.firstChild;return s(F,t(re,{get id(){return $.category},class:"size-5 shrink-0 icon-strong-base"}),A),s(A,()=>$.items[0].provider.name),s(P,t(N,{get children(){return t(q,{get each(){return $.items},children:D=>{const v={providerID:D.provider.id,modelID:D.id};return(()=>{var h=er(),d=h.firstChild,m=d.firstChild,k=d.nextSibling;return s(m,()=>D.name),s(k,t(M,{get checked(){return e.visible(v)},onChange:j=>{e.setVisibility(v,j)},hideLabel:!0,get children(){return D.name}})),h})()}})}}),null),P})()})}})}})),n})()};var fe=p("<div class=settings-services-list>"),nr=p("<div class=settings-services-drafts-title>New services (add to opencode.jsonc)"),ir=p('<div class=settings-services-hint>Copy the configuration above into your <code>opencode.jsonc</code> under the <code>"preview"</code> key.'),lr=p("<div class=settings-services-empty>No preview services configured. Click <strong>Auto-detect</strong> to scan your project or <strong>Add</strong> to configure manually."),ar=p("<div class=settings-services><div class=settings-services-header><div><div class=settings-services-title>Preview Services</div><div class=settings-services-desc>Configure dev servers and preview services for this project.</div></div><div class=settings-services-actions><button class=settings-services-btn></button><button class=settings-services-btn>Add"),or=p("<span class=settings-services-port>:"),cr=p("<button class=settings-services-icon-btn title=Stop>"),dr=p("<button class=settings-services-icon-btn title=Start>"),ur=p("<div class=settings-services-item><span class=settings-services-dot></span><span class=settings-services-name></span><span class=settings-services-cmd></span><div class=settings-services-item-actions>"),gr=p('<div class=settings-services-draft><input class="settings-services-input settings-services-input--name"placeholder=name><select class=settings-services-select><option value=web>web</option><option value=api>api</option><option value=terminal>terminal</option></select><input class="settings-services-input settings-services-input--port"placeholder=port type=number><input class="settings-services-input settings-services-input--cmd"placeholder=command><button class="settings-services-icon-btn settings-services-rm">');function pr(){const r=qe(),e=O(()=>`?directory=${encodeURIComponent(r.directory)}`),[l,n]=ue([]),[o,f]=ce([]),[y,x]=ue(!1),b=async()=>{try{const d=await r.fetch(`${r.url}/preview/services${e()}`);d.ok&&n(await d.json())}catch{}};Ue(()=>{b()});const $=async d=>{await r.fetch(`${r.url}/preview/services/${d}/start${e()}`,{method:"POST"}),await b()},P=async d=>{await r.fetch(`${r.url}/preview/services/${d}/stop${e()}`,{method:"POST"}),await b()},F=async()=>{x(!0);try{const d=await r.fetch(`${r.url}/preview/infer${e()}`,{method:"POST"});if(d.ok){const m=await d.json(),k=new Set(l().map(S=>S.name)),j=m.filter(S=>!k.has(S.name)).map(S=>({name:S.name,port:String(S.port),type:S.type,command:S.command}));f([...o,...j])}}finally{x(!1)}},A=()=>f([...o,{name:"",port:"3000",type:"web",command:""}]),D=d=>f(o.filter((m,k)=>k!==d)),v=d=>d==="web"?et:d==="api"?tt:rt,h=d=>d==="running"?"var(--color-green-500)":d==="starting"?"var(--color-yellow-500)":d==="error"?"var(--color-red-500)":"var(--text-weaker)";return(()=>{var d=ar(),m=d.firstChild,k=m.firstChild,j=k.nextSibling,S=j.firstChild,_=S.nextSibling,c=_.firstChild;return S.$$click=()=>void F(),s(S,t(He,{class:"size-3.5"}),null),s(S,()=>y()?"Scanning…":"Auto-detect",null),_.$$click=A,s(_,t(Ye,{class:"size-3.5"}),c),s(d,t(C,{get when(){return l().length>0},get children(){var a=fe();return s(a,t(q,{get each(){return l()},children:i=>{const u=v(i.type);return(()=>{var g=ur(),w=g.firstChild,z=w.nextSibling,K=z.nextSibling,I=K.nextSibling;return s(g,t(u,{class:"size-3.5 text-icon-weak"}),z),s(z,()=>i.name),s(g,t(C,{get when(){return i.port},get children(){var T=or();return T.firstChild,s(T,()=>i.port,null),T}}),K),s(K,()=>i.command),s(I,t(C,{get when(){return i.status==="running"},get children(){var T=cr();return T.$$click=()=>void P(i.name),s(T,t(Je,{class:"size-3.5"})),T}}),null),s(I,t(C,{get when(){return i.status==="stopped"},get children(){var T=dr();return T.$$click=()=>void $(i.name),s(T,t(Qe,{class:"size-3.5"})),T}}),null),H(T=>Xe(w,"background",h(i.status))),g})()}})),a}}),null),s(d,t(C,{get when(){return o.length>0},get children(){return[nr(),(()=>{var a=fe();return s(a,t(q,{each:o,children:(i,u)=>(()=>{var g=gr(),w=g.firstChild,z=w.nextSibling,K=z.nextSibling,I=K.nextSibling,T=I.nextSibling;return w.$$input=W=>f(u(),"name",W.currentTarget.value),z.addEventListener("change",W=>f(u(),"type",W.currentTarget.value)),K.$$input=W=>f(u(),"port",W.currentTarget.value),I.$$input=W=>f(u(),"command",W.currentTarget.value),T.$$click=()=>D(u()),s(T,t(Ze,{class:"size-3.5"})),H(()=>w.value=i.name),H(()=>z.value=i.type),H(()=>K.value=i.port),H(()=>I.value=i.command),g})()})),a})(),ir()]}}),null),s(d,t(C,{get when(){return V(()=>l().length===0)()&&o.length===0},get children(){return lr()}}),null),H(()=>S.disabled=y()),d})()}be(["click","input"]);var fr=p('<div class="flex flex-col justify-between h-full w-full"><div class="flex flex-col gap-3 w-full pt-3"><div class="flex flex-col gap-3"><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div><div class="flex flex-col gap-1.5"><div class="flex flex-col gap-1.5 w-full"></div></div></div></div><div class="flex flex-col gap-1 pl-1 py-1 text-12-medium text-text-weak"><span></span><span class=text-11-regular>v');const kr=r=>{const e=ee(),l=he();return t(st,{size:"x-large",transition:!0,get children(){return t(L,{orientation:"vertical",variant:"settings",get defaultValue(){return r.tab??"general"},class:"h-full settings-dialog",get children(){return[t(L.List,{get children(){var n=fr(),o=n.firstChild,f=o.firstChild,y=f.firstChild,x=y.firstChild,b=y.nextSibling,$=b.firstChild,P=o.nextSibling,F=P.firstChild,A=F.nextSibling;return A.firstChild,s(y,t(L.SectionTitle,{get children(){return e.t("settings.section.desktop")}}),x),s(x,t(L.Trigger,{value:"general",get children(){return[t(B,{name:"sliders"}),V(()=>e.t("settings.tab.general"))]}}),null),s(x,t(L.Trigger,{value:"shortcuts",get children(){return[t(B,{name:"keyboard"}),V(()=>e.t("settings.tab.shortcuts"))]}}),null),s(b,t(L.SectionTitle,{get children(){return e.t("settings.section.server")}}),$),s($,t(L.Trigger,{value:"providers",get children(){return[t(B,{name:"providers"}),V(()=>e.t("settings.providers.title"))]}}),null),s($,t(L.Trigger,{value:"models",get children(){return[t(B,{name:"models"}),V(()=>e.t("settings.models.title"))]}}),null),s($,t(L.Trigger,{value:"services",get children(){return[t(B,{name:"terminal"}),"Services"]}}),null),s(F,()=>e.t("app.name.desktop")),s(A,()=>l.version,null),n}}),t(L.Content,{value:"general",class:"no-scrollbar",get children(){return t(St,{})}}),t(L.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return t(Nt,{})}}),t(L.Content,{value:"providers",class:"no-scrollbar",get children(){return t(Jt,{})}}),t(L.Content,{value:"models",class:"no-scrollbar",get children(){return t(sr,{})}}),t(L.Content,{value:"services",class:"no-scrollbar",get children(){return t(pr,{})}})]}})}})};export{kr as DialogSettings};