import{C as x}from"./CrudView.243b212b.js";import{d as I,r as A,i as e,c as C,ac as D,f as d,u as a,b as p,aY as M,eA as h,o as P,de as T,g as f,t as y,df as j,M as V,eC as B,eL as E}from"./jwt-decode.esm.7c9b757c.js";import{a as N}from"./asyncComputed.29ba9357.js";import{A as c}from"./apiKey.5e1c8e0c.js";import"./router.95e6e4b6.js";import{M as $}from"./member.fcad2d55.js";import{a as z}from"./project.b76602c4.js";import"./tables.4a013a6e.js";import"./DocsButton.vue_vue_type_script_setup_true_lang.95065a46.js";import"./constants.6f371b22.js";import"./url.e6b61fa1.js";import"./PhDotsThreeVertical.vue.23d4ad15.js";import"./index.b636bb44.js";import"./index.33534fc9.js";import"./record.c6bfac6e.js";import"./string.fea0919a.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new Error().stack;o&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[o]="62cdcaff-3f6b-4b60-83a4-594fefb6698d",s._sentryDebugIdIdentifier="sentry-dbid-62cdcaff-3f6b-4b60-83a4-594fefb6698d")}catch{}})();const te=I({__name:"ApiKeys",setup(s){const o=A(null),m=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=h().params.projectId,w=new $,{loading:v,result:b,refetch:_}=N(async()=>Promise.all([c.list(r),z.get(r).then(n=>w.list(n.organizationId))]).then(([n,t])=>n.map(i=>({apiKey:i,member:t.find(l=>l.authorId===i.ownerId)})))),k=async n=>{const t=await c.create({projectId:r,name:n.name});_(),o.value=t.value},g=C(()=>{var n,t;return{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:(t=(n=b.value)==null?void 0:n.map(({apiKey:i,member:l})=>{var u;return{key:i.id,cells:[{type:"text",text:i.name},{type:"text",text:B(i.createdAt)},{type:"text",text:(u=l==null?void 0:l.email)!=null?u:e.translate("i18n_apikeysview_owner_unknown")},{type:"actions",actions:[{label:e.translate("i18n_apikeysview_action_delete"),icon:E,dangerous:!0,onClick:async()=>{await c.delete(r,i.id),_()}}]}]}}))!=null?t:[]}});return(n,t)=>(P(),D(M,null,[d(x,{"entity-name":a(e).translate("i18n_apikeysview_entity_name"),"create-button-text":a(e).translate("i18n_apikeysview_create_button"),loading:a(v),title:a(e).translate("i18n_apikeysview_title"),description:a(e).translate("i18n_apikeysview_description"),"empty-title":a(e).translate("i18n_apikeysview_empty_title"),table:g.value,fields:m,create:k},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),d(a(V),{open:!!o.value,title:a(e).translate("i18n_apikeysview_modal_title"),onCancel:t[0]||(t[0]=i=>o.value=null)},{footer:p(()=>[...t[1]||(t[1]=[])]),default:p(()=>[d(a(T),null,{default:p(()=>[f(y(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),d(a(j),{code:"",copyable:""},{default:p(()=>[f(y(o.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{te as default};
//# sourceMappingURL=ApiKeys.f298122d.js.map
