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