import{d as p,u as h,h as _,r as f,i as k,D as v,w as n,o as l,c,F as x,j as y,a as r,k as g,v as b,t as B}from"../index.js";const C={class:"list-group"},M={class:"ml-2 align-items-center"},D=["onUpdate:modelValue"],F={for:"roleCheckBox",class:"form-check-label"},E=p({__name:"RoleList",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(i){const o=h(i,"modelValue"),d=_(),t=f([]);k(async()=>{try{const e=await d.users.roles.get();t.value=(e==null?void 0:e.map(u))??[]}catch(e){console.error(e),v({type:"error",text:"Get available role names failed."})}});function u(e){var s;return{name:e,selected:((s=o.value)==null?void 0:s.includes(e))??!1}}return n(o,e=>{t.value.forEach(s=>{s.selected=(e==null?void 0:e.includes(s.name))??!1})}),n(t,e=>{o.value=e.filter(s=>s.selected).map(s=>s.name)},{deep:!0}),(e,s)=>(l(),c("ul",C,[(l(!0),c(x,null,y(t.value,a=>(l(),c("li",{key:a.name,class:"list-group-item"},[r("div",M,[g(r("input",{id:"roleCheckBox",type:"checkbox","onUpdate:modelValue":m=>a.selected=m,class:"form-check-input"},null,8,D),[[b,a.selected]]),r("label",F,B(a.name),1)])]))),128))]))}});export{E as _};
