live-sfu-demo/internal/server/static/assets/routes-Dsh8M52R.js

1 line
10 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{B as e,C as t,E as n,H as r,I as i,J as a,K as o,M as s,P as c,T as l,W as u,X as d,Z as f,a as p,b as m,c as h,g,i as _,j as v,n as y,o as b,p as x,r as S,s as C,w}from"./ui-CBKBDzcl.js";import{t as T}from"./arrow-right-Co3jJM9l.js";import{n as E,t as D}from"./monitor-play-Ddu3Y_M7.js";import{t as O}from"./hash-DAuOZ9k3.js";import{t as k}from"./radio-tower-DcOqbcos.js";import{t as A}from"./shield-check-CMgIbfEy.js";import{a as j,s as M}from"./index-Cfr72k3j.js";var N=[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]],P=t=>e(m,a(t,{iconNode:N,name:`server`})),F=v(`<div class="mt-6 flex flex-col items-center gap-3 border border-dashed border-line px-6 py-14 text-center"><div><p class=font-medium></p><p class="mt-1 text-sm text-muted-foreground">`),I=v(`<div class="flex items-center gap-2.5"><span class="size-2 bg-success pulse"></span><span class="mono-label text-muted-foreground">SyncLive / 对标 SyncTV · fan-out`),L=v(`<h1 class="display mt-6 text-[clamp(3.4rem,9vw,7.75rem)] will-change-transform"data-parallax=10><span class=block>一路推流,</span><span class=block><span class=text-acid-lime>多端扇出</span><span class="mono-label ml-3 align-top text-acid-lime sm:ml-5">/ fan-out`),R=v(`<p class="mt-6 max-w-xl text-base leading-relaxed text-muted-foreground sm:text-lg">Cloudflare Realtime 与 SRS 双 SFU 分发,浏览器经服务端反代直连,凭证不出服务端。`),z=v(`<div class="mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 border-t border-line/70 pt-3"><span class="mono-label flex items-center gap-1.5 text-muted-foreground">role <span class=text-acid-cyan></span></span><span class="mono-label text-muted-foreground">chat · <span>`),B=v(`<div class="relative max-w-3xl border border-line bg-card/60 p-3 backdrop-blur-sm will-change-transform sm:p-4"data-parallax=6><div class="flex flex-col gap-2 sm:flex-row"><div class="flex h-11 flex-1 items-center gap-2.5 border border-line bg-background/70 px-3 transition-colors focus-within:border-ring"><input class="field-mono h-full w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground/50"placeholder=输入房间名 aria-label=房间名>`),V=v(`<div class="grid max-w-3xl grid-cols-3 divide-x divide-line/80 border border-line bg-card/40 will-change-transform"data-parallax=4><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary"></p><p class="mono-label mt-1.5 text-muted-foreground">sfu backends</p></div><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary"></p><p class="mono-label mt-1.5 text-muted-foreground">online rooms</p></div><div class="px-4 py-3 sm:px-5"><p class="display text-3xl sm:text-4xl dark:text-primary">4</p><p class="mono-label mt-1.5 text-muted-foreground">protocols`),H=v(`<div class="flex items-end justify-between gap-4 border-b border-line pb-4"><div><p class="mono-label text-muted-foreground">online rooms</p><h2 class="display mt-1.5 text-3xl sm:text-4xl">在线房间`),U=v(`<div class=mt-2>`),W=v(`<div class="relative border border-line bg-card/50 p-4 sm:p-5"><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-2"><h2 class=font-semibold>Signal Stack</h2></div></div><div class="mt-4 space-y-2.5"></div><div class="mt-4 border-t border-line/70 pt-4"><p class="micro-label text-muted-foreground">distribution protocols</p><div class="mt-2.5 flex flex-wrap gap-1.5"></div></div><div class="mt-4 flex items-start gap-2.5 border border-line/70 bg-background/40 p-3"><p class="text-xs leading-relaxed text-muted-foreground">凭据由服务端代理注入,浏览器不持有 SFU 密钥。`),G=v(`<div class=relative><section class="relative overflow-hidden"><div class=spotlight aria-hidden=true></div><div class="ghost-text display pointer-events-none absolute -top-8 right-0 hidden text-[24vw] leading-none will-change-transform xl:block"data-parallax=-40 aria-hidden=true>SFU</div><div class="relative mx-auto max-w-[1400px] px-4 pt-14 pb-12 sm:px-6 sm:pt-20"></div></section><section class="mx-auto grid max-w-[1400px] gap-10 px-4 py-14 sm:px-6 lg:grid-cols-[minmax(0,1fr)_360px]"><div class=min-w-0></div><aside class=min-w-0>`),K=v(`<div class="group -mx-3 grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 border-b border-line/80 py-4 transition-colors hover:bg-accent/40 sm:mx-0 sm:-mx-4 sm:grid-cols-[3rem_auto_minmax(0,1fr)_auto] sm:gap-4 sm:px-4"><span class="hidden font-mono text-xs text-muted-foreground/70 sm:block"></span><div class=min-w-0><p class="display truncate text-xl transition-colors sm:text-2xl dark:group-hover:text-primary"></p><p class="mono-label mt-1 text-muted-foreground"> targets · </p></div><div class="col-span-2 flex gap-2 sm:col-span-1">`),q=v(`<p class="text-sm text-muted-foreground">正在读取后端配置…`),J=v(`<div><div class="flex min-w-0 items-center gap-3"><span class="flex size-9 shrink-0 items-center justify-center border border-line bg-background text-foreground/80"></span><div class=min-w-0><p class="truncate text-sm font-medium"></p><p class="micro-label mt-0.5 text-muted-foreground"></p></div></div><div class="flex shrink-0 items-center gap-2.5">`),Y=[`WHIP`,`WHEP`,`HLS`,`FLV`];function X(e){return e===`BACKEND_KIND_CLOUDFLARE`?E:P}function Z(e){return e.targets?.length??0}function Q(t){return(()=>{var n=F(),r=n.firstChild,a=r.firstChild,o=a.nextSibling;return l(n,e(D,{class:`size-6 text-muted-foreground/60`}),r),l(a,()=>t.authed?`暂无在线房间`:`房间列表需登录`),l(o,()=>t.authed?`创建一个房间后,分发拓扑会出现在这里。`:`登录后可查看与管理房间分发拓扑。`),l(n,e(i,{get when(){return!t.authed},get children(){return e(M,{to:`/login`,class:`btn btn-outline btn-sm mt-1`,children:`去登录`})}}),null),n})()}var $=()=>{let a=j(),[m,v]=o([]),[w,E]=o([]),[D,M]=o(``),N;f(()=>{g.getConfig().then(e=>v(e.backends||[])).catch(()=>{});let e=N;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),d(()=>{e.removeEventListener(`mousemove`,s),e.removeEventListener(`mouseleave`,c),cancelAnimationFrame(o)})}}),r(()=>{x.check()&&x.isAuthed()&&g.listRooms().then(e=>E(e.rooms||[])).catch(()=>{})});let P=e=>a({to:e,search:{room:D()}});return(()=>{var r=G(),o=r.firstChild,d=o.firstChild.nextSibling.nextSibling,f=o.nextSibling,g=f.firstChild,v=g.nextSibling;return s(e=>N=e,o),l(d,e(h,{get children(){return I()}}),null),l(d,e(h,{delay:1,get children(){return L()}}),null),l(d,e(h,{delay:2,get children(){return R()}}),null),l(d,e(h,{delay:3,class:`mt-10`,get children(){var n=B(),r=n.firstChild,a=r.firstChild,o=a.firstChild;return l(n,e(_,{}),r),l(a,e(O,{class:`size-4 shrink-0 text-muted-foreground`}),o),o.$$keydown=e=>{e.key===`Enter`&&P(`/room`)},o.$$input=e=>M(e.currentTarget.value),l(r,e(S,{class:`h-11 sm:w-auto`,onClick:()=>P(`/room`),get children(){return[`进入房间`,e(T,{class:`size-4`})]}}),null),l(n,e(i,{get when(){return x.isAuthed()},get children(){var e=z(),n=e.firstChild,r=n.firstChild.nextSibling,i=n.nextSibling.firstChild.nextSibling;return l(r,()=>x.role()),l(i,()=>x.can(`room:chat`)?`ON`:`OFF`),u(()=>t(i,x.can(`room:chat`)?`text-success`:`opacity-50`)),e}}),null),u(()=>o.value=D()),n}}),null),l(d,e(h,{delay:4,class:`mt-12`,get children(){var e=V(),t=e.firstChild,r=t.firstChild,i=t.nextSibling.firstChild;return l(r,()=>m().length||`–`),l(i,(()=>{var e=n(()=>!!x.isAuthed());return()=>e()?w().length:`–`})()),e}}),null),l(r,e(b,{items:[`WHIP → SFU`,`SRS FAN-OUT`,`WHEP / HLS / FLV`,`CLOUDFLARE REALTIME`,`WEBRTC LOW-LATENCY`,`一路推流 · 多端扇出`,`FAN-OUT CONSOLE`]}),f),l(g,e(h,{get children(){var t=H();return t.firstChild,l(t,e(S,{variant:`ghost`,size:`sm`,class:`hidden sm:inline-flex`,onClick:()=>a({to:`/rooms`}),get children(){return[`全部`,e(T,{class:`size-3.5`})]}}),null),t}}),null),l(g,e(i,{get when(){return w().length>0},get fallback(){return e(Q,{get authed(){return x.isAuthed()}})},get children(){var t=U();return l(t,e(c,{get each(){return w()},children:(t,n)=>e(h,{get delay(){return Math.min(n()+1,5)},get children(){var r=K(),i=r.firstChild,o=i.nextSibling,s=o.firstChild,c=s.nextSibling,u=c.firstChild,d=o.nextSibling;return l(i,()=>String(n()+1).padStart(2,`0`)),l(r,e(p,{get active(){return Z(t)>0}}),o),l(s,()=>t.name),l(c,()=>Z(t),u),l(c,()=>Z(t)>0?`live`:`idle`,null),l(d,e(S,{size:`sm`,variant:`outline`,class:`flex-1 sm:flex-none`,onClick:()=>a({to:`/room`,search:{room:t.name}}),children:`进入`})),r}})})),t}}),null),l(v,e(h,{get children(){var r=W(),a=r.firstChild,o=a.firstChild,s=o.firstChild,d=a.nextSibling,f=d.nextSibling,p=f.firstChild.nextSibling,h=f.nextSibling,g=h.firstChild;return l(r,e(_,{}),a),l(o,e(k,{class:`size-4 text-acid-lime`}),s),l(a,e(y,{variant:`muted`,get children(){return[n(()=>m().length),` 路`]}}),null),l(d,e(i,{get when(){return m().length>0},get fallback(){return q()},get children(){return e(c,{get each(){return m()},children:n=>{let r=X(n.kind);return(()=>{var i=J(),a=i.firstChild,o=a.firstChild,s=o.nextSibling.firstChild,c=s.nextSibling,d=a.nextSibling;return l(o,e(r,{class:`size-4`})),l(s,()=>n.name),l(c,()=>n.primary?`primary sfu`:`standby`),l(d,e(C,{get active(){return n.configured}}),null),l(d,e(y,{get variant(){return n.configured?`success`:`muted`},get children(){return n.configured?`在线`:`未配置`}}),null),u(()=>t(i,`flex items-center justify-between gap-3 border p-3 transition-colors ${n.configured?`border-line bg-background/50`:`border-line/60 bg-background/20 opacity-70`}`)),i})()}})}})),l(p,e(c,{each:Y,children:t=>e(y,{variant:`outline`,class:`font-mono`,children:t})})),l(h,e(A,{class:`mt-px size-4 shrink-0 text-success`}),g),r}})),r})()};w([`input`,`keydown`]);export{$ as Home};