import{ba as k,i as a,an as x,a5 as A,M as b,a2 as B,a3 as $}from"./app-JmgyQoR0.js";import{b as P,a as v,h as d,i as _,j as i,K as u,E as o,z as n,t as g,l as m,H as T,u as r,G as U,F as j}from"./vue-y3KLWBaS.js";const E={key:0,class:"_section"},F={class:"_section"},G={style:{"margin-bottom":"16px"}},I={class:"_section"},O={style:{"margin-bottom":"16px"}},z=P({__name:"MkTokenGenerateWindow",props:{title:{default:null},information:{default:null},initialName:{default:null},initialPermissions:{default:null}},emits:["closed","done"],setup(y,{emit:V}){const f=y,w=V,p=v();let c=v(f.initialName),t=v({});if(f.initialPermissions)for(const e of f.initialPermissions)t.value[e]=!0;else for(const e of k.permissions)t.value[e]=!1;function C(){w("done",{name:c.value,permissions:Object.keys(t.value).filter(e=>t.value[e])}),p.value.close()}function M(){for(const e in t.value)t.value[e]=!1}function h(){for(const e in t.value)t.value[e]=!0}return(e,l)=>(d(),_($,{ref_key:"dialog",ref:p,width:400,height:600,"with-ok-button":!0,"ok-button-disabled":!1,"can-close":!1,onClose:l[1]||(l[1]=s=>p.value.close()),onClosed:l[2]||(l[2]=s=>e.$emit("closed")),onOk:l[3]||(l[3]=s=>C()),style:{padding:"12px"}},{header:i(()=>[u(o(e.title||n(a).ts.generateAccessToken),1)]),default:i(()=>[e.information?(d(),g("div",E,[m(x,{warn:""},{default:i(()=>[u(o(e.information),1)]),_:1})])):T("",!0),r("div",F,[r("div",G,[r("b",null,o(n(a).ts.name),1)]),m(A,{style:{"margin-bottom":"16px"},modelValue:c.value,"onUpdate:modelValue":l[0]||(l[0]=s=>c.value=s)},null,8,["modelValue"])]),r("div",I,[r("div",O,[r("b",null,o(n(a).ts.permission),1)]),m(b,{inline:"",onClick:M},{default:i(()=>[u(o(n(a).ts.disableAll),1)]),_:1}),m(b,{style:{"margin-bottom":"12px"},inline:"",onClick:h},{default:i(()=>[u(o(n(a).ts.enableAll),1)]),_:1}),(d(!0),g(j,null,U(e.initialPermissions||n(k.permissions),s=>(d(),_(B,{style:{"margin-bottom":"6px"},key:s,modelValue:t.value[s],"onUpdate:modelValue":N=>t.value[s]=N},{default:i(()=>[u(o(n(a).t(`_permissions.${s}`)),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1},512))}});export{z as default};
