From 21e18d7da9689881d3bcd120e708118d2a022c1b Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Mon, 29 Apr 2024 20:48:26 +0100 Subject: [PATCH 01/22] Do not reopen files back and forth, less bugs --- crates/librqbit/src/chunk_tracker.rs | 3 -- crates/librqbit/src/opened_file.rs | 17 ------- .../src/torrent_state/initializing.rs | 2 - crates/librqbit/src/torrent_state/live/mod.rs | 46 +------------------ 4 files changed, 1 insertion(+), 67 deletions(-) diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index b830186e..ef8db7c4 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -156,9 +156,6 @@ impl ChunkTracker { &self.have } - pub fn get_selected_pieces(&self) -> &BF { - &self.selected - } pub fn reserve_needed_piece(&mut self, index: ValidPieceIndex) { self.queue_pieces.set(index.get() as usize, false) } diff --git a/crates/librqbit/src/opened_file.rs b/crates/librqbit/src/opened_file.rs index 357a9605..205b7b7a 100644 --- a/crates/librqbit/src/opened_file.rs +++ b/crates/librqbit/src/opened_file.rs @@ -7,7 +7,6 @@ use std::{ use anyhow::Context; use librqbit_core::lengths::Lengths; use parking_lot::Mutex; -use tracing::debug; #[derive(Debug)] pub(crate) struct OpenedFile { @@ -63,22 +62,6 @@ impl OpenedFile { piece_range, } } - pub fn reopen(&self, read_only: bool) -> anyhow::Result<()> { - let log_suffix = if read_only { " read only" } else { "" }; - - let mut open_opts = std::fs::OpenOptions::new(); - open_opts.read(true); - if !read_only { - open_opts.write(true).create(false); - } - - let mut g = self.file.lock(); - *g = open_opts - .open(&self.filename) - .with_context(|| format!("error re-opening {:?}{log_suffix}", self.filename))?; - debug!("reopened {:?}{log_suffix}", self.filename); - Ok(()) - } pub fn take(&self) -> anyhow::Result { let mut f = self.file.lock(); diff --git a/crates/librqbit/src/torrent_state/initializing.rs b/crates/librqbit/src/torrent_state/initializing.rs index d77634e3..02f1376c 100644 --- a/crates/librqbit/src/torrent_state/initializing.rs +++ b/crates/librqbit/src/torrent_state/initializing.rs @@ -121,8 +121,6 @@ impl TorrentStateInitializing { ); } } - - file.reopen(true)?; } Ok::<_, anyhow::Error>(()) })?; diff --git a/crates/librqbit/src/torrent_state/live/mod.rs b/crates/librqbit/src/torrent_state/live/mod.rs index 38e5399c..387e09ea 100644 --- a/crates/librqbit/src/torrent_state/live/mod.rs +++ b/crates/librqbit/src/torrent_state/live/mod.rs @@ -176,32 +176,6 @@ pub struct TorrentStateLive { cancellation_token: CancellationToken, } -fn reopen_necessary_files_for_write(ct: &ChunkTracker, files: &OpenedFiles) -> anyhow::Result<()> { - // Reopen files that we don't have, but have selected in write-only mode. - for opened_file in files.iter() { - let prange = opened_file.piece_range_usize(); - if prange.is_empty() { - continue; - } - let selected = ct - .get_selected_pieces() - .get(prange.clone()) - .with_context(|| format!("bug: bad range get_selected_pieces(), {prange:?}"))?; - let have = ct - .get_have_pieces() - .get(prange.clone()) - .with_context(|| format!("bug: bad range get_have_pieces(), {prange:?}"))?; - let need_write = selected - .iter() - .zip(have.iter()) - .any(|(selected, have)| *selected && !*have); - if need_write { - opened_file.reopen(false)?; - } - } - Ok(()) -} - impl TorrentStateLive { pub(crate) fn new( paused: TorrentStatePaused, @@ -216,8 +190,6 @@ impl TorrentStateLive { let have_bytes = paused.chunk_tracker.get_hns().have_bytes; let lengths = *paused.chunk_tracker.get_lengths(); - reopen_necessary_files_for_write(&paused.chunk_tracker, &paused.files)?; - // TODO: make it configurable let file_priorities = { let mut pri = (0..paused.files.len()).collect::>(); @@ -661,9 +633,7 @@ impl TorrentStateLive { .iter() .map(|f| f.take_clone()) .collect::>>()?; - for file in files.iter() { - file.reopen(true)?; - } + let mut chunk_tracker = g .chunks .take() @@ -697,7 +667,6 @@ impl TorrentStateLive { let mut g = self.lock_write("update_only_files"); let ct = g.get_chunks_mut()?; let hns = ct.update_only_files(self.files.iter().map(|f| f.len), only_files)?; - reopen_necessary_files_for_write(ct, &self.files)?; if !hns.finished() { self.reconnect_all_not_needed_peers(); } @@ -721,19 +690,6 @@ impl TorrentStateLive { if bytes == 0 { warn!(file_id=idx, piece_id=id.get(), "bug: update_have_on_piece_completed() returned 0, although this piece is present in the file"); } - - let have_all = self - .lock_read("on_piece_completed_reopen") - .get_chunks()? - .get_have_pieces() - .get(opened_file.piece_range_usize()) - .with_context(|| { - format!("bug: invalid range {:?}", opened_file.piece_range_usize()) - })? - .all(); - if have_all { - opened_file.reopen(true)?; - } } if self.is_finished() { From 278911c81eaeefb747703c967b0c054b842c3acf Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 18:53:15 +0100 Subject: [PATCH 02/22] Streaming test --- crates/librqbit/src/torrent_state/live/mod.rs | 2 +- crates/librqbit/src/torrent_state/mod.rs | 4 + .../librqbit/src/torrent_state/streaming.rs | 226 ++++++++++++++++++ 3 files changed, 231 insertions(+), 1 deletion(-) create mode 100644 crates/librqbit/src/torrent_state/streaming.rs diff --git a/crates/librqbit/src/torrent_state/live/mod.rs b/crates/librqbit/src/torrent_state/live/mod.rs index 387e09ea..60dd1d58 100644 --- a/crates/librqbit/src/torrent_state/live/mod.rs +++ b/crates/librqbit/src/torrent_state/live/mod.rs @@ -158,7 +158,7 @@ pub struct TorrentStateLive { meta: Arc, locked: RwLock, - files: OpenedFiles, + pub(crate) files: OpenedFiles, stats: AtomicStats, lengths: Lengths, diff --git a/crates/librqbit/src/torrent_state/mod.rs b/crates/librqbit/src/torrent_state/mod.rs index adb2d623..65071eff 100644 --- a/crates/librqbit/src/torrent_state/mod.rs +++ b/crates/librqbit/src/torrent_state/mod.rs @@ -2,6 +2,7 @@ pub mod initializing; pub mod live; pub mod paused; pub mod stats; +mod streaming; pub mod utils; use std::collections::HashSet; @@ -41,6 +42,7 @@ use initializing::TorrentStateInitializing; use self::paused::TorrentStatePaused; pub use self::stats::{TorrentStats, TorrentStatsState}; +use self::streaming::TorrentStreams; pub enum ManagedTorrentState { Initializing(Arc), @@ -92,6 +94,7 @@ pub struct ManagedTorrentInfo { pub struct ManagedTorrent { pub info: Arc, + pub(crate) streams: TorrentStreams, locked: RwLock, } @@ -548,6 +551,7 @@ impl ManagedTorrentBuilder { only_files: self.only_files, }), info, + streams: Default::default(), })) } } diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs new file mode 100644 index 00000000..555df7a5 --- /dev/null +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -0,0 +1,226 @@ +use std::{ + io::{Read, Seek, SeekFrom}, + sync::{ + atomic::{AtomicUsize, Ordering}, + Arc, + }, + task::{Poll, Waker}, +}; + +use anyhow::Context; +use dashmap::DashMap; +use librqbit_core::lengths::ValidPieceIndex; +use tokio::io::{AsyncRead, AsyncSeek}; + +use crate::{opened_file::OpenedFile, ManagedTorrent}; + +use super::ManagedTorrentHandle; + +type StreamId = usize; + +#[derive(Default)] +pub(crate) struct TorrentStreams { + next_stream_id: AtomicUsize, + wakers_by_stream: DashMap, +} + +impl TorrentStreams { + fn next_id(&self) -> usize { + self.next_stream_id.fetch_add(1, Ordering::Relaxed) + } + + fn register_waker(&self, stream_id: StreamId, piece_id: ValidPieceIndex, waker: Waker) { + self.wakers_by_stream.insert(stream_id, (piece_id, waker)); + } + + pub(crate) fn wake_streams_on_piece_completed(&self, piece_id: ValidPieceIndex) { + let mut woken = Vec::new(); + for w in self.wakers_by_stream.iter() { + if w.value().0 == piece_id { + w.value().1.wake_by_ref(); + woken.push(*w.key()); + } + } + for w in woken { + self.wakers_by_stream.remove(&w); + } + } + + fn drop_stream(&self, stream_id: StreamId) { + self.wakers_by_stream.remove(&stream_id); + } +} + +struct FileStream { + torrent: ManagedTorrentHandle, + stream_id: usize, + file_id: usize, + position: u64, + + // file params + file_len: u64, + file_torrent_abs_offset: u64, +} + +macro_rules! map_io_err { + ($e:expr) => { + $e.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)) + }; +} + +macro_rules! poll_try_io { + ($e:expr) => {{ + let e = map_io_err!($e); + match e { + Ok(r) => r, + Err(e) => return Poll::Ready(Err(e)), + } + }}; +} + +impl AsyncRead for FileStream { + fn poll_read( + mut self: std::pin::Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + buf: &mut tokio::io::ReadBuf<'_>, + ) -> Poll> { + // if the file is over, return 0 + if self.position == self.file_len { + return Poll::Ready(Ok(())); + } + + // determine the piece that position is pointing to. + let lengths = &self.torrent.info().lengths; + let dpl = lengths.default_piece_length(); + + let abs_pos = self.file_torrent_abs_offset + self.position; + let piece_id = abs_pos / dpl as u64; + let piece_id: u32 = poll_try_io!(piece_id.try_into()); + + let piece_id = poll_try_io!(lengths + .validate_piece_index(piece_id) + .context("bug: invalid piece")); + let piece_len = lengths.piece_length(piece_id); + let piece_offset = abs_pos % dpl as u64; + let piece_remaining = piece_len as u64 - piece_offset; + + // queue N pieces after this if not yet + // TODO + + // if the piece is not there, register to wake when it is + // check if we have the piece for real + let have = poll_try_io!(self.torrent.with_chunk_tracker(|ct| { + let have = ct.get_have_pieces()[piece_id.get() as usize]; + if !have { + self.torrent + .streams + .register_waker(self.stream_id, piece_id, cx.waker().clone()); + } + have + })); + if !have { + return Poll::Pending; + } + + // actually stream the piece + let buf = buf.initialize_unfilled(); + let file_remaining = self.file_len - self.position; + let bytes_to_read: usize = poll_try_io!((piece_len as u64) + .min(buf.len() as u64) + .min(piece_remaining) + .min(file_remaining) + .try_into()); + + let buf = &mut buf[..bytes_to_read]; + + poll_try_io!(poll_try_io!(self.torrent.with_opened_file( + self.file_id, + |fd| { + let mut g = fd.file.lock(); + g.seek(SeekFrom::Start(self.position))?; + g.read_exact(buf)?; + Ok::<_, anyhow::Error>(()) + } + ))); + + self.as_mut().position += buf.len() as u64; + + Poll::Ready(Ok(())) + } +} + +impl AsyncSeek for FileStream { + fn start_seek( + mut self: std::pin::Pin<&mut Self>, + position: std::io::SeekFrom, + ) -> std::io::Result<()> { + let end_i64 = map_io_err!(TryInto::::try_into(self.file_len))?; + let new_pos: i64 = match position { + SeekFrom::Start(s) => { + self.as_mut().position = s; + return Ok(()); + } + SeekFrom::End(e) => map_io_err!(TryInto::::try_into(self.file_len))? + e, + SeekFrom::Current(o) => map_io_err!(TryInto::::try_into(self.position))? + o, + }; + + if new_pos < 0 || new_pos > end_i64 { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + anyhow::anyhow!("invalid seek"), + )); + } + + self.as_mut().position = map_io_err!(new_pos.try_into())?; + Ok(()) + } + + fn poll_complete( + self: std::pin::Pin<&mut Self>, + _cx: &mut std::task::Context<'_>, + ) -> Poll> { + Poll::Ready(Ok(self.position)) + } +} + +impl Drop for FileStream { + fn drop(&mut self) { + self.torrent.streams.drop_stream(self.stream_id) + } +} + +impl ManagedTorrent { + fn with_opened_file(&self, file_id: usize, f: F) -> anyhow::Result + where + F: FnOnce(&OpenedFile) -> R, + { + self.with_state(|s| { + let files = match s { + crate::ManagedTorrentState::Paused(p) => &p.files, + crate::ManagedTorrentState::Live(l) => &l.files, + _ => anyhow::bail!("invalid state"), + }; + let fd = files.get(file_id).context("invalid file")?; + Ok(f(fd)) + }) + } + + pub fn stream(self: Arc, file_id: usize) -> anyhow::Result { + let (fd_len, fd_offset) = + self.with_opened_file(file_id, |fd| (fd.len, fd.offset_in_torrent))?; + Ok(FileStream { + stream_id: { + let this = &self; + &this.streams + } + .next_id(), + + file_id, + position: 0, + + file_len: fd_len, + file_torrent_abs_offset: fd_offset, + torrent: self, + }) + } +} From 7db807de5fd8806d479a3be8dab77d7b99830175 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 18:58:30 +0100 Subject: [PATCH 03/22] Streaming test --- .../src/torrent_state/initializing.rs | 1 + crates/librqbit/src/torrent_state/live/mod.rs | 7 ++++++ crates/librqbit/src/torrent_state/mod.rs | 3 --- crates/librqbit/src/torrent_state/paused.rs | 3 ++- .../librqbit/src/torrent_state/streaming.rs | 23 +++++++++++-------- 5 files changed, 24 insertions(+), 13 deletions(-) diff --git a/crates/librqbit/src/torrent_state/initializing.rs b/crates/librqbit/src/torrent_state/initializing.rs index 02f1376c..2d55189e 100644 --- a/crates/librqbit/src/torrent_state/initializing.rs +++ b/crates/librqbit/src/torrent_state/initializing.rs @@ -136,6 +136,7 @@ impl TorrentStateInitializing { info: self.meta.clone(), files, chunk_tracker, + streams: Arc::new(Default::default()), }; Ok(paused) } diff --git a/crates/librqbit/src/torrent_state/live/mod.rs b/crates/librqbit/src/torrent_state/live/mod.rs index 60dd1d58..57b758e6 100644 --- a/crates/librqbit/src/torrent_state/live/mod.rs +++ b/crates/librqbit/src/torrent_state/live/mod.rs @@ -104,6 +104,7 @@ use self::{ use super::{ paused::TorrentStatePaused, + streaming::TorrentStreams, utils::{timeit, TimedExistence}, ManagedTorrentInfo, }; @@ -174,6 +175,8 @@ pub struct TorrentStateLive { down_speed_estimator: SpeedEstimator, up_speed_estimator: SpeedEstimator, cancellation_token: CancellationToken, + + pub(crate) streams: Arc, } impl TorrentStateLive { @@ -219,6 +222,7 @@ impl TorrentStateLive { down_speed_estimator, up_speed_estimator, cancellation_token, + streams: paused.streams, }); state.spawn( @@ -647,6 +651,7 @@ impl TorrentStateLive { info: self.meta.clone(), files, chunk_tracker, + streams: self.streams.clone(), }) } @@ -692,6 +697,8 @@ impl TorrentStateLive { } } + self.streams.wake_streams_on_piece_completed(id); + if self.is_finished() { info!("torrent finished downloading"); self.finished_notify.notify_waiters(); diff --git a/crates/librqbit/src/torrent_state/mod.rs b/crates/librqbit/src/torrent_state/mod.rs index 65071eff..e2032361 100644 --- a/crates/librqbit/src/torrent_state/mod.rs +++ b/crates/librqbit/src/torrent_state/mod.rs @@ -42,7 +42,6 @@ use initializing::TorrentStateInitializing; use self::paused::TorrentStatePaused; pub use self::stats::{TorrentStats, TorrentStatsState}; -use self::streaming::TorrentStreams; pub enum ManagedTorrentState { Initializing(Arc), @@ -94,7 +93,6 @@ pub struct ManagedTorrentInfo { pub struct ManagedTorrent { pub info: Arc, - pub(crate) streams: TorrentStreams, locked: RwLock, } @@ -551,7 +549,6 @@ impl ManagedTorrentBuilder { only_files: self.only_files, }), info, - streams: Default::default(), })) } } diff --git a/crates/librqbit/src/torrent_state/paused.rs b/crates/librqbit/src/torrent_state/paused.rs index 23d8fd33..848d89d9 100644 --- a/crates/librqbit/src/torrent_state/paused.rs +++ b/crates/librqbit/src/torrent_state/paused.rs @@ -5,12 +5,13 @@ use crate::{ type_aliases::OpenedFiles, }; -use super::ManagedTorrentInfo; +use super::{streaming::TorrentStreams, ManagedTorrentInfo}; pub struct TorrentStatePaused { pub(crate) info: Arc, pub(crate) files: OpenedFiles, pub(crate) chunk_tracker: ChunkTracker, + pub(crate) streams: Arc, } impl TorrentStatePaused { diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs index 555df7a5..27836c94 100644 --- a/crates/librqbit/src/torrent_state/streaming.rs +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -53,6 +53,7 @@ impl TorrentStreams { struct FileStream { torrent: ManagedTorrentHandle, + streams: Arc, stream_id: usize, file_id: usize, position: u64, @@ -112,8 +113,7 @@ impl AsyncRead for FileStream { let have = poll_try_io!(self.torrent.with_chunk_tracker(|ct| { let have = ct.get_have_pieces()[piece_id.get() as usize]; if !have { - self.torrent - .streams + self.streams .register_waker(self.stream_id, piece_id, cx.waker().clone()); } have @@ -185,7 +185,7 @@ impl AsyncSeek for FileStream { impl Drop for FileStream { fn drop(&mut self) { - self.torrent.streams.drop_stream(self.stream_id) + self.streams.drop_stream(self.stream_id) } } @@ -205,16 +205,21 @@ impl ManagedTorrent { }) } + fn streams(&self) -> anyhow::Result> { + self.with_state(|s| match s { + crate::ManagedTorrentState::Paused(p) => Ok(p.streams.clone()), + crate::ManagedTorrentState::Live(l) => Ok(l.streams.clone()), + _ => anyhow::bail!("invalid state"), + }) + } + pub fn stream(self: Arc, file_id: usize) -> anyhow::Result { let (fd_len, fd_offset) = self.with_opened_file(file_id, |fd| (fd.len, fd.offset_in_torrent))?; + let streams = self.streams()?; Ok(FileStream { - stream_id: { - let this = &self; - &this.streams - } - .next_id(), - + stream_id: streams.next_id(), + streams, file_id, position: 0, From ae1d95f2f19c6a37ac540eefb9d014b0bd6af65c Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 19:10:17 +0100 Subject: [PATCH 04/22] Should be ready to test --- crates/librqbit/src/api.rs | 10 +++++++++- crates/librqbit/src/http_api.rs | 30 +++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/crates/librqbit/src/api.rs b/crates/librqbit/src/api.rs index 57d02d3d..716c4b2d 100644 --- a/crates/librqbit/src/api.rs +++ b/crates/librqbit/src/api.rs @@ -7,7 +7,10 @@ use futures::Stream; use http::StatusCode; use librqbit_core::torrent_metainfo::TorrentMetaV1Info; use serde::{Deserialize, Serialize}; -use tokio::sync::mpsc::UnboundedSender; +use tokio::{ + io::{AsyncRead, AsyncSeek}, + sync::mpsc::UnboundedSender, +}; use tokio_stream::wrappers::{errors::BroadcastStreamRecvError, BroadcastStream}; use tracing::warn; @@ -239,6 +242,11 @@ impl Api { let mgr = self.mgr_handle(idx)?; Ok(mgr.with_chunk_tracker(|chunks| format!("{:?}", chunks.get_have_pieces()))?) } + + pub fn api_stream(&self, idx: TorrentId, file_id: usize) -> Result { + let mgr = self.mgr_handle(idx)?; + Ok(mgr.stream(file_id)?) + } } #[derive(Serialize)] diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index ccb0a5e0..d33a5ad6 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -8,9 +8,11 @@ use futures::{FutureExt, TryStreamExt}; use itertools::Itertools; use serde::{Deserialize, Serialize}; +use std::io::SeekFrom; use std::net::SocketAddr; use std::str::FromStr; use std::time::Duration; +use tokio::io::AsyncSeekExt; use tracing::{debug, info}; use axum::Router; @@ -154,6 +156,31 @@ impl HttpApi { state.api_peer_stats(idx, filter).map(axum::Json) } + async fn torrent_stream_file( + State(state): State, + Path((idx, file_id)): Path<(usize, usize)>, + headers: http::HeaderMap, + ) -> Result { + let mut stream = state.api_stream(idx, file_id)?; + if let Some(range) = headers.get(http::header::RANGE) { + let offset: Option = range + .to_str() + .ok() + .and_then(|s| s.strip_prefix("bytes=")) + .and_then(|s| s.strip_suffix('-')) + .and_then(|s| s.parse().ok()); + if let Some(offset) = offset { + stream + .seek(SeekFrom::Start(offset)) + .await + .context("error seeking")?; + } + } + + let s = tokio_util::io::ReaderStream::new(stream); + Ok(axum::body::Body::from_stream(s)) + } + async fn torrent_action_pause( State(state): State, Path(idx): Path, @@ -223,7 +250,8 @@ impl HttpApi { .route("/torrents/:id/haves", get(torrent_haves)) .route("/torrents/:id/stats", get(torrent_stats_v0)) .route("/torrents/:id/stats/v1", get(torrent_stats_v1)) - .route("/torrents/:id/peer_stats", get(peer_stats)); + .route("/torrents/:id/peer_stats", get(peer_stats)) + .route("/torrents/:id/stream/:file_id", get(torrent_stream_file)); if !self.opts.read_only { app = app From 600a4dfb6307be9d8214de107b89ac3b61e12894 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 20:56:58 +0100 Subject: [PATCH 05/22] Fix the bugs --- crates/librqbit/src/api.rs | 9 ++-- crates/librqbit/src/http_api.rs | 33 +++++++++++++- crates/librqbit/src/torrent_state/mod.rs | 1 + .../librqbit/src/torrent_state/streaming.rs | 43 ++++++++++++++++--- 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/crates/librqbit/src/api.rs b/crates/librqbit/src/api.rs index 716c4b2d..436ccc54 100644 --- a/crates/librqbit/src/api.rs +++ b/crates/librqbit/src/api.rs @@ -7,10 +7,7 @@ use futures::Stream; use http::StatusCode; use librqbit_core::torrent_metainfo::TorrentMetaV1Info; use serde::{Deserialize, Serialize}; -use tokio::{ - io::{AsyncRead, AsyncSeek}, - sync::mpsc::UnboundedSender, -}; +use tokio::sync::mpsc::UnboundedSender; use tokio_stream::wrappers::{errors::BroadcastStreamRecvError, BroadcastStream}; use tracing::warn; @@ -21,7 +18,7 @@ use crate::{ }, torrent_state::{ peer::stats::snapshot::{PeerStatsFilter, PeerStatsSnapshot}, - ManagedTorrentHandle, + FileStream, ManagedTorrentHandle, }, tracing_subscriber_config_utils::LineBroadcast, }; @@ -243,7 +240,7 @@ impl Api { Ok(mgr.with_chunk_tracker(|chunks| format!("{:?}", chunks.get_have_pieces()))?) } - pub fn api_stream(&self, idx: TorrentId, file_id: usize) -> Result { + pub fn api_stream(&self, idx: TorrentId, file_id: usize) -> Result { let mgr = self.mgr_handle(idx)?; Ok(mgr.stream(file_id)?) } diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index d33a5ad6..0214f6ff 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -5,6 +5,7 @@ use axum::response::IntoResponse; use axum::routing::{get, post}; use futures::future::BoxFuture; use futures::{FutureExt, TryStreamExt}; +use http::{HeaderMap, HeaderValue, StatusCode}; use itertools::Itertools; use serde::{Deserialize, Serialize}; @@ -162,6 +163,13 @@ impl HttpApi { headers: http::HeaderMap, ) -> Result { let mut stream = state.api_stream(idx, file_id)?; + + dbg!(&headers); + + let mut status = StatusCode::OK; + let mut output_headers = HeaderMap::new(); + output_headers.insert("Accept-Ranges", HeaderValue::from_static("bytes")); + if let Some(range) = headers.get(http::header::RANGE) { let offset: Option = range .to_str() @@ -170,15 +178,38 @@ impl HttpApi { .and_then(|s| s.strip_suffix('-')) .and_then(|s| s.parse().ok()); if let Some(offset) = offset { + status = StatusCode::PARTIAL_CONTENT; + info!(offset, "range request offset"); stream .seek(SeekFrom::Start(offset)) .await .context("error seeking")?; + + output_headers.insert( + http::header::CONTENT_LENGTH, + HeaderValue::from_str(&format!("{}", stream.len() - stream.position())) + .context("bug")?, + ); + output_headers.insert( + http::header::CONTENT_RANGE, + HeaderValue::from_str(&format!( + "bytes {}-{}/{}", + stream.position(), + stream.len().saturating_sub(1), + stream.len() + )) + .context("bug")?, + ); + } else { + output_headers.insert( + http::header::CONTENT_LENGTH, + HeaderValue::from_str(&format!("{}", stream.len())).context("bug")?, + ); } } let s = tokio_util::io::ReaderStream::new(stream); - Ok(axum::body::Body::from_stream(s)) + Ok((status, (output_headers, axum::body::Body::from_stream(s)))) } async fn torrent_action_pause( diff --git a/crates/librqbit/src/torrent_state/mod.rs b/crates/librqbit/src/torrent_state/mod.rs index e2032361..752beb42 100644 --- a/crates/librqbit/src/torrent_state/mod.rs +++ b/crates/librqbit/src/torrent_state/mod.rs @@ -42,6 +42,7 @@ use initializing::TorrentStateInitializing; use self::paused::TorrentStatePaused; pub use self::stats::{TorrentStats, TorrentStatsState}; +pub use self::streaming::FileStream; pub enum ManagedTorrentState { Initializing(Arc), diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs index 27836c94..0e332fc9 100644 --- a/crates/librqbit/src/torrent_state/streaming.rs +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -11,6 +11,7 @@ use anyhow::Context; use dashmap::DashMap; use librqbit_core::lengths::ValidPieceIndex; use tokio::io::{AsyncRead, AsyncSeek}; +use tracing::{debug, trace}; use crate::{opened_file::OpenedFile, ManagedTorrent}; @@ -37,6 +38,11 @@ impl TorrentStreams { let mut woken = Vec::new(); for w in self.wakers_by_stream.iter() { if w.value().0 == piece_id { + trace!( + stream_id = *w.key(), + piece_id = piece_id.get(), + "waking stream" + ); w.value().1.wake_by_ref(); woken.push(*w.key()); } @@ -47,11 +53,12 @@ impl TorrentStreams { } fn drop_stream(&self, stream_id: StreamId) { + trace!(stream_id, "dropping stream"); self.wakers_by_stream.remove(&stream_id); } } -struct FileStream { +pub struct FileStream { torrent: ManagedTorrentHandle, streams: Arc, stream_id: usize, @@ -74,7 +81,10 @@ macro_rules! poll_try_io { let e = map_io_err!($e); match e { Ok(r) => r, - Err(e) => return Poll::Ready(Err(e)), + Err(e) => { + debug!("stream error {e:?}"); + return Poll::Ready(Err(e)); + } } }}; } @@ -83,10 +93,15 @@ impl AsyncRead for FileStream { fn poll_read( mut self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, - buf: &mut tokio::io::ReadBuf<'_>, + tbuf: &mut tokio::io::ReadBuf<'_>, ) -> Poll> { // if the file is over, return 0 if self.position == self.file_len { + trace!( + stream_id = self.stream_id, + file_id = self.file_id, + "stream completed, EOF" + ); return Poll::Ready(Ok(())); } @@ -119,11 +134,12 @@ impl AsyncRead for FileStream { have })); if !have { + trace!(stream_id = self.stream_id, file_id = self.file_id, piece_id = %piece_id, "poll pending, not have"); return Poll::Pending; } // actually stream the piece - let buf = buf.initialize_unfilled(); + let buf = tbuf.initialize_unfilled(); let file_remaining = self.file_len - self.position; let bytes_to_read: usize = poll_try_io!((piece_len as u64) .min(buf.len() as u64) @@ -132,6 +148,12 @@ impl AsyncRead for FileStream { .try_into()); let buf = &mut buf[..bytes_to_read]; + trace!( + buflen = buf.len(), + stream_id = self.stream_id, + file_id = self.file_id, + "will write bytes" + ); poll_try_io!(poll_try_io!(self.torrent.with_opened_file( self.file_id, @@ -144,6 +166,7 @@ impl AsyncRead for FileStream { ))); self.as_mut().position += buf.len() as u64; + tbuf.advance(bytes_to_read); Poll::Ready(Ok(())) } @@ -213,7 +236,7 @@ impl ManagedTorrent { }) } - pub fn stream(self: Arc, file_id: usize) -> anyhow::Result { + pub fn stream(self: Arc, file_id: usize) -> anyhow::Result { let (fd_len, fd_offset) = self.with_opened_file(file_id, |fd| (fd.len, fd.offset_in_torrent))?; let streams = self.streams()?; @@ -229,3 +252,13 @@ impl ManagedTorrent { }) } } + +impl FileStream { + pub fn position(&self) -> u64 { + self.position + } + + pub fn len(&self) -> u64 { + self.file_len + } +} From 23c6615c7248b8ce51111723efdc185fb9c9b92a Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 22:21:41 +0100 Subject: [PATCH 06/22] Works fine now finally --- crates/librqbit/src/chunk_tracker.rs | 8 ++ crates/librqbit/src/http_api.rs | 3 - crates/librqbit/src/torrent_state/live/mod.rs | 16 ++- .../librqbit/src/torrent_state/streaming.rs | 129 ++++++++++++++---- 4 files changed, 121 insertions(+), 35 deletions(-) diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index ef8db7c4..1bd0879d 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -194,6 +194,14 @@ impl ChunkTracker { .filter_map(|id| self.lengths.validate_piece_index(id)) } + pub(crate) fn is_piece_queued(&self, id: ValidPieceIndex) -> bool { + self.queue_pieces[id.get() as usize] + } + + pub(crate) fn is_piece_have(&self, id: ValidPieceIndex) -> bool { + self.have[id.get() as usize] + } + // None if wrong chunk // true if did something // false if didn't do anything diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index 0214f6ff..f787c8a0 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -163,9 +163,6 @@ impl HttpApi { headers: http::HeaderMap, ) -> Result { let mut stream = state.api_stream(idx, file_id)?; - - dbg!(&headers); - let mut status = StatusCode::OK; let mut output_headers = HeaderMap::new(); output_headers.insert("Accept-Ranges", HeaderValue::from_static("bytes")); diff --git a/crates/librqbit/src/torrent_state/live/mod.rs b/crates/librqbit/src/torrent_state/live/mod.rs index 57b758e6..6c69c588 100644 --- a/crates/librqbit/src/torrent_state/live/mod.rs +++ b/crates/librqbit/src/torrent_state/live/mod.rs @@ -965,10 +965,18 @@ impl PeerHandler { let n = { let mut n_opt = None; let bf = &live.bitfield; - for n in g - .get_chunks()? - .iter_queued_pieces(&g.file_priorities, &self.state.files) - { + let chunk_tracker = g.get_chunks()?; + let priority_streamed_pieces = self + .state + .streams + .iter_next_pieces(&self.state.lengths) + .filter(|pid| { + !chunk_tracker.is_piece_have(*pid) + && chunk_tracker.is_piece_queued(*pid) + }); + let natural_order_pieces = + chunk_tracker.iter_queued_pieces(&g.file_priorities, &self.state.files); + for n in priority_streamed_pieces.chain(natural_order_pieces) { if bf.get(n.get() as usize).map(|v| *v) == Some(true) { n_opt = Some(n); break; diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs index 0e332fc9..1814d1ad 100644 --- a/crates/librqbit/src/torrent_state/streaming.rs +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -9,7 +9,8 @@ use std::{ use anyhow::Context; use dashmap::DashMap; -use librqbit_core::lengths::ValidPieceIndex; +use itertools::Itertools; +use librqbit_core::lengths::{Lengths, ValidPieceIndex}; use tokio::io::{AsyncRead, AsyncSeek}; use tracing::{debug, trace}; @@ -19,10 +20,21 @@ use super::ManagedTorrentHandle; type StreamId = usize; +// Buffer either 1/10th of the file forward. +const PER_STREAM_BUF_PART: u64 = 10; +// Or 32 mb, whichever is larger +const PER_STREAM_BUF_MIN: u64 = 32 * 1024 * 1024; + +struct StreamState { + current_piece: ValidPieceIndex, + file_len: u64, + waker: Option, +} + #[derive(Default)] pub(crate) struct TorrentStreams { next_stream_id: AtomicUsize, - wakers_by_stream: DashMap, + streams: DashMap, } impl TorrentStreams { @@ -30,31 +42,83 @@ impl TorrentStreams { self.next_stream_id.fetch_add(1, Ordering::Relaxed) } - fn register_waker(&self, stream_id: StreamId, piece_id: ValidPieceIndex, waker: Waker) { - self.wakers_by_stream.insert(stream_id, (piece_id, waker)); + fn register_waker(&self, stream_id: StreamId, waker: Waker) { + if let Some(mut s) = self.streams.get_mut(&stream_id) { + let vm = s.value_mut(); + vm.waker = Some(waker); + } } - pub(crate) fn wake_streams_on_piece_completed(&self, piece_id: ValidPieceIndex) { - let mut woken = Vec::new(); - for w in self.wakers_by_stream.iter() { - if w.value().0 == piece_id { - trace!( - stream_id = *w.key(), - piece_id = piece_id.get(), - "waking stream" - ); - w.value().1.wake_by_ref(); - woken.push(*w.key()); + // Queue 1st, 2nd etc pieces from each stream in turn until they get 1/10th of the file . + pub(crate) fn iter_next_pieces( + &self, + lengths: &Lengths, + ) -> impl Iterator { + let all = self + .streams + .iter() + .map(|s| { + let remaining = (s.value().file_len + + lengths.piece_length(s.value().current_piece) as u64) + .div_ceil(PER_STREAM_BUF_PART) + .max(PER_STREAM_BUF_MIN); + (s.value().current_piece, remaining) + }) + .map(Some) + .collect_vec(); + + struct It { + all: Vec>, + lengths: Lengths, + } + + impl Iterator for It { + type Item = ValidPieceIndex; + + fn next(&mut self) -> Option { + for item in self.all.iter_mut() { + if let Some((p, remaining)) = item { + let y = *p; + let pl = self.lengths.piece_length(y); + *remaining = remaining.saturating_sub(pl as u64); + if *remaining == 0 { + *item = None; + } else if let Some(next_p) = self.lengths.validate_piece_index(y.get() + 1) + { + *item = Some((next_p, *remaining)) + } else { + *item = None; + } + return Some(y); + } + } + None } } - for w in woken { - self.wakers_by_stream.remove(&w); + It { + all, + lengths: *lengths, + } + } + + pub(crate) fn wake_streams_on_piece_completed(&self, piece_id: ValidPieceIndex) { + for mut w in self.streams.iter_mut() { + if w.value().current_piece == piece_id { + if let Some(waker) = w.value_mut().waker.take() { + trace!( + stream_id = *w.key(), + piece_id = piece_id.get(), + "waking stream" + ); + waker.wake(); + } + } } } fn drop_stream(&self, stream_id: StreamId) { trace!(stream_id, "dropping stream"); - self.wakers_by_stream.remove(&stream_id); + self.streams.remove(&stream_id); } } @@ -120,8 +184,10 @@ impl AsyncRead for FileStream { let piece_offset = abs_pos % dpl as u64; let piece_remaining = piece_len as u64 - piece_offset; - // queue N pieces after this if not yet - // TODO + // queue N pieces after this if not yet. The "if let" should never fail. + if let Some(mut s) = self.streams.streams.get_mut(&self.stream_id) { + s.value_mut().current_piece = piece_id; + } // if the piece is not there, register to wake when it is // check if we have the piece for real @@ -129,7 +195,7 @@ impl AsyncRead for FileStream { let have = ct.get_have_pieces()[piece_id.get() as usize]; if !have { self.streams - .register_waker(self.stream_id, piece_id, cx.waker().clone()); + .register_waker(self.stream_id, cx.waker().clone()); } have })); @@ -179,10 +245,7 @@ impl AsyncSeek for FileStream { ) -> std::io::Result<()> { let end_i64 = map_io_err!(TryInto::::try_into(self.file_len))?; let new_pos: i64 = match position { - SeekFrom::Start(s) => { - self.as_mut().position = s; - return Ok(()); - } + SeekFrom::Start(s) => map_io_err!(s.try_into())?, SeekFrom::End(e) => map_io_err!(TryInto::::try_into(self.file_len))? + e, SeekFrom::Current(o) => map_io_err!(TryInto::::try_into(self.position))? + o, }; @@ -240,16 +303,26 @@ impl ManagedTorrent { let (fd_len, fd_offset) = self.with_opened_file(file_id, |fd| (fd.len, fd.offset_in_torrent))?; let streams = self.streams()?; - Ok(FileStream { + let first_piece = self.info().lengths.validate_piece_index(0).context("bug")?; + let s = FileStream { stream_id: streams.next_id(), - streams, + streams: streams.clone(), file_id, position: 0, file_len: fd_len, file_torrent_abs_offset: fd_offset, torrent: self, - }) + }; + streams.streams.insert( + s.stream_id, + StreamState { + current_piece: first_piece, + waker: None, + file_len: s.file_len, + }, + ); + Ok(s) } } From c3805bfe049f3d3c5b33e38ba793eb64e9a70bef Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Wed, 24 Apr 2024 22:55:56 +0100 Subject: [PATCH 07/22] UI link to video files --- crates/librqbit/src/http_api.rs | 1 - crates/librqbit/webui/dist/assets/index.css | 2 +- crates/librqbit/webui/dist/assets/index.js | 20 +++++++------- crates/librqbit/webui/dist/manifest.json | 6 ++--- crates/librqbit/webui/src/api-types.ts | 1 + .../webui/src/components/FileListInput.tsx | 27 ++++++++++++++++++- .../webui/src/components/TorrentRow.tsx | 2 ++ .../src/components/forms/FormCheckbox.tsx | 14 +++++++++- crates/librqbit/webui/src/context.tsx | 4 +-- crates/librqbit/webui/src/http-api.ts | 3 +++ desktop/src/api.tsx | 3 +++ 11 files changed, 64 insertions(+), 19 deletions(-) diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index f787c8a0..2bde54ed 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -176,7 +176,6 @@ impl HttpApi { .and_then(|s| s.parse().ok()); if let Some(offset) = offset { status = StatusCode::PARTIAL_CONTENT; - info!(offset, "range request offset"); stream .seek(SeekFrom::Start(offset)) .await diff --git a/crates/librqbit/webui/dist/assets/index.css b/crates/librqbit/webui/dist/assets/index.css index a3758293..bb0da63f 100644 --- a/crates/librqbit/webui/dist/assets/index.css +++ b/crates/librqbit/webui/dist/assets/index.css @@ -1 +1 @@ -*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-0{left:0}.start-0{inset-inline-start:0px}.top-0{top:0}.z-10{z-index:10}.z-\[300\]{z-index:300}.z-\[301\]{z-index:301}.m-0{margin:0}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-5{margin:1.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.me-2{margin-inline-end:.5rem}.ml-2{margin-left:.5rem}.ms-2{margin-inline-start:.5rem}.mt-1{margin-top:.25rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-10{height:2.5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-7xl{max-width:80rem}.flex-grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-pre-wrap{white-space:pre-wrap}.text-nowrap{text-wrap:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-green-50{--tw-border-opacity: 1;border-color:rgb(240 253 244 / var(--tw-border-opacity))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity))}.bg-black\/30{background-color:#0000004d}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-green-700{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fill-blue-600{fill:#2563eb}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-none{line-height:1}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.drop-shadow-lg{--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:border-red-700:hover{--tw-border-opacity: 1;border-color:rgb(185 28 28 / var(--tw-border-opacity))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:bg-blue-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:text-amber-500:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:drop-shadow-sm:hover{--tw-drop-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .05));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-blue-200:disabled{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:border-none:is(.dark *){border-style:none}.dark\:border-slate-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity))}.dark\:border-slate-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.dark\:border-slate-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:border-slate-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(15 23 42 / var(--tw-border-opacity))}.dark\:bg-black\/60:is(.dark *){background-color:#0009}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.dark\:bg-gray-500:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:bg-red-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.dark\:bg-red-800\/60:is(.dark *){background-color:#991b1b99}.dark\:bg-slate-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.dark\:text-gray-50:is(.dark *){--tw-text-opacity: 1;color:rgb(249 250 251 / var(--tw-text-opacity))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.dark\:text-slate-200:is(.dark *){--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.dark\:text-slate-300:is(.dark *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dark\:text-slate-400:is(.dark *){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-blue-900\/50:hover:is(.dark *){background-color:#1e3a8a80}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:disabled\:bg-slate-600:disabled:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.dark\:disabled\:text-slate-300:disabled:is(.dark *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:flex-wrap{flex-wrap:wrap}.sm\:px-7{padding-left:1.75rem;padding-right:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width: 768px){.md\:block{display:block}.md\:hidden{display:none}}@media (min-width: 1024px){.lg\:mb-0{margin-bottom:0}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:justify-between{justify-content:space-between}} +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-0{left:0}.start-0{inset-inline-start:0px}.top-0{top:0}.z-10{z-index:10}.z-\[300\]{z-index:300}.z-\[301\]{z-index:301}.m-0{margin:0}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-5{margin:1.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.me-2{margin-inline-end:.5rem}.ml-2{margin-left:.5rem}.ms-2{margin-inline-start:.5rem}.mt-1{margin-top:.25rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.h-10{height:2.5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-8{width:2rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-7xl{max-width:80rem}.flex-grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-nowrap{flex-wrap:nowrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-pre-wrap{white-space:pre-wrap}.text-nowrap{text-wrap:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-green-50{--tw-border-opacity: 1;border-color:rgb(240 253 244 / var(--tw-border-opacity))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity))}.bg-black\/30{background-color:#0000004d}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-green-700{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-red-200{--tw-bg-opacity: 1;background-color:rgb(254 202 202 / var(--tw-bg-opacity))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.fill-blue-600{fill:#2563eb}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pl-5{padding-left:1.25rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-none{line-height:1}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.drop-shadow-lg{--tw-drop-shadow: drop-shadow(0 10px 8px rgb(0 0 0 / .04)) drop-shadow(0 4px 3px rgb(0 0 0 / .1));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:border-red-700:hover{--tw-border-opacity: 1;border-color:rgb(185 28 28 / var(--tw-border-opacity))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:bg-blue-800:hover{--tw-bg-opacity: 1;background-color:rgb(30 64 175 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.hover\:text-amber-500:hover{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.hover\:text-green-600:hover{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}.hover\:drop-shadow-sm:hover{--tw-drop-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .05));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:bg-blue-200:disabled{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:border-none:is(.dark *){border-style:none}.dark\:border-slate-500:is(.dark *){--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity))}.dark\:border-slate-600:is(.dark *){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.dark\:border-slate-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:border-slate-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(15 23 42 / var(--tw-border-opacity))}.dark\:bg-black\/60:is(.dark *){background-color:#0009}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity))}.dark\:bg-gray-500:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity))}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity))}.dark\:bg-red-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.dark\:bg-red-800\/60:is(.dark *){background-color:#991b1b99}.dark\:bg-slate-600:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.dark\:bg-slate-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.dark\:text-blue-500:is(.dark *){--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity))}.dark\:text-gray-50:is(.dark *){--tw-text-opacity: 1;color:rgb(249 250 251 / var(--tw-text-opacity))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity))}.dark\:text-slate-200:is(.dark *){--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.dark\:text-slate-300:is(.dark *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.dark\:text-slate-400:is(.dark *){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.dark\:text-white:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.dark\:hover\:bg-blue-900\/50:hover:is(.dark *){background-color:#1e3a8a80}.dark\:hover\:bg-red-900:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.dark\:hover\:bg-slate-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.dark\:disabled\:bg-slate-600:disabled:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.dark\:disabled\:text-slate-300:disabled:is(.dark *){--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}@media (min-width: 640px){.sm\:flex-wrap{flex-wrap:wrap}.sm\:px-7{padding-left:1.75rem;padding-right:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:leading-6{line-height:1.5rem}}@media (min-width: 768px){.md\:block{display:block}.md\:hidden{display:none}}@media (min-width: 1024px){.lg\:mb-0{margin-bottom:0}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:justify-between{justify-content:space-between}} diff --git a/crates/librqbit/webui/dist/assets/index.js b/crates/librqbit/webui/dist/assets/index.js index db738219..8b262648 100644 --- a/crates/librqbit/webui/dist/assets/index.js +++ b/crates/librqbit/webui/dist/assets/index.js @@ -1,4 +1,4 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _c={exports:{}},_i={},Tc={exports:{}},B={};/** +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function il(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tc={exports:{}},_i={},jc={exports:{}},B={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ol=Symbol.for("react.element"),M1=Symbol.for("react.portal"),z1=Symbol.for("react.fragment"),F1=Symbol.for("react.strict_mode"),I1=Symbol.for("react.profiler"),D1=Symbol.for("react.provider"),R1=Symbol.for("react.context"),A1=Symbol.for("react.forward_ref"),$1=Symbol.for("react.suspense"),U1=Symbol.for("react.memo"),B1=Symbol.for("react.lazy"),ea=Symbol.iterator;function H1(e){return e===null||typeof e!="object"?null:(e=ea&&e[ea]||e["@@iterator"],typeof e=="function"?e:null)}var jc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Nc=Object.assign,Pc={};function sr(e,t,n){this.props=e,this.context=t,this.refs=Pc,this.updater=n||jc}sr.prototype.isReactComponent={};sr.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};sr.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Lc(){}Lc.prototype=sr.prototype;function Iu(e,t,n){this.props=e,this.context=t,this.refs=Pc,this.updater=n||jc}var Du=Iu.prototype=new Lc;Du.constructor=Iu;Nc(Du,sr.prototype);Du.isPureReactComponent=!0;var ta=Array.isArray,Oc=Object.prototype.hasOwnProperty,Ru={current:null},Mc={key:!0,ref:!0,__self:!0,__source:!0};function zc(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Oc.call(t,r)&&!Mc.hasOwnProperty(r)&&(l[r]=t[r]);var s=arguments.length-2;if(s===1)l.children=n;else if(1>>1,ee=P[K];if(0>>1;Kl(pt,$))Yel(Ot,pt)?(P[K]=Ot,P[Ye]=$,K=Ye):(P[K]=pt,P[$e]=$,K=$e);else if(Yel(Ot,$))P[K]=Ot,P[Ye]=$,K=Ye;else break e}}return R}function l(P,R){var $=P.sortIndex-R.sortIndex;return $!==0?$:P.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var a=[],f=[],y=1,x=null,v=3,w=!1,S=!1,k=!1,z=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function m(P){for(var R=n(f);R!==null;){if(R.callback===null)r(f);else if(R.startTime<=P)r(f),R.sortIndex=R.expirationTime,t(a,R);else break;R=n(f)}}function _(P){if(k=!1,m(P),!S)if(n(a)!==null)S=!0,Ae(T);else{var R=n(f);R!==null&&rt(_,R.startTime-P)}}function T(P,R){S=!1,k&&(k=!1,h(F),F=-1),w=!0;var $=v;try{for(m(R),x=n(a);x!==null&&(!(x.expirationTime>R)||P&&!we());){var K=x.callback;if(typeof K=="function"){x.callback=null,v=x.priorityLevel;var ee=K(x.expirationTime<=R);R=e.unstable_now(),typeof ee=="function"?x.callback=ee:x===n(a)&&r(a),m(R)}else r(a);x=n(a)}if(x!==null)var Ge=!0;else{var $e=n(f);$e!==null&&rt(_,$e.startTime-R),Ge=!1}return Ge}finally{x=null,v=$,w=!1}}var j=!1,O=null,F=-1,W=5,A=-1;function we(){return!(e.unstable_now()-AP||125K?(P.sortIndex=$,t(f,P),n(a)===null&&P===n(f)&&(k?(h(F),F=-1):k=!0,rt(_,$-K))):(P.sortIndex=ee,t(a,P),S||w||(S=!0,Ae(T))),P},e.unstable_shouldYield=we,e.unstable_wrapCallback=function(P){var R=v;return function(){var $=v;v=R;try{return P.apply(this,arguments)}finally{v=$}}}})(Rc);Dc.exports=Rc;var b1=Dc.exports;/** + */(function(e){function t(P,R){var $=P.length;P.push(R);e:for(;0<$;){var K=$-1>>>1,ee=P[K];if(0>>1;Kl(ht,$))Yel(Ot,ht)?(P[K]=Ot,P[Ye]=$,K=Ye):(P[K]=ht,P[$e]=$,K=$e);else if(Yel(Ot,$))P[K]=Ot,P[Ye]=$,K=Ye;else break e}}return R}function l(P,R){var $=P.sortIndex-R.sortIndex;return $!==0?$:P.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var a=[],f=[],x=1,y=null,v=3,w=!1,S=!1,T=!1,I=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(P){for(var R=n(f);R!==null;){if(R.callback===null)r(f);else if(R.startTime<=P)r(f),R.sortIndex=R.expirationTime,t(a,R);else break;R=n(f)}}function k(P){if(T=!1,h(P),!S)if(n(a)!==null)S=!0,Ae(_);else{var R=n(f);R!==null&&rt(k,R.startTime-P)}}function _(P,R){S=!1,T&&(T=!1,m(z),z=-1),w=!0;var $=v;try{for(h(R),y=n(a);y!==null&&(!(y.expirationTime>R)||P&&!we());){var K=y.callback;if(typeof K=="function"){y.callback=null,v=y.priorityLevel;var ee=K(y.expirationTime<=R);R=e.unstable_now(),typeof ee=="function"?y.callback=ee:y===n(a)&&r(a),h(R)}else r(a);y=n(a)}if(y!==null)var Ge=!0;else{var $e=n(f);$e!==null&&rt(k,$e.startTime-R),Ge=!1}return Ge}finally{y=null,v=$,w=!1}}var j=!1,O=null,z=-1,W=5,A=-1;function we(){return!(e.unstable_now()-AP||125K?(P.sortIndex=$,t(f,P),n(a)===null&&P===n(f)&&(T?(m(z),z=-1):T=!0,rt(k,$-K))):(P.sortIndex=ee,t(a,P),S||w||(S=!0,Ae(_))),P},e.unstable_shouldYield=we,e.unstable_wrapCallback=function(P){var R=v;return function(){var $=v;v=R;try{return P.apply(this,arguments)}finally{v=$}}}})(Ac);Rc.exports=Ac;var b1=Rc.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ac=C,Ie=b1;function N(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uo=Object.prototype.hasOwnProperty,ep=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ra={},la={};function tp(e){return Uo.call(la,e)?!0:Uo.call(ra,e)?!1:ep.test(e)?la[e]=!0:(ra[e]=!0,!1)}function np(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function rp(e,t,n,r){if(t===null||typeof t>"u"||np(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _e(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){me[e]=new _e(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];me[t]=new _e(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){me[e]=new _e(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){me[e]=new _e(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){me[e]=new _e(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){me[e]=new _e(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){me[e]=new _e(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){me[e]=new _e(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){me[e]=new _e(e,5,!1,e.toLowerCase(),null,!1,!1)});var $u=/[\-:]([a-z])/g;function Uu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace($u,Uu);me[t]=new _e(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace($u,Uu);me[t]=new _e(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace($u,Uu);me[t]=new _e(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){me[e]=new _e(e,1,!1,e.toLowerCase(),null,!1,!1)});me.xlinkHref=new _e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){me[e]=new _e(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bu(e,t,n,r){var l=me.hasOwnProperty(t)?me[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uo=Object.prototype.hasOwnProperty,ep=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,la={},ia={};function tp(e){return Uo.call(ia,e)?!0:Uo.call(la,e)?!1:ep.test(e)?ia[e]=!0:(la[e]=!0,!1)}function np(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function rp(e,t,n,r){if(t===null||typeof t>"u"||np(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function _e(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var me={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){me[e]=new _e(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];me[t]=new _e(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){me[e]=new _e(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){me[e]=new _e(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){me[e]=new _e(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){me[e]=new _e(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){me[e]=new _e(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){me[e]=new _e(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){me[e]=new _e(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uu=/[\-:]([a-z])/g;function Bu(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Uu,Bu);me[t]=new _e(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Uu,Bu);me[t]=new _e(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Uu,Bu);me[t]=new _e(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){me[e]=new _e(e,1,!1,e.toLowerCase(),null,!1,!1)});me.xlinkHref=new _e("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){me[e]=new _e(e,1,!1,e.toLowerCase(),null,!0,!0)});function Hu(e,t,n,r){var l=me.hasOwnProperty(t)?me[t]:null;(l!==null?l.type!==0:r||!(2s||l[o]!==i[s]){var a=` -`+l[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=s);break}}}finally{so=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nr(e):""}function lp(e){switch(e.tag){case 5:return Nr(e.type);case 16:return Nr("Lazy");case 13:return Nr("Suspense");case 19:return Nr("SuspenseList");case 0:case 2:case 15:return e=ao(e.type,!1),e;case 11:return e=ao(e.type.render,!1),e;case 1:return e=ao(e.type,!0),e;default:return""}}function Wo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Dn:return"Fragment";case In:return"Portal";case Bo:return"Profiler";case Hu:return"StrictMode";case Ho:return"Suspense";case Vo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Bc:return(e.displayName||"Context")+".Consumer";case Uc:return(e._context.displayName||"Context")+".Provider";case Vu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Wu:return t=e.displayName||null,t!==null?t:Wo(e.type)||"Memo";case Dt:t=e._payload,e=e._init;try{return Wo(e(t))}catch{}}return null}function ip(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wo(t);case 8:return t===Hu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Vc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function op(e){var t=Vc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _l(e){e._valueTracker||(e._valueTracker=op(e))}function Wc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Vc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qo(e,t){var n=t.checked;return re({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function oa(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Qc(e,t){t=t.checked,t!=null&&Bu(e,"checked",t,!1)}function Ko(e,t){Qc(e,t);var n=qt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Zo(e,t.type,qt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ua(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Zo(e,t,n){(t!=="number"||bl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Pr=Array.isArray;function Zn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Tl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},up=["Webkit","ms","Moz","O"];Object.keys(Mr).forEach(function(e){up.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mr[t]=Mr[e]})});function Yc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mr.hasOwnProperty(e)&&Mr[e]?(""+t).trim():t+"px"}function Xc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Yc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var sp=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xo(e,t){if(t){if(sp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Jo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qo=null;function Qu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bo=null,Gn=null,Yn=null;function ca(e){if(e=al(e)){if(typeof bo!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Li(t),bo(e.stateNode,e.type,t))}}function Jc(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function qc(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,ca(e),t)for(e=0;e>>=0,e===0?32:31-(xp(e)/wp|0)|0}var jl=64,Nl=4194304;function Lr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ri(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~l;s!==0?r=Lr(s):(i&=o,i!==0&&(r=Lr(i)))}else o=n&~l,o!==0?r=Lr(o):i!==0&&(r=Lr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ul(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-et(t),e[t]=n}function Cp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Fr),xa=String.fromCharCode(32),wa=!1;function xf(e,t){switch(e){case"keyup":return qp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rn=!1;function eh(e,t){switch(e){case"compositionend":return wf(t);case"keypress":return t.which!==32?null:(wa=!0,xa);case"textInput":return e=t.data,e===xa&&wa?null:e;default:return null}}function th(e,t){if(Rn)return e==="compositionend"||!bu&&xf(e,t)?(e=vf(),Wl=Xu=Bt=null,Rn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ca(n)}}function Cf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _f(){for(var e=window,t=bl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bl(e.document)}return t}function es(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ch(e){var t=_f(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Cf(n.ownerDocument.documentElement,n)){if(r!==null&&es(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=_a(n,i);var o=_a(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,An=null,iu=null,Dr=null,ou=!1;function Ta(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ou||An==null||An!==bl(r)||(r=An,"selectionStart"in r&&es(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&Gr(Dr,r)||(Dr=r,r=oi(iu,"onSelect"),0Bn||(e.current=du[Bn],du[Bn]=null,Bn--)}function Y(e,t){Bn++,du[Bn]=e.current,e.current=t}var bt={},xe=nn(bt),Pe=nn(!1),yn=bt;function tr(e,t){var n=e.type.contextTypes;if(!n)return bt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Le(e){return e=e.childContextTypes,e!=null}function si(){J(Pe),J(xe)}function za(e,t,n){if(xe.current!==bt)throw Error(N(168));Y(xe,t),Y(Pe,n)}function Ff(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,ip(e)||"Unknown",l));return re({},n,r)}function ai(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bt,yn=xe.current,Y(xe,e),Y(Pe,Pe.current),!0}function Fa(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=Ff(e,t,yn),r.__reactInternalMemoizedMergedChildContext=e,J(Pe),J(xe),Y(xe,e)):J(Pe),Y(Pe,n)}var wt=null,Oi=!1,Co=!1;function If(e){wt===null?wt=[e]:wt.push(e)}function kh(e){Oi=!0,If(e)}function rn(){if(!Co&&wt!==null){Co=!0;var e=0,t=Q;try{var n=wt;for(Q=1;e>=o,l-=o,St=1<<32-et(t)+l|n<F?(W=O,O=null):W=O.sibling;var A=v(h,O,m[F],_);if(A===null){O===null&&(O=W);break}e&&O&&A.alternate===null&&t(h,O),p=i(A,p,F),j===null?T=A:j.sibling=A,j=A,O=W}if(F===m.length)return n(h,O),b&&sn(h,F),T;if(O===null){for(;FF?(W=O,O=null):W=O.sibling;var we=v(h,O,A.value,_);if(we===null){O===null&&(O=W);break}e&&O&&we.alternate===null&&t(h,O),p=i(we,p,F),j===null?T=we:j.sibling=we,j=we,O=W}if(A.done)return n(h,O),b&&sn(h,F),T;if(O===null){for(;!A.done;F++,A=m.next())A=x(h,A.value,_),A!==null&&(p=i(A,p,F),j===null?T=A:j.sibling=A,j=A);return b&&sn(h,F),T}for(O=r(h,O);!A.done;F++,A=m.next())A=w(O,h,F,A.value,_),A!==null&&(e&&A.alternate!==null&&O.delete(A.key===null?F:A.key),p=i(A,p,F),j===null?T=A:j.sibling=A,j=A);return e&&O.forEach(function(ft){return t(h,ft)}),b&&sn(h,F),T}function z(h,p,m,_){if(typeof m=="object"&&m!==null&&m.type===Dn&&m.key===null&&(m=m.props.children),typeof m=="object"&&m!==null){switch(m.$$typeof){case Cl:e:{for(var T=m.key,j=p;j!==null;){if(j.key===T){if(T=m.type,T===Dn){if(j.tag===7){n(h,j.sibling),p=l(j,m.props.children),p.return=h,h=p;break e}}else if(j.elementType===T||typeof T=="object"&&T!==null&&T.$$typeof===Dt&&Ba(T)===j.type){n(h,j.sibling),p=l(j,m.props),p.ref=_r(h,j,m),p.return=h,h=p;break e}n(h,j);break}else t(h,j);j=j.sibling}m.type===Dn?(p=gn(m.props.children,h.mode,_,m.key),p.return=h,h=p):(_=ql(m.type,m.key,m.props,null,h.mode,_),_.ref=_r(h,p,m),_.return=h,h=_)}return o(h);case In:e:{for(j=m.key;p!==null;){if(p.key===j)if(p.tag===4&&p.stateNode.containerInfo===m.containerInfo&&p.stateNode.implementation===m.implementation){n(h,p.sibling),p=l(p,m.children||[]),p.return=h,h=p;break e}else{n(h,p);break}else t(h,p);p=p.sibling}p=Mo(m,h.mode,_),p.return=h,h=p}return o(h);case Dt:return j=m._init,z(h,p,j(m._payload),_)}if(Pr(m))return S(h,p,m,_);if(wr(m))return k(h,p,m,_);Il(h,m)}return typeof m=="string"&&m!==""||typeof m=="number"?(m=""+m,p!==null&&p.tag===6?(n(h,p.sibling),p=l(p,m),p.return=h,h=p):(n(h,p),p=Oo(m,h.mode,_),p.return=h,h=p),o(h)):n(h,p)}return z}var rr=Vf(!0),Wf=Vf(!1),cl={},ct=nn(cl),qr=nn(cl),br=nn(cl);function pn(e){if(e===cl)throw Error(N(174));return e}function as(e,t){switch(Y(br,t),Y(qr,e),Y(ct,cl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Yo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Yo(t,e)}J(ct),Y(ct,t)}function lr(){J(ct),J(qr),J(br)}function Qf(e){pn(br.current);var t=pn(ct.current),n=Yo(t,e.type);t!==n&&(Y(qr,e),Y(ct,n))}function cs(e){qr.current===e&&(J(ct),J(qr))}var te=nn(0);function mi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _o=[];function fs(){for(var e=0;e<_o.length;e++)_o[e]._workInProgressVersionPrimary=null;_o.length=0}var Zl=Pt.ReactCurrentDispatcher,To=Pt.ReactCurrentBatchConfig,wn=0,ne=null,ue=null,fe=null,gi=!1,Rr=!1,el=0,Ch=0;function ge(){throw Error(N(321))}function ds(e,t){if(t===null)return!1;for(var n=0;nn?n:4,e(!0);var r=To.transition;To.transition={};try{e(!1),t()}finally{Q=n,To.transition=r}}function ud(){return Ze().memoizedState}function Th(e,t,n){var r=Yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},sd(e))ad(t,n);else if(n=$f(e,t,n,r),n!==null){var l=Ee();tt(n,e,r,l),cd(n,t,r)}}function jh(e,t,n){var r=Yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(sd(e))ad(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,n);if(l.hasEagerState=!0,l.eagerState=s,nt(s,o)){var a=t.interleaved;a===null?(l.next=l,us(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=$f(e,t,l,r),n!==null&&(l=Ee(),tt(n,e,r,l),cd(n,t,r))}}function sd(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function ad(e,t){Rr=gi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function cd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zu(e,n)}}var vi={readContext:Ke,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useInsertionEffect:ge,useLayoutEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useMutableSource:ge,useSyncExternalStore:ge,useId:ge,unstable_isNewReconciler:!1},Nh={readContext:Ke,useCallback:function(e,t){return ut().memoizedState=[e,t===void 0?null:t],e},useContext:Ke,useEffect:Va,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gl(4194308,4,nd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gl(4,2,e,t)},useMemo:function(e,t){var n=ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ut();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Th.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=ut();return e={current:e},t.memoizedState=e},useState:Ha,useDebugValue:gs,useDeferredValue:function(e){return ut().memoizedState=e},useTransition:function(){var e=Ha(!1),t=e[0];return e=_h.bind(null,e[1]),ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,l=ut();if(b){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),de===null)throw Error(N(349));wn&30||Gf(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Va(Xf.bind(null,r,i,e),[e]),r.flags|=2048,nl(9,Yf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ut(),t=de.identifierPrefix;if(b){var n=kt,r=St;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=el++,0")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=s);break}}}finally{so=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Nr(e):""}function lp(e){switch(e.tag){case 5:return Nr(e.type);case 16:return Nr("Lazy");case 13:return Nr("Suspense");case 19:return Nr("SuspenseList");case 0:case 2:case 15:return e=ao(e.type,!1),e;case 11:return e=ao(e.type.render,!1),e;case 1:return e=ao(e.type,!0),e;default:return""}}function Wo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Dn:return"Fragment";case In:return"Portal";case Bo:return"Profiler";case Vu:return"StrictMode";case Ho:return"Suspense";case Vo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Hc:return(e.displayName||"Context")+".Consumer";case Bc:return(e._context.displayName||"Context")+".Provider";case Wu:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Qu:return t=e.displayName||null,t!==null?t:Wo(e.type)||"Memo";case Dt:t=e._payload,e=e._init;try{return Wo(e(t))}catch{}}return null}function ip(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Wo(t);case 8:return t===Vu?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Wc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function op(e){var t=Wc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _l(e){e._valueTracker||(e._valueTracker=op(e))}function Qc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Wc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Qo(e,t){var n=t.checked;return re({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ua(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Kc(e,t){t=t.checked,t!=null&&Hu(e,"checked",t,!1)}function Ko(e,t){Kc(e,t);var n=qt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Zo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Zo(e,t.type,qt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function sa(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Zo(e,t,n){(t!=="number"||bl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Pr=Array.isArray;function Zn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Tl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},up=["Webkit","ms","Moz","O"];Object.keys(Mr).forEach(function(e){up.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mr[t]=Mr[e]})});function Xc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mr.hasOwnProperty(e)&&Mr[e]?(""+t).trim():t+"px"}function Jc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Xc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var sp=re({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Xo(e,t){if(t){if(sp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(N(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(N(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(N(61))}if(t.style!=null&&typeof t.style!="object")throw Error(N(62))}}function Jo(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qo=null;function Ku(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bo=null,Gn=null,Yn=null;function fa(e){if(e=al(e)){if(typeof bo!="function")throw Error(N(280));var t=e.stateNode;t&&(t=Li(t),bo(e.stateNode,e.type,t))}}function qc(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function bc(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,fa(e),t)for(e=0;e>>=0,e===0?32:31-(xp(e)/wp|0)|0}var jl=64,Nl=4194304;function Lr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ri(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~l;s!==0?r=Lr(s):(i&=o,i!==0&&(r=Lr(i)))}else o=n&~l,o!==0?r=Lr(o):i!==0&&(r=Lr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ul(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-et(t),e[t]=n}function Cp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Fr),wa=String.fromCharCode(32),Sa=!1;function wf(e,t){switch(e){case"keyup":return qp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Sf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Rn=!1;function eh(e,t){switch(e){case"compositionend":return Sf(t);case"keypress":return t.which!==32?null:(Sa=!0,wa);case"textInput":return e=t.data,e===wa&&Sa?null:e;default:return null}}function th(e,t){if(Rn)return e==="compositionend"||!es&&wf(e,t)?(e=yf(),Wl=Ju=Bt=null,Rn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=_a(n)}}function _f(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_f(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tf(){for(var e=window,t=bl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bl(e.document)}return t}function ts(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function ch(e){var t=Tf(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_f(n.ownerDocument.documentElement,n)){if(r!==null&&ts(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Ta(n,i);var o=Ta(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,An=null,iu=null,Dr=null,ou=!1;function ja(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ou||An==null||An!==bl(r)||(r=An,"selectionStart"in r&&ts(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Dr&&Gr(Dr,r)||(Dr=r,r=oi(iu,"onSelect"),0Bn||(e.current=du[Bn],du[Bn]=null,Bn--)}function Y(e,t){Bn++,du[Bn]=e.current,e.current=t}var bt={},xe=nn(bt),Pe=nn(!1),yn=bt;function tr(e,t){var n=e.type.contextTypes;if(!n)return bt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function Le(e){return e=e.childContextTypes,e!=null}function si(){J(Pe),J(xe)}function Fa(e,t,n){if(xe.current!==bt)throw Error(N(168));Y(xe,t),Y(Pe,n)}function If(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(N(108,ip(e)||"Unknown",l));return re({},n,r)}function ai(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bt,yn=xe.current,Y(xe,e),Y(Pe,Pe.current),!0}function Ia(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=If(e,t,yn),r.__reactInternalMemoizedMergedChildContext=e,J(Pe),J(xe),Y(xe,e)):J(Pe),Y(Pe,n)}var St=null,Oi=!1,Co=!1;function Df(e){St===null?St=[e]:St.push(e)}function kh(e){Oi=!0,Df(e)}function rn(){if(!Co&&St!==null){Co=!0;var e=0,t=Q;try{var n=St;for(Q=1;e>=o,l-=o,kt=1<<32-et(t)+l|n<z?(W=O,O=null):W=O.sibling;var A=v(m,O,h[z],k);if(A===null){O===null&&(O=W);break}e&&O&&A.alternate===null&&t(m,O),p=i(A,p,z),j===null?_=A:j.sibling=A,j=A,O=W}if(z===h.length)return n(m,O),b&&sn(m,z),_;if(O===null){for(;zz?(W=O,O=null):W=O.sibling;var we=v(m,O,A.value,k);if(we===null){O===null&&(O=W);break}e&&O&&we.alternate===null&&t(m,O),p=i(we,p,z),j===null?_=we:j.sibling=we,j=we,O=W}if(A.done)return n(m,O),b&&sn(m,z),_;if(O===null){for(;!A.done;z++,A=h.next())A=y(m,A.value,k),A!==null&&(p=i(A,p,z),j===null?_=A:j.sibling=A,j=A);return b&&sn(m,z),_}for(O=r(m,O);!A.done;z++,A=h.next())A=w(O,m,z,A.value,k),A!==null&&(e&&A.alternate!==null&&O.delete(A.key===null?z:A.key),p=i(A,p,z),j===null?_=A:j.sibling=A,j=A);return e&&O.forEach(function(dt){return t(m,dt)}),b&&sn(m,z),_}function I(m,p,h,k){if(typeof h=="object"&&h!==null&&h.type===Dn&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case Cl:e:{for(var _=h.key,j=p;j!==null;){if(j.key===_){if(_=h.type,_===Dn){if(j.tag===7){n(m,j.sibling),p=l(j,h.props.children),p.return=m,m=p;break e}}else if(j.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Dt&&Ha(_)===j.type){n(m,j.sibling),p=l(j,h.props),p.ref=_r(m,j,h),p.return=m,m=p;break e}n(m,j);break}else t(m,j);j=j.sibling}h.type===Dn?(p=gn(h.props.children,m.mode,k,h.key),p.return=m,m=p):(k=ql(h.type,h.key,h.props,null,m.mode,k),k.ref=_r(m,p,h),k.return=m,m=k)}return o(m);case In:e:{for(j=h.key;p!==null;){if(p.key===j)if(p.tag===4&&p.stateNode.containerInfo===h.containerInfo&&p.stateNode.implementation===h.implementation){n(m,p.sibling),p=l(p,h.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=Mo(h,m.mode,k),p.return=m,m=p}return o(m);case Dt:return j=h._init,I(m,p,j(h._payload),k)}if(Pr(h))return S(m,p,h,k);if(wr(h))return T(m,p,h,k);Il(m,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,p!==null&&p.tag===6?(n(m,p.sibling),p=l(p,h),p.return=m,m=p):(n(m,p),p=Oo(h,m.mode,k),p.return=m,m=p),o(m)):n(m,p)}return I}var rr=Wf(!0),Qf=Wf(!1),cl={},ct=nn(cl),qr=nn(cl),br=nn(cl);function pn(e){if(e===cl)throw Error(N(174));return e}function cs(e,t){switch(Y(br,t),Y(qr,e),Y(ct,cl),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Yo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Yo(t,e)}J(ct),Y(ct,t)}function lr(){J(ct),J(qr),J(br)}function Kf(e){pn(br.current);var t=pn(ct.current),n=Yo(t,e.type);t!==n&&(Y(qr,e),Y(ct,n))}function fs(e){qr.current===e&&(J(ct),J(qr))}var te=nn(0);function mi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _o=[];function ds(){for(var e=0;e<_o.length;e++)_o[e]._workInProgressVersionPrimary=null;_o.length=0}var Zl=Lt.ReactCurrentDispatcher,To=Lt.ReactCurrentBatchConfig,wn=0,ne=null,ue=null,fe=null,gi=!1,Rr=!1,el=0,Ch=0;function ge(){throw Error(N(321))}function ps(e,t){if(t===null)return!1;for(var n=0;nn?n:4,e(!0);var r=To.transition;To.transition={};try{e(!1),t()}finally{Q=n,To.transition=r}}function sd(){return Ze().memoizedState}function Th(e,t,n){var r=Yt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ad(e))cd(t,n);else if(n=Uf(e,t,n,r),n!==null){var l=Ee();tt(n,e,r,l),fd(n,t,r)}}function jh(e,t,n){var r=Yt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ad(e))cd(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,n);if(l.hasEagerState=!0,l.eagerState=s,nt(s,o)){var a=t.interleaved;a===null?(l.next=l,ss(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Uf(e,t,l,r),n!==null&&(l=Ee(),tt(n,e,r,l),fd(n,t,r))}}function ad(e){var t=e.alternate;return e===ne||t!==null&&t===ne}function cd(e,t){Rr=gi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Gu(e,n)}}var vi={readContext:Ke,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useInsertionEffect:ge,useLayoutEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useMutableSource:ge,useSyncExternalStore:ge,useId:ge,unstable_isNewReconciler:!1},Nh={readContext:Ke,useCallback:function(e,t){return ut().memoizedState=[e,t===void 0?null:t],e},useContext:Ke,useEffect:Wa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Gl(4194308,4,rd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Gl(4,2,e,t)},useMemo:function(e,t){var n=ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ut();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Th.bind(null,ne,e),[r.memoizedState,e]},useRef:function(e){var t=ut();return e={current:e},t.memoizedState=e},useState:Va,useDebugValue:vs,useDeferredValue:function(e){return ut().memoizedState=e},useTransition:function(){var e=Va(!1),t=e[0];return e=_h.bind(null,e[1]),ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ne,l=ut();if(b){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),de===null)throw Error(N(349));wn&30||Yf(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Wa(Jf.bind(null,r,i,e),[e]),r.flags|=2048,nl(9,Xf.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ut(),t=de.identifierPrefix;if(b){var n=Et,r=kt;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=el++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[st]=t,e[Jr]=r,xd(e,t,!1,!1),t.stateNode=e;e:{switch(o=Jo(n,r),n){case"dialog":X("cancel",e),X("close",e),l=r;break;case"iframe":case"object":case"embed":X("load",e),l=r;break;case"video":case"audio":for(l=0;lor&&(t.flags|=128,r=!0,Tr(i,!1),t.lanes=4194304)}else{if(!r)if(e=mi(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Tr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!b)return ve(t),null}else 2*ie()-i.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,Tr(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ie(),t.sibling=null,n=te.current,Y(te,r?n&1|2:n&1),t):(ve(t),null);case 22:case 23:return ks(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Me&1073741824&&(ve(t),t.subtreeFlags&6&&(t.flags|=8192)):ve(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Dh(e,t){switch(ns(t),t.tag){case 1:return Le(t.type)&&si(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lr(),J(Pe),J(xe),fs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return cs(t),null;case 13:if(J(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));nr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return J(te),null;case 4:return lr(),null;case 10:return os(t.type._context),null;case 22:case 23:return ks(),null;case 24:return null;default:return null}}var Rl=!1,ye=!1,Rh=typeof WeakSet=="function"?WeakSet:Set,I=null;function Qn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){le(e,t,r)}else n.current=null}function Cu(e,t,n){try{n()}catch(r){le(e,t,r)}}var qa=!1;function Ah(e,t){if(uu=li,e=_f(),es(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,s=-1,a=-1,f=0,y=0,x=e,v=null;t:for(;;){for(var w;x!==n||l!==0&&x.nodeType!==3||(s=o+l),x!==i||r!==0&&x.nodeType!==3||(a=o+r),x.nodeType===3&&(o+=x.nodeValue.length),(w=x.firstChild)!==null;)v=x,x=w;for(;;){if(x===e)break t;if(v===n&&++f===l&&(s=o),v===i&&++y===r&&(a=o),(w=x.nextSibling)!==null)break;x=v,v=x.parentNode}x=w}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(su={focusedElem:e,selectionRange:n},li=!1,I=t;I!==null;)if(t=I,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,I=e;else for(;I!==null;){t=I;try{var S=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var k=S.memoizedProps,z=S.memoizedState,h=t.stateNode,p=h.getSnapshotBeforeUpdate(t.elementType===t.type?k:Je(t.type,k),z);h.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var m=t.stateNode.containerInfo;m.nodeType===1?m.textContent="":m.nodeType===9&&m.documentElement&&m.removeChild(m.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(_){le(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,I=e;break}I=t.return}return S=qa,qa=!1,S}function Ar(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Cu(t,n,i)}l=l.next}while(l!==r)}}function Fi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _u(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function kd(e){var t=e.alternate;t!==null&&(e.alternate=null,kd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[st],delete t[Jr],delete t[fu],delete t[wh],delete t[Sh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ed(e){return e.tag===5||e.tag===3||e.tag===4}function ba(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ed(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}function ju(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ju(e,t,n),e=e.sibling;e!==null;)ju(e,t,n),e=e.sibling}var pe=null,qe=!1;function It(e,t,n){for(n=n.child;n!==null;)Cd(e,t,n),n=n.sibling}function Cd(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Ti,n)}catch{}switch(n.tag){case 5:ye||Qn(n,t);case 6:var r=pe,l=qe;pe=null,It(e,t,n),pe=r,qe=l,pe!==null&&(qe?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(qe?(e=pe,n=n.stateNode,e.nodeType===8?Eo(e.parentNode,n):e.nodeType===1&&Eo(e,n),Kr(e)):Eo(pe,n.stateNode));break;case 4:r=pe,l=qe,pe=n.stateNode.containerInfo,qe=!0,It(e,t,n),pe=r,qe=l;break;case 0:case 11:case 14:case 15:if(!ye&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Cu(n,t,o),l=l.next}while(l!==r)}It(e,t,n);break;case 1:if(!ye&&(Qn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){le(n,t,s)}It(e,t,n);break;case 21:It(e,t,n);break;case 22:n.mode&1?(ye=(r=ye)||n.memoizedState!==null,It(e,t,n),ye=r):It(e,t,n);break;default:It(e,t,n)}}function ec(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rh),t.forEach(function(r){var l=Zh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Xe(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uh(r/1960))-r,10e?16:e,Ht===null)var r=!1;else{if(e=Ht,Ht=null,wi=0,V&6)throw Error(N(331));var l=V;for(V|=4,I=e.current;I!==null;){var i=I,o=i.child;if(I.flags&16){var s=i.deletions;if(s!==null){for(var a=0;aie()-ws?mn(e,0):xs|=n),Oe(e,t)}function Md(e,t){t===0&&(e.mode&1?(t=Nl,Nl<<=1,!(Nl&130023424)&&(Nl=4194304)):t=1);var n=Ee();e=jt(e,t),e!==null&&(ul(e,t,n),Oe(e,n))}function Kh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Md(e,n)}function Zh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),Md(e,n)}var zd;zd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Pe.current)Ne=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ne=!1,Fh(e,t,n);Ne=!!(e.flags&131072)}else Ne=!1,b&&t.flags&1048576&&Df(t,fi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yl(e,t),e=t.pendingProps;var l=tr(t,xe.current);Jn(t,n),l=ps(null,t,r,e,l,n);var i=hs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Le(r)?(i=!0,ai(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ss(t),l.updater=Mi,t.stateNode=l,l._reactInternals=t,vu(t,r,e,n),t=wu(null,t,r,!0,i,n)):(t.tag=0,b&&i&&ts(t),ke(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Yh(r),e=Je(r,e),l){case 0:t=xu(null,t,r,e,n);break e;case 1:t=Ya(null,t,r,e,n);break e;case 11:t=Za(null,t,r,e,n);break e;case 14:t=Ga(null,t,r,Je(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),xu(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Ya(e,t,r,l,n);case 3:e:{if(gd(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Uf(e,t),hi(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=ir(Error(N(423)),t),t=Xa(e,t,r,n,l);break e}else if(r!==l){l=ir(Error(N(424)),t),t=Xa(e,t,r,n,l);break e}else for(ze=Kt(t.stateNode.containerInfo.firstChild),Fe=t,b=!0,be=null,n=Wf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nr(),r===l){t=Nt(e,t,n);break e}ke(e,t,r,n)}t=t.child}return t;case 5:return Qf(t),e===null&&hu(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,au(r,l)?o=null:i!==null&&au(r,i)&&(t.flags|=32),md(e,t),ke(e,t,o,n),t.child;case 6:return e===null&&hu(t),null;case 13:return vd(e,t,n);case 4:return as(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=rr(t,null,r,n):ke(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Za(e,t,r,l,n);case 7:return ke(e,t,t.pendingProps,n),t.child;case 8:return ke(e,t,t.pendingProps.children,n),t.child;case 12:return ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,Y(di,r._currentValue),r._currentValue=o,i!==null)if(nt(i.value,o)){if(i.children===l.children&&!Pe.current){t=Nt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Ct(-1,n&-n),a.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var y=f.pending;y===null?a.next=a:(a.next=y.next,y.next=a),f.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),mu(i.return,n,t),s.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(N(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),mu(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ke(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Jn(t,n),l=Ke(l),r=r(l),t.flags|=1,ke(e,t,r,n),t.child;case 14:return r=t.type,l=Je(r,t.pendingProps),l=Je(r.type,l),Ga(e,t,r,l,n);case 15:return pd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Yl(e,t),t.tag=1,Le(r)?(e=!0,ai(t)):e=!1,Jn(t,n),Hf(t,r,l),vu(t,r,l,n),wu(null,t,r,!0,e,n);case 19:return yd(e,t,n);case 22:return hd(e,t,n)}throw Error(N(156,t.tag))};function Fd(e,t){return of(e,t)}function Gh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function We(e,t,n,r){return new Gh(e,t,n,r)}function Cs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yh(e){if(typeof e=="function")return Cs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Vu)return 11;if(e===Wu)return 14}return 2}function Xt(e,t){var n=e.alternate;return n===null?(n=We(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ql(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Cs(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Dn:return gn(n.children,l,i,t);case Hu:o=8,l|=8;break;case Bo:return e=We(12,n,t,l|2),e.elementType=Bo,e.lanes=i,e;case Ho:return e=We(13,n,t,l),e.elementType=Ho,e.lanes=i,e;case Vo:return e=We(19,n,t,l),e.elementType=Vo,e.lanes=i,e;case Hc:return Di(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Uc:o=10;break e;case Bc:o=9;break e;case Vu:o=11;break e;case Wu:o=14;break e;case Dt:o=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=We(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function gn(e,t,n,r){return e=We(7,e,r,t),e.lanes=n,e}function Di(e,t,n,r){return e=We(22,e,r,t),e.elementType=Hc,e.lanes=n,e.stateNode={isHidden:!1},e}function Oo(e,t,n){return e=We(6,e,null,t),e.lanes=n,e}function Mo(e,t,n){return t=We(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fo(0),this.expirationTimes=fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function _s(e,t,n,r,l,i,o,s,a){return e=new Xh(e,t,n,s,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=We(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ss(i),e}function Jh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ad)}catch(e){console.error(e)}}Ad(),Ic.exports=De;var $d=Ic.exports;const nm=il($d);var sc=$d;$o.createRoot=sc.createRoot,$o.hydrateRoot=sc.hydrateRoot;const Lt=C.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},updateOnlyFiles:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getStreamLogsUrl:()=>null}),Ps=C.createContext({refresh:()=>{}}),Ei=({label:e,className:t})=>d.jsxs("div",{className:`flex gap-2 items-center ${t}`,children:[d.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),d.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e?d.jsxs("span",{className:"text-sm",children:[e," ..."]}):d.jsx("span",{className:"sr-only",children:"Loading..."})]}),Ls="initializing",rm="paused",lm="live",im="error";function Os(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";i()};let i=()=>{n=setTimeout(l,r)};return i(),()=>{clearTimeout(n)}}function Ud(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=i=>{n=setTimeout(r,i!==void 0?i:t)};return l(0),()=>clearTimeout(n)}var Bd={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ac=Et.createContext&&Et.createContext(Bd),Jt=globalThis&&globalThis.__assign||function(){return Jt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:i,...o}=e,s=f=>{f.stopPropagation(),!n&&t()},a=r?`text-${r}`:"";return d.jsx("a",{className:`p-1 text-blue-500 flex items-center justify-center ${a} ${i}`,onClick:s,href:"#",...o,children:l})};function fm(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function dm(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"}}]})(e)}function Vd(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const pm=({title:e,children:t,onClose:n})=>d.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3 dark:bg-red-800/60",children:[d.jsxs("div",{className:"flex justify-between mb-2",children:[d.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&d.jsx("button",{onClick:n,children:d.jsx(Vd,{})})]}),t]}),En=e=>{var r,l,i;let{error:t,remove:n}=e;return t==null?null:d.jsxs(pm,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&d.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),d.jsx("div",{className:"whitespace-pre-wrap text-sm",children:(i=t.details)==null?void 0:i.text})]})};function Ms(e){return e&&e.ownerDocument||document}function zo(e){e===void 0&&(e=Ms());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function cc(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Bi=!!(typeof window<"u"&&window.document&&window.document.createElement);var Mu=!1,zu=!1;try{var Fo={get passive(){return Mu=!0},get once(){return zu=Mu=!0}};Bi&&(window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,!0))}catch{}function hm(e,t,n,r){if(r&&typeof r!="boolean"&&!zu){var l=r.once,i=r.capture,o=n;!zu&&l&&(o=n.__once||function s(a){this.removeEventListener(t,s,i),n.call(this,a)},n.__once=o),e.addEventListener(t,o,Mu?r:i)}e.addEventListener(t,n,r)}function mm(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function fc(e,t,n,r){return hm(e,t,n,r),function(){mm(e,t,n,r)}}function gm(){const e=C.useRef(!0),t=C.useRef(()=>e.current);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function vm(e){const t=C.useRef(e);return t.current=e,t}function ym(e){const t=vm(e);C.useEffect(()=>()=>t.current(),[])}function xm(e){const t=C.useRef(null);return C.useEffect(()=>{t.current=e}),t.current}function wm(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e},[e]),t}function cn(e){const t=wm(e);return C.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function Sm(e){var t=Ms(e);return t&&t.defaultView||window}function km(e,t){return Sm(e).getComputedStyle(e,t)}var Em=/([A-Z])/g;function Cm(e){return e.replace(Em,"-$1").toLowerCase()}var _m=/^ms-/;function Ul(e){return Cm(e).replace(_m,"-ms-")}var Tm=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function jm(e){return!!(e&&Tm.test(e))}function dc(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Ul(t))||km(e).getPropertyValue(Ul(t));Object.keys(t).forEach(function(l){var i=t[l];!i&&i!==0?e.style.removeProperty(Ul(l)):jm(l)?r+=l+"("+i+") ":n+=Ul(l)+": "+i+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const Nm="data-rr-ui-";function Pm(e){return`${Nm}${e}`}function Lm(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const pc=Pm("modal-open");class Om{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return Lm(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(dc(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(pc,""),dc(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(pc),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const Wd=Om,Qd=C.createContext(Bi?window:void 0);Qd.Provider;function zs(){return C.useContext(Qd)}const Io=(e,t)=>Bi?e==null?(t||Ms()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function Mm(e,t){const n=zs(),[r,l]=C.useState(()=>Io(e,n==null?void 0:n.document));if(!r){const i=Io(e);i&&l(i)}return C.useEffect(()=>{t&&r&&t(r)},[t,r]),C.useEffect(()=>{const i=Io(e);i!==r&&l(i)},[e,r]),r}const hc=e=>!e||typeof e=="function"?e:t=>{e.current=t};function zm(e,t){const n=hc(e),r=hc(t);return l=>{n&&n(l),r&&r(l)}}function Fs(e,t){return C.useMemo(()=>zm(e,t),[e,t])}const Fm=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",Im=typeof document<"u",mc=Im||Fm?C.useLayoutEffect:C.useEffect;function Dm({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const i=C.useRef(null),o=C.useRef(t),s=cn(n);C.useEffect(()=>{t?o.current=!0:s(i.current)},[t,s]);const a=Fs(i,e.ref),f=C.cloneElement(e,{ref:a});return t?f:l||!o.current&&r?null:f}const Rm=["onEnter","onEntering","onEntered","onExit","onExiting","onExited","addEndListener","children"];function Am(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}function $m(e){let{onEnter:t,onEntering:n,onEntered:r,onExit:l,onExiting:i,onExited:o,addEndListener:s,children:a}=e,f=Am(e,Rm);const y=C.useRef(null),x=Fs(y,typeof a=="function"?null:a.ref),v=_=>T=>{_&&y.current&&_(y.current,T)},w=C.useCallback(v(t),[t]),S=C.useCallback(v(n),[n]),k=C.useCallback(v(r),[r]),z=C.useCallback(v(l),[l]),h=C.useCallback(v(i),[i]),p=C.useCallback(v(o),[o]),m=C.useCallback(v(s),[s]);return Object.assign({},f,{nodeRef:y},t&&{onEnter:w},n&&{onEntering:S},r&&{onEntered:k},l&&{onExit:z},i&&{onExiting:h},o&&{onExited:p},s&&{addEndListener:m},{children:typeof a=="function"?(_,T)=>a(_,Object.assign({},T,{ref:x})):C.cloneElement(a,{ref:x})})}const Um=["component"];function Bm(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}const Hm=C.forwardRef((e,t)=>{let{component:n}=e,r=Bm(e,Um);const l=$m(r);return d.jsx(n,Object.assign({ref:t},l))}),Vm=Hm;function Wm({in:e,onTransition:t}){const n=C.useRef(null),r=C.useRef(!0),l=cn(t);return mc(()=>{if(!n.current)return;let i=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>i}),()=>{i=!0}},[e,l]),mc(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function Qm({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[i,o]=C.useState(!t);t&&i&&o(!1);const s=Wm({in:!!t,onTransition:f=>{const y=()=>{f.isStale()||(f.in?r==null||r(f.element,f.initial):(o(!0),n==null||n(f.element)))};Promise.resolve(l(f)).then(y,x=>{throw f.in||o(!0),x})}}),a=Fs(s,e.ref);return i&&!t?null:C.cloneElement(e,{ref:a})}function gc(e,t,n){return e?d.jsx(Vm,Object.assign({},n,{component:e})):t?d.jsx(Qm,Object.assign({},n,{transition:t})):d.jsx(Dm,Object.assign({},n))}function Km(e){return e.code==="Escape"||e.keyCode===27}const Zm=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function Gm(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}let Do;function Ym(e){return Do||(Do=new Wd({ownerDocument:e==null?void 0:e.document})),Do}function Xm(e){const t=zs(),n=e||Ym(t),r=C.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:C.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:C.useCallback(l=>{r.current.backdrop=l},[])})}const Kd=C.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:i,children:o,backdrop:s=!0,keyboard:a=!0,onBackdropClick:f,onEscapeKeyDown:y,transition:x,runTransition:v,backdropTransition:w,runBackdropTransition:S,autoFocus:k=!0,enforceFocus:z=!0,restoreFocus:h=!0,restoreFocusOptions:p,renderDialog:m,renderBackdrop:_=q=>d.jsx("div",Object.assign({},q)),manager:T,container:j,onShow:O,onHide:F=()=>{},onExit:W,onExited:A,onExiting:we,onEnter:ft,onEntering:dt,onEntered:Tn}=e,fr=Gm(e,Zm);const Ae=zs(),rt=Mm(j),P=Xm(T),R=gm(),$=xm(n),[K,ee]=C.useState(!n),Ge=C.useRef(null);C.useImperativeHandle(t,()=>P,[P]),Bi&&!$&&n&&(Ge.current=zo(Ae==null?void 0:Ae.document)),n&&K&&ee(!1);const $e=cn(()=>{if(P.add(),dr.current=fc(document,"keydown",Z),jn.current=fc(document,"focus",()=>setTimeout(Ye),!0),O&&O(),k){var q,hr;const Ln=zo((q=(hr=P.dialog)==null?void 0:hr.ownerDocument)!=null?q:Ae==null?void 0:Ae.document);P.dialog&&Ln&&!cc(P.dialog,Ln)&&(Ge.current=Ln,P.dialog.focus())}}),pt=cn(()=>{if(P.remove(),dr.current==null||dr.current(),jn.current==null||jn.current(),h){var q;(q=Ge.current)==null||q.focus==null||q.focus(p),Ge.current=null}});C.useEffect(()=>{!n||!rt||$e()},[n,rt,$e]),C.useEffect(()=>{K&&pt()},[K,pt]),ym(()=>{pt()});const Ye=cn(()=>{if(!z||!R()||!P.isTopModal())return;const q=zo(Ae==null?void 0:Ae.document);P.dialog&&q&&!cc(P.dialog,q)&&P.dialog.focus()}),Ot=cn(q=>{q.target===q.currentTarget&&(f==null||f(q),s===!0&&F())}),Z=cn(q=>{a&&Km(q)&&P.isTopModal()&&(y==null||y(q),q.defaultPrevented||F())}),jn=C.useRef(),dr=C.useRef(),lt=(...q)=>{ee(!0),A==null||A(...q)};if(!rt)return null;const pr=Object.assign({role:r,ref:P.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},fr,{style:i,className:l,tabIndex:-1});let Nn=m?m(pr):d.jsx("div",Object.assign({},pr,{children:C.cloneElement(o,{role:"document"})}));Nn=gc(x,v,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:W,onExiting:we,onExited:lt,onEnter:ft,onEntering:dt,onEntered:Tn,children:Nn});let Pn=null;return s&&(Pn=_({ref:P.setBackdropRef,onClick:Ot}),Pn=gc(w,S,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:Pn})),d.jsx(d.Fragment,{children:nm.createPortal(d.jsxs(d.Fragment,{children:[Pn,Nn]}),rt)})});Kd.displayName="Modal";const Jm=Object.assign(Kd,{Manager:Wd}),qm=({onClose:e,title:t})=>d.jsxs("div",{className:"flex p-3 justify-between items-center border-b dark:border-slate-600",children:[d.jsx("h2",{className:"text-xl font-semibold dark:slate-300",children:t}),e&&d.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:d.jsx(Vd,{className:"w-5 h-5"})})]}),Hi=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const i=()=>d.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300] dark:bg-black/60 backdrop-blur"});return d.jsx(Jm,{show:e,onHide:t,renderBackdrop:i,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:d.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l} dark:bg-slate-800 dark:text-gray-50`,children:[d.jsx(qm,{onClose:t,title:n}),r]})})},Vi=({children:e})=>d.jsx("div",{className:"p-3 border-b dark:border-slate-500",children:e}),Wi=({children:e,className:t})=>d.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),en=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let i={secondary:"hover:bg-blue-500 transition-colors hover:text-white dark:hover:bg-blue-900/50",danger:"bg-red-400 text-white border-green-50 hover:border-red-700 hover:bg-red-600 dark:bg-red-800 dark:border-none dark:hover:bg-red-900",primary:"bg-blue-600 text-white hover:bg-blue-800 disabled:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-300 dark:border-none",cancel:"hover:bg-slate-200 dark:bg-slate-600 dark:hover:bg-slate-700 dark:border-none",none:""}[l??"secondary"];return d.jsx("button",{disabled:r,onClick:o=>{o.preventDefault(),e()},className:`inline-flex items-center gap-1 border rounded-lg disabled:cursor-not-allowed px-2 py-1 dark:border-slate-700 ${i} ${n}`,children:t})},vc=e=>{let t;const n=new Set,r=(y,x)=>{const v=typeof y=="function"?y(t):y;if(!Object.is(v,t)){const w=t;t=x??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(S=>S(t,w))}},l=()=>t,a={setState:r,getState:l,getInitialState:()=>f,subscribe:y=>(n.add(y),()=>n.delete(y)),destroy:()=>{n.clear()}},f=t=e(r,l,a);return a},bm=e=>e?vc(e):vc;var Zd={exports:{}},Gd={},Yd={exports:{}},Xd={};/** +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function Po(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function yu(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Oh=typeof WeakMap=="function"?WeakMap:Map;function dd(e,t,n){n=_t(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){xi||(xi=!0,Nu=r),yu(e,t)},n}function pd(e,t,n){n=_t(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){yu(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){yu(e,t),typeof r!="function"&&(Gt===null?Gt=new Set([this]):Gt.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Qa(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Oh;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=Qh.bind(null,e,t,n),t.then(e,e))}function Ka(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Za(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=_t(-1,1),t.tag=2,Zt(n,t,1))),n.lanes|=1),e)}var Mh=Lt.ReactCurrentOwner,Ne=!1;function ke(e,t,n,r){t.child=e===null?Qf(t,null,n,r):rr(t,e.child,n,r)}function Ga(e,t,n,r,l){n=n.render;var i=t.ref;return Jn(t,l),r=hs(e,t,n,r,i,l),n=ms(),e!==null&&!Ne?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Pt(e,t,l)):(b&&n&&ns(t),t.flags|=1,ke(e,t,r,l),t.child)}function Ya(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!_s(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,hd(e,t,i,r,l)):(e=ql(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:Gr,n(o,r)&&e.ref===t.ref)return Pt(e,t,l)}return t.flags|=1,e=Xt(i,r),e.ref=t.ref,e.return=t,t.child=e}function hd(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(Gr(i,r)&&e.ref===t.ref)if(Ne=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(Ne=!0);else return t.lanes=e.lanes,Pt(e,t,l)}return xu(e,t,n,r,l)}function md(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Y(Kn,Me),Me|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Y(Kn,Me),Me|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Y(Kn,Me),Me|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Y(Kn,Me),Me|=r;return ke(e,t,l,n),t.child}function gd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function xu(e,t,n,r,l){var i=Le(n)?yn:xe.current;return i=tr(t,i),Jn(t,l),n=hs(e,t,n,r,i,l),r=ms(),e!==null&&!Ne?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Pt(e,t,l)):(b&&r&&ns(t),t.flags|=1,ke(e,t,n,l),t.child)}function Xa(e,t,n,r,l){if(Le(n)){var i=!0;ai(t)}else i=!1;if(Jn(t,l),t.stateNode===null)Yl(e,t),Vf(t,n,r),vu(t,n,r,l),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var a=o.context,f=n.contextType;typeof f=="object"&&f!==null?f=Ke(f):(f=Le(n)?yn:xe.current,f=tr(t,f));var x=n.getDerivedStateFromProps,y=typeof x=="function"||typeof o.getSnapshotBeforeUpdate=="function";y||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==r||a!==f)&&Ba(t,o,r,f),Rt=!1;var v=t.memoizedState;o.state=v,hi(t,r,o,l),a=t.memoizedState,s!==r||v!==a||Pe.current||Rt?(typeof x=="function"&&(gu(t,n,x,r),a=t.memoizedState),(s=Rt||Ua(t,n,s,r,v,a,f))?(y||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),o.props=r,o.state=a,o.context=f,r=s):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Bf(e,t),s=t.memoizedProps,f=t.type===t.elementType?s:Je(t.type,s),o.props=f,y=t.pendingProps,v=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Ke(a):(a=Le(n)?yn:xe.current,a=tr(t,a));var w=n.getDerivedStateFromProps;(x=typeof w=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==y||v!==a)&&Ba(t,o,r,a),Rt=!1,v=t.memoizedState,o.state=v,hi(t,r,o,l);var S=t.memoizedState;s!==y||v!==S||Pe.current||Rt?(typeof w=="function"&&(gu(t,n,w,r),S=t.memoizedState),(f=Rt||Ua(t,n,f,r,v,S,a)||!1)?(x||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,S,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,S,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=S),o.props=r,o.state=S,o.context=a,r=f):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),r=!1)}return wu(e,t,n,r,i,l)}function wu(e,t,n,r,l,i){gd(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return l&&Ia(t,n,!1),Pt(e,t,i);r=t.stateNode,Mh.current=t;var s=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=rr(t,e.child,null,i),t.child=rr(t,null,s,i)):ke(e,t,s,i),t.memoizedState=r.state,l&&Ia(t,n,!0),t.child}function vd(e){var t=e.stateNode;t.pendingContext?Fa(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Fa(e,t.context,!1),cs(e,t.containerInfo)}function Ja(e,t,n,r,l){return nr(),ls(l),t.flags|=256,ke(e,t,n,r),t.child}var Su={dehydrated:null,treeContext:null,retryLane:0};function ku(e){return{baseLanes:e,cachePool:null,transitions:null}}function yd(e,t,n){var r=t.pendingProps,l=te.current,i=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(l&2)!==0),s?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Y(te,l&1),e===null)return hu(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Di(o,r,0,null),e=gn(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=ku(n),t.memoizedState=Su,e):ys(t,o));if(l=e.memoizedState,l!==null&&(s=l.dehydrated,s!==null))return zh(e,t,o,r,s,l,n);if(i){i=r.fallback,o=t.mode,l=e.child,s=l.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=Xt(l,a),r.subtreeFlags=l.subtreeFlags&14680064),s!==null?i=Xt(s,i):(i=gn(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?ku(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Su,r}return i=e.child,e=i.sibling,r=Xt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function ys(e,t){return t=Di({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Dl(e,t,n,r){return r!==null&&ls(r),rr(t,e.child,null,n),e=ys(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zh(e,t,n,r,l,i,o){if(n)return t.flags&256?(t.flags&=-257,r=Po(Error(N(422))),Dl(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=Di({mode:"visible",children:r.children},l,0,null),i=gn(i,l,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&rr(t,e.child,null,o),t.child.memoizedState=ku(o),t.memoizedState=Su,i);if(!(t.mode&1))return Dl(e,t,o,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var s=r.dgst;return r=s,i=Error(N(419)),r=Po(i,r,void 0),Dl(e,t,o,r)}if(s=(o&e.childLanes)!==0,Ne||s){if(r=de,r!==null){switch(o&-o){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|o)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,Nt(e,l),tt(r,e,l,-1))}return Cs(),r=Po(Error(N(421))),Dl(e,t,o,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Kh.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,ze=Kt(l.nextSibling),Fe=t,b=!0,be=null,e!==null&&(He[Ve++]=kt,He[Ve++]=Et,He[Ve++]=xn,kt=e.id,Et=e.overflow,xn=t),t=ys(t,r.children),t.flags|=4096,t)}function qa(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),mu(e.return,t,n)}function Lo(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function xd(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(ke(e,t,r.children,n),r=te.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&qa(e,n,t);else if(e.tag===19)qa(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Y(te,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&mi(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Lo(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&mi(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Lo(t,!0,n,null,i);break;case"together":Lo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Yl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Pt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Sn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(N(153));if(t.child!==null){for(e=t.child,n=Xt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fh(e,t,n){switch(t.tag){case 3:vd(t),nr();break;case 5:Kf(t);break;case 1:Le(t.type)&&ai(t);break;case 4:cs(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;Y(di,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Y(te,te.current&1),t.flags|=128,null):n&t.child.childLanes?yd(e,t,n):(Y(te,te.current&1),e=Pt(e,t,n),e!==null?e.sibling:null);Y(te,te.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return xd(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Y(te,te.current),r)break;return null;case 22:case 23:return t.lanes=0,md(e,t,n)}return Pt(e,t,n)}var wd,Eu,Sd,kd;wd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Eu=function(){};Sd=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,pn(ct.current);var i=null;switch(n){case"input":l=Qo(e,l),r=Qo(e,r),i=[];break;case"select":l=re({},l,{value:void 0}),r=re({},r,{value:void 0}),i=[];break;case"textarea":l=Go(e,l),r=Go(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ui)}Xo(n,r);var o;n=null;for(f in l)if(!r.hasOwnProperty(f)&&l.hasOwnProperty(f)&&l[f]!=null)if(f==="style"){var s=l[f];for(o in s)s.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else f!=="dangerouslySetInnerHTML"&&f!=="children"&&f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&f!=="autoFocus"&&(Br.hasOwnProperty(f)?i||(i=[]):(i=i||[]).push(f,null));for(f in r){var a=r[f];if(s=l!=null?l[f]:void 0,r.hasOwnProperty(f)&&a!==s&&(a!=null||s!=null))if(f==="style")if(s){for(o in s)!s.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&s[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(i||(i=[]),i.push(f,n)),n=a;else f==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,s=s?s.__html:void 0,a!=null&&s!==a&&(i=i||[]).push(f,a)):f==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(f,""+a):f!=="suppressContentEditableWarning"&&f!=="suppressHydrationWarning"&&(Br.hasOwnProperty(f)?(a!=null&&f==="onScroll"&&X("scroll",e),i||s===a||(i=[])):(i=i||[]).push(f,a))}n&&(i=i||[]).push("style",n);var f=i;(t.updateQueue=f)&&(t.flags|=4)}};kd=function(e,t,n,r){n!==r&&(t.flags|=4)};function Tr(e,t){if(!b)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ve(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ih(e,t,n){var r=t.pendingProps;switch(rs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ve(t),null;case 1:return Le(t.type)&&si(),ve(t),null;case 3:return r=t.stateNode,lr(),J(Pe),J(xe),ds(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Fl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,be!==null&&(Ou(be),be=null))),Eu(e,t),ve(t),null;case 5:fs(t);var l=pn(br.current);if(n=t.type,e!==null&&t.stateNode!=null)Sd(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(N(166));return ve(t),null}if(e=pn(ct.current),Fl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[st]=t,r[Jr]=i,e=(t.mode&1)!==0,n){case"dialog":X("cancel",r),X("close",r);break;case"iframe":case"object":case"embed":X("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[st]=t,e[Jr]=r,wd(e,t,!1,!1),t.stateNode=e;e:{switch(o=Jo(n,r),n){case"dialog":X("cancel",e),X("close",e),l=r;break;case"iframe":case"object":case"embed":X("load",e),l=r;break;case"video":case"audio":for(l=0;lor&&(t.flags|=128,r=!0,Tr(i,!1),t.lanes=4194304)}else{if(!r)if(e=mi(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Tr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!b)return ve(t),null}else 2*ie()-i.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,Tr(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ie(),t.sibling=null,n=te.current,Y(te,r?n&1|2:n&1),t):(ve(t),null);case 22:case 23:return Es(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Me&1073741824&&(ve(t),t.subtreeFlags&6&&(t.flags|=8192)):ve(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Dh(e,t){switch(rs(t),t.tag){case 1:return Le(t.type)&&si(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return lr(),J(Pe),J(xe),ds(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return fs(t),null;case 13:if(J(te),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));nr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return J(te),null;case 4:return lr(),null;case 10:return us(t.type._context),null;case 22:case 23:return Es(),null;case 24:return null;default:return null}}var Rl=!1,ye=!1,Rh=typeof WeakSet=="function"?WeakSet:Set,F=null;function Qn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){le(e,t,r)}else n.current=null}function Cu(e,t,n){try{n()}catch(r){le(e,t,r)}}var ba=!1;function Ah(e,t){if(uu=li,e=Tf(),ts(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,s=-1,a=-1,f=0,x=0,y=e,v=null;t:for(;;){for(var w;y!==n||l!==0&&y.nodeType!==3||(s=o+l),y!==i||r!==0&&y.nodeType!==3||(a=o+r),y.nodeType===3&&(o+=y.nodeValue.length),(w=y.firstChild)!==null;)v=y,y=w;for(;;){if(y===e)break t;if(v===n&&++f===l&&(s=o),v===i&&++x===r&&(a=o),(w=y.nextSibling)!==null)break;y=v,v=y.parentNode}y=w}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(su={focusedElem:e,selectionRange:n},li=!1,F=t;F!==null;)if(t=F,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,F=e;else for(;F!==null;){t=F;try{var S=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var T=S.memoizedProps,I=S.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?T:Je(t.type,T),I);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(k){le(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,F=e;break}F=t.return}return S=ba,ba=!1,S}function Ar(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Cu(t,n,i)}l=l.next}while(l!==r)}}function Fi(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function _u(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Ed(e){var t=e.alternate;t!==null&&(e.alternate=null,Ed(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[st],delete t[Jr],delete t[fu],delete t[wh],delete t[Sh])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Cd(e){return e.tag===5||e.tag===3||e.tag===4}function ec(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Cd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Tu(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ui));else if(r!==4&&(e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}function ju(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ju(e,t,n),e=e.sibling;e!==null;)ju(e,t,n),e=e.sibling}var pe=null,qe=!1;function It(e,t,n){for(n=n.child;n!==null;)_d(e,t,n),n=n.sibling}function _d(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(Ti,n)}catch{}switch(n.tag){case 5:ye||Qn(n,t);case 6:var r=pe,l=qe;pe=null,It(e,t,n),pe=r,qe=l,pe!==null&&(qe?(e=pe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):pe.removeChild(n.stateNode));break;case 18:pe!==null&&(qe?(e=pe,n=n.stateNode,e.nodeType===8?Eo(e.parentNode,n):e.nodeType===1&&Eo(e,n),Kr(e)):Eo(pe,n.stateNode));break;case 4:r=pe,l=qe,pe=n.stateNode.containerInfo,qe=!0,It(e,t,n),pe=r,qe=l;break;case 0:case 11:case 14:case 15:if(!ye&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Cu(n,t,o),l=l.next}while(l!==r)}It(e,t,n);break;case 1:if(!ye&&(Qn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){le(n,t,s)}It(e,t,n);break;case 21:It(e,t,n);break;case 22:n.mode&1?(ye=(r=ye)||n.memoizedState!==null,It(e,t,n),ye=r):It(e,t,n);break;default:It(e,t,n)}}function tc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Rh),t.forEach(function(r){var l=Zh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Xe(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=ie()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Uh(r/1960))-r,10e?16:e,Ht===null)var r=!1;else{if(e=Ht,Ht=null,wi=0,V&6)throw Error(N(331));var l=V;for(V|=4,F=e.current;F!==null;){var i=F,o=i.child;if(F.flags&16){var s=i.deletions;if(s!==null){for(var a=0;aie()-Ss?mn(e,0):ws|=n),Oe(e,t)}function zd(e,t){t===0&&(e.mode&1?(t=Nl,Nl<<=1,!(Nl&130023424)&&(Nl=4194304)):t=1);var n=Ee();e=Nt(e,t),e!==null&&(ul(e,t,n),Oe(e,n))}function Kh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),zd(e,n)}function Zh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(N(314))}r!==null&&r.delete(t),zd(e,n)}var Fd;Fd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Pe.current)Ne=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Ne=!1,Fh(e,t,n);Ne=!!(e.flags&131072)}else Ne=!1,b&&t.flags&1048576&&Rf(t,fi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yl(e,t),e=t.pendingProps;var l=tr(t,xe.current);Jn(t,n),l=hs(null,t,r,e,l,n);var i=ms();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Le(r)?(i=!0,ai(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,as(t),l.updater=Mi,t.stateNode=l,l._reactInternals=t,vu(t,r,e,n),t=wu(null,t,r,!0,i,n)):(t.tag=0,b&&i&&ns(t),ke(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Yl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Yh(r),e=Je(r,e),l){case 0:t=xu(null,t,r,e,n);break e;case 1:t=Xa(null,t,r,e,n);break e;case 11:t=Ga(null,t,r,e,n);break e;case 14:t=Ya(null,t,r,Je(r.type,e),n);break e}throw Error(N(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),xu(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Xa(e,t,r,l,n);case 3:e:{if(vd(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Bf(e,t),hi(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=ir(Error(N(423)),t),t=Ja(e,t,r,n,l);break e}else if(r!==l){l=ir(Error(N(424)),t),t=Ja(e,t,r,n,l);break e}else for(ze=Kt(t.stateNode.containerInfo.firstChild),Fe=t,b=!0,be=null,n=Qf(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(nr(),r===l){t=Pt(e,t,n);break e}ke(e,t,r,n)}t=t.child}return t;case 5:return Kf(t),e===null&&hu(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,au(r,l)?o=null:i!==null&&au(r,i)&&(t.flags|=32),gd(e,t),ke(e,t,o,n),t.child;case 6:return e===null&&hu(t),null;case 13:return yd(e,t,n);case 4:return cs(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=rr(t,null,r,n):ke(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Ga(e,t,r,l,n);case 7:return ke(e,t,t.pendingProps,n),t.child;case 8:return ke(e,t,t.pendingProps.children,n),t.child;case 12:return ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,Y(di,r._currentValue),r._currentValue=o,i!==null)if(nt(i.value,o)){if(i.children===l.children&&!Pe.current){t=Pt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=_t(-1,n&-n),a.tag=2;var f=i.updateQueue;if(f!==null){f=f.shared;var x=f.pending;x===null?a.next=a:(a.next=x.next,x.next=a),f.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),mu(i.return,n,t),s.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(N(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),mu(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ke(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Jn(t,n),l=Ke(l),r=r(l),t.flags|=1,ke(e,t,r,n),t.child;case 14:return r=t.type,l=Je(r,t.pendingProps),l=Je(r.type,l),Ya(e,t,r,l,n);case 15:return hd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Je(r,l),Yl(e,t),t.tag=1,Le(r)?(e=!0,ai(t)):e=!1,Jn(t,n),Vf(t,r,l),vu(t,r,l,n),wu(null,t,r,!0,e,n);case 19:return xd(e,t,n);case 22:return md(e,t,n)}throw Error(N(156,t.tag))};function Id(e,t){return uf(e,t)}function Gh(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function We(e,t,n,r){return new Gh(e,t,n,r)}function _s(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Yh(e){if(typeof e=="function")return _s(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wu)return 11;if(e===Qu)return 14}return 2}function Xt(e,t){var n=e.alternate;return n===null?(n=We(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ql(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")_s(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Dn:return gn(n.children,l,i,t);case Vu:o=8,l|=8;break;case Bo:return e=We(12,n,t,l|2),e.elementType=Bo,e.lanes=i,e;case Ho:return e=We(13,n,t,l),e.elementType=Ho,e.lanes=i,e;case Vo:return e=We(19,n,t,l),e.elementType=Vo,e.lanes=i,e;case Vc:return Di(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Bc:o=10;break e;case Hc:o=9;break e;case Wu:o=11;break e;case Qu:o=14;break e;case Dt:o=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=We(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function gn(e,t,n,r){return e=We(7,e,r,t),e.lanes=n,e}function Di(e,t,n,r){return e=We(22,e,r,t),e.elementType=Vc,e.lanes=n,e.stateNode={isHidden:!1},e}function Oo(e,t,n){return e=We(6,e,null,t),e.lanes=n,e}function Mo(e,t,n){return t=We(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xh(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=fo(0),this.expirationTimes=fo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Ts(e,t,n,r,l,i,o,s,a){return e=new Xh(e,t,n,s,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=We(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},as(i),e}function Jh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($d)}catch(e){console.error(e)}}$d(),Dc.exports=De;var Ud=Dc.exports;const nm=il(Ud);var ac=Ud;$o.createRoot=ac.createRoot,$o.hydrateRoot=ac.hydrateRoot;const ft=C.createContext({listTorrents:()=>{throw new Error("Function not implemented.")},getTorrentDetails:()=>{throw new Error("Function not implemented.")},getTorrentStats:()=>{throw new Error("Function not implemented.")},uploadTorrent:()=>{throw new Error("Function not implemented.")},updateOnlyFiles:()=>{throw new Error("Function not implemented.")},pause:()=>{throw new Error("Function not implemented.")},start:()=>{throw new Error("Function not implemented.")},forget:()=>{throw new Error("Function not implemented.")},delete:()=>{throw new Error("Function not implemented.")},getTorrentStreamUrl:()=>{throw new Error("Function not implemented.")}}),Ls=C.createContext({refresh:()=>{}}),Ei=({label:e,className:t})=>d.jsxs("div",{className:`flex gap-2 items-center ${t}`,children:[d.jsxs("svg",{"aria-hidden":"true",className:"w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[d.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),d.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),e?d.jsxs("span",{className:"text-sm",children:[e," ..."]}):d.jsx("span",{className:"sr-only",children:"Loading..."})]}),Os="initializing",rm="paused",lm="live",im="error";function Ms(e,t){let n,r=t;const l=async()=>{if(r=await e(),r==null)throw"asyncCallback returned null or undefined";i()};let i=()=>{n=setTimeout(l,r)};return i(),()=>{clearTimeout(n)}}function Bd(e,t){let n;const r=async()=>{await e().then(()=>!1,()=>!0)&&l()};let l=i=>{n=setTimeout(r,i!==void 0?i:t)};return l(0),()=>clearTimeout(n)}var Hd={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},cc=Ct.createContext&&Ct.createContext(Hd),Jt=globalThis&&globalThis.__assign||function(){return Jt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const{onClick:t,disabled:n,color:r,children:l,className:i,...o}=e,s=f=>{f.stopPropagation(),!n&&t()},a=r?`text-${r}`:"";return d.jsx("a",{className:`p-1 text-blue-500 flex items-center justify-center ${a} ${i}`,onClick:s,href:"#",...o,children:l})};function fm(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M0 .5A.5.5 0 0 1 .5 0h4a.5.5 0 0 1 0 1h-4A.5.5 0 0 1 0 .5Zm0 2A.5.5 0 0 1 .5 2h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm9 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-9 2A.5.5 0 0 1 .5 4h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm5 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5Zm-12 2A.5.5 0 0 1 .5 6h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5Zm8 0a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm-8 2A.5.5 0 0 1 .5 8h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5Zm7 0a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5Zm-7 2a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 0 1h-8a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 1-.5-.5Zm0 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5Z"}}]})(e)}function dm(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M6 .278a.768.768 0 0 1 .08.858 7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71 0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278zM4.858 1.311A7.269 7.269 0 0 0 1.025 7.71c0 4.02 3.279 7.276 7.319 7.276a7.316 7.316 0 0 0 5.205-2.162c-.337.042-.68.063-1.029.063-4.61 0-8.343-3.714-8.343-8.29 0-1.167.242-2.278.681-3.286z"}}]})(e)}function Wd(e){return ae({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"}}]})(e)}const pm=({title:e,children:t,onClose:n})=>d.jsxs("div",{className:"bg-red-200 p-3 rounded-md mb-3 dark:bg-red-800/60",children:[d.jsxs("div",{className:"flex justify-between mb-2",children:[d.jsx("h2",{className:"text-lg font-semibold",children:e}),n&&d.jsx("button",{onClick:n,children:d.jsx(Wd,{})})]}),t]}),En=e=>{var r,l,i;let{error:t,remove:n}=e;return t==null?null:d.jsxs(pm,{onClose:n,title:t.text,children:[((r=t.details)==null?void 0:r.statusText)&&d.jsx("div",{className:"pb-2 text-md",children:(l=t.details)==null?void 0:l.statusText}),d.jsx("div",{className:"whitespace-pre-wrap text-sm",children:(i=t.details)==null?void 0:i.text})]})};function zs(e){return e&&e.ownerDocument||document}function zo(e){e===void 0&&(e=zs());try{var t=e.activeElement;return!t||!t.nodeName?null:t}catch{return e.body}}function fc(e,t){if(e.contains)return e.contains(t);if(e.compareDocumentPosition)return e===t||!!(e.compareDocumentPosition(t)&16)}const Bi=!!(typeof window<"u"&&window.document&&window.document.createElement);var Mu=!1,zu=!1;try{var Fo={get passive(){return Mu=!0},get once(){return zu=Mu=!0}};Bi&&(window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,!0))}catch{}function hm(e,t,n,r){if(r&&typeof r!="boolean"&&!zu){var l=r.once,i=r.capture,o=n;!zu&&l&&(o=n.__once||function s(a){this.removeEventListener(t,s,i),n.call(this,a)},n.__once=o),e.addEventListener(t,o,Mu?r:i)}e.addEventListener(t,n,r)}function mm(e,t,n,r){var l=r&&typeof r!="boolean"?r.capture:r;e.removeEventListener(t,n,l),n.__once&&e.removeEventListener(t,n.__once,l)}function dc(e,t,n,r){return hm(e,t,n,r),function(){mm(e,t,n,r)}}function gm(){const e=C.useRef(!0),t=C.useRef(()=>e.current);return C.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),t.current}function vm(e){const t=C.useRef(e);return t.current=e,t}function ym(e){const t=vm(e);C.useEffect(()=>()=>t.current(),[])}function xm(e){const t=C.useRef(null);return C.useEffect(()=>{t.current=e}),t.current}function wm(e){const t=C.useRef(e);return C.useEffect(()=>{t.current=e},[e]),t}function cn(e){const t=wm(e);return C.useCallback(function(...n){return t.current&&t.current(...n)},[t])}function Sm(e){var t=zs(e);return t&&t.defaultView||window}function km(e,t){return Sm(e).getComputedStyle(e,t)}var Em=/([A-Z])/g;function Cm(e){return e.replace(Em,"-$1").toLowerCase()}var _m=/^ms-/;function Ul(e){return Cm(e).replace(_m,"-ms-")}var Tm=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function jm(e){return!!(e&&Tm.test(e))}function pc(e,t){var n="",r="";if(typeof t=="string")return e.style.getPropertyValue(Ul(t))||km(e).getPropertyValue(Ul(t));Object.keys(t).forEach(function(l){var i=t[l];!i&&i!==0?e.style.removeProperty(Ul(l)):jm(l)?r+=l+"("+i+") ":n+=Ul(l)+": "+i+";"}),r&&(n+="transform: "+r+";"),e.style.cssText+=";"+n}const Nm="data-rr-ui-";function Pm(e){return`${Nm}${e}`}function Lm(e=document){const t=e.defaultView;return Math.abs(t.innerWidth-e.documentElement.clientWidth)}const hc=Pm("modal-open");class Om{constructor({ownerDocument:t,handleContainerOverflow:n=!0,isRTL:r=!1}={}){this.handleContainerOverflow=n,this.isRTL=r,this.modals=[],this.ownerDocument=t}getScrollbarWidth(){return Lm(this.ownerDocument)}getElement(){return(this.ownerDocument||document).body}setModalAttributes(t){}removeModalAttributes(t){}setContainerStyle(t){const n={overflow:"hidden"},r=this.isRTL?"paddingLeft":"paddingRight",l=this.getElement();t.style={overflow:l.style.overflow,[r]:l.style[r]},t.scrollBarWidth&&(n[r]=`${parseInt(pc(l,r)||"0",10)+t.scrollBarWidth}px`),l.setAttribute(hc,""),pc(l,n)}reset(){[...this.modals].forEach(t=>this.remove(t))}removeContainerStyle(t){const n=this.getElement();n.removeAttribute(hc),Object.assign(n.style,t.style)}add(t){let n=this.modals.indexOf(t);return n!==-1||(n=this.modals.length,this.modals.push(t),this.setModalAttributes(t),n!==0)||(this.state={scrollBarWidth:this.getScrollbarWidth(),style:{}},this.handleContainerOverflow&&this.setContainerStyle(this.state)),n}remove(t){const n=this.modals.indexOf(t);n!==-1&&(this.modals.splice(n,1),!this.modals.length&&this.handleContainerOverflow&&this.removeContainerStyle(this.state),this.removeModalAttributes(t))}isTopModal(t){return!!this.modals.length&&this.modals[this.modals.length-1]===t}}const Qd=Om,Kd=C.createContext(Bi?window:void 0);Kd.Provider;function Fs(){return C.useContext(Kd)}const Io=(e,t)=>Bi?e==null?(t||zs()).body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),e&&("nodeType"in e||e.getBoundingClientRect)?e:null):null;function Mm(e,t){const n=Fs(),[r,l]=C.useState(()=>Io(e,n==null?void 0:n.document));if(!r){const i=Io(e);i&&l(i)}return C.useEffect(()=>{t&&r&&t(r)},[t,r]),C.useEffect(()=>{const i=Io(e);i!==r&&l(i)},[e,r]),r}const mc=e=>!e||typeof e=="function"?e:t=>{e.current=t};function zm(e,t){const n=mc(e),r=mc(t);return l=>{n&&n(l),r&&r(l)}}function Is(e,t){return C.useMemo(()=>zm(e,t),[e,t])}const Fm=typeof global<"u"&&global.navigator&&global.navigator.product==="ReactNative",Im=typeof document<"u",gc=Im||Fm?C.useLayoutEffect:C.useEffect;function Dm({children:e,in:t,onExited:n,mountOnEnter:r,unmountOnExit:l}){const i=C.useRef(null),o=C.useRef(t),s=cn(n);C.useEffect(()=>{t?o.current=!0:s(i.current)},[t,s]);const a=Is(i,e.ref),f=C.cloneElement(e,{ref:a});return t?f:l||!o.current&&r?null:f}const Rm=["onEnter","onEntering","onEntered","onExit","onExiting","onExited","addEndListener","children"];function Am(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}function $m(e){let{onEnter:t,onEntering:n,onEntered:r,onExit:l,onExiting:i,onExited:o,addEndListener:s,children:a}=e,f=Am(e,Rm);const x=C.useRef(null),y=Is(x,typeof a=="function"?null:a.ref),v=k=>_=>{k&&x.current&&k(x.current,_)},w=C.useCallback(v(t),[t]),S=C.useCallback(v(n),[n]),T=C.useCallback(v(r),[r]),I=C.useCallback(v(l),[l]),m=C.useCallback(v(i),[i]),p=C.useCallback(v(o),[o]),h=C.useCallback(v(s),[s]);return Object.assign({},f,{nodeRef:x},t&&{onEnter:w},n&&{onEntering:S},r&&{onEntered:T},l&&{onExit:I},i&&{onExiting:m},o&&{onExited:p},s&&{addEndListener:h},{children:typeof a=="function"?(k,_)=>a(k,Object.assign({},_,{ref:y})):C.cloneElement(a,{ref:y})})}const Um=["component"];function Bm(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}const Hm=C.forwardRef((e,t)=>{let{component:n}=e,r=Bm(e,Um);const l=$m(r);return d.jsx(n,Object.assign({ref:t},l))}),Vm=Hm;function Wm({in:e,onTransition:t}){const n=C.useRef(null),r=C.useRef(!0),l=cn(t);return gc(()=>{if(!n.current)return;let i=!1;return l({in:e,element:n.current,initial:r.current,isStale:()=>i}),()=>{i=!0}},[e,l]),gc(()=>(r.current=!1,()=>{r.current=!0}),[]),n}function Qm({children:e,in:t,onExited:n,onEntered:r,transition:l}){const[i,o]=C.useState(!t);t&&i&&o(!1);const s=Wm({in:!!t,onTransition:f=>{const x=()=>{f.isStale()||(f.in?r==null||r(f.element,f.initial):(o(!0),n==null||n(f.element)))};Promise.resolve(l(f)).then(x,y=>{throw f.in||o(!0),y})}}),a=Is(s,e.ref);return i&&!t?null:C.cloneElement(e,{ref:a})}function vc(e,t,n){return e?d.jsx(Vm,Object.assign({},n,{component:e})):t?d.jsx(Qm,Object.assign({},n,{transition:t})):d.jsx(Dm,Object.assign({},n))}function Km(e){return e.code==="Escape"||e.keyCode===27}const Zm=["show","role","className","style","children","backdrop","keyboard","onBackdropClick","onEscapeKeyDown","transition","runTransition","backdropTransition","runBackdropTransition","autoFocus","enforceFocus","restoreFocus","restoreFocusOptions","renderDialog","renderBackdrop","manager","container","onShow","onHide","onExit","onExited","onExiting","onEnter","onEntering","onEntered"];function Gm(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,i;for(i=0;i=0)&&(n[l]=e[l]);return n}let Do;function Ym(e){return Do||(Do=new Qd({ownerDocument:e==null?void 0:e.document})),Do}function Xm(e){const t=Fs(),n=e||Ym(t),r=C.useRef({dialog:null,backdrop:null});return Object.assign(r.current,{add:()=>n.add(r.current),remove:()=>n.remove(r.current),isTopModal:()=>n.isTopModal(r.current),setDialogRef:C.useCallback(l=>{r.current.dialog=l},[]),setBackdropRef:C.useCallback(l=>{r.current.backdrop=l},[])})}const Zd=C.forwardRef((e,t)=>{let{show:n=!1,role:r="dialog",className:l,style:i,children:o,backdrop:s=!0,keyboard:a=!0,onBackdropClick:f,onEscapeKeyDown:x,transition:y,runTransition:v,backdropTransition:w,runBackdropTransition:S,autoFocus:T=!0,enforceFocus:I=!0,restoreFocus:m=!0,restoreFocusOptions:p,renderDialog:h,renderBackdrop:k=q=>d.jsx("div",Object.assign({},q)),manager:_,container:j,onShow:O,onHide:z=()=>{},onExit:W,onExited:A,onExiting:we,onEnter:dt,onEntering:pt,onEntered:Tn}=e,fr=Gm(e,Zm);const Ae=Fs(),rt=Mm(j),P=Xm(_),R=gm(),$=xm(n),[K,ee]=C.useState(!n),Ge=C.useRef(null);C.useImperativeHandle(t,()=>P,[P]),Bi&&!$&&n&&(Ge.current=zo(Ae==null?void 0:Ae.document)),n&&K&&ee(!1);const $e=cn(()=>{if(P.add(),dr.current=dc(document,"keydown",Z),jn.current=dc(document,"focus",()=>setTimeout(Ye),!0),O&&O(),T){var q,hr;const Ln=zo((q=(hr=P.dialog)==null?void 0:hr.ownerDocument)!=null?q:Ae==null?void 0:Ae.document);P.dialog&&Ln&&!fc(P.dialog,Ln)&&(Ge.current=Ln,P.dialog.focus())}}),ht=cn(()=>{if(P.remove(),dr.current==null||dr.current(),jn.current==null||jn.current(),m){var q;(q=Ge.current)==null||q.focus==null||q.focus(p),Ge.current=null}});C.useEffect(()=>{!n||!rt||$e()},[n,rt,$e]),C.useEffect(()=>{K&&ht()},[K,ht]),ym(()=>{ht()});const Ye=cn(()=>{if(!I||!R()||!P.isTopModal())return;const q=zo(Ae==null?void 0:Ae.document);P.dialog&&q&&!fc(P.dialog,q)&&P.dialog.focus()}),Ot=cn(q=>{q.target===q.currentTarget&&(f==null||f(q),s===!0&&z())}),Z=cn(q=>{a&&Km(q)&&P.isTopModal()&&(x==null||x(q),q.defaultPrevented||z())}),jn=C.useRef(),dr=C.useRef(),lt=(...q)=>{ee(!0),A==null||A(...q)};if(!rt)return null;const pr=Object.assign({role:r,ref:P.setDialogRef,"aria-modal":r==="dialog"?!0:void 0},fr,{style:i,className:l,tabIndex:-1});let Nn=h?h(pr):d.jsx("div",Object.assign({},pr,{children:C.cloneElement(o,{role:"document"})}));Nn=vc(y,v,{unmountOnExit:!0,mountOnEnter:!0,appear:!0,in:!!n,onExit:W,onExiting:we,onExited:lt,onEnter:dt,onEntering:pt,onEntered:Tn,children:Nn});let Pn=null;return s&&(Pn=k({ref:P.setBackdropRef,onClick:Ot}),Pn=vc(w,S,{in:!!n,appear:!0,mountOnEnter:!0,unmountOnExit:!0,children:Pn})),d.jsx(d.Fragment,{children:nm.createPortal(d.jsxs(d.Fragment,{children:[Pn,Nn]}),rt)})});Zd.displayName="Modal";const Jm=Object.assign(Zd,{Manager:Qd}),qm=({onClose:e,title:t})=>d.jsxs("div",{className:"flex p-3 justify-between items-center border-b dark:border-slate-600",children:[d.jsx("h2",{className:"text-xl font-semibold dark:slate-300",children:t}),e&&d.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:e,"aria-label":"Close modal",children:d.jsx(Wd,{className:"w-5 h-5"})})]}),Hi=({isOpen:e,onClose:t,title:n,children:r,className:l})=>{const i=()=>d.jsx("div",{className:"fixed inset-0 bg-black/30 z-[300] dark:bg-black/60 backdrop-blur"});return d.jsx(Jm,{show:e,onHide:t,renderBackdrop:i,className:"fixed z-[301] top-0 left-0 w-full h-full block overflow-x-hidden overflow-y-auto",children:d.jsxs("div",{className:`bg-white shadow-lg my-8 mx-auto max-w-2xl rounded ${l} dark:bg-slate-800 dark:text-gray-50`,children:[d.jsx(qm,{onClose:t,title:n}),r]})})},Vi=({children:e})=>d.jsx("div",{className:"p-3 border-b dark:border-slate-500",children:e}),Wi=({children:e,className:t})=>d.jsx("div",{className:`p-3 flex justify-end gap-2 ${t}`,children:e}),en=({onClick:e,children:t,className:n,disabled:r,variant:l})=>{let i={secondary:"hover:bg-blue-500 transition-colors hover:text-white dark:hover:bg-blue-900/50",danger:"bg-red-400 text-white border-green-50 hover:border-red-700 hover:bg-red-600 dark:bg-red-800 dark:border-none dark:hover:bg-red-900",primary:"bg-blue-600 text-white hover:bg-blue-800 disabled:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-300 dark:border-none",cancel:"hover:bg-slate-200 dark:bg-slate-600 dark:hover:bg-slate-700 dark:border-none",none:""}[l??"secondary"];return d.jsx("button",{disabled:r,onClick:o=>{o.preventDefault(),e()},className:`inline-flex items-center gap-1 border rounded-lg disabled:cursor-not-allowed px-2 py-1 dark:border-slate-700 ${i} ${n}`,children:t})},yc=e=>{let t;const n=new Set,r=(x,y)=>{const v=typeof x=="function"?x(t):x;if(!Object.is(v,t)){const w=t;t=y??(typeof v!="object"||v===null)?v:Object.assign({},t,v),n.forEach(S=>S(t,w))}},l=()=>t,a={setState:r,getState:l,getInitialState:()=>f,subscribe:x=>(n.add(x),()=>n.delete(x)),destroy:()=>{n.clear()}},f=t=e(r,l,a);return a},bm=e=>e?yc(e):yc;var Gd={exports:{}},Yd={},Xd={exports:{}},Jd={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -45,7 +45,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ur=C;function eg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tg=typeof Object.is=="function"?Object.is:eg,ng=ur.useState,rg=ur.useEffect,lg=ur.useLayoutEffect,ig=ur.useDebugValue;function og(e,t){var n=t(),r=ng({inst:{value:n,getSnapshot:t}}),l=r[0].inst,i=r[1];return lg(function(){l.value=n,l.getSnapshot=t,Ro(l)&&i({inst:l})},[e,n,t]),rg(function(){return Ro(l)&&i({inst:l}),e(function(){Ro(l)&&i({inst:l})})},[e]),ig(n),n}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tg(e,n)}catch{return!0}}function ug(e,t){return t()}var sg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ug:og;Xd.useSyncExternalStore=ur.useSyncExternalStore!==void 0?ur.useSyncExternalStore:sg;Yd.exports=Xd;var ag=Yd.exports;/** + */var ur=C;function eg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tg=typeof Object.is=="function"?Object.is:eg,ng=ur.useState,rg=ur.useEffect,lg=ur.useLayoutEffect,ig=ur.useDebugValue;function og(e,t){var n=t(),r=ng({inst:{value:n,getSnapshot:t}}),l=r[0].inst,i=r[1];return lg(function(){l.value=n,l.getSnapshot=t,Ro(l)&&i({inst:l})},[e,n,t]),rg(function(){return Ro(l)&&i({inst:l}),e(function(){Ro(l)&&i({inst:l})})},[e]),ig(n),n}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tg(e,n)}catch{return!0}}function ug(e,t){return t()}var sg=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ug:og;Jd.useSyncExternalStore=ur.useSyncExternalStore!==void 0?ur.useSyncExternalStore:sg;Xd.exports=Jd;var ag=Xd.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * @@ -53,4 +53,4 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Qi=C,cg=ag;function fg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dg=typeof Object.is=="function"?Object.is:fg,pg=cg.useSyncExternalStore,hg=Qi.useRef,mg=Qi.useEffect,gg=Qi.useMemo,vg=Qi.useDebugValue;Gd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var i=hg(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=gg(function(){function a(w){if(!f){if(f=!0,y=w,w=r(w),l!==void 0&&o.hasValue){var S=o.value;if(l(S,w))return x=S}return x=w}if(S=x,dg(y,w))return S;var k=r(w);return l!==void 0&&l(S,k)?S:(y=w,x=k)}var f=!1,y,x,v=n===void 0?null:n;return[function(){return a(t())},v===null?void 0:function(){return a(v())}]},[t,n,r,l]);var s=pg(e,i[0],i[1]);return mg(function(){o.hasValue=!0,o.value=s},[s]),vg(s),s};Zd.exports=Gd;var yg=Zd.exports;const xg=il(yg),{useDebugValue:wg}=Et,{useSyncExternalStoreWithSelector:Sg}=xg;const kg=e=>e;function Eg(e,t=kg,n){const r=Sg(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wg(r),r}const yc=e=>{const t=typeof e=="function"?bm(e):e,n=(r,l)=>Eg(t,r,l);return Object.assign(n,t),n},Jd=e=>e?yc(e):yc,Cg=(e,t)=>e.id==t.id&&e.info_hash==t.info_hash,_g=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.length===t.length&&e.every((n,r)=>Cg(n,t[r])),vn=Jd(e=>({torrents:null,torrentsLoading:!1,torrentsInitiallyLoading:!1,setTorrentsLoading:t=>e(n=>n.torrents==null?{torrentsInitiallyLoading:t,torrentsLoading:t}:{torrentsInitiallyLoading:!1,torrentsLoading:t}),setTorrents:t=>e(n=>_g(n.torrents,t)?{}:{torrents:t}),refreshTorrents:()=>{},setRefreshTorrents:t=>e({refreshTorrents:t})})),Tg=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=C.useState(!1),[i,o]=C.useState(null),[s,a]=C.useState(!1),f=C.useContext(Lt),y=vn(w=>w.refreshTorrents),x=()=>{l(!1),o(null),a(!1),n()},v=()=>{a(!0),(r?f.delete:f.forget)(e).then(()=>{y(),x()}).catch(S=>{o({text:`Error deleting torrent id=${e}`,details:S}),a(!1)})};return d.jsxs(Hi,{isOpen:t,onClose:n,title:"Delete torrent",children:[d.jsxs(Vi,{children:[d.jsx("p",{className:"text-gray-700 dark:text-slate-300",children:"Are you sure you want to delete the torrent?"}),d.jsxs("div",{className:"mt-4 flex items-center",children:[d.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),d.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700 dark:text-slate-300",children:"Also delete files"})]}),i&&d.jsx(En,{error:i})]}),d.jsxs(Wi,{children:[s&&d.jsx(Ei,{}),d.jsx(en,{variant:"cancel",onClick:x,children:"Cancel"}),d.jsx(en,{variant:"danger",onClick:v,disabled:s,children:"Delete Torrent"})]})]})};function jg(e){return ae({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"}}]})(e)}function Ng(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function Pg(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function Lg(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const bn=Jd(e=>({closeableError:null,setCloseableError:t=>e(()=>({closeableError:t})),otherError:null,setOtherError:t=>e(()=>({otherError:t}))})),Og=({id:e,statsResponse:t,extendedView:n,setExtendedView:r})=>{let l=t.state,[i,o]=C.useState(!1),[s,a]=C.useState(!1),f=C.useContext(Ps);const y=l=="live",x=l=="paused"||l=="error",v=l=="paused"||l=="live",w=bn(m=>m.setCloseableError),S=C.useContext(Lt),k=()=>{o(!0),S.start(e).then(()=>{f.refresh()},m=>{w({text:`Error starting torrent id=${e}`,details:m})}).finally(()=>o(!1))},z=()=>{o(!0),S.pause(e).then(()=>{f.refresh()},m=>{w({text:`Error pausing torrent id=${e}`,details:m})}).finally(()=>o(!1))},h=()=>{o(!0),a(!0)},p=()=>{o(!1),a(!1)};return d.jsxs("div",{className:"flex w-full justify-center gap-2 dark:text-slate-300",children:[x&&d.jsx(hn,{onClick:k,disabled:i,children:d.jsx(Pg,{className:"hover:text-green-600"})}),y&&d.jsx(hn,{onClick:z,disabled:i,children:d.jsx(Ng,{className:"hover:text-amber-500"})}),v&&d.jsx(hn,{onClick:()=>r(!n),disabled:i,children:d.jsx(jg,{className:"hover:text-green-600"})}),d.jsx(hn,{onClick:h,disabled:i,children:d.jsx(Lg,{className:"hover:text-red-500"})}),d.jsx(Tg,{id:e,show:s,onHide:p})]})},xc={warn:"bg-amber-500 text-white",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"},qd=({now:e,variant:t,label:n,classNames:r})=>{const l=n??`${e.toFixed(2)}%`,i=xc[t??"info"]??xc.info;return d.jsx("div",{className:`w-full bg-gray-200 rounded-full mb-1 dark:bg-gray-500 ${r}`,children:d.jsx("div",{className:`text-xs font-medium transition-all text-center leading-none py-0.5 px-2 rounded-full ${i} ${e<1&&"bg-transparent"}`,style:{width:`${e}%`},children:l})})};function ll(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const Mg=({statsResponse:e})=>{var t,n;switch(e.state){case rm:return"Paused";case Ls:return"Checking files";case im:return"Error"}return e.state!="live"||e.live===null?e.state:d.jsxs(d.Fragment,{children:[!e.finished&&d.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),d.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&d.jsxs("span",{children:["(",ll(e.live.snapshot.uploaded_bytes),")"]})]})]})};function zg(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function Fg(e){return e.name??zg(e)}function Ig(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(i,o)=>i>0?`${i}${o}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function Dg(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":Ig(t)}function Rg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function Ag(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function $g(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function Ug(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function Bg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const Hg=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?d.jsx(Ag,{className:e,color:"red"}):l?d.jsx(Ug,{className:e,color:"green"}):t?d.jsx(Rg,{className:e,color:"green"}):n?d.jsx($g,{className:`text-blue-500 ${e}`}):d.jsx(Bg,{className:e})},wc=({checked:e,name:t,disabled:n,onChange:r,label:l,help:i,inputType:o,children:s})=>d.jsxs("div",{className:"flex gap-3 items-start",children:[d.jsx("div",{className:"flex",children:d.jsx("input",{type:o||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),d.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[d.jsx("label",{htmlFor:t,children:l}),i&&d.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300 mb-3",children:i})]}),s]});function Vg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.564a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.564,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M9,12.5a.5.5,0,0,1,0-1h6a.5.5,0,0,1,0,1Z"}}]}]}]})(e)}function Wg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.563a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.563,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"}}]}]}]})(e)}var Ci={exports:{}};Ci.exports;(function(e,t){var n=200,r="Expected a function",l="__lodash_hash_undefined__",i=1,o=2,s=1/0,a=9007199254740991,f="[object Arguments]",y="[object Array]",x="[object Boolean]",v="[object Date]",w="[object Error]",S="[object Function]",k="[object GeneratorFunction]",z="[object Map]",h="[object Number]",p="[object Object]",m="[object Promise]",_="[object RegExp]",T="[object Set]",j="[object String]",O="[object Symbol]",F="[object WeakMap]",W="[object ArrayBuffer]",A="[object DataView]",we="[object Float32Array]",ft="[object Float64Array]",dt="[object Int8Array]",Tn="[object Int16Array]",fr="[object Int32Array]",Ae="[object Uint8Array]",rt="[object Uint8ClampedArray]",P="[object Uint16Array]",R="[object Uint32Array]",$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,ee=/^\./,Ge=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$e=/[\\^$.*+?()[\]{}|]/g,pt=/\\(\\)?/g,Ye=/^\[object .+?Constructor\]$/,Ot=/^(?:0|[1-9]\d*)$/,Z={};Z[we]=Z[ft]=Z[dt]=Z[Tn]=Z[fr]=Z[Ae]=Z[rt]=Z[P]=Z[R]=!0,Z[f]=Z[y]=Z[W]=Z[x]=Z[A]=Z[v]=Z[w]=Z[S]=Z[z]=Z[h]=Z[p]=Z[_]=Z[T]=Z[j]=Z[F]=!1;var jn=typeof Ut=="object"&&Ut&&Ut.Object===Object&&Ut,dr=typeof self=="object"&&self&&self.Object===Object&&self,lt=jn||dr||Function("return this")(),pr=t&&!t.nodeType&&t,Nn=pr&&!0&&e&&!e.nodeType&&e,Pn=Nn&&Nn.exports===pr,q=Pn&&jn.process,hr=function(){try{return q&&q.binding("util")}catch{}}(),Ln=hr&&hr.isTypedArray;function l0(u,c,g){switch(g.length){case 0:return u.call(c);case 1:return u.call(c,g[0]);case 2:return u.call(c,g[0],g[1]);case 3:return u.call(c,g[0],g[1],g[2])}return u.apply(c,g)}function Ds(u,c){for(var g=-1,E=u?u.length:0,M=Array(E);++g-1}function F0(u,c){var g=this.__data__,E=ml(g,u);return E<0?g.push([u,c]):g[E][1]=c,this}mt.prototype.clear=L0,mt.prototype.delete=O0,mt.prototype.get=M0,mt.prototype.has=z0,mt.prototype.set=F0;function gt(u){var c=-1,g=u?u.length:0;for(this.clear();++c0&&g(U)?c>1?Ws(U,c-1,g,E,M):i0(M,U):E||(M[M.length]=U)}return M}var Y0=m1();function X0(u,c){return u&&Y0(u,c,wl)}function Qs(u,c){c=vl(c,u)?[c]:Ks(c);for(var g=0,E=c.length;u!=null&&gc||L&&D&&H&&!U&&!G||E&&D&&H||!g&&H||!M)return 1;if(!E&&!L&&!G&&u=U)return H;var G=g[E];return H*(G=="desc"?-1:1)}}return u.index-c.index}function h1(u,c){return function(g,E){if(g==null)return g;if(!vr(g))return u(g,E);for(var M=g.length,L=c?M:-1,D=Object(g);(c?L--:++LU))return!1;var G=L.get(u);if(G&&L.get(c))return G==c;var Se=-1,Te=!0,ce=M&i?new hl:void 0;for(L.set(u,c),L.set(c,u);++Se-1&&u%1==0&&u1&&Gs(u,c[0],c[1])?c=[]:g>2&&Gs(c[0],c[1],c[2])&&(c=[c[0]]),s1(u,Ws(c,1),[])});function no(u,c){if(typeof u!="function"||c&&typeof c!="function")throw new TypeError(r);var g=function(){var E=arguments,M=c?c.apply(this,E):E[0],L=g.cache;if(L.has(M))return L.get(M);var D=u.apply(this,E);return g.cache=L.set(M,D),D};return g.cache=new(no.Cache||gt),g}no.Cache=gt;function ro(u,c){return u===c||u!==u&&c!==c}function lo(u){return T1(u)&&ht.call(u,"callee")&&(!v0.call(u,"callee")||On.call(u)==f)}var zt=Array.isArray;function vr(u){return u!=null&&io(u.length)&&!Js(u)}function T1(u){return xl(u)&&vr(u)}function Js(u){var c=yr(u)?On.call(u):"";return c==S||c==k}function io(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=a}function yr(u){var c=typeof u;return!!u&&(c=="object"||c=="function")}function xl(u){return!!u&&typeof u=="object"}function xr(u){return typeof u=="symbol"||xl(u)&&On.call(u)==O}var j1=Ln?Rs(Ln):n1;function N1(u){return u==null?"":f1(u)}function P1(u,c,g){var E=u==null?void 0:Qs(u,c);return E===void 0?g:E}function L1(u,c){return u!=null&&x1(u,c,q0)}function wl(u){return vr(u)?Z0(u):l1(u)}function qs(u){return u}function O1(u){return vl(u)?u0(yl(u)):a1(u)}e.exports=_1})(Ci,Ci.exports);var Qg=Ci.exports;const Sc=il(Qg),Kg=(e,t)=>{const n=(r,l,i,o)=>{let s=[],a=[],f={};const y=w=>(f[w]=f[w]||[],f[w]);i.forEach(w=>{if(o==w.pathComponents.length-1){s.push(w);return}y(w.pathComponents[o]).push(w)}),s=Sc(s,w=>w.filename);let x=Sc(Object.entries(f),([w,S])=>w),v=0;for(const[w,S]of x)a.push(n(w,l+"."+v,S,o+1)),v+=1;return{name:r,id:l,dirs:a,files:s}};return n("","filetree-root",e.files.map((r,l)=>({id:l,filename:r.components[r.components.length-1],pathComponents:r.components,length:r.length,have_bytes:t?t.file_progress[l]??0:0})),0)},bd=({tree:e,selectedFiles:t,setSelectedFiles:n,initialExpanded:r,torrentDetails:l,torrentStats:i,showProgressBar:o,disabled:s})=>{let[a,f]=C.useState(r),y=C.useMemo(()=>{let k=z=>{let h=z.dirs.flatMap(k);return h.push(...z.files.map(p=>p.id)),h};return k(e)},[e]);const x=k=>{if(k.target.checked){let z=new Set(t);y.forEach(h=>z.add(h)),n(z)}else{let z=new Set(t);y.forEach(h=>z.delete(h)),n(z)}},v=k=>{if(t.has(k)){let z=new Set(t);z.delete(k),n(z)}else{let z=new Set(t);z.add(k),n(z)}},w=()=>y.filter(k=>t.has(k)).length,S=()=>y.filter(k=>t.has(k)).map(k=>l.files[k].length).reduce((k,z)=>k+z,0);return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(hn,{onClick:()=>f(!a),children:a?d.jsx(Vg,{}):d.jsx(Wg,{})}),d.jsx(wc,{checked:y.every(k=>t.has(k)),label:`${e.name?e.name+", ":""} ${w()} files, ${ll(S())}`,name:e.id,onChange:x})]}),d.jsxs("div",{className:"pl-5",hidden:!a,children:[e.dirs.map(k=>d.jsx(bd,{torrentDetails:l,torrentStats:i,tree:k,selectedFiles:t,setSelectedFiles:n,initialExpanded:!1,showProgressBar:o,disabled:s},k.name)),d.jsx("div",{className:"pl-1",children:e.files.map(k=>d.jsxs("div",{className:`${o?"grid grid-cols-1 gap-1 items-start lg:grid-cols-2 mb-2 lg:mb-0":""}`,children:[d.jsx(wc,{checked:t.has(k.id),label:`${k.filename} (${ll(k.length)})`,name:`file-${k.id}`,disabled:s,onChange:()=>v(k.id)}),o&&d.jsx(qd,{now:k.have_bytes/k.length*100,variant:k.have_bytes==k.length?"success":"info"})]},k.id))})]})]})},e0=({torrentDetails:e,selectedFiles:t,setSelectedFiles:n,torrentStats:r,showProgressBar:l,disabled:i})=>{let o=C.useMemo(()=>Kg(e,r),[e,r]);return d.jsx(bd,{torrentDetails:e,torrentStats:r,tree:o,selectedFiles:t,setSelectedFiles:n,initialExpanded:!0,showProgressBar:l,disabled:i})},Zg=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,i=(n==null?void 0:n.total_bytes)??1,o=(n==null?void 0:n.progress_bytes)??0,s=(n==null?void 0:n.finished)||!1,a=l||i==0?100:o/i*100,f=()=>{var j;let T=(j=n==null?void 0:n.live)==null?void 0:j.snapshot.peer_stats;return T?`${T.live} / ${T.seen}`:""},y=T=>d.jsx(Hg,{className:T,error:!!l,live:!!(n!=null&&n.live),finished:s}),[x,v]=C.useState(new Set);C.useEffect(()=>{v(new Set((t==null?void 0:t.files.map((T,j)=>({f:T,id:j})).filter(({f:T})=>T.included).map(({id:T})=>T))??[]))},[t]);const w=C.useContext(Lt),S=C.useContext(Ps),[k,z]=C.useState(!1);let h=bn(T=>T.setCloseableError);const p=T=>{z(!0),w.updateOnlyFiles(e,Array.from(T)).then(()=>{S.refresh(),h(null)},j=>{h({text:"Error configuring torrent",details:j})}).finally(()=>z(!1))},[m,_]=C.useState(!1);return d.jsxs("div",{className:"flex flex-col border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm dark:bg-slate-800 dark:border-slate-900",children:[d.jsxs("section",{className:"flex flex-col lg:flex-row items-center gap-2",children:[d.jsx("div",{className:"hidden md:block",children:y("w-10 h-10")}),d.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"md:hidden",children:y("w-5 h-5")}),d.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all dark:text-slate-200",children:Fg(t)})]}),l?d.jsxs("p",{className:"text-red-500 text-sm",children:[d.jsx("strong",{children:"Error:"})," ",l]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{children:d.jsx(qd,{now:a,label:l,variant:r==Ls?"warn":s?"success":"info"})}),d.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(cm,{})," ",f().toString()]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(am,{}),d.jsxs("div",{children:[ll(o),"/",ll(i)]})]}),n&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(sm,{}),Dg(n)]}),d.jsx("div",{className:"flex gap-2 items-center",children:d.jsx(Mg,{statsResponse:n})})]})]})]})]}),n&&d.jsx("div",{className:"",children:d.jsx(Og,{id:e,statsResponse:n,extendedView:m,setExtendedView:_})})]}),t&&m&&d.jsx("div",{className:"",children:d.jsx(e0,{torrentDetails:t,torrentStats:n,selectedFiles:x,setSelectedFiles:p,disabled:k,showProgressBar:!0})})]})},Gg=({id:e,torrent:t})=>{const[n,r]=C.useState(null),[l,i]=C.useState(null),[o,s]=C.useState(0),a=C.useContext(Lt),f=()=>{s(o+1)};return C.useEffect(()=>Ud(async()=>{await a.getTorrentDetails(t.id).then(r)},1e3),[o]),C.useEffect(()=>Os(async()=>a.getTorrentStats(t.id).then(w=>(i(w),w)).then(w=>w.state==Ls||w.state==lm?1e3:1e4,()=>1e4),0),[o]),d.jsx(Ps.Provider,{value:{refresh:f},children:d.jsx(Zg,{id:e,detailsResponse:n,statsResponse:l})})},Yg=e=>d.jsx("div",{className:"flex flex-col gap-2 mx-2 pb-3 sm:px-7",children:e.torrents===null?e.loading?d.jsx(Ei,{className:"justify-center m-5",label:"Loading torrent list"}):null:e.torrents.length===0?d.jsx("p",{className:"text-center",children:"No existing torrents found."}):e.torrents.map(t=>d.jsx(Gg,{id:t.id,torrent:t},t.id))}),Xg=e=>{let t=bn(o=>o.closeableError),n=bn(o=>o.setCloseableError),r=bn(o=>o.otherError),l=vn(o=>o.torrents),i=vn(o=>o.torrentsInitiallyLoading);return d.jsxs("div",{className:"container mx-auto",children:[d.jsx(En,{error:t,remove:()=>n(null)}),d.jsx(En,{error:r}),d.jsx(Yg,{torrents:l,loading:i})]})};var Jg="Expected a function",kc=0/0,qg="[object Symbol]",bg=/^\s+|\s+$/g,ev=/^[-+]0x[0-9a-f]+$/i,tv=/^0b[01]+$/i,nv=/^0o[0-7]+$/i,rv=parseInt,lv=typeof Ut=="object"&&Ut&&Ut.Object===Object&&Ut,iv=typeof self=="object"&&self&&self.Object===Object&&self,ov=lv||iv||Function("return this")(),uv=Object.prototype,sv=uv.toString,av=Math.max,cv=Math.min,Ao=function(){return ov.Date.now()};function fv(e,t,n){var r,l,i,o,s,a,f=0,y=!1,x=!1,v=!0;if(typeof e!="function")throw new TypeError(Jg);t=Ec(t)||0,Fu(n)&&(y=!!n.leading,x="maxWait"in n,i=x?av(Ec(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v);function w(j){var O=r,F=l;return r=l=void 0,f=j,o=e.apply(F,O),o}function S(j){return f=j,s=setTimeout(h,t),y?w(j):o}function k(j){var O=j-a,F=j-f,W=t-O;return x?cv(W,i-F):W}function z(j){var O=j-a,F=j-f;return a===void 0||O>=t||O<0||x&&F>=i}function h(){var j=Ao();if(z(j))return p(j);s=setTimeout(h,k(j))}function p(j){return s=void 0,v&&r?w(j):(r=l=void 0,o)}function m(){s!==void 0&&clearTimeout(s),f=0,r=a=l=s=void 0}function _(){return s===void 0?o:p(Ao())}function T(){var j=Ao(),O=z(j);if(r=arguments,l=this,a=j,O){if(s===void 0)return S(a);if(x)return s=setTimeout(h,t),w(a)}return s===void 0&&(s=setTimeout(h,t)),o}return T.cancel=m,T.flush=_,T}function Fu(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function dv(e){return!!e&&typeof e=="object"}function pv(e){return typeof e=="symbol"||dv(e)&&sv.call(e)==qg}function Ec(e){if(typeof e=="number")return e;if(pv(e))return kc;if(Fu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Fu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(bg,"");var n=tv.test(e);return n||nv.test(e)?rv(e.slice(2),n?2:8):ev.test(e)?kc:+e}var hv=fv;const mv=il(hv),gv=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:d.jsxs(d.Fragment,{children:["{",t.map(([n,r])=>d.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>d.jsxs(d.Fragment,{children:[n,", ",r]})),"}"]})},vv=({span:e})=>d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-bold",children:e.name}),d.jsx(gv,{span:e}),d.jsx("span",{className:"font-bold",children:":"})]}),yv=({fields:e})=>d.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500 dark:text-slate-200"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>d.jsxs("span",{className:"m-1",children:[d.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),xv=Et.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return d.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[d.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.timestamp}),d.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),d.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,i)=>d.jsx(vv,{span:l},i))}),d.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.target}),d.jsx(yv,{fields:t.fields})]})}),t0=({children:e})=>d.jsx("form",{children:e}),Is=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,onKeyDown:i,label:o,help:s,inputType:a,placeholder:f})=>d.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-2",children:[d.jsx("label",{htmlFor:n,className:"dark:text-white",children:o}),d.jsx("input",{autoFocus:e,type:a,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6 dark:text-slate-300",id:n,name:n,disabled:r,placeholder:f,value:t,onKeyDown:i,onChange:l}),s&&d.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300",children:s})]}),wv=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},Sv=(e,t,n)=>{const r=new AbortController,l=r.signal;let i=!1;const o=()=>{console.log("cancelling fetch"),i=!0,r.abort()},s=async()=>{let f=await fetch(e,{signal:l});if(!f.ok){let v=await f.text();throw n({text:"error fetching logs",details:{statusText:f.statusText,text:v}}),null}if(!f.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const y=f.body.getReader();let x=new Uint8Array;for(;;){const{done:v,value:w}=await y.read();if(v)throw n({text:"log stream terminated"}),null;x=wv(x,w);for(let S;(S=x.indexOf(10))!==-1;){let k=x.slice(0,S),z=new TextDecoder().decode(k);t(z),x=x.slice(S+1)}}};let a=Ud(()=>s().then(()=>{},f=>{if(!i&&f!==null)throw n({text:"error streaming logs",details:{text:f.toString()}}),f}),1e3);return()=>{o(),a()}},kv=({url:e,maxLines:t})=>{const[n,r]=C.useState([]),[l,i]=C.useState(null),[o,s]=C.useState(""),a=C.useRef(null),f=t??1e3,y=C.useCallback(S=>{r(k=>[{id:k.length==0?0:k[0].id+1,content:S,parsed:JSON.parse(S),show:a.current?!!S.match(a.current):!0},...k.slice(0,f-1)])},[a.current,t]),x=C.useRef(y);x.current=y;const v=mv(S=>{let k=null;try{k=new RegExp(S)}catch{return}a.current=k,r(z=>{let h=[...z];for(let p of h)p.show=!!p.content.match(k);return h})},200),w=S=>{s(S),v(S)};return C.useEffect(()=>v.cancel,[]),C.useEffect(()=>Sv(e,S=>x.current(S),i),[e]),d.jsxs("div",{children:[d.jsx(En,{error:l}),d.jsxs("div",{className:"mb-3",children:["Showing last ",f," logs since this window was opened"]}),d.jsx(t0,{children:d.jsx(Is,{value:o,name:"filter",placeholder:"Enter filter (regex)",onChange:S=>w(S.target.value)})}),n.map(S=>d.jsx("div",{hidden:!S.show,children:d.jsx(xv,{line:S.parsed})},S.id))]})},Ev=({show:e,onClose:t})=>{let r=C.useContext(Lt).getStreamLogsUrl();return d.jsxs(Hi,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[d.jsx(Vi,{children:r?d.jsx(kv,{url:r}):d.jsx(En,{error:{text:"HTTP API not available to stream logs"}})}),d.jsx(Wi,{children:d.jsx(en,{variant:"primary",onClick:t,children:"Close"})})]})},Cv=({children:e,label:t,help:n,className:r})=>d.jsxs("fieldset",{className:`mb-4 ${r}`,children:[t&&d.jsx("label",{className:"text-md font-md mb-3 block pb-1 border-b",children:t}),e]}),_v=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:i}=e;const[o,s]=C.useState(new Set),[a,f]=C.useState(!1),[y,x]=C.useState(null),[v,w]=C.useState(!1),[S,k]=C.useState(""),z=vn(T=>T.refreshTorrents),h=C.useContext(Lt);C.useEffect(()=>{s(new Set(n==null?void 0:n.details.files.map((T,j)=>j))),k((n==null?void 0:n.output_folder)||"")},[n]);const p=()=>{t(),s(new Set),x(null),f(!1)},m=async()=>{if(!n)return;f(!0);let T=n.seen_peers?n.seen_peers.slice(0,32):null,j={overwrite:!0,only_files:Array.from(o),initial_peers:T,output_folder:S};v&&(j.peer_opts={connect_timeout:20,read_write_timeout:60}),h.uploadTorrent(i,j).then(()=>{t(),z()},O=>{x({text:"Error starting torrent",details:O})}).finally(()=>f(!1))},_=()=>{if(l)return d.jsx(Ei,{label:"Loading torrent contents"});if(r)return d.jsx(En,{error:r});if(n)return d.jsxs(t0,{children:[d.jsx(Is,{label:"Output folder",name:"output_folder",inputType:"text",value:S,onChange:T=>k(T.target.value)}),d.jsx(Cv,{children:d.jsx(e0,{selectedFiles:o,setSelectedFiles:s,torrentDetails:n.details,torrentStats:null})})]})};return d.jsxs(Hi,{isOpen:!0,onClose:p,title:"Add Torrent",children:[d.jsxs(Vi,{children:[_(),d.jsx(En,{error:y})]}),d.jsxs(Wi,{children:[a&&d.jsx(Ei,{}),d.jsx(en,{onClick:p,variant:"cancel",children:"Cancel"}),d.jsx(en,{onClick:m,variant:"primary",disabled:l||a||o.size==0,children:"OK"})]})]})},n0=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[i,o]=C.useState(!1),[s,a]=C.useState(null),[f,y]=C.useState(null),x=C.useContext(Lt);C.useEffect(()=>{if(t===null)return;let w=setTimeout(async()=>{o(!0);try{const S=await x.uploadTorrent(t,{list_only:!0});a(S)}catch(S){y({text:"Error listing torrent files",details:S})}finally{o(!1)}},0);return()=>clearTimeout(w)},[t]);const v=()=>{n(),y(null),a(null),o(!1)};return d.jsxs(d.Fragment,{children:[d.jsx(en,{onClick:e,className:l,children:r}),t&&d.jsx(_v,{onHide:v,listTorrentError:f,listTorrentResponse:s,data:t,listTorrentLoading:i})]})};function Tv(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function jv(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const Nv=({className:e})=>{const t=C.useRef(),[n,r]=C.useState(null),l=async()=>{var a;if(!((a=t==null?void 0:t.current)!=null&&a.files))return;const s=t.current.files[0];r(s)},i=()=>{t!=null&&t.current&&(t.current.value="",r(null))},o=()=>{t!=null&&t.current&&t.current.click()};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),d.jsxs(n0,{onClick:o,data:n,resetData:i,className:`group ${e}`,children:[d.jsx(Tv,{className:"text-blue-500 group-hover:text-white dark:text-white"}),d.jsx("div",{children:"Upload .torrent File"})]})]})},Pv=({className:e})=>{const[t,n]=C.useState(null),[r,l]=C.useState(""),[i,o]=C.useState(!1),s=()=>{n(r),l(""),o(!1)},a=()=>{o(!1),n(null)};return d.jsxs(d.Fragment,{children:[d.jsxs(n0,{onClick:()=>{o(!0)},data:t,className:`group ${e}`,resetData:()=>n(null),children:[d.jsx(jv,{className:"text-blue-500 group-hover:text-white dark:text-white"}),d.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),d.jsxs(Hi,{isOpen:i,onClose:a,title:"Add torrent",children:[d.jsx(Vi,{children:d.jsx(Is,{autoFocus:!0,value:r,name:"magnet",onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Enter"&&r&&s()},placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),d.jsxs(Wi,{children:[d.jsx(en,{variant:"cancel",onClick:a,children:"Cancel"}),d.jsx(en,{disabled:!r,variant:"primary",onClick:s,children:"Add"})]})]})]})},Lv=e=>C.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},C.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),C.createElement("defs",{id:"defs1"},C.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),C.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},C.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),C.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),C.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Ov=({title:e,version:t})=>d.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center dark:bg-slate-800 mb-3",children:[d.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[d.jsx(Lv,{className:"w-10 h-10 p-1",alt:"logo"}),d.jsxs("h1",{className:"flex items-center dark:text-white",children:[d.jsx("div",{className:"text-3xl",children:e}),d.jsxs("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2 dark:bg-blue-900 dark:text-white",children:["v",t]})]})]}),d.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[d.jsx(Pv,{className:"flex-grow justify-center dark:text-white"}),d.jsx(Nv,{className:"flex-grow justify-center dark:text-white"})]})]});let Fn=window.matchMedia("(prefers-color-scheme: dark)").matches;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{Ki.setDark(e.matches)});const Ki={isDark:()=>Fn,setDark:e=>(Fn=e,document.body.classList.toggle("dark",Fn),Fn),toggle:()=>{Ki.setDark(!Fn)}};Ki.setDark(Fn);const Mv=e=>{let[t,n]=C.useState(!1);const r=bn(f=>f.setOtherError),l=C.useContext(Lt),i=vn(f=>f.setTorrents),o=vn(f=>f.setTorrentsLoading),s=vn(f=>f.setRefreshTorrents),a=async()=>{o(!0);let f=await l.listTorrents().finally(()=>o(!1));i(f.torrents)};return s(a),C.useEffect(()=>Os(async()=>a().then(()=>(r(null),5e3),f=>(r({text:"Error refreshing torrents",details:f}),console.error(f),5e3)),0),[]),d.jsxs("div",{className:"dark:bg-gray-900 dark:text-gray-200 min-h-screen",children:[d.jsx(Ov,{title:e.title,version:e.version}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((f,y)=>d.jsx("span",{children:f},y)),d.jsx(hn,{onClick:()=>n(!0),children:d.jsx(fm,{})}),d.jsx(hn,{onClick:Ki.toggle,children:d.jsx(dm,{})})]}),d.jsx(Xg,{})]}),d.jsx(Ev,{show:t,onClose:()=>n(!1)})]})},r0=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",ot=async(e,t,n,r)=>{console.log(e,t);const l=r0+t;let i={method:e,headers:{Accept:"application/json"}};r?(i.headers={Accept:"application/json","Content-Type":"application/json"},i.body=JSON.stringify(n)):i.body=n;let o={method:e,path:t,text:""},s;try{s=await fetch(l,i)}catch{return o.text="network error",Promise.reject(o)}if(o.status=s.status,o.statusText=`${s.status} ${s.statusText}`,!s.ok){const f=await s.text();try{const y=JSON.parse(f);o.text=y.human_readable!==void 0?y.human_readable:JSON.stringify(y,null,2)}catch{o.text=f}return Promise.reject(o)}return await s.json()},Cc={getStreamLogsUrl:()=>r0+"/stream_logs",listTorrents:()=>ot("GET","/torrents"),getTorrentDetails:e=>ot("GET",`/torrents/${e}`),getTorrentStats:e=>ot("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),ot("POST",n,e)},updateOnlyFiles:(e,t)=>{let n=`/torrents/${e}/update_only_files`;return ot("POST",n,{only_files:t},!0)},pause:e=>ot("POST",`/torrents/${e}/pause`),start:e=>ot("POST",`/torrents/${e}/start`),forget:e=>ot("POST",`/torrents/${e}/forget`),delete:e=>ot("POST",`/torrents/${e}/delete`),getVersion:async()=>(await ot("GET","/")).version},zv=()=>{let[e,t]=C.useState("");return C.useEffect(()=>Os(()=>Cc.getVersion().then(r=>{t(r);const l=`rqbit web UI - v${r}`;return document.title=l,1e4},r=>1e3),0),[]),d.jsx(Lt.Provider,{value:Cc,children:d.jsx(Mv,{title:"rqbit web UI",version:e})})};$o.createRoot(document.getElementById("app")).render(d.jsx(C.StrictMode,{children:d.jsx(zv,{})})); + */var Qi=C,cg=ag;function fg(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dg=typeof Object.is=="function"?Object.is:fg,pg=cg.useSyncExternalStore,hg=Qi.useRef,mg=Qi.useEffect,gg=Qi.useMemo,vg=Qi.useDebugValue;Yd.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var i=hg(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=gg(function(){function a(w){if(!f){if(f=!0,x=w,w=r(w),l!==void 0&&o.hasValue){var S=o.value;if(l(S,w))return y=S}return y=w}if(S=y,dg(x,w))return S;var T=r(w);return l!==void 0&&l(S,T)?S:(x=w,y=T)}var f=!1,x,y,v=n===void 0?null:n;return[function(){return a(t())},v===null?void 0:function(){return a(v())}]},[t,n,r,l]);var s=pg(e,i[0],i[1]);return mg(function(){o.hasValue=!0,o.value=s},[s]),vg(s),s};Gd.exports=Yd;var yg=Gd.exports;const xg=il(yg),{useDebugValue:wg}=Ct,{useSyncExternalStoreWithSelector:Sg}=xg;const kg=e=>e;function Eg(e,t=kg,n){const r=Sg(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return wg(r),r}const xc=e=>{const t=typeof e=="function"?bm(e):e,n=(r,l)=>Eg(t,r,l);return Object.assign(n,t),n},qd=e=>e?xc(e):xc,Cg=(e,t)=>e.id==t.id&&e.info_hash==t.info_hash,_g=(e,t)=>e===null&&t===null?!0:e===null||t===null?!1:e.length===t.length&&e.every((n,r)=>Cg(n,t[r])),vn=qd(e=>({torrents:null,torrentsLoading:!1,torrentsInitiallyLoading:!1,setTorrentsLoading:t=>e(n=>n.torrents==null?{torrentsInitiallyLoading:t,torrentsLoading:t}:{torrentsInitiallyLoading:!1,torrentsLoading:t}),setTorrents:t=>e(n=>_g(n.torrents,t)?{}:{torrents:t}),refreshTorrents:()=>{},setRefreshTorrents:t=>e({refreshTorrents:t})})),Tg=({id:e,show:t,onHide:n})=>{if(!t)return null;const[r,l]=C.useState(!1),[i,o]=C.useState(null),[s,a]=C.useState(!1),f=C.useContext(ft),x=vn(w=>w.refreshTorrents),y=()=>{l(!1),o(null),a(!1),n()},v=()=>{a(!0),(r?f.delete:f.forget)(e).then(()=>{x(),y()}).catch(S=>{o({text:`Error deleting torrent id=${e}`,details:S}),a(!1)})};return d.jsxs(Hi,{isOpen:t,onClose:n,title:"Delete torrent",children:[d.jsxs(Vi,{children:[d.jsx("p",{className:"text-gray-700 dark:text-slate-300",children:"Are you sure you want to delete the torrent?"}),d.jsxs("div",{className:"mt-4 flex items-center",children:[d.jsx("input",{type:"checkbox",id:"deleteFiles",className:"form-checkbox h-4 w-4 text-blue-500",onChange:()=>l(!r),checked:r,placeholder:"Also delete files"}),d.jsx("label",{htmlFor:"deleteFiles",className:"ml-2 text-gray-700 dark:text-slate-300",children:"Also delete files"})]}),i&&d.jsx(En,{error:i})]}),d.jsxs(Wi,{children:[s&&d.jsx(Ei,{}),d.jsx(en,{variant:"cancel",onClick:y,children:"Cancel"}),d.jsx(en,{variant:"danger",onClick:v,disabled:s,children:"Delete Torrent"})]})]})};function jg(e){return ae({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M487.4 315.7l-42.6-24.6c4.3-23.2 4.3-47 0-70.2l42.6-24.6c4.9-2.8 7.1-8.6 5.5-14-11.1-35.6-30-67.8-54.7-94.6-3.8-4.1-10-5.1-14.8-2.3L380.8 110c-17.9-15.4-38.5-27.3-60.8-35.1V25.8c0-5.6-3.9-10.5-9.4-11.7-36.7-8.2-74.3-7.8-109.2 0-5.5 1.2-9.4 6.1-9.4 11.7V75c-22.2 7.9-42.8 19.8-60.8 35.1L88.7 85.5c-4.9-2.8-11-1.9-14.8 2.3-24.7 26.7-43.6 58.9-54.7 94.6-1.7 5.4.6 11.2 5.5 14L67.3 221c-4.3 23.2-4.3 47 0 70.2l-42.6 24.6c-4.9 2.8-7.1 8.6-5.5 14 11.1 35.6 30 67.8 54.7 94.6 3.8 4.1 10 5.1 14.8 2.3l42.6-24.6c17.9 15.4 38.5 27.3 60.8 35.1v49.2c0 5.6 3.9 10.5 9.4 11.7 36.7 8.2 74.3 7.8 109.2 0 5.5-1.2 9.4-6.1 9.4-11.7v-49.2c22.2-7.9 42.8-19.8 60.8-35.1l42.6 24.6c4.9 2.8 11 1.9 14.8-2.3 24.7-26.7 43.6-58.9 54.7-94.6 1.5-5.5-.7-11.3-5.6-14.1zM256 336c-44.1 0-80-35.9-80-80s35.9-80 80-80 80 35.9 80 80-35.9 80-80 80z"}}]})(e)}function Ng(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z"}}]})(e)}function Pg(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"}}]})(e)}function Lg(e){return ae({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16zM53.2 467a48 48 0 0 0 47.9 45h245.8a48 48 0 0 0 47.9-45L416 128H32z"}}]})(e)}const bn=qd(e=>({closeableError:null,setCloseableError:t=>e(()=>({closeableError:t})),otherError:null,setOtherError:t=>e(()=>({otherError:t}))})),Og=({id:e,statsResponse:t,extendedView:n,setExtendedView:r})=>{let l=t.state,[i,o]=C.useState(!1),[s,a]=C.useState(!1),f=C.useContext(Ls);const x=l=="live",y=l=="paused"||l=="error",v=l=="paused"||l=="live",w=bn(h=>h.setCloseableError),S=C.useContext(ft),T=()=>{o(!0),S.start(e).then(()=>{f.refresh()},h=>{w({text:`Error starting torrent id=${e}`,details:h})}).finally(()=>o(!1))},I=()=>{o(!0),S.pause(e).then(()=>{f.refresh()},h=>{w({text:`Error pausing torrent id=${e}`,details:h})}).finally(()=>o(!1))},m=()=>{o(!0),a(!0)},p=()=>{o(!1),a(!1)};return d.jsxs("div",{className:"flex w-full justify-center gap-2 dark:text-slate-300",children:[y&&d.jsx(hn,{onClick:T,disabled:i,children:d.jsx(Pg,{className:"hover:text-green-600"})}),x&&d.jsx(hn,{onClick:I,disabled:i,children:d.jsx(Ng,{className:"hover:text-amber-500"})}),v&&d.jsx(hn,{onClick:()=>r(!n),disabled:i,children:d.jsx(jg,{className:"hover:text-green-600"})}),d.jsx(hn,{onClick:m,disabled:i,children:d.jsx(Lg,{className:"hover:text-red-500"})}),d.jsx(Tg,{id:e,show:s,onHide:p})]})},wc={warn:"bg-amber-500 text-white",info:"bg-blue-500 text-white",success:"bg-green-700 text-white",error:"bg-red-500 text-white"},bd=({now:e,variant:t,label:n,classNames:r})=>{const l=n??`${e.toFixed(2)}%`,i=wc[t??"info"]??wc.info;return d.jsx("div",{className:`w-full bg-gray-200 rounded-full mb-1 dark:bg-gray-500 ${r}`,children:d.jsx("div",{className:`text-xs font-medium transition-all text-center leading-none py-0.5 px-2 rounded-full ${i} ${e<1&&"bg-transparent"}`,style:{width:`${e}%`},children:l})})};function ll(e){if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+n[r]}const Mg=({statsResponse:e})=>{var t,n;switch(e.state){case rm:return"Paused";case Os:return"Checking files";case im:return"Error"}return e.state!="live"||e.live===null?e.state:d.jsxs(d.Fragment,{children:[!e.finished&&d.jsxs("div",{className:"download-speed",children:["↓ ",(t=e.live.download_speed)==null?void 0:t.human_readable]}),d.jsxs("div",{className:"upload-speed",children:["↑ ",(n=e.live.upload_speed)==null?void 0:n.human_readable,e.live.snapshot.uploaded_bytes>0&&d.jsxs("span",{children:["(",ll(e.live.snapshot.uploaded_bytes),")"]})]})]})};function zg(e){return e.files.filter(n=>n.included).reduce((n,r)=>n.length>r.length?n:r).name}function Fg(e){return e.name??zg(e)}function Ig(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,l=(i,o)=>i>0?`${i}${o}`:"";return t>0?`${l(t,"h")} ${l(n,"m")}`.trim():n>0?`${l(n,"m")} ${l(r,"s")}`.trim():`${l(r,"s")}`.trim()}function Dg(e){var n,r,l;let t=(l=(r=(n=e==null?void 0:e.live)==null?void 0:n.time_remaining)==null?void 0:r.duration)==null?void 0:l.secs;return t==null?"N/A":Ig(t)}function Rg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}}]})(e)}function Ag(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}}]})(e)}function $g(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M5 20h14v-2H5v2zM19 9h-4V3H9v6H5l7 7 7-7z"}}]})(e)}function Ug(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M9 16h6v-6h4l-7-7-7 7h4v6zm3-10.17L14.17 8H13v6h-2V8H9.83L12 5.83zM5 18h14v2H5z"}}]})(e)}function Bg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 12c0 5.52-4.48 10-10 10S2 17.52 2 12c0-1.19.22-2.32.6-3.38l1.88.68C4.17 10.14 4 11.05 4 12c0 4.41 3.59 8 8 8s8-3.59 8-8-3.59-8-8-8c-.95 0-1.85.17-2.69.48l-.68-1.89C9.69 2.22 10.82 2 12 2c5.52 0 10 4.48 10 10zM5.5 4C4.67 4 4 4.67 4 5.5S4.67 7 5.5 7 7 6.33 7 5.5 6.33 4 5.5 4zM11 16V8H9v8h2zm4 0V8h-2v8h2z"}}]})(e)}const Hg=({className:e,finished:t,live:n,error:r})=>{const l=t&&n;return r?d.jsx(Ag,{className:e,color:"red"}):l?d.jsx(Ug,{className:e,color:"green"}):t?d.jsx(Rg,{className:e,color:"green"}):n?d.jsx($g,{className:`text-blue-500 ${e}`}):d.jsx(Bg,{className:e})},Sc=({checked:e,name:t,disabled:n,onChange:r,label:l,help:i,inputType:o,children:s,labelLink:a})=>d.jsxs("div",{className:"flex gap-3 items-start",children:[d.jsx("div",{className:"flex",children:d.jsx("input",{type:o||"checkbox",className:"block mt-1",id:t,name:t,disabled:n,checked:e,onChange:r})}),d.jsxs("div",{className:"text-sm flex flex-col gap-1",children:[a?d.jsx("a",{href:a,className:"text-blue-600 dark:text-blue-500 hover:underline",children:l}):d.jsx("label",{htmlFor:t,children:l}),i&&d.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300 mb-3",children:i})]}),s]});function Vg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Minus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.564a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.564,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M9,12.5a.5.5,0,0,1,0-1h6a.5.5,0,0,1,0,1Z"}}]}]}]})(e)}function Wg(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"g",attr:{id:"Square_Plus"},child:[{tag:"g",attr:{},child:[{tag:"path",attr:{d:"M18.438,20.938H5.563a2.5,2.5,0,0,1-2.5-2.5V5.564a2.5,2.5,0,0,1,2.5-2.5H18.438a2.5,2.5,0,0,1,2.5,2.5V18.438A2.5,2.5,0,0,1,18.438,20.938ZM5.563,4.064a1.5,1.5,0,0,0-1.5,1.5V18.438a1.5,1.5,0,0,0,1.5,1.5H18.438a1.5,1.5,0,0,0,1.5-1.5V5.564a1.5,1.5,0,0,0-1.5-1.5Z"}},{tag:"path",attr:{d:"M15,12.5H12.5V15a.5.5,0,0,1-1,0V12.5H9a.5.5,0,0,1,0-1h2.5V9a.5.5,0,0,1,1,0v2.5H15A.5.5,0,0,1,15,12.5Z"}}]}]}]})(e)}var Ci={exports:{}};Ci.exports;(function(e,t){var n=200,r="Expected a function",l="__lodash_hash_undefined__",i=1,o=2,s=1/0,a=9007199254740991,f="[object Arguments]",x="[object Array]",y="[object Boolean]",v="[object Date]",w="[object Error]",S="[object Function]",T="[object GeneratorFunction]",I="[object Map]",m="[object Number]",p="[object Object]",h="[object Promise]",k="[object RegExp]",_="[object Set]",j="[object String]",O="[object Symbol]",z="[object WeakMap]",W="[object ArrayBuffer]",A="[object DataView]",we="[object Float32Array]",dt="[object Float64Array]",pt="[object Int8Array]",Tn="[object Int16Array]",fr="[object Int32Array]",Ae="[object Uint8Array]",rt="[object Uint8ClampedArray]",P="[object Uint16Array]",R="[object Uint32Array]",$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,K=/^\w*$/,ee=/^\./,Ge=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$e=/[\\^$.*+?()[\]{}|]/g,ht=/\\(\\)?/g,Ye=/^\[object .+?Constructor\]$/,Ot=/^(?:0|[1-9]\d*)$/,Z={};Z[we]=Z[dt]=Z[pt]=Z[Tn]=Z[fr]=Z[Ae]=Z[rt]=Z[P]=Z[R]=!0,Z[f]=Z[x]=Z[W]=Z[y]=Z[A]=Z[v]=Z[w]=Z[S]=Z[I]=Z[m]=Z[p]=Z[k]=Z[_]=Z[j]=Z[z]=!1;var jn=typeof Ut=="object"&&Ut&&Ut.Object===Object&&Ut,dr=typeof self=="object"&&self&&self.Object===Object&&self,lt=jn||dr||Function("return this")(),pr=t&&!t.nodeType&&t,Nn=pr&&!0&&e&&!e.nodeType&&e,Pn=Nn&&Nn.exports===pr,q=Pn&&jn.process,hr=function(){try{return q&&q.binding("util")}catch{}}(),Ln=hr&&hr.isTypedArray;function l0(u,c,g){switch(g.length){case 0:return u.call(c);case 1:return u.call(c,g[0]);case 2:return u.call(c,g[0],g[1]);case 3:return u.call(c,g[0],g[1],g[2])}return u.apply(c,g)}function Rs(u,c){for(var g=-1,E=u?u.length:0,M=Array(E);++g-1}function F0(u,c){var g=this.__data__,E=ml(g,u);return E<0?g.push([u,c]):g[E][1]=c,this}gt.prototype.clear=L0,gt.prototype.delete=O0,gt.prototype.get=M0,gt.prototype.has=z0,gt.prototype.set=F0;function vt(u){var c=-1,g=u?u.length:0;for(this.clear();++c0&&g(U)?c>1?Qs(U,c-1,g,E,M):i0(M,U):E||(M[M.length]=U)}return M}var Y0=m1();function X0(u,c){return u&&Y0(u,c,wl)}function Ks(u,c){c=vl(c,u)?[c]:Zs(c);for(var g=0,E=c.length;u!=null&&gc||L&&D&&H&&!U&&!G||E&&D&&H||!g&&H||!M)return 1;if(!E&&!L&&!G&&u=U)return H;var G=g[E];return H*(G=="desc"?-1:1)}}return u.index-c.index}function h1(u,c){return function(g,E){if(g==null)return g;if(!vr(g))return u(g,E);for(var M=g.length,L=c?M:-1,D=Object(g);(c?L--:++LU))return!1;var G=L.get(u);if(G&&L.get(c))return G==c;var Se=-1,Te=!0,ce=M&i?new hl:void 0;for(L.set(u,c),L.set(c,u);++Se-1&&u%1==0&&u1&&Ys(u,c[0],c[1])?c=[]:g>2&&Ys(c[0],c[1],c[2])&&(c=[c[0]]),s1(u,Qs(c,1),[])});function no(u,c){if(typeof u!="function"||c&&typeof c!="function")throw new TypeError(r);var g=function(){var E=arguments,M=c?c.apply(this,E):E[0],L=g.cache;if(L.has(M))return L.get(M);var D=u.apply(this,E);return g.cache=L.set(M,D),D};return g.cache=new(no.Cache||vt),g}no.Cache=vt;function ro(u,c){return u===c||u!==u&&c!==c}function lo(u){return T1(u)&&mt.call(u,"callee")&&(!v0.call(u,"callee")||On.call(u)==f)}var zt=Array.isArray;function vr(u){return u!=null&&io(u.length)&&!qs(u)}function T1(u){return xl(u)&&vr(u)}function qs(u){var c=yr(u)?On.call(u):"";return c==S||c==T}function io(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=a}function yr(u){var c=typeof u;return!!u&&(c=="object"||c=="function")}function xl(u){return!!u&&typeof u=="object"}function xr(u){return typeof u=="symbol"||xl(u)&&On.call(u)==O}var j1=Ln?As(Ln):n1;function N1(u){return u==null?"":f1(u)}function P1(u,c,g){var E=u==null?void 0:Ks(u,c);return E===void 0?g:E}function L1(u,c){return u!=null&&x1(u,c,q0)}function wl(u){return vr(u)?Z0(u):l1(u)}function bs(u){return u}function O1(u){return vl(u)?u0(yl(u)):a1(u)}e.exports=_1})(Ci,Ci.exports);var Qg=Ci.exports;const kc=il(Qg),Kg=(e,t)=>{const n=(r,l,i,o)=>{let s=[],a=[],f={};const x=w=>(f[w]=f[w]||[],f[w]);i.forEach(w=>{if(o==w.pathComponents.length-1){s.push(w);return}x(w.pathComponents[o]).push(w)}),s=kc(s,w=>w.filename);let y=kc(Object.entries(f),([w,S])=>w),v=0;for(const[w,S]of y)a.push(n(w,l+"."+v,S,o+1)),v+=1;return{name:r,id:l,dirs:a,files:s}};return n("","filetree-root",e.files.map((r,l)=>({id:l,filename:r.components[r.components.length-1],pathComponents:r.components,length:r.length,have_bytes:t?t.file_progress[l]??0:0})),0)},e0=({torrentId:e,tree:t,selectedFiles:n,setSelectedFiles:r,initialExpanded:l,torrentDetails:i,torrentStats:o,showProgressBar:s,disabled:a,allowStream:f})=>{const x=C.useContext(ft);let[y,v]=C.useState(l),w=C.useMemo(()=>{let h=k=>{let _=k.dirs.flatMap(h);return _.push(...k.files.map(j=>j.id)),_};return h(t)},[t]);const S=h=>{if(h.target.checked){let k=new Set(n);w.forEach(_=>k.add(_)),r(k)}else{let k=new Set(n);w.forEach(_=>k.delete(_)),r(k)}},T=h=>{if(n.has(h)){let k=new Set(n);k.delete(h),r(k)}else{let k=new Set(n);k.add(h),r(k)}},I=()=>w.filter(h=>n.has(h)).length,m=()=>w.filter(h=>n.has(h)).map(h=>i.files[h].length).reduce((h,k)=>h+k,0),p=h=>{if(f&&e!=null&&/\.(mp4|mkv|avi)$/.test(h.filename))return x.getTorrentStreamUrl(e,h.id)};return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(hn,{onClick:()=>v(!y),children:y?d.jsx(Vg,{}):d.jsx(Wg,{})}),d.jsx(Sc,{checked:w.every(h=>n.has(h)),label:`${t.name?t.name+", ":""} ${I()} files, ${ll(m())}`,name:t.id,onChange:S})]}),d.jsxs("div",{className:"pl-5",hidden:!y,children:[t.dirs.map(h=>d.jsx(e0,{torrentId:e,torrentDetails:i,torrentStats:o,tree:h,selectedFiles:n,setSelectedFiles:r,initialExpanded:!1,showProgressBar:s,disabled:a,allowStream:f},h.name)),d.jsx("div",{className:"pl-1",children:t.files.map(h=>d.jsxs("div",{className:`${s?"grid grid-cols-1 gap-1 items-start lg:grid-cols-2 mb-2 lg:mb-0":""}`,children:[d.jsx(Sc,{checked:n.has(h.id),label:`${h.filename} (${ll(h.length)})`,name:`file-${h.id}`,disabled:a,onChange:()=>T(h.id),labelLink:p(h)}),s&&d.jsx(bd,{now:h.have_bytes/h.length*100,variant:h.have_bytes==h.length?"success":"info"})]},h.id))})]})]})},t0=({torrentId:e,torrentDetails:t,selectedFiles:n,setSelectedFiles:r,torrentStats:l,showProgressBar:i,disabled:o,allowStream:s})=>{let a=C.useMemo(()=>Kg(t,l),[t,l]);return d.jsx(e0,{torrentId:e,torrentDetails:t,torrentStats:l,tree:a,selectedFiles:n,setSelectedFiles:r,initialExpanded:!0,showProgressBar:i,disabled:o,allowStream:s})},Zg=({id:e,detailsResponse:t,statsResponse:n})=>{const r=(n==null?void 0:n.state)??"",l=(n==null?void 0:n.error)??null,i=(n==null?void 0:n.total_bytes)??1,o=(n==null?void 0:n.progress_bytes)??0,s=(n==null?void 0:n.finished)||!1,a=l||i==0?100:o/i*100,f=()=>{var j;let _=(j=n==null?void 0:n.live)==null?void 0:j.snapshot.peer_stats;return _?`${_.live} / ${_.seen}`:""},x=_=>d.jsx(Hg,{className:_,error:!!l,live:!!(n!=null&&n.live),finished:s}),[y,v]=C.useState(new Set);C.useEffect(()=>{v(new Set((t==null?void 0:t.files.map((_,j)=>({f:_,id:j})).filter(({f:_})=>_.included).map(({id:_})=>_))??[]))},[t]);const w=C.useContext(ft),S=C.useContext(Ls),[T,I]=C.useState(!1);let m=bn(_=>_.setCloseableError);const p=_=>{I(!0),w.updateOnlyFiles(e,Array.from(_)).then(()=>{S.refresh(),m(null)},j=>{m({text:"Error configuring torrent",details:j})}).finally(()=>I(!1))},[h,k]=C.useState(!1);return d.jsxs("div",{className:"flex flex-col border p-2 border-gray-200 rounded-xl shadow-xs hover:drop-shadow-sm dark:bg-slate-800 dark:border-slate-900",children:[d.jsxs("section",{className:"flex flex-col lg:flex-row items-center gap-2",children:[d.jsx("div",{className:"hidden md:block",children:x("w-10 h-10")}),d.jsxs("div",{className:"w-full flex flex-col gap-2",children:[t&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"md:hidden",children:x("w-5 h-5")}),d.jsx("div",{className:"text-left text-lg text-gray-900 text-ellipsis break-all dark:text-slate-200",children:Fg(t)})]}),l?d.jsxs("p",{className:"text-red-500 text-sm",children:[d.jsx("strong",{children:"Error:"})," ",l]}):d.jsxs(d.Fragment,{children:[d.jsx("div",{children:d.jsx(bd,{now:a,label:l,variant:r==Os?"warn":s?"success":"info"})}),d.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-2 sm:flex-wrap items-center text-sm text-nowrap font-medium text-gray-500",children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(cm,{})," ",f().toString()]}),d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(am,{}),d.jsxs("div",{children:[ll(o),"/",ll(i)]})]}),n&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex gap-2 items-center",children:[d.jsx(sm,{}),Dg(n)]}),d.jsx("div",{className:"flex gap-2 items-center",children:d.jsx(Mg,{statsResponse:n})})]})]})]})]}),n&&d.jsx("div",{className:"",children:d.jsx(Og,{id:e,statsResponse:n,extendedView:h,setExtendedView:k})})]}),t&&h&&d.jsx("div",{className:"",children:d.jsx(t0,{torrentId:e,torrentDetails:t,torrentStats:n,selectedFiles:y,setSelectedFiles:p,disabled:T,allowStream:!0,showProgressBar:!0})})]})},Gg=({id:e,torrent:t})=>{const[n,r]=C.useState(null),[l,i]=C.useState(null),[o,s]=C.useState(0),a=C.useContext(ft),f=()=>{s(o+1)};return C.useEffect(()=>Bd(async()=>{await a.getTorrentDetails(t.id).then(r)},1e3),[o]),C.useEffect(()=>Ms(async()=>a.getTorrentStats(t.id).then(w=>(i(w),w)).then(w=>w.state==Os||w.state==lm?1e3:1e4,()=>1e4),0),[o]),d.jsx(Ls.Provider,{value:{refresh:f},children:d.jsx(Zg,{id:e,detailsResponse:n,statsResponse:l})})},Yg=e=>d.jsx("div",{className:"flex flex-col gap-2 mx-2 pb-3 sm:px-7",children:e.torrents===null?e.loading?d.jsx(Ei,{className:"justify-center m-5",label:"Loading torrent list"}):null:e.torrents.length===0?d.jsx("p",{className:"text-center",children:"No existing torrents found."}):e.torrents.map(t=>d.jsx(Gg,{id:t.id,torrent:t},t.id))}),Xg=e=>{let t=bn(o=>o.closeableError),n=bn(o=>o.setCloseableError),r=bn(o=>o.otherError),l=vn(o=>o.torrents),i=vn(o=>o.torrentsInitiallyLoading);return d.jsxs("div",{className:"container mx-auto",children:[d.jsx(En,{error:t,remove:()=>n(null)}),d.jsx(En,{error:r}),d.jsx(Yg,{torrents:l,loading:i})]})};var Jg="Expected a function",Ec=0/0,qg="[object Symbol]",bg=/^\s+|\s+$/g,ev=/^[-+]0x[0-9a-f]+$/i,tv=/^0b[01]+$/i,nv=/^0o[0-7]+$/i,rv=parseInt,lv=typeof Ut=="object"&&Ut&&Ut.Object===Object&&Ut,iv=typeof self=="object"&&self&&self.Object===Object&&self,ov=lv||iv||Function("return this")(),uv=Object.prototype,sv=uv.toString,av=Math.max,cv=Math.min,Ao=function(){return ov.Date.now()};function fv(e,t,n){var r,l,i,o,s,a,f=0,x=!1,y=!1,v=!0;if(typeof e!="function")throw new TypeError(Jg);t=Cc(t)||0,Fu(n)&&(x=!!n.leading,y="maxWait"in n,i=y?av(Cc(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v);function w(j){var O=r,z=l;return r=l=void 0,f=j,o=e.apply(z,O),o}function S(j){return f=j,s=setTimeout(m,t),x?w(j):o}function T(j){var O=j-a,z=j-f,W=t-O;return y?cv(W,i-z):W}function I(j){var O=j-a,z=j-f;return a===void 0||O>=t||O<0||y&&z>=i}function m(){var j=Ao();if(I(j))return p(j);s=setTimeout(m,T(j))}function p(j){return s=void 0,v&&r?w(j):(r=l=void 0,o)}function h(){s!==void 0&&clearTimeout(s),f=0,r=a=l=s=void 0}function k(){return s===void 0?o:p(Ao())}function _(){var j=Ao(),O=I(j);if(r=arguments,l=this,a=j,O){if(s===void 0)return S(a);if(y)return s=setTimeout(m,t),w(a)}return s===void 0&&(s=setTimeout(m,t)),o}return _.cancel=h,_.flush=k,_}function Fu(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function dv(e){return!!e&&typeof e=="object"}function pv(e){return typeof e=="symbol"||dv(e)&&sv.call(e)==qg}function Cc(e){if(typeof e=="number")return e;if(pv(e))return Ec;if(Fu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Fu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(bg,"");var n=tv.test(e);return n||nv.test(e)?rv(e.slice(2),n?2:8):ev.test(e)?Ec:+e}var hv=fv;const mv=il(hv),gv=({span:e})=>{let t=Object.entries(e).filter(([n,r])=>n!="name");return t.length==0?null:d.jsxs(d.Fragment,{children:["{",t.map(([n,r])=>d.jsxs("span",{children:[n," = ",r]},n)).reduce((n,r)=>d.jsxs(d.Fragment,{children:[n,", ",r]})),"}"]})},vv=({span:e})=>d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"font-bold",children:e.name}),d.jsx(gv,{span:e}),d.jsx("span",{className:"font-bold",children:":"})]}),yv=({fields:e})=>d.jsxs("span",{className:`m-1 ${e.message.match(/error|fail/g)?"text-red-500":"text-slate-500 dark:text-slate-200"}`,children:[e.message,Object.entries(e).filter(([t,n])=>t!="message").map(([t,n])=>d.jsxs("span",{className:"m-1",children:[d.jsx("span",{className:"italic font-bold",children:t}),"=",n]},t))]}),xv=Ct.memo(({line:e})=>{var r;const t=e,n=l=>{switch(l){case"DEBUG":return"text-blue-500";case"INFO":return"text-green-500";case"WARN":return"text-amber-500";case"ERROR":return"text-red-500";default:return"text-slate-500"}};return d.jsxs("p",{className:"font-mono m-0 text-break text-[10px]",children:[d.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.timestamp}),d.jsx("span",{className:`m-1 ${n(t.level)}`,children:t.level}),d.jsx("span",{className:"m-1",children:(r=t.spans)==null?void 0:r.map((l,i)=>d.jsx(vv,{span:l},i))}),d.jsx("span",{className:"m-1 text-slate-500 dark:text-slate-400",children:t.target}),d.jsx(yv,{fields:t.fields})]})}),n0=({children:e})=>d.jsx("form",{children:e}),Ds=({autoFocus:e,value:t,name:n,disabled:r,onChange:l,onKeyDown:i,label:o,help:s,inputType:a,placeholder:f})=>d.jsxs("div",{className:"flex flex-col gap-2 text-sm mb-2",children:[d.jsx("label",{htmlFor:n,className:"dark:text-white",children:o}),d.jsx("input",{autoFocus:e,type:a,className:"block border rounded bg-transparent py-1.5 pl-2 text-gray-800 focus:ring-0 sm:text-sm sm:leading-6 dark:text-slate-300",id:n,name:n,disabled:r,placeholder:f,value:t,onKeyDown:i,onChange:l}),s&&d.jsx("div",{className:"text-xs text-slate-500 dark:text-slate-300",children:s})]}),wv=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},Sv=(e,t,n)=>{const r=new AbortController,l=r.signal;let i=!1;const o=()=>{console.log("cancelling fetch"),i=!0,r.abort()},s=async()=>{let f=await fetch(e,{signal:l});if(!f.ok){let v=await f.text();throw n({text:"error fetching logs",details:{statusText:f.statusText,text:v}}),null}if(!f.body){n({text:"error fetching logs: ReadableStream not supported."});return}n(null);const x=f.body.getReader();let y=new Uint8Array;for(;;){const{done:v,value:w}=await x.read();if(v)throw n({text:"log stream terminated"}),null;y=wv(y,w);for(let S;(S=y.indexOf(10))!==-1;){let T=y.slice(0,S),I=new TextDecoder().decode(T);t(I),y=y.slice(S+1)}}};let a=Bd(()=>s().then(()=>{},f=>{if(!i&&f!==null)throw n({text:"error streaming logs",details:{text:f.toString()}}),f}),1e3);return()=>{o(),a()}},kv=({url:e,maxLines:t})=>{const[n,r]=C.useState([]),[l,i]=C.useState(null),[o,s]=C.useState(""),a=C.useRef(null),f=t??1e3,x=C.useCallback(S=>{r(T=>[{id:T.length==0?0:T[0].id+1,content:S,parsed:JSON.parse(S),show:a.current?!!S.match(a.current):!0},...T.slice(0,f-1)])},[a.current,t]),y=C.useRef(x);y.current=x;const v=mv(S=>{let T=null;try{T=new RegExp(S)}catch{return}a.current=T,r(I=>{let m=[...I];for(let p of m)p.show=!!p.content.match(T);return m})},200),w=S=>{s(S),v(S)};return C.useEffect(()=>v.cancel,[]),C.useEffect(()=>Sv(e,S=>y.current(S),i),[e]),d.jsxs("div",{children:[d.jsx(En,{error:l}),d.jsxs("div",{className:"mb-3",children:["Showing last ",f," logs since this window was opened"]}),d.jsx(n0,{children:d.jsx(Ds,{value:o,name:"filter",placeholder:"Enter filter (regex)",onChange:S=>w(S.target.value)})}),n.map(S=>d.jsx("div",{hidden:!S.show,children:d.jsx(xv,{line:S.parsed})},S.id))]})},Ev=({show:e,onClose:t})=>{let r=C.useContext(ft).getStreamLogsUrl();return d.jsxs(Hi,{isOpen:e,onClose:t,title:"rqbit server logs",className:"max-w-7xl",children:[d.jsx(Vi,{children:r?d.jsx(kv,{url:r}):d.jsx(En,{error:{text:"HTTP API not available to stream logs"}})}),d.jsx(Wi,{children:d.jsx(en,{variant:"primary",onClick:t,children:"Close"})})]})},Cv=({children:e,label:t,help:n,className:r})=>d.jsxs("fieldset",{className:`mb-4 ${r}`,children:[t&&d.jsx("label",{className:"text-md font-md mb-3 block pb-1 border-b",children:t}),e]}),_v=e=>{let{onHide:t,listTorrentResponse:n,listTorrentError:r,listTorrentLoading:l,data:i}=e;const[o,s]=C.useState(new Set),[a,f]=C.useState(!1),[x,y]=C.useState(null),[v,w]=C.useState(!1),[S,T]=C.useState(""),I=vn(_=>_.refreshTorrents),m=C.useContext(ft);C.useEffect(()=>{s(new Set(n==null?void 0:n.details.files.map((_,j)=>j))),T((n==null?void 0:n.output_folder)||"")},[n]);const p=()=>{t(),s(new Set),y(null),f(!1)},h=async()=>{if(!n)return;f(!0);let _=n.seen_peers?n.seen_peers.slice(0,32):null,j={overwrite:!0,only_files:Array.from(o),initial_peers:_,output_folder:S};v&&(j.peer_opts={connect_timeout:20,read_write_timeout:60}),m.uploadTorrent(i,j).then(()=>{t(),I()},O=>{y({text:"Error starting torrent",details:O})}).finally(()=>f(!1))},k=()=>{if(l)return d.jsx(Ei,{label:"Loading torrent contents"});if(r)return d.jsx(En,{error:r});if(n)return d.jsxs(n0,{children:[d.jsx(Ds,{label:"Output folder",name:"output_folder",inputType:"text",value:S,onChange:_=>T(_.target.value)}),d.jsx(Cv,{children:d.jsx(t0,{selectedFiles:o,setSelectedFiles:s,torrentDetails:n.details,torrentStats:null})})]})};return d.jsxs(Hi,{isOpen:!0,onClose:p,title:"Add Torrent",children:[d.jsxs(Vi,{children:[k(),d.jsx(En,{error:x})]}),d.jsxs(Wi,{children:[a&&d.jsx(Ei,{}),d.jsx(en,{onClick:p,variant:"cancel",children:"Cancel"}),d.jsx(en,{onClick:h,variant:"primary",disabled:l||a||o.size==0,children:"OK"})]})]})},r0=({onClick:e,data:t,resetData:n,children:r,className:l})=>{const[i,o]=C.useState(!1),[s,a]=C.useState(null),[f,x]=C.useState(null),y=C.useContext(ft);C.useEffect(()=>{if(t===null)return;let w=setTimeout(async()=>{o(!0);try{const S=await y.uploadTorrent(t,{list_only:!0});a(S)}catch(S){x({text:"Error listing torrent files",details:S})}finally{o(!1)}},0);return()=>clearTimeout(w)},[t]);const v=()=>{n(),x(null),a(null),o(!1)};return d.jsxs(d.Fragment,{children:[d.jsx(en,{onClick:e,className:l,children:r}),t&&d.jsx(_v,{onHide:v,listTorrentError:f,listTorrentResponse:s,data:t,listTorrentLoading:i})]})};function Tv(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M10 18V16H8V14H10V12H12V14H14V16H12V18H10Z",fill:"currentColor"}},{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2C4.34315 2 3 3.34315 3 5V19C3 20.6569 4.34315 22 6 22H18C19.6569 22 21 20.6569 21 19V9C21 5.13401 17.866 2 14 2H6ZM6 4H13V9H19V19C19 19.5523 18.5523 20 18 20H6C5.44772 20 5 19.5523 5 19V5C5 4.44772 5.44772 4 6 4ZM15 4.10002C16.6113 4.4271 17.9413 5.52906 18.584 7H15V4.10002Z",fill:"currentColor"}}]})(e)}function jv(e){return ae({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none"},child:[{tag:"path",attr:{d:"M14.8284 12L16.2426 13.4142L19.071 10.5858C20.6331 9.02365 20.6331 6.49099 19.071 4.9289C17.509 3.3668 14.9763 3.3668 13.4142 4.9289L10.5858 7.75732L12 9.17154L14.8284 6.34311C15.6095 5.56206 16.8758 5.56206 17.6568 6.34311C18.4379 7.12416 18.4379 8.39049 17.6568 9.17154L14.8284 12Z",fill:"currentColor"}},{tag:"path",attr:{d:"M12 14.8285L13.4142 16.2427L10.5858 19.0711C9.02372 20.6332 6.49106 20.6332 4.92896 19.0711C3.36686 17.509 3.36686 14.9764 4.92896 13.4143L7.75739 10.5858L9.1716 12L6.34317 14.8285C5.56212 15.6095 5.56212 16.8758 6.34317 17.6569C7.12422 18.4379 8.39055 18.4379 9.1716 17.6569L12 14.8285Z",fill:"currentColor"}},{tag:"path",attr:{d:"M14.8285 10.5857C15.219 10.1952 15.219 9.56199 14.8285 9.17147C14.4379 8.78094 13.8048 8.78094 13.4142 9.17147L9.1716 13.4141C8.78107 13.8046 8.78107 14.4378 9.1716 14.8283C9.56212 15.2188 10.1953 15.2188 10.5858 14.8283L14.8285 10.5857Z",fill:"currentColor"}}]})(e)}const Nv=({className:e})=>{const t=C.useRef(),[n,r]=C.useState(null),l=async()=>{var a;if(!((a=t==null?void 0:t.current)!=null&&a.files))return;const s=t.current.files[0];r(s)},i=()=>{t!=null&&t.current&&(t.current.value="",r(null))},o=()=>{t!=null&&t.current&&t.current.click()};return d.jsxs(d.Fragment,{children:[d.jsx("input",{type:"file",ref:t,accept:".torrent",onChange:l,hidden:!0}),d.jsxs(r0,{onClick:o,data:n,resetData:i,className:`group ${e}`,children:[d.jsx(Tv,{className:"text-blue-500 group-hover:text-white dark:text-white"}),d.jsx("div",{children:"Upload .torrent File"})]})]})},Pv=({className:e})=>{const[t,n]=C.useState(null),[r,l]=C.useState(""),[i,o]=C.useState(!1),s=()=>{n(r),l(""),o(!1)},a=()=>{o(!1),n(null)};return d.jsxs(d.Fragment,{children:[d.jsxs(r0,{onClick:()=>{o(!0)},data:t,className:`group ${e}`,resetData:()=>n(null),children:[d.jsx(jv,{className:"text-blue-500 group-hover:text-white dark:text-white"}),d.jsx("div",{children:"Add Torrent from Magnet / URL"})]}),d.jsxs(Hi,{isOpen:i,onClose:a,title:"Add torrent",children:[d.jsx(Vi,{children:d.jsx(Ds,{autoFocus:!0,value:r,name:"magnet",onChange:f=>l(f.target.value),onKeyDown:f=>{f.key==="Enter"&&r&&s()},placeholder:"magnet:?xt=urn:btih:...",help:"Enter magnet or HTTP(S) URL to the .torrent"})}),d.jsxs(Wi,{children:[d.jsx(en,{variant:"cancel",onClick:a,children:"Cancel"}),d.jsx(en,{disabled:!r,variant:"primary",onClick:s,children:"Add"})]})]})]})},Lv=e=>C.createElement("svg",{width:"64mm",height:"64mm",viewBox:"0 0 64 64",id:"svg1",xmlSpace:"preserve","inkscape:version":"1.3.1 (91b66b0, 2023-11-16)","sodipodi:docname":"logo.svg","xmlns:inkscape":"http://www.inkscape.org/namespaces/inkscape","xmlns:sodipodi":"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",xmlns:"http://www.w3.org/2000/svg","xmlns:svg":"http://www.w3.org/2000/svg",...e},C.createElement("sodipodi:namedview",{id:"namedview1",pagecolor:"#ffffff",bordercolor:"#000000",borderopacity:.25,"inkscape:showpageshadow":2,"inkscape:pageopacity":0,"inkscape:pagecheckerboard":0,"inkscape:deskcolor":"#d1d1d1","inkscape:document-units":"mm","inkscape:zoom":1.4936372,"inkscape:cx":134.90559,"inkscape:cy":139.92689,"inkscape:window-width":1440,"inkscape:window-height":847,"inkscape:window-x":0,"inkscape:window-y":25,"inkscape:window-maximized":0,"inkscape:current-layer":"layer1"}),C.createElement("defs",{id:"defs1"},C.createElement("inkscape:perspective",{"sodipodi:type":"inkscape:persp3d","inkscape:vp_x":"3.1042448 : 18.147022 : 1","inkscape:vp_y":"0 : 999.99994 : 0","inkscape:vp_z":"303.94612 : 54.05812 : 1","inkscape:persp3d-origin":"105 : -134 : 1",id:"perspective4"})),C.createElement("g",{"inkscape:label":"Layer 1","inkscape:groupmode":"layer",id:"layer1",transform:"translate(-56.674541,-85.911432)"},C.createElement("path",{style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.610041},d:"m 81.603814,145.5382 -7.433116,-4.36986 -6.018097,-3.54529 -6.018099,-3.54529 -0.09405,-0.35761 -0.09406,-0.3576 v -15.31979 -15.31979 l 0.09451,-0.35939 0.09451,-0.35938 6.017643,-3.544433 6.017641,-3.544428 7.432805,-4.369167 7.432803,-4.369166 0.240089,0.09331 0.240083,0.09331 13.292394,7.826122 13.29241,7.826122 0.093,0.35355 0.093,0.35355 v 15.31979 15.31979 l -0.0928,0.35267 -0.0928,0.35266 -13.29682,7.82802 -13.296819,7.82803 -0.235583,0.0921 -0.235588,0.0921 z m 19.758596,-5.88315 12.13185,-7.15306 v -14.45996 -14.45994 l -5.11526,-3.01603 -5.11526,-3.016035 -7.017048,-4.136312 -7.017053,-4.13631 h -0.112738 -0.11273 l -7.097035,4.182089 -7.09703,4.18209 -5.035336,2.971548 -5.035335,2.97155 v 14.45761 14.45762 l 5.275113,3.11051 5.275113,3.11051 6.793709,4.02813 6.793702,4.02812 0.176743,0.0155 0.176742,0.0155 z",id:"path15","sodipodi:nodetypes":"cccccccccccccccccccccccccccccccccccccccccccccccccccc"}),C.createElement("path",{style:{fill:"#000000"},id:"path1",d:""}),C.createElement("path",{d:"m 84.161856,133.76725 -4.567369,-2.5483 -0.700367,0.28585 -0.700376,0.28584 -0.495731,0.11427 -0.495731,0.11426 -3.168791,-1.75603 -3.168782,-1.75603 -0.515321,-0.57002 -0.515323,-0.57002 0.0161,-3.59449 0.0161,-3.59448 0.164041,-0.41611 0.164042,-0.41611 1.480342,-0.85565 1.480346,-0.85565 0.06276,-3.67919 0.06276,-3.67921 0.39653,-0.35884 0.396521,-0.35886 3.663275,-2.04111 3.663267,-2.04112 0.114523,-1.62785 0.114506,-1.62786 0.229029,-0.21764 0.229038,-0.21765 3.341459,-1.854383 3.341467,-1.854382 h 0.301682 0.301682 l 2.476951,1.380374 2.476959,1.380381 1.151673,0.57845 1.151674,0.57845 0.02969,0.27424 0.02969,0.27423 0.02753,1.46272 0.02753,1.46273 3.663258,2.04521 3.66327,2.04521 0.40205,0.36386 0.40206,0.36385 v 3.60098 3.60097 l 0.28629,0.23408 0.28628,0.23408 1.43146,0.72479 1.43145,0.72479 v 3.9806 3.98059 l -0.51533,0.56995 -0.51532,0.56994 -3.19072,1.75191 -3.19072,1.75191 -0.47379,-0.11007 -0.473797,-0.11007 -0.699654,-0.28558 -0.699656,-0.28558 -4.589745,2.5527 -4.589746,2.55269 -0.321886,-0.004 -0.321886,-0.004 z m 8.681258,-1.65766 3.426793,-1.91645 0.06536,-0.19784 0.06535,-0.19785 -1.315884,-0.68709 -1.315885,-0.6871 -0.401264,-0.40081 -0.401265,-0.4008 v -3.79409 -3.79409 l 0.221568,-0.41401 0.221567,-0.414 3.411065,-1.86126 3.411061,-1.86126 h 0.38456 0.38455 l 0.91435,0.46646 0.91435,0.46646 -0.0646,-2.66249 -0.0646,-2.66248 -2.829977,-1.58148 -2.829984,-1.58149 -0.204696,0.12651 -0.204688,0.12651 v 1.11999 1.11999 l -0.744359,0.54975 -0.744358,0.54977 -2.773906,1.52318 -2.773906,1.52319 h -0.526565 -0.526565 l -3.34145,-1.85945 -3.341467,-1.85945 -0.168271,-0.2591 -0.16827,-0.25909 -0.0035,-1.07439 -0.0035,-1.07439 -0.204688,-0.12651 -0.204697,-0.12651 -2.82999,1.58149 -2.829982,1.58148 -0.06458,2.66248 -0.06458,2.66249 0.914351,-0.46646 0.914343,-0.46646 h 0.378551 0.37855 l 3.638639,1.97495 3.63864,1.97495 v 4.0944 4.09441 l -0.401265,0.4008 -0.401264,0.40081 -1.315885,0.6871 -1.315884,0.68709 0.06535,0.19785 0.06536,0.19784 3.426792,1.91645 3.426785,1.91644 h 0.343552 0.343544 z m -16.416873,-5.4431 -0.06475,-2.55838 -2.046125,-1.10985 -2.046124,-1.10984 -0.195677,0.19567 -0.195685,0.19568 0.06596,2.2656 0.06596,2.2656 2.06129,1.18713 2.06129,1.18713 0.179282,0.0198 0.179273,0.0198 z m 4.515881,1.34369 2.061291,-1.19456 0.06527,-2.48747 0.06527,-2.48748 -0.408821,0.15589 -0.408848,0.15589 -1.889514,1.02885 -1.889514,1.02885 v 2.50736 2.50736 l 0.171777,-0.01 0.171767,-0.01 z m 18.666131,-1.29267 v -2.50736 l -1.889509,-1.02885 -1.889522,-1.02885 -0.40883,-0.15589 -0.408839,-0.15589 0.06527,2.48748 0.06527,2.48747 2.061291,1.19456 2.061288,1.19456 0.171777,0.01 0.171774,0.01 z m 4.466127,1.28059 2.06129,-1.18713 0.0661,-2.2656 0.066,-2.2656 -0.19568,-0.19568 -0.19568,-0.19567 -2.04613,1.10984 -2.04612,1.10985 -0.0647,2.55838 -0.0648,2.55838 0.17927,-0.0198 0.17927,-0.0198 z m -24.281888,-6.71835 1.960418,-1.07415 -0.07566,-0.22693 -0.07566,-0.22691 -2.049423,-1.09443 -2.049431,-1.09442 -2.116604,1.14523 -2.116613,1.14523 v 0.17781 0.17782 l 2.004029,1.06709 2.004037,1.06711 0.277236,0.005 0.277237,0.005 z m 23.056528,4.3e-4 2.03643,-1.07372 -0.0708,-0.21245 -0.0708,-0.21244 -2.09332,-1.13015 -2.09332,-1.13016 -2.077692,1.17124 -2.077685,1.17123 v 0.17384 0.17386 l 1.889522,1.0551 1.889505,1.0551 0.31588,0.0161 0.31587,0.0161 z m -14.742004,-11.90808 0.06492,-2.2946 -0.293917,-0.23052 -0.293926,-0.2305 -2.011741,-1.08631 -2.01175,-1.08629 0.06501,2.57478 0.06501,2.57476 1.946776,1.09773 1.946767,1.09773 0.229038,-0.0611 0.229029,-0.0611 z m 4.401245,1.31989 1.946767,-1.09857 0.06501,-2.57476 0.06501,-2.57478 -2.01175,1.08629 -2.011741,1.08631 -0.286291,0.22417 -0.286291,0.22418 v 2.22411 2.2241 l 0.152689,0.15269 0.152689,0.15269 0.133602,-0.0139 0.133602,-0.0139 z m -1.021015,-6.79999 1.952048,-1.05546 -0.224347,-0.26147 -0.224337,-0.26149 -1.958921,-1.03065 -1.958911,-1.03064 -1.958912,1.03064 -1.958912,1.03065 -0.224303,0.26142 -0.224277,0.26141 1.896915,1.04261 1.896906,1.04261 0.517494,0.0129 0.517501,0.0129 z",style:{fill:"#0d6efd",fillOpacity:1,strokeWidth:.865634},id:"path1-8"}))),Ov=({title:e,version:t})=>d.jsxs("header",{className:"bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center dark:bg-slate-800 mb-3",children:[d.jsxs("div",{className:"flex flex-nowrap items-center justify-between m-2",children:[d.jsx(Lv,{className:"w-10 h-10 p-1",alt:"logo"}),d.jsxs("h1",{className:"flex items-center dark:text-white",children:[d.jsx("div",{className:"text-3xl",children:e}),d.jsxs("div",{className:"bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2 dark:bg-blue-900 dark:text-white",children:["v",t]})]})]}),d.jsxs("div",{className:"flex flex-wrap gap-1 m-2",children:[d.jsx(Pv,{className:"flex-grow justify-center dark:text-white"}),d.jsx(Nv,{className:"flex-grow justify-center dark:text-white"})]})]});let Fn=window.matchMedia("(prefers-color-scheme: dark)").matches;window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",e=>{Ki.setDark(e.matches)});const Ki={isDark:()=>Fn,setDark:e=>(Fn=e,document.body.classList.toggle("dark",Fn),Fn),toggle:()=>{Ki.setDark(!Fn)}};Ki.setDark(Fn);const Mv=e=>{let[t,n]=C.useState(!1);const r=bn(f=>f.setOtherError),l=C.useContext(ft),i=vn(f=>f.setTorrents),o=vn(f=>f.setTorrentsLoading),s=vn(f=>f.setRefreshTorrents),a=async()=>{o(!0);let f=await l.listTorrents().finally(()=>o(!1));i(f.torrents)};return s(a),C.useEffect(()=>Ms(async()=>a().then(()=>(r(null),5e3),f=>(r({text:"Error refreshing torrents",details:f}),console.error(f),5e3)),0),[]),d.jsxs("div",{className:"dark:bg-gray-900 dark:text-gray-200 min-h-screen",children:[d.jsx(Ov,{title:e.title,version:e.version}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"absolute top-0 start-0 pl-2 z-10",children:[e.menuButtons&&e.menuButtons.map((f,x)=>d.jsx("span",{children:f},x)),d.jsx(hn,{onClick:()=>n(!0),children:d.jsx(fm,{})}),d.jsx(hn,{onClick:Ki.toggle,children:d.jsx(dm,{})})]}),d.jsx(Xg,{})]}),d.jsx(Ev,{show:t,onClose:()=>n(!1)})]})},Iu=window.origin==="null"||window.origin==="http://localhost:3031"?"http://localhost:3030":"",ot=async(e,t,n,r)=>{console.log(e,t);const l=Iu+t;let i={method:e,headers:{Accept:"application/json"}};r?(i.headers={Accept:"application/json","Content-Type":"application/json"},i.body=JSON.stringify(n)):i.body=n;let o={method:e,path:t,text:""},s;try{s=await fetch(l,i)}catch{return o.text="network error",Promise.reject(o)}if(o.status=s.status,o.statusText=`${s.status} ${s.statusText}`,!s.ok){const f=await s.text();try{const x=JSON.parse(f);o.text=x.human_readable!==void 0?x.human_readable:JSON.stringify(x,null,2)}catch{o.text=f}return Promise.reject(o)}return await s.json()},_c={getStreamLogsUrl:()=>Iu+"/stream_logs",listTorrents:()=>ot("GET","/torrents"),getTorrentDetails:e=>ot("GET",`/torrents/${e}`),getTorrentStats:e=>ot("GET",`/torrents/${e}/stats/v1`),uploadTorrent:(e,t)=>{var r,l;let n="/torrents?&overwrite=true";return t!=null&&t.list_only&&(n+="&list_only=true"),(t==null?void 0:t.only_files)!=null&&(n+=`&only_files=${t.only_files.join(",")}`),(r=t==null?void 0:t.peer_opts)!=null&&r.connect_timeout&&(n+=`&peer_connect_timeout=${t.peer_opts.connect_timeout}`),(l=t==null?void 0:t.peer_opts)!=null&&l.read_write_timeout&&(n+=`&peer_read_write_timeout=${t.peer_opts.read_write_timeout}`),t!=null&&t.initial_peers&&(n+=`&initial_peers=${t.initial_peers.join(",")}`),t!=null&&t.output_folder&&(n+=`&output_folder=${t.output_folder}`),typeof e=="string"&&(n+="&is_url=true"),ot("POST",n,e)},updateOnlyFiles:(e,t)=>{let n=`/torrents/${e}/update_only_files`;return ot("POST",n,{only_files:t},!0)},pause:e=>ot("POST",`/torrents/${e}/pause`),start:e=>ot("POST",`/torrents/${e}/start`),forget:e=>ot("POST",`/torrents/${e}/forget`),delete:e=>ot("POST",`/torrents/${e}/delete`),getVersion:async()=>(await ot("GET","/")).version,getTorrentStreamUrl:(e,t)=>Iu+`/torrents/${e}/stream/${t}`},zv=()=>{let[e,t]=C.useState("");return C.useEffect(()=>Ms(()=>_c.getVersion().then(r=>{t(r);const l=`rqbit web UI - v${r}`;return document.title=l,1e4},r=>1e3),0),[]),d.jsx(ft.Provider,{value:_c,children:d.jsx(Mv,{title:"rqbit web UI",version:e})})};$o.createRoot(document.getElementById("app")).render(d.jsx(C.StrictMode,{children:d.jsx(zv,{})})); diff --git a/crates/librqbit/webui/dist/manifest.json b/crates/librqbit/webui/dist/manifest.json index a4f97cf6..107d1a3a 100644 --- a/crates/librqbit/webui/dist/manifest.json +++ b/crates/librqbit/webui/dist/manifest.json @@ -4,14 +4,14 @@ "src": "assets/logo.svg" }, "index.css": { - "file": "assets/index-144bafe5.css", + "file": "assets/index-74bd798d.css", "src": "index.css" }, "index.html": { "css": [ - "assets/index-144bafe5.css" + "assets/index-74bd798d.css" ], - "file": "assets/index-838acac9.js", + "file": "assets/index-80d6e7c6.js", "isEntry": true, "src": "index.html" } diff --git a/crates/librqbit/webui/src/api-types.ts b/crates/librqbit/webui/src/api-types.ts index 56edd05c..7d4aa19a 100644 --- a/crates/librqbit/webui/src/api-types.ts +++ b/crates/librqbit/webui/src/api-types.ts @@ -166,6 +166,7 @@ export interface RqbitAPI { listTorrents: () => Promise; getTorrentDetails: (index: number) => Promise; getTorrentStats: (index: number) => Promise; + getTorrentStreamUrl: (index: number, file_id: number) => string | null; uploadTorrent: ( data: string | File, opts?: AddTorrentOptions, diff --git a/crates/librqbit/webui/src/components/FileListInput.tsx b/crates/librqbit/webui/src/components/FileListInput.tsx index 83cf4ee7..3825b24d 100644 --- a/crates/librqbit/webui/src/components/FileListInput.tsx +++ b/crates/librqbit/webui/src/components/FileListInput.tsx @@ -1,4 +1,4 @@ -import { useMemo, useState } from "react"; +import { useContext, useMemo, useState } from "react"; import { TorrentDetails, TorrentStats } from "../api-types"; import { FormCheckbox } from "./forms/FormCheckbox"; import { CiSquarePlus, CiSquareMinus } from "react-icons/ci"; @@ -6,6 +6,7 @@ import { IconButton } from "./buttons/IconButton"; import { formatBytes } from "../helper/formatBytes"; import { ProgressBar } from "./ProgressBar"; import sortBy from "lodash.sortby"; +import { APIContext } from "../context"; type TorrentFileForCheckbox = { id: number; @@ -86,6 +87,7 @@ const newFileTree = ( }; const FileTreeComponent: React.FC<{ + torrentId?: number; tree: FileTree; torrentDetails: TorrentDetails; torrentStats: TorrentStats | null; @@ -94,7 +96,9 @@ const FileTreeComponent: React.FC<{ initialExpanded: boolean; showProgressBar?: boolean; disabled?: boolean; + allowStream?: boolean; }> = ({ + torrentId, tree, selectedFiles, setSelectedFiles, @@ -103,7 +107,9 @@ const FileTreeComponent: React.FC<{ torrentStats, showProgressBar, disabled, + allowStream, }) => { + const API = useContext(APIContext); let [expanded, setExpanded] = useState(initialExpanded); let children = useMemo(() => { let getAllChildren = (tree: FileTree): number[] => { @@ -149,6 +155,16 @@ const FileTreeComponent: React.FC<{ .reduce((a, b) => a + b, 0); }; + const fileLink = (file: TorrentFileForCheckbox) => { + if ( + allowStream && + torrentId != null && + /\.(mp4|mkv|avi)$/.test(file.filename) + ) { + return API.getTorrentStreamUrl(torrentId, file.id); + } + }; + return ( <>
@@ -170,6 +186,7 @@ const FileTreeComponent: React.FC<{