var C=(M,v,c)=>new Promise((h,n)=>{var m=e=>{try{u(c.next(e))}catch(d){n(d)}},p=e=>{try{u(c.throw(e))}catch(d){n(d)}},u=e=>e.done?h(e.value):Promise.resolve(e.value).then(m,p);u((c=c.apply(M,v)).next())});import{aH as D,cZ as V,c_ as O,el as P,ei as $,eX as z,x as E,v as R,c$ as j,aK as _,df as x,au as K}from"./index-X7Y8jykP.js";import"./index-BDvqZ5j4.js";import{_ as Q}from"./ImChatModal.vue_vue_type_style_index_0_lang-OmNIJ9EN.js";import{u as X}from"./useModal-DaJ3Bflg.js";import{L as Z,_ as q,a as J}from"./index-Wl3jtD-0.js";import{B as W}from"./index-DfX9t4DO.js";import{A as Y}from"./index-B4gPlWQt.js";import{e as tt,C as ot,z as y,f as s,A as r,r as I,u as T,F as at,c as w,y as k,E as et,G as f,Q as g}from"./vue-vendor-DNhG1Cve.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./BasicModal-xH56XuRZ.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useTimeout-D5AmIBZw.js";import"./index-BzChaRPg.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./useAppInject-DPZGPcR3.js";import"./index-CuWaQdlK.js";import"./index-DO7ZhK45.js";import"./ImChat-CP9TPra1.js";import"./useWebSocket-CMyoaPFz.js";import"./ImChatInput-rBvfVpHc.js";/* empty css */import"./index-CfNJyBRj.js";import"./dropdown-jkliuVyN.js";import"./ImChatSettingsModal-4rnykuc8.js";import"./index-DklMb9Qc.js";import"./UpOutlined-B1UMbtrP.js";import"./ImPageListPickModal.vue_vue_type_script_setup_true_lang-DaELlYpW.js";import"./BasicTable-C6eG0bgK.js";import"./BasicTable.vue_vue_type_style_index_0_lang-B9DxrWas.js";import"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./useForm-D61zovon.js";import"./injectionKey-DPVn4AgL.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-BuONesFs.js";import"./FormOutlined-Y84itqS0.js";import"./useTableContext-CncNVXgp.js";import"./index-DTjkSGYl.js";import"./eagerComputed-BTlOruLW.js";import"./fromPairs-Dx9PT-t0.js";import"./useMaxLevel-DE205ncc.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./RadioButton-DRBix2Fq.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./scrollTo-D49dA-9c.js";import"./operationUnit-vCu2co3e.js";import"./index-C69VKHba.js";import"./index-DsixALRt.js";import"./dayjs-jnKD3YGS.js";import"./index-aCD42OrZ.js";import"./quarterOfYear-BU2sPnff.js";import"./index-J2mOtM3w.js";import"./dayjs-ALi1pEeb.js";import"./clickOutside-DHfwTU6R.js";import"./onMountedOrActivated-DhSdLlqP.js";import"./throttle-De_jAmBh.js";import"./uuid-CODpppBC.js";import"./sortable.esm-DJNoJSdJ.js";import"./RedoOutlined-Cq2g4Slp.js";import"./index-CeNCCWzL.js";import"./TableAction.vue_vue_type_style_index_0_lang-BIWZ0bGo.js";import"./index-fAAIzD3j.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import"./useListPage-CK9oQ-1O.js";import"./useTable-DbHE4FHE.js";import"./useMethods-D3efiSSd.js";import"./useApprovalSelection-D4wlWO_T.js";import"./ImBizRecordMessageContent-DJr_9NNp.js";import"./approvalHandle.api-gBzdKBq5.js";import"./ImApprovalDetailModal-Dnx-eyNG.js";import"./index-DWDasoBX.js";import"./index-3-sNW-01.js";import"./ImCreateGroupModal-Co9b_zTb.js";import"./ImGroupSettingDrawer-CYkJsATT.js";import"./index-D9GWo192.js";import"./ArrowLeftOutlined-B3JgaWh-.js";import"./index-DZJwICFr.js";import"./isNumeric-DjvBa-1E.js";import"./ImGroupAddMemberModal-N0YNycEF.js";import"./useDrawer-BDPywy9W.js";const rt={class:"im-chat-msg-time"},it={class:"im-chat-msg-title"},st={class:"im-chat-msg-name"},nt={class:"im-chat-msg-preview"},mt=tt({name:"SysImChatMessageList",__name:"SysImChatMessageList",emits:["closeModal"],setup(M,{expose:v,emit:c}){const h=c,n=I(!1),m=I([]),p=I([]),[u,{openModal:e}]=X(),d=w(()=>{const o=m.value.filter(t=>(t.unreadCount||0)>0).map(t=>({type:"single",id:t.id,displayName:t.realname||t.username||"",avatar:t.avatar,conversationId:t.conversationId,lastContent:t.lastContent,lastTime:t.lastTime,unreadCount:t.unreadCount})),a=p.value.filter(t=>(t.unreadCount||0)>0).map(t=>({type:"group",id:t.conversationId,displayName:t.groupName||"群聊",conversationId:t.conversationId,lastContent:t.lastContent,lastTime:t.lastTime,unreadCount:t.unreadCount}));return[...o,...a].sort((t,l)=>_(l.lastTime||0).valueOf()-_(t.lastTime||0).valueOf())}),L=w(()=>({emptyText:n.value?" ":"暂无未读聊天消息"}));function N(o){return o?R(o):""}function U(o){return j(o)||"发来一条新消息"}function b(o){if(!o)return"";const a=_(o);return a.isValid()?a.isSame(_(),"day")?a.format("HH:mm"):a.format("MM-DD HH:mm"):""}function B(o=!1){return C(this,null,function*(){const a=!o&&m.value.length===0&&p.value.length===0;a&&(n.value=!0);try{const[t,l]=yield Promise.all([V().catch(()=>[]),O().catch(()=>[])]);m.value=t||[],p.value=l||[],P(p.value),$([...m.value,...z()])}catch(t){o||(m.value=[],p.value=[])}finally{a&&(n.value=!1)}})}function H(o){return C(this,null,function*(){o.type==="group"?(yield x({conversationId:o.conversationId}))==="modal"&&e(!0,{conversationId:o.conversationId}):(yield x({targetUserId:o.id,pageContext:null}))==="modal"&&e(!0,{targetUserId:o.id,pageContext:null}),h("closeModal")})}return v({reload:B}),(o,a)=>{const t=W,l=Y,S=J,A=q,F=Z,G=D;return y(),ot(at,null,[s(G,{spinning:n.value},{default:r(()=>[s(F,{"item-layout":"horizontal","data-source":d.value,locale:L.value},{renderItem:r(({item:i})=>[s(A,{class:"im-chat-msg-item",onClick:pt=>H(i)},{actions:r(()=>[g("span",rt,f(b(i.lastTime)),1)]),default:r(()=>[s(S,null,{title:r(()=>[g("div",it,[g("span",st,f(i.displayName),1),s(t,{count:i.unreadCount,"overflow-count":99},null,8,["count"])])]),description:r(()=>[g("div",nt,f(U(i.lastContent)),1)]),avatar:r(()=>[s(t,{dot:"",offset:[-2,2]},{default:r(()=>[i.type==="group"?(y(),k(l,{key:0,style:{backgroundColor:"#1677ff"}},{default:r(()=>[s(T(E),{icon:"ant-design:team-outlined"})]),_:1})):(y(),k(l,{key:1,src:N(i.avatar)},{default:r(()=>[et(f((i.displayName||"?").slice(0,1)),1)]),_:2},1032,["src"]))]),_:2},1024)]),_:2},1024)]),_:2},1032,["onClick"])]),_:1},8,["data-source","locale"])]),_:1},8,["spinning"]),s(Q,{onRegister:T(u)},null,8,["onRegister"])],64)}}}),ea=K(mt,[["__scopeId","data-v-cdda353f"]]);export{ea as default};