1import{o as ve}from"./rolldown-runtime-ChpBd9eV.js";import{a as ke,n as we}from"./vendor-react-DcWoBPJp.js";import{At as X,Bo as Ce,Ct as Ae,Dt as Ee,Go as Fe,Hi as De,Ho as Oe,Is as _e,Jt as Me,Li as $,Nr as Ue,Qa as oe,Sn as ne,Tr as Ie,Wa as te,_ as ie,da as le,g as _,gs as Le,ha as de,ir as Pe,jn as Re,ls as Y,mr as $e,na as me,qo as Te,qr as ze}from"./vendor-ui-hcrcJjHJ.js";import{u as Ge}from"./chunk-QUQL4437-DKXSrjJr.js";import{o as g}from"./authErrors-BJPPLK2J.js";import{r as Ve}from"./AuthContext-CWrypuf9.js";import{d as re,f as ae,m as M}from"./index-CL2aAkkR.js";import{t as Be}from"./SearchInput-DrhDJygS.js";import"./SearchInput-BBL0I83Y.js";import{t as J}from"./Input-CdbxVNBC.js";import{a as He,i as We,n as Ke,o as Je,r as Qe,t as Xe}from"./Dialog-BGm0rtm_.js";import{t as Q}from"./label-DC53kUfY.js";import{t as O}from"./VaultApiClient-D9YVUbnU.js";import{t as Ye}from"./Badge-8-nCtEoo.js";import"./Badge-Dyl1iSmB.js";import{t as Ze}from"./GlassPageHeader-KtIdCo6i.js";var s=ve(ke(),1);function qe(l={}){const{service:o,account:d,scope:p,initialized:f,autoRefresh:j=!1,refreshInterval:v=3e4}=l,[k,A]=(0,s.useState)([]),[U,y]=(0,s.useState)(!1),[I,h]=(0,s.use
1State)(null),x=(0,s.useMemo)(()=>{const a=new Set;return k.forEach(t=>a.add(t.service)),Array.from(a).sort()},[k]),n=(0,s.useCallback)(a=>({service:a?.service??o,account:a?.account??d,scope:a?.scope??p,initialized:a?.initialized??f,limit:a?.limit,offset:a?.offset}),[o,d,p,f]),m=(0,s.useCallback)(async a=>{y(!0),h(null);try{const t=n(a);g.debug("[useSecrets] Fetching secrets with filter:",t);const c=(await O.listSecrets(t))?.secrets??[];A(c),g.debug(`[useSecrets] Fetched ${c.length} secrets`)}catch(t){const c=t instanceof Error?t.message:"Failed to fetch secrets";g.error("[useSecrets] Error fetching secrets:",t),h(c),A([])}finally{y(!1)}},[n]),E=(0,s.useCallback)(async a=>{try{g.debug("[useSecrets] Creating secret:",{service:a.service,account:a.account,secretName:a.secretName,scope:a.scope});const t=await O.upsertSecret(a);return await m(),g.info("[useSecrets] Secret created successfully:",{id:t.id,service:a.service,account:a.account,secretName:a.secretName}),t}catch(t){const c=t instanceof Error?t.message:"Failed to create secret";throw g.error("[useSecrets] Error creating secret:",t),h(c),t}},[m]),L=(0,s.useCallback)(async a=>{try{g.debug("[useSecrets] Updating secret:",{service:a.service,account:a.account,secretName:a.secretName});const t=await O.upsertSecret(a);return await m(),g.info("[useSecrets] Secret updated successfully:",{id:t.id,version:t.version}),t}catch(t){const c=t instanceof Error?t.message:"Failed to update secret";throw g.error("[useSecrets] Error updating secret:",t),h(c),t}},[m]),S=(0,s.useCallback)(async(a,t)=>{try{g.debug("[useSecrets] Changing secret scope:",{secretId:a,targetScope:t.targetScope});const c=await O.changeSecretScope(a,t);return await m(),g.info("[useSecrets] Secret scope changed successfully:",{id:c.id,scope:c.scope}),c}catch(c){const N=c instanceof Error?c.message:"Failed to change secret scope";throw g.error("[useSecrets] Error changing secret scope:",{error:N}),h(N),c}},[m]),w=(0,s.useCallback)(async a=>{try{g.debug("[useSecrets] Deleting secret:",a),await O.deleteSecret(a),A(t=>t.filter(c=>c.id!==a)),g.info("[useSecrets] Secret deleted successfully:",a)}catch(t){const c=t instanceof Error?t.message:"Failed to delete secret";throw g.error("[useSecrets] Error deleting secret:",t),h(c),t}},[]),T=(0,s.useCallback)(async(a,t)=>{try{g.debug("[useSecrets] Starting rotation for secret:",a);const c=await O.startRotation(a,t);return await m(),g.info("[useSecrets] Rotation started:",{id:c.id,rotationState:c.rotationState}),c}catch(c){const N=c instanceof Error?c.message:"Failed to start rotation";throw g.error("[useSecrets] Error starting rotation:",c),h(N),c}},[m]),b=(0,s.useCallback)(async a=>{try{g.debug("[useSecrets] Completing rotation for secret:",a);const t=await O.completeRotation(a);return await m(),g.info("[useSecrets] Rotation completed:",{id:t.id,rotationState:t.rotationState}),t}catch(t){const c=t instanceof Error?t.message:"Failed to complete rotation";throw g.error("[useSecrets] Error completing rotation:",t),h(c),t}},[m]),P=(0,s.useCallback)(async()=>{await m()},[m]);return(0,s.useEffect)(()=>{P()},[o,d,p,f]),(0,s.useEffect)(()=>{if(!j)return;const a=setInterval(()=>{g.debug("[useSecrets] Auto-refreshing secrets"),m()},v);return()=>clearInterval(a)},[j,v,m]),{secrets:k,isLoading:U,error:I,services:x,fetchSecrets:m,createSecret:E,updateSecret:L,changeSecretScope:S,deleteSecret:w,startRotation:T,completeRotation:b,refresh:P}}var e=we(),et={"mcp-services":{name:"MCP Services",description:"API keys for external AI and media services",icon:ne,color:"from-amber-500 to-orange-500"},"facebook-ads":{name:"Facebook Ads",description:"OAuth tokens and credentials for Facebook Ads API",icon:me,color:"from-blue-500 to-indigo-500"},google:{name:"Google Services",description:"Google API credentials and OAuth tokens",icon:oe,color:"from-red-500 to-yellow-500"},oauth:{name:"OAuth Tokens",description:"OAuth access and refresh tokens",icon:Re,color:"from-green-500 to-emerald-500"},"api-keys":{name:"API Keys",description:"General API keys and credentials",icon:$,color:"from-purple-500 to-pink-500"}},tt={name:"Secrets",description:"Stored secrets and credentials",icon:le,color:"from-gray-500 to-slate-500"},se=["from-blue-500 to-indigo-500","from-purple-600 to-indigo-600","from-emerald-500 to-teal-500","from-orange-500 to-red-500","from-gray-700 to-gray-900","from-pink-500 to-rose-500","from-teal-500 to-cyan-500","from-amber-500 to-yellow-500"];function rt(l){let o=0;for(let d=0;d<l.length;d++)o=(o<<5)-o+l.charCodeAt(d),o|=0;return Math.abs(o)}function at(l){return{name:l.split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "),description:"OAuth integration",icon:me,color:se[rt(l)%se.length]??"from-blue-500 to-indigo-500"}}function st(l){if(!l)return null;const o=l.split(":");return o.length>=1&&o[0]?o[0]:null}var ce={freepik:{name:"Freepik",icon:De,color:"from-blue-500 to-cyan-500",helpUrl:"https://www.freepik.com/api"}
1,nanobanana:{name:"NanoBanana",icon:Ue,color:"from-yellow-500 to-orange-500",helpUrl:"https://nanobanana.ai"},"black-forest-labs":{name:"Black Forest Labs",icon:Ae,color:"from-purple-500 to-pink-500",helpUrl:"https://blackforestlabs.ai"},elevenlabs:{name:"ElevenLabs",icon:ze,color:"from-green-500 to-emerald-500",helpUrl:"https://elevenlabs.io"},hedra:{name:"Hedra",icon:Ee,color:"from-red-500 to-rose-500",helpUrl:"https://www.hedra.com"},heygen:{name:"HeyGen",icon:Le,color:"from-indigo-500 to-violet-500",helpUrl:"https://www.heygen.com"},openai:{name:"OpenAI",icon:ne,color:"from-teal-500 to-cyan-500",helpUrl:"https://platform.openai.com"}};function ge(l){if(l.startsWith("mcp-oauth:"))return at(l.replace("mcp-oauth:",""));const o=et[l];if(o)return o;const d=l.split("-").map(p=>p.charAt(0).toUpperCase()+p.slice(1)).join(" ");return{...tt,name:d}}function ct(l){return l.replace(/_/g," ").replace(/-/g," ").split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function ot(l){const o=l.match(/^([a-z0-9-]+)_/);if(o){const d=o[1];if(d&&ce[d])return ce[d]}return null}function nt({service:l,secrets:o,isExpanded:d,onToggle:p,onEdit:f,onDelete:j,onChangeScope:v,onAdd:k,canChangeScope:A}){const U=Ge(),y=ge(l),I=y.icon,h=l.startsWith("mcp-oauth:"),x=h&&o.length>0?new Date(Math.max(...o.map(n=>new Date(n.updatedAt).getTime()))):null;return(0,e.jsxs)(_.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"bg-white/70 dark:bg-gray-800/70 backdrop-blur-xl rounded-2xl border border-white/40 dark:border-gray-700/40 overflow-hidden shadow-lg",children:[(0,e.jsxs)("button",{onClick:p,className:"w-full flex items-center justify-between p-4 hover:bg-gray-50/50 dark:hover:bg-gray-700/50 transition-colors",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("div",{className:`p-2 bg-gradient-to-br ${y.color} rounded-xl`,children:d?(0,e.jsx)(de,{className:"h-5 w-5 text-white"}):(0,e.jsx)(I,{className:"h-5 w-5 text-white"})}),(0,e.jsxs)("div",{className:"text-left",children:[(0,e.jsx)("h3",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:y.name}),(0,e.jsxs)("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[y.description,h&&x&&(0,e.jsxs)("span",{className:"ml-1",children:["· Updated ",x.toLocaleDateString()]})]})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[h&&(0,e.jsxs)("span",{role:"button",tabIndex:0,onClick:n=>{n.stopPropagation(),U("/integrations")},onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.stopPropagation(),U("/integrations"))},className:"px-2.5 py-1 bg-blue-50 dark:bg-blue-900/30 rounded-full text-xs font-medium text-blue-600 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-800/50 transition-colors flex items-center gap-1 cursor-pointer",children:[(0,e.jsx)(te,{className:"h-3 w-3"}),"Manage"]}),(0,e.jsxs)("span",{className:"px-2.5 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-sm font-medium text-gray-600 dark:text-gray-300",children:[o.length," ",o.length===1?"secret":"secrets"]}),d?(0,e.jsx)(Te,{className:"h-5 w-5 text-gray-400"}):(0,e.jsx)(Fe,{className:"h-5 w-5 text-gray-400"})]})]}),(0,e.jsx)(ie,{children:d&&(0,e.jsx)(_.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:(0,e.jsxs)("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4",children:[!h&&(0,e.jsx)("div",{className:"mb-4",children:(0,e.jsxs)(M,{onClick:()=>k(l),variant:"outline",size:"sm",className:"gap-2",children:[(0,e.jsx)($e,{className:"h-4 w-4"}),"Add Secret"]})}),o.length===0?(0,e.jsxs)("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:[(0,e.jsx)($,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,e.jsx)("p",{children:"No secrets in this service"})]}):(0,e.jsx)("div",{className:"space-y-3",children:o.map(n=>{const m=ot(n.secretName),E=m?.icon||$;return(0,e.jsxs)("div",{className:"p-4 bg-gray-50/80 dark:bg-gray-700/50 rounded-xl border border-gray-200/50 dark:border-gray-600/50",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[m?(0,e.jsx)("div",{className:`p-1.5 bg-gradient-to-br ${m.color} rounded-lg`,children:(0,e.jsx)(E,{className:"h-4 w-4 text-white"})}):(0,e.jsx)("div",{className:"p-1.5 bg-gray-200 dark:bg-gray-600 rounded-lg",children:(0,e.jsx)($,{className:"h-4 w-4 text-gray-600 dark:text-gray-300"})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h4",{className:"font-semibold text-gray-900 dark:text-gray-100",children:m?.name||ct(n.secretName)}),(0,e.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono",children:n.secretName})]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[A&&(0,e.jsx)(M,{variant:"ghost",size:"sm",onClick:()=>v(n),className:"h-7 w-7 p-0",title:n.scope==="user"?"Make company secret":"Make personal secret",children:(0,e.jsx)(_e,{className:"h-4 w-4 text-gray-500"})}),(0,e.jsx)(M,{variant:"ghost",size:"sm",onClick:()=>f(l,n),className:"h-7 w-7 p-0",title:"Edit",children:(0,e.jsx)(Ie,{className:"h-4 w-4 text-gray-500"})}),(0,e.jsx)(M,{variant:"ghost",size:"sm",onClick:()=>j(n.id,n.secretName),className:"h-7 w-7 p-0 hover:bg-red-100 dark:hover:bg-red-900/50",title:"Delete",children:(0,e.jsx)(Me,{className:"h-4 w-4 text-red-500"})}),m?.helpUrl&&(0,e.jsx)("a",{href:m.helpUrl,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-lg transition-colors",title:"Documentation",children:(0,e.jsx)(te,{className:"h-4 w-4 text-gray-500"})})]})]}),(0,e.jsxs)("div",{className:"mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded-lg flex items-center justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:n.initialized?"Configured":"Not configured"}),(0,e.jsxs)(Ye,{variant:"outline",className:"gap-1",children:[n.scope==="user"?(0,e.jsx)(X,{className:"h-3 w-3"}):(0,e.jsx)(Y,{className:"h-3 w-3"}),n.scope==="user"?"Personal":"Company"]})]}),n.account&&n.account!=="default"&&(0,e.jsxs)("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:["Account: ",(0,e.jsx)("span",{className:"font-mono",children:n.account})]}),n.metadata&&Object.keys(n.metadata).length>0&&(0,e.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:Object.entries(n.metadata).slice(0,3).map(([L,S])=>(0,e.jsxs)("span",{className:"px-2 py-0.5 bg-gray-200 dark:bg-gray-600 rounded text-xs text-gray-600 dark:text-gray-300",children:[L,": ",typeof S=="string"?S.substring(0,20):String(S)]},L))}),(0,e.jsxs)("div",{className:"mt-2 text-xs text-gray-400",children:["Updated: ",n.updatedAt?new Date(n.updatedAt).toLocaleDateString():"N/A"]})]},n.id)})})]})})})]})}function kt(){const{identity:l}=Ve(),o=(0,s.useMemo)(()=>{const r=l?.companyRoles??[];return r.includes("admin")||r.includes("owner")}
1,[l?.companyRoles]),[d,p]=(0,s.useState)("company"),{secrets:f,services:j,isLoading:v,error:k,createSecret:A,updateSecret:U,changeSecretScope:y,deleteSecret:I,refresh:h}=qe({scope:d}),[x,n]=(0,s.useState)(""),[m,E]=(0,s.useState)(new Set),[L,S]=(0,s.useState)(!1),[w,T]=(0,s.useState)(null),[b,P]=(0,s.useState)(null),[a,t]=(0,s.useState)(null),[c,N]=(0,s.useState)(""),[R,z]=(0,s.useState)(""),[B,G]=(0,s.useState)("default"),[H,Z]=(0,s.useState)(!1),[q,F]=(0,s.useState)(null),D=(0,s.useMemo)(()=>{const r={};return j.forEach(i=>{i!=="mcp-oauth"&&(r[i]=[])}),f.forEach(i=>{if(i.service==="mcp-oauth"){const u=st(i.account),C=u?`mcp-oauth:${u}`:"mcp-oauth";r[C]||(r[C]=[]),r[C].push(i)}else{const u=i.service;r[u]||(r[u]=[]),r[u].push(i)}}),r},[f,j]),ee=(0,s.useMemo)(()=>{if(!x)return Object.keys(D).sort();const r=x.toLowerCase();return Object.keys(D).filter(i=>{const u=ge(i);if(i.toLowerCase().includes(r)||u.name.toLowerCase().includes(r)||u.description.toLowerCase().includes(r))return!0;const C=D[i];return C?C.some(K=>K.secretName.toLowerCase().includes(r)||K.account&&K.account.toLowerCase().includes(r)):!1}).sort()},[D,x]),ue=f.length,he=j.length,xe=(0,s.useCallback)(r=>{E(i=>{const u=new Set(i);return u.has(r)?u.delete(r):u.add(r),u})},[]),pe=(0,s.useCallback)(()=>{E(new Set(Object.keys(D)))},[D]),fe=(0,s.useCallback)(()=>{E(new Set)},[]),ye=(0,s.useCallback)(r=>{T(r),P(null),z(""),N(""),G("default"),F(null),S(!0)},[]),be=(0,s.useCallback)((r,i)=>{T(r),P(i),z(i.secretName),N(""),G(i.account||"default"),F(null),S(!0)},[]),Se=(0,s.useCallback)(async(r,i)=>{if(confirm(`Are you sure you want to delete "${i}"?`))try{await I(r),V(`Secret "${i}" deleted successfully`)}catch(u){console.error("Failed to delete secret:",u)}},[I]),Ne=(0,s.useCallback)(async r=>{const i=r.scope==="user"?"company":"user",u=i==="company"?"company":"personal";if(confirm(`Move "${r.secretName}" to ${u} secrets?`))try{await y(r.id,{targetScope:i}),V(`Secret "${r.secretName}" moved to ${u} secrets`)}catch(C){console.error("Failed to change secret scope:",C)}},[y]),W=()=>{S(!1),T(null),P(null),z(""),N(""),G("default"),F(null)},je=async r=>{if(r.preventDefault(),!!w){if(!R.trim()){F("Secret name is required");return}if(!c.trim()){F("Secret value is required");return}Z(!0),F(null);try{b?(await U({service:w,account:B.trim()||"default",secretName:R.trim(),scope:d,value:c.trim()}),V(`Secret "${R}" updated successfully`)):(await A({service:w,account:B.trim()||"default",secretName:R.trim(),scope:d,value:c.trim()}),V(`Secret "${R}" created successfully`)),W()}catch(i){console.error("Failed to save secret:",i),F("Failed to save secret. Please try again.")}finally{Z(!1)}}},V=r=>{t(r),setTimeout(()=>t(null),5e3)};return(0,e.jsx)("div",{className:"relative",children:(0,e.jsxs)(_.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4},className:"space-y-5",children:[(0,e.jsx)(Ze,{title:"Vault Secrets",description:"Manage credentials across all services",icon:(0,e.jsx)("img",{src:"/accounts-icon.webp",alt:"Vault Secrets",className:"w-full h-full object-cover"}),iconGradient:"from-blue-500 to-cyan-600",iconSize:"lg",titleGradient:"from-gray-900 to-gray-900",titleGradientDark:"from-gray-100 to-gray-100",titleSize:"sm",titleTracking:"normal",titleTransform:"none",titleFontWeight:"bold",showBackButton:!0,backTo:"/home",onRefresh:h,isRefreshing:v,actions:[{label:"Expand All",onClick:pe,icon:de},{label:"Collapse All",onClick:fe,icon:le}]}),(0,e.jsx)("div",{children:(0,e.jsx)(Be,{value:x,onChange:n,placeholder:"Search services or secrets...",showKeyboardHint:!0})}),(0,e.jsxs)("div",{className:"bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1 p-1 bg-gray-100/80 dark:bg-gray-700/80 rounded-xl",children:[(0,e.jsxs)("button",{onClick:()=>p("user"),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${d==="user"?"bg-white dark:bg-gray-600 text-amber-600 dar
1k:text-amber-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:[(0,e.jsx)(X,{className:"h-4 w-4"}),(0,e.jsx)("span",{children:"My Secrets"})]}),(0,e.jsxs)("button",{onClick:()=>p("company"),className:`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-200 ${d==="company"?"bg-white dark:bg-gray-600 text-amber-600 dark:text-amber-400 shadow-sm":"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-200"}`,children:[(0,e.jsx)(Y,{className:"h-4 w-4"}),(0,e.jsx)("span",{children:"Company Secrets"})]})]}),(0,e.jsxs)("div",{className:"flex gap-6",children:[(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("div",{className:"text-2xl font-bold bg-gradient-to-br from-amber-600 to-orange-600 dark:from-amber-400 dark:to-orange-400 bg-clip-text text-transparent",children:he}),(0,e.jsx)("div",{className:"text-xs text-gray-600 dark:text-gray-400 font-medium",children:"Services"})]}),(0,e.jsxs)("div",{className:"text-center",children:[(0,e.jsx)("div",{className:"text-2xl font-bold bg-gradient-to-br from-gray-600 to-gray-800 dark:from-gray-300 dark:to-gray-100 bg-clip-text text-transparent",children:ue}),(0,e.jsx)("div",{className:"text-xs text-gray-600 dark:text-gray-400 font-medium",children:"Secrets"})]})]})]}),(0,e.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-200/50 dark:border-gray-700/50",children:(0,e.jsx)("div",{className:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400",children:d==="user"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(X,{className:"h-4 w-4 text-amber-500"}),(0,e.jsxs)("span",{children:["Viewing ",(0,e.jsx)("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"personal secrets"})," - only accessible by you"]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Y,{className:"h-4 w-4 text-amber-500"}),(0,e.jsxs)("span",{children:["Viewing ",(0,e.jsx)("span",{className:"font-medium text-amber-600 dark:text-amber-400",children:"company secrets"})," - shared across your team"]})]})})})]}),(0,e.jsx)(ie,{children:a&&(0,e.jsx)(_.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"mb-4",children:(0,e.jsxs)(re,{className:"border-green-200 bg-green-50 dark:bg-green-950/50 dark:border-green-800",children:[(0,e.jsx)(Ce,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),(0,e.jsx)(ae,{className:"text-green-800 dark:text-green-300",children:a})]})})}),k&&(0,e.jsx)(_.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-4",children:(0,e.jsxs)(re,{className:"border-red-200 bg-red-50 dark:bg-red-950/50 dark:border-red-800",children:[(0,e.jsx)(Oe,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,e.jsx)(ae,{className:"text-red-800 dark:text-red-300",children:k})]})}),v&&f.length===0&&(0,e.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,e.jsx)(Pe,{className:"h-8 w-8 text-amber-500 animate-spin"})}),(0,e.jsx)("div",{className:"space-y-4",children:ee.map((r,i)=>(0,e.jsx)(_.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:i*.05},children:(0,e.jsx)(nt,{service:r,secrets:D[r]||[],isExpanded:m.has(r),onToggle:()=>xe(r),onEdit:be,onDelete:Se,onChangeScope:Ne,onAdd:ye,canChangeScope:o})},r))}),!v&&ee.length===0&&(0,e.jsxs)(_.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"flex flex-col items-center justify-center py-12 px-4",children:[(0,e.jsx)("div",{className:"w-16 h-16 bg-gradient-to-br from-gray-200 to-gray-300 dark:from-gray-700 dark:to-gray-800 rounded-full flex items-center justify-center mb-4",children:(0,e.jsx)(oe,{className:"h-8 w-8 text-gray-400 dark:text-gray-500"})}),(0,e.jsx)("h3",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:x?"No services found":"No secrets yet"}),(0,e.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400 text-center mb-4 max-w-md",children:x?`No services or secrets match "${x}". Try a different search term.`:"Create your first secret to get started."}),x&&(0,e.jsx)(M,{onClick:()=>n(""),children:"Clear Search"})]}),(0,e.jsx)(Xe,{open:L,onOpenChange:W,children:(0,e.jsxs)(Ke,{className:"max-w-md",children:[(0,e.jsxs)(He,{children:[(0,e.jsxs)(Je,{className:"flex items-center gap-2",children:[(0,e.jsx)("div",{className:"p-2 bg-gradient-to-br from-amber-500 to-orange-500 rounded-xl",children:(0,e.jsx)($,{className:"h-5 w-5 text-white"})}),b?"Update Secret":"Add Secret"]}
1),(0,e.jsx)(Qe,{children:b?`Update the secret value for "${b.secretName}" in ${w}`:`Add a new secret to the "${w}" service`})]}),(0,e.jsxs)("form",{onSubmit:je,className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Q,{htmlFor:"secretName",children:"Secret Name"}),(0,e.jsx)(J,{id:"secretName",value:R,onChange:r=>z(r.target.value),placeholder:"e.g., api_key, access_token",disabled:!!b,className:"font-mono"}),!b&&(0,e.jsx)("p",{className:"text-xs text-gray-500",children:"Use snake_case for secret names (e.g., hedra_api_key)"})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Q,{htmlFor:"accountName",children:"Account (optional)"}),(0,e.jsx)(J,{id:"accountName",value:B,onChange:r=>G(r.target.value),placeholder:"default",className:"font-mono"}),(0,e.jsx)("p",{className:"text-xs text-gray-500",children:"Use to organize multiple accounts per service"})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(Q,{htmlFor:"secretValue",className:"flex items-center gap-2",children:[(0,e.jsx)($,{className:"h-4 w-4"}),"Secret Value"]}),(0,e.jsx)(J,{id:"secretValue",type:"password",value:c,onChange:r=>N(r.target.value),placeholder:b?"Enter replacement value...":"Enter secret value...",className:"font-mono",autoComplete:"new-password"})]}),(0,e.jsxs)("div",{className:"p-3 bg-gray-50 dark:bg-gray-800/50 rounded-xl text-sm",children:[(0,e.jsx)("span",{className:"text-gray-500 dark:text-gray-400",children:"Service: "}),(0,e.jsx)("code",{className:"font-mono text-gray-700 dark:text-gray-300",children:w})]}),q&&(0,e.jsx)("div",{className:"p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg",children:(0,e.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:q})}),(0,e.jsxs)(We,{children:[(0,e.jsx)(M,{type:"button",variant:"outline",onClick:W,disabled:H,children:"Cancel"}),(0,e.jsx)(M,{type:"submit",disabled:H,children:H?"Saving...":b?"Update":"Create"})]})]})]})})]})})}export{kt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.