import{C as g}from"./CrudView-lwVlHvLk.js";import{a as x,r as I,i as e,ag as C,c as A,aL as h,aM as D,k as M,f as P,h as s,u as a,w as l,aN as T,g as _,t as u,T as j,ac as N,R as V}from"./jwt-decode.esm-Dw_OlTCW.js";import{a as B}from"./asyncComputed-3zrnCYug.js";import{A as d}from"./apiKey-gNZ0sw4C.js";import"./router-DzczyMew.js";import{M as E}from"./member-Cn62RcK0.js";import{a as R}from"./project-Dsz7eI6O.js";import"./tables-CkY-LQhC.js";import"./DocsButton.vue_vue_type_script_setup_true_lang-4fYs65kc.js";import"./constants-DtajWhvQ.js";import"./url-vGC2YsRB.js";import"./PhDotsThreeVertical.vue-zeuZOamM.js";import"./index-BNW_czQY.js";import"./ts.worker-5sEEipil.js";import"./record-BTRCUCPd.js";import"./string-BuQ9zSDy.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]="27cecf9c-1de8-4820-a128-845252b35927",o._sentryDebugIdIdentifier="sentry-dbid-27cecf9c-1de8-4820-a128-845252b35927")}catch{}})();const ee=x({__name:"ApiKeys",setup(o){const i=I(null),c=[{key:"name",label:e.translate("i18n_apikeysview_field_name")}],r=C().params.projectId,y=new E,{loading:f,result:w,refetch:m}=B(async()=>Promise.all([d.list(r),R.get(r).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,name:t.name});m(),i.value=n.value},b=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 d.delete(r,t.id),m()}}]}]}))??[]}));return(t,n)=>(P(),M(V,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:c,create:v},null,8,["entity-name","create-button-text","loading","title","description","empty-title","table"]),s(a(N),{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(T),null,{default:l(()=>[_(u(a(e).translate("i18n_apikeysview_modal_description")),1)]),_:1}),s(a(j),{code:"",copyable:""},{default:l(()=>[_(u(i.value),1)]),_:1})]),_:1},8,["open","title"])],64))}});export{ee as default};
//# sourceMappingURL=ApiKeys-B3DjM2_o.js.map
