import{C as g}from"./CrudView-xgqfvJMN.js";import{e as x,r as I,i as e,an as C,b as A,aQ as h,aR as D,y as M,h as P,m as s,j as a,w as l,aS as j,k as _,t as u,T,af as V,V as B}from"./jwt-decode.esm-BJTSBhUK.js";import{a as E}from"./asyncComputed-BvQLJepS.js";import{A as c}from"./apiKey-2ssT_GW-.js";import"./router-JNJkT0FW.js";import{M as N}from"./member-CiZB7vof.js";import{a as R}from"./project-CNNVe7L3.js";import"./tables-COuMqsTr.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-jdUos6Ps.js";import"./constants-CIm3pvgY.js";import"./url-D-YE6ZXS.js";import"./PhDotsThreeVertical.vue-BrfgJanq.js";import"./index-BM0-PlaO.js";import"./ts.worker-_F6qeu5Y.js";import"./record-COWr9r4M.js";import"./string-C1f4nly_.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]="32c99cc0-49fc-4400-a98c-6d3ce165a2fa",o._sentryDebugIdIdentifier="sentry-dbid-32c99cc0-49fc-4400-a98c-6d3ce165a2fa")}catch{}})();const ee=x({__name:"ApiKeys",setup(o){const i=I(null),d=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=C().params.projectId,y=new N,{loading:f,result:w,refetch:m}=E(async()=>Promise.all([c.list(r),R.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 c.create({projectId:r,name:t.name});m(),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:w.value?.map(({apiKey:t,member:n})=>({key:t.id,cells:[{type:"text",text:t.name},{type:"text",text:h(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 c.delete(r,t.id),m()}}]}]}))??[]}));return(t,n)=>(P(),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(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:k.value,fields:d,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-BhcLGR9R.js.map
