`),q=[`WHIP`,`WHEP`,`HLS`,`FLV`];function J(e){return e===`BACKEND_KIND_CLOUDFLARE`?w:O}function Y(e){return e.targets?.length??0}function X(e){return(()=>{var t=N(),i=t.firstChild,o=i.firstChild,s=o.nextSibling;return a(t,n(E,{class:`size-6 text-muted-foreground/60`}),i),a(o,()=>e.authed?`暂无在线房间`:`房间列表需登录`),a(s,()=>e.authed?`创建一个房间后,分发拓扑会出现在这里。`:`登录后可查看与管理房间分发拓扑。`),a(t,n(r,{get when(){return!e.authed},get children(){return n(M,{to:`/login`,class:`btn btn-outline btn-sm mt-1`,children:`去登录`})}}),null),t})()}var Z=()=>{let i=j(),[x,w]=o([]),[E,O]=o([]),[M,N]=o(``),Z;t(()=>{d.getConfig().then(e=>w(e.backends||[])).catch(()=>{});let e=Z;if(e&&!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches){let t=Array.from(e.querySelectorAll(`[data-parallax]`)),n=0,r=0,i=0,a=0,o=0,s=t=>{let i=e.getBoundingClientRect();n=(t.clientX-i.left)/i.width-.5,r=(t.clientY-i.top)/i.height-.5,e.style.setProperty(`--mx`,`${t.clientX-i.left}px`),e.style.setProperty(`--my`,`${t.clientY-i.top}px`)},c=()=>{n=0,r=0},l=()=>{i+=(n-i)*.08,a+=(r-a)*.08;for(let e of t){let t=Number(e.dataset.parallax||0);e.style.transform=`translate3d(${(i*t).toFixed(2)}px, ${(a*t).toFixed(2)}px, 0)`}o=requestAnimationFrame(l)};e.addEventListener(`mousemove`,s),e.addEventListener(`mouseleave`,c),o=requestAnimationFrame(l),v(()=>{e.removeEventListener(`mousemove`,s),e.removeEventListener(`mouseleave`,c),cancelAnimationFrame(o)})}}),S(()=>{_.check()&&_.isAuthed()&&d.listRooms().then(e=>O(e.rooms||[])).catch(()=>{})});let Q=e=>i({to:e,search:{room:M()}});return(()=>{var t=U(),o=t.firstChild,d=o.firstChild.nextSibling.nextSibling,v=o.nextSibling,S=v.firstChild,w=S.nextSibling;return m(e=>Z=e,o),a(d,n(u,{get children(){return P()}}),null),a(d,n(u,{delay:1,get children(){return F()}}),null),a(d,n(u,{delay:2,get children(){return I()}}),null),a(d,n(u,{delay:3,class:`mt-10`,get children(){var e=R(),t=e.firstChild,i=t.firstChild,o=i.firstChild;return a(e,n(f,{}),t),a(i,n(T,{class:`size-4 shrink-0 text-muted-foreground`}),o),o.$$keydown=e=>{e.key===`Enter`&&Q(`/room`)},o.$$input=e=>N(e.currentTarget.value),a(t,n(y,{class:`h-11 sm:w-auto`,onClick:()=>Q(`/room`),get children(){return[`进入房间`,n(C,{class:`size-4`})]}}),null),a(t,n(y,{variant:`outline`,class:`h-11`,onClick:()=>Q(`/publish`),get children(){return[n(A,{class:`size-4`}),`开始直播`]}}),null),a(e,n(r,{get when(){return _.isAuthed()},get children(){var e=L(),t=e.firstChild,n=t.firstChild.nextSibling,r=t.nextSibling,i=r.firstChild.nextSibling,o=r.nextSibling.firstChild.nextSibling;return a(n,()=>_.role()),a(i,()=>_.can(`room:publish`)?`ON`:`OFF`),a(o,()=>_.can(`room:chat`)?`ON`:`OFF`),s(e=>{var t=_.can(`room:publish`)?`text-success`:`opacity-50`,n=_.can(`room:chat`)?`text-success`:`opacity-50`;return t!==e.e&&l(i,e.e=t),n!==e.t&&l(o,e.t=n),e},{e:void 0,t:void 0}),e}}),null),s(()=>o.value=M()),e}}),null),a(d,n(u,{delay:4,class:`mt-12`,get children(){var t=z(),n=t.firstChild,r=n.firstChild,i=n.nextSibling.firstChild;return a(r,()=>x().length||`–`),a(i,(()=>{var t=e(()=>!!_.isAuthed());return()=>t()?E().length:`–`})()),t}}),null),a(t,n(g,{items:[`WHIP → SFU`,`SRS FAN-OUT`,`WHEP / HLS / FLV`,`CLOUDFLARE REALTIME`,`WEBRTC LOW-LATENCY`,`一路推流 · 多端扇出`,`FAN-OUT CONSOLE`]}),v),a(S,n(u,{get children(){var e=B();return e.firstChild,a(e,n(y,{variant:`ghost`,size:`sm`,class:`hidden sm:inline-flex`,onClick:()=>i({to:`/rooms`}),get children(){return[`全部`,n(C,{class:`size-3.5`})]}}),null),e}}),null),a(S,n(r,{get when(){return E().length>0},get fallback(){return n(X,{get authed(){return _.isAuthed()}})},get children(){var e=V();return a(e,n(p,{get each(){return E()},children:(e,t)=>n(u,{get delay(){return Math.min(t()+1,5)},get children(){var r=W(),o=r.firstChild,s=o.nextSibling,l=s.firstChild,u=l.nextSibling,d=u.firstChild,f=s.nextSibling;return a(o,()=>String(t()+1).padStart(2,`0`)),a(r,n(c,{get active(){return Y(e)>0}}),s),a(l,()=>e.name),a(u,()=>Y(e),d),a(u,()=>Y(e)>0?`live`:`idle`,null),a(f,n(y,{size:`sm`,variant:`outline`,class:`flex-1 sm:flex-none`,onClick:()=>i({to:`/room`,search:{room:e.name}}),children:`进入`}),null),a(f,n(y,{size:`sm`,class:`flex-1 sm:flex-none`,onClick:()=>i({to:`/publish`,search:{room:e.name}}),children:`直播`}),null),r}})})),e}}),null),a(w,n(u,{get children(){var t=H(),i=t.firstChild,o=i.firstChild,c=o.firstChild,u=i.nextSibling,d=u.nextSibling,m=d.firstChild.nextSibling,g=d.nextSibling,_=g.firstChild;return a(t,n(f,{}),i),a(o,n(D,{class:`size-4 text-acid-lime`}),c),a(i,n(h,{variant:`muted`,get children(){return[e(()=>x().length),` 路`]}}),null),a(u,n(r,{get when(){return x().length>0},get fallback(){return G()},get children(){return n(p,{get each(){return x()},children:e=>{let t=J(e.kind);return(()=>{var r=K(),i=r.firstChild,o=i.firstChild,c=o.nextSibling.firstChild,u=c.nextSibling,d=i.nextSibling;return a(o,n(t,{class:`size-4`})),a(c,()=>e.name),a(u,()=>e.primary?`primary sfu`:`standby`),a(d,n(b,{get active(){return e.configured}}),null),a(d,n(h,{get variant(){return e.configured?`success`:`muted`},get children(){return e.configured?`在线`:`未配置`}}),null),s(()=>l(r,`flex items-center justify-between gap-3 border p-3 transition-colors ${e.configured?`border-line bg-background/50`:`border-line/60 bg-background/20 opacity-70`}`)),r})()}})}})),a(m,n(p,{each:q,children:e=>n(h,{variant:`outline`,class:`font-mono`,children:e})})),a(g,n(k,{class:`mt-px size-4 shrink-0 text-success`}),_),t}})),t})()};x([`input`,`keydown`]);export{Z as Home};