import{C as g}from"./CrudView-BCKz8q7-.js";import{a as x,r as I,ae as e,ac as C,c as A,aO as P,aP as D,b as M,e as h,j as s,u as a,w as l,aQ as j,S as _,U as u,ak as T,a8 as V,M as B}from"./jwt-decode.esm-CQm3LY6y.js";import{a as E}from"./asyncComputed-_0zTJceu.js";import{A as d}from"./apiKey-BmtHyRhp.js";import"./router-iclNQ3sb.js";import{M as N}from"./member-C_iHzb1Q.js";import{P as S}from"./project-DCJ6jnzi.js";import"./tables-D9fKw_fk.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-yaUz4fth.js";import"./constants-BkB36yfF.js";import"./url-DLnEW9pi.js";import"./PhDotsThreeVertical.vue-D4TsgP8r.js";import"./index-Bt656mEJ.js";import"./ts.worker-BIIJMa7D.js";import"./record-Dzon-Vi8.js";import"./string-W5Qb0ZHU.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[i]="317017e1-a3ed-4483-9e37-338e9402606d",o._sentryDebugIdIdentifier="sentry-dbid-317017e1-a3ed-4483-9e37-338e9402606d")}catch{}})();const ee=x({__name:"ApiKeys",setup(o){const i=I(null),m=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=C().params.projectId,y=new N,{loading:w,result:f,refetch:c}=E(async()=>Promise.all([d.list(r),S.get(r).then(t=>y.list(t.organizationId))]).then(([t,n])=>t.map(p=>({apiKey:p,member:n.find(b=>b.authorId===p.ownerId)})))),v=async t=>{const n=await d.create({projectId:r,name:t.name});c(),i.value=n.value},k=A(()=>({columns:[{title:e.translate("i18n_apikeysview_column_name")},{title:e.translate("i18n_apikeysview_column_creation_date")},{title:e.translate("i18n_apikeysview_column_owner")},{title:"",align:"right"}],rows:f.value?.map(({apiKey:t,member:n})=>({key:t.id,cells:[{type:"text",text:t.name},{type:"text",text:P(t.createdAt)},{type:"text",text:n?.email??e.translate("i18n_apikeysview_owner_unknown")},{type:"actions",actions:[{label:e.translate("i18n_apikeysview_action_delete"),icon:D,dangerous:!0,onClick:async()=>{await d.delete(r,t.id),c()}}]}]}))??[]}));return(t,n)=>(h(),M(B,null,[s(g,{"entity-name":a(e).translate("i18n_apikeysview_entity_name"),"create-button-text":a(e).translate("i18n_apikeysview_create_button"),loading:a(w),title:a(e).translate("i18n_apikeysview_title"),description:a(e).translate("i18n_apikeysview_description"),"empty-title":a(e).translate("i18n_apikeysview_empty_title"),table:k.value,fields:m,create:v},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),s(a(V),{open:!!i.value,title:a(e).translate("i18n_apikeysview_modal_title"),onCancel:n[0]||(n[0]=p=>i.value=null)},{footer:l(()=>[...n[1]||(n[1]=[])]),default:l(()=>[s(a(j),null,{default:l(()=>[_(u(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),s(a(T),{code:"",copyable:""},{default:l(()=>[_(u(i.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys-BoKCu2fX.js.map
