import{C as g}from"./CrudView-B2gCTb2F.js";import{e as I,r as x,i as e,b as j,aQ as C,aR as A,y as h,h as D,m as s,j as a,w as l,aS as P,k as _,t as u,T as M,af as S,V as T}from"./jwt-decode.esm-C2n6WQ0J.js";import{a as V}from"./asyncComputed-BkrPdfiN.js";import{A as d}from"./apiKey-BW3Odj5A.js";import"./router-DyRErWhl.js";import{M as B}from"./member-CZHLDQnW.js";import{a as E}from"./project-BWts715N.js";import"./tables-Bfw_MTCm.js";import{u as N}from"./projectStore-DxqJVC72.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-_eFLlbdB.js";import"./constants-Bmi88G_I.js";import"./url-DStrZ0-7.js";import"./PhDotsThreeVertical.vue-DQBfXint.js";import"./index-BjcMudYN.js";import"./ts.worker-BwqBcqxg.js";import"./string-DePeD5b-.js";import"./organization-Brtl8D5A.js";import"./folder-mjOIyKW7.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]="7e976391-b539-4a14-9fce-11dfe3200f60",o._sentryDebugIdIdentifier="sentry-dbid-7e976391-b539-4a14-9fce-11dfe3200f60")}catch{}})();const te=I({__name:"ApiKeys",setup(o){const i=x(null),m=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=N(),y=new B,{loading:f,result:w,refetch:c}=V(async()=>Promise.all([d.list(r.projectId),E.get(r.projectId).then(t=>y.list(t.organizationId))]).then(([t,n])=>t.map(p=>({apiKey:p,member:n.find(k=>k.authorId===p.ownerId)})))),v=async t=>{const n=await d.create({projectId:r.projectId,name:t.name});c(),i.value=n.value},b=j(()=>({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:w.value?.map(({apiKey:t,member:n})=>({key:t.id,cells:[{type:"text",text:t.name},{type:"text",text:C(t.createdAt)},{type:"text",text:n?.email??e.translate("i18n_apikeysview_owner_unknown")},{type:"actions",actions:[{label:e.translate("i18n_apikeysview_action_delete"),icon:A,dangerous:!0,onClick:async()=>{await d.delete(r.projectId,t.id),c()}}]}]}))??[]}));return(t,n)=>(D(),h(T,null,[s(g,{"entity-name":a(e).translate("i18n_apikeysview_entity_name"),"create-button-text":a(e).translate("i18n_apikeysview_create_button"),loading:a(f),title:a(e).translate("i18n_apikeysview_title"),description:a(e).translate("i18n_apikeysview_description"),"empty-title":a(e).translate("i18n_apikeysview_empty_title"),table:b.value,fields:m,create:v},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),s(a(S),{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(P),null,{default:l(()=>[_(u(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),s(a(M),{code:"",copyable:""},{default:l(()=>[_(u(i.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys-B5WQA861.js.map
