import{u as D}from"./widget-jbnupkVY.js";import{M as N}from"./MkContainer-CNBcUt5w.js";import{_ as V}from"./MkAvatars.vue_vue_type_style_index_0_lang-C9VK6yA5.js";import{Q as $,b as p,M as E,d as f,s as H,_ as q}from"./app-QjDgb7aF.js";import{b as z,g,i as l,u as e,j as r,q as n,p as k,k as v,J as I,D as x,x as A,a as m,E as J}from"./vue-Cm77DuTi.js";import"./charts-3gEHPHRq.js";import"./media-DuCIZ-3n.js";const Q={class:"wsdlkfj"},S={key:0,class:"init"},T={key:2,class:"users"},y="userList",W=z({__name:"user-list",props:{widget:{}},emits:["updateProps"],setup(L,{expose:M,emit:b}){const j={showHeader:{type:"boolean",default:!0},listId:{type:"string",default:null,hidden:!0}},u=L,C=b,{widgetProps:t,configure:_,save:B}=D(y,j,u,C);let i=m(),h=m([]),d=m(!0);async function P(){const a=await f("users/lists/list"),{canceled:s,result:c}=await H({title:p.ts.selectList,items:a.map(o=>({value:o,text:o.name})),default:t.listId});s||(t.listId=c.id,B(),w())}const w=()=>{if(t.listId==null){d.value=!1;return}f("users/lists/show",{listId:t.listId}).then(a=>{i.value=a,f("users/show",{userIds:i.value.userIds}).then(s=>{h.value=i.value.userIds,d.value=!1})})};return $(w,1e3*60,{immediate:!0,afterMounted:!0}),M({name:y,configure:_,id:u.widget?u.widget.id:null}),(a,s)=>{const c=J("MkLoading");return r(),g(N,{"show-header":e(t).showHeader,class:"mkw-userList"},{header:l(()=>[s[1]||(s[1]=n("i",{class:"ph-user-list ph-bold ph-lg"},null,-1)),I(" "+x(e(i)?e(i).name:e(p).ts._widgets.userList),1)]),func:l(({buttonStyleClass:o})=>[n("button",{class:A(["_button",o]),onClick:s[0]||(s[0]=R=>e(_)())},[...s[2]||(s[2]=[n("i",{class:"ph-gear-six ph-bold ph-lg"},null,-1)])],2)]),default:l(()=>[n("div",Q,[e(t).listId==null?(r(),k("div",S,[v(E,{primary:"",onClick:P},{default:l(()=>[I(x(e(p).ts._widgets._userList.chooseList),1)]),_:1})])):e(d)?(r(),g(c,{key:1})):(r(),k("div",T,[v(V,{"user-ids":e(h),class:"userAvatars"},null,8,["user-ids"])]))])]),_:1},8,["show-header"])}}}),F="_wsdlkfj_1p7xj_1",G="_init_1p7xj_1",K={wsdlkfj:F,init:G},O={$style:K},is=q(W,[["__cssModules",O]]);export{is as default};
//# sourceMappingURL=user-list-DAlgfJwG.js.map
