import{k as $t,j as x,t as U,h as _t,m as i,n as $,p as e,q as f,i as y,v as C,f as v,A as s,x as ut,s as gt,e as k,S as D,F as N,w as mt}from"./web.Os7kOAdY.js";import{g as B,t as dt}from"./i18n-runtime._BAkvU05.js";var ht=s("<div class=panel style=display:flex;flex-direction:column;gap:14px><!$><!/><!$><!/><!$><!/><p class=tool-hint>"),G=s("<p class=tool-hint>"),pt=s("<span class=tool-error>&times; <!$><!/>"),ft=s('<div style=display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px><span class=tool-hint style=margin:0><!$><!/><!$><!/><!$><!/><!$><!/> <!$><!/></span><button class=tool-btn style="font-size:13px;padding:4px 10px">'),bt=s("<div class=tool-tabs><button></button><button>"),xt=s("<div class=hotlist-ai>"),vt=s("<div style=display:flex;flex-wrap:wrap;gap:6px><button></button><!$><!/>"),St=s("<ul class=hotlist-list>"),yt=s("<details class=hotlist-ai-block open><summary class=hotlist-ai-title></summary><p class=hotlist-ai-content>"),wt=s("<button>"),Ct=s("<li class=hotlist-item><span class=hotlist-rank></span><!$><!/><span class=hotlist-platform>"),kt=s('<a target=_blank rel="noopener noreferrer"class=hotlist-title>'),Et=s("<span class=hotlist-title>");const At="https://www.lvonce.com/public/hotlist/latest.json",H="taitan_hotlist",j="taitan_hotlist_ts",It=300*1e3;async function Lt(){try{const _=localStorage.getItem(j),g=localStorage.getItem(H);if(_&&g&&Date.now()-parseInt(_)<It)return JSON.parse(g)}catch{}try{const _=await fetch(At);if(!_.ok)return null;const g=await _.json();return localStorage.setItem(H,JSON.stringify(g)),localStorage.setItem(j,String(Date.now())),g}catch{return null}}function Tt(_){try{return new Date(_).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return _}}function Ht(){const[_,g]=x(B(),{equals:!1}),u=n=>dt(n,_());U(()=>{const n=b=>{const p=b.detail?.locale;p&&g(p)};window.addEventListener("taitan:locale-change",n),g(B()),gt(()=>window.removeEventListener("taitan:locale-change",n))});const[h,Q]=x(null),[F,M]=x(!0),[R,q]=x(""),[E,z]=x("all"),[w,A]=x("summary"),J=async()=>{M(!0),q("");const n=await Lt();n?(Q(n),n.ai_summary?.length||A("list")):q("数据加载失败，请稍后重试"),M(!1)},V=async()=>{localStorage.removeItem(H),localStorage.removeItem(j),await J()};U(J);const K=_t(()=>{const n=h();if(!n)return[];const b=E();return b==="all"?n.items:n.items.filter(p=>p.platform===b)});return(()=>{var n=i(ht),b=n.firstChild,[p,W]=$(b.nextSibling),X=p.nextSibling,[O,Z]=$(X.nextSibling),tt=O.nextSibling,[Y,et]=$(tt.nextSibling),lt=Y.nextSibling;return e(n,(()=>{var S=f(()=>!!F());return()=>S()&&(()=>{var l=i(G);return e(l,()=>u("加载中...")),l})()})(),p,W),e(n,(()=>{var S=f(()=>!!R());return()=>S()&&(()=>{var l=i(pt),t=l.firstChild,r=t.nextSibling,[a,o]=$(r.nextSibling);return e(l,R,a,o),l})()})(),O,Z),e(n,(()=>{var S=f(()=>!!h());return()=>S()&&[(()=>{var l=i(ft),t=l.firstChild,r=t.firstChild,[a,o]=$(r.nextSibling),c=a.nextSibling,[m,I]=$(c.nextSibling),L=m.nextSibling,[d,nt]=$(L.nextSibling),at=d.nextSibling,[P,rt]=$(at.nextSibling),it=P.nextSibling,st=it.nextSibling,[ot,ct]=$(st.nextSibling),T=t.nextSibling;return e(t,()=>u("更新于"),a,o),e(t,()=>Tt(h().generated_at),m,I),e(t,()=>u("，共"),d,nt),e(t,()=>h().total,P,rt),e(t,()=>u("条"),ot,ct),T.$$click=V,e(T,()=>u("刷新")),y(()=>ut(T,"disabled",F())),C(),l})(),v(D,{get when(){return h().ai_summary?.length},get children(){var l=i(bt),t=l.firstChild,r=t.nextSibling;return t.$$click=()=>A("summary"),e(t,()=>u("AI 总结")),r.$$click=()=>A("list"),e(r,()=>u("热榜列表")),y(a=>{var o=`tool-tab${w()==="summary"?" is-active":""}`,c=`tool-tab${w()==="list"?" is-active":""}`;return o!==a.e&&k(t,a.e=o),c!==a.t&&k(r,a.t=c),a},{e:void 0,t:void 0}),C(),l}}),v(D,{get when(){return f(()=>w()==="summary")()&&h().ai_summary?.length},get children(){var l=i(xt);return e(l,v(N,{get each(){return h().ai_summary},children:t=>(()=>{var r=i(yt),a=r.firstChild,o=a.nextSibling;return e(a,()=>t.title),e(o,()=>t.content),r})()})),l}}),v(D,{get when(){return w()==="list"},get children(){return[(()=>{var l=i(vt),t=l.firstChild,r=t.nextSibling,[a,o]=$(r.nextSibling);return t.$$click=()=>z("all"),e(t,()=>u("全部")),e(l,v(N,{get each(){return h().platforms},children:c=>(()=>{var m=i(wt);return m.$$click=()=>z(c),e(m,c),y(()=>k(m,`hotlist-pill${E()===c?" is-active":""}`)),C(),m})()}),a,o),y(()=>k(t,`hotlist-pill${E()==="all"?" is-active":""}`)),C(),l})(),(()=>{var l=i(St);return e(l,v(N,{get each(){return K()},children:t=>(()=>{var r=i(Ct),a=r.firstChild,o=a.nextSibling,[c,m]=$(o.nextSibling),I=c.nextSibling;return e(a,()=>t.rank),e(r,(()=>{var L=f(()=>!!t.url);return()=>L()?(()=>{var d=i(kt);return e(d,()=>t.title),y(()=>mt(d,"href",t.url)),d})():(()=>{var d=i(Et);return e(d,()=>t.title),d})()})(),c,m),e(I,()=>t.platform),r})()})),l})(),f(()=>f(()=>K().length===0)()&&(()=>{var l=i(G);return e(l,()=>u("该平台暂无数据")),l})())]}})]})(),Y,et),e(lt,()=>u("数据来自 TrendRadar，每 30 分钟自动更新；本工具不上传任何信息。")),n})()}$t(["click"]);export{Ht as default};
