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.

state, frontend: reorder and shuffle up-next queue

karitham (Jun 1, 2026, 1:07 PM +0200) 8b710f75 09ead6ad

+473 -23
+13
frontend/src/App.tsx
··· 149 149 send({ type: "set_playlist_enabled", enabled }); 150 150 }; 151 151 152 + // Reorder an item in the up-next queue. 0-indexed. 153 + const handleMoveQueueItem = (from: number, to: number) => { 154 + if (from === to) return; 155 + send({ type: "move_queue_item", from, to }); 156 + }; 157 + 158 + // Shuffle the up-next queue. Server picks the seed. 159 + const handleShuffleQueue = () => { 160 + send({ type: "shuffle_queue" }); 161 + }; 162 + 152 163 return ( 153 164 <div class="room"> 154 165 <header class="room-header"> ··· 240 251 onAddToPlaylist={handleAddToPlaylist} 241 252 onRemoveFromPlaylist={handleRemoveFromPlaylist} 242 253 onTogglePlaylist={handleTogglePlaylist} 254 + onMoveQueueItem={handleMoveQueueItem} 255 + onShuffleQueue={handleShuffleQueue} 243 256 /> 244 257 <Chat messages={chats()} onSend={(content) => send({ type: "chat", content })} /> 245 258 <div class="room-footer">
+46 -8
frontend/src/Queue.tsx
··· 38 38 onAddToPlaylist?: (url: string) => void; 39 39 onRemoveFromPlaylist?: (id: string) => void; 40 40 onTogglePlaylist?: (enabled: boolean) => void; 41 + onMoveQueueItem?: (from: number, to: number) => void; 42 + onShuffleQueue?: () => void; 41 43 } 42 44 43 45 export function Queue(props: QueueProps) { ··· 58 60 </div> 59 61 60 62 <div class="queue-section"> 61 - <h3>Up Next ({props.queue.length})</h3> 63 + <h3> 64 + Up Next ({props.queue.length}) 65 + {props.onShuffleQueue && props.queue.length > 1 && ( 66 + <button 67 + type="button" 68 + class="queue-shuffle" 69 + title="Shuffle up next" 70 + onClick={() => props.onShuffleQueue?.()} 71 + > 72 + ⇄ Shuffle 73 + </button> 74 + )} 75 + </h3> 62 76 <For each={props.queue}> 63 - {(item) => ( 64 - <QueueItem 65 - title={item.title} 66 - duration={item.duration} 67 - thumbnail={item.thumbnail} 68 - pending={item.pending} 69 - /> 77 + {(item, index) => ( 78 + <div class="queue-item-row"> 79 + <QueueItem 80 + title={item.title} 81 + duration={item.duration} 82 + thumbnail={item.thumbnail} 83 + pending={item.pending} 84 + /> 85 + {props.onMoveQueueItem && ( 86 + <div class="queue-item-actions"> 87 + <button 88 + type="button" 89 + class="queue-item-action" 90 + title="Move up" 91 + disabled={index() === 0} 92 + onClick={() => props.onMoveQueueItem?.(index(), index() - 1)} 93 + > 94 + 95 + </button> 96 + <button 97 + type="button" 98 + class="queue-item-action" 99 + title="Move down" 100 + disabled={index() === props.queue.length - 1} 101 + onClick={() => props.onMoveQueueItem?.(index(), index() + 1)} 102 + > 103 + 104 + </button> 105 + </div> 106 + )} 107 + </div> 70 108 )} 71 109 </For> 72 110 {props.queue.length === 0 && <div class="queue-empty">Tracks you add will appear here</div>}
+59
frontend/src/style.css
··· 421 421 margin-bottom: 0.4rem; 422 422 letter-spacing: 0.06em; 423 423 font-weight: 700; 424 + display: flex; 425 + align-items: center; 426 + justify-content: space-between; 427 + gap: 0.5rem; 428 + } 429 + .queue-shuffle { 430 + font-size: 0.7rem; 431 + font-weight: 600; 432 + text-transform: none; 433 + letter-spacing: 0; 434 + padding: 0.15rem 0.5rem; 435 + border: 1px solid var(--border); 436 + border-radius: 4px; 437 + background: var(--surface); 438 + color: var(--text-muted); 439 + cursor: pointer; 440 + transition: 441 + color 0.15s, 442 + border-color 0.15s, 443 + background 0.15s; 444 + } 445 + .queue-shuffle:hover { 446 + color: var(--accent); 447 + border-color: var(--accent); 448 + background: var(--surface-raised); 449 + } 450 + .queue-item-actions { 451 + display: flex; 452 + gap: 0.15rem; 453 + flex-shrink: 0; 454 + } 455 + .queue-item-actions .queue-item-action { 456 + display: flex; 457 + font-size: 0.85rem; 458 + width: 20px; 459 + height: 20px; 460 + } 461 + .queue-item-actions .queue-item-action:disabled { 462 + opacity: 0.25; 463 + cursor: not-allowed; 464 + } 465 + .queue-item-actions .queue-item-action:disabled:hover { 466 + color: var(--text-muted); 467 + background: none; 468 + } 469 + .playlist-toggle { 470 + display: inline-flex; 471 + align-items: center; 472 + gap: 0.3rem; 473 + text-transform: none; 474 + letter-spacing: 0; 475 + font-size: 0.72rem; 476 + color: var(--text-muted); 477 + cursor: pointer; 478 + user-select: none; 479 + } 480 + .playlist-toggle input { 481 + margin: 0; 482 + cursor: pointer; 424 483 } 425 484 .queue-item { 426 485 display: flex;
+3 -1
frontend/src/types.ts
··· 66 66 | { type: "skip" } 67 67 | { type: "track_ended"; item_id: string } 68 68 | { type: "set_playlist_enabled"; enabled: boolean } 69 - | { type: "ping" }; 69 + | { type: "ping" } 70 + | { type: "move_queue_item"; from: number; to: number } 71 + | { type: "shuffle_queue" };
+34
src/room.rs
··· 62 62 SetPlaylistEnabled(bool), 63 63 PublishState, 64 64 Shutdown, 65 + MoveQueueItem { 66 + from: usize, 67 + to: usize, 68 + }, 69 + ShuffleQueue, 65 70 } 66 71 67 72 /// Per-room event-loop actor. Owns all mutable state. ··· 399 404 } 400 405 RoomCommand::PublishState => self.handle_publish_state().await, 401 406 RoomCommand::Shutdown => self.handle_shutdown().await, 407 + RoomCommand::MoveQueueItem { from, to } => self.handle_move_queue_item(from, to).await, 408 + RoomCommand::ShuffleQueue => self.handle_shuffle_queue().await, 402 409 } 403 410 } 404 411 ··· 670 677 if effects.is_empty() { 671 678 return false; 672 679 } 680 + self.execute_effects(effects).await; 681 + false 682 + } 683 + 684 + /// Reorder a single track in the queue. Out-of-range or no-op moves 685 + /// return no effects from the state machine; everything is persisted 686 + /// before the snapshot goes out. 687 + async fn handle_move_queue_item(&mut self, from: usize, to: usize) -> bool { 688 + let effects = self.state.transition(&Event::MoveQueueItem { from, to }, 0); 689 + if effects.is_empty() { 690 + return false; 691 + } 692 + self.persist_effects(&effects).await; 693 + self.execute_effects(effects).await; 694 + false 695 + } 696 + 697 + /// Shuffle the queue using a server-picked seed. The seed comes from the 698 + /// wall clock so concurrent shuffles are independent, and clients can't 699 + /// predict or replay each other's shuffles. 700 + async fn handle_shuffle_queue(&mut self) -> bool { 701 + let seed = Utc::now().timestamp_nanos_opt().unwrap_or(0) as u64; 702 + let effects = self.state.transition(&Event::ShuffleQueue { seed }, 0); 703 + if effects.is_empty() { 704 + return false; 705 + } 706 + self.persist_effects(&effects).await; 673 707 self.execute_effects(effects).await; 674 708 false 675 709 }
+262 -7
src/state.rs
··· 90 90 PlaylistEntryRemoved(PlaylistEntryId), 91 91 /// Toggle the perpetual playlist on/off. 92 92 SetPlaylistEnabled(bool), 93 + /// Reorder a track within the up-next queue. 94 + /// `from` and `to` are 0-based queue indices. `from == to` is a no-op. 95 + /// Indices out of range or queue empty are no-ops. 96 + MoveQueueItem { from: usize, to: usize }, 97 + /// Shuffle the up-next queue deterministically. Same seed → same result. 98 + /// Empty/single-item queues are no-ops. Active track is not affected. 99 + ShuffleQueue { seed: u64 }, 93 100 } 94 101 95 102 /// Side effects to execute after a transition. ··· 135 142 }, 136 143 /// Remove a playlist entry. 137 144 RemovePlaylistEntry(PlaylistEntryId), 145 + /// Renumber queue positions to match `new_order`. Emitted by both 146 + /// move and shuffle operations; the store updates the `position` 147 + /// column for every queued track so a fresh `SELECT ... ORDER BY 148 + /// position` returns the new order. 149 + ReorderQueue { new_order: Vec<TrackId> }, 138 150 } 139 151 140 152 /// Pure playback state: no IO handles, no DB connections. ··· 189 201 Event::PlaylistEntryAdded(entry) => self.handle_playlist_entry_added(entry), 190 202 Event::PlaylistEntryRemoved(id) => self.handle_playlist_entry_removed(*id), 191 203 Event::SetPlaylistEnabled(enabled) => self.handle_set_playlist_enabled(*enabled), 204 + Event::MoveQueueItem { from, to } => self.handle_move_queue_item(*from, *to), 205 + Event::ShuffleQueue { seed } => self.handle_shuffle_queue(*seed), 192 206 } 193 207 } 194 208 ··· 488 502 Some(entry) 489 503 } 490 504 505 + /// Reorder a track within the up-next queue. `from` and `to` are 506 + /// 0-based queue indices. The active track is not affected. No-op if 507 + /// either index is out of range, the queue is empty, or `from == to`. 508 + fn handle_move_queue_item(&mut self, from: usize, to: usize) -> Vec<Effect> { 509 + if from == to || from >= self.queue.len() || to >= self.queue.len() { 510 + return Vec::new(); 511 + } 512 + let track = self.queue.remove(from); 513 + self.queue.insert(to, track); 514 + let new_order: Vec<TrackId> = self.queue.iter().map(|t| t.id).collect(); 515 + vec![Effect::ReorderQueue { new_order }, Effect::PublishSnapshot] 516 + } 517 + 518 + /// Shuffle the up-next queue deterministically. Same seed → same order. 519 + /// Fisher-Yates with a splitmix64 PRNG seeded by the caller. 520 + /// No-op for queues with fewer than 2 items. 521 + fn handle_shuffle_queue(&mut self, seed: u64) -> Vec<Effect> { 522 + if self.queue.len() < 2 { 523 + return Vec::new(); 524 + } 525 + let mut rng = SplitMix64::new(seed); 526 + let n = self.queue.len(); 527 + // Fisher-Yates: walk from the end, swap each element with a random earlier one. 528 + for i in (1..n).rev() { 529 + let j = (rng.next() as usize) % (i + 1); 530 + self.queue.swap(i, j); 531 + } 532 + let new_order: Vec<TrackId> = self.queue.iter().map(|t| t.id).collect(); 533 + vec![Effect::ReorderQueue { new_order }, Effect::PublishSnapshot] 534 + } 535 + 491 536 /// Pop the first track from the queue and start playing it. 492 537 /// 493 538 /// Returns effects for starting the pipeline and publishing state. ··· 557 602 } 558 603 559 604 (state, effects) 605 + } 606 + } 607 + 608 + /// Tiny splitmix64 PRNG — deterministic, no dependencies, good enough for 609 + /// shuffling a user-visible queue. Not cryptographic. 610 + struct SplitMix64(u64); 611 + 612 + impl SplitMix64 { 613 + fn new(seed: u64) -> Self { 614 + Self(seed) 615 + } 616 + 617 + fn next(&mut self) -> u64 { 618 + self.0 = self.0.wrapping_add(0x9E3779B97F4A7C15); 619 + let mut z = self.0; 620 + z = (z ^ (z >> 30)).wrapping_mul(0xBF58476D1CE4E5B9); 621 + z = (z ^ (z >> 27)).wrapping_mul(0x94D049BB133111EB); 622 + z ^ (z >> 31) 560 623 } 561 624 } 562 625 ··· 1472 1535 // Active track should be the queued one. 1473 1536 assert_eq!(s.active.as_ref().unwrap().title, "PL"); 1474 1537 } 1538 + 1539 + // --- queue reorder / shuffle --- 1540 + 1541 + fn qid(n: u128) -> QueuedTrack { 1542 + QueuedTrack { 1543 + id: track_id(n), 1544 + title: format!("Q{n}"), 1545 + url: format!("https://example.com/q{n}"), 1546 + duration: "1:00".into(), 1547 + thumbnail: None, 1548 + pending: false, 1549 + } 1550 + } 1551 + 1552 + fn queue_with(n: usize) -> (PlaybackState, Vec<TrackId>) { 1553 + // Queue `n` tracks. The first becomes active (idle room); the rest 1554 + // sit in the queue. Total TrackQueued events = n + 1. 1555 + let mut s = PlaybackState::default(); 1556 + let active = qid(0); 1557 + let mut ids = vec![active.id]; 1558 + s.transition(&Event::TrackQueued(active), 0); 1559 + for i in 0..n { 1560 + let t = qid((i + 1) as u128); 1561 + ids.push(t.id); 1562 + s.transition(&Event::TrackQueued(t), 0); 1563 + } 1564 + (s, ids) 1565 + } 1566 + 1567 + #[test] 1568 + fn test_move_queue_item_basic() { 1569 + // Queue (after queue_with): [B, C, D]. Active is A. Move from 0 to 2 → [C, D, B]. 1570 + let (mut s, ids) = queue_with(3); 1571 + let effects = s.transition(&Event::MoveQueueItem { from: 0, to: 2 }, 0); 1572 + assert_eq!(s.queue[0].id, ids[2]); 1573 + assert_eq!(s.queue[1].id, ids[3]); 1574 + assert_eq!(s.queue[2].id, ids[1]); 1575 + // Effect carries the new queue order so the store can renumber. 1576 + assert!(effects.iter().any(|e| matches!( 1577 + e, 1578 + Effect::ReorderQueue { new_order } if new_order == &vec![ids[2], ids[3], ids[1]] 1579 + ))); 1580 + assert!(effects.iter().any(|e| matches!(e, Effect::PublishSnapshot))); 1581 + } 1582 + 1583 + #[test] 1584 + fn test_move_queue_item_same_index_is_noop() { 1585 + let (mut s, ids) = queue_with(3); 1586 + let effects = s.transition(&Event::MoveQueueItem { from: 1, to: 1 }, 0); 1587 + assert_eq!(s.queue[0].id, ids[1]); 1588 + assert!(effects.is_empty()); 1589 + } 1590 + 1591 + #[test] 1592 + fn test_move_queue_item_out_of_range_is_noop() { 1593 + let (mut s, _ids) = queue_with(3); 1594 + let effects = s.transition(&Event::MoveQueueItem { from: 5, to: 0 }, 0); 1595 + assert_eq!(s.queue.len(), 3); 1596 + assert!(effects.is_empty()); 1597 + let effects = s.transition(&Event::MoveQueueItem { from: 0, to: 5 }, 0); 1598 + assert!(effects.is_empty()); 1599 + } 1600 + 1601 + #[test] 1602 + fn test_move_queue_item_empty_queue_is_noop() { 1603 + let mut s = PlaybackState::default(); 1604 + let effects = s.transition(&Event::MoveQueueItem { from: 0, to: 0 }, 0); 1605 + assert!(effects.is_empty()); 1606 + } 1607 + 1608 + #[test] 1609 + fn test_shuffle_queue_deterministic() { 1610 + // Same seed → same order. Run twice and compare. 1611 + let (mut s1, _) = queue_with(8); 1612 + let (mut s2, _) = queue_with(8); 1613 + s1.transition(&Event::ShuffleQueue { seed: 42 }, 0); 1614 + s2.transition(&Event::ShuffleQueue { seed: 42 }, 0); 1615 + let order1: Vec<TrackId> = s1.queue.iter().map(|t| t.id).collect(); 1616 + let order2: Vec<TrackId> = s2.queue.iter().map(|t| t.id).collect(); 1617 + assert_eq!(order1, order2); 1618 + } 1619 + 1620 + #[test] 1621 + fn test_shuffle_queue_different_seeds_diverge() { 1622 + // Two different seeds → almost certainly different orders. 1623 + // (Birthday-paradox: collision chance with 8 items is ~1/2000.) 1624 + let (mut s1, _) = queue_with(8); 1625 + let (mut s2, _) = queue_with(8); 1626 + s1.transition(&Event::ShuffleQueue { seed: 1 }, 0); 1627 + s2.transition(&Event::ShuffleQueue { seed: 2 }, 0); 1628 + let order1: Vec<TrackId> = s1.queue.iter().map(|t| t.id).collect(); 1629 + let order2: Vec<TrackId> = s2.queue.iter().map(|t| t.id).collect(); 1630 + assert_ne!(order1, order2); 1631 + } 1632 + 1633 + #[test] 1634 + fn test_shuffle_queue_preserves_count() { 1635 + let (mut s, ids) = queue_with(10); 1636 + s.transition(&Event::ShuffleQueue { seed: 99 }, 0); 1637 + assert_eq!(s.queue.len(), 10); 1638 + // ids[0] is the active track; ids[1..] are the queue. 1639 + let mut sorted: Vec<_> = s.queue.iter().map(|t| t.id).collect(); 1640 + sorted.sort_by_key(|id| id.0.as_u128()); 1641 + let mut expected: Vec<_> = ids[1..].to_vec(); 1642 + expected.sort_by_key(|id| id.0.as_u128()); 1643 + assert_eq!(sorted, expected); 1644 + } 1645 + 1646 + #[test] 1647 + fn test_shuffle_queue_singleton_is_noop() { 1648 + let (mut s, ids) = queue_with(1); 1649 + let effects = s.transition(&Event::ShuffleQueue { seed: 0 }, 0); 1650 + assert_eq!(s.queue[0].id, ids[1]); 1651 + assert!(effects.is_empty()); 1652 + } 1653 + 1654 + #[test] 1655 + fn test_shuffle_queue_empty_is_noop() { 1656 + let mut s = PlaybackState::default(); 1657 + let effects = s.transition(&Event::ShuffleQueue { seed: 0 }, 0); 1658 + assert!(effects.is_empty()); 1659 + } 1660 + 1661 + #[test] 1662 + fn test_shuffle_queue_does_not_affect_active() { 1663 + // Active track stays put; the shuffle permutes only the queue Vec. 1664 + let (mut s, _ids) = queue_with(5); 1665 + let original_active = s.active.as_ref().unwrap().id; 1666 + s.transition(&Event::ShuffleQueue { seed: 7 }, 0); 1667 + assert_eq!(s.active.as_ref().unwrap().id, original_active); 1668 + assert_eq!(s.queue.len(), 5); 1669 + } 1475 1670 } 1476 1671 1477 1672 /// Deterministic simulation testing: random event sequences with invariant ··· 1506 1701 MetadataUpdated(u64), 1507 1702 DownloadResolved(u64), 1508 1703 DownloadFailed(u64), 1704 + MoveQueueItem { from: u8, to: u8 }, 1705 + ShuffleQueue { seed: u64 }, 1509 1706 } 1510 1707 1511 1708 fn op_strategy() -> impl Strategy<Value = Vec<Op>> { 1709 + // Move and shuffle are weighted higher than the other ops so the new 1710 + // handlers get meaningful coverage in the 1024-case run. 1512 1711 let op = prop_oneof![ 1513 - (0u64..12).prop_map(Op::Queue), 1514 - Just(Op::Skip), 1515 - (0u64..12).prop_map(Op::TrackEnded), 1516 - (0u64..12).prop_map(Op::TrackFailed), 1517 - (0u64..12).prop_map(Op::MetadataUpdated), 1518 - (0u64..12).prop_map(Op::DownloadResolved), 1519 - (0u64..12).prop_map(Op::DownloadFailed), 1712 + 2 => (0u64..12).prop_map(Op::Queue), 1713 + 1 => Just(Op::Skip), 1714 + 1 => (0u64..12).prop_map(Op::TrackEnded), 1715 + 1 => (0u64..12).prop_map(Op::TrackFailed), 1716 + 1 => (0u64..12).prop_map(Op::MetadataUpdated), 1717 + 1 => (0u64..12).prop_map(Op::DownloadResolved), 1718 + 1 => (0u64..12).prop_map(Op::DownloadFailed), 1719 + 3 => (0u8..16, 0u8..16).prop_map(|(from, to)| Op::MoveQueueItem { from, to }), 1720 + 2 => (0u64..1000).prop_map(|seed| Op::ShuffleQueue { seed }), 1520 1721 ]; 1521 1722 proptest::collection::vec(op, 0..50) 1522 1723 } ··· 1622 1823 Some(&crate::state::MediaStatus::Failed(format!("err-{n}"))), 1623 1824 "DownloadFailed({url}) did not record Failed in media_cache", 1624 1825 ); 1826 + effects 1827 + } 1828 + Op::MoveQueueItem { from, to } => { 1829 + // The handler is a no-op for out-of-range or equal indices. 1830 + let queue_len = state.queue.len(); 1831 + let from_in = (*from as usize) < queue_len; 1832 + let to_in = (*to as usize) < queue_len; 1833 + let changed = from_in && to_in && from != to; 1834 + let expected_ids: Vec<_> = if changed { 1835 + let mut q = state.queue.clone(); 1836 + let t = q.remove(*from as usize); 1837 + q.insert(*to as usize, t); 1838 + q.into_iter().map(|t| t.id).collect() 1839 + } else { 1840 + state.queue.iter().map(|t| t.id).collect() 1841 + }; 1842 + let effects = state.transition( 1843 + &Event::MoveQueueItem { 1844 + from: *from as usize, 1845 + to: *to as usize, 1846 + }, 1847 + 0, 1848 + ); 1849 + let actual_ids: Vec<_> = state.queue.iter().map(|t| t.id).collect(); 1850 + assert_eq!( 1851 + actual_ids, expected_ids, 1852 + "MoveQueueItem {from},{to} produced wrong order", 1853 + ); 1854 + if changed { 1855 + assert!(effects.iter().any(|e| matches!(e, Effect::PublishSnapshot))); 1856 + } else { 1857 + assert!(effects.is_empty(), "no-op move should return no effects"); 1858 + } 1859 + effects 1860 + } 1861 + Op::ShuffleQueue { seed } => { 1862 + // Same seed → same order. Record the order, run the op, 1863 + // and verify the queue contains the same track IDs 1864 + // (it's a permutation, not a transformation). 1865 + let pre: std::collections::HashSet<_> = 1866 + state.queue.iter().map(|t| t.id).collect(); 1867 + let effects = state.transition(&Event::ShuffleQueue { seed: *seed }, 0); 1868 + let post: std::collections::HashSet<_> = 1869 + state.queue.iter().map(|t| t.id).collect(); 1870 + assert_eq!(pre, post, "shuffle must be a permutation"); 1871 + if state.queue.len() >= 2 { 1872 + assert!(effects.iter().any(|e| matches!(e, Effect::PublishSnapshot))); 1873 + } else { 1874 + assert!(effects.is_empty(), "tiny queue should be a no-op"); 1875 + } 1625 1876 effects 1626 1877 } 1627 1878 }; ··· 1797 2048 } 1798 2049 1799 2050 proptest! { 2051 + #![proptest_config(ProptestConfig { 2052 + cases: 1024, 2053 + ..ProptestConfig::default() 2054 + })] 1800 2055 #[test] 1801 2056 fn dst_random_sequences_invariants_hold(ops in op_strategy()) { 1802 2057 apply_ops(&ops);
+28
src/store.rs
··· 292 292 Effect::RemovePlaylistEntry(id) => { 293 293 room.playlist.retain(|e| e.id != *id); 294 294 } 295 + Effect::ReorderQueue { new_order } => { 296 + // The state machine's in-memory `room.queue` is already in 297 + // the new order; this arm keeps the effect exhaustively 298 + // matched. The SQLite path handles position renumbering. 299 + let _ = new_order; 300 + } 295 301 _ => {} 296 302 } 297 303 } ··· 590 596 .bind(id.as_str_buf()) 591 597 .execute(&mut *tx) 592 598 .await?; 599 + } 600 + Effect::ReorderQueue { new_order } => { 601 + // Renumber every queued track's position to its index in 602 + // new_order. Limit to un-played, un-started rows so we 603 + // never touch the active or history rows. Using indexed 604 + // UPDATEs (one per row) is fine for queues of typical 605 + // size (< 100). 606 + for (i, track_id) in new_order.iter().enumerate() { 607 + sqlx::query( 608 + "UPDATE tracks 609 + SET position = ?1 610 + WHERE id = ?2 611 + AND room_id = ?3 612 + AND played = 0 613 + AND started_at_ms IS NULL", 614 + ) 615 + .bind(i as i64) 616 + .bind(track_id.as_str_buf()) 617 + .bind(room_id) 618 + .execute(&mut *tx) 619 + .await?; 620 + } 593 621 } 594 622 _ => {} 595 623 }
+24 -3
src/transport.rs
··· 26 26 #[derive(Deserialize)] 27 27 #[serde(tag = "type", rename_all = "snake_case")] 28 28 enum WsClientMessage { 29 - Chat { content: String }, 29 + Chat { 30 + content: String, 31 + }, 30 32 Skip, 31 - TrackEnded { item_id: TrackId }, 32 - SetPlaylistEnabled { enabled: bool }, 33 + TrackEnded { 34 + item_id: TrackId, 35 + }, 36 + SetPlaylistEnabled { 37 + enabled: bool, 38 + }, 33 39 Ping, 40 + /// Move a queue item from one position to another. 0-indexed. 41 + MoveQueueItem { 42 + from: usize, 43 + to: usize, 44 + }, 45 + /// Shuffle the entire queue (server picks the seed). 46 + ShuffleQueue, 34 47 } 35 48 36 49 /// Run a WebSocket session for a single client. ··· 127 140 } 128 141 WsClientMessage::Ping => { 129 142 let _ = ws_tx.send(Message::Ping(Bytes::new())).await; 143 + } 144 + WsClientMessage::MoveQueueItem { from, to } => { 145 + let _ = cmd_tx 146 + .send(RoomCommand::MoveQueueItem { from, to }) 147 + .await; 148 + } 149 + WsClientMessage::ShuffleQueue => { 150 + let _ = cmd_tx.send(RoomCommand::ShuffleQueue).await; 130 151 } 131 152 } 132 153 }
+1 -1
static/dist/assets/index-DGSP7qCt.css 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}.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 + :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-DnsnxcTM.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 Ft extends Error{source;constructor(t,n){super(n instanceof Error?n.message:String(n),{cause:n}),this.source=t}}class Sn extends Error{constructor(){super("")}}class dr extends Error{constructor(){super("")}}const En=0,Ve=1,Pe=2,pt=4,le=8,Je=16,J=32,ye=64,$e=128,Gt=256,at=512,He=1024,wt=1,hr=2,bt=4,gr=8,Cn=16,xe=32,Jt=64,O=1,W=2,F=4,Ae=1,G=2,Ce=3,_={},yr=typeof Proxy=="function",Ht={},mr=Symbol("refresh");function On(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&(le|pt|He)||(n&Ve?e.O=n&-4|Pe|le:e.O=n|le,n&Je||On(e,t))}function Tn(e,t){let n=e.O;n&(le|pt|Je|He)||(e.O=n|Je,On(e,t))}function Ne(e,t){const n=e.O;if(!(n&(le|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 pr(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&&ft(n)}}function ft(e,t=Pe){const n=e.O;if(!((n&(Ve|Pe))>=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&le?t(n):wr(n,e),n=e.l[e.C]}e._=0}function wr(e,t){Ne(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)Tn(r.h,t)}}const dt=new WeakMap,te=new Set;function br(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),te.add(t),e.$=!1,t}function V(e){for(;e.H;)e=e.H;return e}function An(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 Re(e){const t=e.G;if(!t)return;const n=V(t);if(te.has(n))return n;e.G=void 0}function Be(e){return Re(e)?.M??e.M}function vt(e){return e.K!==void 0&&e.K!==_}function Yt(e,t){const n=V(t),r=e.G;if(r){if(r.H){e.G=t;return}const i=V(r);if(te.has(i)){i!==n&&!vt(e)&&(n.j&&V(n.j)===i?e.G=t:i.j&&V(i.j)===n||An(n,i));return}}e.G=t}const je=new Set,I={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0},H={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0};let M=0,b=null,Ye=!1,Bt=0,lt=null;const Ke=new Set;function vr(e){return je.size===0&&te.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===_&&(e.K!==void 0&&e.K!==_||(Ke.delete(e),e.X?.()))}}function _r(e){return!!lt?.has(e)}function nt(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]=[],gt(n,e))}}function Sr(e){for(let t=e.I;t!==null;t=t.p){const n=t.h;if(!n.J)continue;if(n.J===Ce){n.ee||(n.ee=!0,n.te.enqueue(G,n.ne));continue}const r=n.O&J?H:I;r.C>n.o&&(r.C=n.o),Qe(n,r)}}function Er(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 Cr(e){for(let t=0;t<e.length;t++){const n=e[t];n.G=void 0,n.B!==_&&(n.ue=n.B,n.B=_);const r=n.K;n.K=_,r!==_&&n.ue!==r&&ke(n,!0),n.M=null}e.length=0}function Or(e){for(const t of te)(e?t.M===e:!t.M)&&(t.H||(t.W[0].length&&gt(t.W[0],Ae),t.W[1].length&&gt(t.W[1],G)),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),dt.delete(t.k))}function Se(){Ye||(Ye=!0,!Bt&&!E.ce&&queueMicrotask(Ie))}let Tr=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&&(z?V(z).W[t-1].push(n):this.le[t-1].push(n)),Se()}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 Tr{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(I,X.Ee),b){if(!Rr(b)){const r=b;if(Fe(H,X.Ee),this.ae=null,this.fe=[],this.Z=[],this.q=new Set,nt(Ae),nt(G),this.stashQueues(r._e),M++,Ye=I._>=I.C,cn(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),Sr(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,cn(this.fe),kt(n)}else vr(this)?(ht(),I._>=I.C&&(Fe(I,X.Ee),ht())):(je.size&&Fe(H,X.Ee),kt());M++,Ye=I._>=I.C,te.size&&nt(Ae),this.run(Ae),te.size&&nt(G),this.run(G)}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&&Se()}}return!0}return!1}initTransition(t){if(t&&(t=Pn(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;Er(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 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 $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||z,r=e.pe!==void 0;for(let i=e.I;i!==null;i=i.p){if(r&&i.h.Oe&gr){i.h.O|=Gt;continue}t&&n?(i.h.O|=$e,Yt(i.h,n)):t&&(i.h.O|=$e,i.h.G=void 0);const o=i.h;if(o.J===Ce){o.ee||(o.ee=!0,o.te.enqueue(G,o.ne));continue}const s=i.h.O&J?H:I;s.C>i.h.o&&(s.C=i.h.o),Qe(i.h,s)}}function un(e){const t=e;if(!t.L){e.B!==_&&(e.ue=e.B,e.B=_);return}e.B!==_&&(e.ue=e.B,e.B=_,e.J&&e.J!==Ce&&(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&&(un(E.ae),E.ae=null);const e=E.fe;for(let t=0;t<e.length;t++)un(e[t]);e.length=0}function kt(e=null,t=!1){const n=!t;n&&ht(),!t&&E.Y.length&&Rn(E);const r=I._>=I.C;if(r&&Fe(I,X.Ee),n){if(r&&ht(),Cr(e?e.Z:E.Z),e&&e.se.size){for(const i of e.se){if(i.O&ye)continue;if(i.J===Ce){i.ee||(i.ee=!0,i.te.enqueue(G,i.ne));continue}const o=i.O&J?H:I;o.C>i.o&&(o.C=i.o),Qe(i,o)}e.se.clear()}e?e.q:E.q,$r(),Or(e)}}function Rn(e){for(const t of e.Y)t.checkSources?.(),Rn(t)}function cn(e){for(let t=0;t<e.length;t++)e[t].M=b}const E=new X;function Ie(e){if(e){Bt++;try{return e()}finally{Ie(),Bt--}}if(!E.ce)for(;Ye||b;)E.flush()}function gt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function Ar(e,t){if(e.O&(J|ye))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 Rr(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(Ar(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 Pn(e){for(;e.ie&&typeof e.ie=="object";)e=e.ie;return e}function Pr(e,t){const n=b;try{return b=Pn(e),t()}finally{b=n}}function kn(e){let t=e.ge;for(;t;)t.O|=J,t.O&le&&(Ne(t,I),Qe(t,H)),kn(t),t=t.De}function Xe(e,t=!1,n){const r=e.O;if(r&ye)return;t&&(e.O=r|ye),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;Ne(s,s.O&J?H:I);let c=s.P;do c=Xt(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&J)&&e.i!==null&&!(e.i.O&ye)){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 Ir(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 Zt(e){return Ir(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 xr(e=!0){Xe(this,e)}function ze(e){const t=$,n=e?.transparent??!1,r={id:e?.id??(n?t?.id:t?.id!=null?Zt(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||Ht,me:0,Ae:null,Ne:null,i:t,dispose:xr};if(t){const i=t.ge;i===null||(r.De=i,i.we=r),t.ge=r}return r}function Qt(e,t){const n=ze(t);return se(n,()=>e(()=>n.dispose()))}function Xt(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&xe&&!(o.O&J)&&Ln(o)}return n}function In(e){const t=e.ye;let n=t!==null?t.D:e.P;if(n!==null){do n=Xt(n);while(n!==null);t!==null?t.D=null:e.P=null}}function Ln(e){Ne(e,e.O&J?H:I);let t=e.P;for(;t!==null;)t=Xt(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||Nr(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 Nr(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 qr(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 Mr(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 xn(e){e.Ce=void 0,e.Pe?.clear(),e.Pe=void 0}function yt(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 jt(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 Dr(e){let t=!1;const n=new Set,r=i=>{if(n.has(i)||!Mr(i,e))return;n.add(i),i.Ie=M;const o=i.Ce??i.Pe?.values().next().value;if(o)yt(i,o),Ee(i);else{if(i.he&=~O,yt(i),Ee(i),i.Ge){if(i.J===Ce){const s=i;s.ee||(s.ee=!0,s.te.enqueue(G,s.ne))}else{const s=i.O&J?H:I;s.C>i.o&&(s.C=i.o),Qe(i,s)}t=!0}i.Ge=!1}jt(i,r)};jt(e,r),t&&Se()}function Fr(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)),en(e,l instanceof U?O:W,l),e.Ie=M)},c=(l,d)=>{if(e.ve!==t||e.O&(Pe|$e))return;E.initTransition(Be(e));const h=!!(e.he&F);In(e),Nn(e);const f=Re(e);if(f&&f.F.delete(e),e.K!==void 0)e.K!==void 0&&e.K!==_?e.B=l:(e.ue=l,ke(e)),e.Ie=M;else if(f){const g=e.J,p=e.ue,m=e.ke;(!g&&h||!m||!m(l,p))&&(e.ue=l,e.Ie=M,e.Fe&&ce(e.Fe,l),ke(e,!0))}else ce(e,()=>l);Dr(e),Se(),Ie(),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,m=!1,u=!0;return l.next().then(a=>{if(u)p=a,m=!0,a.done&&(h=!0);else{if(e.ve!==t)return;a.done?(h=!0,Se(),Ie()):c(a.value,f)}},a=>{!u&&e.ve===t&&(h=!0,s(a))}),u=!1,m&&!p.done?(o=p.value,d=!0,f()):m&&p.done},g=f();if(!d&&!g)throw E.initTransition(Be(e)),new U($)}return o}function Nn(e,t=!1){(e.Ce||e.Pe)&&xn(e),e.Ge&&(e.Ge=!1),e.he=t?0:e.he&F,e.Re&&yt(e),e.We&&Ee(e),e.xe&&e.xe()}function en(e,t,n,r,i){t===W&&!(n instanceof Ft)&&!(n instanceof U)&&(n=new Ft(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?(qr(e,o),e.he=O|e.he&F,yt(e,o,n)):(xn(e),e.he=t|(t!==W?e.he&F:0),e.Re=n),Ee(e)),i&&!r&&Yt(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}jt(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),en(f,t,n,d,h))})}let Br=null;X.Ee=ue;X.Se=Xe;let K=!1,ne=!1,$=null,z=null;function ue(e,t=!1){const n=e.J;t||(e.M&&(!n||b)&&b!==e.M&&E.initTransition(e.M),Ne(e,e.O&J?H:I),e.ve=null,e.M||n===Ce?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&$e);const i=e.K!==void 0&&e.K!==_,o=!!(e.he&O),s=!!(e.he&F),c=$;$=e,e.ye=null,e.O=pt,e.Ie=M;let l=e.B===_?e.ue:e.B,d=e.o,h=K,f=z;if(K=!0,r){const u=Re(e);u&&(z=u)}else if(b&&!t&&b.Z.length)for(let u=e.P;u;u=u.D){const a=u.m;if(a.O&$e){const y=Re(a);if(y){r=!0,z=y,e.O|=$e,Yt(e,y);break}}}const g=n&&n!==G,p=ne;g&&(ne=!0);try{if(e.Oe&Jt)l=e.L(l),e.ve=null;else{const u=e.ve,a=e.L(l),y=typeof a=="object"&&a!==null,w=e.ve!==u;l=w||!y?a:Fr(e,a),!w&&!y&&(e.ve=null)}if(Nn(e,t),e.G){const u=Re(e);u&&(u.F.delete(e),Ee(u.k))}}catch(u){if(u instanceof U&&z){const a=V(z);a.k!==e&&(a.F.add(e),e.G=a,Ee(a.k))}u instanceof U&&(e.Ge=!0),en(e,u instanceof U?O:W,u,void 0,u instanceof U?e.G:void 0)}finally{K=h,g&&(ne=p),e.O=En|(t?e.O&Gt:0),$=c}if(!e.Re){In(e);const u=i?e.K:e.B===_?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 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)&&ke(e,r||i)}else if(i)e.B=l;else if(e.o!=d)for(let y=e.I;y!==null;y=y.p)Tn(y.h,y.h.O&J?H:I)}z=f,(e.B!==_||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&&Pr(e.M,()=>ue(e))}function qn(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&&qn(r),e.O&Pe)break}(e.O&(Pe|$e)||e.Re&&e.Ie<M&&!e.ve)&&ue(e),e.O=e.O&(Gt|le|Je)}function St(e,t){const n=t?.transparent??!1,r={id:t?.id??(n?$?.id:$?.id!=null?Zt($):void 0),Oe:(n?bt:0)|(t?.ownedWrite?wt:0)|(!$||t?.lazy?xe:0)|(t?.sync?Jt:0)|0,ke:t?.equals!=null?t.equals:Dn,X:t?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Ht,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:En,he:F,Ie:M,B:_,Ae:null,Ne:null,ve:null,M:null};return Mn(r,t),r}function jr(e,t,n,r,i,o){const s=o?.transparent??!1,c={id:o?.id??(s?$?.id:$?.id!=null?Zt($):void 0),Oe:(s?bt:0)|(o?.ownedWrite?wt:0)|(o?.sync?Jt:0)|0,ke:!1,X:o?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Ht,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:_,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 Mn(c,Kr),c}const Kr={lazy:!0};function Mn(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&&ue(e,!0)}function Ue(e,t,n=null){const r={ke:t?.equals!=null?t.equals:Dn,Oe:(t?.ownedWrite?wt:0)|(t?.Ye?hr:0),X:t?.unobserved,ue:e,I:null,Ue:null,Ie:M,V:n,A:n?.N||null,B:_};return n&&(n.N=r),r}function Dn(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 Fn(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,ue(o,!0)):o.O&ye&&ue(o,!0)}const r=e.V||e;if(!n.L&&r===e&&e.K===void 0&&e.pe===void 0&&b===null&&z===null)return t&&K&&De(e,t),!t||e.B===_?e.ue:e.B;if(t&&K&&(De(e,t),r.L)){const o=e.O&J;r.o>=(o?H.C:I.C)&&(ft(t),pr(o?H:I),qn(r));const s=r.o;s>=t.o&&e.i!==t&&(t.o=s+1)}if(r.he&O)if(t&&!(ne&&r.M&&b!==r.M))if(z){const o=r.G,s=V(z);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 ue(e),Fn(e);throw e.Re}if(e.K!==void 0&&e.K!==_)return t&&ne&&_r(e)?e.ue:e.K;if(b!==null&&z!==null&&e.B!==_&&r===e&&!e.L&&t)return b.se.add(t),e.ue;const i=!t||z!==null&&(e.K!==void 0||e.G||r===e&&ne||r.he&O)||e.B===_||ne&&e.M&&b!==e.M?e.ue:e.B;return!t&&r===e&&typeof n.L=="function"&&e.Oe&xe&&!(r.he&O)&&!e.I&&Ln(e),i}function ce(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!==_,i=n?r?e.K:e.ue:e.B===_?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),Se()),t;if(n){const s=e.K===_;s||E.initTransition(Be(e)),s&&(e.B=e.ue,E.Z.push(e)),e.$=!0;const c=br(e);e.G=c,e.K=t}else e.B===_&&$t(e),e.B=t;return e.We&&Ee(e),e.Fe&&ce(e.Fe,t),e.Ie=M,ke(e,n),Se(),t}function Ur(e){Ne(e,e.O&J?H:I),!(e.O&He)&&e.B===_&&$t(e),e.O=e.O&-4|He}function Wr(e,t){const n=ce(e,t);return Ur(e),n}function se(e,t){const n=$,r=K;$=e,K=!1;try{return t()}finally{$=n,K=r}}function Vr(e){const t=e,n=e.V;if(e.U){const r=e.U;return r.he&O&&!(r.he&F)?!0:e.B!==_&&!(t.he&F)}if(n&&e.B!==_)return!n.ve&&!(n.he&O);if(e.K!==void 0&&e.K!==_){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===_&&!e.U?!1:e.B!==_&&!(t.he&F)?!0:!!(t.he&O&&!(t.he&F))}function Ee(e){if(e.We){const t=Vr(e),n=e.We;if(ce(n,t),!t&&n.G){const r=Re(e);if(r&&r.F.size>0){const i=V(n.G);i!==r&&An(r,i)}dt.delete(n),n.G=void 0}}}function zr(e,t=!0){const n=ne;ne=t;try{return e()}finally{ne=n}}function Gr(e,t=et()){if(!t)throw new Sn;const n=Hr(e,t)?t.Ve[e.id]:e.defaultValue;if(tn(n))throw new dr;return n}function Jr(e,t,n=et()){if(!n)throw new Sn;n.Ve={...n.Ve,[e.id]:tn(t)?e.defaultValue:t}}function Hr(e,t){return!tn(t?.Ve[e.id])}function tn(e){return typeof e>"u"}function Bn(e,t,n,r){const i=!!r?.user,o=jr(e,t,n,i?G:Ae,Yr,r);ue(o,!0),!r?.defer&&(o.J===G||r?.schedule?o.te.enqueue(o.J,Kt.bind(null,o)):Kt(o))}function Yr(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===G)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===Ae&&this.te.notify(this,O|W,n,r)}function Kt(e){if(!(!e.ee||e.O&ye)){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,()=>_t(()=>e.$e?.())))}catch(t){if(e.Re=new Ft(e,t),e.he|=W,!e.te.notify(e,W,W))throw t}finally{e.Me=e.ue,e.ee=!1}}}X.Te=Kt;function Zr(e,t){const n=()=>{if(!(!r.ee||r.O&ye))try{r.ee=!1,ue(r)}finally{}},r=St(()=>{r.$e?.(),r.$e=void 0;const i=zr(e);r.$e=i},{...t,lazy:!0});r.$e=void 0,r.Oe=r.Oe&~xe|Cn,r.ee=!0,r.J=Ce,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(G,n),_t(()=>r.$e?.())}function jn(e){return _t(e)}function ge(e){const t=Fn.bind(null,e);return t[mr]=e,t}function Qr(e,t){if(typeof e=="function"){const r=St(e,t);return r.Oe&=~xe,[ge(r),Wr.bind(null,r)]}const n=Ue(e,t);return[ge(n),ce.bind(null,n)]}function _e(e,t){return ge(St(e,t))}function Xr(e,t,n){Bn(e,t.effect||t,t.error,{user:!0,...n})}function ei(e,t,n){Bn(e,t,void 0,n)}function ti(e,t){Zr(e,t)}function ni(e){const t=et();t&&!(t.Oe&Cn)?ti(()=>ee(e),void 0):E.enqueue(G,()=>{e()?.()})}const ri=Symbol(0),Ut=Symbol(0);function an(e){return e==null||typeof e!="object"||Object.isFrozen(e)?!1:typeof Node>"u"||!(e instanceof Node)}const Kn=Symbol(0);function fn(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"&&fn(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===Kn)delete e[r];else if(r===void 0||an(i)&&an(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(fn(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:Kn});function rt(){return!0}const ii={get(e,t,n){return t===Ut?n:e.get(t)},has(e,t){return t===Ut?!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 It(e){return(e=typeof e=="function"?e():e)?e:{}}const Lt=Symbol(0);function oi(...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&&Ut 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,_e(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=It(n[d]);if(l in h)return h[l]}},has(l){for(let d=n.length-1;d>=0;d--)if(l in It(n[d]))return!0;return!1},keys(){const l=new Set;for(let d=0;d<n.length;d++){const h=Object.keys(It(n[d]));for(let f=0;f<h.length;f++)l.add(h[f])}return[...l]}},ii);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 si(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(li.bind(s));return s.Ze.u=c,c.Oe&=~xe,ge(c)}const it={ownedWrite:!0};function li(){const e=this.Be()||[],t=e.length;return e[ri],se(this.Ze,()=>{let n,r,i=this.nt?this.rt?()=>(this.nt[r]=Ue(e[r],it),this.Xe(ge(this.nt[r]),r)):()=>(this.nt[r]=Ue(e[r],it),this.it&&(this.it[r]=Ue(r,it)),this.Xe(ge(this.nt[r]),this.it?ge(this.it[r]):void 0)):this.it?()=>{const o=e[r];return this.it[r]=Ue(r,it),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]=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]=se(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),m=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&&dn(this.tt,this.ze[o],e[o]));o++)this.nt&&ce(this.nt[o],e[o]);for(s=this.qe-1,c=t-1;s>=o&&c>=o&&(this.ze[s]===e[c]||this.nt&&dn(this.tt,this.ze[s],e[c]));s--,c--)g[c]=this.Je[s],p[c]=this.et[s],m&&(m[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],m&&(m[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],m&&(this.nt[r]=m[r],ce(this.nt[r],e[r])),u&&(this.it[r]=u[r],ce(this.it[r],r))):this.Je[r]=se(this.et[r]=ze(),i);this.Je=this.Je.slice(0,this.qe=t),this.ze=e.slice(0)}}),this.Je}function dn(e,t,n){return e?e(t)===e(n):!0}function nn(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 Wt(e,n,t)?()=>{let r=[];return Wt(n,r,{...t,doNotUnwrap:!1}),r}:n}return e}}function Wt(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=Wt(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 Un(e,t){const n=Symbol("");function r(i){return Qt(()=>(Jr(r,i.value),rn(()=>i.children)))}return r.id=n,r.defaultValue=e,r}function Wn(e){return Gr(e)}function rn(e){const t=_e(e,{lazy:!0}),n=_e(()=>nn(t()),{lazy:!0,sync:!0});return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}class Te{static{for(const t of["all","allSettled","any","race","reject","resolve"])Te[t]=()=>new Te}catch(){return new Te}then(){return new Te}finally(){return new Te}}const Q=(...e)=>_e(...e),q=(...e)=>Qr(...e),ui=(...e)=>ei(...e),Et=(...e)=>Xr(...e);function L(e,t){return ee(()=>e(t||{}))}const ci=e=>`Stale read from <${e}>.`;function ut(e){const t="fallback"in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed};return si(()=>e.each,e.children,t)}function Vn(e){const t=e.keyed,n=_e(()=>e.when,void 0),r=t?n:_e(n,{equals:(i,o)=>!i==!o,sync:!0});return _e(()=>{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 ci("Show");return n()})):o}return e.fallback},{sync:!0})}const j=Symbol("slot"),ai={transparent:!0,sync:!0},fi={sync:!0},Y=(e,t,n)=>ui(e,t,n?{transparent:!0,sync:!0,...n}:ai),D=e=>Q(()=>e(),fi);function di(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,m;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],y=a[j];u=a.parentNode===e&&(!y||y===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&&(!(m=p[j])||m===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,y=1,w;for(;++a<o&&a<s&&!((w=g.get(t[a]))==null||w!==u+y);)y++;if(y>u-l){const C=t[c],A=C[j],k=C.parentNode===e&&(!A||A===r)?C:f;for(;l<u;){const B=n[l++];e.insertBefore(B,k),r&&(B[j]=r)}}else{const C=t[c++],A=n[l++],k=C[j];C.parentNode===e&&(!k||k===r)?e.replaceChild(A,C):e.insertBefore(A,f),r&&(A[j]=r)}}else c++;else{const a=t[c++],y=a[j];a.parentNode===e&&(!y||y===r)&&a.remove()}}}}const hn="_$DX_EVENT_OWNER",gn={},Vt=new Set,Le=new Map;function hi(e,t,n,r={}){let i;yi(t);try{Qt(o=>{if(i=o,t===document){const s=e();Y(()=>nn(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 gi(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=gi(e,i,t))).cloneNode(!0)}function tt(e){for(let t=0,n=e.length;t<n;t++){const r=e[t];Vt.has(r)||(Vt.add(r),Le.forEach((i,o)=>zn(r,o,i)))}}function yi(e){const t=mi(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),pi(e,e)}function mi(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),Vt.forEach(r=>zn(r,e,n)),n}function pi(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 zn(e,t,n){if(n.handlers.has(e))return;const r=i=>vi(i,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}function wi(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 re(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=pn(n||{}),t=pn(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 mn(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 bi(e,t){Array.isArray(e)?e.flat(1/0).forEach(n=>n&&n(t)):e(t)}function mt(e,t){const n=ee(e);se(null,()=>bi(n,t))}function v(e,t,n,r,i){const o=n!==void 0;if(o&&!r&&(r=[]),typeof t!="function"&&(t=Nt(t,r,o,!0),typeof t!="function"))return xt(e,t,r,n);if(o&&r.length===0){const c=document.createTextNode("");e.insertBefore(c,n),r=[c]}let s=r;Y(c=>{const l=Nt(t(),s,o,!0);return typeof l!="function"?l:(Y(()=>Nt(l,s,o),d=>{xt(e,d,s,n),s=d},c!==void 0&&!(i&&i.schedule)?{...i,schedule:!0}:i),gn)},c=>{c!==gn&&(xt(e,c,s,n),s=c)},i)}function pn(e){if(Array.isArray(e)){const t={};Gn(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 Gn(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n];Array.isArray(i)?Gn(i,t):typeof i=="object"&&i!=null?Object.assign(t,i):(i||i===0)&&(t[i]=!0)}}function vi(e,t,n){if(e[hn])return;const r=n&&(n.owners.size===1&&n.owners.has(t)?t:wi(e.target,n)?.owner);if(n&&!r)return;e[hn]=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 xt(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?wn(e,t,r):di(e,n,t,r):(n&&ot(e),wn(e,t))}}function Nt(e,t,n,r){if(e=nn(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 wn(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 _i(e,t,n,r={}){try{const i=hi(e,t,n,{...r,insertOptions:{schedule:!0}});return Ie(),i}finally{}}function Jn(){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 zt;function on(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),zt=window.history.state._depth}on();function Si(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function Ei(e,t){let n=!1;return()=>{const r=zt;on();const i=r==null?null:zt-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}const Ci=/^(?:[a-z0-9]+:)?\/\//i,Oi=/^\/+|(\/)\/+$/g,Hn="http://sr";function Ge(e,t=!1){const n=e.replace(Oi,"$1");return n?t||/^[?#]/.test(n)?n:"/"+n:""}function ct(e,t,n){if(Ci.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 Ti(e,t){if(e==null)throw new Error(t);return e}function Ai(e,t){return Ge(e).replace(/\/*(\*.*)?$/g,"")+Ge(t)}function Yn(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 Ri(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],m=p[0]===":",u=m?l[g]:l[g].toLowerCase(),a=m?p.slice(1):p.toLowerCase();if(m&&qt(u,f(a)))h.params[a]=u;else if(m||!qt(u,a))return null;h.path+=`/${u}`}if(i){const g=d?l.slice(-d).join("/"):"";if(qt(g,f(i)))h.params[i]=g;else return null}return h}}function qt(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 Pi(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 Zn(e){const t=new Map,n=et();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 Qn(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 Qn(r).reduce((o,s)=>[...o,...i.map(c=>c+s)],[])}const ki=100,Xn=Un(),er=Un();function Ii(e){try{return Wn(e)}catch{return}}const tr=()=>Ti(Wn(Xn),"<A> and 'use' router primitives can be only used inside a Route."),nr=()=>tr().navigatorFactory(),Li=()=>tr().params;function xi(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 rr(e.path).reduce((l,d)=>{for(const h of Qn(d)){const f=Ai(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:Ri(g,!s,e.matchFilters)})}return l},[])}function Ni(e,t=0){return{routes:e,score:Pi(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 rr(e){return Array.isArray(e)?e:[e]}function ir(e,t="",n=[],r=[]){const i=rr(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=xi(c,t);for(const d of l){n.push(d);const h=Array.isArray(c.children)&&c.children.length===0;if(c.children&&!h)ir(c.children,d.pattern,n,r);else{const f=Ni([...n],r.length);r.push(f)}n.pop()}}}return n.length?r:r.sort((o,s)=>s.score-o.score)}function Mt(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n].matcher(t);if(i)return i}return[]}function qi(e,t,n){const r=new URL(Hn),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(()=>Yn(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):Zn(d)}}let ve;function Mi(){return ve}function Di(e,t,n,r={}){const{signal:[i,o],utils:s={}}=e,c=s.parsePath||(P=>P),l=s.renderPath||(P=>P),d=s.beforeLeave||Jn(),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}),[m,u]=q(void 0,{ownedWrite:!0});let a;const y=Q(()=>m()??i()),w=qi(()=>y().value,()=>y().state,s.queryWrapper),C=[],A=q([],{ownedWrite:!0}),k=Q(()=>typeof r.transformUrl=="function"?Mt(t(),r.transformUrl(w.pathname)):Mt(t(),w.pathname)),B=()=>{const P=k(),x={};for(let Z=0;Z<P.length;Z++)Object.assign(x,P[Z].params);return x},Oe=s.paramsWrapper?s.paramsWrapper(B,t):Zn(B),me={pattern:h,path:()=>h,outlet:()=>null,resolvePath(P){return ct(h,P)}};return{base:me,location:w,params:Oe,isRouting:g,renderPath:l,parsePath:c,navigatorFactory:Ot,matches:k,beforeLeave:d,preloadRoute:qe,singleFlight:r.singleFlight===void 0?!0:r.singleFlight,submissions:A};function Ct(P,x,Z){ee(()=>{if(typeof x=="number"){x&&(s.go?s.go(x):console.warn("Router integration does not support relative routing"));return}const pe=!x||x[0]==="?",{replace:ae,resolve:ie,scroll:we,state:fe}={replace:!1,resolve:!pe,scroll:!0,...Z},de=ie?P.resolvePath(x):ct(pe&&w.pathname||"",x);if(de===void 0)throw new Error(`Path '${x}' is not a routable path`);if(C.length>=ki)throw new Error("Too many redirects");const he=y();if((de!==he.value||fe!==he.state)&&!$i){if(d.confirm(de,Z)){C.push({value:he.value,replace:ae,scroll:we,state:he.state});const be={value:de,state:fe};a===void 0&&(p(!0),Ie()),ve="navigate",a=be,a===be&&(u({...a}),queueMicrotask(()=>{a===be&&(ve=void 0,Tt(a),u(void 0),p(!1),a=void 0)}))}}})}function Ot(P){return P=P||Ii(er)||me,(x,Z)=>Ct(P,x,Z)}function Tt(P){const x=C[0];x&&(o({...P,replace:x.replace,scroll:x.scroll}),C.length=0)}function qe(P,x){const Z=Mt(t(),P.pathname),pe=ve;ve="preload";for(let ae in Z){const{route:ie,params:we}=Z[ae];ie.component&&ie.component.preload&&ie.component.preload();const{preload:fe}=ie;x&&fe&&se(n(),()=>fe({params:we,location:{pathname:P.pathname,search:P.search,hash:P.hash,query:Yn(P),state:null,key:""},intent:"preload"}))}ve=pe}}function Fi(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:ve||"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 Bi=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=rn(()=>l),h=Q(()=>ir(d(),r||""));let f;const g=Di(e,h,()=>f,{base:r,singleFlight:i,transformUrl:o});return e.create&&e.create(g),L(Xn,{value:g,get children(){return L(ji,{routerState:g,root:s,preload:c,get children(){return[D(()=>(f=et())&&null),L(Ki,{routerState:g,get branches(){return h()}})]}})}})};function ji(e){const t=e.routerState.location,n=e.routerState.params,r=Q(()=>e.preload&&ee(()=>{e.preload({params:n,location:t,intent:Mi()||"initial"})})),i=e.root;return i?L(i,{params:n,location:t,get data(){return r()},get children(){return e.children}}):e.children}function Ki(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],m=c[f];s&&p&&m.route.key===p.route.key?h[f]=s[f]:(d=!1,t[f]&&t[f](),Qt(u=>{t[f]=u,h[f]=Fi(e.routerState,h[f-1]||e.routerState.base,bn(()=>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=bn(()=>i()&&n);return D(o)}const bn=e=>()=>{const t=e();if(t)return L(er,{value:t,get children(){return t.outlet()}})},vn=e=>{const t=rn(()=>e.children);return oi(e,{get children(){return t()}})};function Ui(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&&jn(e.init((s=e.get())=>{t=!0,o[1](n(s)),t=!1})),Bi({signal:o,create:e.create,utils:e.utils})}function Wi(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function Vi(e,t){const n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}const zi=new Map;function Gi({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 y=d(a),w=y?a.href.baseVal:a.href;if((y?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 k=y?new URL(w,document.baseURI):new URL(w);if(!(k.origin!==window.location.origin||o&&k.pathname&&!k.pathname.toLowerCase().startsWith(o.toLowerCase())))return[a,k]}function f(u){const a=h(u);if(!a)return;const[y,w]=a,C=i.parsePath(w.pathname+w.search+w.hash),A=y.getAttribute("state");u.preventDefault(),s(C,{resolve:!1,replace:y.hasAttribute("replace"),scroll:!y.hasAttribute("noscroll"),state:A?JSON.parse(A):void 0})}function g(u){const a=h(u);if(!a)return;const[y,w]=a;r&&(w.pathname=r(w.pathname)),i.preloadRoute(w,y.getAttribute("preload")!=="false")}function p(u){clearTimeout(c);const a=h(u);if(!a)return l=null;const[y,w]=a;l!==y&&(r&&(w.pathname=r(w.pathname)),c=setTimeout(()=>{i.preloadRoute(w,y.getAttribute("preload")!=="false"),l=y},20))}function m(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,Hn);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 y=zi.get(a);if(y){u.preventDefault();const w=new FormData(u.target,u.submitter);y.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",m),jn(()=>{document.removeEventListener("click",f),e&&(document.removeEventListener("mousemove",p),document.removeEventListener("focusin",g),document.removeEventListener("touchstart",g)),document.removeEventListener("submit",m)})}}function Ji(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=Jn();return Ui({get:t,set({value:r,replace:i,scroll:o,state:s}){i?window.history.replaceState(Si(s),"",r):window.history.pushState(s,"",r),Vi(decodeURIComponent(window.location.hash.slice(1)),o),on()},init:r=>Wi(window,"popstate",Ei(r,i=>{if(i)return!n.confirm(i);{const o=t();return!n.confirm(o.value,{state:o.state})}})),create:Gi({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:r=>window.history.go(r),beforeLeave:n}})(e)}var Hi=T('<div class=chat><div class=chat-messages></div><div class=chat-input><input type=text placeholder="Type a message..."><button type=button>Send'),Yi=T("<span class=chat-user>"),Zi=T("<span class=chat-time>"),Qi=T("<div><div class=chat-content>");function Xi(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),y=Math.floor((Date.now()-a.getTime())/1e3);if(y<60)return"just now";const w=Math.floor(y/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=Hi(),d=l.firstChild,h=d.nextSibling,f=h.firstChild,g=f.nextSibling,p=n;typeof p=="function"||Array.isArray(p)?mt(()=>p,d):n=d,v(d,L(ut,{get each(){return e.messages},children:u=>(()=>{var a=Qi(),y=a.firstChild;return v(a,L(Vn,{get when(){return u.msg_type!=="system"},get children(){return[(()=>{var w=Yi();return v(w,()=>u.user_name),w})(),(()=>{var w=Zi();return v(w,()=>c(u.created_at)),w})()]}}),y),v(y,()=>u.content),Y(()=>`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 m=t;return typeof m=="function"||Array.isArray(m)?mt(()=>m,f):t=f,g.$$click=o,Y(()=>({e:r(),t:!r().trim()}),({e:u,t:a},y)=>{f.value=u??"",a!==y?.t&&re(g,"disabled",a)}),l}tt(["input","keydown","click"]);function eo(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 to(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=eo(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 or([e,t],n={}){Et(()=>e(),r=>{if(!r||n.unless?.(r))return;const i=setTimeout(()=>t(null),n.ms??5e3);return()=>clearTimeout(i)})}function no(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=to(e,t,{onState:a=>{g.current=!1,r(a)},onChat:a=>o(y=>{const w=[...y,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 ni(()=>{p(),setTimeout(()=>{g.current&&d("Room not found or unavailable")},8e3)}),Et(()=>[s(),h()],([u,a])=>{if(!u&&!a){const y=setTimeout(p,3e3);return()=>clearTimeout(y)}}),or([l,d],{unless:u=>u.includes("not found")}),{state:n,chats:i,connected:s,error:l,setError:d,send:u=>h()?.(u)}}var ro=T("<div class=player>"),io=T("<div class=player-idle>Paste a URL to start watching together"),oo=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>"),so=T("<div class=player-media-wrap><div class=player-media></div><button type=button>"),lo=T("<img class=player-thumb alt>"),uo=T("<video controls><track kind=captions>"),co=T("<audio controls><track kind=captions>");const sr="moqbox-volume",$n=()=>parseFloat(localStorage.getItem(sr)||"0.5");function ao(e){const t=Math.round(e.volume*100)/100;localStorage.setItem(sr,t.toString())}function fo(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 Dt(e,t){const n=(Date.now()-t)/1e3;e.currentTime=n}function ho(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&&ao(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,m=t;if(!m||!p?.started_at){m&&m.pause(),r(!0);return}const u=p.started_at,a=`/api/v1/rooms/${i}/media/${p.hash}`;m.src=a,m.volume=$n();let y;const w=()=>{Dt(m,u);const A=()=>{r(!0),m.play().catch(()=>{}),y=()=>{const k=c?.started_at;if(!k)return;const B=(Date.now()-k)/1e3;r(Math.abs(m.currentTime-B)<.5)},m.addEventListener("timeupdate",y),m.addEventListener("pause",C)};m.addEventListener("seeked",A,{once:!0})};m.addEventListener("loadedmetadata",w,{once:!0}),m.addEventListener("canplay",w,{once:!0});const C=()=>{m.ended||Dt(m,u)};return()=>{m.removeEventListener("loadedmetadata",w),m.removeEventListener("canplay",w),y&&m.removeEventListener("timeupdate",y),m.removeEventListener("pause",C)}});const l=f=>{if(f<1)return"--:--";const g=Math.floor(f/1e3),p=Math.floor(g/60),m=g%60;return`${p}:${m.toString().padStart(2,"0")}`},d=()=>{const f=t,g=e.track?.started_at;f&&g&&(Dt(f,g),r(!0))};var h=ro();return v(h,L(Vn,{get when(){return e.track},get fallback(){return io()},children:f=>{const g=f();return[(()=>{var p=oo(),m=p.firstChild,u=m.firstChild,a=u.nextSibling,y=a.firstChild,w=y.nextSibling;return v(p,(()=>{var C=D(()=>!!g.thumbnail);return()=>C()&&(()=>{var A=lo();return A.addEventListener("error",k=>k.currentTarget.hidden=!0),Y(()=>g.thumbnail,k=>{re(A,"src",k)}),A})()})(),m),v(u,()=>g.title),v(y,()=>g.duration),v(w,()=>l(Date.now()-g.started_at)),p})(),(()=>{var p=so(),m=p.firstChild,u=m.nextSibling;return v(m,(()=>{var a=D(()=>!!fo(g));return()=>a()?(()=>{var y=uo();return mn(y,"ended",e.onEnded),mt(()=>o,y),y})():(()=>{var y=co();return mn(y,"ended",e.onEnded),mt(()=>o,y),y})()})()),u.$$click=d,v(u,()=>n()?"Live":"Go live"),Y(()=>["live-btn",n()&&"live-btn--on"],(a,y)=>{Ze(u,a,y)}),p})()]}})),h}tt(["click"]);var go=T("<div><span class=queue-title></span><span class=queue-duration>"),yo=T("<img class=queue-thumb alt>"),mo=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"),po=T("<div class=queue-empty>Paste a URL to start watching together"),wo=T('<button type=button class=queue-shuffle title="Shuffle up next">⇄ Shuffle'),bo=T("<div class=queue-item-row>"),vo=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">▼'),$o=T("<div class=queue-empty>Tracks you add will appear here"),_o=T('<div class=queue-item-row><button type=button class="queue-item-action queue-item-remove"title="Remove from playlist">×'),So=T("<div class=queue-empty>Add links to build a perpetual playlist"),Eo=T('<div class=queue-item-row><button type=button class=queue-item-action title="Add to playlist">+'),Co=T("<div class=queue-empty>Recently played tracks show up here");function st(e){var t=go(),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),Y(()=>e.thumbnail,s=>{re(o,"src",s)}),o})()})(),n),v(n,()=>e.pending?"⏳ ":"",null),v(n,()=>e.title,null),v(r,()=>e.duration),Y(()=>`queue-item${e.extraClass?" "+e.extraClass:""}`,(i,o)=>{Ze(t,i,o)}),t}function Oo(e){var t=mo(),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,m=c.nextSibling;return m.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"}):po()})(),null),v(i,()=>e.queue.length,s),v(i,(()=>{var u=D(()=>!!(e.onShuffleQueue&&e.queue.length>1));return()=>u()&&(()=>{var a=wo();return a.$$click=()=>e.onShuffleQueue?.(),a})()})(),null),v(r,L(ut,{get each(){return e.queue},children:(u,a)=>(()=>{var y=bo();return v(y,L(st,{get title(){return u.title},get duration(){return u.duration},get thumbnail(){return u.thumbnail},get pending(){return u.pending}}),null),v(y,(()=>{var w=D(()=>!!e.onMoveQueueItem);return()=>w()&&(()=>{var C=vo(),A=C.firstChild,k=A.nextSibling;return A.$$click=()=>e.onMoveQueueItem?.(a(),a()-1),k.$$click=()=>e.onMoveQueueItem?.(a(),a()+1),Y(()=>({e:a()===0,t:a()===e.queue.length-1}),({e:B,t:Oe},me)=>{B!==me?.e&&re(A,"disabled",B),Oe!==me?.t&&re(k,"disabled",Oe)}),C})()})(),null),y})()}),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=_o(),y=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}}),y),y.$$click=()=>e.onRemoveFromPlaylist?.(u.id),a})()}),null),v(c,(()=>{var u=D(()=>e.playlist.length===0);return()=>u()&&So()})(),null),v(m,L(ut,{get each(){return e.history},children:u=>(()=>{var a=Eo(),y=a.firstChild;return v(a,L(st,{get title(){return u.title},get duration(){return u.duration},get thumbnail(){return u.thumbnail},extraClass:"history"}),y),y.$$click=()=>e.onAddToPlaylist?.(u.url),a})()}),null),v(m,(()=>{var u=D(()=>e.history.length===0);return()=>u()&&Co()})(),null),Y(()=>({e:e.playlistEnabled,t:e.playlist.length===0}),({e:u,t:a},y)=>{p.checked=u,a!==y?.t&&re(p,"disabled",a)}),t}tt(["click"]);const lr="moqbox-theme";function ur(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(lr,e)}function To(e){return e==="macchiato"?"latte":e==="latte"?"system":"macchiato"}function cr(){return localStorage.getItem(lr)||"system"}var Ao=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>'),Ro=T('<div class="toast toast-error"role=alert>'),Po=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"),Io=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 xo=()=>{const e=nr(),[t,n]=q(""),[r,i]=q(!1),[o,s]=q(null);or([o,s]);const c=async()=>{if(t().trim()){i(!0);try{const m=await fetch("/api/v1/rooms",{method:"POST"});if(!m.ok)throw new Error(`create room: ${m.status}`);const u=await m.json();e(`/room/${u.room_id}?name=${encodeURIComponent(t().trim())}`)}catch(m){console.error("Failed to create room:",m),s("Failed to create room"),i(!1)}}};var l=Ao(),d=l.firstChild,h=d.nextSibling,f=h.nextSibling,g=f.firstChild,p=g.nextSibling;return g.$$keydown=m=>m.key==="Enter"&&c(),g.$$input=m=>n(m.currentTarget.value),p.$$click=c,v(p,()=>r()?"Creating...":"Create Room"),v(l,(()=>{var m=D(()=>!!o());return()=>m()&&(()=>{var u=Ro();return v(u,o),u})()})(),null),Y(()=>({e:t(),t:r()||!t().trim()}),({e:m,t:u},a)=>{g.value=m??"",u!==a?.t&&re(p,"disabled",u)}),l},No=()=>{const e=Li(),t=ee(()=>e.id),r=new URLSearchParams(location.search).get("name")||"anonymous",i=nr(),[o,s]=q(cr()),c=()=>{const S=To(o());ur(S),s(S)},{state:l,chats:d,connected:h,error:f,setError:g,send:p}=no(t,r),[m,u]=q(!1),[a,y]=q(""),[w,C]=q("queue"),[A,k]=q(!1),B=async()=>{const S=a().trim();if(S){k(!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:S,room_id:t})});if(!N.ok){if(N.status===429){const oe=N.headers.get("Retry-After");g(oe?`Too fast — try again in ${oe}s`:"Too fast — try again in a moment")}else{const oe=await N.json().catch(()=>({error:N.statusText}));g(oe.error||`${w()} failed`)}return}y(""),u(!1),g(null)}catch(R){g(String(R))}finally{k(!1)}}},Oe=async S=>{try{const R=await fetch("/api/v1/playlist/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:S,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))}},me=async S=>{try{const R=await fetch("/api/v1/playlist/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:t,id:S})});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))}},Ct=S=>{p({type:"set_playlist_enabled",enabled:S})},Ot=(S,R)=>{S!==R&&p({type:"move_queue_item",from:S,to:R})},Tt=()=>{p({type:"shuffle_queue"})};var qe=Po(),P=qe.firstChild,x=P.firstChild,Z=x.nextSibling,pe=P.nextSibling,ae=pe.firstChild,ie=ae.firstChild,we=ie.firstChild,fe=we.nextSibling,de=ae.nextSibling,he=de.firstChild,be=he.firstChild;return v(x,()=>l()?.room_name??"Loading..."),v(Z,(()=>{var S=D(()=>l()?.clients!=null);return()=>S()?`${l()?.clients} connected`:""})()),v(P,(()=>{var S=D(()=>!h());return()=>S()&&ko()})(),null),v(qe,(()=>{var S=D(()=>!!f());return()=>S()&&(()=>{var R=Io(),N=R.firstChild,oe=N.nextSibling;return v(N,f),oe.$$click=()=>i("/"),R})()})(),pe),v(ae,L(ho,{get track(){return l()?.current_track??null},roomId:t,onEnded:()=>{const S=l()?.current_track;S&&p({type:"track_ended",item_id:S.id})}}),ie),we.$$click=()=>{u(!m())},v(we,()=>m()?"Cancel":"Add"),fe.$$click=()=>p({type:"skip"}),v(ae,(()=>{var S=D(()=>!!m());return()=>S()&&(()=>{var R=Lo(),N=R.firstChild,oe=N.nextSibling,At=oe.firstChild,sn=At.nextSibling,Rt=oe.nextSibling;return N.$$keydown=Me=>Me.key==="Enter"&&B(),N.$$input=Me=>y(Me.currentTarget.value),At.$$click=()=>C("queue"),sn.$$click=()=>C("playlist"),Rt.$$click=B,v(Rt,()=>A()?"Adding...":"Add"),Y(()=>({e:a(),t:w()==="queue"?"active":"",a:w()==="playlist"?"active":"",o:A()||!a().trim()}),({e:Me,t:ar,a:fr,o:ln},Pt)=>{N.value=Me??"",Ze(At,ar,Pt?.t),Ze(sn,fr,Pt?.a),ln!==Pt?.o&&re(Rt,"disabled",ln)}),R})()})(),null),v(de,L(Oo,{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:Oe,onRemoveFromPlaylist:me,onTogglePlaylist:Ct,onMoveQueueItem:Ot,onShuffleQueue:Tt}),he),v(de,L(Xi,{get messages(){return d()},onSend:S=>p({type:"chat",content:S})}),he),be.$$click=c,v(be,(()=>{var S=D(()=>o()==="macchiato");return()=>S()?"Dark":o()==="latte"?"Light":"System"})()),Y(()=>({e:!l()?.current_track,t:`Theme: ${o()}`}),({e:S,t:R},N)=>{S!==N?.e&&re(fe,"disabled",S),R!==N?.t&&re(be,"title",R)}),qe},qo=()=>(ur(cr()),L(Ji,{get children(){return[L(vn,{path:"/",component:xo}),L(vn,{path:"/room/:id",component:No})]}}));tt(["input","keydown","click"]);const _n=document.getElementById("root");_n&&_i(()=>L(qo,{}),_n);
-1
static/dist/assets/index-dTCvdWLw.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 Mt extends Error{source;constructor(t,n){super(n instanceof Error?n.message:String(n),{cause:n}),this.source=t}}class $n extends Error{constructor(){super("")}}class ar extends Error{constructor(){super("")}}const _n=0,Ke=1,Oe=2,pt=4,le=8,Ve=16,J=32,de=64,we=128,Vt=256,ct=512,ze=1024,mt=1,fr=2,wt=4,dr=8,Sn=16,Pe=32,zt=64,C=1,W=2,D=4,Ee=1,G=2,_e=3,S={},hr=typeof Proxy=="function",Gt={},gr=Symbol("refresh");function En(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 He(e,t){let n=e.O;n&(le|pt|ze)||(n&Ke?e.O=n&-4|Oe|le:e.O=n|le,n&Ve||En(e,t))}function Cn(e,t){let n=e.O;n&(le|pt|Ve|ze)||(e.O=n|Ve,En(e,t))}function ke(e,t){const n=e.O;if(!(n&(le|Ve)))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 yr(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&&at(n)}}function at(e,t=Oe){const n=e.O;if(!((n&(Ke|Oe))>=t)){e.O=n&-4|t;for(let r=e.I;r!==null;r=r.p)at(r.h,Ke);if(e.N!==null)for(let r=e.N;r!==null;r=r.A)for(let i=r.I;i!==null;i=i.p)at(i.h,Ke)}}function qe(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):pr(n,e),n=e.l[e.C]}e._=0}function pr(e,t){ke(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)Cn(r.h,t)}}const ft=new WeakMap,te=new Set;function mr(e){let t=ft.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},ft.set(e,t),te.add(t),e.$=!1,t}function V(e){for(;e.H;)e=e.H;return e}function On(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 Ce(e){const t=e.G;if(!t)return;const n=V(t);if(te.has(n))return n;e.G=void 0}function Me(e){return Ce(e)?.M??e.M}function bt(e){return e.K!==void 0&&e.K!==S}function Jt(e,t){const n=V(t),r=e.G;if(r){if(r.H){e.G=t;return}const i=V(r);if(te.has(i)){i!==n&&!bt(e)&&(n.j&&V(n.j)===i?e.G=t:i.j&&V(i.j)===n||On(n,i));return}}e.G=t}const De=new Set,k={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0},H={l:new Array(2e3).fill(void 0),R:!1,C:0,_:0};let M=0,b=null,Ge=!1,Dt=0,st=null;const Fe=new Set;function wr(e){return De.size===0&&te.size===0&&e.Y.length===0&&e.Z.length===0&&e.q.size===0&&Fe.size===0}function br(){if(Fe.size!==0)for(const e of Fe){if(e.I!==null){Fe.delete(e);continue}e.B===S&&(e.K!==void 0&&e.K!==S||(Fe.delete(e),e.X?.()))}}function vr(e){return!!st?.has(e)}function tt(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]=[],ht(n,e))}}function $r(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(G,n.ne));continue}const r=n.O&J?H:k;r.C>n.o&&(r.C=n.o),He(n,r)}}function _r(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 Sr(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&&Te(n,!0),n.M=null}e.length=0}function Er(e){for(const t of te)(e?t.M===e:!t.M)&&(t.H||(t.W[0].length&&ht(t.W[0],Ee),t.W[1].length&&ht(t.W[1],G)),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),ft.delete(t.k))}function ve(){Ge||(Ge=!0,!Dt&&!E.ce&&queueMicrotask(Ae))}let Cr=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]=[],ht(n,t)}for(let n=0;n<this.Y.length;n++)this.Y[n].run?.(t)}enqueue(t,n){t&&(z?V(z).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 Cr{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(qe(k,X.Ee),b){if(!Tr(b)){const r=b;if(qe(H,X.Ee),this.ae=null,this.fe=[],this.Z=[],this.q=new Set,tt(Ee),tt(G),this.stashQueues(r._e),M++,Ge=k._>=k.C,ln(r.fe),b=null,!r.re.length&&!r.oe.size&&r.Z.length){st=new Set;for(let i=0;i<r.Z.length;i++){const o=r.Z[i];o.L||o.Oe&mt||(st.add(o),$r(o))}}try{Rt(null,!0)}finally{st=null}return}this.fe!==b.fe&&this.fe.push(...b.fe),this.restoreQueues(b._e),De.delete(b);const n=b;b=null,ln(this.fe),Rt(n)}else wr(this)?(dt(),k._>=k.C&&(qe(k,X.Ee),dt())):(De.size&&qe(H,X.Ee),Rt());M++,Ge=k._>=k.C,te.size&&tt(Ee),this.run(Ee),te.size&&tt(G),this.run(G)}finally{this.ce=!1}}}notify(t,n,r,i){if(n&C){if(r&C){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&&ve()}}return!0}return!1}initTransition(t){if(t&&(t=An(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;_r(t,n),De.delete(n),b=t}if(De.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 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 vt(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 Te(e,t=!1){const n=e.G||z,r=e.pe!==void 0;for(let i=e.I;i!==null;i=i.p){if(r&&i.h.Oe&dr){i.h.O|=Vt;continue}t&&n?(i.h.O|=we,Jt(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(G,o.ne));continue}const s=i.h.O&J?H:k;s.C>i.h.o&&(s.C=i.h.o),He(i.h,s)}}function sn(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&=~ze,t.he&C||(t.he&=~D),(t.Ne!==null||t.Ae!==null)&&X.Se(t,!1,!0)}function dt(){E.ae!==null&&(sn(E.ae),E.ae=null);const e=E.fe;for(let t=0;t<e.length;t++)sn(e[t]);e.length=0}function Rt(e=null,t=!1){const n=!t;n&&dt(),!t&&E.Y.length&&Tn(E);const r=k._>=k.C;if(r&&qe(k,X.Ee),n){if(r&&dt(),Sr(e?e.Z:E.Z),e&&e.se.size){for(const i of e.se){if(i.O&de)continue;if(i.J===_e){i.ee||(i.ee=!0,i.te.enqueue(G,i.ne));continue}const o=i.O&J?H:k;o.C>i.o&&(o.C=i.o),He(i,o)}e.se.clear()}e?e.q:E.q,br(),Er(e)}}function Tn(e){for(const t of e.Y)t.checkSources?.(),Tn(t)}function ln(e){for(let t=0;t<e.length;t++)e[t].M=b}const E=new X;function Ae(e){if(e){Dt++;try{return e()}finally{Ae(),Dt--}}if(!E.ce)for(;Ge||b;)E.flush()}function ht(e,t){for(let n=0;n<e.length;n++)e[n](t)}function Or(e,t){if(e.O&(J|de))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&C&&e.Re instanceof U&&e.Re.source===t)}function Tr(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(Or(o,n)){i=!0;break}r.delete(o)}if(!i)e.oe.delete(n);else if(n.he&C&&n.Re?.source===n){t=!1;break}}if(t)for(let n=0;n<e.Z.length;n++){const r=e.Z[n];if(bt(r)&&"he"in r&&r.he&C&&r.Re instanceof U&&r.Re.source!==r){t=!1;break}}return t&&(e.ie=!0),t}function An(e){for(;e.ie&&typeof e.ie=="object";)e=e.ie;return e}function Ar(e,t){const n=b;try{return b=An(e),t()}finally{b=n}}function Rn(e){let t=e.ge;for(;t;)t.O|=J,t.O&le&&(ke(t,k),He(t,H)),Rn(t),t=t.De}function Ye(e,t=!1,n){const r=e.O;if(r&de)return;t&&(e.O=r|de),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;ke(s,s.O&J?H:k);let u=s.P;do u=Zt(u);while(u!==null);s.P=null,s.ye=null}Ye(i,!0),i=o}if(n?e.Ne=null:(e.ge=null,e.me=0),t&&!n&&!(r&J)&&e.i!==null&&!(e.i.O&de)){const o=e.we,s=e.De;o!==null?o.De=s:e.i.ge=s,s!==null&&(s.we=o),e.we=null}Rr(e,n)}function Rr(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 Pr(e,t){let n=e;for(;n.Oe&wt&&n.i;)n=n.i;if(n.id!=null)return kr(n.id,n.me++);throw new Error("Cannot get child id from owner without an id")}function Ht(e){return Pr(e)}function kr(e,t){const n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):"")+n}function Ze(){return $}function $t(e){return $&&($.be?Array.isArray($.be)?$.be.push(e):$.be=[$.be,e]:$.be=e),e}function Ir(e=!0){Ye(this,e)}function Ue(e){const t=$,n=e?.transparent??!1,r={id:e?.id??(n?t?.id:t?.id!=null?Ht(t):void 0),Oe:n?wt:0,t:!0,u:t?.t?t.u:t,ge:null,De:null,we:null,be:null,te:t?.te??E,Ve:t?.Ve||Gt,me:0,Ae:null,Ne:null,i:t,dispose:Ir};if(t){const i=t.ge;i===null||(r.De=i,i.we=r),t.ge=r}return r}function Yt(e,t){const n=Ue(t);return se(n,()=>e(()=>n.dispose()))}function Zt(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&Pe&&!(o.O&J)&&kn(o)}return n}function Pn(e){const t=e.ye;let n=t!==null?t.D:e.P;if(n!==null){do n=Zt(n);while(n!==null);t!==null?t.D=null:e.P=null}}function kn(e){ke(e,e.O&J?H:k);let t=e.P;for(;t!==null;)t=Zt(t);e.P=null,e.ye=null,Ye(e,!0)}function Ne(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||xr(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 xr(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 Lr(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 Nr(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 In(e){e.Ce=void 0,e.Pe?.clear(),e.Pe=void 0}function gt(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 Ft(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 qr(e){let t=!1;const n=new Set,r=i=>{if(n.has(i)||!Nr(i,e))return;n.add(i),i.Ie=M;const o=i.Ce??i.Pe?.values().next().value;if(o)gt(i,o),$e(i);else{if(i.he&=~C,gt(i),$e(i),i.Ge){if(i.J===_e){const s=i;s.ee||(s.ee=!0,s.te.enqueue(G,s.ne))}else{const s=i.O&J?H:k;s.C>i.o&&(s.C=i.o),He(i,s)}t=!0}i.Ge=!1}Ft(i,r)};Ft(e,r),t&&ve()}function Mr(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(Me(e)),Qt(e,l instanceof U?C:W,l),e.Ie=M)},u=(l,d)=>{if(e.ve!==t||e.O&(Oe|we))return;E.initTransition(Me(e));const h=!!(e.he&D);Pn(e),xn(e);const a=Ce(e);if(a&&a.F.delete(e),e.K!==void 0)e.K!==void 0&&e.K!==S?e.B=l:(e.ue=l,Te(e)),e.Ie=M;else if(a){const g=e.J,m=e.ue,p=e.ke;(!g&&h||!p||!p(l,m))&&(e.ue=l,e.Ie=M,e.Fe&&ce(e.Fe,l),Te(e,!0))}else ce(e,()=>l);qr(e),ve(),Ae(),d?.()};if(i){let l=!1,d=!0;if(t.then(h=>{d?(o=h,l=!0):u(h)},h=>{d||s(h)}),d=!1,!l)throw E.initTransition(Me(e)),new U($)}if(r){const l=t[Symbol.asyncIterator]();let d=!1,h=!1;$t(()=>{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(f=>{if(c)m=f,p=!0,f.done&&(h=!0);else{if(e.ve!==t)return;f.done?(h=!0,ve(),Ae()):u(f.value,a)}},f=>{!c&&e.ve===t&&(h=!0,s(f))}),c=!1,p&&!m.done?(o=m.value,d=!0,a()):p&&m.done},g=a();if(!d&&!g)throw E.initTransition(Me(e)),new U($)}return o}function xn(e,t=!1){(e.Ce||e.Pe)&&In(e),e.Ge&&(e.Ge=!1),e.he=t?0:e.he&D,e.Re&&gt(e),e.We&&$e(e),e.xe&&e.xe()}function Qt(e,t,n,r,i){t===W&&!(n instanceof Mt)&&!(n instanceof U)&&(n=new Mt(e,n));const o=t===C&&n instanceof U?n.source:void 0,s=o===e,u=t===C&&e.K!==void 0&&!s,l=u&&bt(e);r||(t===C&&o?(Lr(e,o),e.he=C|e.he&D,gt(e,o,n)):(In(e),e.he=t|(t!==W?e.he&D:0),e.Re=n),$e(e)),i&&!r&&Jt(e,i);const d=r||l,h=r||u?void 0:i;if(e.xe){if(r&&t===C)return;d?e.xe(t,n):e.xe();return}Ft(e,a=>{a.Ie=M,(t===C&&o&&a.Ce!==o&&!a.Pe?.has(o)||t!==C&&(a.Re!==n||a.Ce||a.Pe))&&(!d&&!a.M&&vt(a),Qt(a,t,n,d,h))})}let Dr=null;X.Ee=ue;X.Se=Ye;let j=!1,ne=!1,$=null,z=null;function ue(e,t=!1){const n=e.J;t||(e.M&&(!n||b)&&b!==e.M&&E.initTransition(e.M),ke(e,e.O&J?H:k),e.ve=null,e.M||n===_e?Ye(e):(e.ge!==null||e.be!==null)&&(Rn(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&C),s=!!(e.he&D),u=$;$=e,e.ye=null,e.O=pt,e.Ie=M;let l=e.B===S?e.ue:e.B,d=e.o,h=j,a=z;if(j=!0,r){const c=Ce(e);c&&(z=c)}else if(b&&!t&&b.Z.length)for(let c=e.P;c;c=c.D){const f=c.m;if(f.O&we){const y=Ce(f);if(y){r=!0,z=y,e.O|=we,Jt(e,y);break}}}const g=n&&n!==G,m=ne;g&&(ne=!0);try{if(e.Oe&zt)l=e.L(l),e.ve=null;else{const c=e.ve,f=e.L(l),y=typeof f=="object"&&f!==null,w=e.ve!==c;l=w||!y?f:Mr(e,f),!w&&!y&&(e.ve=null)}if(xn(e,t),e.G){const c=Ce(e);c&&(c.F.delete(e),$e(c.k))}}catch(c){if(c instanceof U&&z){const f=V(z);f.k!==e&&(f.F.add(e),e.G=f,$e(f.k))}c instanceof U&&(e.Ge=!0),Qt(e,c instanceof U?C:W,c,void 0,c instanceof U?e.G:void 0)}finally{j=h,g&&(ne=m),e.O=_n|(t?e.O&Vt:0),$=u}if(!e.Re){Pn(e);const c=i?e.K:e.B===S?e.ue:e.B,f=!n&&s||!e.ke||!e.ke(c,l);if(n&&f&&(e.ee=!e.Re,t||e.te.enqueue(n,X.Te.bind(null,e))),f){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)&&Te(e,r||i)}else if(i)e.B=l;else if(e.o!=d)for(let y=e.I;y!==null;y=y.p)Cn(y.h,y.h.O&J?H:k)}z=a,(e.B!==S||e.Ne!==null||e.Ae!==null||!!(e.he&(C|D)))&&(!t||e.he&C)&&!e.M&&!(b&&i)&&vt(e),e.M&&n&&b!==e.M&&Ar(e.M,()=>ue(e))}function Ln(e){if(e.O&Ke)for(let t=e.P;t;t=t.D){const n=t.m,r=n.V||n;if(r.L&&Ln(r),e.O&Oe)break}(e.O&(Oe|we)||e.Re&&e.Ie<M&&!e.ve)&&ue(e),e.O=e.O&(Vt|le|Ve)}function _t(e,t){const n=t?.transparent??!1,r={id:t?.id??(n?$?.id:$?.id!=null?Ht($):void 0),Oe:(n?wt:0)|(t?.ownedWrite?mt:0)|(!$||t?.lazy?Pe:0)|(t?.sync?zt:0)|0,ke:t?.equals!=null?t.equals:qn,X:t?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Gt,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?ct:_n,he:D,Ie:M,B:S,Ae:null,Ne:null,ve:null,M:null};return Nn(r,t),r}function Fr(e,t,n,r,i,o){const s=o?.transparent??!1,u={id:o?.id??(s?$?.id:$?.id!=null?Ht($):void 0),Oe:(s?wt:0)|(o?.ownedWrite?mt:0)|(o?.sync?zt:0)|0,ke:!1,X:o?.unobserved,be:null,te:$?.te??E,Ve:$?.Ve??Gt,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:ct,he:D,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 Nn(u,Br),u}const Br={lazy:!0};function Nn(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&&ue(e,!0)}function Be(e,t,n=null){const r={ke:t?.equals!=null?t.equals:qn,Oe:(t?.ownedWrite?mt:0)|(t?.Ye?fr: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 qn(e,t){return e===t}function ee(e,t){if(!j)return e();const n=j;j=!1;try{return e()}finally{j=n}}function Mn(e){let t=$;t?.t&&(t=t.u);const n=e;if(typeof n.L=="function"){const o=e;o.O&ct?(o.O&=~ct,ue(o,!0)):o.O&de&&ue(o,!0)}const r=e.V||e;if(!n.L&&r===e&&e.K===void 0&&e.pe===void 0&&b===null&&z===null)return t&&j&&Ne(e,t),!t||e.B===S?e.ue:e.B;if(t&&j&&(Ne(e,t),r.L)){const o=e.O&J;r.o>=(o?H.C:k.C)&&(at(t),yr(o?H:k),Ln(r));const s=r.o;s>=t.o&&e.i!==t&&(t.o=s+1)}if(r.he&C)if(t&&!(ne&&r.M&&b!==r.M))if(z){const o=r.G,s=V(z);if(o&&V(o)===s&&!bt(r))throw!j&&e!==t&&Ne(e,t),r.Re}else throw!j&&e!==t&&Ne(e,t),r.Re;else{if(t&&r!==e&&r.he&D)throw!j&&e!==t&&Ne(e,t),r.Re;if(!t&&r.he&D)throw r.Re}if(e.L&&e.he&W){if(e.Ie<M)return ue(e),Mn(e);throw e.Re}if(e.K!==void 0&&e.K!==S)return t&&ne&&vr(e)?e.ue:e.K;if(b!==null&&z!==null&&e.B!==S&&r===e&&!e.L&&t)return b.se.add(t),e.ue;const i=!t||z!==null&&(e.K!==void 0||e.G||r===e&&ne||r.he&C)||e.B===S||ne&&e.M&&b!==e.M?e.ue:e.B;return!t&&r===e&&typeof n.L=="function"&&e.Oe&Pe&&!(r.he&C)&&!e.I&&kn(e),i}function ce(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&D)))return n&&r&&e.L&&(Te(e,!0),ve()),t;if(n){const s=e.K===S;s||E.initTransition(Me(e)),s&&(e.B=e.ue,E.Z.push(e)),e.$=!0;const u=mr(e);e.G=u,e.K=t}else e.B===S&&vt(e),e.B=t;return e.We&&$e(e),e.Fe&&ce(e.Fe,t),e.Ie=M,Te(e,n),ve(),t}function jr(e){ke(e,e.O&J?H:k),!(e.O&ze)&&e.B===S&&vt(e),e.O=e.O&-4|ze}function Kr(e,t){const n=ce(e,t);return jr(e),n}function se(e,t){const n=$,r=j;$=e,j=!1;try{return t()}finally{$=n,j=r}}function Ur(e){const t=e,n=e.V;if(e.U){const r=e.U;return r.he&C&&!(r.he&D)?!0:e.B!==S&&!(t.he&D)}if(n&&e.B!==S)return!n.ve&&!(n.he&C);if(e.K!==void 0&&e.K!==S){if(t.he&C&&!(t.he&D))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&D)?!0:!!(t.he&C&&!(t.he&D))}function $e(e){if(e.We){const t=Ur(e),n=e.We;if(ce(n,t),!t&&n.G){const r=Ce(e);if(r&&r.F.size>0){const i=V(n.G);i!==r&&On(r,i)}ft.delete(n),n.G=void 0}}}function Wr(e,t=!0){const n=ne;ne=t;try{return e()}finally{ne=n}}function Vr(e,t=Ze()){if(!t)throw new $n;const n=Gr(e,t)?t.Ve[e.id]:e.defaultValue;if(Xt(n))throw new ar;return n}function zr(e,t,n=Ze()){if(!n)throw new $n;n.Ve={...n.Ve,[e.id]:Xt(t)?e.defaultValue:t}}function Gr(e,t){return!Xt(t?.Ve[e.id])}function Xt(e){return typeof e>"u"}function Dn(e,t,n,r){const i=!!r?.user,o=Fr(e,t,n,i?G:Ee,Jr,r);ue(o,!0),!r?.defer&&(o.J===G||r?.schedule?o.te.enqueue(o.J,Bt.bind(null,o)):Bt(o))}function Jr(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,C,0),this.J===G)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===Ee&&this.te.notify(this,C|W,n,r)}function Bt(e){if(!(!e.ee||e.O&de)){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,()=>$t(()=>e.$e?.())))}catch(t){if(e.Re=new Mt(e,t),e.he|=W,!e.te.notify(e,W,W))throw t}finally{e.Me=e.ue,e.ee=!1}}}X.Te=Bt;function Hr(e,t){const n=()=>{if(!(!r.ee||r.O&de))try{r.ee=!1,ue(r)}finally{}},r=_t(()=>{r.$e?.(),r.$e=void 0;const i=Wr(e);r.$e=i},{...t,lazy:!0});r.$e=void 0,r.Oe=r.Oe&~Pe|Sn,r.ee=!0,r.J=_e,r.xe=(i,o)=>{if((i!==void 0?i:r.he)&W){r.te.notify(r,C,0);const u=o!==void 0?o:r.Re;if(!r.te.notify(r,W,W))throw u}},r.ne=n,r.te.enqueue(G,n),$t(()=>r.$e?.())}function Fn(e){return $t(e)}function fe(e){const t=Mn.bind(null,e);return t[gr]=e,t}function Yr(e,t){if(typeof e=="function"){const r=_t(e,t);return r.Oe&=~Pe,[fe(r),Kr.bind(null,r)]}const n=Be(e,t);return[fe(n),ce.bind(null,n)]}function be(e,t){return fe(_t(e,t))}function Zr(e,t,n){Dn(e,t.effect||t,t.error,{user:!0,...n})}function Qr(e,t,n){Dn(e,t,void 0,n)}function Xr(e,t){Hr(e,t)}function ei(e){const t=Ze();t&&!(t.Oe&Sn)?Xr(()=>ee(e),void 0):E.enqueue(G,()=>{e()?.()})}const ti=Symbol(0),jt=Symbol(0);function un(e){return e==null||typeof e!="object"||Object.isFrozen(e)?!1:typeof Node>"u"||!(e instanceof Node)}const Bn=Symbol(0);function cn(e){return e==="__proto__"||e==="constructor"||e==="prototype"}function je(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"&&cn(r))return;if(Array.isArray(r)){for(let l=0;l<r.length;l++)t[n]=r[l],je(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,je(e,t,n));t[n]=r;return}else if(u&&s==="object"){const{from:l=0,to:d=e.length-1,by:h=1}=r;for(let a=l;a<=d;a+=h)t[n]=a,je(e,t,n);t[n]=r;return}else if(n<t.length-2){je(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===Bn)delete e[r];else if(r===void 0||un(i)&&un(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 d=u[l];if(cn(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=>{je(n,t)}},{DELETE:Bn});function nt(){return!0}const ni={get(e,t,n){return t===jt?n:e.get(t)},has(e,t){return t===jt?!0:e.has(t)},set:nt,deleteProperty:nt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:nt,deleteProperty:nt}},ownKeys(e){return e.keys()}};function Pt(e){return(e=typeof e=="function"?e():e)?e:{}}const kt=Symbol(0);function ri(...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&&jt in d;const h=!!d&&d[kt];if(h)for(let a=0;a<h.length;a++)n.push(h[a]);else n.push(typeof d=="function"?(t=!0,be(d)):d)}if(hr&&t)return new Proxy({get(l){if(l===kt)return n;for(let d=n.length-1;d>=0;d--){const h=Pt(n[d]);if(l in h)return h[l]}},has(l){for(let d=n.length-1;d>=0;d--)if(l in Pt(n[d]))return!0;return!1},keys(){const l=new Set;for(let d=0;d<n.length;d++){const h=Object.keys(Pt(n[d]));for(let a=0;a<h.length;a++)l.add(h[a])}return[...l]}},ni);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 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(d,g);r[g]=m.get?{enumerable:!0,configurable:!0,get:m.get.bind(d)}:m}}}if(!i)return n[o];const s={},u=Object.keys(r);for(let l=u.length-1;l>=0;l--){const d=u[l],h=r[d];h.get?Object.defineProperty(s,d,h):s[d]=h.value}return s[kt]=n,s}function ii(e,t,n){const r=typeof n?.keyed=="function"?n.keyed:void 0,i=t.length>1,o=t,s={Ze:Ue(),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=_t(oi.bind(s));return s.Ze.u=u,u.Oe&=~Pe,fe(u)}const rt={ownedWrite:!0};function oi(){const e=this.Be()||[],t=e.length;return e[ti],se(this.Ze,()=>{let n,r,i=this.nt?this.rt?()=>(this.nt[r]=Be(e[r],rt),this.Xe(fe(this.nt[r]),r)):()=>(this.nt[r]=Be(e[r],rt),this.it&&(this.it[r]=Be(r,rt)),this.Xe(fe(this.nt[r]),this.it?fe(this.it[r]):void 0)):this.it?()=>{const o=e[r];return this.it[r]=Be(r,rt),this.Xe(o,fe(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]=Ue(),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]=Ue(),i);this.qe=t}else{let o,s,u,l,d,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&&an(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&&an(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],d=this.tt?this.tt(l):l,n=h.get(d),a[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],m[r]=this.et[n],p&&(p[r]=this.nt[n]),c&&(c[r]=this.it[n]),r=a[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]=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]=Ue(),i);this.Je=this.Je.slice(0,this.qe=t),this.ze=e.slice(0)}}),this.Je}function an(e,t,n){return e?e(t)===e(n):!0}function en(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 Kt(e,n,t)?()=>{let r=[];return Kt(n,r,{...t,doNotUnwrap:!1}),r}:n}return e}}function Kt(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=Kt(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 jn(e,t){const n=Symbol("");function r(i){return Yt(()=>(zr(r,i.value),tn(()=>i.children)))}return r.id=n,r.defaultValue=e,r}function Kn(e){return Vr(e)}function tn(e){const t=be(e,{lazy:!0}),n=be(()=>en(t()),{lazy:!0,sync:!0});return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}class Se{static{for(const t of["all","allSettled","any","race","reject","resolve"])Se[t]=()=>new Se}catch(){return new Se}then(){return new Se}finally(){return new Se}}const Z=(...e)=>be(...e),q=(...e)=>Yr(...e),si=(...e)=>Qr(...e),St=(...e)=>Zr(...e);function I(e,t){return ee(()=>e(t||{}))}const li=e=>`Stale read from <${e}>.`;function lt(e){const t="fallback"in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed};return ii(()=>e.each,e.children,t)}function Un(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 li("Show");return n()})):o}return e.fallback},{sync:!0})}const B=Symbol("slot"),ui={transparent:!0,sync:!0},ci={sync:!0},Q=(e,t,n)=>si(e,t,n?{transparent:!0,sync:!0,...n}:ui),K=e=>Z(()=>e(),ci);function ai(e,t,n,r){let i=n.length,o=t.length,s=i,u=0,l=0,d=t[o-1],h=d[B],a=d.parentNode===e&&(!h||h===r)?d.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 f=n[l-1],y=f[B];c=f.parentNode===e&&(!y||y===r)?f.nextSibling:a}else c=n[s-l];else c=a;for(;l<s;){const f=n[l++];e.insertBefore(f,c),r&&(f[B]=r)}}else if(s===l)for(;u<o;){const c=t[u++];if(!g||!g.has(c)){const f=c[B];c.parentNode===e&&(!f||f===r)&&c.remove()}}else if((m=t[u])===n[s-1]&&n[l]===t[o-1]&&m.parentNode===e&&(!(p=m[B])||p===r))if(r)do{const c=t[--o];if(e.insertBefore(c,m),c[B]=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 f=l;for(;f<s;)g.set(n[f],f++)}const c=g.get(t[u]);if(c!=null)if(l<c&&c<s){let f=u,y=1,w;for(;++f<o&&f<s&&!((w=g.get(t[f]))==null||w!==c+y);)y++;if(y>c-l){const O=t[u],P=O[B],x=O.parentNode===e&&(!P||P===r)?O:a;for(;l<c;){const Y=n[l++];e.insertBefore(Y,x),r&&(Y[B]=r)}}else{const O=t[u++],P=n[l++],x=O[B];O.parentNode===e&&(!x||x===r)?e.replaceChild(P,O):e.insertBefore(P,a),r&&(P[B]=r)}}else u++;else{const f=t[u++],y=f[B];f.parentNode===e&&(!y||y===r)&&f.remove()}}}}const fn="_$DX_EVENT_OWNER",dn={},Ut=new Set,Re=new Map;function fi(e,t,n,r={}){let i;hi(t);try{Yt(o=>{if(i=o,t===document){const s=e();Q(()=>en(s),()=>{})}else{const s=e();v(t,()=>s,t.firstChild?null:void 0,n,r.insertOptions)}},{id:r.renderId})}catch(o){throw i&&i(),hn(t),o}return()=>{i(),hn(t),t.textContent=""}}function di(e,t,n){const r=document.createElement("template");return r.innerHTML=e,n===2?r.content.firstChild.firstChild:r.content.firstChild}function A(e,t){let n;return i=>(n||(n=di(e,i,t))).cloneNode(!0)}function Qe(e){for(let t=0,n=e.length;t<n;t++){const r=e[t];Ut.has(r)||(Ut.add(r),Re.forEach((i,o)=>Wn(r,o,i)))}}function hi(e){const t=gi(e,e);t&&(t.roots=(t.roots||0)+1)}function hn(e){const t=Re.get(e);t&&(t.roots>1?t.roots--:delete t.roots),yi(e,e)}function gi(e,t=e){if(!e||!t)return;let n=Re.get(e);return n||Re.set(e,n={owners:new Map,handlers:new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),Ut.forEach(r=>Wn(r,e,n)),n}function yi(e,t=e){const n=Re.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)),Re.delete(e))}function Wn(e,t,n){if(n.handlers.has(e))return;const r=i=>wi(i,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}function pi(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 he(e,t,n){n==null||n===!1?e.removeAttribute(t):e.setAttribute(t,n===!0?"":n)}function Je(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=yn(n||{}),t=yn(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 gn(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 mi(e,t){Array.isArray(e)?e.flat(1/0).forEach(n=>n&&n(t)):e(t)}function yt(e,t){const n=ee(e);se(null,()=>mi(n,t))}function v(e,t,n,r,i){const o=n!==void 0;if(o&&!r&&(r=[]),typeof t!="function"&&(t=xt(t,r,o,!0),typeof t!="function"))return It(e,t,r,n);if(o&&r.length===0){const u=document.createTextNode("");e.insertBefore(u,n),r=[u]}let s=r;Q(u=>{const l=xt(t(),s,o,!0);return typeof l!="function"?l:(Q(()=>xt(l,s,o),d=>{It(e,d,s,n),s=d},u!==void 0&&!(i&&i.schedule)?{...i,schedule:!0}:i),dn)},u=>{u!==dn&&(It(e,u,s,n),s=u)},i)}function yn(e){if(Array.isArray(e)){const t={};Vn(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 Vn(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n];Array.isArray(i)?Vn(i,t):typeof i=="object"&&i!=null?Object.assign(t,i):(i||i===0)&&(t[i]=!0)}}function wi(e,t,n){if(e[fn])return;const r=n&&(n.owners.size===1&&n.owners.has(t)?t:pi(e.target,n)?.owner);if(n&&!r)return;e[fn]=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}),d=()=>{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(;d()&&!(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],!!d());g++){if(i._$host){i=i._$host,h();break}if(i===u||i.parentNode===u)break}}else h()}else h();l(s)}function It(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)it(e,n,r);else if(t.nodeType)Array.isArray(n)?it(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[B]=r);else if(Array.isArray(t)){const s=n&&Array.isArray(n);t.length===0?it(e,n,r):s?n.length===0?pn(e,t,r):ai(e,n,t,r):(n&&it(e),pn(e,t))}}function xt(e,t,n,r){if(e=en(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 pn(e,t,n=null){for(let r=0,i=t.length;r<i;r++){const o=t[r];e.insertBefore(o,n),n&&(o[B]=n)}}function it(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[B],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[B]=n)}const bi=!1;function vi(e,t,n,r={}){try{const i=fi(e,t,n,{...r,insertOptions:{schedule:!0}});return Ae(),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 Wt;function nn(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),Wt=window.history.state._depth}nn();function $i(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function _i(e,t){let n=!1;return()=>{const r=Wt;nn();const i=r==null?null:Wt-r;if(n){n=!1;return}i&&t(i)?(n=!0,window.history.go(-i)):e()}}const Si=/^(?:[a-z0-9]+:)?\/\//i,Ei=/^\/+|(\/)\/+$/g,Gn="http://sr";function We(e,t=!1){const n=e.replace(Ei,"$1");return n?t||/^[?#]/.test(n)?n:"/"+n:""}function ut(e,t,n){if(Si.test(t))return;const r=We(e),i=n&&We(n);let o="";return!i||t.startsWith("/")?o=r:i.toLowerCase().indexOf(r.toLowerCase())!==0?o=r+i:o=i,(o||"/")+We(t,!o)}function Ci(e,t){if(e==null)throw new Error(t);return e}function Oi(e,t){return We(e).replace(/\/*(\*.*)?$/g,"")+We(t)}function Jn(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 Ti(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),d=l.length-s;if(d<0||d>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(),f=p?m.slice(1):m.toLowerCase();if(p&&Lt(c,a(f)))h.params[f]=c;else if(p||!Lt(c,f))return null;h.path+=`/${c}`}if(i){const g=d?l.slice(-d).join("/"):"";if(Lt(g,a(i)))h.params[i]=g;else return null}return h}}function Lt(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 Ai(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 Hn(e){const t=new Map,n=Ze();return new Proxy({},{get(r,i){return t.has(i)||se(n,()=>t.set(i,Z(()=>e()[i]))),t.get(i)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(r,i){return i in e()}})}function Yn(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 Yn(r).reduce((o,s)=>[...o,...i.map(u=>u+s)],[])}const Ri=100,Zn=jn(),Qn=jn();function Pi(e){try{return Kn(e)}catch{return}}const Xn=()=>Ci(Kn(Zn),"<A> and 'use' router primitives can be only used inside a Route."),er=()=>Xn().navigatorFactory(),ki=()=>Xn().params;function Ii(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 tr(e.path).reduce((l,d)=>{for(const h of Yn(d)){const a=Oi(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:d,pattern:g,matcher:Ti(g,!s,e.matchFilters)})}return l},[])}function xi(e,t=0){return{routes:e,score:Ai(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 tr(e){return Array.isArray(e)?e:[e]}function nr(e,t="",n=[],r=[]){const i=tr(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=Ii(u,t);for(const d of l){n.push(d);const h=Array.isArray(u.children)&&u.children.length===0;if(u.children&&!h)nr(u.children,d.pattern,n,r);else{const a=xi([...n],r.length);r.push(a)}n.pop()}}}return n.length?r:r.sort((o,s)=>s.score-o.score)}function Nt(e,t){for(let n=0,r=e.length;n<r;n++){const i=e[n].matcher(t);if(i)return i}return[]}function Li(e,t,n){const r=new URL(Gn),i=Z((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=Z(()=>i().pathname),s=Z(()=>i().search),u=Z(()=>i().hash),l=()=>"",d=Z(()=>Jn(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(d):Hn(d)}}let me;function Ni(){return me}function qi(e,t,n,r={}){const{signal:[i,o],utils:s={}}=e,u=s.parsePath||(R=>R),l=s.renderPath||(R=>R),d=s.beforeLeave||zn(),h=ut("",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]=q(!1,{ownedWrite:!0}),[p,c]=q(void 0,{ownedWrite:!0});let f;const y=Z(()=>p()??i()),w=Li(()=>y().value,()=>y().state,s.queryWrapper),O=[],P=q([],{ownedWrite:!0}),x=Z(()=>typeof r.transformUrl=="function"?Nt(t(),r.transformUrl(w.pathname)):Nt(t(),w.pathname)),Y=()=>{const R=x(),L={};for(let F=0;F<R.length;F++)Object.assign(L,R[F].params);return L},Et=s.paramsWrapper?s.paramsWrapper(Y,t):Hn(Y),Xe={pattern:h,path:()=>h,outlet:()=>null,resolvePath(R){return ut(h,R)}};return{base:Xe,location:w,params:Et,isRouting:g,renderPath:l,parsePath:u,navigatorFactory:Ie,matches:x,beforeLeave:d,preloadRoute:et,singleFlight:r.singleFlight===void 0?!0:r.singleFlight,submissions:P};function Ct(R,L,F){ee(()=>{if(typeof L=="number"){L&&(s.go?s.go(L):console.warn("Router integration does not support relative routing"));return}const ge=!L||L[0]==="?",{replace:ye,resolve:re,scroll:pe,state:ie}={replace:!1,resolve:!ge,scroll:!0,...F},ae=re?R.resolvePath(L):ut(ge&&w.pathname||"",L);if(ae===void 0)throw new Error(`Path '${L}' is not a routable path`);if(O.length>=Ri)throw new Error("Too many redirects");const _=y();if((ae!==_.value||ie!==_.state)&&!bi){if(d.confirm(ae,F)){O.push({value:_.value,replace:ye,scroll:pe,state:_.state});const T={value:ae,state:ie};f===void 0&&(m(!0),Ae()),me="navigate",f=T,f===T&&(c({...f}),queueMicrotask(()=>{f===T&&(me=void 0,xe(f),c(void 0),m(!1),f=void 0)}))}}})}function Ie(R){return R=R||Pi(Qn)||Xe,(L,F)=>Ct(R,L,F)}function xe(R){const L=O[0];L&&(o({...R,replace:L.replace,scroll:L.scroll}),O.length=0)}function et(R,L){const F=Nt(t(),R.pathname),ge=me;me="preload";for(let ye in F){const{route:re,params:pe}=F[ye];re.component&&re.component.preload&&re.component.preload();const{preload:ie}=re;L&&ie&&se(n(),()=>ie({params:pe,location:{pathname:R.pathname,search:R.search,hash:R.hash,query:Jn(R),state:null,key:""},intent:"preload"}))}me=ge}}function Mi(e,t,n,r){const{base:i,location:o,params:s}=e,{pattern:u,component:l,preload:d}=r().route,h=Z(()=>r().path);l&&l.preload&&l.preload();const a=d?d({params:s,location:o,intent:me||"initial"}):void 0;return{parent:t,pattern:u,path:h,outlet:()=>l?I(l,{params:s,location:o,data:a,get children(){return n()}}):n(),resolvePath(m){return ut(i.path(),m,h())}}}const Di=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})),d=tn(()=>l),h=Z(()=>nr(d(),r||""));let a;const g=qi(e,h,()=>a,{base:r,singleFlight:i,transformUrl:o});return e.create&&e.create(g),I(Zn,{value:g,get children(){return I(Fi,{routerState:g,root:s,preload:u,get children(){return[K(()=>(a=Ze())&&null),I(Bi,{routerState:g,get branches(){return h()}})]}})}})};function Fi(e){const t=e.routerState.location,n=e.routerState.params,r=Z(()=>e.preload&&ee(()=>{e.preload({params:n,location:t,intent:Ni()||"initial"})})),i=e.root;return i?I(i,{params:n,location:t,get data(){return r()},get children(){return e.children}}):e.children}function Bi(e){const t=[];let n,r;const i=Z(s=>{const u=e.routerState.matches(),l=r;let d=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]:(d=!1,t[a]&&t[a](),Yt(c=>{t[a]=c,h[a]=Mi(e.routerState,h[a-1]||e.routerState.base,mn(()=>i()?.[a+1]),()=>{const f=e.routerState.matches();return f[a]??f[0]})}))}return t.splice(u.length).forEach(a=>a()),s&&d?(r=u,s):(n=h[0],r=u,h)}),o=mn(()=>i()&&n);return K(o)}const mn=e=>()=>{const t=e();if(t)return I(Qn,{value:t,get children(){return t.outlet()}})},wn=e=>{const t=tn(()=>e.children);return ri(e,{get children(){return t()}})};function ji(e){let t=!1;const n=s=>typeof s=="string"?{value:s}:s,[r,i]=q(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&&Fn(e.init((s=e.get())=>{t=!0,o[1](n(s)),t=!1})),Di({signal:o,create:e.create,utils:e.utils})}function Ki(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function Ui(e,t){const n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}const Wi=new Map;function Vi({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 d(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 f=c.composedPath().find(Y=>Y instanceof Node&&Y.nodeName.toUpperCase()==="A");if(!f||t&&!f.hasAttribute("link"))return;const y=d(f),w=y?f.href.baseVal:f.href;if((y?f.target.baseVal:f.target)||!w&&!f.hasAttribute("state"))return;const P=(f.getAttribute("rel")||"").split(/\s+/);if(f.hasAttribute("download")||P&&P.includes("external"))return;const x=y?new URL(w,document.baseURI):new URL(w);if(!(x.origin!==window.location.origin||o&&x.pathname&&!x.pathname.toLowerCase().startsWith(o.toLowerCase())))return[f,x]}function a(c){const f=h(c);if(!f)return;const[y,w]=f,O=i.parsePath(w.pathname+w.search+w.hash),P=y.getAttribute("state");c.preventDefault(),s(O,{resolve:!1,replace:y.hasAttribute("replace"),scroll:!y.hasAttribute("noscroll"),state:P?JSON.parse(P):void 0})}function g(c){const f=h(c);if(!f)return;const[y,w]=f;r&&(w.pathname=r(w.pathname)),i.preloadRoute(w,y.getAttribute("preload")!=="false")}function m(c){clearTimeout(u);const f=h(c);if(!f)return l=null;const[y,w]=f;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 f=c.submitter&&c.submitter.hasAttribute("formaction")?c.submitter.getAttribute("formaction"):c.target.getAttribute("action");if(!f)return;if(!f.startsWith("https://action/")){const w=new URL(f,Gn);if(f=i.parsePath(w.pathname+w.search),!f.startsWith(n))return}if(c.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const y=Wi.get(f);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))}}Qe(["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),Fn(()=>{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 ji({get:t,set({value:r,replace:i,scroll:o,state:s}){i?window.history.replaceState($i(s),"",r):window.history.pushState(s,"",r),Ui(decodeURIComponent(window.location.hash.slice(1)),o),nn()},init:r=>Ki(window,"popstate",_i(r,i=>{if(i)return!n.confirm(i);{const o=t();return!n.confirm(o.value,{state:o.state})}})),create:Vi({preload:e.preload,explicitLinks:e.explicitLinks,actionBase:e.actionBase,transformUrl:e.transformUrl}),utils:{go:r=>window.history.go(r),beforeLeave:n}})(e)}var Gi=A('<div class=chat><div class=chat-messages></div><div class=chat-input><input type=text placeholder="Type a message..."><button type=button>Send'),Ji=A("<span class=chat-user>"),Hi=A("<span class=chat-time>"),Yi=A("<div><div class=chat-content>");function Zi(e){let t,n;St(()=>e.messages.length,()=>{n&&n.lastElementChild&&n.lastElementChild.scrollIntoView({behavior:"instant"})});const[r,i]=q(""),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 f=new Date(c),y=Math.floor((Date.now()-f.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`:f.toLocaleDateString([],{month:"short",day:"numeric"})}catch{return c}};var l=Gi(),d=l.firstChild,h=d.nextSibling,a=h.firstChild,g=a.nextSibling,m=n;typeof m=="function"||Array.isArray(m)?yt(()=>m,d):n=d,v(d,I(lt,{get each(){return e.messages},children:c=>(()=>{var f=Yi(),y=f.firstChild;return v(f,I(Un,{get when(){return c.msg_type!=="system"},get children(){return[(()=>{var w=Ji();return v(w,()=>c.user_name),w})(),(()=>{var w=Hi();return v(w,()=>u(c.created_at)),w})()]}}),y),v(y,()=>c.content),Q(()=>`chat-message${c.msg_type==="system"?" system":""}`,(w,O)=>{Je(f,w,O)}),f})()})),a.$$keydown=s,a.$$input=c=>i(c.currentTarget.value);var p=t;return typeof p=="function"||Array.isArray(p)?yt(()=>p,a):t=a,g.$$click=o,Q(()=>({e:r(),t:!r().trim()}),({e:c,t:f},y)=>{a.value=c??"",f!==y?.t&&he(g,"disabled",f)}),l}Qe(["input","keydown","click"]);function Qi(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 Xi(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(d){o?.readyState===WebSocket.OPEN?o.send(d):s.push(d)}return o.onopen=()=>{u=!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),a=Qi(h);a?.kind==="state"?n.onState(a.data):a?.kind==="chat"&&n.onChat(a.data)}catch{}},o.onclose=d=>{o=null,u?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 rr([e,t],n={}){St(()=>e(),r=>{if(!r||n.unless?.(r))return;const i=setTimeout(()=>t(null),n.ms??5e3);return()=>clearTimeout(i)})}function eo(e,t){const[n,r]=q(null),[i,o]=q([]),[s,u]=q(!1),[l,d]=q(null),[h,a]=q(null),g={current:!0},m=()=>{if(h())return;const c=Xi(e,t,{onState:f=>{g.current=!1,r(f)},onChat:f=>o(y=>{const w=[...y,f];return w.length>200?w.slice(-200):w}),onDisconnect:()=>{u(!1),a(null)},onError:f=>{d(f)}});a(()=>c),u(!0),d(null)};return ei(()=>{m(),setTimeout(()=>{g.current&&d("Room not found or unavailable")},8e3)}),St(()=>[s(),h()],([c,f])=>{if(!c&&!f){const y=setTimeout(m,3e3);return()=>clearTimeout(y)}}),rr([l,d],{unless:c=>c.includes("not found")}),{state:n,chats:i,connected:s,error:l,setError:d,send:c=>h()?.(c)}}var to=A("<div class=player>"),no=A("<div class=player-idle>Paste a URL to start watching together"),ro=A("<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>"),io=A("<div class=player-media-wrap><div class=player-media></div><button type=button>"),oo=A("<img class=player-thumb alt>"),so=A("<video controls><track kind=captions>"),lo=A("<audio controls><track kind=captions>");const ir="moqbox-volume",bn=()=>parseFloat(localStorage.getItem(ir)||"0.5");function uo(e){const t=Math.round(e.volume*100)/100;localStorage.setItem(ir,t.toString())}function co(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 qt(e,t){const n=(Date.now()-t)/1e3;e.currentTime=n}function ao(e){let t;const[n,r]=q(!0),i=e.roomId,o=a=>{t&&t.removeEventListener("volumechange",s),t=a??void 0,a&&(a.volume=bn(),a.addEventListener("volumechange",s))},s=()=>{const a=t;a&&uo(a)};let u=null;St(()=>{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,f=`/api/v1/rooms/${i}/media/${m.hash}`;p.src=f,p.volume=bn();let y;const w=()=>{qt(p,c);const P=()=>{r(!0),p.play().catch(()=>{}),y=()=>{const x=u?.started_at;if(!x)return;const Y=(Date.now()-x)/1e3;r(Math.abs(p.currentTime-Y)<.5)},p.addEventListener("timeupdate",y),p.addEventListener("pause",O)};p.addEventListener("seeked",P,{once:!0})};p.addEventListener("loadedmetadata",w,{once:!0}),p.addEventListener("canplay",w,{once:!0});const O=()=>{p.ended||qt(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")}`},d=()=>{const a=t,g=e.track?.started_at;a&&g&&(qt(a,g),r(!0))};var h=to();return v(h,I(Un,{get when(){return e.track},get fallback(){return no()},children:a=>{const g=a();return[(()=>{var m=ro(),p=m.firstChild,c=p.firstChild,f=c.nextSibling,y=f.firstChild,w=y.nextSibling;return v(m,(()=>{var O=K(()=>!!g.thumbnail);return()=>O()&&(()=>{var P=oo();return P.addEventListener("error",x=>x.currentTarget.hidden=!0),Q(()=>g.thumbnail,x=>{he(P,"src",x)}),P})()})(),p),v(c,()=>g.title),v(y,()=>g.duration),v(w,()=>l(Date.now()-g.started_at)),m})(),(()=>{var m=io(),p=m.firstChild,c=p.nextSibling;return v(p,(()=>{var f=K(()=>!!co(g));return()=>f()?(()=>{var y=so();return gn(y,"ended",e.onEnded),yt(()=>o,y),y})():(()=>{var y=lo();return gn(y,"ended",e.onEnded),yt(()=>o,y),y})()})()),c.$$click=d,v(c,()=>n()?"Live":"Go live"),Q(()=>["live-btn",n()&&"live-btn--on"],(f,y)=>{Je(c,f,y)}),m})()]}})),h}Qe(["click"]);var fo=A("<div><span class=queue-title></span><span class=queue-duration>"),ho=A("<img class=queue-thumb alt>"),go=A("<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"),yo=A("<div class=queue-empty>Paste a URL to start watching together"),po=A("<div class=queue-empty>Tracks you add will appear here"),mo=A('<div class=queue-item-row><button type=button class="queue-item-action queue-item-remove"title="Remove from playlist">×'),wo=A("<div class=queue-empty>Add links to build a perpetual playlist"),bo=A('<div class=queue-item-row><button type=button class=queue-item-action title="Add to playlist">+'),vo=A("<div class=queue-empty>Recently played tracks show up here");function ot(e){var t=fo(),n=t.firstChild,r=n.nextSibling;return v(t,(()=>{var i=K(()=>!!e.thumbnail);return()=>i()&&(()=>{var o=ho();return o.addEventListener("error",s=>s.currentTarget.hidden=!0),Q(()=>e.thumbnail,s=>{he(o,"src",s)}),o})()})(),n),v(n,()=>e.pending?"⏳ ":"",null),v(n,()=>e.title,null),v(r,()=>e.duration),Q(()=>`queue-item${e.extraClass?" "+e.extraClass:""}`,(i,o)=>{Je(t,i,o)}),t}function $o(e){var t=go(),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,d=l.firstChild,h=d.nextSibling,a=h.nextSibling,g=a.nextSibling,m=g.firstChild,p=u.nextSibling;return p.firstChild,v(n,(()=>{var c=K(()=>!!e.currentTrack);return()=>c()?I(ot,{get title(){return e.currentTrack.title},get duration(){return e.currentTrack.duration},get thumbnail(){return e.currentTrack.thumbnail},extraClass:"current"}):yo()})(),null),v(i,()=>e.queue.length,s),v(r,I(lt,{get each(){return e.queue},children:c=>I(ot,{get title(){return c.title},get duration(){return c.duration},get thumbnail(){return c.thumbnail},get pending(){return c.pending}})}),null),v(r,(()=>{var c=K(()=>e.queue.length===0);return()=>c()&&po()})(),null),v(l,()=>e.playlist.length,h),m.addEventListener("change",c=>e.onTogglePlaylist?.(c.currentTarget.checked)),v(u,I(lt,{get each(){return e.playlist},children:c=>(()=>{var f=mo(),y=f.firstChild;return v(f,I(ot,{get title(){return c.title},get duration(){return c.duration},get thumbnail(){return c.thumbnail},get pending(){return c.pending}}),y),y.$$click=()=>e.onRemoveFromPlaylist?.(c.id),f})()}),null),v(u,(()=>{var c=K(()=>e.playlist.length===0);return()=>c()&&wo()})(),null),v(p,I(lt,{get each(){return e.history},children:c=>(()=>{var f=bo(),y=f.firstChild;return v(f,I(ot,{get title(){return c.title},get duration(){return c.duration},get thumbnail(){return c.thumbnail},extraClass:"history"}),y),y.$$click=()=>e.onAddToPlaylist?.(c.url),f})()}),null),v(p,(()=>{var c=K(()=>e.history.length===0);return()=>c()&&vo()})(),null),Q(()=>({e:e.playlistEnabled,t:e.playlist.length===0}),({e:c,t:f},y)=>{m.checked=c,f!==y?.t&&he(m,"disabled",f)}),t}Qe(["click"]);const or="moqbox-theme";function sr(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(or,e)}function _o(e){return e==="macchiato"?"latte":e==="latte"?"system":"macchiato"}function lr(){return localStorage.getItem(or)||"system"}var So=A('<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>'),Eo=A('<div class="toast toast-error"role=alert>'),Co=A("<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>"),Oo=A("<span class=disconnected>Disconnected"),To=A('<div class="toast toast-error"role=alert><span></span><button type=button class=toast-action>Go back'),Ao=A('<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 Ro=()=>{const e=er(),[t,n]=q(""),[r,i]=q(!1),[o,s]=q(null);rr([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(`/room/${c.room_id}?name=${encodeURIComponent(t().trim())}`)}catch(p){console.error("Failed to create room:",p),s("Failed to create room"),i(!1)}}};var l=So(),d=l.firstChild,h=d.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,v(m,()=>r()?"Creating...":"Create Room"),v(l,(()=>{var p=K(()=>!!o());return()=>p()&&(()=>{var c=Eo();return v(c,o),c})()})(),null),Q(()=>({e:t(),t:r()||!t().trim()}),({e:p,t:c},f)=>{g.value=p??"",c!==f?.t&&he(m,"disabled",c)}),l},Po=()=>{const e=ki(),t=ee(()=>e.id),r=new URLSearchParams(location.search).get("name")||"anonymous",i=er(),[o,s]=q(lr()),u=()=>{const _=_o(o());sr(_),s(_)},{state:l,chats:d,connected:h,error:a,setError:g,send:m}=eo(t,r),[p,c]=q(!1),[f,y]=q(""),[w,O]=q("queue"),[P,x]=q(!1),Y=async()=>{const _=f().trim();if(_){x(!0);try{const T=w()==="queue"?"/api/v1/ingest":"/api/v1/playlist/add",N=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:_,room_id:t})});if(!N.ok){if(N.status===429){const oe=N.headers.get("Retry-After");g(oe?`Too fast — try again in ${oe}s`:"Too fast — try again in a moment")}else{const oe=await N.json().catch(()=>({error:N.statusText}));g(oe.error||`${w()} failed`)}return}y(""),c(!1),g(null)}catch(T){g(String(T))}finally{x(!1)}}},Et=async _=>{try{const T=await fetch("/api/v1/playlist/add",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:_,room_id:t})});if(!T.ok){const N=await T.json().catch(()=>({error:T.statusText}));g(N.error||"Failed to add to playlist")}}catch(T){g(String(T))}},Xe=async _=>{try{const T=await fetch("/api/v1/playlist/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({room_id:t,id:_})});if(!T.ok){const N=await T.json().catch(()=>({error:T.statusText}));g(N.error||"Failed to remove from playlist")}}catch(T){g(String(T))}},Ct=_=>{m({type:"set_playlist_enabled",enabled:_})};var Ie=Co(),xe=Ie.firstChild,et=xe.firstChild,R=et.nextSibling,L=xe.nextSibling,F=L.firstChild,ge=F.firstChild,ye=ge.firstChild,re=ye.nextSibling,pe=F.nextSibling,ie=pe.firstChild,ae=ie.firstChild;return v(et,()=>l()?.room_name??"Loading..."),v(R,(()=>{var _=K(()=>l()?.clients!=null);return()=>_()?`${l()?.clients} connected`:""})()),v(xe,(()=>{var _=K(()=>!h());return()=>_()&&Oo()})(),null),v(Ie,(()=>{var _=K(()=>!!a());return()=>_()&&(()=>{var T=To(),N=T.firstChild,oe=N.nextSibling;return v(N,a),oe.$$click=()=>i("/"),T})()})(),L),v(F,I(ao,{get track(){return l()?.current_track??null},roomId:t,onEnded:()=>{const _=l()?.current_track;_&&m({type:"track_ended",item_id:_.id})}}),ge),ye.$$click=()=>{c(!p())},v(ye,()=>p()?"Cancel":"Add"),re.$$click=()=>m({type:"skip"}),v(F,(()=>{var _=K(()=>!!p());return()=>_()&&(()=>{var T=Ao(),N=T.firstChild,oe=N.nextSibling,Ot=oe.firstChild,rn=Ot.nextSibling,Tt=oe.nextSibling;return N.$$keydown=Le=>Le.key==="Enter"&&Y(),N.$$input=Le=>y(Le.currentTarget.value),Ot.$$click=()=>O("queue"),rn.$$click=()=>O("playlist"),Tt.$$click=Y,v(Tt,()=>P()?"Adding...":"Add"),Q(()=>({e:f(),t:w()==="queue"?"active":"",a:w()==="playlist"?"active":"",o:P()||!f().trim()}),({e:Le,t:ur,a:cr,o:on},At)=>{N.value=Le??"",Je(Ot,ur,At?.t),Je(rn,cr,At?.a),on!==At?.o&&he(Tt,"disabled",on)}),T})()})(),null),v(pe,I($o,{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:Et,onRemoveFromPlaylist:Xe,onTogglePlaylist:Ct}),ie),v(pe,I(Zi,{get messages(){return d()},onSend:_=>m({type:"chat",content:_})}),ie),ae.$$click=u,v(ae,(()=>{var _=K(()=>o()==="macchiato");return()=>_()?"Dark":o()==="latte"?"Light":"System"})()),Q(()=>({e:!l()?.current_track,t:`Theme: ${o()}`}),({e:_,t:T},N)=>{_!==N?.e&&he(re,"disabled",_),T!==N?.t&&he(ae,"title",T)}),Ie},ko=()=>(sr(lr()),I(zi,{get children(){return[I(wn,{path:"/",component:Ro}),I(wn,{path:"/room/:id",component:Po})]}}));Qe(["input","keydown","click"]);const vn=document.getElementById("root");vn&&vi(()=>I(ko,{}),vn);
+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-dTCvdWLw.js"></script> 14 - <link rel="stylesheet" crossorigin href="/assets/index-DGSP7qCt.css"> 13 + <script type="module" crossorigin src="/assets/index-DnsnxcTM.js"></script> 14 + <link rel="stylesheet" crossorigin href="/assets/index-DrH7LpDB.css"> 15 15 </head> 16 16 <body> 17 17 <div id="root"></div>