import{a as u,j as s}from"./vendor-query-SzWcOU0G.js";import{I as j,B as o}from"./index-CW3r0-Ob.js";import{ay as d,az as v,q as y,v as N,B as w,T as k}from"./vendor-icons-CVrPjN2Q.js";const E=({value:l,onChange:c,onSave:m,onDelete:i,placeholder:x="Enter API key...",loading:n=!1,isStored:a=!1,disabled:e=!1,saveLabel:h="Validate",savedLabel:f="Valid"})=>{const[t,p]=u.useState(!1);return s.jsxs("div",{className:"flex w-full items-stretch gap-1",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(j,{type:t?"text":"password",value:l,onChange:r=>c(r.target.value),placeholder:x,disabled:e,className:"font-mono pr-9"}),s.jsx("button",{type:"button",onClick:()=>p(r=>!r),className:"absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":t?"Hide key":"Show key",children:t?s.jsx(d,{className:"h-4 w-4"}):s.jsx(v,{className:"h-4 w-4"})})]}),s.jsxs(o,{variant:"default",onClick:m,disabled:!l.trim()||e||n,children:[n?s.jsx(y,{className:"h-4 w-4 animate-spin"}):a?s.jsx(N,{className:"h-4 w-4"}):s.jsx(w,{className:"h-4 w-4"}),a?f:h]}),a&&i&&s.jsx(o,{variant:"destructive",size:"icon",onClick:i,disabled:e,children:s.jsx(k,{className:"h-4 w-4"})})]})};export{E as A};
