import{a7 as w,j as e,a8 as p,r as P,a1 as I,S as b}from"./vendor-ClLR6ncd.js";import{S as v}from"./SmallStandardSelect-7k6-Wr8Q.js";import{d as g}from"./Visibility-DBeRDmOx.js";import{T as x}from"./index-OtVJl4GC.js";import{I as E}from"./InputAdornment-CFoDSQyQ.js";import{p as M,f as q,m as A,n as y}from"./model-BneMh0-t.js";var m={},C=p;Object.defineProperty(m,"__esModule",{value:!0});var S=m.default=void 0,_=C(w()),k=e;S=m.default=(0,_.default)((0,k.jsx)("path",{d:"M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"}),"VisibilityOff");function R(t){const[r,n]=P.useState(!1),s=()=>n(l=>!l),o=l=>{l.preventDefault()};return e.jsx(x,{InputProps:{endAdornment:e.jsx(E,{position:"end",children:e.jsx(I,{disabled:t.disabled,onClick:s,onMouseDown:o,children:r?e.jsx(S,{}):e.jsx(g,{})})})},type:r?"text":"password",...t})}function D({embedder:t,setEmbedder:r,setModel:n,embedderOptionsQuery:s,disabled:o,sx:l,required:u=!0}){return e.jsx(v,{required:u,items:s.data||[],label:"Vendor",disabled:!s.isSuccess||o,value:t,sx:{pr:0,...l},onChange:c=>{var i,f;const d=c.target.value;r(d||""),n(((f=(i=s.data)==null?void 0:i.find(({value:h})=>h===d))==null?void 0:f.defaultOption)||"")}})}function O({embedderOptionsQuery:t,embedder:r,model:n,setModel:s,disabled:o,sx:l,fullWidth:u}){var c,d;return e.jsx(v,{fullWidth:u,items:((d=(c=t.data)==null?void 0:c.find(({value:i})=>i===r))==null?void 0:d.options)||[],label:"Model",sx:{pr:0,...l},disabled:!r||o,value:n,onChange:i=>s(i.target.value||"")})}function V({apiKey:t,setApiKey:r,disabled:n,label:s,sx:o,required:l}){return e.jsx(R,{label:s||"API key",value:t,setter:r,disabled:n,sx:o,required:l})}function K({embedderOptionsQuery:t,embedder:r,model:n,scheme:s,setScheme:o,host:l,setHost:u,port:c,setPort:d,disabled:i,sx:f,containerSx:h}){var j;if(r!=="ollama")return null;const a=A(t,r,n);return e.jsxs(b,{direction:"row",flexWrap:"wrap",spacing:1,useFlexGap:!0,sx:h,children:[e.jsx(x,{label:"Scheme",value:s,required:!(a!=null&&a.scheme),placeholder:a==null?void 0:a.scheme,setter:o,disabled:i,sx:{width:"60px",...f}}),e.jsx(x,{label:"Host",value:l,required:!(a!=null&&a.host),placeholder:a==null?void 0:a.host,setter:u,disabled:i,fullWidth:!1,sx:{flexGrow:1,...f}}),e.jsx(x,{label:"Port",value:c,required:!(a!=null&&a.port),placeholder:(j=a==null?void 0:a.port)==null?void 0:j.toString(),setter:d,disabled:i,sx:{width:"50px",...f}})]})}function L({embedderOptionsQuery:t,embedder:r,model:n,endpointUrl:s,setEndpointUrl:o,sx:l,fullWidth:u}){if(r!=="databricks")return null;const c=M(t,r,n),d=!c,i=s===""?!1:!q(s);return e.jsx(x,{label:"Endpoint URL",required:d,placeholder:c,error:i,helperText:i?"Invalid URL. Please check the format.":void 0,value:s,setter:o,fullWidth:u,sx:l})}function T({embedderOptionsQuery:t={},embedder:r,model:n,apiKey:s,setApiKey:o,required:l,...u}){return y(t,r,n)?e.jsx(V,{apiKey:s,setApiKey:o,required:l??!0,...u}):null}function B(t){return e.jsxs(e.Fragment,{children:[e.jsx(D,{...t}),e.jsx(O,{...t}),e.jsx(T,{...t}),e.jsx(K,{...t}),e.jsx(L,{...t})]})}export{T as A,B as E,O as M,V as O,L as P,K as S,D as a};
