midsomar 0.1.2 → 0.1.4
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.
- package/package.json +1 -1
- package/web-ui/assets/dialog-connect-provider-DLnpNUTc.js +1 -1
- package/web-ui/assets/dialog-settings-C0ClHN8Q.js +1 -1
- package/web-ui/assets/index-BfNxi3ev.js +7 -7
- package/web-ui/assets/index-wflYMX4p.js +1 -1
- package/web-ui/assets/sprite-Chb7ocDN.svg +2 -2
- package/web-ui/index.html +1 -1
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c6 as et,bI as tt,bJ as rt,bc as nt,b6 as t,bL as S,aR as Te,bV as Ue,ch as je,cg as Ve,b_ as se,aL as ne,c2 as ot,bG as ke,au as e,N as be,aa as Q,u as he,aH as ve,bF as re,o as pe,B as ae,ba as xe,b as Ae,am as _e,by as ue,ck as Ie,j as it,f as lt,a2 as U,I as De,h as at,d as st,bQ as Ze,M as T,a5 as ie,ca as ct,c4 as dt,c9 as Le,bl as ut,aD as A,aI as vt,ax as pt,a3 as me,aq as ge,a8 as $e,bw as de,L as Ce,aQ as gt,aN as ze,bm as fe,ab as Se,a as Ee,bo as mt}from"./index-BfNxi3ev.js";var ft=S("<a>");function le(l){const B=et(),[h,u]=tt(l,["href","children","class"]);return(()=>{var s=ft();return s.$$click=$=>{h.href&&($.preventDefault(),B.openLink(h.href))},rt(s,nt({get href(){return h.href},get class(){return`text-text-strong underline ${h.class??""}`}},u),!1,!0),t(s,()=>h.children),s})()}Te(["click"]);const ht=/^[a-z0-9][a-z0-9-_]*$/,xt="@ai-sdk/openai-compatible";function bt(l){const B=l.form.providerID.trim(),h=l.form.name.trim(),u=l.form.baseURL.trim(),s=l.form.apiKey.trim(),$=s.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),n=s&&!$?s:void 0,j=B?ht.test(B)?void 0:l.t("provider.custom.error.providerID.format"):l.t("provider.custom.error.providerID.required"),c=h?void 0:l.t("provider.custom.error.name.required"),D=u?/^https?:\/\//.test(u)?void 0:l.t("provider.custom.error.baseURL.format"):l.t("provider.custom.error.baseURL.required"),M=l.disabledProviders.includes(B),E=j?void 0:l.existingProviderIDs.has(B)&&!M?l.t("provider.custom.error.providerID.exists"):void 0,C=new Set,K=l.form.models.map(m=>{const F=m.id.trim(),q=F?C.has(F)?l.t("provider.custom.error.duplicate"):(()=>{C.add(F)})():l.t("provider.custom.error.required"),P=m.name.trim()?void 0:l.t("provider.custom.error.required");return{id:q,name:P}}),R=K.every(m=>!m.id&&!m.name),X=Object.fromEntries(l.form.models.map(m=>[m.id.trim(),{name:m.name.trim()}])),w=new Set,i=l.form.headers.map(m=>{const F=m.key.trim(),q=m.value.trim();if(!F&&!q)return{};const P=F?w.has(F.toLowerCase())?l.t("provider.custom.error.duplicate"):(()=>{w.add(F.toLowerCase())})():l.t("provider.custom.error.required"),J=q?void 0:l.t("provider.custom.error.required");return{key:P,value:J}}),v=i.every(m=>!m.key&&!m.value),f=Object.fromEntries(l.form.headers.map(m=>({key:m.key.trim(),value:m.value.trim()})).filter(m=>!!m.key&&!!m.value).map(m=>[m.key,m.value])),V={providerID:j??E,name:c,baseURL:D};return!j&&!E&&!c&&!D&&R&&v?{err:V,models:K,headers:i,result:{providerID:B,name:h,key:n,config:{npm:xt,name:h,...$?{env:[$]}:{},options:{baseURL:u,...Object.keys(f).length?{headers:f}:{}},models:X}}}:{err:V,models:K,headers:i}}let yt=0;const He=()=>`row-${yt++}`,Ke=()=>({row:He(),id:"",name:"",err:{}}),Re=()=>({row:He(),key:"",value:"",err:{}});var _t=S('<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">'),qe=S('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Wt(l){const B=se();return e(Ae,{class:"h-full",get title(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",get onClick(){return l.onBack},get"aria-label"(){return B.t("common.goBack")}})},transition:!0,get children(){return e(Ge,{})}})}function Ge(l={}){const B=Ue(),h=je(),u=Ve(),s=se(),[$,n]=ne({providerID:"",name:"",baseURL:"",apiKey:"",models:[Ke()],headers:[Re()],err:{}}),j=()=>{n("models",ue(i=>{i.push(Ke())}))},c=i=>{$.models.length<=1||n("models",ue(v=>{v.splice(i,1)}))},D=()=>{n("headers",ue(i=>{i.push(Re())}))},M=i=>{$.headers.length<=1||n("headers",ue(v=>{v.splice(i,1)}))},E=(i,v)=>{n(i,v),i!=="apiKey"&&n("err",i,void 0)},C=(i,v,f)=>{_e(()=>{n("models",i,v,f),n("models",i,"err",v,void 0)})},K=(i,v,f)=>{_e(()=>{n("headers",i,v,f),n("headers",i,"err",v,void 0)})},R=()=>{const i=bt({form:$,t:s.t,disabledProviders:h().data.config.disabled_providers??[],existingProviderIDs:new Set(h().data.provider.all.keys())});return _e(()=>{n("err",i.err),i.models.forEach((v,f)=>n("models",f,"err",v)),i.headers.forEach((v,f)=>n("headers",f,"err",v))}),i.result},X=ot(()=>({mutationFn:async i=>{if(await u().protocol!=="v1")throw new Error("Custom providers are unavailable on this server");const f=(h().data.config.disabled_providers??[]).filter(V=>V!==i.providerID);return i.key&&await u().client.auth.set({providerID:i.providerID,auth:{type:"api",key:i.key}}),await h().updateConfig({provider:{[i.providerID]:i.config},disabled_providers:f}),i},onSuccess:i=>{B.close(),ke({variant:"success",icon:"circle-check",title:s.t("provider.connect.toast.connected.title",{provider:i.name}),description:s.t("provider.connect.toast.connected.description",{provider:i.name})})},onError:i=>{const v=i instanceof Error?i.message:String(i);ke({title:s.t("common.requestFailed"),description:v})}})),w=i=>{if(i.preventDefault(),X.isPending)return;const v=R();v&&X.mutate(v)};return(()=>{var i=_t(),v=i.firstChild,f=v.firstChild,V=v.nextSibling,I=V.firstChild,m=I.nextSibling,F=m.nextSibling,q=F.firstChild,P=F.nextSibling,J=P.firstChild;return t(v,e(be,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),f),t(f,()=>s.t("provider.custom.title")),V.addEventListener("submit",w),t(I,()=>s.t("provider.custom.description.prefix"),null),t(I,e(le,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return s.t("provider.custom.description.link")}}),null),t(I,()=>s.t("provider.custom.description.suffix"),null),t(m,e(Q,{get autofocus(){return l.autofocus??!0},get label(){return s.t("provider.custom.field.providerID.label")},get placeholder(){return s.t("provider.custom.field.providerID.placeholder")},get description(){return s.t("provider.custom.field.providerID.description")},get value(){return $.providerID},onChange:p=>E("providerID",p),get validationState(){return $.err.providerID?"invalid":void 0},get error(){return $.err.providerID}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.name.label")},get placeholder(){return s.t("provider.custom.field.name.placeholder")},get value(){return $.name},onChange:p=>E("name",p),get validationState(){return $.err.name?"invalid":void 0},get error(){return $.err.name}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.baseURL.label")},get placeholder(){return s.t("provider.custom.field.baseURL.placeholder")},get value(){return $.baseURL},onChange:p=>E("baseURL",p),get validationState(){return $.err.baseURL?"invalid":void 0},get error(){return $.err.baseURL}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.apiKey.label")},get placeholder(){return s.t("provider.custom.field.apiKey.placeholder")},get description(){return s.t("provider.custom.field.apiKey.description")},get value(){return $.apiKey},onChange:p=>E("apiKey",p)}),null),t(q,()=>s.t("provider.custom.models.label")),t(F,e(pe,{get each(){return $.models},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.id.placeholder")},get value(){return p.id},onChange:te=>C(G(),"id",te),get validationState(){return p.err.id?"invalid":void 0},get error(){return p.err.id}})),t(Y,e(Q,{get label(){return s.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.name.placeholder")},get value(){return p.name},onChange:te=>C(G(),"name",te),get validationState(){return p.err.name?"invalid":void 0},get error(){return p.err.name}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>c(G()),get disabled(){return $.models.length<=1},get"aria-label"(){return s.t("provider.custom.models.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(F,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:j,class:"self-start",get children(){return s.t("provider.custom.models.add")}}),null),t(J,()=>s.t("provider.custom.headers.label")),t(P,e(pe,{get each(){return $.headers},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.key.placeholder")},get value(){return p.key},onChange:te=>K(G(),"key",te),get validationState(){return p.err.key?"invalid":void 0},get error(){return p.err.key}})),t(Y,e(Q,{get label(){return s.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.value.placeholder")},get value(){return p.value},onChange:te=>K(G(),"value",te),get validationState(){return p.err.value?"invalid":void 0},get error(){return p.err.value}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>M(G()),get disabled(){return $.headers.length<=1},get"aria-label"(){return s.t("provider.custom.headers.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(P,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:D,class:"self-start",get children(){return s.t("provider.custom.headers.add")}}),null),t(V,e(ae,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return X.isPending},get children(){return xe(()=>!!X.isPending)()?s.t("common.saving"):s.t("common.submit")}}),null),i})()}var $t=S('<button type=button class="flex size-5 items-center justify-center rounded-sm text-v2-icon-icon-muted hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none">'),wt=S('<div tabindex=-1 class="flex min-h-0 flex-1 flex-col outline-none">'),Be=S('<div class="text-14-regular text-text-weak">'),kt=S('<div class="px-1.25 w-full flex items-center gap-x-3"><span>'),Ct=S('<div class="flex h-24 items-center justify-center text-[13px] font-[440] text-v2-text-text-muted">'),St=S('<div class="flex min-h-0 flex-1 flex-col gap-4"><div class="shrink-0 px-1 pt-px"></div><div class="relative min-h-0 flex-1"><div class="flex size-full min-h-0 flex-col gap-4 overflow-y-auto pb-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"></div><div class="pointer-events-none absolute inset-x-0 bottom-0 h-10"style="background:linear-gradient(to bottom, transparent, var(--v2-background-bg-layer-01))">'),It=S('<section class="flex flex-col"><div class="px-3 pb-2 text-[13px] font-[440] leading-none tracking-[-0.04px] text-v2-text-text-muted">'),Dt=S('<span class="min-w-0 truncate font-[440] text-v2-text-text-muted">'),Me=S('<span class="flex h-4 shrink-0 items-center rounded-xs border-[0.5px] border-v2-border-border-base bg-v2-background-bg-layer-03 px-1 text-[11px] font-[530] leading-none tracking-[0.05px] text-v2-text-text-muted">'),Lt=S('<button type=button class="flex min-h-9 w-full items-center gap-2 rounded-md px-3 py-2.5 text-left text-[13px] leading-none tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus:bg-v2-overlay-simple-overlay-hover focus:outline-none"><span class="min-w-0 truncate font-[530] text-v2-text-text-base">'),Pt=S('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),zt=S('<form class="flex flex-col items-start gap-4">'),Et=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Kt=S('<div class="flex flex-col gap-2"><div class="px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"></div><div class="flex flex-col">'),Rt=S('<button type=button class="group flex h-9 w-full items-center gap-2 rounded-md px-3 text-left text-[13px] leading-5 tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none"><span class="flex h-2 w-4 shrink-0 items-center justify-center rounded-[1px] bg-v2-background-bg-base shadow-[var(--v2-elevation-button-neutral)]"><span class="hidden h-0.5 w-2.5 bg-v2-icon-icon-base group-hover:block group-focus-visible:block"></span></span><span class="font-[530] text-v2-text-text-base">'),qt=S('<span class="font-[440] text-v2-text-text-muted">'),Fe=S('<div class="text-14-regular text-text-base">'),Bt=S("<div>"),Mt=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),Ft=S('<div class="flex flex-col gap-5"><div></div><div></div><div>'),Ot=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Oe=S('<div role=alert class="-mt-4 text-xs text-v2-state-fg-danger">'),Tt=S('<div class="flex flex-col gap-4"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base">'),Ut=S('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),jt=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><div></div><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Vt=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),At=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),we=S('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Zt=S("<div><div><div></div></div><div><div>");const ee="_custom";function Ne(l={}){const[B,h]=ne({selected:void 0}),u=()=>h("selected",void 0);return{selected:()=>B.selected,select:s=>h("selected",s),back:l.onBack??u}}const Ht=l=>{const B=Ne(),h=l.controller??B,u=se(),$=Ie().general.newLayoutDesigns,n=h.back,j={current:n};let c;const D=()=>c?.focus({preventScroll:!0}),M=C=>{j.current=n,h.select(C)};function E(){return e(ie,{get children(){return[e(T,{get when(){return h.selected()===ee},get children(){return e(Ge,{get autofocus(){return!$()}})}}),e(T,{get when(){return xe(()=>!!(h.selected()&&h.selected()!==ee))()?h.selected():void 0},children:C=>e(Qt,{get provider(){return C()},get directory(){return l.directory},onBack:n,setBack:K=>j.current=K})}),e(T,{when:!0,get children(){return e(Gt,{get directory(){return l.directory},onSelect:M,get onPrepare(){return $()?D:void 0}})}})]}})}return e(U,{get when(){return $()},get fallback(){return e(Ae,{class:"h-full",transition:!0,get title(){return e(U,{get when(){return h.selected()},get fallback(){return u.t("command.provider.connect")},get children(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:()=>j.current(),get"aria-label"(){return u.t("common.goBack")}})}})},get children(){return e(E,{})}})},get children(){return e(it,{containerClass:"!h-[min(calc(100vh_-_16px),512px)] !w-[min(calc(100vw_-_16px),640px)]",class:"[font-family:var(--v2-font-family-sans)] [&_[data-slot=dialog-header]]:!px-5 [&_[data-slot=dialog-header-title]]:!text-[15px] [&_[data-slot=dialog-header-title]]:!tracking-[-0.13px]",get children(){return[e(lt,{get closeLabel(){return u.t("common.close")},get children(){return e(U,{get when(){return h.selected()},get fallback(){return e(at,{get children(){return u.t("command.provider.connect")}})},get children(){var C=$t();return C.$$click=()=>j.current(),t(C,e(De,{name:"arrow-left",size:"small"})),ve(()=>re(C,"aria-label",u.t("common.goBack"))),C}})}}),e(st,{class:"min-h-0 flex-1 overflow-hidden px-2 pb-2",get children(){var C=wt(),K=c;return typeof K=="function"?Ze(K,C):c=C,t(C,e(E,{})),C}})]}})}})};function Gt(l){if(Ie().general.newLayoutDesigns())return e(Nt,{get directory(){return l.directory},get onSelect(){return l.onSelect},get onPrepare(){return l.onPrepare}});const h=Le(()=>l.directory?.()),u=se(),s=()=>u.t("dialog.provider.group.popular"),$=()=>u.t("dialog.provider.group.other"),n=()=>u.t("settings.providers.tag.custom"),j=c=>{if(c==="anthropic")return u.t("dialog.provider.anthropic.note");if(c==="openai")return u.t("dialog.provider.openai.note");if(c.startsWith("github-copilot"))return u.t("dialog.provider.copilot.note");if(c==="opencode-go")return u.t("dialog.provider.opencodeGo.tagline")};return e(Ce,{class:"px-3",get search(){return{placeholder:u.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.provider.empty")},activeIcon:"plus-small",key:c=>c?.id,items:()=>(u.locale(),[{id:ee,name:n()},...h.all().values()]),filterKeys:["id","name"],groupBy:c=>de.includes(c.id)?s():$(),sortBy:(c,D)=>c.id===ee?-1:D.id===ee?1:de.includes(c.id)&&de.includes(D.id)?de.indexOf(c.id)-de.indexOf(D.id):c.name.localeCompare(D.name),sortGroupsBy:(c,D)=>{const M=s();return c.category===M&&D.category!==M?-1:D.category===M&&c.category!==M?1:0},onSelect:c=>{c&&l.onSelect(c.id)},children:c=>(()=>{var D=kt(),M=D.firstChild;return t(D,e(be,{"data-slot":"list-item-extra-icon",get id(){return c.id}}),M),t(M,()=>c.name),t(D,e(U,{get when(){return c.id==="opencode"},get children(){var E=Be();return t(E,()=>u.t("dialog.provider.opencode.tagline")),E}}),null),t(D,e(U,{get when(){return c.id===ee},get children(){return e($e,{get children(){return u.t("settings.providers.tag.custom")}})}}),null),t(D,e(U,{get when(){return c.id==="opencode"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),t(D,e(U,{get when(){return j(c.id)},children:E=>(()=>{var C=Be();return t(C,E),C})()}),null),t(D,e(U,{get when(){return c.id==="opencode-go"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),D})()})}function Nt(l){const B=Le(()=>l.directory?.()),h=se(),[u,s]=ne({filter:"",active:void 0,connecting:void 0}),$=["opencode","opencode-go","anthropic","openai","google","openrouter","vercel"],n=()=>({id:ee,name:h.t("dialog.provider.custom.label")}),j=A(()=>{h.locale();const w=u.filter.trim().toLowerCase(),i=[n(),...B.all().values()];return w?i.filter(v=>`${v.id} ${v.name}`.toLowerCase().includes(w)):i}),c=A(()=>j().filter(w=>$.includes(w.id)).sort((w,i)=>$.indexOf(w.id)-$.indexOf(i.id))),D=A(()=>j().filter(w=>!$.includes(w.id)).sort((w,i)=>w.id===ee?-1:i.id===ee?1:w.name.localeCompare(i.name))),M=A(()=>[...c(),...D()]);let E,C;fe(()=>C?.focus({preventScroll:!0}));const K=w=>{l.onPrepare?.(),l.onSelect(w)},R=(w,i)=>{const v=M();if(v.length===0)return;const f=v.findIndex(I=>I.id===u.active),V=f<0?i>0?0:v.length-1:(f+i+v.length)%v.length;s("active",v[V].id),E?.querySelector(`[data-provider-id="${CSS.escape(v[V].id)}"]`)?.focus({preventScroll:!0}),w.preventDefault()},X=w=>{if(w.key==="ArrowDown")return R(w,1);if(w.key==="ArrowUp")return R(w,-1);w.key!=="Enter"||!u.active||(K(u.active),w.preventDefault())};return(()=>{var w=St(),i=w.firstChild,v=i.nextSibling,f=v.firstChild;f.nextSibling,w.$$keydown=X;var V=E;return typeof V=="function"?Ze(V,w):E=w,t(i,e(Se,{ref(I){var m=C;typeof m=="function"?m(I):C=I},type:"search",class:"!w-full [font-family:var(--v2-font-family-sans)]",get leadingIcon(){return e(De,{name:"magnifying-glass",size:"small"})},get placeholder(){return h.t("dialog.provider.search.placeholder")},get value(){return u.filter},onInput:I=>{s({filter:I.currentTarget.value,active:void 0})}})),t(f,e(pe,{get each(){return[{title:h.t("dialog.provider.group.popular"),items:c},{title:h.t("dialog.provider.group.other"),items:D}]},children:I=>e(U,{get when(){return I.items().length>0},get children(){var m=It(),F=m.firstChild;return t(F,()=>I.title),t(m,e(pe,{get each(){return I.items()},children:q=>(()=>{var P=Lt(),J=P.firstChild;return P.$$click=()=>K(q.id),P.addEventListener("mouseenter",()=>s("active",q.id)),t(P,e(be,{get id(){return q.id},class:"size-4 shrink-0 text-v2-icon-icon-base"}),J),t(J,()=>q.name),t(P,e(U,{get when(){return q.id==="opencode"||q.id==="opencode-go"},get children(){return[(()=>{var p=Dt();return t(p,()=>h.t(q.id==="opencode"?"dialog.provider.opencode.tagline":"dialog.provider.opencodeGo.tagline")),p})(),(()=>{var p=Me();return t(p,()=>h.t("dialog.provider.tag.recommended")),p})()]}}),null),t(P,e(U,{get when(){return q.id===ee},get children(){var p=Me();return t(p,()=>h.t("settings.providers.tag.custom")),p}}),null),t(P,e(U,{get when(){return u.connecting===q.id},get children(){return e(me,{class:"ml-auto size-4 shrink-0 text-v2-icon-icon-muted"})}}),null),ve(p=>{var G=q.id,Z=u.active===q.id,W=u.connecting!==void 0,Y=u.connecting===q.id;return G!==p.e&&re(P,"data-provider-id",p.e=G),Z!==p.t&&P.classList.toggle("bg-v2-overlay-simple-overlay-hover",p.t=Z),W!==p.a&&(P.disabled=p.a=W),Y!==p.o&&re(P,"aria-busy",p.o=Y),p},{e:void 0,t:void 0,a:void 0,o:void 0}),P})()}),null),m}})}),null),t(f,e(U,{get when(){return M().length===0},get children(){var I=Ct();return t(I,()=>h.t("dialog.provider.empty")),I}}),null),w})()}function Qt(l){const B=Ue(),h=je(),u=Ve(),s=ct(),$=dt(),n=se(),c=Ie().general.newLayoutDesigns,D=Le(()=>l.directory?.()),M=()=>l.directory?.()??gt($.dir),E=()=>{const r=M();return r?{directory:r}:void 0},C={value:!0},K={current:void 0};ut(()=>{C.value=!1,K.current!==void 0&&(clearTimeout(K.current),K.current=void 0)});const R=A(()=>D.all().get(l.provider)??h().data.provider.all.get(l.provider)),X=A(()=>[{type:"key",label:n.t("provider.connect.method.apiKey")}]),[w]=vt(()=>({provider:l.provider,directory:M()}),r=>u().api.integration.get({integrationID:r.provider,location:r.directory?{directory:r.directory}:void 0}).then(o=>o.data)),i=A(()=>w.loading),v=A(()=>{const r=w.latest?.methods.filter(o=>o.type==="key"||o.type==="oauth");return r?.length?r:X()}),[f,V]=ne({methodIndex:void 0,authorization:void 0,promptInputs:void 0,state:"pending",error:void 0});function I(r){V(ue(o=>{if(r.type==="method.select"){o.methodIndex=r.index,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="method.reset"){o.methodIndex=void 0,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="auth.prompt"){o.state="prompt",o.error=void 0;return}if(r.type==="auth.inputs"){o.promptInputs=r.inputs,o.state=void 0,o.error=void 0;return}if(r.type==="auth.pending"){o.state="pending",o.error=void 0;return}if(r.type==="auth.complete"){o.state="complete",o.authorization=r.authorization,o.error=void 0;return}o.state="error",o.error=r.error}))}const m=A(()=>f.methodIndex!==void 0?v().at(f.methodIndex):void 0),F=r=>r?r.type==="key"?n.t("provider.connect.method.apiKey"):r.label??"":"",q=r=>{const o=F(r),a=r?.label?.match(/\s+\((browser|headless)\)$/i),y=a?.[1];return{label:a?o.slice(0,-a[0].length):o,hint:y?y[0].toUpperCase()+y.slice(1):r?.type==="key"?"Browser":void 0}};function P(r,o){if(r&&typeof r=="object"&&"data"in r){const a=r.data;if(typeof a?.message=="string"&&a.message)return a.message}if(r&&typeof r=="object"&&"error"in r){const a=P(r.error,"");if(a)return a}if(r&&typeof r=="object"&&"message"in r){const a=r.message;if(typeof a=="string"&&a)return a}return r instanceof Error&&r.message?r.message:typeof r=="string"&&r?r:o}async function J(r,o){K.current!==void 0&&(clearTimeout(K.current),K.current=void 0);const a=v()[r];if(I({type:"method.select",index:r}),a.type==="oauth"){if(a.prompts?.length&&!o){I({type:"auth.prompt"});return}I({type:"auth.pending"}),await u().api.integration.oauth.connect({integrationID:l.provider,methodID:a.id,inputs:o??{},location:E()}).then(y=>{C.value&&I({type:"auth.complete",authorization:y.data})}).catch(y=>{C.value&&I({type:"auth.error",error:P(y,n.t("common.requestFailed"))})})}}function p(){const[r,o]=ne({value:{},index:0}),a=A(()=>{const _=m();return _?.type==="oauth"?_.prompts??[]:[]}),y=(_,O)=>{if(!_.when)return!0;const H=O[_.when.key];return H===void 0?!1:_.when.op==="eq"?H===_.when.value:H!==_.when.value},z=A(()=>{const _=a(),O=_.findIndex((H,ce)=>ce>=r.index&&y(H,r.value));if(O!==-1)return{index:O,prompt:_[O]}}),d=A(()=>{const _=z();return!_||_.prompt.type!=="text"?!1:(r.value[_.prompt.key]??"").trim().length>0});async function g(_,O){if(f.methodIndex===void 0)return;const H=a().findIndex((ce,N)=>N>_&&y(ce,O));if(H!==-1){o("index",H);return}await J(f.methodIndex,O)}async function x(_){_.preventDefault();const O=z();!O||O.prompt.type!=="text"||d()&&await g(O.index,r.value)}const b=()=>z(),k=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="text"))return _}),L=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="select"))return _});return(()=>{var _=zt();return _.addEventListener("submit",x),t(_,e(ie,{get children(){return[e(T,{get when(){return b()?.prompt.type==="text"},get children(){return[e(Q,{type:"text",get label(){return k()?.message??""},get placeholder(){return k()?.placeholder},get value(){return xe(()=>!!k())()?r.value[k().key]??"":""},onChange:O=>{const H=k();H&&o("value",H.key,O)}}),e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!d()},get children(){return n.t("common.continue")}})]}}),e(T,{get when(){return b()?.prompt.type==="select"},get children(){var O=Pt(),H=O.firstChild,ce=H.nextSibling;return t(H,()=>L()?.message),t(ce,e(Ce,{class:"px-3",get items(){return L()?.options??[]},key:N=>N.value,get current(){return L()?.options.find(N=>N.value===r.value[L().key])},onSelect:N=>{if(!N)return;const oe=L();if(!oe)return;const ye={...r.value,[oe.key]:N.value};o("value",oe.key,N.value),g(b().index,ye)},children:N=>(()=>{var oe=Et(),ye=oe.firstChild,Pe=ye.nextSibling,Ye=Pe.nextSibling;return t(Pe,()=>N.label),t(Ye,()=>N.hint),oe})()})),O}})]}})),_})()}let G;function Z(r){r.key==="Enter"&&r.target instanceof HTMLInputElement||r.key!=="Escape"&&G?.onKeyDown(r)}let W=!1;pt(()=>{W||i()||v().length===1&&(W=!0,J(0))});async function Y(){const r=M();await s.refetchQueries(h().queryOptions.providers(r?mt(r):null)).catch(()=>{}),B.close(),ke({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:R().name}),description:n.t("provider.connect.toast.connected.description",{provider:R().name})})}function te(){if(v().length>1&&f.methodIndex!==void 0){I({type:"method.reset"});return}l.onBack()}l.setBack(te);function Qe(){return c()?(()=>{var r=Kt(),o=r.firstChild,a=o.nextSibling;return t(o,()=>n.t("provider.connect.selectMethod",{provider:R().name})),t(a,e(pe,{get each(){return v()},children:(y,z)=>{const d=()=>q(y);return(()=>{var g=Rt(),x=g.firstChild,b=x.nextSibling;return g.$$click=()=>void J(z()),t(b,()=>d().label),t(g,e(U,{get when(){return d().hint},children:k=>(()=>{var L=qt();return t(L,k),L})()}),null),g})()}})),r})():[(()=>{var r=Fe();return t(r,()=>n.t("provider.connect.selectMethod",{provider:R().name})),r})(),(()=>{var r=Bt();return t(r,e(Ce,{class:"px-3",ref:o=>{G=o},items:v,key:o=>o?.label??o?.type,onSelect:async(o,a)=>{o&&J(a)},children:o=>(()=>{var a=Mt(),y=a.firstChild,z=y.nextSibling;return t(z,()=>F(o)),a})()})),r})()]}function Je(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("apiKey");if(!b?.trim()){y("error",n.t("provider.connect.apiKey.required"));return}y("error",void 0),await u().api.integration.connect.key({integrationID:l.provider,location:E(),key:b}),await Y()}return c()?(()=>{var d=Ot(),g=d.firstChild,x=g.firstChild;return t(d,e(U,{get when(){return R().id==="opencode"},get fallback(){return n.t("provider.connect.apiKey.description",{provider:R().name})},get children(){var b=Ft(),k=b.firstChild,L=k.nextSibling,_=L.nextSibling;return t(k,()=>n.t("provider.connect.opencodeZen.line1")),t(L,()=>n.t("provider.connect.opencodeZen.line2")),t(_,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(_,e(le,{href:"https://",class:"text-v2-text-text-base focus-visible:rounded-xs focus-visible:outline-2 focus-visible:outline-v2-border-border-focus",get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(_,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),b}}),g),g.addEventListener("submit",z),t(x,()=>n.t("provider.connect.apiKey.label",{provider:R().name}),null),t(x,e(Se,{ref(b){var k=r;typeof k=="function"?k(b):r=b},class:"!w-full",name:"apiKey","data-input":"provider-api-key",get placeholder(){return n.t("provider.connect.apiKey.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:b=>y("value",b.currentTarget.value)}),null),t(g,e(U,{get when(){return a.error},children:b=>(()=>{var k=Oe();return re(k,"id",o),t(k,b),k})()}),null),t(g,e(Ee,{type:"submit",variant:"contrast","data-action":"provider-connect-submit",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Ut(),g=d.firstChild;return t(d,e(ie,{get children(){return[e(T,{get when(){return R().id==="opencode"},get children(){var x=Tt(),b=x.firstChild,k=b.nextSibling,L=k.nextSibling;return t(b,()=>n.t("provider.connect.opencodeZen.line1")),t(k,()=>n.t("provider.connect.opencodeZen.line2")),t(L,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(L,e(le,{href:"https://",tabIndex:-1,get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(L,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),x}}),e(T,{when:!0,get children(){var x=Fe();return t(x,()=>n.t("provider.connect.apiKey.description",{provider:R().name})),x}})]}}),g),g.addEventListener("submit",z),t(g,e(Q,{get autofocus(){return!c()},ref(x){var b=r;typeof b=="function"?b(x):r=x},type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:R().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return a.value},onChange:x=>y("value",x),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(g,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function We(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("code");if(!b?.trim()){y("error",n.t("provider.connect.oauth.code.required"));return}y("error",void 0);const k=await u().api.integration.oauth.complete({integrationID:l.provider,attemptID:f.authorization.attemptID,location:E(),code:b}).then(()=>({ok:!0})).catch(L=>({ok:!1,error:L}));if(k.ok){await Y();return}y("error",P(k.error,n.t("provider.connect.oauth.code.invalid")))}return c()?(()=>{var d=jt(),g=d.firstChild,x=g.nextSibling,b=x.firstChild;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},class:"text-v2-text-text-base",get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(b,()=>n.t("provider.connect.oauth.code.label",{method:m()?.label??""}),null),t(b,e(Se,{ref(k){var L=r;typeof L=="function"?L(k):r=k},class:"!w-full",name:"code",get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:k=>y("value",k.currentTarget.value)}),null),t(x,e(U,{get when(){return a.error},children:k=>(()=>{var L=Oe();return re(L,"id",o),t(L,k),L})()}),null),t(x,e(Ee,{type:"submit",variant:"contrast",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Vt(),g=d.firstChild,x=g.nextSibling;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(x,e(Q,{get autofocus(){return!c()},ref(b){var k=r;typeof k=="function"?k(b):r=b},type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:m()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return a.value},onChange:b=>y("value",b),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(x,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function Xe(){const r=A(()=>{const o=f.authorization?.instructions;return o?.includes(":")?o.split(":").pop()?.trim():o});return fe(()=>{const o=async()=>{const a=f.authorization;if(!a||!C.value)return;const y=await u().api.integration.oauth.status({integrationID:l.provider,attemptID:a.attemptID,location:E()}).then(z=>({ok:!0,status:z.data})).catch(z=>({ok:!1,error:z}));if(C.value){if(!y.ok){I({type:"auth.error",error:P(y.error,n.t("common.requestFailed"))});return}if(y.status.status==="complete"){await Y();return}if(y.status.status==="failed"){I({type:"auth.error",error:y.status.message});return}if(y.status.status==="expired"){I({type:"auth.error",error:n.t("common.requestFailed")});return}K.current=setTimeout(o,1e3)}};o()}),(()=>{var o=At(),a=o.firstChild,y=a.nextSibling,z=y.firstChild;return t(a,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),t(a,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),t(a,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:R().name}),null),t(o,e(Q,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return r()},readOnly:!0,copyable:!0}),y),t(y,e(me,{}),z),t(z,()=>n.t("provider.connect.status.waiting")),o})()}return(()=>{var r=Zt(),o=r.firstChild,a=o.firstChild,y=o.nextSibling,z=y.firstChild;return t(o,e(be,{get id(){return l.provider},get class(){return c()?"mt-0.5 size-4 shrink-0 text-v2-icon-icon-base":"size-5 shrink-0 icon-strong-base"}}),a),t(a,e(ie,{get children(){return[e(T,{get when(){return xe(()=>l.provider==="anthropic")()&&m()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),e(T,{when:!0,get children(){return n.t("provider.connect.title",{provider:R().name})}})]}})),z.$$keydown=Z,t(z,e(ie,{get children(){return[e(T,{get when(){return i()},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.methodIndex===void 0},get children(){return e(Qe,{})}}),e(T,{get when(){return f.state==="pending"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.state==="prompt"},get children(){return e(p,{})}}),e(T,{get when(){return f.state==="error"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(De,{name:"circle-ban-sign",class:"text-icon-critical-base"}),x),t(x,()=>n.t("provider.connect.status.failed",{error:f.error??""})),d}}),e(T,{get when(){return m()?.type==="key"},get children(){return e(Je,{})}}),e(T,{get when(){return m()?.type==="oauth"},get children(){return e(ie,{get children(){return[e(T,{get when(){return f.authorization?.mode==="code"},get children(){return e(We,{})}}),e(T,{get when(){return f.authorization?.mode==="auto"},get children(){return e(Xe,{})}})]}})}})]}})),ve(d=>{var g=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-3",x=c()?"flex h-10 shrink-0 items-start gap-2 px-3":"flex items-center gap-4 px-2.5",b=c()?"text-[15px] font-[530] leading-5 tracking-[-0.13px] text-v2-text-text-base":"text-16-medium text-text-strong",k=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-10",L=c()?void 0:0,_=!c()&&f.methodIndex===void 0?!0:void 0;return g!==d.e&&ge(r,d.e=g),x!==d.t&&ge(o,d.t=x),b!==d.a&&ge(a,d.a=b),k!==d.o&&ge(y,d.o=k),L!==d.i&&re(z,"tabindex",d.i=L),_!==d.n&&(z.autofocus=d.n=_),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})()}Te(["click","keydown"]);const Xt=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ht,useProviderConnectController:Ne},Symbol.toStringTag,{value:"Module"}));export{Ht as D,le as L,Wt as a,Xt as d,Ne as u};
|
|
1
|
+
import{c6 as et,bI as tt,bJ as rt,bc as nt,b6 as t,bL as S,aR as Te,bV as Ue,ch as je,cg as Ve,b_ as se,aL as ne,c2 as ot,bG as ke,au as e,N as be,aa as Q,u as he,aH as ve,bF as re,o as pe,B as ae,ba as xe,b as Ae,am as _e,by as ue,ck as Ie,j as it,f as lt,a2 as U,I as De,h as at,d as st,bQ as Ze,M as T,a5 as ie,ca as ct,c4 as dt,c9 as Le,bl as ut,aD as A,aI as vt,ax as pt,a3 as me,aq as ge,a8 as $e,bw as de,L as Ce,aQ as gt,aN as ze,bm as fe,ab as Se,a as Ee,bo as mt}from"./index-BfNxi3ev.js";var ft=S("<a>");function le(l){const B=et(),[h,u]=tt(l,["href","children","class"]);return(()=>{var s=ft();return s.$$click=$=>{h.href&&($.preventDefault(),B.openLink(h.href))},rt(s,nt({get href(){return h.href},get class(){return`text-text-strong underline ${h.class??""}`}},u),!1,!0),t(s,()=>h.children),s})()}Te(["click"]);const ht=/^[a-z0-9][a-z0-9-_]*$/,xt="@ai-sdk/openai-compatible";function bt(l){const B=l.form.providerID.trim(),h=l.form.name.trim(),u=l.form.baseURL.trim(),s=l.form.apiKey.trim(),$=s.match(/^\{env:([^}]+)\}$/)?.[1]?.trim(),n=s&&!$?s:void 0,j=B?ht.test(B)?void 0:l.t("provider.custom.error.providerID.format"):l.t("provider.custom.error.providerID.required"),c=h?void 0:l.t("provider.custom.error.name.required"),D=u?/^https?:\/\//.test(u)?void 0:l.t("provider.custom.error.baseURL.format"):l.t("provider.custom.error.baseURL.required"),M=l.disabledProviders.includes(B),E=j?void 0:l.existingProviderIDs.has(B)&&!M?l.t("provider.custom.error.providerID.exists"):void 0,C=new Set,K=l.form.models.map(m=>{const F=m.id.trim(),q=F?C.has(F)?l.t("provider.custom.error.duplicate"):(()=>{C.add(F)})():l.t("provider.custom.error.required"),P=m.name.trim()?void 0:l.t("provider.custom.error.required");return{id:q,name:P}}),R=K.every(m=>!m.id&&!m.name),X=Object.fromEntries(l.form.models.map(m=>[m.id.trim(),{name:m.name.trim()}])),w=new Set,i=l.form.headers.map(m=>{const F=m.key.trim(),q=m.value.trim();if(!F&&!q)return{};const P=F?w.has(F.toLowerCase())?l.t("provider.custom.error.duplicate"):(()=>{w.add(F.toLowerCase())})():l.t("provider.custom.error.required"),J=q?void 0:l.t("provider.custom.error.required");return{key:P,value:J}}),v=i.every(m=>!m.key&&!m.value),f=Object.fromEntries(l.form.headers.map(m=>({key:m.key.trim(),value:m.value.trim()})).filter(m=>!!m.key&&!!m.value).map(m=>[m.key,m.value])),V={providerID:j??E,name:c,baseURL:D};return!j&&!E&&!c&&!D&&R&&v?{err:V,models:K,headers:i,result:{providerID:B,name:h,key:n,config:{npm:xt,name:h,...$?{env:[$]}:{},options:{baseURL:u,...Object.keys(f).length?{headers:f}:{}},models:X}}}:{err:V,models:K,headers:i}}let yt=0;const He=()=>`row-${yt++}`,Ke=()=>({row:He(),id:"",name:"",err:{}}),Re=()=>({row:He(),key:"",value:"",err:{}});var _t=S('<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">'),qe=S('<div class="flex gap-2 items-start"><div class=flex-1></div><div class=flex-1>');function Wt(l){const B=se();return e(Ae,{class:"h-full",get title(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",get onClick(){return l.onBack},get"aria-label"(){return B.t("common.goBack")}})},transition:!0,get children(){return e(Ge,{})}})}function Ge(l={}){const B=Ue(),h=je(),u=Ve(),s=se(),[$,n]=ne({providerID:"",name:"",baseURL:"",apiKey:"",models:[Ke()],headers:[Re()],err:{}}),j=()=>{n("models",ue(i=>{i.push(Ke())}))},c=i=>{$.models.length<=1||n("models",ue(v=>{v.splice(i,1)}))},D=()=>{n("headers",ue(i=>{i.push(Re())}))},M=i=>{$.headers.length<=1||n("headers",ue(v=>{v.splice(i,1)}))},E=(i,v)=>{n(i,v),i!=="apiKey"&&n("err",i,void 0)},C=(i,v,f)=>{_e(()=>{n("models",i,v,f),n("models",i,"err",v,void 0)})},K=(i,v,f)=>{_e(()=>{n("headers",i,v,f),n("headers",i,"err",v,void 0)})},R=()=>{const i=bt({form:$,t:s.t,disabledProviders:h().data.config.disabled_providers??[],existingProviderIDs:new Set(h().data.provider.all.keys())});return _e(()=>{n("err",i.err),i.models.forEach((v,f)=>n("models",f,"err",v)),i.headers.forEach((v,f)=>n("headers",f,"err",v))}),i.result},X=ot(()=>({mutationFn:async i=>{if(await u().protocol!=="v1")throw new Error("Custom providers are unavailable on this server");const f=(h().data.config.disabled_providers??[]).filter(V=>V!==i.providerID);return i.key&&await u().client.auth.set({providerID:i.providerID,auth:{type:"api",key:i.key}}),await h().updateConfig({provider:{[i.providerID]:i.config},disabled_providers:f}),i},onSuccess:i=>{B.close(),ke({variant:"success",icon:"circle-check",title:s.t("provider.connect.toast.connected.title",{provider:i.name}),description:s.t("provider.connect.toast.connected.description",{provider:i.name})})},onError:i=>{const v=i instanceof Error?i.message:String(i);ke({title:s.t("common.requestFailed"),description:v})}})),w=i=>{if(i.preventDefault(),X.isPending)return;const v=R();v&&X.mutate(v)};return(()=>{var i=_t(),v=i.firstChild,f=v.firstChild,V=v.nextSibling,I=V.firstChild,m=I.nextSibling,F=m.nextSibling,q=F.firstChild,P=F.nextSibling,J=P.firstChild;return t(v,e(be,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),f),t(f,()=>s.t("provider.custom.title")),V.addEventListener("submit",w),t(I,()=>s.t("provider.custom.description.prefix"),null),t(I,e(le,{href:"https://opencode.ai/docs/providers/#custom-provider",tabIndex:-1,get children(){return s.t("provider.custom.description.link")}}),null),t(I,()=>s.t("provider.custom.description.suffix"),null),t(m,e(Q,{get autofocus(){return l.autofocus??!0},get label(){return s.t("provider.custom.field.providerID.label")},get placeholder(){return s.t("provider.custom.field.providerID.placeholder")},get description(){return s.t("provider.custom.field.providerID.description")},get value(){return $.providerID},onChange:p=>E("providerID",p),get validationState(){return $.err.providerID?"invalid":void 0},get error(){return $.err.providerID}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.name.label")},get placeholder(){return s.t("provider.custom.field.name.placeholder")},get value(){return $.name},onChange:p=>E("name",p),get validationState(){return $.err.name?"invalid":void 0},get error(){return $.err.name}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.baseURL.label")},get placeholder(){return s.t("provider.custom.field.baseURL.placeholder")},get value(){return $.baseURL},onChange:p=>E("baseURL",p),get validationState(){return $.err.baseURL?"invalid":void 0},get error(){return $.err.baseURL}}),null),t(m,e(Q,{get label(){return s.t("provider.custom.field.apiKey.label")},get placeholder(){return s.t("provider.custom.field.apiKey.placeholder")},get description(){return s.t("provider.custom.field.apiKey.description")},get value(){return $.apiKey},onChange:p=>E("apiKey",p)}),null),t(q,()=>s.t("provider.custom.models.label")),t(F,e(pe,{get each(){return $.models},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.models.id.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.id.placeholder")},get value(){return p.id},onChange:te=>C(G(),"id",te),get validationState(){return p.err.id?"invalid":void 0},get error(){return p.err.id}})),t(Y,e(Q,{get label(){return s.t("provider.custom.models.name.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.models.name.placeholder")},get value(){return p.name},onChange:te=>C(G(),"name",te),get validationState(){return p.err.name?"invalid":void 0},get error(){return p.err.name}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>c(G()),get disabled(){return $.models.length<=1},get"aria-label"(){return s.t("provider.custom.models.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(F,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:j,class:"self-start",get children(){return s.t("provider.custom.models.add")}}),null),t(J,()=>s.t("provider.custom.headers.label")),t(P,e(pe,{get each(){return $.headers},children:(p,G)=>(()=>{var Z=qe(),W=Z.firstChild,Y=W.nextSibling;return t(W,e(Q,{get label(){return s.t("provider.custom.headers.key.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.key.placeholder")},get value(){return p.key},onChange:te=>K(G(),"key",te),get validationState(){return p.err.key?"invalid":void 0},get error(){return p.err.key}})),t(Y,e(Q,{get label(){return s.t("provider.custom.headers.value.label")},hideLabel:!0,get placeholder(){return s.t("provider.custom.headers.value.placeholder")},get value(){return p.value},onChange:te=>K(G(),"value",te),get validationState(){return p.err.value?"invalid":void 0},get error(){return p.err.value}})),t(Z,e(he,{type:"button",icon:"trash",variant:"ghost",class:"mt-1.5",onClick:()=>M(G()),get disabled(){return $.headers.length<=1},get"aria-label"(){return s.t("provider.custom.headers.remove")}}),null),ve(()=>re(Z,"data-row",p.row)),Z})()}),null),t(P,e(ae,{type:"button",size:"small",variant:"ghost",icon:"plus-small",onClick:D,class:"self-start",get children(){return s.t("provider.custom.headers.add")}}),null),t(V,e(ae,{class:"w-auto self-start",type:"submit",size:"large",variant:"primary",get disabled(){return X.isPending},get children(){return xe(()=>!!X.isPending)()?s.t("common.saving"):s.t("common.submit")}}),null),i})()}var $t=S('<button type=button class="flex size-5 items-center justify-center rounded-sm text-v2-icon-icon-muted hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none">'),wt=S('<div tabindex=-1 class="flex min-h-0 flex-1 flex-col outline-none">'),Be=S('<div class="text-14-regular text-text-weak">'),kt=S('<div class="px-1.25 w-full flex items-center gap-x-3"><span>'),Ct=S('<div class="flex h-24 items-center justify-center text-[13px] font-[440] text-v2-text-text-muted">'),St=S('<div class="flex min-h-0 flex-1 flex-col gap-4"><div class="shrink-0 px-1 pt-px"></div><div class="relative min-h-0 flex-1"><div class="flex size-full min-h-0 flex-col gap-4 overflow-y-auto pb-8 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"></div><div class="pointer-events-none absolute inset-x-0 bottom-0 h-10"style="background:linear-gradient(to bottom, transparent, var(--v2-background-bg-layer-01))">'),It=S('<section class="flex flex-col"><div class="px-3 pb-2 text-[13px] font-[440] leading-none tracking-[-0.04px] text-v2-text-text-muted">'),Dt=S('<span class="min-w-0 truncate font-[440] text-v2-text-text-muted">'),Me=S('<span class="flex h-4 shrink-0 items-center rounded-xs border-[0.5px] border-v2-border-border-base bg-v2-background-bg-layer-03 px-1 text-[11px] font-[530] leading-none tracking-[0.05px] text-v2-text-text-muted">'),Lt=S('<button type=button class="flex min-h-9 w-full items-center gap-2 rounded-md px-3 py-2.5 text-left text-[13px] leading-none tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus:bg-v2-overlay-simple-overlay-hover focus:outline-none"><span class="min-w-0 truncate font-[530] text-v2-text-text-base">'),Pt=S('<div class="w-full flex flex-col gap-1.5"><div class="text-14-regular text-text-base"></div><div>'),zt=S('<form class="flex flex-col items-start gap-4">'),Et=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span></span><span class="text-14-regular text-text-weak">'),Kt=S('<div class="flex flex-col gap-2"><div class="px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"></div><div class="flex flex-col">'),Rt=S('<button type=button class="group flex h-9 w-full items-center gap-2 rounded-md px-3 text-left text-[13px] leading-5 tracking-[-0.04px] hover:bg-v2-overlay-simple-overlay-hover focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:outline-none"><span class="flex h-2 w-4 shrink-0 items-center justify-center rounded-[1px] bg-v2-background-bg-base shadow-[var(--v2-elevation-button-neutral)]"><span class="hidden h-0.5 w-2.5 bg-v2-icon-icon-base group-hover:block group-focus-visible:block"></span></span><span class="font-[530] text-v2-text-text-base">'),qt=S('<span class="font-[440] text-v2-text-text-muted">'),Fe=S('<div class="text-14-regular text-text-base">'),Bt=S("<div>"),Mt=S('<div class="w-full flex items-center gap-x-2"><div class="w-4 h-2 rounded-[1px] bg-input-base shadow-xs-border-base flex items-center justify-center"><div class="w-2.5 h-0.5 ml-0 bg-icon-strong-base hidden"data-slot=list-item-extra-icon></div></div><span>'),Ft=S('<div class="flex flex-col gap-5"><div></div><div></div><div>'),Ot=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Oe=S('<div role=alert class="-mt-4 text-xs text-v2-state-fg-danger">'),Tt=S('<div class="flex flex-col gap-4"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base">'),Ut=S('<div class="flex flex-col gap-6"><form class="flex flex-col items-start gap-4">'),jt=S('<div class="flex flex-col gap-5 px-3 text-[13px] font-[440] leading-5 tracking-[-0.04px] text-v2-text-text-muted"><div></div><form class="flex flex-col items-start gap-5 self-stretch"><label class="flex w-full flex-col gap-1 font-[530] leading-4 text-v2-text-text-base">'),Vt=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><form class="flex flex-col items-start gap-4">'),At=S('<div class="flex flex-col gap-6"><div class="text-14-regular text-text-base"></div><div class="text-14-regular text-text-base flex items-center gap-4"><span>'),we=S('<div class="text-14-regular text-text-base"><div class="flex items-center gap-x-2"><span>'),Zt=S("<div><div><div></div></div><div><div>");const ee="_custom";function Ne(l={}){const[B,h]=ne({selected:void 0}),u=()=>h("selected",void 0);return{selected:()=>B.selected,select:s=>h("selected",s),back:l.onBack??u}}const Ht=l=>{const B=Ne(),h=l.controller??B,u=se(),$=Ie().general.newLayoutDesigns,n=h.back,j={current:n};let c;const D=()=>c?.focus({preventScroll:!0}),M=C=>{j.current=n,h.select(C)};function E(){return e(ie,{get children(){return[e(T,{get when(){return h.selected()===ee},get children(){return e(Ge,{get autofocus(){return!$()}})}}),e(T,{get when(){return xe(()=>!!(h.selected()&&h.selected()!==ee))()?h.selected():void 0},children:C=>e(Qt,{get provider(){return C()},get directory(){return l.directory},onBack:n,setBack:K=>j.current=K})}),e(T,{when:!0,get children(){return e(Gt,{get directory(){return l.directory},onSelect:M,get onPrepare(){return $()?D:void 0}})}})]}})}return e(U,{get when(){return $()},get fallback(){return e(Ae,{class:"h-full",transition:!0,get title(){return e(U,{get when(){return h.selected()},get fallback(){return u.t("command.provider.connect")},get children(){return e(he,{tabIndex:-1,icon:"arrow-left",variant:"ghost",onClick:()=>j.current(),get"aria-label"(){return u.t("common.goBack")}})}})},get children(){return e(E,{})}})},get children(){return e(it,{containerClass:"!h-[min(calc(100vh_-_16px),512px)] !w-[min(calc(100vw_-_16px),640px)]",class:"[font-family:var(--v2-font-family-sans)] [&_[data-slot=dialog-header]]:!px-5 [&_[data-slot=dialog-header-title]]:!text-[15px] [&_[data-slot=dialog-header-title]]:!tracking-[-0.13px]",get children(){return[e(lt,{get closeLabel(){return u.t("common.close")},get children(){return e(U,{get when(){return h.selected()},get fallback(){return e(at,{get children(){return u.t("command.provider.connect")}})},get children(){var C=$t();return C.$$click=()=>j.current(),t(C,e(De,{name:"arrow-left",size:"small"})),ve(()=>re(C,"aria-label",u.t("common.goBack"))),C}})}}),e(st,{class:"min-h-0 flex-1 overflow-hidden px-2 pb-2",get children(){var C=wt(),K=c;return typeof K=="function"?Ze(K,C):c=C,t(C,e(E,{})),C}})]}})}})};function Gt(l){if(Ie().general.newLayoutDesigns())return e(Nt,{get directory(){return l.directory},get onSelect(){return l.onSelect},get onPrepare(){return l.onPrepare}});const h=Le(()=>l.directory?.()),u=se(),s=()=>u.t("dialog.provider.group.popular"),$=()=>u.t("dialog.provider.group.other"),n=()=>u.t("settings.providers.tag.custom"),j=c=>{if(c==="anthropic")return u.t("dialog.provider.anthropic.note");if(c==="openai")return u.t("dialog.provider.openai.note");if(c.startsWith("github-copilot"))return u.t("dialog.provider.copilot.note");if(c==="opencode-go")return""};return e(Ce,{class:"px-3",get search(){return{placeholder:u.t("dialog.provider.search.placeholder"),autofocus:!0}},get emptyMessage(){return u.t("dialog.provider.empty")},activeIcon:"plus-small",key:c=>c?.id,items:()=>(u.locale(),[{id:ee,name:n()},...h.all().values()]),filterKeys:["id","name"],groupBy:c=>de.includes(c.id)?s():$(),sortBy:(c,D)=>c.id===ee?-1:D.id===ee?1:de.includes(c.id)&&de.includes(D.id)?de.indexOf(c.id)-de.indexOf(D.id):c.name.localeCompare(D.name),sortGroupsBy:(c,D)=>{const M=s();return c.category===M&&D.category!==M?-1:D.category===M&&c.category!==M?1:0},onSelect:c=>{c&&l.onSelect(c.id)},children:c=>(()=>{var D=kt(),M=D.firstChild;return t(D,e(be,{"data-slot":"list-item-extra-icon",get id(){return c.id}}),M),t(M,()=>c.name),t(D,e(U,{get when(){return c.id==="opencode"},get children(){var E=Be();return t(E,()=>u.t("dialog.provider.opencode.tagline")),E}}),null),t(D,e(U,{get when(){return c.id===ee},get children(){return e($e,{get children(){return u.t("settings.providers.tag.custom")}})}}),null),t(D,e(U,{get when(){return c.id==="opencode"},get children(){return e($e,{get children(){return u.t("dialog.provider.tag.recommended")}})}}),null),t(D,e(U,{get when(){return j(c.id)},children:E=>(()=>{var C=Be();return t(C,E),C})()}),null)const K=w=>{l.onPrepare?.(),l.onSelect(w)},R=(w,i)=>{const v=M();if(v.length===0)return;const f=v.findIndex(I=>I.id===u.active),V=f<0?i>0?0:v.length-1:(f+i+v.length)%v.length;s("active",v[V].id),E?.querySelector(`[data-provider-id="${CSS.escape(v[V].id)}"]`)?.focus({preventScroll:!0}),w.preventDefault()},X=w=>{if(w.key==="ArrowDown")return R(w,1);if(w.key==="ArrowUp")return R(w,-1);w.key!=="Enter"||!u.active||(K(u.active),w.preventDefault())};return(()=>{var w=St(),i=w.firstChild,v=i.nextSibling,f=v.firstChild;f.nextSibling,w.$$keydown=X;var V=E;return typeof V=="function"?Ze(V,w):E=w,t(i,e(Se,{ref(I){var m=C;typeof m=="function"?m(I):C=I},type:"search",class:"!w-full [font-family:var(--v2-font-family-sans)]",get leadingIcon(){return e(De,{name:"magnifying-glass",size:"small"})},get placeholder(){return h.t("dialog.provider.search.placeholder")},get value(){return u.filter},onInput:I=>{s({filter:I.currentTarget.value,active:void 0})}})),t(f,e(pe,{get each(){return[{title:h.t("dialog.provider.group.popular"),items:c},{title:h.t("dialog.provider.group.other"),items:D}]},children:I=>e(U,{get when(){return I.items().length>0},get children(){var m=It(),F=m.firstChild;return t(F,()=>I.title),t(m,e(pe,{get each(){return I.items()},children:q=>(()=>{var P=Lt(),J=P.firstChild;return P.$$click=()=>K(q.id),P.addEventListener("mouseenter",()=>s("active",q.id)),t(P,e(be,{get id(){return q.id},class:"size-4 shrink-0 text-v2-icon-icon-base"}),J),t(J,()=>q.name),t(P,e(U,{get when(){return q.id==="opencode"},get children(){return[(()=>{var p=Dt();return t(p,()=>h.t(q.id==="opencode"?"dialog.provider.opencode.tagline":"dialog.provider.opencodeGo.tagline")),p})(),(()=>{var p=Me();return t(p,()=>h.t("dialog.provider.tag.recommended")),p})()]}}),null),t(P,e(U,{get when(){return q.id===ee},get children(){var p=Me();return t(p,()=>h.t("settings.providers.tag.custom")),p}}),null),t(P,e(U,{get when(){return u.connecting===q.id},get children(){return e(me,{class:"ml-auto size-4 shrink-0 text-v2-icon-icon-muted"})}}),null),ve(p=>{var G=q.id,Z=u.active===q.id,W=u.connecting!==void 0,Y=u.connecting===q.id;return G!==p.e&&re(P,"data-provider-id",p.e=G),Z!==p.t&&P.classList.toggle("bg-v2-overlay-simple-overlay-hover",p.t=Z),W!==p.a&&(P.disabled=p.a=W),Y!==p.o&&re(P,"aria-busy",p.o=Y),p},{e:void 0,t:void 0,a:void 0,o:void 0}),P})()}),null),m}})}),null),t(f,e(U,{get when(){return M().length===0},get children(){var I=Ct();return t(I,()=>h.t("dialog.provider.empty")),I}}),null),w})()}function Qt(l){const B=Ue(),h=je(),u=Ve(),s=ct(),$=dt(),n=se(),c=Ie().general.newLayoutDesigns,D=Le(()=>l.directory?.()),M=()=>l.directory?.()??gt($.dir),E=()=>{const r=M();return r?{directory:r}:void 0},C={value:!0},K={current:void 0};ut(()=>{C.value=!1,K.current!==void 0&&(clearTimeout(K.current),K.current=void 0)});const R=A(()=>D.all().get(l.provider)??h().data.provider.all.get(l.provider)),X=A(()=>[{type:"key",label:n.t("provider.connect.method.apiKey")}]),[w]=vt(()=>({provider:l.provider,directory:M()}),r=>u().api.integration.get({integrationID:r.provider,location:r.directory?{directory:r.directory}:void 0}).then(o=>o.data)),i=A(()=>w.loading),v=A(()=>{const r=w.latest?.methods.filter(o=>o.type==="key"||o.type==="oauth");return r?.length?r:X()}),[f,V]=ne({methodIndex:void 0,authorization:void 0,promptInputs:void 0,state:"pending",error:void 0});function I(r){V(ue(o=>{if(r.type==="method.select"){o.methodIndex=r.index,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="method.reset"){o.methodIndex=void 0,o.authorization=void 0,o.promptInputs=void 0,o.state=void 0,o.error=void 0;return}if(r.type==="auth.prompt"){o.state="prompt",o.error=void 0;return}if(r.type==="auth.inputs"){o.promptInputs=r.inputs,o.state=void 0,o.error=void 0;return}if(r.type==="auth.pending"){o.state="pending",o.error=void 0;return}if(r.type==="auth.complete"){o.state="complete",o.authorization=r.authorization,o.error=void 0;return}o.state="error",o.error=r.error}))}const m=A(()=>f.methodIndex!==void 0?v().at(f.methodIndex):void 0),F=r=>r?r.type==="key"?n.t("provider.connect.method.apiKey"):r.label??"":"",q=r=>{const o=F(r),a=r?.label?.match(/\s+\((browser|headless)\)$/i),y=a?.[1];return{label:a?o.slice(0,-a[0].length):o,hint:y?y[0].toUpperCase()+y.slice(1):r?.type==="key"?"Browser":void 0}};function P(r,o){if(r&&typeof r=="object"&&"data"in r){const a=r.data;if(typeof a?.message=="string"&&a.message)return a.message}if(r&&typeof r=="object"&&"error"in r){const a=P(r.error,"");if(a)return a}if(r&&typeof r=="object"&&"message"in r){const a=r.message;if(typeof a=="string"&&a)return a}return r instanceof Error&&r.message?r.message:typeof r=="string"&&r?r:o}async function J(r,o){K.current!==void 0&&(clearTimeout(K.current),K.current=void 0);const a=v()[r];if(I({type:"method.select",index:r}),a.type==="oauth"){if(a.prompts?.length&&!o){I({type:"auth.prompt"});return}I({type:"auth.pending"}),await u().api.integration.oauth.connect({integrationID:l.provider,methodID:a.id,inputs:o??{},location:E()}).then(y=>{C.value&&I({type:"auth.complete",authorization:y.data})}).catch(y=>{C.value&&I({type:"auth.error",error:P(y,n.t("common.requestFailed"))})})}}function p(){const[r,o]=ne({value:{},index:0}),a=A(()=>{const _=m();return _?.type==="oauth"?_.prompts??[]:[]}),y=(_,O)=>{if(!_.when)return!0;const H=O[_.when.key];return H===void 0?!1:_.when.op==="eq"?H===_.when.value:H!==_.when.value},z=A(()=>{const _=a(),O=_.findIndex((H,ce)=>ce>=r.index&&y(H,r.value));if(O!==-1)return{index:O,prompt:_[O]}}),d=A(()=>{const _=z();return!_||_.prompt.type!=="text"?!1:(r.value[_.prompt.key]??"").trim().length>0});async function g(_,O){if(f.methodIndex===void 0)return;const H=a().findIndex((ce,N)=>N>_&&y(ce,O));if(H!==-1){o("index",H);return}await J(f.methodIndex,O)}async function x(_){_.preventDefault();const O=z();!O||O.prompt.type!=="text"||d()&&await g(O.index,r.value)}const b=()=>z(),k=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="text"))return _}),L=A(()=>{const _=b()?.prompt;if(!(!_||_.type!=="select"))return _});return(()=>{var _=zt();return _.addEventListener("submit",x),t(_,e(ie,{get children(){return[e(T,{get when(){return b()?.prompt.type==="text"},get children(){return[e(Q,{type:"text",get label(){return k()?.message??""},get placeholder(){return k()?.placeholder},get value(){return xe(()=>!!k())()?r.value[k().key]??"":""},onChange:O=>{const H=k();H&&o("value",H.key,O)}}),e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get disabled(){return!d()},get children(){return n.t("common.continue")}})]}}),e(T,{get when(){return b()?.prompt.type==="select"},get children(){var O=Pt(),H=O.firstChild,ce=H.nextSibling;return t(H,()=>L()?.message),t(ce,e(Ce,{class:"px-3",get items(){return L()?.options??[]},key:N=>N.value,get current(){return L()?.options.find(N=>N.value===r.value[L().key])},onSelect:N=>{if(!N)return;const oe=L();if(!oe)return;const ye={...r.value,[oe.key]:N.value};o("value",oe.key,N.value),g(b().index,ye)},children:N=>(()=>{var oe=Et(),ye=oe.firstChild,Pe=ye.nextSibling,Ye=Pe.nextSibling;return t(Pe,()=>N.label),t(Ye,()=>N.hint),oe})()})),O}})]}})),_})()}let G;function Z(r){r.key==="Enter"&&r.target instanceof HTMLInputElement||r.key!=="Escape"&&G?.onKeyDown(r)}let W=!1;pt(()=>{W||i()||v().length===1&&(W=!0,J(0))});async function Y(){const r=M();await s.refetchQueries(h().queryOptions.providers(r?mt(r):null)).catch(()=>{}),B.close(),ke({variant:"success",icon:"circle-check",title:n.t("provider.connect.toast.connected.title",{provider:R().name}),description:n.t("provider.connect.toast.connected.description",{provider:R().name})})}function te(){if(v().length>1&&f.methodIndex!==void 0){I({type:"method.reset"});return}l.onBack()}l.setBack(te);function Qe(){return c()?(()=>{var r=Kt(),o=r.firstChild,a=o.nextSibling;return t(o,()=>n.t("provider.connect.selectMethod",{provider:R().name})),t(a,e(pe,{get each(){return v()},children:(y,z)=>{const d=()=>q(y);return(()=>{var g=Rt(),x=g.firstChild,b=x.nextSibling;return g.$$click=()=>void J(z()),t(b,()=>d().label),t(g,e(U,{get when(){return d().hint},children:k=>(()=>{var L=qt();return t(L,k),L})()}),null),g})()}})),r})():[(()=>{var r=Fe();return t(r,()=>n.t("provider.connect.selectMethod",{provider:R().name})),r})(),(()=>{var r=Bt();return t(r,e(Ce,{class:"px-3",ref:o=>{G=o},items:v,key:o=>o?.label??o?.type,onSelect:async(o,a)=>{o&&J(a)},children:o=>(()=>{var a=Mt(),y=a.firstChild,z=y.nextSibling;return t(z,()=>F(o)),a})()})),r})()]}function Je(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("apiKey");if(!b?.trim()){y("error",n.t("provider.connect.apiKey.required"));return}y("error",void 0),await u().api.integration.connect.key({integrationID:l.provider,location:E(),key:b}),await Y()}return c()?(()=>{var d=Ot(),g=d.firstChild,x=g.firstChild;return t(d,e(U,{get when(){return R().id==="opencode"},get fallback(){return n.t("provider.connect.apiKey.description",{provider:R().name})},get children(){var b=Ft(),k=b.firstChild,L=k.nextSibling,_=L.nextSibling;return t(k,()=>n.t("provider.connect.opencodeZen.line1")),t(L,()=>n.t("provider.connect.opencodeZen.line2")),t(_,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(_,e(le,{href:"https://",class:"text-v2-text-text-base focus-visible:rounded-xs focus-visible:outline-2 focus-visible:outline-v2-border-border-focus",get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(_,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),b}}),g),g.addEventListener("submit",z),t(x,()=>n.t("provider.connect.apiKey.label",{provider:R().name}),null),t(x,e(Se,{ref(b){var k=r;typeof k=="function"?k(b):r=b},class:"!w-full",name:"apiKey","data-input":"provider-api-key",get placeholder(){return n.t("provider.connect.apiKey.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:b=>y("value",b.currentTarget.value)}),null),t(g,e(U,{get when(){return a.error},children:b=>(()=>{var k=Oe();return re(k,"id",o),t(k,b),k})()}),null),t(g,e(Ee,{type:"submit",variant:"contrast","data-action":"provider-connect-submit",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Ut(),g=d.firstChild;return t(d,e(ie,{get children(){return[e(T,{get when(){return R().id==="opencode"},get children(){var x=Tt(),b=x.firstChild,k=b.nextSibling,L=k.nextSibling;return t(b,()=>n.t("provider.connect.opencodeZen.line1")),t(k,()=>n.t("provider.connect.opencodeZen.line2")),t(L,()=>n.t("provider.connect.opencodeZen.visit.prefix"),null),t(L,e(le,{href:"https://",tabIndex:-1,get children(){return n.t("provider.connect.opencodeZen.visit.link")}}),null),t(L,()=>n.t("provider.connect.opencodeZen.visit.suffix"),null),x}}),e(T,{when:!0,get children(){var x=Fe();return t(x,()=>n.t("provider.connect.apiKey.description",{provider:R().name})),x}})]}}),g),g.addEventListener("submit",z),t(g,e(Q,{get autofocus(){return!c()},ref(x){var b=r;typeof b=="function"?b(x):r=x},type:"text",get label(){return n.t("provider.connect.apiKey.label",{provider:R().name})},get placeholder(){return n.t("provider.connect.apiKey.placeholder")},name:"apiKey",get value(){return a.value},onChange:x=>y("value",x),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(g,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function We(){let r;const o=ze(),[a,y]=ne({value:"",error:void 0});fe(()=>{c()&&r?.focus({preventScroll:!0})});async function z(d){d.preventDefault();const g=d.currentTarget,b=new FormData(g).get("code");if(!b?.trim()){y("error",n.t("provider.connect.oauth.code.required"));return}y("error",void 0);const k=await u().api.integration.oauth.complete({integrationID:l.provider,attemptID:f.authorization.attemptID,location:E(),code:b}).then(()=>({ok:!0})).catch(L=>({ok:!1,error:L}));if(k.ok){await Y();return}y("error",P(k.error,n.t("provider.connect.oauth.code.invalid")))}return c()?(()=>{var d=jt(),g=d.firstChild,x=g.nextSibling,b=x.firstChild;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},class:"text-v2-text-text-base",get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(b,()=>n.t("provider.connect.oauth.code.label",{method:m()?.label??""}),null),t(b,e(Se,{ref(k){var L=r;typeof L=="function"?L(k):r=k},class:"!w-full",name:"code",get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},get value(){return a.value},get invalid(){return a.error!==void 0},get"aria-describedby"(){return a.error?o:void 0},autocomplete:"off",spellcheck:!1,onInput:k=>y("value",k.currentTarget.value)}),null),t(x,e(U,{get when(){return a.error},children:k=>(()=>{var L=Oe();return re(L,"id",o),t(L,k),L})()}),null),t(x,e(Ee,{type:"submit",variant:"contrast",get children(){return n.t("common.continue")}}),null),d})():(()=>{var d=Vt(),g=d.firstChild,x=g.nextSibling;return t(g,()=>n.t("provider.connect.oauth.code.visit.prefix"),null),t(g,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.code.visit.link")}}),null),t(g,()=>n.t("provider.connect.oauth.code.visit.suffix",{provider:R().name}),null),x.addEventListener("submit",z),t(x,e(Q,{get autofocus(){return!c()},ref(b){var k=r;typeof k=="function"?k(b):r=b},type:"text",get label(){return n.t("provider.connect.oauth.code.label",{method:m()?.label??""})},get placeholder(){return n.t("provider.connect.oauth.code.placeholder")},name:"code",get value(){return a.value},onChange:b=>y("value",b),get validationState(){return a.error?"invalid":void 0},get error(){return a.error}}),null),t(x,e(ae,{class:"w-auto",type:"submit",size:"large",variant:"primary",get children(){return n.t("common.continue")}}),null),d})()}function Xe(){const r=A(()=>{const o=f.authorization?.instructions;return o?.includes(":")?o.split(":").pop()?.trim():o});return fe(()=>{const o=async()=>{const a=f.authorization;if(!a||!C.value)return;const y=await u().api.integration.oauth.status({integrationID:l.provider,attemptID:a.attemptID,location:E()}).then(z=>({ok:!0,status:z.data})).catch(z=>({ok:!1,error:z}));if(C.value){if(!y.ok){I({type:"auth.error",error:P(y.error,n.t("common.requestFailed"))});return}if(y.status.status==="complete"){await Y();return}if(y.status.status==="failed"){I({type:"auth.error",error:y.status.message});return}if(y.status.status==="expired"){I({type:"auth.error",error:n.t("common.requestFailed")});return}K.current=setTimeout(o,1e3)}};o()}),(()=>{var o=At(),a=o.firstChild,y=a.nextSibling,z=y.firstChild;return t(a,()=>n.t("provider.connect.oauth.auto.visit.prefix"),null),t(a,e(le,{get href(){return f.authorization.url},get children(){return n.t("provider.connect.oauth.auto.visit.link")}}),null),t(a,()=>n.t("provider.connect.oauth.auto.visit.suffix",{provider:R().name}),null),t(o,e(Q,{get label(){return n.t("provider.connect.oauth.auto.confirmationCode")},class:"font-mono",get value(){return r()},readOnly:!0,copyable:!0}),y),t(y,e(me,{}),z),t(z,()=>n.t("provider.connect.status.waiting")),o})()}return(()=>{var r=Zt(),o=r.firstChild,a=o.firstChild,y=o.nextSibling,z=y.firstChild;return t(o,e(be,{get id(){return l.provider},get class(){return c()?"mt-0.5 size-4 shrink-0 text-v2-icon-icon-base":"size-5 shrink-0 icon-strong-base"}}),a),t(a,e(ie,{get children(){return[e(T,{get when(){return xe(()=>l.provider==="anthropic")()&&m()?.label?.toLowerCase().includes("max")},get children(){return n.t("provider.connect.title.anthropicProMax")}}),e(T,{when:!0,get children(){return n.t("provider.connect.title",{provider:R().name})}})]}})),z.$$keydown=Z,t(z,e(ie,{get children(){return[e(T,{get when(){return i()},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.methodIndex===void 0},get children(){return e(Qe,{})}}),e(T,{get when(){return f.state==="pending"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(me,{}),x),t(x,()=>n.t("provider.connect.status.inProgress")),d}}),e(T,{get when(){return f.state==="prompt"},get children(){return e(p,{})}}),e(T,{get when(){return f.state==="error"},get children(){var d=we(),g=d.firstChild,x=g.firstChild;return t(g,e(De,{name:"circle-ban-sign",class:"text-icon-critical-base"}),x),t(x,()=>n.t("provider.connect.status.failed",{error:f.error??""})),d}}),e(T,{get when(){return m()?.type==="key"},get children(){return e(Je,{})}}),e(T,{get when(){return m()?.type==="oauth"},get children(){return e(ie,{get children(){return[e(T,{get when(){return f.authorization?.mode==="code"},get children(){return e(We,{})}}),e(T,{get when(){return f.authorization?.mode==="auto"},get children(){return e(Xe,{})}})]}})}})]}})),ve(d=>{var g=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-3",x=c()?"flex h-10 shrink-0 items-start gap-2 px-3":"flex items-center gap-4 px-2.5",b=c()?"text-[15px] font-[530] leading-5 tracking-[-0.13px] text-v2-text-text-base":"text-16-medium text-text-strong",k=c()?"flex min-h-0 flex-1 flex-col":"flex flex-col gap-6 px-2.5 pb-10",L=c()?void 0:0,_=!c()&&f.methodIndex===void 0?!0:void 0;return g!==d.e&&ge(r,d.e=g),x!==d.t&&ge(o,d.t=x),b!==d.a&&ge(a,d.a=b),k!==d.o&&ge(y,d.o=k),L!==d.i&&re(z,"tabindex",d.i=L),_!==d.n&&(z.autofocus=d.n=_),d},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),r})()}Te(["click","keydown"]);const Xt=Object.freeze(Object.defineProperty({__proto__:null,DialogConnectProvider:Ht,useProviderConnectController:Ne},Symbol.toStringTag,{value:"Module"}));export{Ht as D,le as L,Wt as a,Xt as d,Ne as u};
|
|
2
2
|
//# sourceMappingURL=dialog-connect-provider-DLnpNUTc.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-wflYMX4p.js","assets/index-BfNxi3ev.js","assets/index-S3QimprQ.css","assets/row-DA4cIOhp.js","assets/LROKH5N7-D8CK0ENS.js","assets/row-DVVVLbFk.css","assets/settings-keybinds-BOa6QxJ6.js","assets/list-FiQEDby0.js","assets/dialog-connect-provider-DLnpNUTc.js","assets/index-Bd5IF--R.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{co as Oe,b_ as J,c5 as Ve,c6 as _e,bV as pe,c4 as je,ck as he,aD as z,aQ as Me,ch as $e,cg as ye,aI as ce,bm as Re,b6 as r,au as e,a2 as w,bL as d,af as Ze,a9 as Ke,B as q,T as K,ba as W,aa as se,bB as Ge,bC as qe,be as Ue,bf as Qe,bM as He,bN as We,bc as ge,ac as Xe,I as j,bD as Ye,bg as Je,bO as et,S as tt,bv as rt,bZ as me,l as G,Y as xe,V as te,Z as be,o as Y,$ as nt,a0 as st,y as it,Q as lt,cf as at,c9 as ot,bw as le,N as ie,a8 as re,bG as ne,c1 as ct,bX as gt,u as dt,ce as ut,W as pt,X as ht,aK as mt,a7 as C,bK as vt,b as ft}from"./index-BfNxi3ev.js";import{S as $}from"./switch-CVS6td1r.js";import{u as xt,a as E,S as bt}from"./settings-keybinds-BOa6QxJ6.js";import{L as wt,u as _t,a as $t,D as yt}from"./dialog-connect-provider-DLnpNUTc.js";import"./LROKH5N7-D8CK0ENS.js";import"./list-FiQEDby0.js";var St=d("<div data-action=settings-new-layout-designs>"),de=d('<div class="flex flex-col gap-1">'),Ct=d('<span class="flex items-center gap-2">'),kt=d("<div data-action=settings-auto-accept-permissions>"),Pt=d("<div data-action=settings-feed-reasoning-summaries>"),Tt=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),Dt=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),Ft=d("<div data-action=settings-show-file-tree>"),It=d("<div data-action=settings-show-navigation>"),zt=d("<div data-action=settings-show-search>"),Et=d("<div data-action=settings-show-status>"),At=d("<div data-action=settings-show-custom-agents>"),H=d('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ue=d('<div class="w-full sm:w-[220px]">'),Nt=d("<div data-action=settings-notifications-agent>"),Lt=d("<div data-action=settings-notifications-permissions>"),Bt=d("<div data-action=settings-notifications-errors>"),Ot=d("<div data-action=settings-release-notes>"),Vt=d("<div data-action=settings-pinch-zoom>"),jt=d("<div data-action=settings-wayland>"),Mt=d("<span class=text-text-weak>"),Rt=d('<div class="flex items-center gap-2"><span>'),Zt=d('<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">'),Kt=d('<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 M={cleanup:void 0,timeout:void 0,run:0};const Se=()=>{M.run+=1,M.cleanup&&M.cleanup(),clearTimeout(M.timeout),M.cleanup=void 0},we=i=>{if(Se(),!i)return;const t=++M.run;M.timeout=setTimeout(()=>{rt(i).then(a=>{if(M.run!==t){a?.();return}M.cleanup=a})},100)},Gt=()=>{const i=Oe(),t=J(),a=Ve(),c=_e(),v=pe(),m=je(),l=he(),_=xt(),y=z(()=>c.platform==="desktop"&&c.os==="linux"),k=z(()=>Me(m.dir)),P=z(()=>{const o=k();return o?m.id?a.isAutoAccepting(m.id,o):a.isAutoAcceptingDirectory(o):!1}),T=o=>{const s=k();if(s){if(!m.id){if(a.isAutoAcceptingDirectory(s)===o)return;a.toggleAutoAcceptDirectory(s);return}if(o){a.enableAutoAccept(m.id,s);return}a.disableAutoAccept(m.id,s)}},A=z(()=>c.platform==="desktop"),N=z(()=>i.ids().map(o=>({id:o,name:i.name(o)}))),F=$e(),L=ye(),[O]=ce(async()=>{const o=L();return await o.protocol==="v1"?(await o.client.pty.shells()).data??[]:[]},{initialValue:[]}),[U,{refetch:h}]=ce(()=>!!(y()&&c.getDisplayBackend),()=>Promise.resolve(c.getDisplayBackend?.()??null).catch(()=>null),{initialValue:null}),[u,{mutate:b}]=ce(()=>!!(A()&&c.getPinchZoomEnabled),()=>Promise.resolve(c.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});Re(()=>{i.loadThemes()});const B={id:"auto",value:"",label:t.t("settings.general.row.shell.autoDefault")},R=z(()=>F().data.config.shell??""),Z=z(()=>{const o=O.latest,s=F().data.config.shell,n=new Map;for(const g of o)n.set(g.name,(n.get(g.name)||0)+1);const p=[B,...o.map(g=>{const ve=(n.get(g.name)||0)>1,fe=ve?g.path:g.name,Be=g.acceptable?fe:`${fe} (${t.t("settings.general.row.shell.terminalOnly")})`;return{id:g.path,value:ve?g.path:g.name,label:Be}})];return s&&!p.some(g=>g.value===s)&&p.push({id:s,value:s,label:s}),p}),ae=o=>{const s=c.setDisplayBackend?.(o?"wayland":"auto");s&&s.finally(()=>{h()})},X=o=>{b(o);const s=c.setPinchZoomEnabled?.(o);s&&s.catch(()=>b(!o))},ee=z(()=>[{value:"system",label:t.t("theme.scheme.system")},{value:"light",label:t.t("theme.scheme.light")},{value:"dark",label:t.t("theme.scheme.dark")}]),x=z(()=>t.locales.map(o=>({value:o,label:t.label(o)}))),D={id:"none",label:"sound.option.none"},S=[D,...tt],I=()=>Je(l.appearance.font()),V=()=>Ye(l.appearance.uiFont()),oe=()=>et(l.appearance.terminalFont()),Q=(o,s,n,p)=>({options:S,current:o()?S.find(g=>g.id===s())??D:D,value:g=>g.id,label:g=>t.t(g.label),onHighlight:g=>{g&&we(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){n(!1),Se();return}n(!0),p(g.id),we(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),Te=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return(()=>{var s=Ct();return r(s,()=>t.t("settings.general.row.newInterface.title"),null),r(s,e(Ke,{variant:"accent",get children(){return t.t("settings.general.row.newInterface.badge")}}),null),s})()},get description(){return t.t("settings.general.row.newInterface.description")},get children(){var s=St();return r(s,e($,{get checked(){return l.general.newLayoutDesigns()},onChange:n=>{l.general.setNewLayoutDesigns(n),n&&Ze(()=>import("./index-wflYMX4p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(p=>{v.show(()=>e(p.DialogSettings,{}))})}})),s}})}})),o})(),De=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return t.t("settings.general.row.newInterfaceNotice.title")},get description(){return t.t("settings.general.row.newInterfaceNotice.description")},get children(){return e(q,{size:"small",variant:"ghost",get onClick(){return l.general.dismissNewInterfaceNotice},get children(){return t.t("settings.general.row.newInterfaceNotice.dismiss")}})}})}})),o})(),Fe=()=>(()=>{var o=de();return r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.language.title")},get description(){return t.t("settings.general.row.language.description")},get children(){return e(K,{"data-action":"settings-language",get options(){return x()},get current(){return x().find(s=>s.value===t.locale())},value:s=>s.value,label:s=>s.label,onSelect:s=>s&&t.setLocale(s.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("command.permissions.autoaccept.enable")},get description(){return t.t("toast.permissions.autoaccept.on.description")},get children(){var s=kt();return r(s,e($,{get checked(){return P()},get disabled(){return!k()},onChange:T})),s}}),e(f,{get title(){return t.t("settings.general.row.shell.title")},get description(){return t.t("settings.general.row.shell.description")},get children(){return e(K,{"data-action":"settings-shell",get options(){return Z()},get current(){return Z().find(s=>s.value===R())??B},value:s=>s.id,label:s=>s.label,onSelect:s=>{s&&s.value!==R()&&F().updateConfig({shell:s.value})},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}}),e(f,{get title(){return t.t("settings.general.row.reasoningSummaries.title")},get description(){return t.t("settings.general.row.reasoningSummaries.description")},get children(){var s=Pt();return r(s,e($,{get checked(){return l.general.showReasoningSummaries()},onChange:n=>l.general.setShowReasoningSummaries(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return t.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var s=Tt();return r(s,e($,{get checked(){return l.general.shellToolPartsExpanded()},onChange:n=>l.general.setShellToolPartsExpanded(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.editToolPartsExpanded.title")},get description(){return t.t("settings.general.row.editToolPartsExpanded.description")},get children(){var s=Dt();return r(s,e($,{get checked(){return l.general.editToolPartsExpanded()},onChange:n=>l.general.setEditToolPartsExpanded(n)})),s}})]}})),o})(),Ie=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.advanced")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.showFileTree.title")},get description(){return t.t("settings.general.row.showFileTree.description")},get children(){var n=Ft();return r(n,e($,{get checked(){return l.general.showFileTree()},onChange:p=>l.general.setShowFileTree(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showNavigation.title")},get description(){return t.t("settings.general.row.showNavigation.description")},get children(){var n=It();return r(n,e($,{get checked(){return l.general.showNavigation()},onChange:p=>l.general.setShowNavigation(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showSearch.title")},get description(){return t.t("settings.general.row.showSearch.description")},get children(){var n=zt();return r(n,e($,{get checked(){return l.general.showSearch()},onChange:p=>l.general.setShowSearch(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showStatus.title")},get description(){return t.t("settings.general.row.showStatus.description")},get children(){var n=Et();return r(n,e($,{get checked(){return l.general.showStatus()},onChange:p=>l.general.setShowStatus(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showCustomAgents.title")},get description(){return t.t("settings.general.row.showCustomAgents.description")},get children(){var n=At();return r(n,e($,{get checked(){return l.general.showCustomAgents()},onChange:p=>l.general.setShowCustomAgents(p)})),n}})]}}),null),o})(),ze=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.appearance")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.colorScheme.title")},get description(){return t.t("settings.general.row.colorScheme.description")},get children(){return e(K,{"data-action":"settings-color-scheme",get options(){return ee()},get current(){return ee().find(n=>n.value===i.colorScheme())},value:n=>n.value,label:n=>n.label,onSelect:n=>n&&i.setColorScheme(n.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),e(f,{get title(){return t.t("settings.general.row.theme.title")},get description(){return[W(()=>t.t("settings.general.row.theme.description"))," ",e(wt,{href:"https://opencode.ai/docs/themes/",get children(){return t.t("common.learnMore")}})]},get children(){return e(K,{"data-action":"settings-theme",get options(){return N()},get current(){return N().find(n=>n.id===i.themeId())},value:n=>n.id,label:n=>n.name,onSelect:n=>{n&&i.setTheme(n.id)},variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("settings.general.row.uiFont.title")},get description(){return t.t("settings.general.row.uiFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-ui-font",get label(){return t.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return V()},onChange:p=>l.appearance.setUIFont(p),placeholder:Ge,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":qe(l.appearance.uiFont())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.font.title")},get description(){return t.t("settings.general.row.font.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-code-font",get label(){return t.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return I()},onChange:p=>l.appearance.setFont(p),placeholder:Ue,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Qe(l.appearance.font())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.terminalFont.title")},get description(){return t.t("settings.general.row.terminalFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-terminal-font",get label(){return t.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return oe()},onChange:p=>l.appearance.setTerminalFont(p),placeholder:He,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":We(l.appearance.terminalFont())}}})),n}})]}}),null),o})(),Ee=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.notifications")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.notifications.agent.title")},get description(){return t.t("settings.general.notifications.agent.description")},get children(){var n=Nt();return r(n,e($,{get checked(){return l.notifications.agent()},onChange:p=>l.notifications.setAgent(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.permissions.title")},get description(){return t.t("settings.general.notifications.permissions.description")},get children(){var n=Lt();return r(n,e($,{get checked(){return l.notifications.permissions()},onChange:p=>l.notifications.setPermissions(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.errors.title")},get description(){return t.t("settings.general.notifications.errors.description")},get children(){var n=Bt();return r(n,e($,{get checked(){return l.notifications.errors()},onChange:p=>l.notifications.setErrors(p)})),n}})]}}),null),o})(),Ae=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.sounds")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.sounds.agent.title")},get description(){return t.t("settings.general.sounds.agent.description")},get children(){return e(K,ge({"data-action":"settings-sounds-agent"},()=>Q(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),n=>l.sounds.setAgentEnabled(n),n=>l.sounds.setAgent(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.permissions.title")},get description(){return t.t("settings.general.sounds.permissions.description")},get children(){return e(K,ge({"data-action":"settings-sounds-permissions"},()=>Q(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),n=>l.sounds.setPermissionsEnabled(n),n=>l.sounds.setPermissions(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.errors.title")},get description(){return t.t("settings.general.sounds.errors.description")},get children(){return e(K,ge({"data-action":"settings-sounds-errors"},()=>Q(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),n=>l.sounds.setErrorsEnabled(n),n=>l.sounds.setErrors(n))))}})]}}),null),o})(),Ne=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.updates")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.releaseNotes.title")},get description(){return t.t("settings.general.row.releaseNotes.description")},get children(){var n=Ot();return r(n,e($,{get checked(){return l.general.releaseNotes()},onChange:p=>l.general.setReleaseNotes(p)})),n}}),e(f,{get title(){return t.t("settings.updates.row.check.title")},get description(){return t.t("settings.updates.row.check.description")},get children(){return e(q,{size:"small",variant:"secondary",get disabled(){return!_.action().run},get onClick(){return _.run},get children(){return t.t(_.action().label)}})}})]}}),null),o})(),Le=()=>e(w,{get when(){return A()},get children(){var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.display")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.pinchZoom.title")},get description(){return t.t("settings.general.row.pinchZoom.description")},get children(){var n=Vt();return r(n,e($,{get checked(){return u.latest},onChange:X})),n}}),e(w,{get when(){return y()},get children(){return e(f,{get title(){return(()=>{var n=Rt(),p=n.firstChild;return r(p,()=>t.t("settings.general.row.wayland.title")),r(n,e(Xe,{get value(){return t.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var g=Mt();return r(g,e(j,{name:"help",size:"small"})),g}}),null),n})()},get description(){return t.t("settings.general.row.wayland.description")},get children(){var n=jt();return r(n,e($,{get checked(){return U.latest==="wayland"},onChange:ae})),n}})}})]}}),null),o}});return(()=>{var o=Zt(),s=o.firstChild,n=s.firstChild,p=n.firstChild,g=s.nextSibling;return r(p,()=>t.t("settings.tab.general")),r(g,e(w,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(Te,{})}}),null),r(g,e(w,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(De,{})}}),null),r(g,e(Fe,{}),null),r(g,e(ze,{}),null),r(g,e(Ee,{}),null),r(g,e(Ae,{}),null),r(g,e(Ne,{}),null),r(g,e(Le,{}),null),r(g,e(w,{get when(){return A()},get children(){return e(Ie,{})}}),null),o})()},f=i=>(()=>{var t=Kt(),a=t.firstChild,c=a.firstChild,v=c.nextSibling,m=a.nextSibling;return r(c,()=>i.title),r(v,()=>i.description),r(m,()=>i.children),t})();function Ce(i){const t=me(),a=he();return e(w,{get when(){return a.general.newLayoutDesigns()},get fallback(){return i.children},get children(){return e(w,{get when(){return t.settings.server.selected()},children:c=>e(qt,{get server(){return c()},get children(){return i.children}})})}})}function qt(i){const t=me(),a=()=>t.ensureServerCtx(i.server);return e(lt,{get client(){return a().queryClient},get children(){return e(nt,{server:()=>i.server,get children(){return e(st,{get children(){return e(it,{get children(){return i.children}})}})}})}})}function ke(){const i=me(),t=he(),a=z(()=>t.general.newLayoutDesigns()?i.settings.server.selected():void 0);return e(w,{get when(){return a()},children:c=>e(G,{gutter:4,placement:"bottom-end",get children(){return[e(G.Trigger,{as:q,variant:"secondary",size:"large",class:"h-8 max-w-[260px] gap-2 px-2 py-1.5 data-[expanded]:bg-surface-base-active",get children(){return[e(xe,{get health(){return i.servers.health[te.key(c())]}}),e(be,{get conn(){return c()},get status(){return i.servers.health[te.key(c())]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"hidden"}),e(j,{name:"chevron-down",size:"small",class:"text-icon-weak shrink-0"})]}}),e(G.Portal,{get children(){return e(G.Content,{class:"w-[320px] mt-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-2 [&_[data-slot=dropdown-menu-radio-item]]:pr-2",get children(){return e(G.RadioGroup,{get value(){return i.settings.server.key},onChange:v=>{typeof v=="string"&&i.settings.server.set(te.Key.make(v))},get children(){return e(Y,{get each(){return i.servers.list()},children:v=>{const m=te.key(v),l=()=>i.servers.health[m]?.healthy===!1;return e(G.RadioItem,{value:m,get disabled(){return l()},get children(){return[e(xe,{get health(){return i.servers.health[m]}}),e(be,{conn:v,get dimmed(){return l()},get status(){return i.servers.health[m]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"text-12-regular text-text-weak truncate"}),e(G.ItemIndicator,{get children(){return e(j,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})}})}})}})}})]}})})}var Ut=d('<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">'),Qt=d('<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 items-center justify-between gap-4 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">'),Ht=d('<div class="py-4 text-14-regular text-text-weak">'),Wt=d('<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">'),Xt=d('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Yt=d('<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">'),Jt=d('<span class="text-12-regular text-text-weak pl-8">');const er=[{match:i=>i==="opencode",key:"dialog.provider.opencode.note"},{match:i=>i==="opencode-go",key:"dialog.provider.opencodeGo.tagline"},{match:i=>i==="anthropic",key:"dialog.provider.anthropic.note"},{match:i=>i.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:i=>i==="openai",key:"dialog.provider.openai.note"},{match:i=>i==="google",key:"dialog.provider.google.note"},{match:i=>i==="openrouter",key:"dialog.provider.openrouter.note"},{match:i=>i==="vercel",key:"dialog.provider.vercel.note"}],tr=i=>e(Ce,{get children(){return e(rr,{get onBack(){return i.onBack}})}}),rr=i=>{const t=pe(),a=J(),c=ye(),v=at(),m=$e(),l=ot(()=>{}),_=_t({onBack:i.onBack}),y=h=>{_.select(h),t.show(()=>e(yt,{controller:_}))},k=z(()=>l.connected().filter(h=>h.id!=="opencode"||Object.values(h.models).find(u=>u.cost?.input))),P=z(()=>{const h=new Set(k().map(b=>b.id)),u=l.popular().filter(b=>!h.has(b.id)).slice();return u.sort((b,B)=>le.indexOf(b.id)-le.indexOf(B.id)),u}),T=h=>{if(!("source"in h))return;const u=h.source;if(u==="env"||u==="api"||u==="config"||u==="custom")return u},A=h=>{const u=T(h);return u==="env"?a.t("settings.providers.tag.environment"):u==="api"?a.t("provider.connect.method.apiKey"):u==="config"?L(h.id)?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.config"):u==="custom"?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.other")},N=h=>T(h)!=="env"&&(v()==="v1"||!L(h.id)),F=h=>er.find(u=>u.match(h))?.key,L=h=>{const u=m().data.config.provider?.[h];return!(!u||u.npm!=="@ai-sdk/openai-compatible"||!u.models||Object.keys(u.models).length===0)},O=async(h,u)=>{if(v()!=="v1")return;const b=m().data.config.disabled_providers??[],B=b.includes(h)?b:[...b,h];m().set("config","disabled_providers",B),await m().updateConfig({disabled_providers:B}).then(()=>{ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(R=>{m().set("config","disabled_providers",b);const Z=R instanceof Error?R.message:String(R);ne({title:a.t("common.requestFailed"),description:Z})})},U=async(h,u)=>{if(L(h)){await c().client.auth.remove({providerID:h}).catch(()=>{}),await O(h,u);return}await c().client.auth.remove({providerID:h}).then(async()=>{await c().client.global.dispose(),ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(b=>{const B=b instanceof Error?b.message:String(b);ne({title:a.t("common.requestFailed"),description:B})})};return(()=>{var h=Qt(),u=h.firstChild,b=u.firstChild,B=b.firstChild,R=u.nextSibling,Z=R.firstChild,ae=Z.firstChild,X=Z.nextSibling,ee=X.firstChild;return r(B,()=>a.t("settings.providers.title")),r(b,e(ke,{}),null),r(ae,()=>a.t("settings.providers.section.connected")),r(Z,e(E,{get children(){return e(w,{get when(){return k().length>0},get fallback(){return(()=>{var x=Ht();return r(x,()=>a.t("settings.providers.connected.empty")),x})()},get children(){return e(Y,{get each(){return k()},children:x=>(()=>{var D=Wt(),S=D.firstChild,I=S.firstChild;return r(S,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>x.name),r(S,e(re,{get children(){return A(x)}}),null),r(D,e(w,{get when(){return N(x)},get fallback(){return(()=>{var V=Xt();return r(V,()=>a.t("settings.providers.connected.environmentDescription")),V})()},get children(){return e(q,{size:"large",variant:"ghost",onClick:()=>void U(x.id,x.name),get children(){return a.t("common.disconnect")}})}}),null),D})()})}})}}),null),r(ee,()=>a.t("settings.providers.section.popular")),r(X,e(E,{get children(){return[e(Y,{get each(){return P()},children:x=>(()=>{var D=Yt(),S=D.firstChild,I=S.firstChild,V=I.firstChild;return r(I,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),V),r(V,()=>x.name),r(I,e(w,{get when(){return x.id==="opencode"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null),r(I,e(w,{get when(){return x.id==="opencode-go"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null),r(S,e(w,{get when(){return F(x.id)},children:oe=>(()=>{var Q=Jt();return r(Q,()=>a.t(oe())),Q})()}),null),r(D,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>y(x.id),get children(){return a.t("common.connect")}}),null),D})()}),e(w,{get when(){return v()==="v1"},get children(){var x=Ut(),D=x.firstChild,S=D.firstChild,I=S.firstChild,V=S.nextSibling;return r(S,e(ie,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>a.t("provider.custom.title")),r(S,e(re,{get children(){return a.t("settings.providers.tag.custom")}}),null),r(V,()=>a.t("settings.providers.custom.description")),r(x,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>e($t,{get onBack(){return t.close}}))},get children(){return a.t("common.connect")}}),null),x}})]}}),null),r(X,e(q,{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:()=>y(),get children(){return a.t("dialog.provider.viewAll")}}),null),h})()};var Pe=d('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),nr=d('<span class="text-14-regular text-text-strong mt-1">"<!>"'),sr=d('<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]">'),ir=d('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),lr=d('<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 ar=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.label),t})(),or=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.message),r(t,e(w,{get when(){return i.filter},get children(){var c=nr(),v=c.firstChild,m=v.nextSibling;return m.nextSibling,r(c,()=>i.filter,m),c}}),null),t})(),cr=()=>e(Ce,{get children(){return e(gr,{})}}),gr=()=>{const i=J(),t=ct(),a=gt({items:c=>t.list(),key:c=>`${c.provider.id}:${c.id}`,filterKeys:["provider.name","name","id"],sortBy:(c,v)=>c.name.localeCompare(v.name),groupBy:c=>c.provider.id,sortGroupsBy:(c,v)=>{const m=le.indexOf(c.category),l=le.indexOf(v.category),_=m>=0,y=l>=0;if(_&&!y)return-1;if(!_&&y)return 1;if(_&&y)return m-l;const k=c.items[0].provider.name,P=v.items[0].provider.name;return k.localeCompare(P)}});return(()=>{var c=sr(),v=c.firstChild,m=v.firstChild,l=m.firstChild,_=l.firstChild,y=l.nextSibling,k=v.nextSibling;return r(_,()=>i.t("settings.models.title")),r(l,e(ke,{}),null),r(y,e(j,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),r(y,e(se,{variant:"ghost",type:"text",get value(){return a.filter()},get onChange(){return a.onInput},get placeholder(){return i.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),r(y,e(w,{get when(){return a.filter()},get children(){return e(dt,{icon:"circle-x",variant:"ghost",get onClick(){return a.clear}})}}),null),r(k,e(w,{get when(){return!a.grouped.loading},get fallback(){return e(ar,{get label(){return`${i.t("common.loading")}${i.t("common.loading.ellipsis")}`}})},get children(){return e(w,{get when(){return a.flat().length>0},get fallback(){return e(or,{get message(){return i.t("dialog.model.empty")},get filter(){return a.filter()}})},get children(){return e(Y,{get each(){return a.grouped.latest},children:P=>(()=>{var T=ir(),A=T.firstChild,N=A.firstChild;return r(A,e(ie,{get id(){return P.category},class:"size-5 shrink-0 icon-strong-base"}),N),r(N,()=>P.items[0].provider.name),r(T,e(E,{get children(){return e(Y,{get each(){return P.items},children:F=>{const L={providerID:F.provider.id,modelID:F.id};return(()=>{var O=lr(),U=O.firstChild,h=U.firstChild,u=U.nextSibling;return r(h,()=>F.name),r(u,e($,{get checked(){return t.visible(L)},onChange:b=>{t.setVisibility(L,b)},hideLabel:!0,get children(){return F.name}})),O})()}})}}),null),T})()})}})}})),c})()};var dr=d('<div class="flex flex-1 min-h-0 flex-col gap-4 pt-6"><div class="text-16-medium text-text-strong">'),ur=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="flex flex-col flex-1 min-h-0 max-w-[720px]">'),pr=d('<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">');const hr=()=>{const i=J(),t=ut();return(()=>{var a=ur(),c=a.firstChild;return r(c,e(w,{get when(){return t.isFormMode()},get fallback(){return[(()=>{var v=pr(),m=v.firstChild,l=m.firstChild;return r(l,()=>i.t("status.popover.tab.servers")),v})(),e(ht,{controller:t})]},get children(){var v=dr(),m=v.firstChild;return r(m,()=>t.formTitle()),r(v,e(pt,{controller:t}),null),v}})),a})()};var mr=d('<div class="flex flex-col justify-between h-full w-full gap-4"><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 vr=i=>{const t=J(),a=_e(),c=pe(),[v,m]=mt(i.defaultValue??"general"),l=()=>{c.show(()=>e(vr,{defaultValue:"providers"}))};return e(ft,{size:"x-large",transition:!0,get children(){return e(C,{orientation:"vertical",variant:"settings",get value(){return v()},onChange:_=>void vt(()=>m(_)),class:"h-full settings-dialog",get children(){return[e(C.List,{get children(){var _=mr(),y=_.firstChild,k=y.firstChild,P=k.firstChild,T=P.firstChild,A=P.nextSibling,N=A.firstChild,F=y.nextSibling,L=F.firstChild,O=L.nextSibling;return O.firstChild,r(P,e(C.SectionTitle,{get children(){return t.t("settings.section.desktop")}}),T),r(T,e(C.Trigger,{value:"general",get children(){return[e(j,{name:"sliders"}),W(()=>t.t("settings.tab.general"))]}}),null),r(T,e(C.Trigger,{value:"shortcuts",get children(){return[e(j,{name:"keyboard"}),W(()=>t.t("settings.tab.shortcuts"))]}}),null),r(T,e(C.Trigger,{value:"servers",get children(){return[e(j,{name:"server"}),W(()=>t.t("status.popover.tab.servers"))]}}),null),r(A,e(C.SectionTitle,{get children(){return t.t("settings.section.server")}}),N),r(N,e(C.Trigger,{value:"providers",get children(){return[e(j,{name:"providers"}),W(()=>t.t("settings.providers.title"))]}}),null),r(N,e(C.Trigger,{value:"models",get children(){return[e(j,{name:"models"}),W(()=>t.t("settings.models.title"))]}}),null),r(L,()=>t.t("app.name.desktop")),r(O,()=>a.version,null),_}}),e(C.Content,{value:"general",class:"no-scrollbar",get children(){return e(Gt,{})}}),e(C.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return e(bt,{})}}),e(C.Content,{value:"servers",class:"no-scrollbar",get children(){return e(hr,{})}}),e(C.Content,{value:"providers",class:"no-scrollbar",get children(){return e(tr,{onBack:l})}}),e(C.Content,{value:"models",class:"no-scrollbar",get children(){return e(cr,{})}})]}})}})};export{vr as DialogSettings};
|
|
2
|
+
import{co as Oe,b_ as J,c5 as Ve,c6 as _e,bV as pe,c4 as je,ck as he,aD as z,aQ as Me,ch as $e,cg as ye,aI as ce,bm as Re,b6 as r,au as e,a2 as w,bL as d,af as Ze,a9 as Ke,B as q,T as K,ba as W,aa as se,bB as Ge,bC as qe,be as Ue,bf as Qe,bM as He,bN as We,bc as ge,ac as Xe,I as j,bD as Ye,bg as Je,bO as et,S as tt,bv as rt,bZ as me,l as G,Y as xe,V as te,Z as be,o as Y,$ as nt,a0 as st,y as it,Q as lt,cf as at,c9 as ot,bw as le,N as ie,a8 as re,bG as ne,c1 as ct,bX as gt,u as dt,ce as ut,W as pt,X as ht,aK as mt,a7 as C,bK as vt,b as ft}from"./index-BfNxi3ev.js";import{S as $}from"./switch-CVS6td1r.js";import{u as xt,a as E,S as bt}from"./settings-keybinds-BOa6QxJ6.js";import{L as wt,u as _t,a as $t,D as yt}from"./dialog-connect-provider-DLnpNUTc.js";import"./LROKH5N7-D8CK0ENS.js";import"./list-FiQEDby0.js";var St=d("<div data-action=settings-new-layout-designs>"),de=d('<div class="flex flex-col gap-1">'),Ct=d('<span class="flex items-center gap-2">'),kt=d("<div data-action=settings-auto-accept-permissions>"),Pt=d("<div data-action=settings-feed-reasoning-summaries>"),Tt=d("<div data-action=settings-feed-shell-tool-parts-expanded>"),Dt=d("<div data-action=settings-feed-edit-tool-parts-expanded>"),Ft=d("<div data-action=settings-show-file-tree>"),It=d("<div data-action=settings-show-navigation>"),zt=d("<div data-action=settings-show-search>"),Et=d("<div data-action=settings-show-status>"),At=d("<div data-action=settings-show-custom-agents>"),H=d('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),ue=d('<div class="w-full sm:w-[220px]">'),Nt=d("<div data-action=settings-notifications-agent>"),Lt=d("<div data-action=settings-notifications-permissions>"),Bt=d("<div data-action=settings-notifications-errors>"),Ot=d("<div data-action=settings-release-notes>"),Vt=d("<div data-action=settings-pinch-zoom>"),jt=d("<div data-action=settings-wayland>"),Mt=d("<span class=text-text-weak>"),Rt=d('<div class="flex items-center gap-2"><span>'),Zt=d('<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">'),Kt=d('<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 M={cleanup:void 0,timeout:void 0,run:0};const Se=()=>{M.run+=1,M.cleanup&&M.cleanup(),clearTimeout(M.timeout),M.cleanup=void 0},we=i=>{if(Se(),!i)return;const t=++M.run;M.timeout=setTimeout(()=>{rt(i).then(a=>{if(M.run!==t){a?.();return}M.cleanup=a})},100)},Gt=()=>{const i=Oe(),t=J(),a=Ve(),c=_e(),v=pe(),m=je(),l=he(),_=xt(),y=z(()=>c.platform==="desktop"&&c.os==="linux"),k=z(()=>Me(m.dir)),P=z(()=>{const o=k();return o?m.id?a.isAutoAccepting(m.id,o):a.isAutoAcceptingDirectory(o):!1}),T=o=>{const s=k();if(s){if(!m.id){if(a.isAutoAcceptingDirectory(s)===o)return;a.toggleAutoAcceptDirectory(s);return}if(o){a.enableAutoAccept(m.id,s);return}a.disableAutoAccept(m.id,s)}},A=z(()=>c.platform==="desktop"),N=z(()=>i.ids().map(o=>({id:o,name:i.name(o)}))),F=$e(),L=ye(),[O]=ce(async()=>{const o=L();return await o.protocol==="v1"?(await o.client.pty.shells()).data??[]:[]},{initialValue:[]}),[U,{refetch:h}]=ce(()=>!!(y()&&c.getDisplayBackend),()=>Promise.resolve(c.getDisplayBackend?.()??null).catch(()=>null),{initialValue:null}),[u,{mutate:b}]=ce(()=>!!(A()&&c.getPinchZoomEnabled),()=>Promise.resolve(c.getPinchZoomEnabled?.()??!1).catch(()=>!1),{initialValue:!1});Re(()=>{i.loadThemes()});const B={id:"auto",value:"",label:t.t("settings.general.row.shell.autoDefault")},R=z(()=>F().data.config.shell??""),Z=z(()=>{const o=O.latest,s=F().data.config.shell,n=new Map;for(const g of o)n.set(g.name,(n.get(g.name)||0)+1);const p=[B,...o.map(g=>{const ve=(n.get(g.name)||0)>1,fe=ve?g.path:g.name,Be=g.acceptable?fe:`${fe} (${t.t("settings.general.row.shell.terminalOnly")})`;return{id:g.path,value:ve?g.path:g.name,label:Be}})];return s&&!p.some(g=>g.value===s)&&p.push({id:s,value:s,label:s}),p}),ae=o=>{const s=c.setDisplayBackend?.(o?"wayland":"auto");s&&s.finally(()=>{h()})},X=o=>{b(o);const s=c.setPinchZoomEnabled?.(o);s&&s.catch(()=>b(!o))},ee=z(()=>[{value:"system",label:t.t("theme.scheme.system")},{value:"light",label:t.t("theme.scheme.light")},{value:"dark",label:t.t("theme.scheme.dark")}]),x=z(()=>t.locales.map(o=>({value:o,label:t.label(o)}))),D={id:"none",label:"sound.option.none"},S=[D,...tt],I=()=>Je(l.appearance.font()),V=()=>Ye(l.appearance.uiFont()),oe=()=>et(l.appearance.terminalFont()),Q=(o,s,n,p)=>({options:S,current:o()?S.find(g=>g.id===s())??D:D,value:g=>g.id,label:g=>t.t(g.label),onHighlight:g=>{g&&we(g.id==="none"?void 0:g.id)},onSelect:g=>{if(g){if(g.id==="none"){n(!1),Se();return}n(!0),p(g.id),we(g.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),Te=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return(()=>{var s=Ct();return r(s,()=>t.t("settings.general.row.newInterface.title"),null),r(s,e(Ke,{variant:"accent",get children(){return t.t("settings.general.row.newInterface.badge")}}),null),s})()},get description(){return t.t("settings.general.row.newInterface.description")},get children(){var s=St();return r(s,e($,{get checked(){return l.general.newLayoutDesigns()},onChange:n=>{l.general.setNewLayoutDesigns(n),n&&Ze(()=>import("./index-wflYMX4p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(p=>{v.show(()=>e(p.DialogSettings,{}))})}})),s}})}})),o})(),De=()=>(()=>{var o=de();return r(o,e(E,{get children(){return e(f,{get title(){return t.t("settings.general.row.newInterfaceNotice.title")},get description(){return t.t("settings.general.row.newInterfaceNotice.description")},get children(){return e(q,{size:"small",variant:"ghost",get onClick(){return l.general.dismissNewInterfaceNotice},get children(){return t.t("settings.general.row.newInterfaceNotice.dismiss")}})}})}})),o})(),Fe=()=>(()=>{var o=de();return r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.language.title")},get description(){return t.t("settings.general.row.language.description")},get children(){return e(K,{"data-action":"settings-language",get options(){return x()},get current(){return x().find(s=>s.value===t.locale())},value:s=>s.value,label:s=>s.label,onSelect:s=>s&&t.setLocale(s.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("command.permissions.autoaccept.enable")},get description(){return t.t("toast.permissions.autoaccept.on.description")},get children(){var s=kt();return r(s,e($,{get checked(){return P()},get disabled(){return!k()},onChange:T})),s}}),e(f,{get title(){return t.t("settings.general.row.shell.title")},get description(){return t.t("settings.general.row.shell.description")},get children(){return e(K,{"data-action":"settings-shell",get options(){return Z()},get current(){return Z().find(s=>s.value===R())??B},value:s=>s.id,label:s=>s.label,onSelect:s=>{s&&s.value!==R()&&F().updateConfig({shell:s.value})},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"180px"}})}}),e(f,{get title(){return t.t("settings.general.row.reasoningSummaries.title")},get description(){return t.t("settings.general.row.reasoningSummaries.description")},get children(){var s=Pt();return r(s,e($,{get checked(){return l.general.showReasoningSummaries()},onChange:n=>l.general.setShowReasoningSummaries(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return t.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var s=Tt();return r(s,e($,{get checked(){return l.general.shellToolPartsExpanded()},onChange:n=>l.general.setShellToolPartsExpanded(n)})),s}}),e(f,{get title(){return t.t("settings.general.row.editToolPartsExpanded.title")},get description(){return t.t("settings.general.row.editToolPartsExpanded.description")},get children(){var s=Dt();return r(s,e($,{get checked(){return l.general.editToolPartsExpanded()},onChange:n=>l.general.setEditToolPartsExpanded(n)})),s}})]}})),o})(),Ie=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.advanced")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.showFileTree.title")},get description(){return t.t("settings.general.row.showFileTree.description")},get children(){var n=Ft();return r(n,e($,{get checked(){return l.general.showFileTree()},onChange:p=>l.general.setShowFileTree(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showNavigation.title")},get description(){return t.t("settings.general.row.showNavigation.description")},get children(){var n=It();return r(n,e($,{get checked(){return l.general.showNavigation()},onChange:p=>l.general.setShowNavigation(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showSearch.title")},get description(){return t.t("settings.general.row.showSearch.description")},get children(){var n=zt();return r(n,e($,{get checked(){return l.general.showSearch()},onChange:p=>l.general.setShowSearch(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showStatus.title")},get description(){return t.t("settings.general.row.showStatus.description")},get children(){var n=Et();return r(n,e($,{get checked(){return l.general.showStatus()},onChange:p=>l.general.setShowStatus(p)})),n}}),e(f,{get title(){return t.t("settings.general.row.showCustomAgents.title")},get description(){return t.t("settings.general.row.showCustomAgents.description")},get children(){var n=At();return r(n,e($,{get checked(){return l.general.showCustomAgents()},onChange:p=>l.general.setShowCustomAgents(p)})),n}})]}}),null),o})(),ze=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.appearance")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.colorScheme.title")},get description(){return t.t("settings.general.row.colorScheme.description")},get children(){return e(K,{"data-action":"settings-color-scheme",get options(){return ee()},get current(){return ee().find(n=>n.value===i.colorScheme())},value:n=>n.value,label:n=>n.label,onSelect:n=>n&&i.setColorScheme(n.value),variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),e(f,{get title(){return t.t("settings.general.row.theme.title")},get description(){return[W(()=>t.t("settings.general.row.theme.description"))," ",e(wt,{href:"https://opencode.ai/docs/themes/",get children(){return t.t("common.learnMore")}})]},get children(){return e(K,{"data-action":"settings-theme",get options(){return N()},get current(){return N().find(n=>n.id===i.themeId())},value:n=>n.id,label:n=>n.name,onSelect:n=>{n&&i.setTheme(n.id)},variant:"secondary",size:"small",triggerVariant:"settings"})}}),e(f,{get title(){return t.t("settings.general.row.uiFont.title")},get description(){return t.t("settings.general.row.uiFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-ui-font",get label(){return t.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return V()},onChange:p=>l.appearance.setUIFont(p),placeholder:Ge,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":qe(l.appearance.uiFont())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.font.title")},get description(){return t.t("settings.general.row.font.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-code-font",get label(){return t.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return I()},onChange:p=>l.appearance.setFont(p),placeholder:Ue,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Qe(l.appearance.font())}}})),n}}),e(f,{get title(){return t.t("settings.general.row.terminalFont.title")},get description(){return t.t("settings.general.row.terminalFont.description")},get children(){var n=ue();return r(n,e(se,{"data-action":"settings-terminal-font",get label(){return t.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return oe()},onChange:p=>l.appearance.setTerminalFont(p),placeholder:He,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":We(l.appearance.terminalFont())}}})),n}})]}}),null),o})(),Ee=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.notifications")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.notifications.agent.title")},get description(){return t.t("settings.general.notifications.agent.description")},get children(){var n=Nt();return r(n,e($,{get checked(){return l.notifications.agent()},onChange:p=>l.notifications.setAgent(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.permissions.title")},get description(){return t.t("settings.general.notifications.permissions.description")},get children(){var n=Lt();return r(n,e($,{get checked(){return l.notifications.permissions()},onChange:p=>l.notifications.setPermissions(p)})),n}}),e(f,{get title(){return t.t("settings.general.notifications.errors.title")},get description(){return t.t("settings.general.notifications.errors.description")},get children(){var n=Bt();return r(n,e($,{get checked(){return l.notifications.errors()},onChange:p=>l.notifications.setErrors(p)})),n}})]}}),null),o})(),Ae=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.sounds")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.sounds.agent.title")},get description(){return t.t("settings.general.sounds.agent.description")},get children(){return e(K,ge({"data-action":"settings-sounds-agent"},()=>Q(()=>l.sounds.agentEnabled(),()=>l.sounds.agent(),n=>l.sounds.setAgentEnabled(n),n=>l.sounds.setAgent(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.permissions.title")},get description(){return t.t("settings.general.sounds.permissions.description")},get children(){return e(K,ge({"data-action":"settings-sounds-permissions"},()=>Q(()=>l.sounds.permissionsEnabled(),()=>l.sounds.permissions(),n=>l.sounds.setPermissionsEnabled(n),n=>l.sounds.setPermissions(n))))}}),e(f,{get title(){return t.t("settings.general.sounds.errors.title")},get description(){return t.t("settings.general.sounds.errors.description")},get children(){return e(K,ge({"data-action":"settings-sounds-errors"},()=>Q(()=>l.sounds.errorsEnabled(),()=>l.sounds.errors(),n=>l.sounds.setErrorsEnabled(n),n=>l.sounds.setErrors(n))))}})]}}),null),o})(),Ne=()=>(()=>{var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.updates")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.releaseNotes.title")},get description(){return t.t("settings.general.row.releaseNotes.description")},get children(){var n=Ot();return r(n,e($,{get checked(){return l.general.releaseNotes()},onChange:p=>l.general.setReleaseNotes(p)})),n}}),e(f,{get title(){return t.t("settings.updates.row.check.title")},get description(){return t.t("settings.updates.row.check.description")},get children(){return e(q,{size:"small",variant:"secondary",get disabled(){return!_.action().run},get onClick(){return _.run},get children(){return t.t(_.action().label)}})}})]}}),null),o})(),Le=()=>e(w,{get when(){return A()},get children(){var o=H(),s=o.firstChild;return r(s,()=>t.t("settings.general.section.display")),r(o,e(E,{get children(){return[e(f,{get title(){return t.t("settings.general.row.pinchZoom.title")},get description(){return t.t("settings.general.row.pinchZoom.description")},get children(){var n=Vt();return r(n,e($,{get checked(){return u.latest},onChange:X})),n}}),e(w,{get when(){return y()},get children(){return e(f,{get title(){return(()=>{var n=Rt(),p=n.firstChild;return r(p,()=>t.t("settings.general.row.wayland.title")),r(n,e(Xe,{get value(){return t.t("settings.general.row.wayland.tooltip")},placement:"top",get children(){var g=Mt();return r(g,e(j,{name:"help",size:"small"})),g}}),null),n})()},get description(){return t.t("settings.general.row.wayland.description")},get children(){var n=jt();return r(n,e($,{get checked(){return U.latest==="wayland"},onChange:ae})),n}})}})]}}),null),o}});return(()=>{var o=Zt(),s=o.firstChild,n=s.firstChild,p=n.firstChild,g=s.nextSibling;return r(p,()=>t.t("settings.tab.general")),r(g,e(w,{get when(){return l.general.layoutTransitionAvailable()},get children(){return e(Te,{})}}),null),r(g,e(w,{get when(){return l.general.newInterfaceNoticeVisible()},get children(){return e(De,{})}}),null),r(g,e(Fe,{}),null),r(g,e(ze,{}),null),r(g,e(Ee,{}),null),r(g,e(Ae,{}),null),r(g,e(Ne,{}),null),r(g,e(Le,{}),null),r(g,e(w,{get when(){return A()},get children(){return e(Ie,{})}}),null),o})()},f=i=>(()=>{var t=Kt(),a=t.firstChild,c=a.firstChild,v=c.nextSibling,m=a.nextSibling;return r(c,()=>i.title),r(v,()=>i.description),r(m,()=>i.children),t})();function Ce(i){const t=me(),a=he();return e(w,{get when(){return a.general.newLayoutDesigns()},get fallback(){return i.children},get children(){return e(w,{get when(){return t.settings.server.selected()},children:c=>e(qt,{get server(){return c()},get children(){return i.children}})})}})}function qt(i){const t=me(),a=()=>t.ensureServerCtx(i.server);return e(lt,{get client(){return a().queryClient},get children(){return e(nt,{server:()=>i.server,get children(){return e(st,{get children(){return e(it,{get children(){return i.children}})}})}})}})}function ke(){const i=me(),t=he(),a=z(()=>t.general.newLayoutDesigns()?i.settings.server.selected():void 0);return e(w,{get when(){return a()},children:c=>e(G,{gutter:4,placement:"bottom-end",get children(){return[e(G.Trigger,{as:q,variant:"secondary",size:"large",class:"h-8 max-w-[260px] gap-2 px-2 py-1.5 data-[expanded]:bg-surface-base-active",get children(){return[e(xe,{get health(){return i.servers.health[te.key(c())]}}),e(be,{get conn(){return c()},get status(){return i.servers.health[te.key(c())]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"hidden"}),e(j,{name:"chevron-down",size:"small",class:"text-icon-weak shrink-0"})]}}),e(G.Portal,{get children(){return e(G.Content,{class:"w-[320px] mt-1 [&_[data-slot=dropdown-menu-radio-item]]:pl-2 [&_[data-slot=dropdown-menu-radio-item]]:pr-2",get children(){return e(G.RadioGroup,{get value(){return i.settings.server.key},onChange:v=>{typeof v=="string"&&i.settings.server.set(te.Key.make(v))},get children(){return e(Y,{get each(){return i.servers.list()},children:v=>{const m=te.key(v),l=()=>i.servers.health[m]?.healthy===!1;return e(G.RadioItem,{value:m,get disabled(){return l()},get children(){return[e(xe,{get health(){return i.servers.health[m]}}),e(be,{conn:v,get dimmed(){return l()},get status(){return i.servers.health[m]},class:"flex items-center gap-2 min-w-0 flex-1",nameClass:"text-14-regular text-text-base truncate",versionClass:"text-12-regular text-text-weak truncate"}),e(G.ItemIndicator,{get children(){return e(j,{name:"check-small",size:"small",class:"text-icon-weak"})}})]}})}})}})}})}})]}})})}var Ut=d('<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">'),Qt=d('<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 items-center justify-between gap-4 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">'),Ht=d('<div class="py-4 text-14-regular text-text-weak">'),Wt=d('<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">'),Xt=d('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Yt=d('<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">'),Jt=d('<span class="text-12-regular text-text-weak pl-8">');const er=[{match:i=>i==="opencode",key:"dialog.provider.opencode.note"},,{match:i=>i==="anthropic",key:"dialog.provider.anthropic.note"},{match:i=>i.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:i=>i==="openai",key:"dialog.provider.openai.note"},{match:i=>i==="google",key:"dialog.provider.google.note"},{match:i=>i==="openrouter",key:"dialog.provider.openrouter.note"},{match:i=>i==="vercel",key:"dialog.provider.vercel.note"}],tr=i=>e(Ce,{get children(){return e(rr,{get onBack(){return i.onBack}})}}),rr=i=>{const t=pe(),a=J(),c=ye(),v=at(),m=$e(),l=ot(()=>{}),_=_t({onBack:i.onBack}),y=h=>{_.select(h),t.show(()=>e(yt,{controller:_}))},k=z(()=>l.connected().filter(h=>h.id!=="opencode"||Object.values(h.models).find(u=>u.cost?.input))),P=z(()=>{const h=new Set(k().map(b=>b.id)),u=l.popular().filter(b=>!h.has(b.id)).slice();return u.sort((b,B)=>le.indexOf(b.id)-le.indexOf(B.id)),u}),T=h=>{if(!("source"in h))return;const u=h.source;if(u==="env"||u==="api"||u==="config"||u==="custom")return u},A=h=>{const u=T(h);return u==="env"?a.t("settings.providers.tag.environment"):u==="api"?a.t("provider.connect.method.apiKey"):u==="config"?L(h.id)?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.config"):u==="custom"?a.t("settings.providers.tag.custom"):a.t("settings.providers.tag.other")},N=h=>T(h)!=="env"&&(v()==="v1"||!L(h.id)),F=h=>er.find(u=>u.match(h))?.key,L=h=>{const u=m().data.config.provider?.[h];return!(!u||u.npm!=="@ai-sdk/openai-compatible"||!u.models||Object.keys(u.models).length===0)},O=async(h,u)=>{if(v()!=="v1")return;const b=m().data.config.disabled_providers??[],B=b.includes(h)?b:[...b,h];m().set("config","disabled_providers",B),await m().updateConfig({disabled_providers:B}).then(()=>{ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(R=>{m().set("config","disabled_providers",b);const Z=R instanceof Error?R.message:String(R);ne({title:a.t("common.requestFailed"),description:Z})})},U=async(h,u)=>{if(L(h)){await c().client.auth.remove({providerID:h}).catch(()=>{}),await O(h,u);return}await c().client.auth.remove({providerID:h}).then(async()=>{await c().client.global.dispose(),ne({variant:"success",icon:"circle-check",title:a.t("provider.disconnect.toast.disconnected.title",{provider:u}),description:a.t("provider.disconnect.toast.disconnected.description",{provider:u})})}).catch(b=>{const B=b instanceof Error?b.message:String(b);ne({title:a.t("common.requestFailed"),description:B})})};return(()=>{var h=Qt(),u=h.firstChild,b=u.firstChild,B=b.firstChild,R=u.nextSibling,Z=R.firstChild,ae=Z.firstChild,X=Z.nextSibling,ee=X.firstChild;return r(B,()=>a.t("settings.providers.title")),r(b,e(ke,{}),null),r(ae,()=>a.t("settings.providers.section.connected")),r(Z,e(E,{get children(){return e(w,{get when(){return k().length>0},get fallback(){return(()=>{var x=Ht();return r(x,()=>a.t("settings.providers.connected.empty")),x})()},get children(){return e(Y,{get each(){return k()},children:x=>(()=>{var D=Wt(),S=D.firstChild,I=S.firstChild;return r(S,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>x.name),r(S,e(re,{get children(){return A(x)}}),null),r(D,e(w,{get when(){return N(x)},get fallback(){return(()=>{var V=Xt();return r(V,()=>a.t("settings.providers.connected.environmentDescription")),V})()},get children(){return e(q,{size:"large",variant:"ghost",onClick:()=>void U(x.id,x.name),get children(){return a.t("common.disconnect")}})}}),null),D})()})}})}}),null),r(ee,()=>a.t("settings.providers.section.popular")),r(X,e(E,{get children(){return[e(Y,{get each(){return P()},children:x=>(()=>{var D=Yt(),S=D.firstChild,I=S.firstChild,V=I.firstChild;return r(I,e(ie,{get id(){return x.id},class:"size-5 shrink-0 icon-strong-base"}),V),r(V,()=>x.name),r(I,e(w,{get when(){return x.id==="opencode"},get children(){return e(re,{get children(){return a.t("dialog.provider.tag.recommended")}})}}),null)),null),r(S,e(w,{get when(){return F(x.id)},children:oe=>(()=>{var Q=Jt();return r(Q,()=>a.t(oe())),Q})()}),null),r(D,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>y(x.id),get children(){return a.t("common.connect")}}),null),D})()}),e(w,{get when(){return v()==="v1"},get children(){var x=Ut(),D=x.firstChild,S=D.firstChild,I=S.firstChild,V=S.nextSibling;return r(S,e(ie,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),I),r(I,()=>a.t("provider.custom.title")),r(S,e(re,{get children(){return a.t("settings.providers.tag.custom")}}),null),r(V,()=>a.t("settings.providers.custom.description")),r(x,e(q,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>e($t,{get onBack(){return t.close}}))},get children(){return a.t("common.connect")}}),null),x}})]}}),null),r(X,e(q,{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:()=>y(),get children(){return a.t("dialog.provider.viewAll")}}),null),h})()};var Pe=d('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),nr=d('<span class="text-14-regular text-text-strong mt-1">"<!>"'),sr=d('<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]">'),ir=d('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong">'),lr=d('<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 ar=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.label),t})(),or=i=>(()=>{var t=Pe(),a=t.firstChild;return r(a,()=>i.message),r(t,e(w,{get when(){return i.filter},get children(){var c=nr(),v=c.firstChild,m=v.nextSibling;return m.nextSibling,r(c,()=>i.filter,m),c}}),null),t})(),cr=()=>e(Ce,{get children(){return e(gr,{})}}),gr=()=>{const i=J(),t=ct(),a=gt({items:c=>t.list(),key:c=>`${c.provider.id}:${c.id}`,filterKeys:["provider.name","name","id"],sortBy:(c,v)=>c.name.localeCompare(v.name),groupBy:c=>c.provider.id,sortGroupsBy:(c,v)=>{const m=le.indexOf(c.category),l=le.indexOf(v.category),_=m>=0,y=l>=0;if(_&&!y)return-1;if(!_&&y)return 1;if(_&&y)return m-l;const k=c.items[0].provider.name,P=v.items[0].provider.name;return k.localeCompare(P)}});return(()=>{var c=sr(),v=c.firstChild,m=v.firstChild,l=m.firstChild,_=l.firstChild,y=l.nextSibling,k=v.nextSibling;return r(_,()=>i.t("settings.models.title")),r(l,e(ke,{}),null),r(y,e(j,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),r(y,e(se,{variant:"ghost",type:"text",get value(){return a.filter()},get onChange(){return a.onInput},get placeholder(){return i.t("dialog.model.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),r(y,e(w,{get when(){return a.filter()},get children(){return e(dt,{icon:"circle-x",variant:"ghost",get onClick(){return a.clear}})}}),null),r(k,e(w,{get when(){return!a.grouped.loading},get fallback(){return e(ar,{get label(){return`${i.t("common.loading")}${i.t("common.loading.ellipsis")}`}})},get children(){return e(w,{get when(){return a.flat().length>0},get fallback(){return e(or,{get message(){return i.t("dialog.model.empty")},get filter(){return a.filter()}})},get children(){return e(Y,{get each(){return a.grouped.latest},children:P=>(()=>{var T=ir(),A=T.firstChild,N=A.firstChild;return r(A,e(ie,{get id(){return P.category},class:"size-5 shrink-0 icon-strong-base"}),N),r(N,()=>P.items[0].provider.name),r(T,e(E,{get children(){return e(Y,{get each(){return P.items},children:F=>{const L={providerID:F.provider.id,modelID:F.id};return(()=>{var O=lr(),U=O.firstChild,h=U.firstChild,u=U.nextSibling;return r(h,()=>F.name),r(u,e($,{get checked(){return t.visible(L)},onChange:b=>{t.setVisibility(L,b)},hideLabel:!0,get children(){return F.name}})),O})()}})}}),null),T})()})}})}})),c})()};var dr=d('<div class="flex flex-1 min-h-0 flex-col gap-4 pt-6"><div class="text-16-medium text-text-strong">'),ur=d('<div class="flex flex-col h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10"><div class="flex flex-col flex-1 min-h-0 max-w-[720px]">'),pr=d('<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">');const hr=()=>{const i=J(),t=ut();return(()=>{var a=ur(),c=a.firstChild;return r(c,e(w,{get when(){return t.isFormMode()},get fallback(){return[(()=>{var v=pr(),m=v.firstChild,l=m.firstChild;return r(l,()=>i.t("status.popover.tab.servers")),v})(),e(ht,{controller:t})]},get children(){var v=dr(),m=v.firstChild;return r(m,()=>t.formTitle()),r(v,e(pt,{controller:t}),null),v}})),a})()};var mr=d('<div class="flex flex-col justify-between h-full w-full gap-4"><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 vr=i=>{const t=J(),a=_e(),c=pe(),[v,m]=mt(i.defaultValue??"general"),l=()=>{c.show(()=>e(vr,{defaultValue:"providers"}))};return e(ft,{size:"x-large",transition:!0,get children(){return e(C,{orientation:"vertical",variant:"settings",get value(){return v()},onChange:_=>void vt(()=>m(_)),class:"h-full settings-dialog",get children(){return[e(C.List,{get children(){var _=mr(),y=_.firstChild,k=y.firstChild,P=k.firstChild,T=P.firstChild,A=P.nextSibling,N=A.firstChild,F=y.nextSibling,L=F.firstChild,O=L.nextSibling;return O.firstChild,r(P,e(C.SectionTitle,{get children(){return t.t("settings.section.desktop")}}),T),r(T,e(C.Trigger,{value:"general",get children(){return[e(j,{name:"sliders"}),W(()=>t.t("settings.tab.general"))]}}),null),r(T,e(C.Trigger,{value:"shortcuts",get children(){return[e(j,{name:"keyboard"}),W(()=>t.t("settings.tab.shortcuts"))]}}),null),r(T,e(C.Trigger,{value:"servers",get children(){return[e(j,{name:"server"}),W(()=>t.t("status.popover.tab.servers"))]}}),null),r(A,e(C.SectionTitle,{get children(){return t.t("settings.section.server")}}),N),r(N,e(C.Trigger,{value:"providers",get children(){return[e(j,{name:"providers"}),W(()=>t.t("settings.providers.title"))]}}),null),r(N,e(C.Trigger,{value:"models",get children(){return[e(j,{name:"models"}),W(()=>t.t("settings.models.title"))]}}),null),r(L,()=>t.t("app.name.desktop")),r(O,()=>a.version,null),_}}),e(C.Content,{value:"general",class:"no-scrollbar",get children(){return e(Gt,{})}}),e(C.Content,{value:"shortcuts",class:"no-scrollbar",get children(){return e(bt,{})}}),e(C.Content,{value:"servers",class:"no-scrollbar",get children(){return e(hr,{})}}),e(C.Content,{value:"providers",class:"no-scrollbar",get children(){return e(tr,{onBack:l})}}),e(C.Content,{value:"models",class:"no-scrollbar",get children(){return e(cr,{})}})]}})}})};export{vr as DialogSettings};
|
|
3
3
|
//# sourceMappingURL=dialog-settings-C0ClHN8Q.js.map
|