experiments of a tiny cytube-like player with yt-dlp
0

Configure Feed

Select the types of activity you want to include in your feed.

frontend: /r/{name} route, vote-skip, room settings panel

karitham (Jun 1, 2026, 4:48 PM +0200) 863bdfea 79083f9f

+129 -35
+7 -6
README.md
··· 12 12 - Need space for gifs 13 13 - Improve over the default player (audio level normalization?) 14 14 - Fix player card layering / layouting 15 - - Room management 16 - - name room 17 - - have link with room name in it 18 15 - Built-in search? 19 16 - Track handling 20 17 - Better caching 21 18 - Cleaner file-system backend (s3 at some point?) 22 19 - Resolving a link that we have the file for should not re-resolve 23 - - Auto-play w/ live on join 24 20 - User management 25 21 - ATproto login 26 22 - Anon "login" (pick a username -- server-side) 27 23 - Nice OG images of a room (name + most played video thumbnail, title, a few active members?) 28 24 - Direct track upload 29 - - Vote skip 30 25 - Reorder up-next tracks 31 26 - Shuffle up-next tracks 32 - - Enable / Disable persistent playlist 33 27 - Publish atmo.rsvp events for sharing moments together 34 28 - Actual MOQ transport layer for chromium users / polyfill? 35 29 - ACL / private rooms? (restrict to a set of dids?) 30 + 31 + ## Shipped 32 + 33 + - Named rooms with `/r/{name}` URLs (`create_room` returns the name; the API resolves name → UUID internally) 34 + - Per-room autoplay + skip-threshold settings (room settings panel in the playlist section) 35 + - Vote skip (replace `skip` with `vote_skip`; threshold-based, default 34%) 36 + - Auto-play triggers on client connect (in addition to the idle sweep) 36 37 37 38 ## Quick Start 38 39
+31 -16
frontend/src/App.tsx
··· 21 21 try { 22 22 const res = await fetch("/api/v1/rooms", { method: "POST" }); 23 23 if (!res.ok) throw new Error(`create room: ${res.status}`); 24 - const data: { room_id: string } = await res.json(); 25 - navigate(`/room/${data.room_id}?name=${encodeURIComponent(name().trim())}`); 24 + const data: { room_id: string; room_name: string } = await res.json(); 25 + navigate(`/r/${data.room_name}?name=${encodeURIComponent(name().trim())}`); 26 26 } catch (e) { 27 27 console.error("Failed to create room:", e); 28 28 setHomeError("Failed to create room"); ··· 58 58 /// Room page: player, queue, chat. 59 59 const Room: Component = () => { 60 60 const params = useParams<Record<string, string>>(); 61 - const roomId = untrack(() => params.id); 61 + const roomName = untrack(() => params.name); 62 62 const searchParams = new URLSearchParams(location.search); 63 63 const userName = searchParams.get("name") || "anonymous"; 64 64 const navigate = useNavigate(); ··· 70 70 setTheme(next); 71 71 }; 72 72 73 - const { state, chats, connected, error, setError, send } = useRoomConnection(roomId, userName); 73 + const { state, chats, connected, error, setError, send } = useRoomConnection(roomName, userName); 74 74 75 75 const [showAdd, setShowAdd] = createSignal(false); 76 76 const [addUrl, setAddUrl] = createSignal(""); ··· 86 86 const res = await fetch(endpoint, { 87 87 method: "POST", 88 88 headers: { "Content-Type": "application/json" }, 89 - body: JSON.stringify({ url, room_id: roomId }), 89 + body: JSON.stringify({ url, room_id: roomName }), 90 90 }); 91 91 if (!res.ok) { 92 92 if (res.status === 429) { ··· 117 117 const res = await fetch("/api/v1/playlist/add", { 118 118 method: "POST", 119 119 headers: { "Content-Type": "application/json" }, 120 - body: JSON.stringify({ url, room_id: roomId }), 120 + body: JSON.stringify({ url, room_id: roomName }), 121 121 }); 122 122 if (!res.ok) { 123 123 const err = await res.json().catch(() => ({ error: res.statusText })); ··· 133 133 const res = await fetch("/api/v1/playlist/remove", { 134 134 method: "POST", 135 135 headers: { "Content-Type": "application/json" }, 136 - body: JSON.stringify({ room_id: roomId, id }), 136 + body: JSON.stringify({ room_id: roomName, id }), 137 137 }); 138 138 if (!res.ok) { 139 139 const err = await res.json().catch(() => ({ error: res.statusText })); ··· 144 144 } 145 145 }; 146 146 147 - // Send the toggle over the existing WebSocket — same channel as chat/skip. 148 - const handleTogglePlaylist = (enabled: boolean) => { 149 - send({ type: "set_playlist_enabled", enabled }); 147 + // Settings: sent over the existing WebSocket (same channel as chat). 148 + const handleSetAutoplay = (enabled: boolean) => { 149 + send({ type: "set_autoplay", enabled }); 150 + }; 151 + const handleSetSkipThreshold = (percent: number) => { 152 + send({ type: "set_skip_threshold", percent }); 153 + }; 154 + 155 + // Vote-skip: cast (or re-cast) a vote for the current track. The 156 + // server fires the actual skip when the threshold is met. 157 + const handleVoteSkip = () => { 158 + send({ type: "vote_skip" }); 150 159 }; 151 160 152 161 // Reorder an item in the up-next queue. 0-indexed. ··· 189 198 <div class="room-main"> 190 199 <Player 191 200 track={state()?.current_track ?? null} 192 - roomId={roomId} 201 + roomId={roomName} 193 202 onEnded={() => { 194 203 const track = state()?.current_track; 195 204 if (track) send({ type: "track_ended", item_id: track.id }); ··· 207 216 </button> 208 217 <button 209 218 type="button" 210 - class="secondary" 211 - onClick={() => send({ type: "skip" })} 219 + class="secondary vote-skip" 220 + onClick={handleVoteSkip} 212 221 disabled={!state()?.current_track} 222 + title="Cast a vote to skip the current track" 213 223 > 214 224 Skip 225 + {(state()?.skip_votes ?? 0) > 0 && ( 226 + <span class="vote-count">{state()?.skip_votes}</span> 227 + )} 215 228 </button> 216 229 </div> 217 230 ··· 253 266 queue={state()?.queue ?? []} 254 267 history={state()?.history ?? []} 255 268 playlist={state()?.playlist ?? []} 256 - playlistEnabled={state()?.playlist_enabled ?? true} 269 + autoplayEnabled={state()?.autoplay_enabled ?? true} 270 + skipThreshold={state()?.skip_threshold ?? 34} 257 271 onAddToPlaylist={handleAddToPlaylist} 258 272 onRemoveFromPlaylist={handleRemoveFromPlaylist} 259 - onTogglePlaylist={handleTogglePlaylist} 273 + onSetAutoplay={handleSetAutoplay} 274 + onSetSkipThreshold={handleSetSkipThreshold} 260 275 onMoveQueueItem={handleMoveQueueItem} 261 276 onShuffleQueue={handleShuffleQueue} 262 277 onRemoveQueueItem={handleRemoveQueueItem} ··· 285 300 return ( 286 301 <Router> 287 302 <Route path="/" component={Home} /> 288 - <Route path="/room/:id" component={Room} /> 303 + <Route path="/r/:name" component={Room} /> 289 304 </Router> 290 305 ); 291 306 };
+20 -7
frontend/src/Queue.tsx
··· 34 34 queue: QueueSummary[]; 35 35 history: HistoryEntry[]; 36 36 playlist: PlaylistEntry[]; 37 - playlistEnabled: boolean; 37 + autoplayEnabled: boolean; 38 + skipThreshold: number; 38 39 onAddToPlaylist?: (url: string) => void; 39 40 onRemoveFromPlaylist?: (id: string) => void; 40 - onTogglePlaylist?: (enabled: boolean) => void; 41 + onSetAutoplay?: (enabled: boolean) => void; 42 + onSetSkipThreshold?: (percent: number) => void; 41 43 onMoveQueueItem?: (from: number, to: number) => void; 42 44 onShuffleQueue?: () => void; 43 45 onRemoveQueueItem?: (itemId: string) => void; ··· 120 122 </div> 121 123 122 124 <div class="queue-section"> 123 - <h3> 124 - Playlist ({props.playlist.length}) 125 + <h3>Playlist ({props.playlist.length})</h3> 126 + <div class="playlist-controls"> 125 127 <label class="playlist-toggle"> 126 128 <input 127 129 type="checkbox" 128 - checked={props.playlistEnabled} 130 + checked={props.autoplayEnabled} 129 131 disabled={props.playlist.length === 0} 130 - onChange={(e) => props.onTogglePlaylist?.(e.currentTarget.checked)} 132 + onChange={(e) => props.onSetAutoplay?.(e.currentTarget.checked)} 131 133 /> 132 134 <span>Autoplay</span> 133 135 </label> 134 - </h3> 136 + <label class="playlist-threshold" title="Skip when this percent of the room votes"> 137 + <span class="playlist-threshold-label">Skip ≥ {props.skipThreshold}%</span> 138 + <input 139 + type="range" 140 + min="0" 141 + max="100" 142 + step="1" 143 + value={props.skipThreshold} 144 + onInput={(e) => props.onSetSkipThreshold?.(parseInt(e.currentTarget.value, 10))} 145 + /> 146 + </label> 147 + </div> 135 148 <For each={props.playlist}> 136 149 {(item) => ( 137 150 <div class="queue-item-row">
+58
frontend/src/style.css
··· 249 249 padding: 0.4rem 0.75rem; 250 250 } 251 251 252 + .vote-skip { 253 + display: inline-flex; 254 + align-items: center; 255 + gap: 0.4rem; 256 + } 257 + 258 + .vote-count { 259 + display: inline-flex; 260 + align-items: center; 261 + justify-content: center; 262 + min-width: 18px; 263 + height: 18px; 264 + padding: 0 0.4rem; 265 + font-size: 0.7rem; 266 + font-weight: 700; 267 + font-variant-numeric: tabular-nums; 268 + color: var(--crust); 269 + background: var(--accent); 270 + border-radius: 9px; 271 + line-height: 1; 272 + } 273 + 252 274 /* ── Inline form ── */ 253 275 254 276 .inline-form { ··· 476 498 color: var(--text-muted); 477 499 cursor: pointer; 478 500 user-select: none; 501 + } 502 + 503 + .playlist-toggle input { 504 + margin: 0; 505 + cursor: pointer; 506 + } 507 + 508 + .playlist-controls { 509 + display: flex; 510 + align-items: center; 511 + gap: 0.6rem; 512 + flex-wrap: wrap; 513 + margin-bottom: 0.4rem; 514 + } 515 + 516 + .playlist-threshold { 517 + display: inline-flex; 518 + align-items: center; 519 + gap: 0.4rem; 520 + text-transform: none; 521 + letter-spacing: 0; 522 + font-size: 0.72rem; 523 + color: var(--text-muted); 524 + cursor: pointer; 525 + } 526 + 527 + .playlist-threshold-label { 528 + white-space: nowrap; 529 + font-variant-numeric: tabular-nums; 530 + } 531 + 532 + .playlist-threshold input[type="range"] { 533 + width: 80px; 534 + margin: 0; 535 + cursor: pointer; 536 + accent-color: var(--accent); 479 537 } 480 538 .playlist-toggle input { 481 539 margin: 0;
+9 -2
frontend/src/types.ts
··· 48 48 queue: QueueSummary[]; 49 49 history: HistoryEntry[]; 50 50 playlist: PlaylistEntry[]; 51 - playlist_enabled: boolean; 51 + /// When true, idle rooms draw from the playlist. 52 + autoplay_enabled: boolean; 53 + /// Vote-skip threshold as an integer 0..=100 percent. 54 + skip_threshold: number; 55 + /// Number of clients that have cast a skip vote on the current track. 56 + skip_votes: number; 52 57 clients: number; 53 58 } 54 59 ··· 65 70 | { type: "chat"; content: string } 66 71 | { type: "skip" } 67 72 | { type: "track_ended"; item_id: string } 68 - | { type: "set_playlist_enabled"; enabled: boolean } 73 + | { type: "set_autoplay"; enabled: boolean } 74 + | { type: "set_skip_threshold"; percent: number } 75 + | { type: "vote_skip" } 69 76 | { type: "ping" } 70 77 | { type: "move_queue_item"; from: number; to: number } 71 78 | { type: "shuffle_queue" }
+1
static/dist/assets/index-B2UJYwrh.css
··· 1 + :root{color-scheme:light dark;--rosewater: light-dark(#dc8a78, #f4dbd6);--flamingo: light-dark(#dd7878, #f0c6c6);--pink: light-dark(#ea76cb, #f5bde6);--mauve: light-dark(#8839ef, #c6a0f6);--red: light-dark(#d20f39, #ed8796);--maroon: light-dark(#e64553, #ee99a0);--peach: light-dark(#fe640b, #f5a97f);--yellow: light-dark(#df8e1d, #eed49f);--green: light-dark(#40a02b, #a6da95);--teal: light-dark(#179299, #8bd5ca);--sky: light-dark(#04a5e5, #91d7e3);--sapphire: light-dark(#209fb5, #7dc4e4);--blue: light-dark(#1e66f5, #8aadf4);--lavender: light-dark(#7287fd, #b7bdf8);--text: light-dark(#4c4f69, #cad3f5);--subtext1: light-dark(#5c5f77, #b8c0e0);--subtext0: light-dark(#6c6f85, #a5adcb);--overlay2: light-dark(#7c7f93, #939ab7);--overlay1: light-dark(#8c8fa1, #8087a2);--overlay0: light-dark(#9ca0b0, #6e738d);--surface2: light-dark(#acb0be, #5b6078);--surface1: light-dark(#bcc0cc, #494d64);--surface0: light-dark(#ccd0da, #363a4f);--crust: light-dark(#dce0e8, #181926);--mantle: light-dark(#e6e9ef, #1e2030);--base: light-dark(#eff1f5, #24273a);--bg: var(--base);--surface: var(--mantle);--surface-raised: var(--crust);--border: var(--surface0);--text-primary: var(--text);--text-muted: var(--overlay1);--accent: var(--mauve);--accent-hover: var(--lavender);--danger: var(--red);--success: var(--green);--warning: var(--yellow);font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text-primary);line-height:1.5}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}body{min-height:100vh}input,button,select{font:inherit;color:inherit}input{background:var(--surface-raised);border:1px solid var(--border);border-radius:6px;padding:.5rem .75rem;outline:none;transition:border-color .15s,box-shadow .15s}input:focus{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 25%,transparent)}button{background:var(--accent);color:var(--crust);border:none;border-radius:6px;padding:.5rem 1rem;cursor:pointer;transition:background .15s,transform .1s;font-weight:600;font-size:.875rem}button:hover:not(:disabled){background:var(--accent-hover)}button:active:not(:disabled){transform:scale(.97)}button:disabled{opacity:.35;cursor:not-allowed}button.secondary{background:var(--surface0);color:var(--text-primary)}button.secondary:hover:not(:disabled){background:var(--surface1)}.home{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;gap:1rem;padding:2rem}.home h1{font-size:3rem;font-weight:700;letter-spacing:-.02em;color:var(--accent)}.home p{color:var(--text-muted);margin-bottom:.5rem}.home-form,.home-join{display:flex;gap:.5rem;flex-wrap:wrap;justify-content:center}.toast{padding:.5rem 1rem;font-size:.85rem;cursor:pointer;user-select:none}.toast-error{background:var(--danger);color:var(--crust);font-weight:600}.toast-action{background:#00000026;border:1px solid rgba(255,255,255,.2);color:inherit;font-size:.75rem;padding:.15rem .5rem;border-radius:3px;cursor:pointer;margin-left:.5rem}.room{display:flex;flex-direction:column;height:100vh}.room-header{display:flex;align-items:center;gap:1rem;padding:.6rem 1rem;background:var(--surface);border-bottom:1px solid var(--border);flex-shrink:0}.room-header h2{font-size:1rem;font-weight:600}.client-count{color:var(--text-muted);font-size:.8rem;margin-left:auto}.disconnected{color:var(--danger);font-size:.8rem;margin-left:.5rem}.theme-toggle-sm{background:none;border:none;color:var(--text-muted);font-size:.65rem;cursor:pointer;padding:.15rem .35rem;border-radius:3px;font-weight:500}.theme-toggle-sm:hover{color:var(--text-primary);background:var(--surface0)}.room-layout{display:flex;flex:1;overflow:hidden}.room-main{flex:1;display:flex;flex-direction:column;padding:.75rem;gap:.75rem;min-width:0;overflow-y:auto}.room-sidebar{width:340px;display:flex;flex-direction:column;border-left:1px solid var(--border);overflow:hidden;flex-shrink:0}.room-actions{display:flex;gap:.5rem;flex-wrap:wrap}.room-actions button{font-size:.8rem;padding:.4rem .75rem}.vote-skip{display:inline-flex;align-items:center;gap:.4rem}.vote-count{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 .4rem;font-size:.7rem;font-weight:700;font-variant-numeric:tabular-nums;color:var(--crust);background:var(--accent);border-radius:9px;line-height:1}.inline-form{display:flex;gap:.4rem}.inline-form input{flex:1;font-size:.85rem}.player{background:var(--surface);border-radius:8px;padding:.75rem;display:flex;flex-direction:column;gap:.5rem}.player-info{display:flex;align-items:center;gap:.75rem}.player-thumb{width:48px;height:48px;border-radius:6px;object-fit:cover;flex-shrink:0;background:var(--surface0)}.player-meta{display:flex;flex-direction:column;gap:.1rem;min-width:0;flex:1}.player-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;font-size:.95rem}.player-duration-row{display:flex;gap:.75rem;font-size:.8rem;color:var(--text-muted)}.player-media video,.player-media audio{width:100%;max-height:60vh;border-radius:6px;background:light-dark(#111,#000)}.player-media-wrap{position:relative}.live-btn{position:absolute;top:.75rem;right:.75rem;font-size:.75rem;font-weight:700;padding:.25rem .65rem;border-radius:4px;letter-spacing:.04em;text-transform:uppercase;background:#00000080;color:#fff;border:1px solid rgba(255,255,255,.15);z-index:10;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.live-btn:hover{background:#000000b3}.live-btn--on{background:var(--accent);color:var(--base);border-color:var(--accent)}.live-btn--on:hover{background:color-mix(in srgb,var(--accent) 85%,var(--base))}.player-idle{color:var(--text-muted);padding:2rem;text-align:center;font-style:italic}.chat{flex:1;display:flex;flex-direction:column;min-height:0}.chat-messages{flex:1;overflow-y:auto;padding:.5rem;display:flex;flex-direction:column;gap:.2rem}.chat-message{padding:.2rem .5rem;border-radius:4px;transition:background .1s}.chat-message:hover{background:var(--surface-raised)}.chat-user{font-weight:600;font-size:.8rem;color:var(--accent)}.chat-time{font-size:.65rem;color:var(--text-muted);margin-left:.4rem;opacity:.7}.chat-content{font-size:.88rem;margin-top:.05rem;word-break:break-word}.chat-input{display:flex;gap:.25rem;padding:.5rem;border-top:1px solid var(--border)}.chat-input input{flex:1;font-size:.85rem}.queue-panel{overflow-y:auto;flex-shrink:0;max-height:50%}.queue-section{padding:.6rem .75rem;border-bottom:1px solid var(--border)}.queue-section h3{font-size:.72rem;text-transform:uppercase;color:var(--text-muted);margin-bottom:.4rem;letter-spacing:.06em;font-weight:700;display:flex;align-items:center;justify-content:space-between;gap:.5rem}.queue-shuffle{font-size:.7rem;font-weight:600;text-transform:none;letter-spacing:0;padding:.15rem .5rem;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--text-muted);cursor:pointer;transition:color .15s,border-color .15s,background .15s}.queue-shuffle:hover{color:var(--accent);border-color:var(--accent);background:var(--surface-raised)}.queue-item-actions{display:flex;gap:.15rem;flex-shrink:0}.queue-item-actions .queue-item-action{display:flex;font-size:.85rem;width:20px;height:20px}.queue-item-actions .queue-item-action:disabled{opacity:.25;cursor:not-allowed}.queue-item-actions .queue-item-action:disabled:hover{color:var(--text-muted);background:none}.playlist-toggle{display:inline-flex;align-items:center;gap:.3rem;text-transform:none;letter-spacing:0;font-size:.72rem;color:var(--text-muted);cursor:pointer;user-select:none}.playlist-controls{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin-bottom:.4rem}.playlist-threshold{display:inline-flex;align-items:center;gap:.4rem;text-transform:none;letter-spacing:0;font-size:.72rem;color:var(--text-muted);cursor:pointer}.playlist-threshold-label{white-space:nowrap;font-variant-numeric:tabular-nums}.playlist-threshold input[type=range]{width:80px;margin:0;cursor:pointer;accent-color:var(--accent)}.playlist-toggle input{margin:0;cursor:pointer}.queue-item{display:flex;align-items:center;gap:.4rem;padding:.2rem 0;font-size:.82rem;transition:background .1s;border-radius:4px}.queue-item:hover{background:var(--surface-raised)}.queue-item.current{color:var(--accent);font-weight:600}.queue-item.history{opacity:.65}.queue-item-row{display:flex;align-items:center;gap:.3rem}.queue-item-row .queue-item{flex:1;min-width:0}.queue-item-row .queue-item:hover{background:none}.queue-item-row:hover .queue-item{background:var(--surface-raised)}.queue-item-action{display:none;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:none;color:var(--text-muted);font-size:1.1rem;font-weight:600;line-height:1;border-radius:4px;cursor:pointer;flex-shrink:0;transition:color .15s,background .15s}.queue-item-row:hover .queue-item-action{display:flex}.queue-item-action:hover{color:var(--accent);background:var(--surface0)}.queue-item-remove:hover{color:var(--danger)}.queue-thumb{width:28px;height:20px;border-radius:3px;object-fit:cover;flex-shrink:0;background:var(--surface0)}.queue-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.queue-duration{color:var(--text-muted);font-size:.75rem;margin-left:.3rem;flex-shrink:0}.queue-empty{color:var(--text-muted);font-size:.78rem;font-style:italic}.room-footer{padding:.3rem .75rem;border-top:1px solid var(--border);display:flex;justify-content:flex-end;flex-shrink:0}.add-target-toggle{display:flex;gap:0}.add-target-toggle button{font-size:.72rem;padding:.25rem .5rem;background:var(--surface0);color:var(--text-muted);border:1px solid var(--border);font-weight:500;border-radius:0}.add-target-toggle button:first-child{border-radius:4px 0 0 4px}.add-target-toggle button:last-child{border-radius:0 4px 4px 0}.add-target-toggle button.active{background:var(--accent);color:var(--crust);border-color:var(--accent)}.chat-message.system .chat-user,.chat-message.system .chat-time{display:none}.chat-message.system .chat-content{font-size:.78rem;color:var(--text-muted);font-style:italic}@media(max-width:768px){.room-header{padding:.4rem .75rem}.room-main{padding:.5rem}.room-sidebar{width:100%;border-left:none;border-top:1px solid var(--border);max-height:40vh}.room-layout{flex-direction:column-reverse}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition-duration:0s!important;animation-duration:0s!important}}
-1
static/dist/assets/index-B3kVSRJi.js
··· 1 - (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();class U extends Error{source;constructor(t){super(),this.source=t}}class Bt extends Error{source;constructor(t,n){super(n instanceof Error?n.message:String(n),{cause:n}),this.source=t}}class En extends Error{constructor(){super("")}}class hr extends Error{constructor(){super("")}}const Cn=0,Ve=1,Ie=2,pt=4,ue=8,Je=16,H=32,he=64,we=128,Jt=256,at=512,He=1024,wt=1,gr=2,bt=4,mr=8,On=16,Ne=32,Ht=64,O=1,W=2,F=4,Re=1,J=2,_e=3,S={},yr=typeof Proxy=="function",Yt={},pr=Symbol("refresh");function Tn(e,t){const n=(e.i?.t?e.i.u?.o:e.i?.o)??-1;n>=e.o&&(e.o=n+1);const r=e.o,i=t.l[r];if(i===void 0)t.l[r]=e;else{const o=i.S;o.T=e,e.S=o,i.S=e}r>t._&&(t._=r)}function Qe(e,t){let n=e.O;n&(ue|pt|He)||(n&Ve?e.O=n&-4|Ie|ue:e.O=n|ue,n&Je||Tn(e,t))}function An(e,t){let n=e.O;n&(ue|pt|Je|He)||(e.O=n|Je,Tn(e,t))}function qe(e,t){const n=e.O;if(!(n&(ue|Je)))return;e.O=n&-25;const r=e.o;if(e.S===e)t.l[r]=void 0;else{const i=e.T,o=t.l[r],s=i??o;e===o?t.l[r]=i:e.S.T=i,s.S=e.S}e.S=e,e.T=void 0}function wr(e){if(!e.R){e.R=!0;for(let t=0;t<=e._;t++)for(let n=e.l[t];n!==void 0;n=n.T)n.O&ue&&ft(n)}}function ft(e,t=Ie){const n=e.O;if(!((n&(Ve|Ie))>=t)){e.O=n&-4|t;for(let r=e.I;r!==null;r=r.p)ft(r.h,Ve);if(e.N!==null)for(let r=e.N;r!==null;r=r.A)for(let i=r.I;i!==null;i=i.p)ft(i.h,Ve)}}function Fe(e,t){for(e.R=!1,e.C=0;e.C<=e._;e.C++){let n=e.l[e.C];for(;n!==void 0;)n.O&ue?t(n):br(n,e),n=e.l[e.C]}e._=0}function br(e,t){qe(e,t);let n=e.o;for(let r=e.P;r;r=r.D){const i=r.m,o=i.V||i;o.L&&o.o>=n&&(n=o.o+1)}if(e.o!==n){e.o=n;for(let r=e.I;r!==null;r=r.p)An(r.h,t)}}const dt=new WeakMap,ne=new Set;function vr(e){let t=dt.get(e);if(t)return V(t);const n=e.U,r=n?.G?V(n.G):null;return t={k:e,F:new Set,W:[[],[]],H:null,M:b,j:r},dt.set(e,t),ne.add(t),e.$=!1,t}function V(e){for(;e.H;)e=e.H;return e}function Rn(e,t){if(e=V(e),t=V(t),e===t)return e;t.H=e;for(const n of t.F)e.F.add(n);return e.W[0].push(...t.W[0]),e.W[1].push(...t.W[1]),e}function Pe(e){const t=e.G;if(!t)return;const n=V(t);if(ne.has(n))return n;e.G=void 0}function Be(e){return Pe(e)?.M??e.M}function vt(e){return e.K!==void 0&&e.K!==S}function Zt(e,t){const n=V(t),r=e.G;if(r){if(r.H){e.G=t;return}const i=V(r);if(ne.has(i)){i!==n&&!vt(e)&&(n.j&&V(n.j)===i?e.G=t:i.j&&V(i.j)===n||Rn(n,i));return}}e.G=t}const je=new Set,x={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0},Y={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0};let M=0,b=null,Ye=!1,jt=0,lt=null;const Ke=new Set;function $r(e){return je.size===0&&ne.size===0&&e.Y.length===0&&e.Z.length===0&&e.q.size===0&&Ke.size===0}function _r(){if(Ke.size!==0)for(const e of Ke){if(e.I!==null){Ke.delete(e);continue}e.B===S&&(e.K!==void 0&&e.K!==S||(Ke.delete(e),e.X?.()))}}function Sr(e){return!!lt?.has(e)}function nt(e){for(const t of ne){if(t.H||t.F.size>0)continue;const n=t.W[e-1];n.length&&(t.W[e-1]=[],gt(n,e))}}function Er(e){for(let t=e.I;t!==null;t=t.p){const n=t.h;if(!n.J)continue;if(n.J===_e){n.ee||(n.ee=!0,n.te.enqueue(J,n.ne));continue}const r=n.O&H?Y:x;r.C>n.o&&(r.C=n.o),Qe(n,r)}}function Cr(e,t){t.ie=e,e.re.push(...t.re);for(const n of ne)n.M===t&&(n.M=e);e.Z.push(...t.Z);for(const n of t.q)e.q.add(n);for(const[n,r]of t.oe){let i=e.oe.get(n);i||e.oe.set(n,i=new Set);for(const o of r)i.add(o)}for(const n of t.se)e.se.add(n)}function Or(e){for(let t=0;t<e.length;t++){const n=e[t];n.G=void 0,n.B!==S&&(n.ue=n.B,n.B=S);const r=n.K;n.K=S,r!==S&&n.ue!==r&&ke(n,!0),n.M=null}e.length=0}function Tr(e){for(const t of ne)(e?t.M===e:!t.M)&&(t.H||(t.W[0].length&&gt(t.W[0],Re),t.W[1].length&&gt(t.W[1],J)),t.k.G===t&&(t.k.G=void 0),t.F.clear(),t.W[0].length=0,t.W[1].length=0,ne.delete(t),dt.delete(t.k))}function ve(){Ye||(Ye=!0,!jt&&!E.ce&&queueMicrotask(xe))}let Ar=class{i=null;le=[[],[]];Y=[];created=M;addChild(t){this.Y.push(t),t.i=this}removeChild(t){const n=this.Y.indexOf(t);n>=0&&(this.Y.splice(n,1),t.i=null)}notify(t,n,r,i){return this.i?this.i.notify(t,n,r,i):!1}run(t){if(this.le[t-1].length){const n=this.le[t-1];this.le[t-1]=[],gt(n,t)}for(let n=0;n<this.Y.length;n++)this.Y[n].run?.(t)}enqueue(t,n){t&&(G?V(G).W[t-1].push(n):this.le[t-1].push(n)),ve()}stashQueues(t){t.le[0].push(...this.le[0]),t.le[1].push(...this.le[1]),this.le=[[],[]];for(let n=0;n<this.Y.length;n++){let r=this.Y[n],i=t.Y[n];i||(i={le:[[],[]],Y:[]},t.Y[n]=i),r.stashQueues(i)}}restoreQueues(t){this.le[0].push(...t.le[0]),this.le[1].push(...t.le[1]);for(let n=0;n<t.Y.length;n++){const r=t.Y[n];let i=this.Y[n];i&&i.restoreQueues(r)}}};class X extends Ar{ce=!1;ae=null;fe=[];Z=[];q=new Set;static Ee;static Se;static Te;static de=null;flush(){if(!this.ce){this.ce=!0;try{if(Fe(x,X.Ee),b){if(!Pr(b)){const r=b;if(Fe(Y,X.Ee),this.ae=null,this.fe=[],this.Z=[],this.q=new Set,nt(Re),nt(J),this.stashQueues(r._e),M++,Ye=x._>=x.C,an(r.fe),b=null,!r.re.length&&!r.oe.size&&r.Z.length){lt=new Set;for(let i=0;i<r.Z.length;i++){const o=r.Z[i];o.L||o.Oe&wt||(lt.add(o),Er(o))}}try{kt(null,!0)}finally{lt=null}return}this.fe!==b.fe&&this.fe.push(...b.fe),this.restoreQueues(b._e),je.delete(b);const n=b;b=null,an(this.fe),kt(n)}else $r(this)?(ht(),x._>=x.C&&(Fe(x,X.Ee),ht())):(je.size&&Fe(Y,X.Ee),kt());M++,Ye=x._>=x.C,ne.size&&nt(Re),this.run(Re),ne.size&&nt(J),this.run(J)}finally{this.ce=!1}}}notify(t,n,r,i){if(n&O){if(r&O){const o=i!==void 0?i:t.Re;if(b&&o){const s=o.source;let c=b.oe.get(s);c||b.oe.set(s,c=new Set);const l=c.size;c.add(t),c.size!==l&&ve()}}return!0}return!1}initTransition(t){if(t&&(t=In(t)),!(t&&t===b)&&!(!t&&b&&b.Ie===M)){if(!b)b=t??{Ie:M,fe:[],oe:new Map,Z:[],q:new Set,re:[],_e:{le:[[],[]],Y:[]},ie:!1,se:new Set};else if(t){const n=b;Cr(t,n),je.delete(n),b=t}if(je.add(b),b.Ie=M,this.ae!==null&&(this.ae.M=b,b.fe.push(this.ae),this.ae=null),this.fe!==b.fe){for(let n=0;n<this.fe.length;n++){const r=this.fe[n];r.M=b,b.fe.push(r)}this.fe=b.fe}if(this.Z!==b.Z){for(let n=0;n<this.Z.length;n++){const r=this.Z[n];r.M=b,b.Z.push(r)}this.Z=b.Z}for(const n of ne)n.M||(n.M=b);if(this.q!==b.q){for(const n of this.q)b.q.add(n);this.q=b.q}}}}function $t(e){if(b){E.fe.push(e);return}if(E.ae===null&&E.fe.length===0){E.ae=e;return}E.ae!==null&&(E.fe.push(E.ae),E.ae=null),E.fe.push(e)}function ke(e,t=!1){const n=e.G||G,r=e.pe!==void 0;for(let i=e.I;i!==null;i=i.p){if(r&&i.h.Oe&mr){i.h.O|=Jt;continue}t&&n?(i.h.O|=we,Zt(i.h,n)):t&&(i.h.O|=we,i.h.G=void 0);const o=i.h;if(o.J===_e){o.ee||(o.ee=!0,o.te.enqueue(J,o.ne));continue}const s=i.h.O&H?Y:x;s.C>i.h.o&&(s.C=i.h.o),Qe(i.h,s)}}function cn(e){const t=e;if(!t.L){e.B!==S&&(e.ue=e.B,e.B=S);return}e.B!==S&&(e.ue=e.B,e.B=S,e.J&&e.J!==_e&&(e.ee=!0)),t.O&=~He,t.he&O||(t.he&=~F),(t.Ne!==null||t.Ae!==null)&&X.Se(t,!1,!0)}function ht(){E.ae!==null&&(cn(E.ae),E.ae=null);const e=E.fe;for(let t=0;t<e.length;t++)cn(e[t]);e.length=0}function kt(e=null,t=!1){const n=!t;n&&ht(),!t&&E.Y.length&&Pn(E);const r=x._>=x.C;if(r&&Fe(x,X.Ee),n){if(r&&ht(),Or(e?e.Z:E.Z),e&&e.se.size){for(const i of e.se){if(i.O&he)continue;if(i.J===_e){i.ee||(i.ee=!0,i.te.enqueue(J,i.ne));continue}const o=i.O&H?Y:x;o.C>i.o&&(o.C=i.o),Qe(i,o)}e.se.clear()}e?e.q:E.q,_r(),Tr(e)}}function Pn(e){for(const t of e.Y)t.checkSources?.(),Pn(t)}function an(e){for(let t=0;t<e.length;t++)e[t].M=b}const E=new X;function xe(e){if(e){jt++;try{return e()}finally{xe(),jt--}}if(!E.ce)for(;Ye||b;)E.flush()}function gt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function Rr(e,t){if(e.O&(H|he))return!1;if(e.Ce===t||e.Pe?.has(t))return!0;for(let n=e.P;n;n=n.D){let r=n.m;for(;r;){if(r===t||r.V===t)return!0;r=r.U}}return!!(e.he&O&&e.Re instanceof U&&e.Re.source===t)}function Pr(e){if(e.ie)return!0;if(e.re.length)return!1;let t=!0;for(const[n,r]of e.oe){let i=!1;for(const o of r){if(Rr(o,n)){i=!0;break}r.delete(o)}if(!i)e.oe.delete(n);else if(n.he&O&&n.Re?.source===n){t=!1;break}}if(t)for(let n=0;n<e.Z.length;n++){const r=e.Z[n];if(vt(r)&&"he"in r&&r.he&O&&r.Re instanceof U&&r.Re.source!==r){t=!1;break}}return t&&(e.ie=!0),t}function In(e){for(;e.ie&&typeof e.ie=="object";)e=e.ie;return e}function Ir(e,t){const n=b;try{return b=In(e),t()}finally{b=n}}function kn(e){let t=e.ge;for(;t;)t.O|=H,t.O&ue&&(qe(t,x),Qe(t,Y)),kn(t),t=t.De}function Xe(e,t=!1,n){const r=e.O;if(r&he)return;t&&(e.O=r|he),t&&e.L&&(e.ve=null);let i=n?e.Ne:e.ge;for(;i;){const o=i.De;if(i.P){const s=i;qe(s,s.O&H?Y:x);let c=s.P;do c=en(c);while(c!==null);s.P=null,s.ye=null}Xe(i,!0),i=o}if(n?e.Ne=null:(e.ge=null,e.me=0),t&&!n&&!(r&H)&&e.i!==null&&!(e.i.O&he)){const o=e.we,s=e.De;o!==null?o.De=s:e.i.ge=s,s!==null&&(s.we=o),e.we=null}kr(e,n)}function kr(e,t){let n=t?e.Ae:e.be;if(n){if(Array.isArray(n))for(let r=0;r<n.length;r++){const i=n[r];i.call(i)}else n.call(n);t?e.Ae=null:e.be=null}}function xr(e,t){let n=e;for(;n.Oe&bt&&n.i;)n=n.i;if(n.id!=null)return Lr(n.id,n.me++);throw new Error("Cannot get child id from owner without an id")}function Qt(e){return xr(e)}function Lr(e,t){const n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):"")+n}function et(){return $}function _t(e){return $&&($.be?Array.isArray($.be)?$.be.push(e):$.be=[$.be,e]:$.be=e),e}function Nr(e=!0){Xe(this,e)}function ze(e){const t=$,n=e?.transparent??!1,r={id:e?.id??(n?t?.id:t?.id!=null?Qt(t):void 0),Oe:n?bt:0,t:!0,u:t?.t?t.u:t,ge:null,De:null,we:null,be:null,te:t?.te??E,Ve:t?.Ve||Yt,me:0,Ae:null,Ne:null,i:t,dispose:Nr};if(t){const i=t.ge;i===null||(r.De=i,i.we=r),t.ge=r}return r}function Xt(e,t){const n=ze(t);return le(n,()=>e(()=>n.dispose()))}function en(e){const t=e.m,n=e.D,r=e.p,i=e.Le;if(r!==null?r.Le=i:t.Ue=i,i!==null)i.p=r;else if(t.I=r,r===null){t.X?.();const o=t;o.L&&o.Oe&Ne&&!(o.O&H)&&Ln(o)}return n}function xn(e){const t=e.ye;let n=t!==null?t.D:e.P;if(n!==null){do n=en(n);while(n!==null);t!==null?t.D=null:e.P=null}}function Ln(e){qe(e,e.O&H?Y:x);let t=e.P;for(;t!==null;)t=en(t);e.P=null,e.ye=null,Xe(e,!0)}function De(e,t){const n=t.ye;if(n!==null&&n.m===e)return;let r=null;const i=t.O&pt;if(i&&(r=n!==null?n.D:t.P,r!==null&&r.m===e)){t.ye=r;return}const o=e.Ue;if(o!==null&&o.h===t&&(!i||qr(o,t)))return;const s=t.ye=e.Ue={m:e,h:t,D:r,Le:o,p:null};n!==null?n.D=s:t.P=s,o!==null?o.p=s:e.I=s}function qr(e,t){const n=t.ye;if(n!==null){let r=t.P;do{if(r===e)return!0;if(r===n)break;r=r.D}while(r!==null)}return!1}function Mr(e,t){return e.Ce===t||e.Pe?.has(t)?!1:e.Ce?(e.Pe?e.Pe.add(t):e.Pe=new Set([e.Ce,t]),e.Ce=void 0,!0):(e.Ce=t,!0)}function Dr(e,t){return e.Ce?e.Ce!==t?!1:(e.Ce=void 0,!0):e.Pe?.delete(t)?(e.Pe.size===1?(e.Ce=e.Pe.values().next().value,e.Pe=void 0):e.Pe.size===0&&(e.Pe=void 0),!0):!1}function Nn(e){e.Ce=void 0,e.Pe?.clear(),e.Pe=void 0}function mt(e,t,n){if(!t){e.Re=null;return}if(n instanceof U&&n.source===t){e.Re=n;return}const r=e.Re;(!(r instanceof U)||r.source!==t)&&(e.Re=new U(t))}function Kt(e,t){for(let n=e.I;n!==null;n=n.p)t(n.h);for(let n=e.N;n!==null;n=n.A)for(let r=n.I;r!==null;r=r.p)t(r.h)}function Fr(e){let t=!1;const n=new Set,r=i=>{if(n.has(i)||!Dr(i,e))return;n.add(i),i.Ie=M;const o=i.Ce??i.Pe?.values().next().value;if(o)mt(i,o),$e(i);else{if(i.he&=~O,mt(i),$e(i),i.Ge){if(i.J===_e){const s=i;s.ee||(s.ee=!0,s.te.enqueue(J,s.ne))}else{const s=i.O&H?Y:x;s.C>i.o&&(s.C=i.o),Qe(i,s)}t=!0}i.Ge=!1}Kt(i,r)};Kt(e,r),t&&ve()}function Br(e,t,n){let r=!1,i=!1;if(typeof t=="object"&&t!==null&&ee(()=>{r=t[Symbol.asyncIterator],i=!r&&typeof t.then=="function"}),!i&&!r)return e.ve=null,t;e.ve=t;let o;const s=l=>{e.ve===t&&(E.initTransition(Be(e)),tn(e,l instanceof U?O:W,l),e.Ie=M)},c=(l,d)=>{if(e.ve!==t||e.O&(Ie|we))return;E.initTransition(Be(e));const h=!!(e.he&F);xn(e),qn(e);const f=Pe(e);if(f&&f.F.delete(e),e.K!==void 0)e.K!==void 0&&e.K!==S?e.B=l:(e.ue=l,ke(e)),e.Ie=M;else if(f){const g=e.J,p=e.ue,y=e.ke;(!g&&h||!y||!y(l,p))&&(e.ue=l,e.Ie=M,e.Fe&&ae(e.Fe,l),ke(e,!0))}else ae(e,()=>l);Fr(e),ve(),xe(),d?.()};if(i){let l=!1,d=!0;if(t.then(h=>{d?(o=h,l=!0):c(h)},h=>{d||s(h)}),d=!1,!l)throw E.initTransition(Be(e)),new U($)}if(r){const l=t[Symbol.asyncIterator]();let d=!1,h=!1;_t(()=>{if(!h){h=!0;try{const p=l.return?.();p&&typeof p.then=="function"&&p.then(void 0,()=>{})}catch{}}});const f=()=>{let p,y=!1,u=!0;return l.next().then(a=>{if(u)p=a,y=!0,a.done&&(h=!0);else{if(e.ve!==t)return;a.done?(h=!0,ve(),xe()):c(a.value,f)}},a=>{!u&&e.ve===t&&(h=!0,s(a))}),u=!1,y&&!p.done?(o=p.value,d=!0,f()):y&&p.done},g=f();if(!d&&!g)throw E.initTransition(Be(e)),new U($)}return o}function qn(e,t=!1){(e.Ce||e.Pe)&&Nn(e),e.Ge&&(e.Ge=!1),e.he=t?0:e.he&F,e.Re&&mt(e),e.We&&$e(e),e.xe&&e.xe()}function tn(e,t,n,r,i){t===W&&!(n instanceof Bt)&&!(n instanceof U)&&(n=new Bt(e,n));const o=t===O&&n instanceof U?n.source:void 0,s=o===e,c=t===O&&e.K!==void 0&&!s,l=c&&vt(e);r||(t===O&&o?(Mr(e,o),e.he=O|e.he&F,mt(e,o,n)):(Nn(e),e.he=t|(t!==W?e.he&F:0),e.Re=n),$e(e)),i&&!r&&Zt(e,i);const d=r||l,h=r||c?void 0:i;if(e.xe){if(r&&t===O)return;d?e.xe(t,n):e.xe();return}Kt(e,f=>{f.Ie=M,(t===O&&o&&f.Ce!==o&&!f.Pe?.has(o)||t!==O&&(f.Re!==n||f.Ce||f.Pe))&&(!d&&!f.M&&$t(f),tn(f,t,n,d,h))})}let jr=null;X.Ee=ce;X.Se=Xe;let K=!1,re=!1,$=null,G=null;function ce(e,t=!1){const n=e.J;t||(e.M&&(!n||b)&&b!==e.M&&E.initTransition(e.M),qe(e,e.O&H?Y:x),e.ve=null,e.M||n===_e?Xe(e):(e.ge!==null||e.be!==null)&&(kn(e),e.Ae=e.be,e.Ne=e.ge,e.be=null,e.ge=null,e.me=0));let r=!!(e.O&we);const i=e.K!==void 0&&e.K!==S,o=!!(e.he&O),s=!!(e.he&F),c=$;$=e,e.ye=null,e.O=pt,e.Ie=M;let l=e.B===S?e.ue:e.B,d=e.o,h=K,f=G;if(K=!0,r){const u=Pe(e);u&&(G=u)}else if(b&&!t&&b.Z.length)for(let u=e.P;u;u=u.D){const a=u.m;if(a.O&we){const m=Pe(a);if(m){r=!0,G=m,e.O|=we,Zt(e,m);break}}}const g=n&&n!==J,p=re;g&&(re=!0);try{if(e.Oe&Ht)l=e.L(l),e.ve=null;else{const u=e.ve,a=e.L(l),m=typeof a=="object"&&a!==null,w=e.ve!==u;l=w||!m?a:Br(e,a),!w&&!m&&(e.ve=null)}if(qn(e,t),e.G){const u=Pe(e);u&&(u.F.delete(e),$e(u.k))}}catch(u){if(u instanceof U&&G){const a=V(G);a.k!==e&&(a.F.add(e),e.G=a,$e(a.k))}u instanceof U&&(e.Ge=!0),tn(e,u instanceof U?O:W,u,void 0,u instanceof U?e.G:void 0)}finally{K=h,g&&(re=p),e.O=Cn|(t?e.O&Jt:0),$=c}if(!e.Re){xn(e);const u=i?e.K:e.B===S?e.ue:e.B,a=!n&&s||!e.ke||!e.ke(u,l);if(n&&a&&(e.ee=!e.Re,t||e.te.enqueue(n,X.Te.bind(null,e))),a){const m=i?e.K:void 0;t||n&&b!==e.M||r?(e.ue=l,i&&r&&(e.K=l,e.B=l)):e.B=l,i&&!r&&o&&!e.$&&(e.K=l),(!i||r||e.K!==m)&&ke(e,r||i)}else if(i)e.B=l;else if(e.o!=d)for(let m=e.I;m!==null;m=m.p)An(m.h,m.h.O&H?Y:x)}G=f,(e.B!==S||e.Ne!==null||e.Ae!==null||!!(e.he&(O|F)))&&(!t||e.he&O)&&!e.M&&!(b&&i)&&$t(e),e.M&&n&&b!==e.M&&Ir(e.M,()=>ce(e))}function Mn(e){if(e.O&Ve)for(let t=e.P;t;t=t.D){const n=t.m,r=n.V||n;if(r.L&&Mn(r),e.O&Ie)break}(e.O&(Ie|we)||e.Re&&e.Ie<M&&!e.ve)&&ce(e),e.O=e.O&(Jt|ue|Je)}function St(e,t){const n=t?.transparent??!1,r={id:t?.id??(n?$?.id:$?.id!=null?Qt($):void 0),Oe:(n?bt:0)|(t?.ownedWrite?wt:0)|(!$||t?.lazy?Ne:0)|(t?.sync?Ht:0)|0,ke:t?.equals!=null?t.equals:Fn,X:t?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Yt,me:0,L:e,ue:void 0,o:0,N:null,T:void 0,S:null,P:null,ye:null,I:null,Ue:null,i:$,De:null,we:null,ge:null,O:t?.lazy?at:Cn,he:F,Ie:M,B:S,Ae:null,Ne:null,ve:null,M:null};return Dn(r,t),r}function Kr(e,t,n,r,i,o){const s=o?.transparent??!1,c={id:o?.id??(s?$?.id:$?.id!=null?Qt($):void 0),Oe:(s?bt:0)|(o?.ownedWrite?wt:0)|(o?.sync?Ht:0)|0,ke:!1,X:o?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Yt,me:0,L:e,ue:void 0,o:0,N:null,T:void 0,S:null,P:null,ye:null,I:null,Ue:null,i:$,De:null,we:null,ge:null,O:at,he:F,Ie:M,B:S,Ae:null,Ne:null,ve:null,M:null,ee:!1,Me:void 0,Qe:t,je:n,$e:void 0,Ke:!1,J:r,xe:i};return Dn(c,Ur),c}const Ur={lazy:!0};function Dn(e,t){e.S=e;const n=$?.t?$.u:$;if($){const r=$.ge;r===null||(e.De=r,r.we=e),$.ge=e}n&&(e.o=n.o+1),!t?.lazy&&ce(e,!0)}function Ue(e,t,n=null){const r={ke:t?.equals!=null?t.equals:Fn,Oe:(t?.ownedWrite?wt:0)|(t?.Ye?gr:0),X:t?.unobserved,ue:e,I:null,Ue:null,Ie:M,V:n,A:n?.N||null,B:S};return n&&(n.N=r),r}function Fn(e,t){return e===t}function ee(e,t){if(!K)return e();const n=K;K=!1;try{return e()}finally{K=n}}function Bn(e){let t=$;t?.t&&(t=t.u);const n=e;if(typeof n.L=="function"){const o=e;o.O&at?(o.O&=~at,ce(o,!0)):o.O&he&&ce(o,!0)}const r=e.V||e;if(!n.L&&r===e&&e.K===void 0&&e.pe===void 0&&b===null&&G===null)return t&&K&&De(e,t),!t||e.B===S?e.ue:e.B;if(t&&K&&(De(e,t),r.L)){const o=e.O&H;r.o>=(o?Y.C:x.C)&&(ft(t),wr(o?Y:x),Mn(r));const s=r.o;s>=t.o&&e.i!==t&&(t.o=s+1)}if(r.he&O)if(t&&!(re&&r.M&&b!==r.M))if(G){const o=r.G,s=V(G);if(o&&V(o)===s&&!vt(r))throw!K&&e!==t&&De(e,t),r.Re}else throw!K&&e!==t&&De(e,t),r.Re;else{if(t&&r!==e&&r.he&F)throw!K&&e!==t&&De(e,t),r.Re;if(!t&&r.he&F)throw r.Re}if(e.L&&e.he&W){if(e.Ie<M)return ce(e),Bn(e);throw e.Re}if(e.K!==void 0&&e.K!==S)return t&&re&&Sr(e)?e.ue:e.K;if(b!==null&&G!==null&&e.B!==S&&r===e&&!e.L&&t)return b.se.add(t),e.ue;const i=!t||G!==null&&(e.K!==void 0||e.G||r===e&&re||r.he&O)||e.B===S||re&&e.M&&b!==e.M?e.ue:e.B;return!t&&r===e&&typeof n.L=="function"&&e.Oe&Ne&&!(r.he&O)&&!e.I&&Ln(e),i}function ae(e,t){e.M&&b!==e.M&&E.initTransition(e.M);const n=e.K!==void 0&&!0,r=e.K!==void 0&&e.K!==S,i=n?r?e.K:e.ue:e.B===S?e.ue:e.B;if(typeof t=="function"&&(t=t(i)),!(!e.ke||!e.ke(i,t)||!!(e.he&F)))return n&&r&&e.L&&(ke(e,!0),ve()),t;if(n){const s=e.K===S;s||E.initTransition(Be(e)),s&&(e.B=e.ue,E.Z.push(e)),e.$=!0;const c=vr(e);e.G=c,e.K=t}else e.B===S&&$t(e),e.B=t;return e.We&&$e(e),e.Fe&&ae(e.Fe,t),e.Ie=M,ke(e,n),ve(),t}function Wr(e){qe(e,e.O&H?Y:x),!(e.O&He)&&e.B===S&&$t(e),e.O=e.O&-4|He}function Vr(e,t){const n=ae(e,t);return Wr(e),n}function le(e,t){const n=$,r=K;$=e,K=!1;try{return t()}finally{$=n,K=r}}function zr(e){const t=e,n=e.V;if(e.U){const r=e.U;return r.he&O&&!(r.he&F)?!0:e.B!==S&&!(t.he&F)}if(n&&e.B!==S)return!n.ve&&!(n.he&O);if(e.K!==void 0&&e.K!==S){if(t.he&O&&!(t.he&F))return!0;if(e.U){const r=e.G?V(e.G):null;return!!(r&&r.F.size>0)}return!0}return e.K!==void 0&&e.K===S&&!e.U?!1:e.B!==S&&!(t.he&F)?!0:!!(t.he&O&&!(t.he&F))}function $e(e){if(e.We){const t=zr(e),n=e.We;if(ae(n,t),!t&&n.G){const r=Pe(e);if(r&&r.F.size>0){const i=V(n.G);i!==r&&Rn(r,i)}dt.delete(n),n.G=void 0}}}function Gr(e,t=!0){const n=re;re=t;try{return e()}finally{re=n}}function Jr(e,t=et()){if(!t)throw new En;const n=Yr(e,t)?t.Ve[e.id]:e.defaultValue;if(nn(n))throw new hr;return n}function Hr(e,t,n=et()){if(!n)throw new En;n.Ve={...n.Ve,[e.id]:nn(t)?e.defaultValue:t}}function Yr(e,t){return!nn(t?.Ve[e.id])}function nn(e){return typeof e>"u"}function jn(e,t,n,r){const i=!!r?.user,o=Kr(e,t,n,i?J:Re,Zr,r);ce(o,!0),!r?.defer&&(o.J===J||r?.schedule?o.te.enqueue(o.J,Ut.bind(null,o)):Ut(o))}function Zr(e,t){const n=e!==void 0?e:this.he,r=t!==void 0?t:this.Re;if(n&W){let i=r;if(this.te.notify(this,O,0),this.J===J)try{return this.je?this.je(i,()=>{this.$e?.(),this.$e=void 0}):console.error(i)}catch(o){i=o}if(!this.te.notify(this,W,W))throw i}else this.J===Re&&this.te.notify(this,O|W,n,r)}function Ut(e){if(!(!e.ee||e.O&he)){e.$e?.(),e.$e=void 0;try{const t=e.Qe(e.ue,e.Me);e.$e=t,e.$e&&!e.Ke&&(e.Ke=!0,le(e.i,()=>_t(()=>e.$e?.())))}catch(t){if(e.Re=new Bt(e,t),e.he|=W,!e.te.notify(e,W,W))throw t}finally{e.Me=e.ue,e.ee=!1}}}X.Te=Ut;function Qr(e,t){const n=()=>{if(!(!r.ee||r.O&he))try{r.ee=!1,ce(r)}finally{}},r=St(()=>{r.$e?.(),r.$e=void 0;const i=Gr(e);r.$e=i},{...t,lazy:!0});r.$e=void 0,r.Oe=r.Oe&~Ne|On,r.ee=!0,r.J=_e,r.xe=(i,o)=>{if((i!==void 0?i:r.he)&W){r.te.notify(r,O,0);const c=o!==void 0?o:r.Re;if(!r.te.notify(r,W,W))throw c}},r.ne=n,r.te.enqueue(J,n),_t(()=>r.$e?.())}function Kn(e){return _t(e)}function de(e){const t=Bn.bind(null,e);return t[pr]=e,t}function Xr(e,t){if(typeof e=="function"){const r=St(e,t);return r.Oe&=~Ne,[de(r),Vr.bind(null,r)]}const n=Ue(e,t);return[de(n),ae.bind(null,n)]}function be(e,t){return de(St(e,t))}function ei(e,t,n){jn(e,t.effect||t,t.error,{user:!0,...n})}function ti(e,t,n){jn(e,t,void 0,n)}function ni(e,t){Qr(e,t)}function ri(e){const t=et();t&&!(t.Oe&On)?ni(()=>ee(e),void 0):E.enqueue(J,()=>{e()?.()})}const ii=Symbol(0),Wt=Symbol(0);function fn(e){return e==null||typeof e!="object"||Object.isFrozen(e)?!1:typeof Node>"u"||!(e instanceof Node)}const Un=Symbol(0);function dn(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function We(e,t,n=0){let r,i=e;if(n<t.length-1){r=t[n];const s=typeof r,c=Array.isArray(e);if(s==="string"&&dn(r))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)t[n]=r[l],We(e,t,n);t[n]=r;return}else if(c&&s==="function"){for(let l=0;l<e.length;l++)r(e[l],l)&&(t[n]=l,We(e,t,n));t[n]=r;return}else if(c&&s==="object"){const{from:l=0,to:d=e.length-1,by:h=1}=r;for(let f=l;f<=d;f+=h)t[n]=f,We(e,t,n);t[n]=r;return}else if(n<t.length-2){We(e[r],t,n+1);return}i=e[r]}let o=t[t.length-1];if(!(typeof o=="function"&&(o=o(i),o===i))&&!(r===void 0&&o==null))if(o===Un)delete e[r];else if(r===void 0||fn(i)&&fn(o)&&!Array.isArray(o)){const s=r!==void 0?e[r]:e,c=Object.keys(o);for(let l=0;l<c.length;l++){const d=c[l];if(dn(d))continue;const h=Object.getOwnPropertyDescriptor(o,d);h.get||h.set?Object.defineProperty(s,d,h):s[d]=h.value}}else e[r]=o}Object.assign(function(...t){return n=>{We(n,t)}},{DELETE:Un});function rt(){return!0}const oi={get(e,t,n){return t===Wt?n:e.get(t)},has(e,t){return t===Wt?!0:e.has(t)},set:rt,deleteProperty:rt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:rt,deleteProperty:rt}},ownKeys(e){return e.keys()}};function xt(e){return(e=typeof e=="function"?e():e)?e:{}}const Lt=Symbol(0);function si(...e){if(e.length===1&&typeof e[0]!="function")return e[0];let t=!1;const n=[];for(let l=0;l<e.length;l++){const d=e[l];t=t||!!d&&Wt in d;const h=!!d&&d[Lt];if(h)for(let f=0;f<h.length;f++)n.push(h[f]);else n.push(typeof d=="function"?(t=!0,be(d)):d)}if(yr&&t)return new Proxy({get(l){if(l===Lt)return n;for(let d=n.length-1;d>=0;d--){const h=xt(n[d]);if(l in h)return h[l]}},has(l){for(let d=n.length-1;d>=0;d--)if(l in xt(n[d]))return!0;return!1},keys(){const l=new Set;for(let d=0;d<n.length;d++){const h=Object.keys(xt(n[d]));for(let f=0;f<h.length;f++)l.add(h[f])}return[...l]}},oi);const r=Object.create(null);let i=!1,o=n.length-1;for(let l=o;l>=0;l--){const d=n[l];if(!d){l===o&&o--;continue}const h=Object.getOwnPropertyNames(d);for(let f=h.length-1;f>=0;f--){const g=h[f];if(!(g==="__proto__"||g==="constructor")&&!r[g]){i=i||l!==o;const p=Object.getOwnPropertyDescriptor(d,g);r[g]=p.get?{enumerable:!0,configurable:!0,get:p.get.bind(d)}:p}}}if(!i)return n[o];const s={},c=Object.keys(r);for(let l=c.length-1;l>=0;l--){const d=c[l],h=r[d];h.get?Object.defineProperty(s,d,h):s[d]=h.value}return s[Lt]=n,s}function li(e,t,n){const r=typeof n?.keyed=="function"?n.keyed:void 0,i=t.length>1,o=t,s={Ze:ze(),qe:0,Be:e,ze:[],Xe:o,Je:[],et:[],tt:r,nt:r||n?.keyed===!1?[]:void 0,it:i&&n?.keyed!==!1?[]:void 0,rt:n?.keyed===!1,ot:n?.fallback},c=St(ui.bind(s));return s.Ze.u=c,c.Oe&=~Ne,de(c)}const it={ownedWrite:!0};function ui(){const e=this.Be()||[],t=e.length;return e[ii],le(this.Ze,()=>{let n,r,i=this.nt?this.rt?()=>(this.nt[r]=Ue(e[r],it),this.Xe(de(this.nt[r]),r)):()=>(this.nt[r]=Ue(e[r],it),this.it&&(this.it[r]=Ue(r,it)),this.Xe(de(this.nt[r]),this.it?de(this.it[r]):void 0)):this.it?()=>{const o=e[r];return this.it[r]=Ue(r,it),this.Xe(o,de(this.it[r]))}:()=>{const o=e[r];return this.Xe(o)};if(t===0)this.qe!==0&&(this.Ze.dispose(!1),this.et=[],this.ze=[],this.Je=[],this.qe=0,this.nt&&(this.nt=[]),this.it&&(this.it=[])),this.ot&&!this.Je[0]&&(this.Je[0]=le(this.et[0]=ze(),this.ot));else if(this.qe===0){for(this.et[0]&&this.et[0].dispose(),this.Je=new Array(t),r=0;r<t;r++)this.ze[r]=e[r],this.Je[r]=le(this.et[r]=ze(),i);this.qe=t}else{let o,s,c,l,d,h,f,g=new Array(t),p=new Array(t),y=this.nt?new Array(t):void 0,u=this.it?new Array(t):void 0;for(o=0,s=Math.min(this.qe,t);o<s&&(this.ze[o]===e[o]||this.nt&&hn(this.tt,this.ze[o],e[o]));o++)this.nt&&ae(this.nt[o],e[o]);for(s=this.qe-1,c=t-1;s>=o&&c>=o&&(this.ze[s]===e[c]||this.nt&&hn(this.tt,this.ze[s],e[c]));s--,c--)g[c]=this.Je[s],p[c]=this.et[s],y&&(y[c]=this.nt[s]),u&&(u[c]=this.it[s]);for(h=new Map,f=new Array(c+1),r=c;r>=o;r--)l=e[r],d=this.tt?this.tt(l):l,n=h.get(d),f[r]=n===void 0?-1:n,h.set(d,r);for(n=o;n<=s;n++)l=this.ze[n],d=this.tt?this.tt(l):l,r=h.get(d),r!==void 0&&r!==-1?(g[r]=this.Je[n],p[r]=this.et[n],y&&(y[r]=this.nt[n]),u&&(u[r]=this.it[n]),r=f[r],h.set(d,r)):this.et[n].dispose();for(r=o;r<t;r++)r in g?(this.Je[r]=g[r],this.et[r]=p[r],y&&(this.nt[r]=y[r],ae(this.nt[r],e[r])),u&&(this.it[r]=u[r],ae(this.it[r],r))):this.Je[r]=le(this.et[r]=ze(),i);this.Je=this.Je.slice(0,this.qe=t),this.ze=e.slice(0)}}),this.Je}function hn(e,t,n){return e?e(t)===e(n):!0}function rn(e,t){if(typeof e=="function"&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e=="function"&&!e.length)}if(!(t?.skipNonRendered&&(e==null||e===!0||e===!1||e===""))){if(Array.isArray(e)){let n=[];return Vt(e,n,t)?()=>{let r=[];return Vt(n,r,{...t,doNotUnwrap:!1}),r}:n}return e}}function Vt(e,t=[],n){let r=null,i=!1;for(let o=0;o<e.length;o++)try{let s=e[o];if(typeof s=="function"&&!s.length){if(n?.doNotUnwrap){t.push(s),i=!0;continue}do s=s();while(typeof s=="function"&&!s.length)}Array.isArray(s)?i=Vt(s,t,n):n?.skipNonRendered&&(s==null||s===!0||s===!1||s==="")||t.push(s)}catch(s){if(!(s instanceof U))throw s;r=s}if(r)throw r;return i}function Wn(e,t){const n=Symbol("");function r(i){return Xt(()=>(Hr(r,i.value),on(()=>i.children)))}return r.id=n,r.defaultValue=e,r}function Vn(e){return Jr(e)}function on(e){const t=be(e,{lazy:!0}),n=be(()=>rn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}class Ae{static{for(const t of["all","allSettled","any","race","reject","resolve"])Ae[t]=()=>new Ae}catch(){return new Ae}then(){return new Ae}finally(){return new Ae}}const Q=(...e)=>be(...e),q=(...e)=>Xr(...e),ci=(...e)=>ti(...e),Et=(...e)=>ei(...e);function L(e,t){return ee(()=>e(t||{}))}const ai=e=>`Stale read from <${e}>.`;function ut(e){const t="fallback"in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed};return li(()=>e.each,e.children,t)}function zn(e){const t=e.keyed,n=be(()=>e.when,void 0),r=t?n:be(n,{equals:(i,o)=>!i==!o,sync:!0});return be(()=>{const i=r();if(i){const o=e.children;return typeof o=="function"&&o.length>0?ee(t?()=>o(i):()=>o(()=>{if(!ee(r))throw ai("Show");return n()})):o}return e.fallback},{sync:!0})}const j=Symbol("slot"),fi={transparent:!0,sync:!0},di={sync:!0},Z=(e,t,n)=>ci(e,t,n?{transparent:!0,sync:!0,...n}:fi),D=e=>Q(()=>e(),di);function hi(e,t,n,r){let i=n.length,o=t.length,s=i,c=0,l=0,d=t[o-1],h=d[j],f=d.parentNode===e&&(!h||h===r)?d.nextSibling:r||null,g=null,p,y;for(;c<o||l<s;){if(t[c]===n[l]){c++,l++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===c){let u;if(s<i)if(l){const a=n[l-1],m=a[j];u=a.parentNode===e&&(!m||m===r)?a.nextSibling:f}else u=n[s-l];else u=f;for(;l<s;){const a=n[l++];e.insertBefore(a,u),r&&(a[j]=r)}}else if(s===l)for(;c<o;){const u=t[c++];if(!g||!g.has(u)){const a=u[j];u.parentNode===e&&(!a||a===r)&&u.remove()}}else if((p=t[c])===n[s-1]&&n[l]===t[o-1]&&p.parentNode===e&&(!(y=p[j])||y===r))if(r)do{const u=t[--o];if(e.insertBefore(u,p),u[j]=r,l++,c>=o-1||l>=s)break}while(t[c]===n[s-1]&&n[l]===t[o-1]);else do if(e.insertBefore(t[--o],p),l++,c>=o-1||l>=s)break;while(t[c]===n[s-1]&&n[l]===t[o-1]);else{if(!g){g=new Map;let a=l;for(;a<s;)g.set(n[a],a++)}const u=g.get(t[c]);if(u!=null)if(l<u&&u<s){let a=c,m=1,w;for(;++a<o&&a<s&&!((w=g.get(t[a]))==null||w!==u+m);)m++;if(m>u-l){const C=t[c],A=C[j],P=C.parentNode===e&&(!A||A===r)?C:f;for(;l<u;){const B=n[l++];e.insertBefore(B,P),r&&(B[j]=r)}}else{const C=t[c++],A=n[l++],P=C[j];C.parentNode===e&&(!P||P===r)?e.replaceChild(A,C):e.insertBefore(A,f),r&&(A[j]=r)}}else c++;else{const a=t[c++],m=a[j];a.parentNode===e&&(!m||m===r)&&a.remove()}}}}const gn="_$DX_EVENT_OWNER",mn={},zt=new Set,Le=new Map;function gi(e,t,n,r={}){let i;yi(t);try{Xt(o=>{if(i=o,t===document){const s=e();Z(()=>rn(s),()=>{})}else{const s=e();v(t,()=>s,t.firstChild?null:void 0,n,r.insertOptions)}},{id:r.renderId})}catch(o){throw i&&i(),yn(t),o}return()=>{i(),yn(t),t.textContent=""}}function mi(e,t,n){const r=document.createElement("template");return r.innerHTML=e,n===2?r.content.firstChild.firstChild:r.content.firstChild}function T(e,t){let n;return i=>(n||(n=mi(e,i,t))).cloneNode(!0)}function tt(e){for(let t=0,n=e.length;t<n;t++){const r=e[t];zt.has(r)||(zt.add(r),Le.forEach((i,o)=>Gn(r,o,i)))}}function yi(e){const t=pi(e,e);t&&(t.roots=(t.roots||0)+1)}function yn(e){const t=Le.get(e);t&&(t.roots>1?t.roots--:delete t.roots),wi(e,e)}function pi(e,t=e){if(!e||!t)return;let n=Le.get(e);return n||Le.set(e,n={owners:new Map,handlers:new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),zt.forEach(r=>Gn(r,e,n)),n}function wi(e,t=e){const n=Le.get(e);if(!n)return;const r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),!n.owners.size&&(n.handlers.forEach((i,o)=>e.removeEventListener(o,i)),Le.delete(e))}function Gn(e,t,n){if(n.handlers.has(e))return;const r=i=>$i(i,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}function bi(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=n._$host||n.parentNode||n.host}}function ie(e,t,n){n==null||n===!1?e.removeAttribute(t):e.setAttribute(t,n===!0?"":n)}function Ze(e,t,n){if(t==null||t===!1){n&&e.removeAttribute("class");return}if(typeof t=="string"){t!==n&&e.setAttribute("class",t);return}typeof n=="string"?(n={},e.removeAttribute("class")):n=wn(n||{}),t=wn(t);const r=Object.keys(t||{}),i=Object.keys(n);let o,s;for(o=0,s=i.length;o<s;o++){const c=i[o];!c||c==="undefined"||t[c]||e.classList.remove(c)}for(o=0,s=r.length;o<s;o++){const c=r[o],l=!!t[c];!c||c==="undefined"||n[c]===l||!l||e.classList.add(c)}}function pn(e,t,n,r){if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=o=>i.call(e,n[1],o))}else e.addEventListener(t,n,typeof n!="function"&&n)}function vi(e,t){Array.isArray(e)?e.flat(1/0).forEach(n=>n&&n(t)):e(t)}function yt(e,t){const n=ee(e);le(null,()=>vi(n,t))}function v(e,t,n,r,i){const o=n!==void 0;if(o&&!r&&(r=[]),typeof t!="function"&&(t=qt(t,r,o,!0),typeof t!="function"))return Nt(e,t,r,n);if(o&&r.length===0){const c=document.createTextNode("");e.insertBefore(c,n),r=[c]}let s=r;Z(c=>{const l=qt(t(),s,o,!0);return typeof l!="function"?l:(Z(()=>qt(l,s,o),d=>{Nt(e,d,s,n),s=d},c!==void 0&&!(i&&i.schedule)?{...i,schedule:!0}:i),mn)},c=>{c!==mn&&(Nt(e,c,s,n),s=c)},i)}function wn(e){if(Array.isArray(e)){const t={};Jn(e,t),e=t}if(e&&typeof e=="object"){const t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r];if(!e[o])continue;const s=o.trim().split(/\s+/);for(let c=0,l=s.length;c<l;c++)s[c]&&(t[s[c]]=!0)}return t}return e}function Jn(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n];Array.isArray(i)?Jn(i,t):typeof i=="object"&&i!=null?Object.assign(t,i):(i||i===0)&&(t[i]=!0)}}function $i(e,t,n){if(e[gn])return;const r=n&&(n.owners.size===1&&n.owners.has(t)?t:bi(e.target,n)?.owner);if(n&&!r)return;e[gn]=r||!0;let i=e.target;const o=`$$${e.type}`,s=e.target,c=r||t||e.currentTarget,l=f=>Object.defineProperty(e,"target",{configurable:!0,value:f}),d=()=>{const f=i[o];if(f&&!i.disabled){const g=i[`${o}Data`];if(g!==void 0?f.call(i,g,e):f.call(i,e),e.cancelBubble)return}return i.host&&typeof i.host!="string"&&!i.host._$host&&i.contains(e.target)&&l(i.host),!0},h=()=>{for(;d()&&!(i===c||i.parentNode===c);)i=i._$host||i.parentNode||i.host};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return i||c||document}}),e.composedPath){const f=e.composedPath();if(f.length){l(f[0]);for(let g=0;g<f.length&&(i=f[g],!!d());g++){if(i._$host){i=i._$host,h();break}if(i===c||i.parentNode===c)break}}else h()}else h();l(s)}function Nt(e,t,n,r){if(t===n)return;const i=typeof t,o=r!==void 0;if(i==="string"||i==="number"){const s=typeof n;s==="string"||s==="number"?e.firstChild.data=t:e.textContent=t}else if(t===void 0)ot(e,n,r);else if(t.nodeType)Array.isArray(n)?ot(e,n,o?r:null,t):n&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),r&&(t[j]=r);else if(Array.isArray(t)){const s=n&&Array.isArray(n);t.length===0?ot(e,n,r):s?n.length===0?bn(e,t,r):hi(e,n,t,r):(n&&ot(e),bn(e,t))}}function qt(e,t,n,r){if(e=rn(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e=="function")return e;if(n&&!Array.isArray(e)&&(e=[e??""]),Array.isArray(e))for(let i=0,o=e.length;i<o;i++){const s=e[i],c=t&&t[i],l=typeof s;(l==="string"||l==="number")&&(e[i]=c&&c.nodeType===3&&c.data===""+s?c:document.createTextNode(s))}return e}function bn(e,t,n=null){for(let r=0,i=t.length;r<i;r++){const o=t[r];e.insertBefore(o,n),n&&(o[j]=n)}}function ot(e,t,n,r){if(n===void 0)return e.textContent="";if(t.length){let i=!1;for(let o=t.length-1;o>=0;o--){const s=t[o];if(r!==s){const c=s[j],l=s.parentNode===e&&(!c||c===n);r&&!i&&!o?l?e.replaceChild(r,s):e.insertBefore(r,n):l&&s.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&n&&(r[j]=n)}const _i=!1;function Si(e,t,n,r={}){try{const i=gi(e,t,n,{...r,insertOptions:{schedule:!0}});return xe(),i}finally{}}function Hn(){let e=new Set;function t(i){return e.add(i),()=>e.delete(i)}let n=!1;function r(i,o){if(n)return!(n=!1);const s={to:i,options:o,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const c of e)c.listener({...s,from:c.location,retry:l=>{l&&(n=!0),c.navigate(i,{...o,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:r}}let Gt;function sn(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),Gt=window.history.state._depth}sn();function Ei(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function Ci(e,t){let n=!1;return()=>{const r=Gt;sn();const i=r==null?null:Gt-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}const Oi=/^(?:[a-z0-9]+:)?\/\//i,Ti=/^\/+|(\/)\/+$/g,Yn="http://sr";function Ge(e,t=!1){const n=e.replace(Ti,"$1");return n?t||/^[?#]/.test(n)?n:"/"+n:""}function ct(e,t,n){if(Oi.test(t))return;const r=Ge(e),i=n&&Ge(n);let o="";return!i||t.startsWith("/")?o=r:i.toLowerCase().indexOf(r.toLowerCase())!==0?o=r+i:o=i,(o||"/")+Ge(t,!o)}function Ai(e,t){if(e==null)throw new Error(t);return e}function Ri(e,t){return Ge(e).replace(/\/*(\*.*)?$/g,"")+Ge(t)}function Zn(e){const t={};return e.searchParams.forEach((n,r)=>{r in t?Array.isArray(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n}),t}function Pi(e,t,n){const[r,i]=e.split("/*",2),o=r.split("/").filter(Boolean),s=o.length;return c=>{const l=c.split("/").filter(Boolean),d=l.length-s;if(d<0||d>0&&i===void 0&&!t)return null;const h={path:s?"":"/",params:{}},f=g=>n===void 0?void 0:n[g];for(let g=0;g<s;g++){const p=o[g],y=p[0]===":",u=y?l[g]:l[g].toLowerCase(),a=y?p.slice(1):p.toLowerCase();if(y&&Mt(u,f(a)))h.params[a]=u;else if(y||!Mt(u,a))return null;h.path+=`/${u}`}if(i){const g=d?l.slice(-d).join("/"):"";if(Mt(g,f(i)))h.params[i]=g;else return null}return h}}function Mt(e,t){const n=r=>r===e;return t===void 0?!0:typeof t=="string"?n(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(n):t instanceof RegExp?t.test(e):!1}function Ii(e){const[t,n]=e.pattern.split("/*",2),r=t.split("/").filter(Boolean);return r.reduce((i,o)=>i+(o.startsWith(":")?2:3),r.length-(n===void 0?0:1))}function Qn(e){const t=new Map,n=et();return new Proxy({},{get(r,i){return t.has(i)||le(n,()=>t.set(i,Q(()=>e()[i]))),t.get(i)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(r,i){return i in e()}})}function Xn(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let n=e.slice(0,t.index),r=e.slice(t.index+t[0].length);const i=[n,n+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(r);)i.push(n+=t[1]),r=r.slice(t[0].length);return Xn(r).reduce((o,s)=>[...o,...i.map(c=>c+s)],[])}const ki=100,er=Wn(),tr=Wn();function xi(e){try{return Vn(e)}catch{return}}const nr=()=>Ai(Vn(er),"<A> and 'use' router primitives can be only used inside a Route."),rr=()=>nr().navigatorFactory(),Li=()=>nr().params;function Ni(e,t=""){const{component:n,preload:r,children:i,info:o}=e,s=!i||Array.isArray(i)&&!i.length,c={key:e,component:n,preload:r,info:o};return ir(e.path).reduce((l,d)=>{for(const h of Xn(d)){const f=Ri(t,h);let g=s?f:f.split("/*",1)[0];g=g.split("/").map(p=>p.startsWith(":")||p.startsWith("*")?p:encodeURIComponent(p)).join("/"),l.push({...c,originalPath:d,pattern:g,matcher:Pi(g,!s,e.matchFilters)})}return l},[])}function qi(e,t=0){return{routes:e,score:Ii(e[e.length-1])*1e4-t,matcher(n){const r=[];for(let i=e.length-1;i>=0;i--){const o=e[i],s=o.matcher(n);if(!s)return null;r.unshift({...s,route:o})}return r}}}function ir(e){return Array.isArray(e)?e:[e]}function or(e,t="",n=[],r=[]){const i=ir(e);for(let o=0,s=i.length;o<s;o++){const c=i[o];if(c&&typeof c=="object"){c.hasOwnProperty("path")||(c.path="");const l=Ni(c,t);for(const d of l){n.push(d);const h=Array.isArray(c.children)&&c.children.length===0;if(c.children&&!h)or(c.children,d.pattern,n,r);else{const f=qi([...n],r.length);r.push(f)}n.pop()}}}return n.length?r:r.sort((o,s)=>s.score-o.score)}function Dt(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n].matcher(t);if(i)return i}return[]}function Mi(e,t,n){const r=new URL(Yn),i=Q((h=r)=>{const f=e();try{return new URL(f,r)}catch{return console.error(`Invalid path ${f}`),h}},{equals:(h,f)=>h.href===f.href}),o=Q(()=>i().pathname),s=Q(()=>i().search),c=Q(()=>i().hash),l=()=>"",d=Q(()=>Zn(i()));return{get pathname(){return o()},get search(){return s()},get hash(){return c()},get state(){return t()},get key(){return l()},query:n?n(d):Qn(d)}}let pe;function Di(){return pe}function Fi(e,t,n,r={}){const{signal:[i,o],utils:s={}}=e,c=s.parsePath||(I=>I),l=s.renderPath||(I=>I),d=s.beforeLeave||Hn(),h=ct("",r.base||""),f=ee(i);if(h===void 0)throw new Error(`${h} is not a valid base path`);h&&!f.value&&o({value:h,replace:!0,scroll:!1});const[g,p]=q(!1,{ownedWrite:!0}),[y,u]=q(void 0,{ownedWrite:!0});let a;const m=Q(()=>y()??i()),w=Mi(()=>m().value,()=>m().state,s.queryWrapper),C=[],A=q([],{ownedWrite:!0}),P=Q(()=>typeof r.transformUrl=="function"?Dt(t(),r.transformUrl(w.pathname)):Dt(t(),w.pathname)),B=()=>{const I=P(),k={};for(let z=0;z<I.length;z++)Object.assign(k,I[z].params);return k},Se=s.paramsWrapper?s.paramsWrapper(B,t):Qn(B),ge={pattern:h,path:()=>h,outlet:()=>null,resolvePath(I){return ct(h,I)}};return{base:ge,location:w,params:Se,isRouting:g,renderPath:l,parsePath:c,navigatorFactory:Ct,matches:P,beforeLeave:d,preloadRoute:Tt,singleFlight:r.singleFlight===void 0?!0:r.singleFlight,submissions:A};function Ee(I,k,z){ee(()=>{if(typeof k=="number"){k&&(s.go?s.go(k):console.warn("Router integration does not support relative routing"));return}const Ce=!k||k[0]==="?",{replace:Oe,resolve:te,scroll:Te,state:oe}={replace:!1,resolve:!Ce,scroll:!0,...z},me=te?I.resolvePath(k):ct(Ce&&w.pathname||"",k);if(me===void 0)throw new Error(`Path '${k}' is not a routable path`);if(C.length>=ki)throw new Error("Too many redirects");const fe=m();if((me!==fe.value||oe!==fe.state)&&!_i){if(d.confirm(me,z)){C.push({value:fe.value,replace:Oe,scroll:Te,state:fe.state});const ye={value:me,state:oe};a===void 0&&(p(!0),xe()),pe="navigate",a=ye,a===ye&&(u({...a}),queueMicrotask(()=>{a===ye&&(pe=void 0,Ot(a),u(void 0),p(!1),a=void 0)}))}}})}function Ct(I){return I=I||xi(tr)||ge,(k,z)=>Ee(I,k,z)}function Ot(I){const k=C[0];k&&(o({...I,replace:k.replace,scroll:k.scroll}),C.length=0)}function Tt(I,k){const z=Dt(t(),I.pathname),Ce=pe;pe="preload";for(let Oe in z){const{route:te,params:Te}=z[Oe];te.component&&te.component.preload&&te.component.preload();const{preload:oe}=te;k&&oe&&le(n(),()=>oe({params:Te,location:{pathname:I.pathname,search:I.search,hash:I.hash,query:Zn(I),state:null,key:""},intent:"preload"}))}pe=Ce}}function Bi(e,t,n,r){const{base:i,location:o,params:s}=e,{pattern:c,component:l,preload:d}=r().route,h=Q(()=>r().path);l&&l.preload&&l.preload();const f=d?d({params:s,location:o,intent:pe||"initial"}):void 0;return{parent:t,pattern:c,path:h,outlet:()=>l?L(l,{params:s,location:o,data:f,get children(){return n()}}):n(),resolvePath(p){return ct(i.path(),p,h())}}}const ji=e=>function(n){const{base:r,singleFlight:i,transformUrl:o,root:s,rootPreload:c,routeChildren:l}=ee(()=>({base:n.base,singleFlight:n.singleFlight,transformUrl:n.transformUrl,root:n.root,rootPreload:n.rootPreload,routeChildren:n.children})),d=on(()=>l),h=Q(()=>or(d(),r||""));let f;const g=Fi(e,h,()=>f,{base:r,singleFlight:i,transformUrl:o});return e.create&&e.create(g),L(er,{value:g,get children(){return L(Ki,{routerState:g,root:s,preload:c,get children(){return[D(()=>(f=et())&&null),L(Ui,{routerState:g,get branches(){return h()}})]}})}})};function Ki(e){const t=e.routerState.location,n=e.routerState.params,r=Q(()=>e.preload&&ee(()=>{e.preload({params:n,location:t,intent:Di()||"initial"})})),i=e.root;return i?L(i,{params:n,location:t,get data(){return r()},get children(){return e.children}}):e.children}function Ui(e){const t=[];let n,r;const i=Q(s=>{const c=e.routerState.matches(),l=r;let d=l&&c.length===l.length;const h=[];for(let f=0,g=c.length;f<g;f++){const p=l&&l[f],y=c[f];s&&p&&y.route.key===p.route.key?h[f]=s[f]:(d=!1,t[f]&&t[f](),Xt(u=>{t[f]=u,h[f]=Bi(e.routerState,h[f-1]||e.routerState.base,vn(()=>i()?.[f+1]),()=>{const a=e.routerState.matches();return a[f]??a[0]})}))}return t.splice(c.length).forEach(f=>f()),s&&d?(r=c,s):(n=h[0],r=c,h)}),o=vn(()=>i()&&n);return D(o)}const vn=e=>()=>{const t=e();if(t)return L(tr,{value:t,get children(){return t.outlet()}})},$n=e=>{const t=on(()=>e.children);return si(e,{get children(){return t()}})};function Wi(e){let t=!1;const n=s=>typeof s=="string"?{value:s}:s,[r,i]=q(n(e.get()),{equals:(s,c)=>s.value===c.value&&s.state===c.state,ownedWrite:!0}),o=[r,s=>{!t&&e.set(s),i(s)}];return e.init&&Kn(e.init((s=e.get())=>{t=!0,o[1](n(s)),t=!1})),ji({signal:o,create:e.create,utils:e.utils})}function Vi(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function zi(e,t){const n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}const Gi=new Map;function Ji({preload:e=!0,explicitLinks:t=!1,actionBase:n="/_server",transformUrl:r}={}){return i=>{const o=i.base.path(),s=i.navigatorFactory(i.base);let c,l;function d(u){return u.namespaceURI==="http://www.w3.org/2000/svg"}function h(u){if(u.defaultPrevented||u.button!==0||u.metaKey||u.altKey||u.ctrlKey||u.shiftKey)return;const a=u.composedPath().find(B=>B instanceof Node&&B.nodeName.toUpperCase()==="A");if(!a||t&&!a.hasAttribute("link"))return;const m=d(a),w=m?a.href.baseVal:a.href;if((m?a.target.baseVal:a.target)||!w&&!a.hasAttribute("state"))return;const A=(a.getAttribute("rel")||"").split(/\s+/);if(a.hasAttribute("download")||A&&A.includes("external"))return;const P=m?new URL(w,document.baseURI):new URL(w);if(!(P.origin!==window.location.origin||o&&P.pathname&&!P.pathname.toLowerCase().startsWith(o.toLowerCase())))return[a,P]}function f(u){const a=h(u);if(!a)return;const[m,w]=a,C=i.parsePath(w.pathname+w.search+w.hash),A=m.getAttribute("state");u.preventDefault(),s(C,{resolve:!1,replace:m.hasAttribute("replace"),scroll:!m.hasAttribute("noscroll"),state:A?JSON.parse(A):void 0})}function g(u){const a=h(u);if(!a)return;const[m,w]=a;r&&(w.pathname=r(w.pathname)),i.preloadRoute(w,m.getAttribute("preload")!=="false")}function p(u){clearTimeout(c);const a=h(u);if(!a)return l=null;const[m,w]=a;l!==m&&(r&&(w.pathname=r(w.pathname)),c=setTimeout(()=>{i.preloadRoute(w,m.getAttribute("preload")!=="false"),l=m},20))}function y(u){if(u.defaultPrevented)return;let a=u.submitter&&u.submitter.hasAttribute("formaction")?u.submitter.getAttribute("formaction"):u.target.getAttribute("action");if(!a)return;if(!a.startsWith("https://action/")){const w=new URL(a,Yn);if(a=i.parsePath(w.pathname+w.search),!a.startsWith(n))return}if(u.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const m=Gi.get(a);if(m){u.preventDefault();const w=new FormData(u.target,u.submitter);m.call({r:i,f:u.target},u.target.enctype==="multipart/form-data"?w:new URLSearchParams(w))}}tt(["click","submit"]),document.addEventListener("click",f),e&&(document.addEventListener("mousemove",p,{passive:!0}),document.addEventListener("focusin",g,{passive:!0}),document.addEventListener("touchstart",g,{passive:!0})),document.addEventListener("submit",y),Kn(()=>{document.removeEventListener("click",f),e&&(document.removeEventListener("mousemove",p),document.removeEventListener("focusin",g),document.removeEventListener("touchstart",g)),document.removeEventListener("submit",y)})}}function Hi(e){const t=()=>{const r=window.location.pathname.replace(/^\/+/,"/")+window.location.search,i=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:r+window.location.hash,state:i}},n=Hn();return Wi({get:t,set({value:r,replace:i,scroll:o,state:s}){i?window.history.replaceState(Ei(s),"",r):window.history.pushState(s,"",r),zi(decodeURIComponent(window.location.hash.slice(1)),o),sn()},init:r=>Vi(window,"popstate",Ci(r,i=>{if(i)return!n.confirm(i);{const o=t();return!n.confirm(o.value,{state:o.state})}})),create:Ji({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:r=>window.history.go(r),beforeLeave:n}})(e)}var Yi=T('<div class=chat><div class=chat-messages></div><div class=chat-input><input type=text placeholder="Type a message..."><button type=button>Send'),Zi=T("<span class=chat-user>"),Qi=T("<span class=chat-time>"),Xi=T("<div><div class=chat-content>");function eo(e){let t,n;Et(()=>e.messages.length,()=>{n&&n.lastElementChild&&n.lastElementChild.scrollIntoView({behavior:"instant"})});const[r,i]=q(""),o=()=>{const u=r().trim();u&&(e.onSend(u),i(""),t?.focus())},s=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),o())},c=u=>{try{const a=new Date(u),m=Math.floor((Date.now()-a.getTime())/1e3);if(m<60)return"just now";const w=Math.floor(m/60);if(w<60)return`${w}m ago`;const C=Math.floor(w/60);return C<24?`${C}h ago`:a.toLocaleDateString([],{month:"short",day:"numeric"})}catch{return u}};var l=Yi(),d=l.firstChild,h=d.nextSibling,f=h.firstChild,g=f.nextSibling,p=n;typeof p=="function"||Array.isArray(p)?yt(()=>p,d):n=d,v(d,L(ut,{get each(){return e.messages},children:u=>(()=>{var a=Xi(),m=a.firstChild;return v(a,L(zn,{get when(){return u.msg_type!=="system"},get children(){return[(()=>{var w=Zi();return v(w,()=>u.user_name),w})(),(()=>{var w=Qi();return v(w,()=>c(u.created_at)),w})()]}}),m),v(m,()=>u.content),Z(()=>`chat-message${u.msg_type==="system"?" system":""}`,(w,C)=>{Ze(a,w,C)}),a})()})),f.$$keydown=s,f.$$input=u=>i(u.currentTarget.value);var y=t;return typeof y=="function"||Array.isArray(y)?yt(()=>y,f):t=f,g.$$click=o,Z(()=>({e:r(),t:!r().trim()}),({e:u,t:a},m)=>{f.value=u??"",a!==m?.t&&ie(g,"disabled",a)}),l}tt(["input","keydown","click"]);function to(e){return!e||typeof e!="object"?null:"room_name"in e&&typeof e.room_name=="string"?{kind:"state",data:e}:"user_name"in e&&"content"in e?{kind:"chat",data:e}:null}function no(e,t,n){const i=`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/v1/ws/${e}?name=${encodeURIComponent(t)}`;let o=new WebSocket(i),s=[],c=!1;function l(d){o?.readyState===WebSocket.OPEN?o.send(d):s.push(d)}return o.onopen=()=>{c=!0;for(const d of s)o?.send(d);s=[]},o.onmessage=d=>{if(typeof d.data=="string")try{const h=JSON.parse(d.data),f=to(h);f?.kind==="state"?n.onState(f.data):f?.kind==="chat"&&n.onChat(f.data)}catch{}},o.onclose=d=>{o=null,c?d.code!==1e3&&d.code!==1001&&n.onError(`Connection lost (code: ${d.code})`):n.onError("Failed to connect to room"),n.onDisconnect()},o.onerror=()=>{o?.close()},d=>{l(JSON.stringify(d))}}function sr([e,t],n={}){Et(()=>e(),r=>{if(!r||n.unless?.(r))return;const i=setTimeout(()=>t(null),n.ms??5e3);return()=>clearTimeout(i)})}function ro(e,t){const[n,r]=q(null),[i,o]=q([]),[s,c]=q(!1),[l,d]=q(null),[h,f]=q(null),g={current:!0},p=()=>{if(h())return;const u=no(e,t,{onState:a=>{g.current=!1,r(a)},onChat:a=>o(m=>{const w=[...m,a];return w.length>200?w.slice(-200):w}),onDisconnect:()=>{c(!1),f(null)},onError:a=>{d(a)}});f(()=>u),c(!0),d(null)};return ri(()=>{p(),setTimeout(()=>{g.current&&d("Room not found or unavailable")},8e3)}),Et(()=>[s(),h()],([u,a])=>{if(!u&&!a){const m=setTimeout(p,3e3);return()=>clearTimeout(m)}}),sr([l,d],{unless:u=>u.includes("not found")}),{state:n,chats:i,connected:s,error:l,setError:d,send:u=>h()?.(u)}}var io=T("<div class=player>"),oo=T("<div class=player-idle>Paste a URL to start watching together"),so=T("<div class=player-info><div class=player-meta><strong class=player-title></strong><span class=player-duration-row><span class=duration-label></span><span class=elapsed-label>"),lo=T("<div class=player-media-wrap><div class=player-media></div><button type=button>"),uo=T("<img class=player-thumb alt>"),co=T("<video controls><track kind=captions>"),ao=T("<audio controls><track kind=captions>");const lr="moqbox-volume",_n=()=>parseFloat(localStorage.getItem(lr)||"0.5");function fo(e){const t=Math.round(e.volume*100)/100;localStorage.setItem(lr,t.toString())}function ho(e){const t=e.url.split(".").pop()?.toLowerCase();return t?["mp3","m4a","ogg","wav","flac","aac"].includes(t)?!1:(["mp4","webm","mov","mkv","avi","m4v"].includes(t),!0):!0}function Ft(e,t){const n=(Date.now()-t)/1e3;e.currentTime=n}function go(e){let t;const[n,r]=q(!0),i=e.roomId,o=f=>{t&&t.removeEventListener("volumechange",s),t=f??void 0,f&&(f.volume=_n(),f.addEventListener("volumechange",s))},s=()=>{const f=t;f&&fo(f)};let c=null;Et(()=>{const f=e.track;return c=f,f?.started_at?f.id:null},(f,g)=>{if(f===g)return;const p=c,y=t;if(!y||!p?.started_at){y&&y.pause(),r(!0);return}const u=p.started_at,a=`/api/v1/rooms/${i}/media/${p.hash}`;y.src=a,y.volume=_n();let m;const w=()=>{Ft(y,u);const A=()=>{r(!0),y.play().catch(()=>{}),m=()=>{const P=c?.started_at;if(!P)return;const B=(Date.now()-P)/1e3;r(Math.abs(y.currentTime-B)<.5)},y.addEventListener("timeupdate",m),y.addEventListener("pause",C)};y.addEventListener("seeked",A,{once:!0})};y.addEventListener("loadedmetadata",w,{once:!0}),y.addEventListener("canplay",w,{once:!0});const C=()=>{y.ended||Ft(y,u)};return()=>{y.removeEventListener("loadedmetadata",w),y.removeEventListener("canplay",w),m&&y.removeEventListener("timeupdate",m),y.removeEventListener("pause",C)}});const l=f=>{if(f<1)return"--:--";const g=Math.floor(f/1e3),p=Math.floor(g/60),y=g%60;return`${p}:${y.toString().padStart(2,"0")}`},d=()=>{const f=t,g=e.track?.started_at;f&&g&&(Ft(f,g),r(!0))};var h=io();return v(h,L(zn,{get when(){return e.track},get fallback(){return oo()},children:f=>{const g=f();return[(()=>{var p=so(),y=p.firstChild,u=y.firstChild,a=u.nextSibling,m=a.firstChild,w=m.nextSibling;return v(p,(()=>{var C=D(()=>!!g.thumbnail);return()=>C()&&(()=>{var A=uo();return A.addEventListener("error",P=>P.currentTarget.hidden=!0),Z(()=>g.thumbnail,P=>{ie(A,"src",P)}),A})()})(),y),v(u,()=>g.title),v(m,()=>g.duration),v(w,()=>l(Date.now()-g.started_at)),p})(),(()=>{var p=lo(),y=p.firstChild,u=y.nextSibling;return v(y,(()=>{var a=D(()=>!!ho(g));return()=>a()?(()=>{var m=co();return pn(m,"ended",e.onEnded),yt(()=>o,m),m})():(()=>{var m=ao();return pn(m,"ended",e.onEnded),yt(()=>o,m),m})()})()),u.$$click=d,v(u,()=>n()?"Live":"Go live"),Z(()=>["live-btn",n()&&"live-btn--on"],(a,m)=>{Ze(u,a,m)}),p})()]}})),h}tt(["click"]);var mo=T("<div><span class=queue-title></span><span class=queue-duration>"),yo=T("<img class=queue-thumb alt>"),po=T("<div class=queue-panel><div class=queue-section><h3>Now Playing</h3></div><div class=queue-section><h3>Up Next (<!>)</h3></div><div class=queue-section><h3>Playlist (<!>)<label class=playlist-toggle><input type=checkbox><span>Autoplay</span></label></h3></div><div class=queue-section><h3>Recently Played"),wo=T("<div class=queue-empty>Paste a URL to start watching together"),bo=T('<button type=button class=queue-shuffle title="Shuffle up next">⇄ Shuffle'),vo=T("<div class=queue-item-row>"),$o=T('<div class=queue-item-actions><button type=button class=queue-item-action title="Move up">▲</button><button type=button class=queue-item-action title="Move down">▼</button><button type=button class="queue-item-action queue-item-remove"title="Remove from queue">×'),_o=T("<div class=queue-empty>Tracks you add will appear here"),So=T('<div class=queue-item-row><button type=button class="queue-item-action queue-item-remove"title="Remove from playlist">×'),Eo=T("<div class=queue-empty>Add links to build a perpetual playlist"),Co=T('<div class=queue-item-row><button type=button class=queue-item-action title="Add to playlist">+'),Oo=T("<div class=queue-empty>Recently played tracks show up here");function st(e){var t=mo(),n=t.firstChild,r=n.nextSibling;return v(t,(()=>{var i=D(()=>!!e.thumbnail);return()=>i()&&(()=>{var o=yo();return o.addEventListener("error",s=>s.currentTarget.hidden=!0),Z(()=>e.thumbnail,s=>{ie(o,"src",s)}),o})()})(),n),v(n,()=>e.pending?"⏳ ":"",null),v(n,()=>e.title,null),v(r,()=>e.duration),Z(()=>`queue-item${e.extraClass?" "+e.extraClass:""}`,(i,o)=>{Ze(t,i,o)}),t}function To(e){var t=po(),n=t.firstChild;n.firstChild;var r=n.nextSibling,i=r.firstChild,o=i.firstChild,s=o.nextSibling;s.nextSibling;var c=r.nextSibling,l=c.firstChild,d=l.firstChild,h=d.nextSibling,f=h.nextSibling,g=f.nextSibling,p=g.firstChild,y=c.nextSibling;return y.firstChild,v(n,(()=>{var u=D(()=>!!e.currentTrack);return()=>u()?L(st,{get title(){return e.currentTrack.title},get duration(){return e.currentTrack.duration},get thumbnail(){return e.currentTrack.thumbnail},extraClass:"current"}):wo()})(),null),v(i,()=>e.queue.length,s),v(i,(()=>{var u=D(()=>!!(e.onShuffleQueue&&e.queue.length>1));return()=>u()&&(()=>{var a=bo();return a.$$click=()=>e.onShuffleQueue?.(),a})()})(),null),v(r,L(ut,{get each(){return e.queue},children:(u,a)=>(()=>{var m=vo();return v(m,L(st,{get title(){return u.title},get duration(){return u.duration},get thumbnail(){return u.thumbnail},get pending(){return u.pending}}),null),v(m,(()=>{var w=D(()=>!!e.onMoveQueueItem);return()=>w()&&(()=>{var C=$o(),A=C.firstChild,P=A.nextSibling,B=P.nextSibling;return A.$$click=()=>e.onMoveQueueItem?.(a(),a()-1),P.$$click=()=>e.onMoveQueueItem?.(a(),a()+1),B.$$click=()=>e.onRemoveQueueItem?.(u.id),Z(()=>({e:a()===0,t:a()===e.queue.length-1}),({e:Se,t:ge},Ee)=>{Se!==Ee?.e&&ie(A,"disabled",Se),ge!==Ee?.t&&ie(P,"disabled",ge)}),C})()})(),null),m})()}),null),v(r,(()=>{var u=D(()=>e.queue.length===0);return()=>u()&&_o()})(),null),v(l,()=>e.playlist.length,h),p.addEventListener("change",u=>e.onTogglePlaylist?.(u.currentTarget.checked)),v(c,L(ut,{get each(){return e.playlist},children:u=>(()=>{var a=So(),m=a.firstChild;return v(a,L(st,{get title(){return u.title},get duration(){return u.duration},get thumbnail(){return u.thumbnail},get pending(){return u.pending}}),m),m.$$click=()=>e.onRemoveFromPlaylist?.(u.id),a})()}),null),v(c,(()=>{var u=D(()=>e.playlist.length===0);return()=>u()&&Eo()})(),null),v(y,L(ut,{get each(){return e.history},children:u=>(()=>{var a=Co(),m=a.firstChild;return v(a,L(st,{get title(){return u.title},get duration(){return u.duration},get thumbnail(){return u.thumbnail},extraClass:"history"}),m),m.$$click=()=>e.onAddToPlaylist?.(u.url),a})()}),null),v(y,(()=>{var u=D(()=>e.history.length===0);return()=>u()&&Oo()})(),null),Z(()=>({e:e.playlistEnabled,t:e.playlist.length===0}),({e:u,t:a},m)=>{p.checked=u,a!==m?.t&&ie(p,"disabled",a)}),t}tt(["click"]);const ur="moqbox-theme";function cr(e){const t=document.documentElement;e==="latte"?(t.setAttribute("data-theme","latte"),t.style.colorScheme="light"):e==="macchiato"?(t.setAttribute("data-theme","macchiato"),t.style.colorScheme="dark"):(t.removeAttribute("data-theme"),t.style.colorScheme="light dark"),localStorage.setItem(ur,e)}function Ao(e){return e==="macchiato"?"latte":e==="latte"?"system":"macchiato"}function ar(){return localStorage.getItem(ur)||"system"}var Ro=T('<div class=home><h1>moqbox</h1><p>Watch videos together with friends</p><div class=home-form><input type=text placeholder="Your name"><button type=button>'),Po=T('<div class="toast toast-error"role=alert>'),Io=T("<div class=room><header class=room-header><h2></h2><span class=client-count></span></header><div class=room-layout><div class=room-main><div class=room-actions><button type=button></button><button type=button class=secondary>Skip</button></div></div><div class=room-sidebar><div class=room-footer><button type=button class=theme-toggle-sm>"),ko=T("<span class=disconnected>Disconnected"),xo=T('<div class="toast toast-error"role=alert><span></span><button type=button class=toast-action>Go back'),Lo=T('<div class=inline-form><input type=text placeholder="Paste a YouTube / media URL..."><div class=add-target-toggle><button type=button>Queue</button><button type=button>Playlist</button></div><button type=button>');const No=()=>{const e=rr(),[t,n]=q(""),[r,i]=q(!1),[o,s]=q(null);sr([o,s]);const c=async()=>{if(t().trim()){i(!0);try{const y=await fetch("/api/v1/rooms",{method:"POST"});if(!y.ok)throw new Error(`create room: ${y.status}`);const u=await y.json();e(`/room/${u.room_id}?name=${encodeURIComponent(t().trim())}`)}catch(y){console.error("Failed to create room:",y),s("Failed to create room"),i(!1)}}};var l=Ro(),d=l.firstChild,h=d.nextSibling,f=h.nextSibling,g=f.firstChild,p=g.nextSibling;return g.$$keydown=y=>y.key==="Enter"&&c(),g.$$input=y=>n(y.currentTarget.value),p.$$click=c,v(p,()=>r()?"Creating...":"Create Room"),v(l,(()=>{var y=D(()=>!!o());return()=>y()&&(()=>{var u=Po();return v(u,o),u})()})(),null),Z(()=>({e:t(),t:r()||!t().trim()}),({e:y,t:u},a)=>{g.value=y??"",u!==a?.t&&ie(p,"disabled",u)}),l},qo=()=>{const e=Li(),t=ee(()=>e.id),r=new URLSearchParams(location.search).get("name")||"anonymous",i=rr(),[o,s]=q(ar()),c=()=>{const _=Ao(o());cr(_),s(_)},{state:l,chats:d,connected:h,error:f,setError:g,send:p}=ro(t,r),[y,u]=q(!1),[a,m]=q(""),[w,C]=q("queue"),[A,P]=q(!1),B=async()=>{const _=a().trim();if(_){P(!0);try{const R=w()==="queue"?"/api/v1/ingest":"/api/v1/playlist/add",N=await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:_,room_id:t})});if(!N.ok){if(N.status===429){const se=N.headers.get("Retry-After");g(se?`Too fast — try again in ${se}s`:"Too fast — try again in a moment")}else{const se=await N.json().catch(()=>({error:N.statusText}));g(se.error||`${w()} failed`)}return}m(""),u(!1),g(null)}catch(R){g(String(R))}finally{P(!1)}}},Se=async _=>{try{const R=await fetch("/api/v1/playlist/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:_,room_id:t})});if(!R.ok){const N=await R.json().catch(()=>({error:R.statusText}));g(N.error||"Failed to add to playlist")}}catch(R){g(String(R))}},ge=async _=>{try{const R=await fetch("/api/v1/playlist/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:t,id:_})});if(!R.ok){const N=await R.json().catch(()=>({error:R.statusText}));g(N.error||"Failed to remove from playlist")}}catch(R){g(String(R))}},Ee=_=>{p({type:"set_playlist_enabled",enabled:_})},Ct=(_,R)=>{_!==R&&p({type:"move_queue_item",from:_,to:R})},Ot=()=>{p({type:"shuffle_queue"})},Tt=_=>{p({type:"remove_queue_item",item_id:_})};var I=Io(),k=I.firstChild,z=k.firstChild,Ce=z.nextSibling,Oe=k.nextSibling,te=Oe.firstChild,Te=te.firstChild,oe=Te.firstChild,me=oe.nextSibling,fe=te.nextSibling,ye=fe.firstChild,At=ye.firstChild;return v(z,()=>l()?.room_name??"Loading..."),v(Ce,(()=>{var _=D(()=>l()?.clients!=null);return()=>_()?`${l()?.clients} connected`:""})()),v(k,(()=>{var _=D(()=>!h());return()=>_()&&ko()})(),null),v(I,(()=>{var _=D(()=>!!f());return()=>_()&&(()=>{var R=xo(),N=R.firstChild,se=N.nextSibling;return v(N,f),se.$$click=()=>i("/"),R})()})(),Oe),v(te,L(go,{get track(){return l()?.current_track??null},roomId:t,onEnded:()=>{const _=l()?.current_track;_&&p({type:"track_ended",item_id:_.id})}}),Te),oe.$$click=()=>{u(!y())},v(oe,()=>y()?"Cancel":"Add"),me.$$click=()=>p({type:"skip"}),v(te,(()=>{var _=D(()=>!!y());return()=>_()&&(()=>{var R=Lo(),N=R.firstChild,se=N.nextSibling,Rt=se.firstChild,ln=Rt.nextSibling,Pt=se.nextSibling;return N.$$keydown=Me=>Me.key==="Enter"&&B(),N.$$input=Me=>m(Me.currentTarget.value),Rt.$$click=()=>C("queue"),ln.$$click=()=>C("playlist"),Pt.$$click=B,v(Pt,()=>A()?"Adding...":"Add"),Z(()=>({e:a(),t:w()==="queue"?"active":"",a:w()==="playlist"?"active":"",o:A()||!a().trim()}),({e:Me,t:fr,a:dr,o:un},It)=>{N.value=Me??"",Ze(Rt,fr,It?.t),Ze(ln,dr,It?.a),un!==It?.o&&ie(Pt,"disabled",un)}),R})()})(),null),v(fe,L(To,{get currentTrack(){return l()?.current_track??null},get queue(){return l()?.queue??[]},get history(){return l()?.history??[]},get playlist(){return l()?.playlist??[]},get playlistEnabled(){return l()?.playlist_enabled??!0},onAddToPlaylist:Se,onRemoveFromPlaylist:ge,onTogglePlaylist:Ee,onMoveQueueItem:Ct,onShuffleQueue:Ot,onRemoveQueueItem:Tt}),ye),v(fe,L(eo,{get messages(){return d()},onSend:_=>p({type:"chat",content:_})}),ye),At.$$click=c,v(At,(()=>{var _=D(()=>o()==="macchiato");return()=>_()?"Dark":o()==="latte"?"Light":"System"})()),Z(()=>({e:!l()?.current_track,t:`Theme: ${o()}`}),({e:_,t:R},N)=>{_!==N?.e&&ie(me,"disabled",_),R!==N?.t&&ie(At,"title",R)}),I},Mo=()=>(cr(ar()),L(Hi,{get children(){return[L($n,{path:"/",component:No}),L($n,{path:"/room/:id",component:qo})]}}));tt(["input","keydown","click"]);const Sn=document.getElementById("root");Sn&&Si(()=>L(Mo,{}),Sn);
-1
static/dist/assets/index-DrH7LpDB.css
··· 1 - :root{color-scheme:light dark;--rosewater: light-dark(#dc8a78, #f4dbd6);--flamingo: light-dark(#dd7878, #f0c6c6);--pink: light-dark(#ea76cb, #f5bde6);--mauve: light-dark(#8839ef, #c6a0f6);--red: light-dark(#d20f39, #ed8796);--maroon: light-dark(#e64553, #ee99a0);--peach: light-dark(#fe640b, #f5a97f);--yellow: light-dark(#df8e1d, #eed49f);--green: light-dark(#40a02b, #a6da95);--teal: light-dark(#179299, #8bd5ca);--sky: light-dark(#04a5e5, #91d7e3);--sapphire: light-dark(#209fb5, #7dc4e4);--blue: light-dark(#1e66f5, #8aadf4);--lavender: light-dark(#7287fd, #b7bdf8);--text: light-dark(#4c4f69, #cad3f5);--subtext1: light-dark(#5c5f77, #b8c0e0);--subtext0: light-dark(#6c6f85, #a5adcb);--overlay2: light-dark(#7c7f93, #939ab7);--overlay1: light-dark(#8c8fa1, #8087a2);--overlay0: light-dark(#9ca0b0, #6e738d);--surface2: light-dark(#acb0be, #5b6078);--surface1: light-dark(#bcc0cc, #494d64);--surface0: light-dark(#ccd0da, #363a4f);--crust: light-dark(#dce0e8, #181926);--mantle: light-dark(#e6e9ef, #1e2030);--base: light-dark(#eff1f5, #24273a);--bg: var(--base);--surface: var(--mantle);--surface-raised: var(--crust);--border: var(--surface0);--text-primary: var(--text);--text-muted: var(--overlay1);--accent: var(--mauve);--accent-hover: var(--lavender);--danger: var(--red);--success: var(--green);--warning: var(--yellow);font-family:system-ui,-apple-system,sans-serif;background:var(--bg);color:var(--text-primary);line-height:1.5}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}body{min-height:100vh}input,button,select{font:inherit;color:inherit}input{background:var(--surface-raised);border:1px solid var(--border);border-radius:6px;padding:.5rem .75rem;outline:none;transition:border-color .15s,box-shadow .15s}input:focus{border-color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 25%,transparent)}button{background:var(--accent);color:var(--crust);border:none;border-radius:6px;padding:.5rem 1rem;cursor:pointer;transition:background .15s,transform .1s;font-weight:600;font-size:.875rem}button:hover:not(:disabled){background:var(--accent-hover)}button:active:not(:disabled){transform:scale(.97)}button:disabled{opacity:.35;cursor:not-allowed}button.secondary{background:var(--surface0);color:var(--text-primary)}button.secondary:hover:not(:disabled){background:var(--surface1)}.home{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;gap:1rem;padding:2rem}.home h1{font-size:3rem;font-weight:700;letter-spacing:-.02em;color:var(--accent)}.home p{color:var(--text-muted);margin-bottom:.5rem}.home-form,.home-join{display:flex;gap:.5rem;flex-wrap:wrap;justify-content:center}.toast{padding:.5rem 1rem;font-size:.85rem;cursor:pointer;user-select:none}.toast-error{background:var(--danger);color:var(--crust);font-weight:600}.toast-action{background:#00000026;border:1px solid rgba(255,255,255,.2);color:inherit;font-size:.75rem;padding:.15rem .5rem;border-radius:3px;cursor:pointer;margin-left:.5rem}.room{display:flex;flex-direction:column;height:100vh}.room-header{display:flex;align-items:center;gap:1rem;padding:.6rem 1rem;background:var(--surface);border-bottom:1px solid var(--border);flex-shrink:0}.room-header h2{font-size:1rem;font-weight:600}.client-count{color:var(--text-muted);font-size:.8rem;margin-left:auto}.disconnected{color:var(--danger);font-size:.8rem;margin-left:.5rem}.theme-toggle-sm{background:none;border:none;color:var(--text-muted);font-size:.65rem;cursor:pointer;padding:.15rem .35rem;border-radius:3px;font-weight:500}.theme-toggle-sm:hover{color:var(--text-primary);background:var(--surface0)}.room-layout{display:flex;flex:1;overflow:hidden}.room-main{flex:1;display:flex;flex-direction:column;padding:.75rem;gap:.75rem;min-width:0;overflow-y:auto}.room-sidebar{width:340px;display:flex;flex-direction:column;border-left:1px solid var(--border);overflow:hidden;flex-shrink:0}.room-actions{display:flex;gap:.5rem;flex-wrap:wrap}.room-actions button{font-size:.8rem;padding:.4rem .75rem}.inline-form{display:flex;gap:.4rem}.inline-form input{flex:1;font-size:.85rem}.player{background:var(--surface);border-radius:8px;padding:.75rem;display:flex;flex-direction:column;gap:.5rem}.player-info{display:flex;align-items:center;gap:.75rem}.player-thumb{width:48px;height:48px;border-radius:6px;object-fit:cover;flex-shrink:0;background:var(--surface0)}.player-meta{display:flex;flex-direction:column;gap:.1rem;min-width:0;flex:1}.player-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;font-size:.95rem}.player-duration-row{display:flex;gap:.75rem;font-size:.8rem;color:var(--text-muted)}.player-media video,.player-media audio{width:100%;max-height:60vh;border-radius:6px;background:light-dark(#111,#000)}.player-media-wrap{position:relative}.live-btn{position:absolute;top:.75rem;right:.75rem;font-size:.75rem;font-weight:700;padding:.25rem .65rem;border-radius:4px;letter-spacing:.04em;text-transform:uppercase;background:#00000080;color:#fff;border:1px solid rgba(255,255,255,.15);z-index:10;cursor:pointer;transition:background .15s,color .15s,border-color .15s}.live-btn:hover{background:#000000b3}.live-btn--on{background:var(--accent);color:var(--base);border-color:var(--accent)}.live-btn--on:hover{background:color-mix(in srgb,var(--accent) 85%,var(--base))}.player-idle{color:var(--text-muted);padding:2rem;text-align:center;font-style:italic}.chat{flex:1;display:flex;flex-direction:column;min-height:0}.chat-messages{flex:1;overflow-y:auto;padding:.5rem;display:flex;flex-direction:column;gap:.2rem}.chat-message{padding:.2rem .5rem;border-radius:4px;transition:background .1s}.chat-message:hover{background:var(--surface-raised)}.chat-user{font-weight:600;font-size:.8rem;color:var(--accent)}.chat-time{font-size:.65rem;color:var(--text-muted);margin-left:.4rem;opacity:.7}.chat-content{font-size:.88rem;margin-top:.05rem;word-break:break-word}.chat-input{display:flex;gap:.25rem;padding:.5rem;border-top:1px solid var(--border)}.chat-input input{flex:1;font-size:.85rem}.queue-panel{overflow-y:auto;flex-shrink:0;max-height:50%}.queue-section{padding:.6rem .75rem;border-bottom:1px solid var(--border)}.queue-section h3{font-size:.72rem;text-transform:uppercase;color:var(--text-muted);margin-bottom:.4rem;letter-spacing:.06em;font-weight:700;display:flex;align-items:center;justify-content:space-between;gap:.5rem}.queue-shuffle{font-size:.7rem;font-weight:600;text-transform:none;letter-spacing:0;padding:.15rem .5rem;border:1px solid var(--border);border-radius:4px;background:var(--surface);color:var(--text-muted);cursor:pointer;transition:color .15s,border-color .15s,background .15s}.queue-shuffle:hover{color:var(--accent);border-color:var(--accent);background:var(--surface-raised)}.queue-item-actions{display:flex;gap:.15rem;flex-shrink:0}.queue-item-actions .queue-item-action{display:flex;font-size:.85rem;width:20px;height:20px}.queue-item-actions .queue-item-action:disabled{opacity:.25;cursor:not-allowed}.queue-item-actions .queue-item-action:disabled:hover{color:var(--text-muted);background:none}.playlist-toggle{display:inline-flex;align-items:center;gap:.3rem;text-transform:none;letter-spacing:0;font-size:.72rem;color:var(--text-muted);cursor:pointer;user-select:none}.playlist-toggle input{margin:0;cursor:pointer}.queue-item{display:flex;align-items:center;gap:.4rem;padding:.2rem 0;font-size:.82rem;transition:background .1s;border-radius:4px}.queue-item:hover{background:var(--surface-raised)}.queue-item.current{color:var(--accent);font-weight:600}.queue-item.history{opacity:.65}.queue-item-row{display:flex;align-items:center;gap:.3rem}.queue-item-row .queue-item{flex:1;min-width:0}.queue-item-row .queue-item:hover{background:none}.queue-item-row:hover .queue-item{background:var(--surface-raised)}.queue-item-action{display:none;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;background:none;color:var(--text-muted);font-size:1.1rem;font-weight:600;line-height:1;border-radius:4px;cursor:pointer;flex-shrink:0;transition:color .15s,background .15s}.queue-item-row:hover .queue-item-action{display:flex}.queue-item-action:hover{color:var(--accent);background:var(--surface0)}.queue-item-remove:hover{color:var(--danger)}.queue-thumb{width:28px;height:20px;border-radius:3px;object-fit:cover;flex-shrink:0;background:var(--surface0)}.queue-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.queue-duration{color:var(--text-muted);font-size:.75rem;margin-left:.3rem;flex-shrink:0}.queue-empty{color:var(--text-muted);font-size:.78rem;font-style:italic}.room-footer{padding:.3rem .75rem;border-top:1px solid var(--border);display:flex;justify-content:flex-end;flex-shrink:0}.add-target-toggle{display:flex;gap:0}.add-target-toggle button{font-size:.72rem;padding:.25rem .5rem;background:var(--surface0);color:var(--text-muted);border:1px solid var(--border);font-weight:500;border-radius:0}.add-target-toggle button:first-child{border-radius:4px 0 0 4px}.add-target-toggle button:last-child{border-radius:0 4px 4px 0}.add-target-toggle button.active{background:var(--accent);color:var(--crust);border-color:var(--accent)}.chat-message.system .chat-user,.chat-message.system .chat-time{display:none}.chat-message.system .chat-content{font-size:.78rem;color:var(--text-muted);font-style:italic}@media(max-width:768px){.room-header{padding:.4rem .75rem}.room-main{padding:.5rem}.room-sidebar{width:100%;border-left:none;border-top:1px solid var(--border);max-height:40vh}.room-layout{flex-direction:column-reverse}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition-duration:0s!important;animation-duration:0s!important}}
+1
static/dist/assets/index-Dz6fefYY.js
··· 1 + (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();class W extends Error{source;constructor(t){super(),this.source=t}}class Kt extends Error{source;constructor(t,n){super(n instanceof Error?n.message:String(n),{cause:n}),this.source=t}}class On extends Error{constructor(){super("")}}class mr extends Error{constructor(){super("")}}const Tn=0,Je=1,xe=2,bt=4,le=8,Ze=16,H=32,me=64,_e=128,Yt=256,ht=512,Qe=1024,$t=1,pr=2,_t=4,yr=8,An=16,Me=32,Zt=64,P=1,V=2,B=4,ke=1,J=2,Oe=3,E={},wr=typeof Proxy=="function",Qt={},vr=Symbol("refresh");function Rn(e,t){const n=(e.i?.t?e.i.u?.o:e.i?.o)??-1;n>=e.o&&(e.o=n+1);const r=e.o,i=t.l[r];if(i===void 0)t.l[r]=e;else{const o=i.S;o.T=e,e.S=o,i.S=e}r>t._&&(t._=r)}function tt(e,t){let n=e.O;n&(le|bt|Qe)||(n&Je?e.O=n&-4|xe|le:e.O=n|le,n&Ze||Rn(e,t))}function Pn(e,t){let n=e.O;n&(le|bt|Ze|Qe)||(e.O=n|Ze,Rn(e,t))}function De(e,t){const n=e.O;if(!(n&(le|Ze)))return;e.O=n&-25;const r=e.o;if(e.S===e)t.l[r]=void 0;else{const i=e.T,o=t.l[r],s=i??o;e===o?t.l[r]=i:e.S.T=i,s.S=e.S}e.S=e,e.T=void 0}function br(e){if(!e.R){e.R=!0;for(let t=0;t<=e._;t++)for(let n=e.l[t];n!==void 0;n=n.T)n.O&le&&gt(n)}}function gt(e,t=xe){const n=e.O;if(!((n&(Je|xe))>=t)){e.O=n&-4|t;for(let r=e.I;r!==null;r=r.p)gt(r.h,Je);if(e.N!==null)for(let r=e.N;r!==null;r=r.A)for(let i=r.I;i!==null;i=i.p)gt(i.h,Je)}}function Ke(e,t){for(e.R=!1,e.C=0;e.C<=e._;e.C++){let n=e.l[e.C];for(;n!==void 0;)n.O&le?t(n):$r(n,e),n=e.l[e.C]}e._=0}function $r(e,t){De(e,t);let n=e.o;for(let r=e.P;r;r=r.D){const i=r.m,o=i.V||i;o.L&&o.o>=n&&(n=o.o+1)}if(e.o!==n){e.o=n;for(let r=e.I;r!==null;r=r.p)Pn(r.h,t)}}const mt=new WeakMap,te=new Set;function _r(e){let t=mt.get(e);if(t)return z(t);const n=e.U,r=n?.G?z(n.G):null;return t={k:e,F:new Set,W:[[],[]],H:null,M:b,j:r},mt.set(e,t),te.add(t),e.$=!1,t}function z(e){for(;e.H;)e=e.H;return e}function kn(e,t){if(e=z(e),t=z(t),e===t)return e;t.H=e;for(const n of t.F)e.F.add(n);return e.W[0].push(...t.W[0]),e.W[1].push(...t.W[1]),e}function Ie(e){const t=e.G;if(!t)return;const n=z(t);if(te.has(n))return n;e.G=void 0}function Ue(e){return Ie(e)?.M??e.M}function St(e){return e.K!==void 0&&e.K!==E}function Xt(e,t){const n=z(t),r=e.G;if(r){if(r.H){e.G=t;return}const i=z(r);if(te.has(i)){i!==n&&!St(e)&&(n.j&&z(n.j)===i?e.G=t:i.j&&z(i.j)===n||kn(n,i));return}}e.G=t}const We=new Set,L={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0},Y={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0};let F=0,b=null,Xe=!1,Ut=0,at=null;const Ve=new Set;function Sr(e){return We.size===0&&te.size===0&&e.Y.length===0&&e.Z.length===0&&e.q.size===0&&Ve.size===0}function Cr(){if(Ve.size!==0)for(const e of Ve){if(e.I!==null){Ve.delete(e);continue}e.B===E&&(e.K!==void 0&&e.K!==E||(Ve.delete(e),e.X?.()))}}function Er(e){return!!at?.has(e)}function ot(e){for(const t of te){if(t.H||t.F.size>0)continue;const n=t.W[e-1];n.length&&(t.W[e-1]=[],yt(n,e))}}function Or(e){for(let t=e.I;t!==null;t=t.p){const n=t.h;if(!n.J)continue;if(n.J===Oe){n.ee||(n.ee=!0,n.te.enqueue(J,n.ne));continue}const r=n.O&H?Y:L;r.C>n.o&&(r.C=n.o),tt(n,r)}}function Tr(e,t){t.ie=e,e.re.push(...t.re);for(const n of te)n.M===t&&(n.M=e);e.Z.push(...t.Z);for(const n of t.q)e.q.add(n);for(const[n,r]of t.oe){let i=e.oe.get(n);i||e.oe.set(n,i=new Set);for(const o of r)i.add(o)}for(const n of t.se)e.se.add(n)}function Ar(e){for(let t=0;t<e.length;t++){const n=e[t];n.G=void 0,n.B!==E&&(n.ue=n.B,n.B=E);const r=n.K;n.K=E,r!==E&&n.ue!==r&&Le(n,!0),n.M=null}e.length=0}function Rr(e){for(const t of te)(e?t.M===e:!t.M)&&(t.H||(t.W[0].length&&yt(t.W[0],ke),t.W[1].length&&yt(t.W[1],J)),t.k.G===t&&(t.k.G=void 0),t.F.clear(),t.W[0].length=0,t.W[1].length=0,te.delete(t),mt.delete(t.k))}function Ce(){Xe||(Xe=!0,!Ut&&!T.ce&&queueMicrotask(Ne))}let Pr=class{i=null;le=[[],[]];Y=[];created=F;addChild(t){this.Y.push(t),t.i=this}removeChild(t){const n=this.Y.indexOf(t);n>=0&&(this.Y.splice(n,1),t.i=null)}notify(t,n,r,i){return this.i?this.i.notify(t,n,r,i):!1}run(t){if(this.le[t-1].length){const n=this.le[t-1];this.le[t-1]=[],yt(n,t)}for(let n=0;n<this.Y.length;n++)this.Y[n].run?.(t)}enqueue(t,n){t&&(G?z(G).W[t-1].push(n):this.le[t-1].push(n)),Ce()}stashQueues(t){t.le[0].push(...this.le[0]),t.le[1].push(...this.le[1]),this.le=[[],[]];for(let n=0;n<this.Y.length;n++){let r=this.Y[n],i=t.Y[n];i||(i={le:[[],[]],Y:[]},t.Y[n]=i),r.stashQueues(i)}}restoreQueues(t){this.le[0].push(...t.le[0]),this.le[1].push(...t.le[1]);for(let n=0;n<t.Y.length;n++){const r=t.Y[n];let i=this.Y[n];i&&i.restoreQueues(r)}}};class X extends Pr{ce=!1;ae=null;fe=[];Z=[];q=new Set;static Ee;static Se;static Te;static de=null;flush(){if(!this.ce){this.ce=!0;try{if(Ke(L,X.Ee),b){if(!Ir(b)){const r=b;if(Ke(Y,X.Ee),this.ae=null,this.fe=[],this.Z=[],this.q=new Set,ot(ke),ot(J),this.stashQueues(r._e),F++,Xe=L._>=L.C,dn(r.fe),b=null,!r.re.length&&!r.oe.size&&r.Z.length){at=new Set;for(let i=0;i<r.Z.length;i++){const o=r.Z[i];o.L||o.Oe&$t||(at.add(o),Or(o))}}try{Lt(null,!0)}finally{at=null}return}this.fe!==b.fe&&this.fe.push(...b.fe),this.restoreQueues(b._e),We.delete(b);const n=b;b=null,dn(this.fe),Lt(n)}else Sr(this)?(pt(),L._>=L.C&&(Ke(L,X.Ee),pt())):(We.size&&Ke(Y,X.Ee),Lt());F++,Xe=L._>=L.C,te.size&&ot(ke),this.run(ke),te.size&&ot(J),this.run(J)}finally{this.ce=!1}}}notify(t,n,r,i){if(n&P){if(r&P){const o=i!==void 0?i:t.Re;if(b&&o){const s=o.source;let u=b.oe.get(s);u||b.oe.set(s,u=new Set);const l=u.size;u.add(t),u.size!==l&&Ce()}}return!0}return!1}initTransition(t){if(t&&(t=xn(t)),!(t&&t===b)&&!(!t&&b&&b.Ie===F)){if(!b)b=t??{Ie:F,fe:[],oe:new Map,Z:[],q:new Set,re:[],_e:{le:[[],[]],Y:[]},ie:!1,se:new Set};else if(t){const n=b;Tr(t,n),We.delete(n),b=t}if(We.add(b),b.Ie=F,this.ae!==null&&(this.ae.M=b,b.fe.push(this.ae),this.ae=null),this.fe!==b.fe){for(let n=0;n<this.fe.length;n++){const r=this.fe[n];r.M=b,b.fe.push(r)}this.fe=b.fe}if(this.Z!==b.Z){for(let n=0;n<this.Z.length;n++){const r=this.Z[n];r.M=b,b.Z.push(r)}this.Z=b.Z}for(const n of te)n.M||(n.M=b);if(this.q!==b.q){for(const n of this.q)b.q.add(n);this.q=b.q}}}}function Ct(e){if(b){T.fe.push(e);return}if(T.ae===null&&T.fe.length===0){T.ae=e;return}T.ae!==null&&(T.fe.push(T.ae),T.ae=null),T.fe.push(e)}function Le(e,t=!1){const n=e.G||G,r=e.pe!==void 0;for(let i=e.I;i!==null;i=i.p){if(r&&i.h.Oe&yr){i.h.O|=Yt;continue}t&&n?(i.h.O|=_e,Xt(i.h,n)):t&&(i.h.O|=_e,i.h.G=void 0);const o=i.h;if(o.J===Oe){o.ee||(o.ee=!0,o.te.enqueue(J,o.ne));continue}const s=i.h.O&H?Y:L;s.C>i.h.o&&(s.C=i.h.o),tt(i.h,s)}}function fn(e){const t=e;if(!t.L){e.B!==E&&(e.ue=e.B,e.B=E);return}e.B!==E&&(e.ue=e.B,e.B=E,e.J&&e.J!==Oe&&(e.ee=!0)),t.O&=~Qe,t.he&P||(t.he&=~B),(t.Ne!==null||t.Ae!==null)&&X.Se(t,!1,!0)}function pt(){T.ae!==null&&(fn(T.ae),T.ae=null);const e=T.fe;for(let t=0;t<e.length;t++)fn(e[t]);e.length=0}function Lt(e=null,t=!1){const n=!t;n&&pt(),!t&&T.Y.length&&In(T);const r=L._>=L.C;if(r&&Ke(L,X.Ee),n){if(r&&pt(),Ar(e?e.Z:T.Z),e&&e.se.size){for(const i of e.se){if(i.O&me)continue;if(i.J===Oe){i.ee||(i.ee=!0,i.te.enqueue(J,i.ne));continue}const o=i.O&H?Y:L;o.C>i.o&&(o.C=i.o),tt(i,o)}e.se.clear()}e?e.q:T.q,Cr(),Rr(e)}}function In(e){for(const t of e.Y)t.checkSources?.(),In(t)}function dn(e){for(let t=0;t<e.length;t++)e[t].M=b}const T=new X;function Ne(e){if(e){Ut++;try{return e()}finally{Ne(),Ut--}}if(!T.ce)for(;Xe||b;)T.flush()}function yt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function kr(e,t){if(e.O&(H|me))return!1;if(e.Ce===t||e.Pe?.has(t))return!0;for(let n=e.P;n;n=n.D){let r=n.m;for(;r;){if(r===t||r.V===t)return!0;r=r.U}}return!!(e.he&P&&e.Re instanceof W&&e.Re.source===t)}function Ir(e){if(e.ie)return!0;if(e.re.length)return!1;let t=!0;for(const[n,r]of e.oe){let i=!1;for(const o of r){if(kr(o,n)){i=!0;break}r.delete(o)}if(!i)e.oe.delete(n);else if(n.he&P&&n.Re?.source===n){t=!1;break}}if(t)for(let n=0;n<e.Z.length;n++){const r=e.Z[n];if(St(r)&&"he"in r&&r.he&P&&r.Re instanceof W&&r.Re.source!==r){t=!1;break}}return t&&(e.ie=!0),t}function xn(e){for(;e.ie&&typeof e.ie=="object";)e=e.ie;return e}function xr(e,t){const n=b;try{return b=xn(e),t()}finally{b=n}}function Ln(e){let t=e.ge;for(;t;)t.O|=H,t.O&le&&(De(t,L),tt(t,Y)),Ln(t),t=t.De}function nt(e,t=!1,n){const r=e.O;if(r&me)return;t&&(e.O=r|me),t&&e.L&&(e.ve=null);let i=n?e.Ne:e.ge;for(;i;){const o=i.De;if(i.P){const s=i;De(s,s.O&H?Y:L);let u=s.P;do u=nn(u);while(u!==null);s.P=null,s.ye=null}nt(i,!0),i=o}if(n?e.Ne=null:(e.ge=null,e.me=0),t&&!n&&!(r&H)&&e.i!==null&&!(e.i.O&me)){const o=e.we,s=e.De;o!==null?o.De=s:e.i.ge=s,s!==null&&(s.we=o),e.we=null}Lr(e,n)}function Lr(e,t){let n=t?e.Ae:e.be;if(n){if(Array.isArray(n))for(let r=0;r<n.length;r++){const i=n[r];i.call(i)}else n.call(n);t?e.Ae=null:e.be=null}}function Nr(e,t){let n=e;for(;n.Oe&_t&&n.i;)n=n.i;if(n.id!=null)return qr(n.id,n.me++);throw new Error("Cannot get child id from owner without an id")}function en(e){return Nr(e)}function qr(e,t){const n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):"")+n}function rt(){return C}function Et(e){return C&&(C.be?Array.isArray(C.be)?C.be.push(e):C.be=[C.be,e]:C.be=e),e}function Mr(e=!0){nt(this,e)}function He(e){const t=C,n=e?.transparent??!1,r={id:e?.id??(n?t?.id:t?.id!=null?en(t):void 0),Oe:n?_t:0,t:!0,u:t?.t?t.u:t,ge:null,De:null,we:null,be:null,te:t?.te??T,Ve:t?.Ve||Qt,me:0,Ae:null,Ne:null,i:t,dispose:Mr};if(t){const i=t.ge;i===null||(r.De=i,i.we=r),t.ge=r}return r}function tn(e,t){const n=He(t);return se(n,()=>e(()=>n.dispose()))}function nn(e){const t=e.m,n=e.D,r=e.p,i=e.Le;if(r!==null?r.Le=i:t.Ue=i,i!==null)i.p=r;else if(t.I=r,r===null){t.X?.();const o=t;o.L&&o.Oe&Me&&!(o.O&H)&&qn(o)}return n}function Nn(e){const t=e.ye;let n=t!==null?t.D:e.P;if(n!==null){do n=nn(n);while(n!==null);t!==null?t.D=null:e.P=null}}function qn(e){De(e,e.O&H?Y:L);let t=e.P;for(;t!==null;)t=nn(t);e.P=null,e.ye=null,nt(e,!0)}function je(e,t){const n=t.ye;if(n!==null&&n.m===e)return;let r=null;const i=t.O&bt;if(i&&(r=n!==null?n.D:t.P,r!==null&&r.m===e)){t.ye=r;return}const o=e.Ue;if(o!==null&&o.h===t&&(!i||Dr(o,t)))return;const s=t.ye=e.Ue={m:e,h:t,D:r,Le:o,p:null};n!==null?n.D=s:t.P=s,o!==null?o.p=s:e.I=s}function Dr(e,t){const n=t.ye;if(n!==null){let r=t.P;do{if(r===e)return!0;if(r===n)break;r=r.D}while(r!==null)}return!1}function Fr(e,t){return e.Ce===t||e.Pe?.has(t)?!1:e.Ce?(e.Pe?e.Pe.add(t):e.Pe=new Set([e.Ce,t]),e.Ce=void 0,!0):(e.Ce=t,!0)}function Br(e,t){return e.Ce?e.Ce!==t?!1:(e.Ce=void 0,!0):e.Pe?.delete(t)?(e.Pe.size===1?(e.Ce=e.Pe.values().next().value,e.Pe=void 0):e.Pe.size===0&&(e.Pe=void 0),!0):!1}function Mn(e){e.Ce=void 0,e.Pe?.clear(),e.Pe=void 0}function wt(e,t,n){if(!t){e.Re=null;return}if(n instanceof W&&n.source===t){e.Re=n;return}const r=e.Re;(!(r instanceof W)||r.source!==t)&&(e.Re=new W(t))}function Wt(e,t){for(let n=e.I;n!==null;n=n.p)t(n.h);for(let n=e.N;n!==null;n=n.A)for(let r=n.I;r!==null;r=r.p)t(r.h)}function jr(e){let t=!1;const n=new Set,r=i=>{if(n.has(i)||!Br(i,e))return;n.add(i),i.Ie=F;const o=i.Ce??i.Pe?.values().next().value;if(o)wt(i,o),Ee(i);else{if(i.he&=~P,wt(i),Ee(i),i.Ge){if(i.J===Oe){const s=i;s.ee||(s.ee=!0,s.te.enqueue(J,s.ne))}else{const s=i.O&H?Y:L;s.C>i.o&&(s.C=i.o),tt(i,s)}t=!0}i.Ge=!1}Wt(i,r)};Wt(e,r),t&&Ce()}function Kr(e,t,n){let r=!1,i=!1;if(typeof t=="object"&&t!==null&&ee(()=>{r=t[Symbol.asyncIterator],i=!r&&typeof t.then=="function"}),!i&&!r)return e.ve=null,t;e.ve=t;let o;const s=l=>{e.ve===t&&(T.initTransition(Ue(e)),rn(e,l instanceof W?P:V,l),e.Ie=F)},u=(l,f)=>{if(e.ve!==t||e.O&(xe|_e))return;T.initTransition(Ue(e));const h=!!(e.he&B);Nn(e),Dn(e);const a=Ie(e);if(a&&a.F.delete(e),e.K!==void 0)e.K!==void 0&&e.K!==E?e.B=l:(e.ue=l,Le(e)),e.Ie=F;else if(a){const g=e.J,m=e.ue,p=e.ke;(!g&&h||!p||!p(l,m))&&(e.ue=l,e.Ie=F,e.Fe&&ce(e.Fe,l),Le(e,!0))}else ce(e,()=>l);jr(e),Ce(),Ne(),f?.()};if(i){let l=!1,f=!0;if(t.then(h=>{f?(o=h,l=!0):u(h)},h=>{f||s(h)}),f=!1,!l)throw T.initTransition(Ue(e)),new W(C)}if(r){const l=t[Symbol.asyncIterator]();let f=!1,h=!1;Et(()=>{if(!h){h=!0;try{const m=l.return?.();m&&typeof m.then=="function"&&m.then(void 0,()=>{})}catch{}}});const a=()=>{let m,p=!1,c=!0;return l.next().then(d=>{if(c)m=d,p=!0,d.done&&(h=!0);else{if(e.ve!==t)return;d.done?(h=!0,Ce(),Ne()):u(d.value,a)}},d=>{!c&&e.ve===t&&(h=!0,s(d))}),c=!1,p&&!m.done?(o=m.value,f=!0,a()):p&&m.done},g=a();if(!f&&!g)throw T.initTransition(Ue(e)),new W(C)}return o}function Dn(e,t=!1){(e.Ce||e.Pe)&&Mn(e),e.Ge&&(e.Ge=!1),e.he=t?0:e.he&B,e.Re&&wt(e),e.We&&Ee(e),e.xe&&e.xe()}function rn(e,t,n,r,i){t===V&&!(n instanceof Kt)&&!(n instanceof W)&&(n=new Kt(e,n));const o=t===P&&n instanceof W?n.source:void 0,s=o===e,u=t===P&&e.K!==void 0&&!s,l=u&&St(e);r||(t===P&&o?(Fr(e,o),e.he=P|e.he&B,wt(e,o,n)):(Mn(e),e.he=t|(t!==V?e.he&B:0),e.Re=n),Ee(e)),i&&!r&&Xt(e,i);const f=r||l,h=r||u?void 0:i;if(e.xe){if(r&&t===P)return;f?e.xe(t,n):e.xe();return}Wt(e,a=>{a.Ie=F,(t===P&&o&&a.Ce!==o&&!a.Pe?.has(o)||t!==P&&(a.Re!==n||a.Ce||a.Pe))&&(!f&&!a.M&&Ct(a),rn(a,t,n,f,h))})}let Ur=null;X.Ee=ue;X.Se=nt;let U=!1,re=!1,C=null,G=null;function ue(e,t=!1){const n=e.J;t||(e.M&&(!n||b)&&b!==e.M&&T.initTransition(e.M),De(e,e.O&H?Y:L),e.ve=null,e.M||n===Oe?nt(e):(e.ge!==null||e.be!==null)&&(Ln(e),e.Ae=e.be,e.Ne=e.ge,e.be=null,e.ge=null,e.me=0));let r=!!(e.O&_e);const i=e.K!==void 0&&e.K!==E,o=!!(e.he&P),s=!!(e.he&B),u=C;C=e,e.ye=null,e.O=bt,e.Ie=F;let l=e.B===E?e.ue:e.B,f=e.o,h=U,a=G;if(U=!0,r){const c=Ie(e);c&&(G=c)}else if(b&&!t&&b.Z.length)for(let c=e.P;c;c=c.D){const d=c.m;if(d.O&_e){const y=Ie(d);if(y){r=!0,G=y,e.O|=_e,Xt(e,y);break}}}const g=n&&n!==J,m=re;g&&(re=!0);try{if(e.Oe&Zt)l=e.L(l),e.ve=null;else{const c=e.ve,d=e.L(l),y=typeof d=="object"&&d!==null,w=e.ve!==c;l=w||!y?d:Kr(e,d),!w&&!y&&(e.ve=null)}if(Dn(e,t),e.G){const c=Ie(e);c&&(c.F.delete(e),Ee(c.k))}}catch(c){if(c instanceof W&&G){const d=z(G);d.k!==e&&(d.F.add(e),e.G=d,Ee(d.k))}c instanceof W&&(e.Ge=!0),rn(e,c instanceof W?P:V,c,void 0,c instanceof W?e.G:void 0)}finally{U=h,g&&(re=m),e.O=Tn|(t?e.O&Yt:0),C=u}if(!e.Re){Nn(e);const c=i?e.K:e.B===E?e.ue:e.B,d=!n&&s||!e.ke||!e.ke(c,l);if(n&&d&&(e.ee=!e.Re,t||e.te.enqueue(n,X.Te.bind(null,e))),d){const y=i?e.K:void 0;t||n&&b!==e.M||r?(e.ue=l,i&&r&&(e.K=l,e.B=l)):e.B=l,i&&!r&&o&&!e.$&&(e.K=l),(!i||r||e.K!==y)&&Le(e,r||i)}else if(i)e.B=l;else if(e.o!=f)for(let y=e.I;y!==null;y=y.p)Pn(y.h,y.h.O&H?Y:L)}G=a,(e.B!==E||e.Ne!==null||e.Ae!==null||!!(e.he&(P|B)))&&(!t||e.he&P)&&!e.M&&!(b&&i)&&Ct(e),e.M&&n&&b!==e.M&&xr(e.M,()=>ue(e))}function Fn(e){if(e.O&Je)for(let t=e.P;t;t=t.D){const n=t.m,r=n.V||n;if(r.L&&Fn(r),e.O&xe)break}(e.O&(xe|_e)||e.Re&&e.Ie<F&&!e.ve)&&ue(e),e.O=e.O&(Yt|le|Ze)}function Ot(e,t){const n=t?.transparent??!1,r={id:t?.id??(n?C?.id:C?.id!=null?en(C):void 0),Oe:(n?_t:0)|(t?.ownedWrite?$t:0)|(!C||t?.lazy?Me:0)|(t?.sync?Zt:0)|0,ke:t?.equals!=null?t.equals:jn,X:t?.unobserved,be:null,te:C?.te??T,Ve:C?.Ve??Qt,me:0,L:e,ue:void 0,o:0,N:null,T:void 0,S:null,P:null,ye:null,I:null,Ue:null,i:C,De:null,we:null,ge:null,O:t?.lazy?ht:Tn,he:B,Ie:F,B:E,Ae:null,Ne:null,ve:null,M:null};return Bn(r,t),r}function Wr(e,t,n,r,i,o){const s=o?.transparent??!1,u={id:o?.id??(s?C?.id:C?.id!=null?en(C):void 0),Oe:(s?_t:0)|(o?.ownedWrite?$t:0)|(o?.sync?Zt:0)|0,ke:!1,X:o?.unobserved,be:null,te:C?.te??T,Ve:C?.Ve??Qt,me:0,L:e,ue:void 0,o:0,N:null,T:void 0,S:null,P:null,ye:null,I:null,Ue:null,i:C,De:null,we:null,ge:null,O:ht,he:B,Ie:F,B:E,Ae:null,Ne:null,ve:null,M:null,ee:!1,Me:void 0,Qe:t,je:n,$e:void 0,Ke:!1,J:r,xe:i};return Bn(u,Vr),u}const Vr={lazy:!0};function Bn(e,t){e.S=e;const n=C?.t?C.u:C;if(C){const r=C.ge;r===null||(e.De=r,r.we=e),C.ge=e}n&&(e.o=n.o+1),!t?.lazy&&ue(e,!0)}function ze(e,t,n=null){const r={ke:t?.equals!=null?t.equals:jn,Oe:(t?.ownedWrite?$t:0)|(t?.Ye?pr:0),X:t?.unobserved,ue:e,I:null,Ue:null,Ie:F,V:n,A:n?.N||null,B:E};return n&&(n.N=r),r}function jn(e,t){return e===t}function ee(e,t){if(!U)return e();const n=U;U=!1;try{return e()}finally{U=n}}function Kn(e){let t=C;t?.t&&(t=t.u);const n=e;if(typeof n.L=="function"){const o=e;o.O&ht?(o.O&=~ht,ue(o,!0)):o.O&me&&ue(o,!0)}const r=e.V||e;if(!n.L&&r===e&&e.K===void 0&&e.pe===void 0&&b===null&&G===null)return t&&U&&je(e,t),!t||e.B===E?e.ue:e.B;if(t&&U&&(je(e,t),r.L)){const o=e.O&H;r.o>=(o?Y.C:L.C)&&(gt(t),br(o?Y:L),Fn(r));const s=r.o;s>=t.o&&e.i!==t&&(t.o=s+1)}if(r.he&P)if(t&&!(re&&r.M&&b!==r.M))if(G){const o=r.G,s=z(G);if(o&&z(o)===s&&!St(r))throw!U&&e!==t&&je(e,t),r.Re}else throw!U&&e!==t&&je(e,t),r.Re;else{if(t&&r!==e&&r.he&B)throw!U&&e!==t&&je(e,t),r.Re;if(!t&&r.he&B)throw r.Re}if(e.L&&e.he&V){if(e.Ie<F)return ue(e),Kn(e);throw e.Re}if(e.K!==void 0&&e.K!==E)return t&&re&&Er(e)?e.ue:e.K;if(b!==null&&G!==null&&e.B!==E&&r===e&&!e.L&&t)return b.se.add(t),e.ue;const i=!t||G!==null&&(e.K!==void 0||e.G||r===e&&re||r.he&P)||e.B===E||re&&e.M&&b!==e.M?e.ue:e.B;return!t&&r===e&&typeof n.L=="function"&&e.Oe&Me&&!(r.he&P)&&!e.I&&qn(e),i}function ce(e,t){e.M&&b!==e.M&&T.initTransition(e.M);const n=e.K!==void 0&&!0,r=e.K!==void 0&&e.K!==E,i=n?r?e.K:e.ue:e.B===E?e.ue:e.B;if(typeof t=="function"&&(t=t(i)),!(!e.ke||!e.ke(i,t)||!!(e.he&B)))return n&&r&&e.L&&(Le(e,!0),Ce()),t;if(n){const s=e.K===E;s||T.initTransition(Ue(e)),s&&(e.B=e.ue,T.Z.push(e)),e.$=!0;const u=_r(e);e.G=u,e.K=t}else e.B===E&&Ct(e),e.B=t;return e.We&&Ee(e),e.Fe&&ce(e.Fe,t),e.Ie=F,Le(e,n),Ce(),t}function zr(e){De(e,e.O&H?Y:L),!(e.O&Qe)&&e.B===E&&Ct(e),e.O=e.O&-4|Qe}function Gr(e,t){const n=ce(e,t);return zr(e),n}function se(e,t){const n=C,r=U;C=e,U=!1;try{return t()}finally{C=n,U=r}}function Jr(e){const t=e,n=e.V;if(e.U){const r=e.U;return r.he&P&&!(r.he&B)?!0:e.B!==E&&!(t.he&B)}if(n&&e.B!==E)return!n.ve&&!(n.he&P);if(e.K!==void 0&&e.K!==E){if(t.he&P&&!(t.he&B))return!0;if(e.U){const r=e.G?z(e.G):null;return!!(r&&r.F.size>0)}return!0}return e.K!==void 0&&e.K===E&&!e.U?!1:e.B!==E&&!(t.he&B)?!0:!!(t.he&P&&!(t.he&B))}function Ee(e){if(e.We){const t=Jr(e),n=e.We;if(ce(n,t),!t&&n.G){const r=Ie(e);if(r&&r.F.size>0){const i=z(n.G);i!==r&&kn(r,i)}mt.delete(n),n.G=void 0}}}function Hr(e,t=!0){const n=re;re=t;try{return e()}finally{re=n}}function Yr(e,t=rt()){if(!t)throw new On;const n=Qr(e,t)?t.Ve[e.id]:e.defaultValue;if(on(n))throw new mr;return n}function Zr(e,t,n=rt()){if(!n)throw new On;n.Ve={...n.Ve,[e.id]:on(t)?e.defaultValue:t}}function Qr(e,t){return!on(t?.Ve[e.id])}function on(e){return typeof e>"u"}function Un(e,t,n,r){const i=!!r?.user,o=Wr(e,t,n,i?J:ke,Xr,r);ue(o,!0),!r?.defer&&(o.J===J||r?.schedule?o.te.enqueue(o.J,Vt.bind(null,o)):Vt(o))}function Xr(e,t){const n=e!==void 0?e:this.he,r=t!==void 0?t:this.Re;if(n&V){let i=r;if(this.te.notify(this,P,0),this.J===J)try{return this.je?this.je(i,()=>{this.$e?.(),this.$e=void 0}):console.error(i)}catch(o){i=o}if(!this.te.notify(this,V,V))throw i}else this.J===ke&&this.te.notify(this,P|V,n,r)}function Vt(e){if(!(!e.ee||e.O&me)){e.$e?.(),e.$e=void 0;try{const t=e.Qe(e.ue,e.Me);e.$e=t,e.$e&&!e.Ke&&(e.Ke=!0,se(e.i,()=>Et(()=>e.$e?.())))}catch(t){if(e.Re=new Kt(e,t),e.he|=V,!e.te.notify(e,V,V))throw t}finally{e.Me=e.ue,e.ee=!1}}}X.Te=Vt;function ei(e,t){const n=()=>{if(!(!r.ee||r.O&me))try{r.ee=!1,ue(r)}finally{}},r=Ot(()=>{r.$e?.(),r.$e=void 0;const i=Hr(e);r.$e=i},{...t,lazy:!0});r.$e=void 0,r.Oe=r.Oe&~Me|An,r.ee=!0,r.J=Oe,r.xe=(i,o)=>{if((i!==void 0?i:r.he)&V){r.te.notify(r,P,0);const u=o!==void 0?o:r.Re;if(!r.te.notify(r,V,V))throw u}},r.ne=n,r.te.enqueue(J,n),Et(()=>r.$e?.())}function Wn(e){return Et(e)}function ge(e){const t=Kn.bind(null,e);return t[vr]=e,t}function ti(e,t){if(typeof e=="function"){const r=Ot(e,t);return r.Oe&=~Me,[ge(r),Gr.bind(null,r)]}const n=ze(e,t);return[ge(n),ce.bind(null,n)]}function Se(e,t){return ge(Ot(e,t))}function ni(e,t,n){Un(e,t.effect||t,t.error,{user:!0,...n})}function ri(e,t,n){Un(e,t,void 0,n)}function ii(e,t){ei(e,t)}function oi(e){const t=rt();t&&!(t.Oe&An)?ii(()=>ee(e),void 0):T.enqueue(J,()=>{e()?.()})}const si=Symbol(0),zt=Symbol(0);function hn(e){return e==null||typeof e!="object"||Object.isFrozen(e)?!1:typeof Node>"u"||!(e instanceof Node)}const Vn=Symbol(0);function gn(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function Ge(e,t,n=0){let r,i=e;if(n<t.length-1){r=t[n];const s=typeof r,u=Array.isArray(e);if(s==="string"&&gn(r))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)t[n]=r[l],Ge(e,t,n);t[n]=r;return}else if(u&&s==="function"){for(let l=0;l<e.length;l++)r(e[l],l)&&(t[n]=l,Ge(e,t,n));t[n]=r;return}else if(u&&s==="object"){const{from:l=0,to:f=e.length-1,by:h=1}=r;for(let a=l;a<=f;a+=h)t[n]=a,Ge(e,t,n);t[n]=r;return}else if(n<t.length-2){Ge(e[r],t,n+1);return}i=e[r]}let o=t[t.length-1];if(!(typeof o=="function"&&(o=o(i),o===i))&&!(r===void 0&&o==null))if(o===Vn)delete e[r];else if(r===void 0||hn(i)&&hn(o)&&!Array.isArray(o)){const s=r!==void 0?e[r]:e,u=Object.keys(o);for(let l=0;l<u.length;l++){const f=u[l];if(gn(f))continue;const h=Object.getOwnPropertyDescriptor(o,f);h.get||h.set?Object.defineProperty(s,f,h):s[f]=h.value}}else e[r]=o}Object.assign(function(...t){return n=>{Ge(n,t)}},{DELETE:Vn});function st(){return!0}const li={get(e,t,n){return t===zt?n:e.get(t)},has(e,t){return t===zt?!0:e.has(t)},set:st,deleteProperty:st,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:st,deleteProperty:st}},ownKeys(e){return e.keys()}};function Nt(e){return(e=typeof e=="function"?e():e)?e:{}}const qt=Symbol(0);function ui(...e){if(e.length===1&&typeof e[0]!="function")return e[0];let t=!1;const n=[];for(let l=0;l<e.length;l++){const f=e[l];t=t||!!f&&zt in f;const h=!!f&&f[qt];if(h)for(let a=0;a<h.length;a++)n.push(h[a]);else n.push(typeof f=="function"?(t=!0,Se(f)):f)}if(wr&&t)return new Proxy({get(l){if(l===qt)return n;for(let f=n.length-1;f>=0;f--){const h=Nt(n[f]);if(l in h)return h[l]}},has(l){for(let f=n.length-1;f>=0;f--)if(l in Nt(n[f]))return!0;return!1},keys(){const l=new Set;for(let f=0;f<n.length;f++){const h=Object.keys(Nt(n[f]));for(let a=0;a<h.length;a++)l.add(h[a])}return[...l]}},li);const r=Object.create(null);let i=!1,o=n.length-1;for(let l=o;l>=0;l--){const f=n[l];if(!f){l===o&&o--;continue}const h=Object.getOwnPropertyNames(f);for(let a=h.length-1;a>=0;a--){const g=h[a];if(!(g==="__proto__"||g==="constructor")&&!r[g]){i=i||l!==o;const m=Object.getOwnPropertyDescriptor(f,g);r[g]=m.get?{enumerable:!0,configurable:!0,get:m.get.bind(f)}:m}}}if(!i)return n[o];const s={},u=Object.keys(r);for(let l=u.length-1;l>=0;l--){const f=u[l],h=r[f];h.get?Object.defineProperty(s,f,h):s[f]=h.value}return s[qt]=n,s}function ci(e,t,n){const r=typeof n?.keyed=="function"?n.keyed:void 0,i=t.length>1,o=t,s={Ze:He(),qe:0,Be:e,ze:[],Xe:o,Je:[],et:[],tt:r,nt:r||n?.keyed===!1?[]:void 0,it:i&&n?.keyed!==!1?[]:void 0,rt:n?.keyed===!1,ot:n?.fallback},u=Ot(ai.bind(s));return s.Ze.u=u,u.Oe&=~Me,ge(u)}const lt={ownedWrite:!0};function ai(){const e=this.Be()||[],t=e.length;return e[si],se(this.Ze,()=>{let n,r,i=this.nt?this.rt?()=>(this.nt[r]=ze(e[r],lt),this.Xe(ge(this.nt[r]),r)):()=>(this.nt[r]=ze(e[r],lt),this.it&&(this.it[r]=ze(r,lt)),this.Xe(ge(this.nt[r]),this.it?ge(this.it[r]):void 0)):this.it?()=>{const o=e[r];return this.it[r]=ze(r,lt),this.Xe(o,ge(this.it[r]))}:()=>{const o=e[r];return this.Xe(o)};if(t===0)this.qe!==0&&(this.Ze.dispose(!1),this.et=[],this.ze=[],this.Je=[],this.qe=0,this.nt&&(this.nt=[]),this.it&&(this.it=[])),this.ot&&!this.Je[0]&&(this.Je[0]=se(this.et[0]=He(),this.ot));else if(this.qe===0){for(this.et[0]&&this.et[0].dispose(),this.Je=new Array(t),r=0;r<t;r++)this.ze[r]=e[r],this.Je[r]=se(this.et[r]=He(),i);this.qe=t}else{let o,s,u,l,f,h,a,g=new Array(t),m=new Array(t),p=this.nt?new Array(t):void 0,c=this.it?new Array(t):void 0;for(o=0,s=Math.min(this.qe,t);o<s&&(this.ze[o]===e[o]||this.nt&&mn(this.tt,this.ze[o],e[o]));o++)this.nt&&ce(this.nt[o],e[o]);for(s=this.qe-1,u=t-1;s>=o&&u>=o&&(this.ze[s]===e[u]||this.nt&&mn(this.tt,this.ze[s],e[u]));s--,u--)g[u]=this.Je[s],m[u]=this.et[s],p&&(p[u]=this.nt[s]),c&&(c[u]=this.it[s]);for(h=new Map,a=new Array(u+1),r=u;r>=o;r--)l=e[r],f=this.tt?this.tt(l):l,n=h.get(f),a[r]=n===void 0?-1:n,h.set(f,r);for(n=o;n<=s;n++)l=this.ze[n],f=this.tt?this.tt(l):l,r=h.get(f),r!==void 0&&r!==-1?(g[r]=this.Je[n],m[r]=this.et[n],p&&(p[r]=this.nt[n]),c&&(c[r]=this.it[n]),r=a[r],h.set(f,r)):this.et[n].dispose();for(r=o;r<t;r++)r in g?(this.Je[r]=g[r],this.et[r]=m[r],p&&(this.nt[r]=p[r],ce(this.nt[r],e[r])),c&&(this.it[r]=c[r],ce(this.it[r],r))):this.Je[r]=se(this.et[r]=He(),i);this.Je=this.Je.slice(0,this.qe=t),this.ze=e.slice(0)}}),this.Je}function mn(e,t,n){return e?e(t)===e(n):!0}function sn(e,t){if(typeof e=="function"&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e=="function"&&!e.length)}if(!(t?.skipNonRendered&&(e==null||e===!0||e===!1||e===""))){if(Array.isArray(e)){let n=[];return Gt(e,n,t)?()=>{let r=[];return Gt(n,r,{...t,doNotUnwrap:!1}),r}:n}return e}}function Gt(e,t=[],n){let r=null,i=!1;for(let o=0;o<e.length;o++)try{let s=e[o];if(typeof s=="function"&&!s.length){if(n?.doNotUnwrap){t.push(s),i=!0;continue}do s=s();while(typeof s=="function"&&!s.length)}Array.isArray(s)?i=Gt(s,t,n):n?.skipNonRendered&&(s==null||s===!0||s===!1||s==="")||t.push(s)}catch(s){if(!(s instanceof W))throw s;r=s}if(r)throw r;return i}function zn(e,t){const n=Symbol("");function r(i){return tn(()=>(Zr(r,i.value),ln(()=>i.children)))}return r.id=n,r.defaultValue=e,r}function Gn(e){return Yr(e)}function ln(e){const t=Se(e,{lazy:!0}),n=Se(()=>sn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}class Pe{static{for(const t of["all","allSettled","any","race","reject","resolve"])Pe[t]=()=>new Pe}catch(){return new Pe}then(){return new Pe}finally(){return new Pe}}const Q=(...e)=>Se(...e),M=(...e)=>ti(...e),fi=(...e)=>ri(...e),Tt=(...e)=>ni(...e);function N(e,t){return ee(()=>e(t||{}))}const di=e=>`Stale read from <${e}>.`;function ft(e){const t="fallback"in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed};return ci(()=>e.each,e.children,t)}function Jn(e){const t=e.keyed,n=Se(()=>e.when,void 0),r=t?n:Se(n,{equals:(i,o)=>!i==!o,sync:!0});return Se(()=>{const i=r();if(i){const o=e.children;return typeof o=="function"&&o.length>0?ee(t?()=>o(i):()=>o(()=>{if(!ee(r))throw di("Show");return n()})):o}return e.fallback},{sync:!0})}const K=Symbol("slot"),hi={transparent:!0,sync:!0},gi={sync:!0},Z=(e,t,n)=>fi(e,t,n?{transparent:!0,sync:!0,...n}:hi),D=e=>Q(()=>e(),gi);function mi(e,t,n,r){let i=n.length,o=t.length,s=i,u=0,l=0,f=t[o-1],h=f[K],a=f.parentNode===e&&(!h||h===r)?f.nextSibling:r||null,g=null,m,p;for(;u<o||l<s;){if(t[u]===n[l]){u++,l++;continue}for(;t[o-1]===n[s-1];)o--,s--;if(o===u){let c;if(s<i)if(l){const d=n[l-1],y=d[K];c=d.parentNode===e&&(!y||y===r)?d.nextSibling:a}else c=n[s-l];else c=a;for(;l<s;){const d=n[l++];e.insertBefore(d,c),r&&(d[K]=r)}}else if(s===l)for(;u<o;){const c=t[u++];if(!g||!g.has(c)){const d=c[K];c.parentNode===e&&(!d||d===r)&&c.remove()}}else if((m=t[u])===n[s-1]&&n[l]===t[o-1]&&m.parentNode===e&&(!(p=m[K])||p===r))if(r)do{const c=t[--o];if(e.insertBefore(c,m),c[K]=r,l++,u>=o-1||l>=s)break}while(t[u]===n[s-1]&&n[l]===t[o-1]);else do if(e.insertBefore(t[--o],m),l++,u>=o-1||l>=s)break;while(t[u]===n[s-1]&&n[l]===t[o-1]);else{if(!g){g=new Map;let d=l;for(;d<s;)g.set(n[d],d++)}const c=g.get(t[u]);if(c!=null)if(l<c&&c<s){let d=u,y=1,w;for(;++d<o&&d<s&&!((w=g.get(t[d]))==null||w!==c+y);)y++;if(y>c-l){const O=t[u],v=O[K],_=O.parentNode===e&&(!v||v===r)?O:a;for(;l<c;){const I=n[l++];e.insertBefore(I,_),r&&(I[K]=r)}}else{const O=t[u++],v=n[l++],_=O[K];O.parentNode===e&&(!_||_===r)?e.replaceChild(v,O):e.insertBefore(v,a),r&&(v[K]=r)}}else u++;else{const d=t[u++],y=d[K];d.parentNode===e&&(!y||y===r)&&d.remove()}}}}const pn="_$DX_EVENT_OWNER",yn={},Jt=new Set,qe=new Map;function pi(e,t,n,r={}){let i;wi(t);try{tn(o=>{if(i=o,t===document){const s=e();Z(()=>sn(s),()=>{})}else{const s=e();$(t,()=>s,t.firstChild?null:void 0,n,r.insertOptions)}},{id:r.renderId})}catch(o){throw i&&i(),wn(t),o}return()=>{i(),wn(t),t.textContent=""}}function yi(e,t,n){const r=document.createElement("template");return r.innerHTML=e,n===2?r.content.firstChild.firstChild:r.content.firstChild}function R(e,t){let n;return i=>(n||(n=yi(e,i,t))).cloneNode(!0)}function it(e){for(let t=0,n=e.length;t<n;t++){const r=e[t];Jt.has(r)||(Jt.add(r),qe.forEach((i,o)=>Hn(r,o,i)))}}function wi(e){const t=vi(e,e);t&&(t.roots=(t.roots||0)+1)}function wn(e){const t=qe.get(e);t&&(t.roots>1?t.roots--:delete t.roots),bi(e,e)}function vi(e,t=e){if(!e||!t)return;let n=qe.get(e);return n||qe.set(e,n={owners:new Map,handlers:new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),Jt.forEach(r=>Hn(r,e,n)),n}function bi(e,t=e){const n=qe.get(e);if(!n)return;const r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),!n.owners.size&&(n.handlers.forEach((i,o)=>e.removeEventListener(o,i)),qe.delete(e))}function Hn(e,t,n){if(n.handlers.has(e))return;const r=i=>Si(i,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}function $i(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=n._$host||n.parentNode||n.host}}function ie(e,t,n){n==null||n===!1?e.removeAttribute(t):e.setAttribute(t,n===!0?"":n)}function et(e,t,n){if(t==null||t===!1){n&&e.removeAttribute("class");return}if(typeof t=="string"){t!==n&&e.setAttribute("class",t);return}typeof n=="string"?(n={},e.removeAttribute("class")):n=bn(n||{}),t=bn(t);const r=Object.keys(t||{}),i=Object.keys(n);let o,s;for(o=0,s=i.length;o<s;o++){const u=i[o];!u||u==="undefined"||t[u]||e.classList.remove(u)}for(o=0,s=r.length;o<s;o++){const u=r[o],l=!!t[u];!u||u==="undefined"||n[u]===l||!l||e.classList.add(u)}}function vn(e,t,n,r){if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=o=>i.call(e,n[1],o))}else e.addEventListener(t,n,typeof n!="function"&&n)}function _i(e,t){Array.isArray(e)?e.flat(1/0).forEach(n=>n&&n(t)):e(t)}function vt(e,t){const n=ee(e);se(null,()=>_i(n,t))}function $(e,t,n,r,i){const o=n!==void 0;if(o&&!r&&(r=[]),typeof t!="function"&&(t=Dt(t,r,o,!0),typeof t!="function"))return Mt(e,t,r,n);if(o&&r.length===0){const u=document.createTextNode("");e.insertBefore(u,n),r=[u]}let s=r;Z(u=>{const l=Dt(t(),s,o,!0);return typeof l!="function"?l:(Z(()=>Dt(l,s,o),f=>{Mt(e,f,s,n),s=f},u!==void 0&&!(i&&i.schedule)?{...i,schedule:!0}:i),yn)},u=>{u!==yn&&(Mt(e,u,s,n),s=u)},i)}function bn(e){if(Array.isArray(e)){const t={};Yn(e,t),e=t}if(e&&typeof e=="object"){const t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r];if(!e[o])continue;const s=o.trim().split(/\s+/);for(let u=0,l=s.length;u<l;u++)s[u]&&(t[s[u]]=!0)}return t}return e}function Yn(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n];Array.isArray(i)?Yn(i,t):typeof i=="object"&&i!=null?Object.assign(t,i):(i||i===0)&&(t[i]=!0)}}function Si(e,t,n){if(e[pn])return;const r=n&&(n.owners.size===1&&n.owners.has(t)?t:$i(e.target,n)?.owner);if(n&&!r)return;e[pn]=r||!0;let i=e.target;const o=`$$${e.type}`,s=e.target,u=r||t||e.currentTarget,l=a=>Object.defineProperty(e,"target",{configurable:!0,value:a}),f=()=>{const a=i[o];if(a&&!i.disabled){const g=i[`${o}Data`];if(g!==void 0?a.call(i,g,e):a.call(i,e),e.cancelBubble)return}return i.host&&typeof i.host!="string"&&!i.host._$host&&i.contains(e.target)&&l(i.host),!0},h=()=>{for(;f()&&!(i===u||i.parentNode===u);)i=i._$host||i.parentNode||i.host};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return i||u||document}}),e.composedPath){const a=e.composedPath();if(a.length){l(a[0]);for(let g=0;g<a.length&&(i=a[g],!!f());g++){if(i._$host){i=i._$host,h();break}if(i===u||i.parentNode===u)break}}else h()}else h();l(s)}function Mt(e,t,n,r){if(t===n)return;const i=typeof t,o=r!==void 0;if(i==="string"||i==="number"){const s=typeof n;s==="string"||s==="number"?e.firstChild.data=t:e.textContent=t}else if(t===void 0)ut(e,n,r);else if(t.nodeType)Array.isArray(n)?ut(e,n,o?r:null,t):n&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),r&&(t[K]=r);else if(Array.isArray(t)){const s=n&&Array.isArray(n);t.length===0?ut(e,n,r):s?n.length===0?$n(e,t,r):mi(e,n,t,r):(n&&ut(e),$n(e,t))}}function Dt(e,t,n,r){if(e=sn(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e=="function")return e;if(n&&!Array.isArray(e)&&(e=[e??""]),Array.isArray(e))for(let i=0,o=e.length;i<o;i++){const s=e[i],u=t&&t[i],l=typeof s;(l==="string"||l==="number")&&(e[i]=u&&u.nodeType===3&&u.data===""+s?u:document.createTextNode(s))}return e}function $n(e,t,n=null){for(let r=0,i=t.length;r<i;r++){const o=t[r];e.insertBefore(o,n),n&&(o[K]=n)}}function ut(e,t,n,r){if(n===void 0)return e.textContent="";if(t.length){let i=!1;for(let o=t.length-1;o>=0;o--){const s=t[o];if(r!==s){const u=s[K],l=s.parentNode===e&&(!u||u===n);r&&!i&&!o?l?e.replaceChild(r,s):e.insertBefore(r,n):l&&s.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&n&&(r[K]=n)}const Ci=!1;function Ei(e,t,n,r={}){try{const i=pi(e,t,n,{...r,insertOptions:{schedule:!0}});return Ne(),i}finally{}}function Zn(){let e=new Set;function t(i){return e.add(i),()=>e.delete(i)}let n=!1;function r(i,o){if(n)return!(n=!1);const s={to:i,options:o,defaultPrevented:!1,preventDefault:()=>s.defaultPrevented=!0};for(const u of e)u.listener({...s,from:u.location,retry:l=>{l&&(n=!0),u.navigate(i,{...o,resolve:!1})}});return!s.defaultPrevented}return{subscribe:t,confirm:r}}let Ht;function un(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),Ht=window.history.state._depth}un();function Oi(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function Ti(e,t){let n=!1;return()=>{const r=Ht;un();const i=r==null?null:Ht-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}const Ai=/^(?:[a-z0-9]+:)?\/\//i,Ri=/^\/+|(\/)\/+$/g,Qn="http://sr";function Ye(e,t=!1){const n=e.replace(Ri,"$1");return n?t||/^[?#]/.test(n)?n:"/"+n:""}function dt(e,t,n){if(Ai.test(t))return;const r=Ye(e),i=n&&Ye(n);let o="";return!i||t.startsWith("/")?o=r:i.toLowerCase().indexOf(r.toLowerCase())!==0?o=r+i:o=i,(o||"/")+Ye(t,!o)}function Pi(e,t){if(e==null)throw new Error(t);return e}function ki(e,t){return Ye(e).replace(/\/*(\*.*)?$/g,"")+Ye(t)}function Xn(e){const t={};return e.searchParams.forEach((n,r)=>{r in t?Array.isArray(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n}),t}function Ii(e,t,n){const[r,i]=e.split("/*",2),o=r.split("/").filter(Boolean),s=o.length;return u=>{const l=u.split("/").filter(Boolean),f=l.length-s;if(f<0||f>0&&i===void 0&&!t)return null;const h={path:s?"":"/",params:{}},a=g=>n===void 0?void 0:n[g];for(let g=0;g<s;g++){const m=o[g],p=m[0]===":",c=p?l[g]:l[g].toLowerCase(),d=p?m.slice(1):m.toLowerCase();if(p&&Ft(c,a(d)))h.params[d]=c;else if(p||!Ft(c,d))return null;h.path+=`/${c}`}if(i){const g=f?l.slice(-f).join("/"):"";if(Ft(g,a(i)))h.params[i]=g;else return null}return h}}function Ft(e,t){const n=r=>r===e;return t===void 0?!0:typeof t=="string"?n(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(n):t instanceof RegExp?t.test(e):!1}function xi(e){const[t,n]=e.pattern.split("/*",2),r=t.split("/").filter(Boolean);return r.reduce((i,o)=>i+(o.startsWith(":")?2:3),r.length-(n===void 0?0:1))}function er(e){const t=new Map,n=rt();return new Proxy({},{get(r,i){return t.has(i)||se(n,()=>t.set(i,Q(()=>e()[i]))),t.get(i)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(r,i){return i in e()}})}function tr(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let n=e.slice(0,t.index),r=e.slice(t.index+t[0].length);const i=[n,n+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(r);)i.push(n+=t[1]),r=r.slice(t[0].length);return tr(r).reduce((o,s)=>[...o,...i.map(u=>u+s)],[])}const Li=100,nr=zn(),rr=zn();function Ni(e){try{return Gn(e)}catch{return}}const ir=()=>Pi(Gn(nr),"<A> and 'use' router primitives can be only used inside a Route."),or=()=>ir().navigatorFactory(),qi=()=>ir().params;function Mi(e,t=""){const{component:n,preload:r,children:i,info:o}=e,s=!i||Array.isArray(i)&&!i.length,u={key:e,component:n,preload:r,info:o};return sr(e.path).reduce((l,f)=>{for(const h of tr(f)){const a=ki(t,h);let g=s?a:a.split("/*",1)[0];g=g.split("/").map(m=>m.startsWith(":")||m.startsWith("*")?m:encodeURIComponent(m)).join("/"),l.push({...u,originalPath:f,pattern:g,matcher:Ii(g,!s,e.matchFilters)})}return l},[])}function Di(e,t=0){return{routes:e,score:xi(e[e.length-1])*1e4-t,matcher(n){const r=[];for(let i=e.length-1;i>=0;i--){const o=e[i],s=o.matcher(n);if(!s)return null;r.unshift({...s,route:o})}return r}}}function sr(e){return Array.isArray(e)?e:[e]}function lr(e,t="",n=[],r=[]){const i=sr(e);for(let o=0,s=i.length;o<s;o++){const u=i[o];if(u&&typeof u=="object"){u.hasOwnProperty("path")||(u.path="");const l=Mi(u,t);for(const f of l){n.push(f);const h=Array.isArray(u.children)&&u.children.length===0;if(u.children&&!h)lr(u.children,f.pattern,n,r);else{const a=Di([...n],r.length);r.push(a)}n.pop()}}}return n.length?r:r.sort((o,s)=>s.score-o.score)}function Bt(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n].matcher(t);if(i)return i}return[]}function Fi(e,t,n){const r=new URL(Qn),i=Q((h=r)=>{const a=e();try{return new URL(a,r)}catch{return console.error(`Invalid path ${a}`),h}},{equals:(h,a)=>h.href===a.href}),o=Q(()=>i().pathname),s=Q(()=>i().search),u=Q(()=>i().hash),l=()=>"",f=Q(()=>Xn(i()));return{get pathname(){return o()},get search(){return s()},get hash(){return u()},get state(){return t()},get key(){return l()},query:n?n(f):er(f)}}let $e;function Bi(){return $e}function ji(e,t,n,r={}){const{signal:[i,o],utils:s={}}=e,u=s.parsePath||(k=>k),l=s.renderPath||(k=>k),f=s.beforeLeave||Zn(),h=dt("",r.base||""),a=ee(i);if(h===void 0)throw new Error(`${h} is not a valid base path`);h&&!a.value&&o({value:h,replace:!0,scroll:!1});const[g,m]=M(!1,{ownedWrite:!0}),[p,c]=M(void 0,{ownedWrite:!0});let d;const y=Q(()=>p()??i()),w=Fi(()=>y().value,()=>y().state,s.queryWrapper),O=[],v=M([],{ownedWrite:!0}),_=Q(()=>typeof r.transformUrl=="function"?Bt(t(),r.transformUrl(w.pathname)):Bt(t(),w.pathname)),I=()=>{const k=_(),x={};for(let j=0;j<k.length;j++)Object.assign(x,k[j].params);return x},pe=s.paramsWrapper?s.paramsWrapper(I,t):er(I),ye={pattern:h,path:()=>h,outlet:()=>null,resolvePath(k){return dt(h,k)}};return{base:ye,location:w,params:pe,isRouting:g,renderPath:l,parsePath:u,navigatorFactory:ve,matches:_,beforeLeave:f,preloadRoute:Te,singleFlight:r.singleFlight===void 0?!0:r.singleFlight,submissions:v};function we(k,x,j){ee(()=>{if(typeof x=="number"){x&&(s.go?s.go(x):console.warn("Router integration does not support relative routing"));return}const ae=!x||x[0]==="?",{replace:Ae,resolve:fe,scroll:Re,state:ne}={replace:!1,resolve:!ae,scroll:!0,...j},be=fe?k.resolvePath(x):dt(ae&&w.pathname||"",x);if(be===void 0)throw new Error(`Path '${x}' is not a routable path`);if(O.length>=Li)throw new Error("Too many redirects");const de=y();if((be!==de.value||ne!==de.state)&&!Ci){if(f.confirm(be,j)){O.push({value:de.value,replace:Ae,scroll:Re,state:de.state});const he={value:be,state:ne};d===void 0&&(m(!0),Ne()),$e="navigate",d=he,d===he&&(c({...d}),queueMicrotask(()=>{d===he&&($e=void 0,Fe(d),c(void 0),m(!1),d=void 0)}))}}})}function ve(k){return k=k||Ni(rr)||ye,(x,j)=>we(k,x,j)}function Fe(k){const x=O[0];x&&(o({...k,replace:x.replace,scroll:x.scroll}),O.length=0)}function Te(k,x){const j=Bt(t(),k.pathname),ae=$e;$e="preload";for(let Ae in j){const{route:fe,params:Re}=j[Ae];fe.component&&fe.component.preload&&fe.component.preload();const{preload:ne}=fe;x&&ne&&se(n(),()=>ne({params:Re,location:{pathname:k.pathname,search:k.search,hash:k.hash,query:Xn(k),state:null,key:""},intent:"preload"}))}$e=ae}}function Ki(e,t,n,r){const{base:i,location:o,params:s}=e,{pattern:u,component:l,preload:f}=r().route,h=Q(()=>r().path);l&&l.preload&&l.preload();const a=f?f({params:s,location:o,intent:$e||"initial"}):void 0;return{parent:t,pattern:u,path:h,outlet:()=>l?N(l,{params:s,location:o,data:a,get children(){return n()}}):n(),resolvePath(m){return dt(i.path(),m,h())}}}const Ui=e=>function(n){const{base:r,singleFlight:i,transformUrl:o,root:s,rootPreload:u,routeChildren:l}=ee(()=>({base:n.base,singleFlight:n.singleFlight,transformUrl:n.transformUrl,root:n.root,rootPreload:n.rootPreload,routeChildren:n.children})),f=ln(()=>l),h=Q(()=>lr(f(),r||""));let a;const g=ji(e,h,()=>a,{base:r,singleFlight:i,transformUrl:o});return e.create&&e.create(g),N(nr,{value:g,get children(){return N(Wi,{routerState:g,root:s,preload:u,get children(){return[D(()=>(a=rt())&&null),N(Vi,{routerState:g,get branches(){return h()}})]}})}})};function Wi(e){const t=e.routerState.location,n=e.routerState.params,r=Q(()=>e.preload&&ee(()=>{e.preload({params:n,location:t,intent:Bi()||"initial"})})),i=e.root;return i?N(i,{params:n,location:t,get data(){return r()},get children(){return e.children}}):e.children}function Vi(e){const t=[];let n,r;const i=Q(s=>{const u=e.routerState.matches(),l=r;let f=l&&u.length===l.length;const h=[];for(let a=0,g=u.length;a<g;a++){const m=l&&l[a],p=u[a];s&&m&&p.route.key===m.route.key?h[a]=s[a]:(f=!1,t[a]&&t[a](),tn(c=>{t[a]=c,h[a]=Ki(e.routerState,h[a-1]||e.routerState.base,_n(()=>i()?.[a+1]),()=>{const d=e.routerState.matches();return d[a]??d[0]})}))}return t.splice(u.length).forEach(a=>a()),s&&f?(r=u,s):(n=h[0],r=u,h)}),o=_n(()=>i()&&n);return D(o)}const _n=e=>()=>{const t=e();if(t)return N(rr,{value:t,get children(){return t.outlet()}})},Sn=e=>{const t=ln(()=>e.children);return ui(e,{get children(){return t()}})};function zi(e){let t=!1;const n=s=>typeof s=="string"?{value:s}:s,[r,i]=M(n(e.get()),{equals:(s,u)=>s.value===u.value&&s.state===u.state,ownedWrite:!0}),o=[r,s=>{!t&&e.set(s),i(s)}];return e.init&&Wn(e.init((s=e.get())=>{t=!0,o[1](n(s)),t=!1})),Ui({signal:o,create:e.create,utils:e.utils})}function Gi(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function Ji(e,t){const n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}const Hi=new Map;function Yi({preload:e=!0,explicitLinks:t=!1,actionBase:n="/_server",transformUrl:r}={}){return i=>{const o=i.base.path(),s=i.navigatorFactory(i.base);let u,l;function f(c){return c.namespaceURI==="http://www.w3.org/2000/svg"}function h(c){if(c.defaultPrevented||c.button!==0||c.metaKey||c.altKey||c.ctrlKey||c.shiftKey)return;const d=c.composedPath().find(I=>I instanceof Node&&I.nodeName.toUpperCase()==="A");if(!d||t&&!d.hasAttribute("link"))return;const y=f(d),w=y?d.href.baseVal:d.href;if((y?d.target.baseVal:d.target)||!w&&!d.hasAttribute("state"))return;const v=(d.getAttribute("rel")||"").split(/\s+/);if(d.hasAttribute("download")||v&&v.includes("external"))return;const _=y?new URL(w,document.baseURI):new URL(w);if(!(_.origin!==window.location.origin||o&&_.pathname&&!_.pathname.toLowerCase().startsWith(o.toLowerCase())))return[d,_]}function a(c){const d=h(c);if(!d)return;const[y,w]=d,O=i.parsePath(w.pathname+w.search+w.hash),v=y.getAttribute("state");c.preventDefault(),s(O,{resolve:!1,replace:y.hasAttribute("replace"),scroll:!y.hasAttribute("noscroll"),state:v?JSON.parse(v):void 0})}function g(c){const d=h(c);if(!d)return;const[y,w]=d;r&&(w.pathname=r(w.pathname)),i.preloadRoute(w,y.getAttribute("preload")!=="false")}function m(c){clearTimeout(u);const d=h(c);if(!d)return l=null;const[y,w]=d;l!==y&&(r&&(w.pathname=r(w.pathname)),u=setTimeout(()=>{i.preloadRoute(w,y.getAttribute("preload")!=="false"),l=y},20))}function p(c){if(c.defaultPrevented)return;let d=c.submitter&&c.submitter.hasAttribute("formaction")?c.submitter.getAttribute("formaction"):c.target.getAttribute("action");if(!d)return;if(!d.startsWith("https://action/")){const w=new URL(d,Qn);if(d=i.parsePath(w.pathname+w.search),!d.startsWith(n))return}if(c.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const y=Hi.get(d);if(y){c.preventDefault();const w=new FormData(c.target,c.submitter);y.call({r:i,f:c.target},c.target.enctype==="multipart/form-data"?w:new URLSearchParams(w))}}it(["click","submit"]),document.addEventListener("click",a),e&&(document.addEventListener("mousemove",m,{passive:!0}),document.addEventListener("focusin",g,{passive:!0}),document.addEventListener("touchstart",g,{passive:!0})),document.addEventListener("submit",p),Wn(()=>{document.removeEventListener("click",a),e&&(document.removeEventListener("mousemove",m),document.removeEventListener("focusin",g),document.removeEventListener("touchstart",g)),document.removeEventListener("submit",p)})}}function Zi(e){const t=()=>{const r=window.location.pathname.replace(/^\/+/,"/")+window.location.search,i=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:r+window.location.hash,state:i}},n=Zn();return zi({get:t,set({value:r,replace:i,scroll:o,state:s}){i?window.history.replaceState(Oi(s),"",r):window.history.pushState(s,"",r),Ji(decodeURIComponent(window.location.hash.slice(1)),o),un()},init:r=>Gi(window,"popstate",Ti(r,i=>{if(i)return!n.confirm(i);{const o=t();return!n.confirm(o.value,{state:o.state})}})),create:Yi({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:r=>window.history.go(r),beforeLeave:n}})(e)}var Qi=R('<div class=chat><div class=chat-messages></div><div class=chat-input><input type=text placeholder="Type a message..."><button type=button>Send'),Xi=R("<span class=chat-user>"),eo=R("<span class=chat-time>"),to=R("<div><div class=chat-content>");function no(e){let t,n;Tt(()=>e.messages.length,()=>{n&&n.lastElementChild&&n.lastElementChild.scrollIntoView({behavior:"instant"})});const[r,i]=M(""),o=()=>{const c=r().trim();c&&(e.onSend(c),i(""),t?.focus())},s=c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),o())},u=c=>{try{const d=new Date(c),y=Math.floor((Date.now()-d.getTime())/1e3);if(y<60)return"just now";const w=Math.floor(y/60);if(w<60)return`${w}m ago`;const O=Math.floor(w/60);return O<24?`${O}h ago`:d.toLocaleDateString([],{month:"short",day:"numeric"})}catch{return c}};var l=Qi(),f=l.firstChild,h=f.nextSibling,a=h.firstChild,g=a.nextSibling,m=n;typeof m=="function"||Array.isArray(m)?vt(()=>m,f):n=f,$(f,N(ft,{get each(){return e.messages},children:c=>(()=>{var d=to(),y=d.firstChild;return $(d,N(Jn,{get when(){return c.msg_type!=="system"},get children(){return[(()=>{var w=Xi();return $(w,()=>c.user_name),w})(),(()=>{var w=eo();return $(w,()=>u(c.created_at)),w})()]}}),y),$(y,()=>c.content),Z(()=>`chat-message${c.msg_type==="system"?" system":""}`,(w,O)=>{et(d,w,O)}),d})()})),a.$$keydown=s,a.$$input=c=>i(c.currentTarget.value);var p=t;return typeof p=="function"||Array.isArray(p)?vt(()=>p,a):t=a,g.$$click=o,Z(()=>({e:r(),t:!r().trim()}),({e:c,t:d},y)=>{a.value=c??"",d!==y?.t&&ie(g,"disabled",d)}),l}it(["input","keydown","click"]);function ro(e){return!e||typeof e!="object"?null:"room_name"in e&&typeof e.room_name=="string"?{kind:"state",data:e}:"user_name"in e&&"content"in e?{kind:"chat",data:e}:null}function io(e,t,n){const i=`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}/api/v1/ws/${e}?name=${encodeURIComponent(t)}`;let o=new WebSocket(i),s=[],u=!1;function l(f){o?.readyState===WebSocket.OPEN?o.send(f):s.push(f)}return o.onopen=()=>{u=!0;for(const f of s)o?.send(f);s=[]},o.onmessage=f=>{if(typeof f.data=="string")try{const h=JSON.parse(f.data),a=ro(h);a?.kind==="state"?n.onState(a.data):a?.kind==="chat"&&n.onChat(a.data)}catch{}},o.onclose=f=>{o=null,u?f.code!==1e3&&f.code!==1001&&n.onError(`Connection lost (code: ${f.code})`):n.onError("Failed to connect to room"),n.onDisconnect()},o.onerror=()=>{o?.close()},f=>{l(JSON.stringify(f))}}function ur([e,t],n={}){Tt(()=>e(),r=>{if(!r||n.unless?.(r))return;const i=setTimeout(()=>t(null),n.ms??5e3);return()=>clearTimeout(i)})}function oo(e,t){const[n,r]=M(null),[i,o]=M([]),[s,u]=M(!1),[l,f]=M(null),[h,a]=M(null),g={current:!0},m=()=>{if(h())return;const c=io(e,t,{onState:d=>{g.current=!1,r(d)},onChat:d=>o(y=>{const w=[...y,d];return w.length>200?w.slice(-200):w}),onDisconnect:()=>{u(!1),a(null)},onError:d=>{f(d)}});a(()=>c),u(!0),f(null)};return oi(()=>{m(),setTimeout(()=>{g.current&&f("Room not found or unavailable")},8e3)}),Tt(()=>[s(),h()],([c,d])=>{if(!c&&!d){const y=setTimeout(m,3e3);return()=>clearTimeout(y)}}),ur([l,f],{unless:c=>c.includes("not found")}),{state:n,chats:i,connected:s,error:l,setError:f,send:c=>h()?.(c)}}var so=R("<div class=player>"),lo=R("<div class=player-idle>Paste a URL to start watching together"),uo=R("<div class=player-info><div class=player-meta><strong class=player-title></strong><span class=player-duration-row><span class=duration-label></span><span class=elapsed-label>"),co=R("<div class=player-media-wrap><div class=player-media></div><button type=button>"),ao=R("<img class=player-thumb alt>"),fo=R("<video controls><track kind=captions>"),ho=R("<audio controls><track kind=captions>");const cr="moqbox-volume",Cn=()=>parseFloat(localStorage.getItem(cr)||"0.5");function go(e){const t=Math.round(e.volume*100)/100;localStorage.setItem(cr,t.toString())}function mo(e){const t=e.url.split(".").pop()?.toLowerCase();return t?["mp3","m4a","ogg","wav","flac","aac"].includes(t)?!1:(["mp4","webm","mov","mkv","avi","m4v"].includes(t),!0):!0}function jt(e,t){const n=(Date.now()-t)/1e3;e.currentTime=n}function po(e){let t;const[n,r]=M(!0),i=e.roomId,o=a=>{t&&t.removeEventListener("volumechange",s),t=a??void 0,a&&(a.volume=Cn(),a.addEventListener("volumechange",s))},s=()=>{const a=t;a&&go(a)};let u=null;Tt(()=>{const a=e.track;return u=a,a?.started_at?a.id:null},(a,g)=>{if(a===g)return;const m=u,p=t;if(!p||!m?.started_at){p&&p.pause(),r(!0);return}const c=m.started_at,d=`/api/v1/rooms/${i}/media/${m.hash}`;p.src=d,p.volume=Cn();let y;const w=()=>{jt(p,c);const v=()=>{r(!0),p.play().catch(()=>{}),y=()=>{const _=u?.started_at;if(!_)return;const I=(Date.now()-_)/1e3;r(Math.abs(p.currentTime-I)<.5)},p.addEventListener("timeupdate",y),p.addEventListener("pause",O)};p.addEventListener("seeked",v,{once:!0})};p.addEventListener("loadedmetadata",w,{once:!0}),p.addEventListener("canplay",w,{once:!0});const O=()=>{p.ended||jt(p,c)};return()=>{p.removeEventListener("loadedmetadata",w),p.removeEventListener("canplay",w),y&&p.removeEventListener("timeupdate",y),p.removeEventListener("pause",O)}});const l=a=>{if(a<1)return"--:--";const g=Math.floor(a/1e3),m=Math.floor(g/60),p=g%60;return`${m}:${p.toString().padStart(2,"0")}`},f=()=>{const a=t,g=e.track?.started_at;a&&g&&(jt(a,g),r(!0))};var h=so();return $(h,N(Jn,{get when(){return e.track},get fallback(){return lo()},children:a=>{const g=a();return[(()=>{var m=uo(),p=m.firstChild,c=p.firstChild,d=c.nextSibling,y=d.firstChild,w=y.nextSibling;return $(m,(()=>{var O=D(()=>!!g.thumbnail);return()=>O()&&(()=>{var v=ao();return v.addEventListener("error",_=>_.currentTarget.hidden=!0),Z(()=>g.thumbnail,_=>{ie(v,"src",_)}),v})()})(),p),$(c,()=>g.title),$(y,()=>g.duration),$(w,()=>l(Date.now()-g.started_at)),m})(),(()=>{var m=co(),p=m.firstChild,c=p.nextSibling;return $(p,(()=>{var d=D(()=>!!mo(g));return()=>d()?(()=>{var y=fo();return vn(y,"ended",e.onEnded),vt(()=>o,y),y})():(()=>{var y=ho();return vn(y,"ended",e.onEnded),vt(()=>o,y),y})()})()),c.$$click=f,$(c,()=>n()?"Live":"Go live"),Z(()=>["live-btn",n()&&"live-btn--on"],(d,y)=>{et(c,d,y)}),m})()]}})),h}it(["click"]);var yo=R("<div><span class=queue-title></span><span class=queue-duration>"),wo=R("<img class=queue-thumb alt>"),vo=R('<div class=queue-panel><div class=queue-section><h3>Now Playing</h3></div><div class=queue-section><h3>Up Next (<!>)</h3></div><div class=queue-section><h3>Playlist (<!>)</h3><div class=playlist-controls><label class=playlist-toggle><input type=checkbox><span>Autoplay</span></label><label class=playlist-threshold title="Skip when this percent of the room votes"><span class=playlist-threshold-label>Skip ≥ <!>%</span><input type=range min=0 max=100 step=1></label></div></div><div class=queue-section><h3>Recently Played'),bo=R("<div class=queue-empty>Paste a URL to start watching together"),$o=R('<button type=button class=queue-shuffle title="Shuffle up next">⇄ Shuffle'),_o=R("<div class=queue-item-row>"),So=R('<div class=queue-item-actions><button type=button class=queue-item-action title="Move up">▲</button><button type=button class=queue-item-action title="Move down">▼</button><button type=button class="queue-item-action queue-item-remove"title="Remove from queue">×'),Co=R("<div class=queue-empty>Tracks you add will appear here"),Eo=R('<div class=queue-item-row><button type=button class="queue-item-action queue-item-remove"title="Remove from playlist">×'),Oo=R("<div class=queue-empty>Add links to build a perpetual playlist"),To=R('<div class=queue-item-row><button type=button class=queue-item-action title="Add to playlist">+'),Ao=R("<div class=queue-empty>Recently played tracks show up here");function ct(e){var t=yo(),n=t.firstChild,r=n.nextSibling;return $(t,(()=>{var i=D(()=>!!e.thumbnail);return()=>i()&&(()=>{var o=wo();return o.addEventListener("error",s=>s.currentTarget.hidden=!0),Z(()=>e.thumbnail,s=>{ie(o,"src",s)}),o})()})(),n),$(n,()=>e.pending?"⏳ ":"",null),$(n,()=>e.title,null),$(r,()=>e.duration),Z(()=>`queue-item${e.extraClass?" "+e.extraClass:""}`,(i,o)=>{et(t,i,o)}),t}function Ro(e){var t=vo(),n=t.firstChild;n.firstChild;var r=n.nextSibling,i=r.firstChild,o=i.firstChild,s=o.nextSibling;s.nextSibling;var u=r.nextSibling,l=u.firstChild,f=l.firstChild,h=f.nextSibling;h.nextSibling;var a=l.nextSibling,g=a.firstChild,m=g.firstChild,p=g.nextSibling,c=p.firstChild,d=c.firstChild,y=d.nextSibling;y.nextSibling;var w=c.nextSibling,O=u.nextSibling;return O.firstChild,$(n,(()=>{var v=D(()=>!!e.currentTrack);return()=>v()?N(ct,{get title(){return e.currentTrack.title},get duration(){return e.currentTrack.duration},get thumbnail(){return e.currentTrack.thumbnail},extraClass:"current"}):bo()})(),null),$(i,()=>e.queue.length,s),$(i,(()=>{var v=D(()=>!!(e.onShuffleQueue&&e.queue.length>1));return()=>v()&&(()=>{var _=$o();return _.$$click=()=>e.onShuffleQueue?.(),_})()})(),null),$(r,N(ft,{get each(){return e.queue},children:(v,_)=>(()=>{var I=_o();return $(I,N(ct,{get title(){return v.title},get duration(){return v.duration},get thumbnail(){return v.thumbnail},get pending(){return v.pending}}),null),$(I,(()=>{var pe=D(()=>!!e.onMoveQueueItem);return()=>pe()&&(()=>{var ye=So(),we=ye.firstChild,ve=we.nextSibling,Fe=ve.nextSibling;return we.$$click=()=>e.onMoveQueueItem?.(_(),_()-1),ve.$$click=()=>e.onMoveQueueItem?.(_(),_()+1),Fe.$$click=()=>e.onRemoveQueueItem?.(v.id),Z(()=>({e:_()===0,t:_()===e.queue.length-1}),({e:Te,t:k},x)=>{Te!==x?.e&&ie(we,"disabled",Te),k!==x?.t&&ie(ve,"disabled",k)}),ye})()})(),null),I})()}),null),$(r,(()=>{var v=D(()=>e.queue.length===0);return()=>v()&&Co()})(),null),$(l,()=>e.playlist.length,h),m.addEventListener("change",v=>e.onSetAutoplay?.(v.currentTarget.checked)),$(c,()=>e.skipThreshold,y),w.$$input=v=>e.onSetSkipThreshold?.(parseInt(v.currentTarget.value,10)),$(u,N(ft,{get each(){return e.playlist},children:v=>(()=>{var _=Eo(),I=_.firstChild;return $(_,N(ct,{get title(){return v.title},get duration(){return v.duration},get thumbnail(){return v.thumbnail},get pending(){return v.pending}}),I),I.$$click=()=>e.onRemoveFromPlaylist?.(v.id),_})()}),null),$(u,(()=>{var v=D(()=>e.playlist.length===0);return()=>v()&&Oo()})(),null),$(O,N(ft,{get each(){return e.history},children:v=>(()=>{var _=To(),I=_.firstChild;return $(_,N(ct,{get title(){return v.title},get duration(){return v.duration},get thumbnail(){return v.thumbnail},extraClass:"history"}),I),I.$$click=()=>e.onAddToPlaylist?.(v.url),_})()}),null),$(O,(()=>{var v=D(()=>e.history.length===0);return()=>v()&&Ao()})(),null),Z(()=>({e:e.autoplayEnabled,t:e.playlist.length===0,a:e.skipThreshold}),({e:v,t:_,a:I},pe)=>{m.checked=v,_!==pe?.t&&ie(m,"disabled",_),w.value=I??""}),t}it(["input","click"]);const ar="moqbox-theme";function fr(e){const t=document.documentElement;e==="latte"?(t.setAttribute("data-theme","latte"),t.style.colorScheme="light"):e==="macchiato"?(t.setAttribute("data-theme","macchiato"),t.style.colorScheme="dark"):(t.removeAttribute("data-theme"),t.style.colorScheme="light dark"),localStorage.setItem(ar,e)}function Po(e){return e==="macchiato"?"latte":e==="latte"?"system":"macchiato"}function dr(){return localStorage.getItem(ar)||"system"}var ko=R('<div class=home><h1>moqbox</h1><p>Watch videos together with friends</p><div class=home-form><input type=text placeholder="Your name"><button type=button>'),Io=R('<div class="toast toast-error"role=alert>'),xo=R('<div class=room><header class=room-header><h2></h2><span class=client-count></span></header><div class=room-layout><div class=room-main><div class=room-actions><button type=button></button><button type=button class="secondary vote-skip"title="Cast a vote to skip the current track">Skip</button></div></div><div class=room-sidebar><div class=room-footer><button type=button class=theme-toggle-sm>'),Lo=R("<span class=disconnected>Disconnected"),No=R('<div class="toast toast-error"role=alert><span></span><button type=button class=toast-action>Go back'),qo=R("<span class=vote-count>"),Mo=R('<div class=inline-form><input type=text placeholder="Paste a YouTube / media URL..."><div class=add-target-toggle><button type=button>Queue</button><button type=button>Playlist</button></div><button type=button>');const Do=()=>{const e=or(),[t,n]=M(""),[r,i]=M(!1),[o,s]=M(null);ur([o,s]);const u=async()=>{if(t().trim()){i(!0);try{const p=await fetch("/api/v1/rooms",{method:"POST"});if(!p.ok)throw new Error(`create room: ${p.status}`);const c=await p.json();e(`/r/${c.room_name}?name=${encodeURIComponent(t().trim())}`)}catch(p){console.error("Failed to create room:",p),s("Failed to create room"),i(!1)}}};var l=ko(),f=l.firstChild,h=f.nextSibling,a=h.nextSibling,g=a.firstChild,m=g.nextSibling;return g.$$keydown=p=>p.key==="Enter"&&u(),g.$$input=p=>n(p.currentTarget.value),m.$$click=u,$(m,()=>r()?"Creating...":"Create Room"),$(l,(()=>{var p=D(()=>!!o());return()=>p()&&(()=>{var c=Io();return $(c,o),c})()})(),null),Z(()=>({e:t(),t:r()||!t().trim()}),({e:p,t:c},d)=>{g.value=p??"",c!==d?.t&&ie(m,"disabled",c)}),l},Fo=()=>{const e=qi(),t=ee(()=>e.name),r=new URLSearchParams(location.search).get("name")||"anonymous",i=or(),[o,s]=M(dr()),u=()=>{const S=Po(o());fr(S),s(S)},{state:l,chats:f,connected:h,error:a,setError:g,send:m}=oo(t,r),[p,c]=M(!1),[d,y]=M(""),[w,O]=M("queue"),[v,_]=M(!1),I=async()=>{const S=d().trim();if(S){_(!0);try{const A=w()==="queue"?"/api/v1/ingest":"/api/v1/playlist/add",q=await fetch(A,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:S,room_id:t})});if(!q.ok){if(q.status===429){const oe=q.headers.get("Retry-After");g(oe?`Too fast — try again in ${oe}s`:"Too fast — try again in a moment")}else{const oe=await q.json().catch(()=>({error:q.statusText}));g(oe.error||`${w()} failed`)}return}y(""),c(!1),g(null)}catch(A){g(String(A))}finally{_(!1)}}},pe=async S=>{try{const A=await fetch("/api/v1/playlist/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:S,room_id:t})});if(!A.ok){const q=await A.json().catch(()=>({error:A.statusText}));g(q.error||"Failed to add to playlist")}}catch(A){g(String(A))}},ye=async S=>{try{const A=await fetch("/api/v1/playlist/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:t,id:S})});if(!A.ok){const q=await A.json().catch(()=>({error:A.statusText}));g(q.error||"Failed to remove from playlist")}}catch(A){g(String(A))}},we=S=>{m({type:"set_autoplay",enabled:S})},ve=S=>{m({type:"set_skip_threshold",percent:S})},Fe=()=>{m({type:"vote_skip"})},Te=(S,A)=>{S!==A&&m({type:"move_queue_item",from:S,to:A})},k=()=>{m({type:"shuffle_queue"})},x=S=>{m({type:"remove_queue_item",item_id:S})};var j=xo(),ae=j.firstChild,Ae=ae.firstChild,fe=Ae.nextSibling,Re=ae.nextSibling,ne=Re.firstChild,be=ne.firstChild,de=be.firstChild,he=de.nextSibling;he.firstChild;var At=ne.nextSibling,Rt=At.firstChild,Pt=Rt.firstChild;return $(Ae,()=>l()?.room_name??"Loading..."),$(fe,(()=>{var S=D(()=>l()?.clients!=null);return()=>S()?`${l()?.clients} connected`:""})()),$(ae,(()=>{var S=D(()=>!h());return()=>S()&&Lo()})(),null),$(j,(()=>{var S=D(()=>!!a());return()=>S()&&(()=>{var A=No(),q=A.firstChild,oe=q.nextSibling;return $(q,a),oe.$$click=()=>i("/"),A})()})(),Re),$(ne,N(po,{get track(){return l()?.current_track??null},roomId:t,onEnded:()=>{const S=l()?.current_track;S&&m({type:"track_ended",item_id:S.id})}}),be),de.$$click=()=>{c(!p())},$(de,()=>p()?"Cancel":"Add"),he.$$click=Fe,$(he,(()=>{var S=D(()=>(l()?.skip_votes??0)>0);return()=>S()&&(()=>{var A=qo();return $(A,()=>l()?.skip_votes),A})()})(),null),$(ne,(()=>{var S=D(()=>!!p());return()=>S()&&(()=>{var A=Mo(),q=A.firstChild,oe=q.nextSibling,kt=oe.firstChild,cn=kt.nextSibling,It=oe.nextSibling;return q.$$keydown=Be=>Be.key==="Enter"&&I(),q.$$input=Be=>y(Be.currentTarget.value),kt.$$click=()=>O("queue"),cn.$$click=()=>O("playlist"),It.$$click=I,$(It,()=>v()?"Adding...":"Add"),Z(()=>({e:d(),t:w()==="queue"?"active":"",a:w()==="playlist"?"active":"",o:v()||!d().trim()}),({e:Be,t:hr,a:gr,o:an},xt)=>{q.value=Be??"",et(kt,hr,xt?.t),et(cn,gr,xt?.a),an!==xt?.o&&ie(It,"disabled",an)}),A})()})(),null),$(At,N(Ro,{get currentTrack(){return l()?.current_track??null},get queue(){return l()?.queue??[]},get history(){return l()?.history??[]},get playlist(){return l()?.playlist??[]},get autoplayEnabled(){return l()?.autoplay_enabled??!0},get skipThreshold(){return l()?.skip_threshold??34},onAddToPlaylist:pe,onRemoveFromPlaylist:ye,onSetAutoplay:we,onSetSkipThreshold:ve,onMoveQueueItem:Te,onShuffleQueue:k,onRemoveQueueItem:x}),Rt),$(At,N(no,{get messages(){return f()},onSend:S=>m({type:"chat",content:S})}),Rt),Pt.$$click=u,$(Pt,(()=>{var S=D(()=>o()==="macchiato");return()=>S()?"Dark":o()==="latte"?"Light":"System"})()),Z(()=>({e:!l()?.current_track,t:`Theme: ${o()}`}),({e:S,t:A},q)=>{S!==q?.e&&ie(he,"disabled",S),A!==q?.t&&ie(Pt,"title",A)}),j},Bo=()=>(fr(dr()),N(Zi,{get children(){return[N(Sn,{path:"/",component:Do}),N(Sn,{path:"/r/:name",component:Fo})]}}));it(["input","keydown","click"]);const En=document.getElementById("root");En&&Ei(()=>N(Bo,{}),En);
+2 -2
static/dist/index.html
··· 10 10 if (t === "latte") { document.documentElement.style.colorScheme = "light"; } 11 11 else if (t === "macchiato") { document.documentElement.setAttribute("data-theme", "macchiato"); document.documentElement.style.colorScheme = "dark"; } 12 12 </script> 13 - <script type="module" crossorigin src="/assets/index-B3kVSRJi.js"></script> 14 - <link rel="stylesheet" crossorigin href="/assets/index-DrH7LpDB.css"> 13 + <script type="module" crossorigin src="/assets/index-Dz6fefYY.js"></script> 14 + <link rel="stylesheet" crossorigin href="/assets/index-B2UJYwrh.css"> 15 15 </head> 16 16 <body> 17 17 <div id="root"></div>