import{d as s,r as e,a,o as t,aH as l,e as r,f as n,h as i,l as o,m as c,p as d,z as m,F as p,G as u,y as h,O as f}from"./index-ip5gDR6L.js";/* empty css                     *//* empty css               *//* empty css                */import{a as v}from"./dashboard-C-Wq9kTO.js";import{E as x}from"./index-D1xXI5gl.js";import{E as y}from"./index-DbRz3Zuu.js";const g={class:"art-card h-128 p-5 mb-5 max-sm:mb-4"},b={class:"art-card-header"},w={class:"title"},j={class:"text-success"},_={class:"h-9/10 mt-2 overflow-hidden"},k={class:"text-g-800 font-medium"},z={class:"text-theme"},I=s({__name:"dynamic-stats",setup(s){const I=e([]),E=a(0);let P,F=null;const G=()=>{return s=this,e=null,a=function*(){try{const{list:s,sinceId:e}=yield v(P,50);if(s.length){P=e;const a=new Set(I.map(s=>s.id)),t=s.filter(s=>!a.has(s.id));t.length&&(I.unshift(...t),E.value=t.length,I.length>100&&I.splice(100))}}catch(s){f.error("获取抽奖动态失败")}},new Promise((t,l)=>{var r=s=>{try{i(a.next(s))}catch(e){l(e)}},n=s=>{try{i(a.throw(s))}catch(e){l(e)}},i=s=>s.done?t(s.value):Promise.resolve(s.value).then(r,n);i((a=a.apply(s,e)).next())});var s,e,a};return t(()=>{G(),F=window.setInterval(G,5e3)}),l(()=>{F&&window.clearInterval(F)}),(s,e)=>{const a=x,t=y;return n(),r("div",g,[i("div",b,[i("div",w,[e[1]||(e[1]=i("h4",null,"实时抽奖动态",-1)),i("p",null,[e[0]||(e[0]=o("新增",-1)),i("span",j,"+"+c(E.value),1)])])]),i("div",_,[d(t,null,{default:m(()=>[(n(!0),r(p,null,u(I,(s,t)=>(n(),r("div",{class:"h-17.5 leading-17.5 border-b border-g-300 text-sm overflow-hidden last:border-b-0",key:s.id},[i("span",k,c(s.nickname),1),e[4]||(e[4]=i("span",{class:"mx-2 text-g-600"},"在",-1)),i("span",z,c(s.issueName),1),s.isWinner?(n(),h(a,{key:0,size:"small",type:"success",class:"ml-2"},{default:m(()=>[...e[2]||(e[2]=[o("中奖",-1)])]),_:1})):(n(),h(a,{key:1,size:"small",type:"info",class:"ml-2"},{default:m(()=>[...e[3]||(e[3]=[o("参与",-1)])]),_:1}))]))),128))]),_:1})])])}}});export{I as _};
