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