From 90d17c9d25f048e0ed7059e381de90fdc1971ec4 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:56:55 +0200 Subject: [PATCH] feat: precompute cached_bytes per entry in DB (#13) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Store how many bytes of each entry's artifacts are already on disk from an earlier entry (content-addressed blob deduplication means shared blobs are only stored once). Design ------ - Add `cached_bytes INTEGER NOT NULL DEFAULT 0` to `archived_entries` - Precompute at capture time via `database::refresh_entry_cached_bytes` called after all artifacts are saved for every capture path (web page, generic URL, tweet, yt-dlp/local) - One-time migration in `initialize_schema`: detects missing column via PRAGMA table_info, ALTERs the table, then back-fills all existing rows with the correlated subquery - `database::cascade_cached_bytes_after_delete` ready for when entry deletion is implemented; designed to run asynchronously after the delete is acknowledged to the user - `cached_bytes` included in `EntrySummary` and all four SELECT paths (list_root_entries, search_entries, list_entries_for_collection, entries_for_tag) via the shared ENTRY_SELECT_COLS constant Frontend -------- - `EntryRow` shows a `% cached` sub-line under the size when non-zero, with a tooltip showing the raw cached byte count - No separate API endpoint or extra fetch — value rides in the existing entries list response at zero extra query cost per read --- crates/archivr-core/src/archive.rs | 15 ++- crates/archivr-core/src/capture.rs | 12 +- crates/archivr-core/src/database.rs | 111 +++++++++++++++++- .../static/assets/index-DXhicc6w.css | 1 + .../{index-BEbGvi2K.js => index-DnX_j2fa.js} | 16 +-- .../static/assets/index-MrdP6h9x.css | 1 - crates/archivr-server/static/index.html | 4 +- frontend/src/App.jsx | 2 +- frontend/src/components/EntryRow.jsx | 9 +- frontend/src/styles.css | 11 +- 10 files changed, 161 insertions(+), 21 deletions(-) create mode 100644 crates/archivr-server/static/assets/index-DXhicc6w.css rename crates/archivr-server/static/assets/{index-BEbGvi2K.js => index-DnX_j2fa.js} (65%) delete mode 100644 crates/archivr-server/static/assets/index-MrdP6h9x.css diff --git a/crates/archivr-core/src/archive.rs b/crates/archivr-core/src/archive.rs index 0961830..0c02bc9 100644 --- a/crates/archivr-core/src/archive.rs +++ b/crates/archivr-core/src/archive.rs @@ -28,6 +28,8 @@ pub struct EntrySummary { pub parent_entry_uid: Option, /// True if a `favicon` artifact exists for this entry. pub has_favicon: bool, + /// Bytes of blobs already on disk from an earlier entry (precomputed at capture time). + pub cached_bytes: i64, } #[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)] @@ -206,7 +208,8 @@ pub fn list_root_entries(conn: &rusqlite::Connection, caller_bits: u32) -> Resul COUNT(ea.id) AS artifact_count, COALESCE(SUM(b.byte_size), 0) AS total_artifact_bytes, NULL AS parent_entry_uid, - EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon + EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon, + e.cached_bytes FROM archived_entries e JOIN source_identities si ON si.id = e.source_identity_id LEFT JOIN entry_artifacts ea ON ea.entry_id = e.id @@ -238,6 +241,7 @@ pub fn list_root_entries(conn: &rusqlite::Connection, caller_bits: u32) -> Resul total_artifact_bytes: row.get(8)?, parent_entry_uid: row.get(9)?, has_favicon: row.get::<_, i64>(10)? != 0, + cached_bytes: row.get(11)?, }) })? .collect::>>()?; @@ -425,6 +429,7 @@ pub fn list_entries_for_collection( total_artifact_bytes: row.get(8)?, parent_entry_uid: row.get(9)?, has_favicon: row.get::<_, i64>(10)? != 0, + cached_bytes: row.get(11)?, }) })? .collect::>>()?; @@ -539,7 +544,8 @@ const ENTRY_SELECT_COLS: &str = e.visibility, si.canonical_url, COUNT(ea.id) AS artifact_count, \ COALESCE(SUM(b.byte_size), 0) AS total_artifact_bytes, \ parent.entry_uid AS parent_entry_uid, \ - EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon"; + EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon, \ + e.cached_bytes"; const ENTRY_FROM_JOINS: &str = "FROM archived_entries e \ @@ -649,6 +655,7 @@ pub fn search_entries( total_artifact_bytes: row.get(8)?, parent_entry_uid: row.get(9)?, has_favicon: row.get::<_, i64>(10)? != 0, + cached_bytes: row.get(11)?, }) })? .collect::>>()?; @@ -810,7 +817,8 @@ pub fn entries_for_tag( e.visibility, si.canonical_url, COUNT(ea.id) AS artifact_count, COALESCE(SUM(b.byte_size), 0) AS total_artifact_bytes, parent.entry_uid AS parent_entry_uid, - EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon + EXISTS(SELECT 1 FROM entry_artifacts fav WHERE fav.entry_id = e.id AND fav.artifact_role = 'favicon') AS has_favicon, + e.cached_bytes FROM archived_entries e JOIN source_identities si ON si.id = e.source_identity_id LEFT JOIN entry_artifacts ea ON ea.entry_id = e.id @@ -835,6 +843,7 @@ pub fn entries_for_tag( total_artifact_bytes: row.get(8)?, parent_entry_uid: row.get(9)?, has_favicon: row.get::<_, i64>(10)? != 0, + cached_bytes: row.get(11)?, }) })? .collect::>>()?; diff --git a/crates/archivr-core/src/capture.rs b/crates/archivr-core/src/capture.rs index c2345d7..ff6e0a6 100644 --- a/crates/archivr-core/src/capture.rs +++ b/crates/archivr-core/src/capture.rs @@ -751,7 +751,7 @@ pub fn perform_capture( let _ = fs::remove_dir_all(store_path.join("temp").join(×tamp)); } - record_media_entry( + let entry = record_media_entry( &conn, store_path, user_id, @@ -765,6 +765,7 @@ pub fn perform_capture( byte_size, title_hint, )?; + database::refresh_entry_cached_bytes(&conn, entry.id)?; database::finish_archive_run(&conn, run.id)?; return Ok(CaptureResult { run_uid: run.run_uid.clone(), @@ -904,6 +905,9 @@ pub fn perform_capture( } } + // 7. Store how many bytes this entry gets "for free" from earlier entries. + database::refresh_entry_cached_bytes(&conn, entry.id)?; + database::finish_archive_run(&conn, run.id)?; return Ok(CaptureResult { run_uid: run.run_uid.clone(), @@ -942,7 +946,7 @@ pub fn perform_capture( ×tamp, ) { Ok(_) => { - record_tweet_entry( + let tweet_entry = record_tweet_entry( &conn, store_path, user_id, @@ -952,6 +956,7 @@ pub fn perform_capture( source, &tweet_id, )?; + database::refresh_entry_cached_bytes(&conn, tweet_entry.id)?; database::finish_archive_run(&conn, run.id)?; return Ok(CaptureResult { run_uid: run.run_uid.clone(), @@ -1042,7 +1047,7 @@ pub fn perform_capture( let _ = fs::remove_dir_all(store_path.join("temp").join(×tamp)); } - record_media_entry( + let media_entry = record_media_entry( &conn, store_path, user_id, @@ -1056,6 +1061,7 @@ pub fn perform_capture( byte_size, None, // title — populated in a later task )?; + database::refresh_entry_cached_bytes(&conn, media_entry.id)?; database::finish_archive_run(&conn, run.id)?; Ok(CaptureResult { diff --git a/crates/archivr-core/src/database.rs b/crates/archivr-core/src/database.rs index d690070..96f233c 100644 --- a/crates/archivr-core/src/database.rs +++ b/crates/archivr-core/src/database.rs @@ -251,7 +251,8 @@ pub fn initialize_schema(conn: &Connection) -> Result<()> { structured_root_relpath TEXT NOT NULL, representation_kind TEXT NOT NULL, source_metadata_json TEXT NOT NULL DEFAULT '{}', - display_metadata_json TEXT + display_metadata_json TEXT, + cached_bytes INTEGER NOT NULL DEFAULT 0 ); CREATE TABLE IF NOT EXISTS blobs ( @@ -350,6 +351,38 @@ pub fn initialize_schema(conn: &Connection) -> Result<()> { FROM archived_entries ae; "#, )?; + + // Migration: add cached_bytes column to existing databases. + // New databases already have it from the DDL above; the column check is + // the idiomatic SQLite way to run a migration exactly once. + let column_exists: bool = conn.query_row( + "SELECT COUNT(*) FROM pragma_table_info('archived_entries') WHERE name = 'cached_bytes'", + [], + |row| row.get::<_, i64>(0), + )? > 0; + if !column_exists { + conn.execute_batch( + "ALTER TABLE archived_entries ADD COLUMN cached_bytes INTEGER NOT NULL DEFAULT 0; + UPDATE archived_entries + SET cached_bytes = ( + SELECT COALESCE(SUM(b.byte_size), 0) + FROM entry_artifacts ea + JOIN blobs b ON b.id = ea.blob_id + WHERE ea.entry_id = archived_entries.id + AND ea.blob_id IS NOT NULL + AND EXISTS ( + SELECT 1 + FROM entry_artifacts ea2 + JOIN archived_entries e2 ON e2.id = ea2.entry_id + WHERE ea2.blob_id = ea.blob_id + AND (e2.archived_at < archived_entries.archived_at + OR (e2.archived_at = archived_entries.archived_at + AND e2.id < archived_entries.id)) + ) + );", + )?; + } + Ok(()) } @@ -1191,6 +1224,82 @@ pub fn upsert_source_identity( Ok(id) } +/// Computes and stores `cached_bytes` for a single entry. +/// +/// Must be called after all artifacts for the entry have been inserted so the +/// correlated subquery sees the complete artifact set. Ordering by `archived_at` +/// (tiebreak: `id`) matches the display ordering used in listings. +pub fn refresh_entry_cached_bytes(conn: &Connection, entry_id: i64) -> Result<()> { + let cached: i64 = conn.query_row( + "SELECT COALESCE(SUM(b.byte_size), 0) + FROM entry_artifacts ea + JOIN blobs b ON b.id = ea.blob_id + JOIN archived_entries e ON e.id = ea.entry_id + WHERE ea.entry_id = ?1 + AND ea.blob_id IS NOT NULL + AND EXISTS ( + SELECT 1 + FROM entry_artifacts ea2 + JOIN archived_entries e2 ON e2.id = ea2.entry_id + WHERE ea2.blob_id = ea.blob_id + AND (e2.archived_at < e.archived_at + OR (e2.archived_at = e.archived_at AND e2.id < ?1)) + )", + [entry_id], + |row| row.get(0), + )?; + conn.execute( + "UPDATE archived_entries SET cached_bytes = ?1 WHERE id = ?2", + params![cached, entry_id], + )?; + Ok(()) +} + +/// Recomputes `cached_bytes` for entries that shared blobs with `entry_id` and +/// were archived after it. +/// +/// Must be called **before** the entry row is deleted so that the shared-blob +/// lookup still works. The inner EXISTS deliberately excludes `entry_id` so each +/// affected entry is recomputed as if that entry no longer exists. +/// +/// Intended to be dispatched asynchronously: acknowledge the delete to the user +/// first, then call this on a background thread. +pub fn cascade_cached_bytes_after_delete(conn: &Connection, entry_id: i64) -> Result<()> { + conn.execute( + "UPDATE archived_entries + SET cached_bytes = ( + SELECT COALESCE(SUM(b.byte_size), 0) + FROM entry_artifacts ea + JOIN blobs b ON b.id = ea.blob_id + WHERE ea.entry_id = archived_entries.id + AND ea.blob_id IS NOT NULL + AND EXISTS ( + SELECT 1 + FROM entry_artifacts ea3 + JOIN archived_entries e3 ON e3.id = ea3.entry_id + WHERE ea3.blob_id = ea.blob_id + AND e3.id != ?1 + AND (e3.archived_at < archived_entries.archived_at + OR (e3.archived_at = archived_entries.archived_at + AND e3.id < archived_entries.id)) + ) + ) + WHERE id IN ( + SELECT DISTINCT ea2.entry_id + FROM entry_artifacts ea_del + JOIN entry_artifacts ea2 ON ea2.blob_id = ea_del.blob_id + JOIN archived_entries e_del ON e_del.id = ea_del.entry_id + JOIN archived_entries e2 ON e2.id = ea2.entry_id + WHERE ea_del.entry_id = ?1 + AND ea2.entry_id != ?1 + AND (e2.archived_at > e_del.archived_at + OR (e2.archived_at = e_del.archived_at AND e2.id > ?1)) + )", + [entry_id], + )?; + Ok(()) +} + pub fn upsert_blob(conn: &Connection, blob: &BlobRecord) -> Result { conn.execute( "INSERT OR IGNORE INTO blobs ( diff --git a/crates/archivr-server/static/assets/index-DXhicc6w.css b/crates/archivr-server/static/assets/index-DXhicc6w.css new file mode 100644 index 0000000..53412ef --- /dev/null +++ b/crates/archivr-server/static/assets/index-DXhicc6w.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Spectral:wght@500;600&display=swap";:root{color-scheme:light;--ink: #20251f;--muted: #6b6f66;--muted-2: #8a8d83;--paper: #f5f0e7;--paper-2: #e9e1d2;--paper-3: #fffaf0;--line: #d2c6b5;--line-soft: #e5dccd;--accent: #8d3f30;--accent-2: #b78342;--link: #245f72;--top: #141d18;--field: #fffdf7;--r: 3px;--r2: 6px;--r3: 10px;--sans: "Helvetica Neue", Helvetica, Arial, sans-serif;--serif: "Spectral", Georgia, "Times New Roman", serif;--display: "Cormorant Garamond", Georgia, serif}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:14px;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}button,input,select{font:inherit}.workspace,.context-rail{scrollbar-width:thin;scrollbar-color:var(--line) transparent}.workspace::-webkit-scrollbar,.context-rail::-webkit-scrollbar{width:11px;height:11px}.workspace::-webkit-scrollbar-track,.context-rail::-webkit-scrollbar-track{background:transparent}.workspace::-webkit-scrollbar-thumb,.context-rail::-webkit-scrollbar-thumb{background:var(--line);border-radius:999px;border:3px solid transparent;background-clip:padding-box}.workspace::-webkit-scrollbar-thumb:hover,.context-rail::-webkit-scrollbar-thumb:hover{background:var(--muted-2);background-clip:padding-box;border:3px solid transparent}.topbar{height:58px;display:grid;grid-template-columns:auto auto 1fr auto auto;align-items:center;gap:26px;padding:0 22px;background:var(--top);color:#efe6d6;border-bottom:3px solid var(--accent)}.brand{font-family:var(--display);font-weight:600;font-size:30px;line-height:1;letter-spacing:.01em;color:#f4ead8}.switcher{position:relative;display:inline-flex;align-items:center}.switcher select{-moz-appearance:none;appearance:none;-webkit-appearance:none;border:1px solid rgba(247,238,223,.2);background:#f7eedf0f;color:#f1e8d8;font-family:var(--sans);font-weight:550;font-size:13.5px;letter-spacing:.04em;padding:8px 32px 8px 15px;cursor:pointer;border-radius:6px;transition:background .15s ease,border-color .15s ease}.switcher select:hover{background:#f7eedf1c;border-color:#f7eedf57}.switcher:after{content:"";position:absolute;right:15px;top:50%;width:6px;height:6px;margin-top:-5px;border-right:1.2px solid #b6ab98;border-bottom:1.2px solid #b6ab98;transform:rotate(45deg);pointer-events:none}.nav{display:flex;gap:22px;justify-content:flex-end;min-width:0}.nav-link{border:0;background:transparent;color:#cdc1ad;cursor:pointer;padding:6px 0;font-size:12.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;position:relative}.nav-link:hover,.nav-link.is-active{color:#f4ead8}.nav-link.is-active:after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:1px;background:var(--accent-2)}.capture-button{display:inline-flex;align-items:center;gap:8px;position:relative;overflow:hidden;border:0;background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 88%,#fff) 0%,var(--accent) 55%);color:#f7eddd;padding:10px 18px;cursor:pointer;font-size:12px;font-weight:600;letter-spacing:.15em;text-transform:uppercase;border-radius:var(--r);box-shadow:inset 0 1px #fff5e629,0 1px 2px #141d184d;transition:filter .18s ease,box-shadow .18s ease}.capture-button:hover{filter:brightness(.93);box-shadow:inset 0 1px #fff5e61f,0 2px 6px #141d1857}.capture-button:before{content:"";position:absolute;top:0;bottom:0;left:0;width:45%;background:linear-gradient(100deg,transparent 0%,rgba(255,246,232,.45) 50%,transparent 100%);transform:translate(-180%) skew(-18deg);pointer-events:none}@media (prefers-reduced-motion: no-preference){.capture-button:hover:before{animation:cap-sheen .7s ease}}@keyframes cap-sheen{0%{transform:translate(-180%) skew(-18deg)}to{transform:translate(340%) skew(-18deg)}}.app-shell{height:calc(100vh - 58px);display:grid;grid-template-columns:minmax(0,1fr) 340px}.workspace{min-width:0;overflow:auto;display:flex;flex-direction:column}.view{display:none}.view.is-active{display:block}.toolbar{position:sticky;top:0;z-index:3;display:flex;align-items:center;gap:16px;padding:12px 22px;background:color-mix(in srgb,var(--paper) 88%,white);border-bottom:1px solid var(--line-soft)}.search-field{position:relative;flex:1 1 auto;min-width:0;display:flex;align-items:center;height:42px;background:var(--field);border:1px solid var(--line);border-radius:20px;transition:border-color .15s ease,box-shadow .15s ease}.search-field:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent)}.search-field .ico{display:grid;place-items:center;width:46px;height:100%;color:var(--muted-2);flex-shrink:0}.search-field .ico svg{width:16px;height:16px}.search-input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--ink);padding:0 6px 0 0;font-size:14px;letter-spacing:.01em;outline:none}.search-input::placeholder{color:var(--muted-2)}.search-field .kbd{margin-right:12px;display:inline-flex;align-items:center;padding:3px 7px;font-size:11px;color:var(--muted);background:var(--paper-2);border:1px solid var(--line-soft);border-radius:var(--r);flex-shrink:0}.result-count{flex-shrink:0;font-size:13px;color:var(--muted);letter-spacing:.02em;white-space:nowrap}.result-count b{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}.tag-filter-badge{display:inline-flex;align-items:center;gap:4px;background:var(--accent);color:#fff;border:0;border-radius:var(--r);font-size:12px;padding:2px 8px;cursor:pointer;margin-left:8px}.tag-filter-badge:hover{opacity:.85}.entry-table{width:100%;font-size:12.5px}.entry-header-row{display:flex;align-items:stretch;position:sticky;top:67px;z-index:2;background:color-mix(in srgb,var(--paper) 92%,white);border-bottom:1px solid var(--line-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em}.entry-header-row>div{padding:9px 10px;flex-shrink:0;font-weight:600;display:flex;align-items:center}#entries-body>div{display:flex;align-items:center;cursor:default;border-bottom:1px solid var(--line-soft)}#entries-body>div>div{padding:7px 10px;flex-shrink:0;overflow:hidden}#entries-body>div:nth-child(2n){background:#f2ede5}#entries-body>div:nth-child(odd){background:var(--paper-3)}#entries-body>div.is-selected{background:#eee2d2;outline:2px solid var(--accent);outline-offset:-2px}.col-added{width:162px;color:var(--muted)}.col-title{flex:1 1 0;min-width:0;overflow:hidden;display:flex;align-items:center;gap:.42em}.col-type{width:116px}.col-size{width:100px;display:flex;flex-direction:column;justify-content:center;gap:1px}.size-total{font-variant-numeric:tabular-nums}.size-cached-pct{font-size:10px;color:var(--muted);opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.col-url{flex:0 0 30%;min-width:0;overflow:hidden}.entry-header-row>div:first-child,#entries-body>div>div:first-child{padding-left:22px}.entry-header-row>div:last-child,#entries-body>div>div:last-child{padding-right:22px}.entry-title{color:var(--link);font-weight:700;min-width:0}.entry-header-row>div{padding:9px 10px;flex-shrink:0;font-weight:600}.source-icon{display:flex;align-items:center;justify-content:center;width:1.05em;height:1.05em;flex-shrink:0}.source-icon>*{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.source-icon svg{width:100%;height:100%}.url-cell{color:#555b55;word-break:break-all}.type-pill{display:inline-block;padding:2px 6px;background:#d8e3df;color:#275a5f;border:1px solid #bfd0ca;border-radius:var(--r)}#runs-view .entry-table{border-collapse:collapse;table-layout:auto}#runs-view .entry-table th{position:sticky;top:0;z-index:1;text-align:left;padding:10px;background:color-mix(in srgb,var(--paper) 92%,white);color:var(--muted);border-bottom:1px solid var(--line-soft);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em}#runs-view .entry-table td{padding:10px;border-bottom:1px solid var(--line-soft);vertical-align:top}#runs-view .entry-table tr:nth-child(2n) td{background:#f2ede5}#runs-view .entry-table tr:nth-child(odd) td{background:var(--paper-3)}.context-rail{border-left:1px solid var(--line);background:var(--paper);padding:20px 20px 32px;overflow:auto}.rail-eyebrow{font-size:10.5px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;color:var(--muted-2);margin-bottom:16px}.rail-title{display:block;font-family:var(--sans);font-weight:700;font-size:15.5px;line-height:1.4;color:var(--ink);margin:0 0 16px;word-break:break-word}.url-tile{display:flex;align-items:center;gap:9px;padding:10px 12px;background:var(--paper-3);border:1px solid var(--line);border-radius:var(--r3);margin-bottom:20px;text-decoration:none}.url-tile:hover{background:var(--field);border-color:var(--accent)}.url-tile .ico{color:var(--ink);flex-shrink:0;display:grid;place-items:center}.url-tile .ico svg{width:15px;height:15px}.url-tile .u-text{min-width:0;flex:1;font-size:12.5px;color:var(--link);font-family:ui-monospace,SF Mono,Menlo,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.url-tile .ext{color:var(--muted-2);flex-shrink:0}.url-tile .ext svg{width:13px;height:13px;display:block}.meta-list{margin-bottom:24px;border-top:1px solid var(--line-soft)}.meta-item{display:grid;grid-template-columns:92px 1fr;gap:14px;align-items:baseline;padding:9px 0;border-bottom:1px solid var(--line-soft)}.meta-k{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-2)}.meta-v{font-size:13.5px;color:var(--ink);word-break:break-word;line-height:1.4}.meta-v.mono{font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px;color:var(--muted)}.rail-section{margin-bottom:24px}.rail-section-heading{display:flex;align-items:baseline;gap:8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--muted-2);margin-bottom:9px;padding-bottom:8px;border-bottom:1px solid var(--line)}.rail-section-heading .num{color:var(--muted-2);font-weight:600}.artifact-list{list-style:none;margin:0;padding:0}.artifact-link{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:7px 2px;border-bottom:1px solid var(--line-soft);text-decoration:none}.artifact-link:last-child{border-bottom:0}.artifact-name{font-size:13px;color:var(--link);min-width:0;word-break:break-word}.artifact-link:hover .artifact-name{text-decoration:underline}.artifact-size{font-size:11.5px;color:var(--muted-2);flex-shrink:0;font-variant-numeric:tabular-nums}.tags-wrap{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 12px}.tag-pill{display:inline-flex;align-items:center;gap:7px;background:var(--paper-2);border:1px solid var(--line);border-radius:var(--r);font-size:12px;padding:4px 7px 4px 10px;color:var(--ink)}.tag-pill .remove{border:0;background:transparent;cursor:pointer;color:var(--muted-2);width:15px;height:15px;display:grid;place-items:center;font-size:13px;line-height:1}.tag-pill .remove:hover{color:var(--accent)}.tags-empty{font-size:13px;color:var(--muted);margin:0 0 11px}.tag-input-wrap{display:flex;align-items:center;gap:8px;background:var(--field);border:1px solid var(--line);border-radius:var(--r2);padding:2px 2px 2px 11px;transition:border-color .15s ease,box-shadow .15s ease}.tag-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent)}.tag-input-wrap .hash{color:var(--muted-2);font-size:13px}.tag-input{flex:1;min-width:0;border:0;background:transparent;color:var(--ink);font-size:13px;padding:6px 0;outline:none;font-family:ui-monospace,SF Mono,Menlo,monospace}.tag-add-btn{border:0;background:var(--ink);color:var(--paper-3);padding:6px 13px;font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;border-radius:var(--r);cursor:pointer;white-space:nowrap}.tag-add-btn:hover{background:#2c332b}.coll-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 13px;background:var(--field);border:1px solid var(--line);border-radius:var(--r2);margin-bottom:6px;transition:border-color .15s ease}.coll-row:hover{border-color:var(--accent)}.coll-name{font-size:13px;color:var(--ink);font-weight:500}.vis-badge{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);background:var(--paper-2);border:1px solid var(--line-soft);border-radius:999px;padding:3px 10px}.vis-badge:before{content:"";width:6px;height:6px;border-radius:50%;background:var(--accent-2)}.capture-dialog{border:1px solid var(--line);background:var(--paper);padding:0;min-width:360px;max-width:520px;border-radius:var(--r3);box-shadow:0 20px 60px #141d1847}.capture-dialog::backdrop{background:#141d1873}.capture-dialog-inner{padding:28px}.capture-dialog-title{margin:0 0 16px;font-size:22px;font-family:var(--display);font-weight:600}.capture-label{display:block;font-size:11px;font-weight:600;margin-bottom:6px;color:var(--muted-2);text-transform:uppercase;letter-spacing:.06em}.capture-input{width:100%;height:44px;border:1px solid var(--line);background:var(--field);color:var(--ink);padding:0 14px;font-size:15px;margin-bottom:10px;border-radius:var(--r2);outline:none;transition:border-color .15s ease,box-shadow .15s ease}.capture-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent)}.form-field .capture-input{margin-bottom:0}.capture-error{color:var(--accent);font-size:13px;margin-bottom:10px;min-height:18px}.capture-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px}.capture-cancel{border:1px solid var(--line);background:none;color:var(--ink);padding:8px 18px;border-radius:var(--r);cursor:pointer}.capture-cancel:hover{background:var(--paper-2)}.capture-submit{border:0;background:var(--ink);color:var(--paper);padding:8px 20px;border-radius:var(--r);cursor:pointer;font-weight:600}.capture-submit:hover{opacity:.85}.capture-submit:disabled{opacity:.45;cursor:default}.muted{color:var(--muted)}.admin-view{padding:22px}.admin-list{display:grid;gap:10px;max-width:780px}.admin-archive{border:1px solid var(--line);background:var(--paper-3);padding:12px;border-radius:var(--r2)}.tag-tree{padding:20px 22px;max-width:320px}.tag-tree-header{display:flex;align-items:baseline;gap:10px;margin-bottom:14px;border-bottom:1px solid var(--line-soft);padding-bottom:10px}.tag-tree-title{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.07em}.tag-tree-active{font-size:12px;color:var(--muted-2);font-style:italic}.tag-tree-list{list-style:none;margin:0;padding:0}.tag-children{padding-left:16px}.tag-node-btn{border:0;background:transparent;color:var(--link);cursor:pointer;padding:3px 0;text-align:left;font-size:13px;display:block;width:100%}.tag-node-btn:hover{text-decoration:underline}.tag-node-btn.is-active{font-weight:600;color:var(--ink)}.collections-view{padding:24px}.collections-heading{margin:0 0 16px;font-size:22px;font-family:var(--display);font-weight:600}.collections-error{color:var(--accent);font-size:13px;margin-bottom:8px}.coll-dismiss{background:none;border:none;cursor:pointer;color:var(--accent);font-size:16px;line-height:1;padding:0 4px}.collections-layout{display:grid;grid-template-columns:220px 1fr;gap:0;border:1px solid var(--line);border-radius:var(--r2);min-height:340px}.collections-sidebar{border-right:1px solid var(--line);overflow-y:auto}.coll-sidebar-row{display:flex;flex-direction:column;width:100%;padding:10px 14px;border:none;border-bottom:1px solid var(--line-soft);background:none;cursor:pointer;text-align:left;gap:2px}.coll-sidebar-row:hover{background:var(--paper-2)}.coll-sidebar-row.is-active{background:var(--paper-2);border-left:3px solid var(--accent)}.coll-row-name{font-size:14px;font-weight:600;color:var(--ink)}.coll-row-meta{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.coll-detail{padding:20px 24px;display:flex;flex-direction:column;gap:16px}.coll-detail--empty{justify-content:center;align-items:center}.coll-detail-header{display:flex;align-items:center;gap:12px}.coll-detail-name{margin:0;font-size:18px;font-family:var(--display);font-weight:600;flex:1}.coll-detail-name--editable{cursor:pointer}.coll-detail-name--editable:hover{color:var(--link)}.coll-edit-hint{font-size:14px;opacity:.5;margin-left:4px}.coll-rename-input{flex:1;font-size:16px;font-family:var(--display);border:1px solid var(--line);padding:4px 8px;background:var(--field);color:var(--ink);border-radius:var(--r)}.coll-delete-btn{border:1px solid var(--accent);background:none;color:var(--accent);padding:5px 12px;font-size:13px;cursor:pointer;border-radius:var(--r)}.coll-delete-btn:hover{background:var(--accent);color:var(--paper)}.coll-detail-vis{display:flex;align-items:center;gap:10px}.coll-vis-label{font-size:13px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}.coll-vis-select{border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:4px 8px;font-size:13px;border-radius:var(--r)}.coll-section-heading{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:8px}.coll-entries-section{flex:1}.coll-entries-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.coll-entry-row{display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid var(--line-soft)}.coll-entry-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.coll-entry-title{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.coll-entry-kind{font-size:11px;text-transform:uppercase;letter-spacing:.04em}.coll-entry-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.coll-entry-vis-select{border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:3px 6px;font-size:12px;border-radius:var(--r)}.coll-entry-remove{border:none;background:none;cursor:pointer;color:var(--muted);font-size:18px;line-height:1;padding:0 4px}.coll-entry-remove:hover{color:var(--accent)}.coll-add-entry-form{border-top:1px solid var(--line-soft);padding-top:12px}.coll-add-entry-row{display:flex;gap:8px;align-items:center}.coll-add-entry-input{flex:1;border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:6px 10px;font-size:13px;min-width:0;border-radius:var(--r)}.coll-add-btn{border:none;background:var(--ink);color:var(--paper);padding:6px 14px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;border-radius:var(--r)}.coll-add-btn:hover{opacity:.85}.coll-add-btn:disabled{opacity:.45;cursor:default}.auth-loading{min-height:100vh;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:15px;background:var(--paper)}.user-menu{display:flex;align-items:center;gap:14px;padding-left:6px;flex-shrink:0}.user-name{font-size:12.5px;color:var(--muted-2);letter-spacing:.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:140px}.logout-btn{border:1px solid rgba(255,255,255,.18);background:transparent;color:#c8bfb0;font-size:12px;padding:4px 11px;border-radius:var(--r);cursor:pointer;white-space:nowrap;transition:background .15s,color .15s}.logout-btn:hover{background:#ffffff1a;color:var(--paper)}.logout-btn:disabled{opacity:.5;cursor:default}.login-page,.setup-page{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--paper)}.login-card,.setup-card{width:100%;max-width:360px;padding:40px 36px 44px;background:var(--paper-3);border:1px solid var(--line);border-radius:var(--r3);box-shadow:0 2px 20px #141d1812}.login-brand,.setup-brand{font-family:var(--display);font-size:32px;font-weight:600;color:var(--ink);letter-spacing:-.01em;margin:0 0 6px}.login-tagline,.setup-tagline{font-size:13px;color:var(--muted);margin:0 0 28px}.login-field,.setup-field{display:flex;flex-direction:column;gap:5px;margin-bottom:14px}.login-label,.setup-label{font-size:11.5px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.login-input,.setup-input{width:100%;border:1px solid var(--line);background:var(--field);color:var(--ink);padding:9px 11px;font-size:14px;border-radius:var(--r2);outline:none;transition:border-color .15s}.login-input:focus,.setup-input:focus{border-color:var(--accent)}.login-error,.setup-error{font-size:13px;color:var(--accent);margin:4px 0 8px}.login-submit,.setup-submit{width:100%;margin-top:8px;border:none;background:var(--top);color:var(--paper);font-size:14px;font-weight:600;padding:11px 16px;border-radius:var(--r2);cursor:pointer;letter-spacing:.02em;transition:opacity .15s}.login-submit:hover,.setup-submit:hover{opacity:.85}.login-submit:disabled,.setup-submit:disabled{opacity:.45;cursor:default}.view-tabs{display:flex;gap:2px;margin-bottom:22px;border-bottom:1px solid var(--line-soft);padding-bottom:0}.view-tab{border:none;background:none;color:var(--muted);font-size:13px;font-weight:600;padding:7px 14px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;letter-spacing:.02em;transition:color .12s;text-transform:uppercase;letter-spacing:.06em;font-size:11.5px}.view-tab:hover{color:var(--ink)}.view-tab.is-active{color:var(--ink);border-bottom-color:var(--accent)}.form-section{margin-bottom:32px}.form-section h2{font-size:14px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:0 0 14px}.form-row{display:flex;gap:8px;margin-bottom:10px}.form-field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px}.form-label{font-size:11.5px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}.field-input{border:1px solid var(--line);background:var(--field);color:var(--ink);padding:8px 10px;font-size:13.5px;border-radius:var(--r);outline:none;transition:border-color .15s;min-width:0}.field-input:focus{border-color:var(--accent)}.field-input--flex{flex:1}.form-msg{font-size:13px;margin:6px 0}.form-msg--ok{color:var(--link)}.form-msg--err{color:var(--accent)}.btn-primary{border:none;background:var(--top);color:var(--paper);font-size:13px;font-weight:600;padding:8px 16px;border-radius:var(--r);cursor:pointer;white-space:nowrap}.btn-primary:hover{opacity:.85}.btn-primary:disabled{opacity:.45;cursor:default}.btn-ghost{border:1px solid var(--line);background:none;color:var(--ink);font-size:13px;padding:7px 14px;border-radius:var(--r);cursor:pointer}.btn-ghost:hover{background:var(--paper-2)}.btn-danger{border:1px solid var(--accent);background:none;color:var(--accent);font-size:13px;padding:7px 14px;border-radius:var(--r);cursor:pointer}.btn-danger:hover{background:var(--accent);color:var(--paper)}.admin-view h1{font-family:var(--display);font-weight:600;font-size:26px;margin:0 0 20px}.admin-table{width:100%;border-collapse:collapse;font-size:13px;margin-bottom:28px}.admin-table th{text-align:left;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 10px;border-bottom:1px solid var(--line);background:var(--paper-2)}.admin-table th:first-child{padding-left:16px}.admin-table td{padding:9px 10px;border-bottom:1px solid var(--line-soft);color:var(--ink);vertical-align:middle}.admin-table td:first-child{padding-left:16px}.admin-table tr:hover td{background:var(--paper-2)}.admin-row-disabled td{opacity:.45}.admin-section{margin-bottom:36px;max-width:860px}.admin-section h2{font-size:14px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:0 0 14px}.admin-section h3{font-size:13px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:22px 0 10px}.admin-form{display:flex;flex-direction:column;gap:8px;max-width:480px}.admin-input{border:1px solid var(--line);background:var(--field);color:var(--ink);padding:8px 10px;font-size:13.5px;border-radius:var(--r);outline:none;transition:border-color .15s}.admin-input:focus{border-color:var(--accent)}.admin-action-btn{border:1px solid var(--line);background:none;color:var(--ink);font-size:12px;padding:4px 10px;border-radius:var(--r);cursor:pointer;white-space:nowrap}.admin-action-btn:hover{border-color:var(--accent);color:var(--accent)}.status-badge{display:inline-block;padding:2px 8px;border-radius:var(--r);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.status-active{background:#d8eddf;color:#235c35;border:1px solid #b4d9be}.status-disabled{background:#ede8e0;color:var(--muted);border:1px solid var(--line)}.run-status{display:inline-block;padding:2px 8px;border-radius:var(--r);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.run-status--completed{background:#d8eddf;color:#235c35;border:1px solid #b4d9be}.run-status--failed{background:#f5ddd8;color:#8d3f30;border:1px solid #e0b8b0}.run-status--running{background:#dde8f5;color:#245f72;border:1px solid #b8cde0}.token-banner{background:#d8eddf;border:1px solid #b4d9be;padding:12px 14px;margin-bottom:16px;font-size:13px;border-radius:var(--r2)}.token-banner code{word-break:break-all;display:block;margin-top:6px;padding:6px 8px;background:var(--field);border:1px solid var(--line);border-radius:var(--r);font-size:12px;font-family:ui-monospace,SF Mono,Menlo,monospace}.token-dismiss{margin-top:8px;font-size:12px;border:1px solid var(--line);background:none;cursor:pointer;padding:3px 8px;border-radius:var(--r);color:var(--muted)}.token-dismiss:hover{background:var(--paper-2)}.token-row{display:flex;align-items:center;justify-content:space-between;border:1px solid var(--line);background:var(--paper-3);padding:10px 12px;border-radius:var(--r);margin-bottom:6px}.token-row-info strong{font-size:14px;display:block}.token-row-info .muted{font-size:12px;margin-top:2px}.token-create-row{display:flex;gap:8px;margin-bottom:16px}.checkbox-row{display:flex;align-items:center;gap:10px;margin-bottom:12px;cursor:pointer;font-size:14px}.checkbox-row input[type=checkbox]{width:15px;height:15px;accent-color:var(--accent)}.coll-create-details{margin-top:16px}.coll-create-details summary{font-weight:600;cursor:pointer;font-size:13px;color:var(--link);list-style:none;display:flex;align-items:center;gap:6px;padding:8px 12px;border:1px solid var(--line-soft);border-radius:var(--r2);background:var(--paper-3);width:fit-content}.coll-create-details summary:hover{background:var(--paper-2)}.coll-create-details[open] summary{border-bottom-left-radius:0;border-bottom-right-radius:0}.coll-create-form{border:1px solid var(--line-soft);border-top:none;padding:14px;border-radius:0 0 var(--r2) var(--r2);background:var(--paper-3);display:flex;flex-direction:column;gap:10px;max-width:440px}@media (max-width: 900px){.topbar{grid-template-columns:1fr auto;height:auto;min-height:58px;padding:12px}.switcher,.nav{grid-column:1 / -1}.nav{justify-content:flex-start;overflow-x:auto}.app-shell{height:auto;grid-template-columns:1fr}.context-rail{border-left:0;border-top:1px solid var(--line)}.entry-table{min-width:860px}} diff --git a/crates/archivr-server/static/assets/index-BEbGvi2K.js b/crates/archivr-server/static/assets/index-DnX_j2fa.js similarity index 65% rename from crates/archivr-server/static/assets/index-BEbGvi2K.js rename to crates/archivr-server/static/assets/index-DnX_j2fa.js index 7859262..0055333 100644 --- a/crates/archivr-server/static/assets/index-BEbGvi2K.js +++ b/crates/archivr-server/static/assets/index-DnX_j2fa.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 s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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 su={exports:{}},hl={},ou={exports:{}},M={};/** +(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 s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).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 ou={exports:{}},hl={},uu={exports:{}},M={};/** * @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 cr=Symbol.for("react.element"),Ec=Symbol.for("react.portal"),_c=Symbol.for("react.fragment"),Pc=Symbol.for("react.strict_mode"),Tc=Symbol.for("react.profiler"),Lc=Symbol.for("react.provider"),zc=Symbol.for("react.context"),Rc=Symbol.for("react.forward_ref"),Oc=Symbol.for("react.suspense"),Dc=Symbol.for("react.memo"),Fc=Symbol.for("react.lazy"),Ks=Symbol.iterator;function Mc(e){return e===null||typeof e!="object"?null:(e=Ks&&e[Ks]||e["@@iterator"],typeof e=="function"?e:null)}var uu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},au=Object.assign,cu={};function kn(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||uu}kn.prototype.isReactComponent={};kn.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")};kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function du(){}du.prototype=kn.prototype;function qi(e,t,n){this.props=e,this.context=t,this.refs=cu,this.updater=n||uu}var bi=qi.prototype=new du;bi.constructor=qi;au(bi,kn.prototype);bi.isPureReactComponent=!0;var Ys=Array.isArray,fu=Object.prototype.hasOwnProperty,es={current:null},pu={key:!0,ref:!0,__self:!0,__source:!0};function hu(e,t,n){var r,l={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)fu.call(t,r)&&!pu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,O=E[I];if(0>>1;Il(Ge,R))Dl(re,Ge)?(E[I]=re,E[D]=R,I=D):(E[I]=Ge,E[oe]=R,I=oe);else if(Dl(re,R))E[I]=re,E[D]=R,I=D;else break e}}return k}function l(E,k){var R=E.sortIndex-k.sortIndex;return R!==0?R:E.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],d=[],v=1,m=null,h=3,w=!1,x=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(E){for(var k=n(d);k!==null;){if(k.callback===null)r(d);else if(k.startTime<=E)r(d),k.sortIndex=k.expirationTime,t(a,k);else break;k=n(d)}}function g(E){if(S=!1,f(E),!x)if(n(a)!==null)x=!0,xe(j);else{var k=n(d);k!==null&&Ue(g,k.startTime-E)}}function j(E,k){x=!1,S&&(S=!1,p(z),z=-1),w=!0;var R=h;try{for(f(k),m=n(a);m!==null&&(!(m.expirationTime>k)||E&&!Z());){var I=m.callback;if(typeof I=="function"){m.callback=null,h=m.priorityLevel;var O=I(m.expirationTime<=k);k=e.unstable_now(),typeof O=="function"?m.callback=O:m===n(a)&&r(a),f(k)}else r(a);m=n(a)}if(m!==null)var pe=!0;else{var oe=n(d);oe!==null&&Ue(g,oe.startTime-k),pe=!1}return pe}finally{m=null,h=R,w=!1}}var _=!1,T=null,z=-1,A=5,F=-1;function Z(){return!(e.unstable_now()-FE||125I?(E.sortIndex=R,t(d,E),n(a)===null&&E===n(d)&&(S?(p(z),z=-1):S=!0,Ue(g,R-I))):(E.sortIndex=O,t(a,E),x||w||(x=!0,xe(j))),E},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(E){var k=h;return function(){var R=h;h=k;try{return E.apply(this,arguments)}finally{h=R}}}})(wu);yu.exports=wu;var Yc=yu.exports;/** + */(function(e){function t(E,k){var R=E.length;E.push(k);e:for(;0>>1,O=E[I];if(0>>1;Il(Ge,R))Dl(re,Ge)?(E[I]=re,E[D]=R,I=D):(E[I]=Ge,E[oe]=R,I=oe);else if(Dl(re,R))E[I]=re,E[D]=R,I=D;else break e}}return k}function l(E,k){var R=E.sortIndex-k.sortIndex;return R!==0?R:E.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,u=s.now();e.unstable_now=function(){return s.now()-u}}var a=[],d=[],v=1,m=null,h=3,w=!1,x=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function f(E){for(var k=n(d);k!==null;){if(k.callback===null)r(d);else if(k.startTime<=E)r(d),k.sortIndex=k.expirationTime,t(a,k);else break;k=n(d)}}function g(E){if(S=!1,f(E),!x)if(n(a)!==null)x=!0,xe(j);else{var k=n(d);k!==null&&Ue(g,k.startTime-E)}}function j(E,k){x=!1,S&&(S=!1,p(z),z=-1),w=!0;var R=h;try{for(f(k),m=n(a);m!==null&&(!(m.expirationTime>k)||E&&!Z());){var I=m.callback;if(typeof I=="function"){m.callback=null,h=m.priorityLevel;var O=I(m.expirationTime<=k);k=e.unstable_now(),typeof O=="function"?m.callback=O:m===n(a)&&r(a),f(k)}else r(a);m=n(a)}if(m!==null)var pe=!0;else{var oe=n(d);oe!==null&&Ue(g,oe.startTime-k),pe=!1}return pe}finally{m=null,h=R,w=!1}}var _=!1,T=null,z=-1,A=5,F=-1;function Z(){return!(e.unstable_now()-FE||125I?(E.sortIndex=R,t(d,E),n(a)===null&&E===n(d)&&(S?(p(z),z=-1):S=!0,Ue(g,R-I))):(E.sortIndex=O,t(a,E),x||w||(x=!0,xe(j))),E},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(E){var k=h;return function(){var R=h;h=k;try{return E.apply(this,arguments)}finally{h=R}}}})(xu);wu.exports=xu;var Yc=wu.exports;/** * @license React * react-dom.production.min.js * @@ -30,11 +30,11 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Xc=y,Te=Yc;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"),si=Object.prototype.hasOwnProperty,Gc=/^[: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]*$/,Gs={},Js={};function Jc(e){return si.call(Js,e)?!0:si.call(Gs,e)?!1:Gc.test(e)?Js[e]=!0:(Gs[e]=!0,!1)}function Zc(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 qc(e,t,n,r){if(t===null||typeof t>"u"||Zc(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 ge(e,t,n,r,l,i,s){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=s}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new ge(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new ge(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new ge(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new ge(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){se[e]=new ge(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new ge(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new ge(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new ge(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new ge(e,5,!1,e.toLowerCase(),null,!1,!1)});var ns=/[\-:]([a-z])/g;function rs(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(ns,rs);se[t]=new ge(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(ns,rs);se[t]=new ge(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(ns,rs);se[t]=new ge(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new ge("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!0,!0)});function ls(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),si=Object.prototype.hasOwnProperty,Gc=/^[: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]*$/,Js={},Zs={};function Jc(e){return si.call(Zs,e)?!0:si.call(Js,e)?!1:Gc.test(e)?Zs[e]=!0:(Js[e]=!0,!1)}function Zc(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 qc(e,t,n,r){if(t===null||typeof t>"u"||Zc(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 ge(e,t,n,r,l,i,s){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=s}var se={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){se[e]=new ge(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];se[t]=new ge(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){se[e]=new ge(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){se[e]=new ge(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){se[e]=new ge(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){se[e]=new ge(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){se[e]=new ge(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){se[e]=new ge(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){se[e]=new ge(e,5,!1,e.toLowerCase(),null,!1,!1)});var rs=/[\-:]([a-z])/g;function ls(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(rs,ls);se[t]=new ge(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(rs,ls);se[t]=new ge(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(rs,ls);se[t]=new ge(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!1,!1)});se.xlinkHref=new ge("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){se[e]=new ge(e,1,!1,e.toLowerCase(),null,!0,!0)});function is(e,t,n,r){var l=se.hasOwnProperty(t)?se[t]:null;(l!==null?l.type!==0:r||!(2u||l[s]!==i[u]){var a=` -`+l[s].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Ol=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?On(e):""}function bc(e){switch(e.tag){case 5:return On(e.type);case 16:return On("Lazy");case 13:return On("Suspense");case 19:return On("SuspenseList");case 0:case 2:case 15:return e=Dl(e.type,!1),e;case 11:return e=Dl(e.type.render,!1),e;case 1:return e=Dl(e.type,!0),e;default:return""}}function ci(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 Zt:return"Fragment";case Jt:return"Portal";case oi:return"Profiler";case is:return"StrictMode";case ui:return"Suspense";case ai:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ku:return(e.displayName||"Context")+".Consumer";case Su:return(e._context.displayName||"Context")+".Provider";case ss:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case os:return t=e.displayName||null,t!==null?t:ci(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return ci(e(t))}catch{}}return null}function ed(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 ci(t);case 8:return t===is?"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 _t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ju(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function td(e){var t=ju(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(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gr(e){e._valueTracker||(e._valueTracker=td(e))}function Cu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ju(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wr(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 di(e,t){var n=t.checked;return X({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_t(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 Eu(e,t){t=t.checked,t!=null&&ls(e,"checked",t,!1)}function fi(e,t){Eu(e,t);var n=_t(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")?pi(e,t.type,n):t.hasOwnProperty("defaultValue")&&pi(e,t.type,_t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function bs(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 pi(e,t,n){(t!=="number"||Wr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={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},nd=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){nd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function Lu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function zu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Lu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rd=X({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 vi(e,t){if(t){if(rd[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 gi(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 yi=null;function us(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wi=null,cn=null,dn=null;function no(e){if(e=pr(e)){if(typeof wi!="function")throw Error(N(280));var t=e.stateNode;t&&(t=wl(t),wi(e.stateNode,e.type,t))}}function Ru(e){cn?dn?dn.push(e):dn=[e]:cn=e}function Ou(){if(cn){var e=cn,t=dn;if(dn=cn=null,no(e),t)for(e=0;e>>=0,e===0?32:31-(hd(e)/md|0)|0}var wr=64,xr=4194304;function Fn(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 Xr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var u=s&~l;u!==0?r=Fn(u):(i&=s,i!==0&&(r=Fn(i)))}else s=n&~l,s!==0?r=Fn(s):i!==0&&(r=Fn(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 dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qe(t),e[t]=n}function wd(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=An),fo=" ",po=!1;function bu(e,t){switch(e){case"keyup":return Yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ea(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qt=!1;function Gd(e,t){switch(e){case"compositionend":return ea(t);case"keypress":return t.which!==32?null:(po=!0,fo);case"textInput":return e=t.data,e===fo&&po?null:e;default:return null}}function Jd(e,t){if(qt)return e==="compositionend"||!vs&&bu(e,t)?(e=Zu(),Fr=ps=gt=null,qt=!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=go(n)}}function la(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?la(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ia(){for(var e=window,t=Wr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wr(e.document)}return t}function gs(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 sf(e){var t=ia(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&la(n.ownerDocument.documentElement,n)){if(r!==null&&gs(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=yo(n,i);var s=yo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,bt=null,Ci=null,Bn=null,Ei=!1;function wo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ei||bt==null||bt!==Wr(r)||(r=bt,"selectionStart"in r&&gs(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}),Bn&&er(Bn,r)||(Bn=r,r=Zr(Ci,"onSelect"),0nn||(e.current=Ri[nn],Ri[nn]=null,nn--)}function B(e,t){nn++,Ri[nn]=e.current,e.current=t}var Pt={},de=Lt(Pt),Ne=Lt(!1),Vt=Pt;function vn(e,t){var n=e.type.contextTypes;if(!n)return Pt;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 je(e){return e=e.childContextTypes,e!=null}function br(){W(Ne),W(de)}function Eo(e,t,n){if(de.current!==Pt)throw Error(N(168));B(de,t),B(Ne,n)}function ha(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,ed(e)||"Unknown",l));return X({},n,r)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pt,Vt=de.current,B(de,e),B(Ne,Ne.current),!0}function _o(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=ha(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,W(Ne),W(de),B(de,e)):W(Ne),B(Ne,n)}var nt=null,xl=!1,Xl=!1;function ma(e){nt===null?nt=[e]:nt.push(e)}function yf(e){xl=!0,ma(e)}function zt(){if(!Xl&&nt!==null){Xl=!0;var e=0,t=V;try{var n=nt;for(V=1;e>=s,l-=s,rt=1<<32-Qe(t)+l|n<z?(A=T,T=null):A=T.sibling;var F=h(p,T,f[z],g);if(F===null){T===null&&(T=A);break}e&&T&&F.alternate===null&&t(p,T),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F,T=A}if(z===f.length)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;zz?(A=T,T=null):A=T.sibling;var Z=h(p,T,F.value,g);if(Z===null){T===null&&(T=A);break}e&&T&&Z.alternate===null&&t(p,T),c=i(Z,c,z),_===null?j=Z:_.sibling=Z,_=Z,T=A}if(F.done)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;!F.done;z++,F=f.next())F=m(p,F.value,g),F!==null&&(c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return Q&&Ot(p,z),j}for(T=r(p,T);!F.done;z++,F=f.next())F=w(T,p,z,F.value,g),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?z:F.key),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return e&&T.forEach(function(we){return t(p,we)}),Q&&Ot(p,z),j}function C(p,c,f,g){if(typeof f=="object"&&f!==null&&f.type===Zt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case vr:e:{for(var j=f.key,_=c;_!==null;){if(_.key===j){if(j=f.type,j===Zt){if(_.tag===7){n(p,_.sibling),c=l(_,f.props.children),c.return=p,p=c;break e}}else if(_.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===pt&&Lo(j)===_.type){n(p,_.sibling),c=l(_,f.props),c.ref=Ln(p,_,f),c.return=p,p=c;break e}n(p,_);break}else t(p,_);_=_.sibling}f.type===Zt?(c=At(f.props.children,p.mode,g,f.key),c.return=p,p=c):(g=Hr(f.type,f.key,f.props,null,p.mode,g),g.ref=Ln(p,c,f),g.return=p,p=g)}return s(p);case Jt:e:{for(_=f.key;c!==null;){if(c.key===_)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(p,c.sibling),c=l(c,f.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=ni(f,p.mode,g),c.return=p,p=c}return s(p);case pt:return _=f._init,C(p,c,_(f._payload),g)}if(Dn(f))return x(p,c,f,g);if(Cn(f))return S(p,c,f,g);_r(p,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(p,c.sibling),c=l(c,f),c.return=p,p=c):(n(p,c),c=ti(f,p.mode,g),c.return=p,p=c),s(p)):n(p,c)}return C}var yn=wa(!0),xa=wa(!1),rl=Lt(null),ll=null,sn=null,Ss=null;function ks(){Ss=sn=ll=null}function Ns(e){var t=rl.current;W(rl),e._currentValue=t}function Fi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pn(e,t){ll=e,Ss=sn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ke=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(Ss!==e)if(e={context:e,memoizedValue:t,next:null},sn===null){if(ll===null)throw Error(N(308));sn=e,ll.dependencies={lanes:0,firstContext:e}}else sn=sn.next=e;return t}var Mt=null;function js(e){Mt===null?Mt=[e]:Mt.push(e)}function Sa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,js(t)):(n.next=l.next,l.next=n),t.interleaved=n,ut(e,r)}function ut(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ht=!1;function Cs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ka(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Nt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ut(e,n)}return l=r.interleaved,l===null?(t.next=t,js(r)):(t.next=l.next,l.next=t),r.interleaved=t,ut(e,n)}function $r(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cs(e,n)}}function zo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function il(e,t,n,r){var l=e.updateQueue;ht=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,d=a.next;a.next=null,s===null?i=d:s.next=d,s=a;var v=e.alternate;v!==null&&(v=v.updateQueue,u=v.lastBaseUpdate,u!==s&&(u===null?v.firstBaseUpdate=d:u.next=d,v.lastBaseUpdate=a))}if(i!==null){var m=l.baseState;s=0,v=d=a=null,u=i;do{var h=u.lane,w=u.eventTime;if((r&h)===h){v!==null&&(v=v.next={eventTime:w,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var x=e,S=u;switch(h=t,w=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){m=x.call(w,m,h);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,m,h):x,h==null)break e;m=X({},m,h);break e;case 2:ht=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else w={eventTime:w,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},v===null?(d=v=w,a=m):v=v.next=w,s|=h;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;h=u,u=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(v===null&&(a=m),l.baseState=a,l.firstBaseUpdate=d,l.lastBaseUpdate=v,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Wt|=s,e.lanes=s,e.memoizedState=m}}function Ro(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Jl.transition;Jl.transition={};try{e(!1),t()}finally{V=n,Jl.transition=r}}function Ua(){return Ie().memoizedState}function kf(e,t,n){var r=Ct(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Aa(e))Va(t,n);else if(n=Sa(e,t,n,r),n!==null){var l=me();Ke(n,e,r,l),Ba(n,t,r)}}function Nf(e,t,n){var r=Ct(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Aa(e))Va(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,u=i(s,n);if(l.hasEagerState=!0,l.eagerState=u,Ye(u,s)){var a=t.interleaved;a===null?(l.next=l,js(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Sa(e,t,l,r),n!==null&&(l=me(),Ke(n,e,r,l),Ba(n,t,r))}}function Aa(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function Va(e,t){Hn=ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ba(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,cs(e,n)}}var ul={readContext:$e,useCallback:ue,useContext:ue,useEffect:ue,useImperativeHandle:ue,useInsertionEffect:ue,useLayoutEffect:ue,useMemo:ue,useReducer:ue,useRef:ue,useState:ue,useDebugValue:ue,useDeferredValue:ue,useTransition:ue,useMutableSource:ue,useSyncExternalStore:ue,useId:ue,unstable_isNewReconciler:!1},jf={readContext:$e,useCallback:function(e,t){return Ze().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Do,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ur(4194308,4,Da.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ur(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ur(4,2,e,t)},useMemo:function(e,t){var n=Ze();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ze();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=kf.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=Ze();return e={current:e},t.memoizedState=e},useState:Oo,useDebugValue:Os,useDeferredValue:function(e){return Ze().memoizedState=e},useTransition:function(){var e=Oo(!1),t=e[0];return e=Sf.bind(null,e[1]),Ze().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Y,l=Ze();if(Q){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Ht&30||Ea(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Do(Pa.bind(null,r,i,e),[e]),r.flags|=2048,ur(9,_a.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ze(),t=ne.identifierPrefix;if(Q){var n=lt,r=rt;n=(r&~(1<<32-Qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=sr++,0")&&(a=a.replace("",e.displayName)),a}while(1<=s&&0<=u);break}}}finally{Ol=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?On(e):""}function bc(e){switch(e.tag){case 5:return On(e.type);case 16:return On("Lazy");case 13:return On("Suspense");case 19:return On("SuspenseList");case 0:case 2:case 15:return e=Dl(e.type,!1),e;case 11:return e=Dl(e.type.render,!1),e;case 1:return e=Dl(e.type,!0),e;default:return""}}function ci(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 Zt:return"Fragment";case Jt:return"Portal";case oi:return"Profiler";case ss:return"StrictMode";case ui:return"Suspense";case ai:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Nu:return(e.displayName||"Context")+".Consumer";case ku:return(e._context.displayName||"Context")+".Provider";case os:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case us:return t=e.displayName||null,t!==null?t:ci(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return ci(e(t))}catch{}}return null}function ed(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 ci(t);case 8:return t===ss?"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 _t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Cu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function td(e){var t=Cu(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(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gr(e){e._valueTracker||(e._valueTracker=td(e))}function Eu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Cu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Wr(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 di(e,t){var n=t.checked;return X({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bs(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_t(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 _u(e,t){t=t.checked,t!=null&&is(e,"checked",t,!1)}function fi(e,t){_u(e,t);var n=_t(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")?pi(e,t.type,n):t.hasOwnProperty("defaultValue")&&pi(e,t.type,_t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function eo(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 pi(e,t,n){(t!=="number"||Wr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Dn=Array.isArray;function an(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Xn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var In={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},nd=["Webkit","ms","Moz","O"];Object.keys(In).forEach(function(e){nd.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),In[t]=In[e]})});function zu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||In.hasOwnProperty(e)&&In[e]?(""+t).trim():t+"px"}function Ru(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=zu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var rd=X({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 vi(e,t){if(t){if(rd[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 gi(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 yi=null;function as(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wi=null,cn=null,dn=null;function ro(e){if(e=pr(e)){if(typeof wi!="function")throw Error(N(280));var t=e.stateNode;t&&(t=wl(t),wi(e.stateNode,e.type,t))}}function Ou(e){cn?dn?dn.push(e):dn=[e]:cn=e}function Du(){if(cn){var e=cn,t=dn;if(dn=cn=null,ro(e),t)for(e=0;e>>=0,e===0?32:31-(hd(e)/md|0)|0}var wr=64,xr=4194304;function Fn(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 Xr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var u=s&~l;u!==0?r=Fn(u):(i&=s,i!==0&&(r=Fn(i)))}else s=n&~l,s!==0?r=Fn(s):i!==0&&(r=Fn(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 dr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qe(t),e[t]=n}function wd(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=An),po=" ",ho=!1;function ea(e,t){switch(e){case"keyup":return Yd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ta(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qt=!1;function Gd(e,t){switch(e){case"compositionend":return ta(t);case"keypress":return t.which!==32?null:(ho=!0,po);case"textInput":return e=t.data,e===po&&ho?null:e;default:return null}}function Jd(e,t){if(qt)return e==="compositionend"||!gs&&ea(e,t)?(e=qu(),Fr=hs=gt=null,qt=!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=yo(n)}}function ia(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ia(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sa(){for(var e=window,t=Wr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wr(e.document)}return t}function ys(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 sf(e){var t=sa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ia(n.ownerDocument.documentElement,n)){if(r!==null&&ys(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=wo(n,i);var s=wo(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,bt=null,Ci=null,Bn=null,Ei=!1;function xo(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ei||bt==null||bt!==Wr(r)||(r=bt,"selectionStart"in r&&ys(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}),Bn&&er(Bn,r)||(Bn=r,r=Zr(Ci,"onSelect"),0nn||(e.current=Ri[nn],Ri[nn]=null,nn--)}function B(e,t){nn++,Ri[nn]=e.current,e.current=t}var Pt={},de=Lt(Pt),Ne=Lt(!1),Vt=Pt;function vn(e,t){var n=e.type.contextTypes;if(!n)return Pt;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 je(e){return e=e.childContextTypes,e!=null}function br(){W(Ne),W(de)}function _o(e,t,n){if(de.current!==Pt)throw Error(N(168));B(de,t),B(Ne,n)}function ma(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,ed(e)||"Unknown",l));return X({},n,r)}function el(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Pt,Vt=de.current,B(de,e),B(Ne,Ne.current),!0}function Po(e,t,n){var r=e.stateNode;if(!r)throw Error(N(169));n?(e=ma(e,t,Vt),r.__reactInternalMemoizedMergedChildContext=e,W(Ne),W(de),B(de,e)):W(Ne),B(Ne,n)}var nt=null,xl=!1,Xl=!1;function va(e){nt===null?nt=[e]:nt.push(e)}function yf(e){xl=!0,va(e)}function zt(){if(!Xl&&nt!==null){Xl=!0;var e=0,t=V;try{var n=nt;for(V=1;e>=s,l-=s,rt=1<<32-Qe(t)+l|n<z?(A=T,T=null):A=T.sibling;var F=h(p,T,f[z],g);if(F===null){T===null&&(T=A);break}e&&T&&F.alternate===null&&t(p,T),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F,T=A}if(z===f.length)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;zz?(A=T,T=null):A=T.sibling;var Z=h(p,T,F.value,g);if(Z===null){T===null&&(T=A);break}e&&T&&Z.alternate===null&&t(p,T),c=i(Z,c,z),_===null?j=Z:_.sibling=Z,_=Z,T=A}if(F.done)return n(p,T),Q&&Ot(p,z),j;if(T===null){for(;!F.done;z++,F=f.next())F=m(p,F.value,g),F!==null&&(c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return Q&&Ot(p,z),j}for(T=r(p,T);!F.done;z++,F=f.next())F=w(T,p,z,F.value,g),F!==null&&(e&&F.alternate!==null&&T.delete(F.key===null?z:F.key),c=i(F,c,z),_===null?j=F:_.sibling=F,_=F);return e&&T.forEach(function(we){return t(p,we)}),Q&&Ot(p,z),j}function C(p,c,f,g){if(typeof f=="object"&&f!==null&&f.type===Zt&&f.key===null&&(f=f.props.children),typeof f=="object"&&f!==null){switch(f.$$typeof){case vr:e:{for(var j=f.key,_=c;_!==null;){if(_.key===j){if(j=f.type,j===Zt){if(_.tag===7){n(p,_.sibling),c=l(_,f.props.children),c.return=p,p=c;break e}}else if(_.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===pt&&zo(j)===_.type){n(p,_.sibling),c=l(_,f.props),c.ref=Ln(p,_,f),c.return=p,p=c;break e}n(p,_);break}else t(p,_);_=_.sibling}f.type===Zt?(c=At(f.props.children,p.mode,g,f.key),c.return=p,p=c):(g=Hr(f.type,f.key,f.props,null,p.mode,g),g.ref=Ln(p,c,f),g.return=p,p=g)}return s(p);case Jt:e:{for(_=f.key;c!==null;){if(c.key===_)if(c.tag===4&&c.stateNode.containerInfo===f.containerInfo&&c.stateNode.implementation===f.implementation){n(p,c.sibling),c=l(c,f.children||[]),c.return=p,p=c;break e}else{n(p,c);break}else t(p,c);c=c.sibling}c=ni(f,p.mode,g),c.return=p,p=c}return s(p);case pt:return _=f._init,C(p,c,_(f._payload),g)}if(Dn(f))return x(p,c,f,g);if(Cn(f))return S(p,c,f,g);_r(p,f)}return typeof f=="string"&&f!==""||typeof f=="number"?(f=""+f,c!==null&&c.tag===6?(n(p,c.sibling),c=l(c,f),c.return=p,p=c):(n(p,c),c=ti(f,p.mode,g),c.return=p,p=c),s(p)):n(p,c)}return C}var yn=xa(!0),Sa=xa(!1),rl=Lt(null),ll=null,sn=null,ks=null;function Ns(){ks=sn=ll=null}function js(e){var t=rl.current;W(rl),e._currentValue=t}function Fi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function pn(e,t){ll=e,ks=sn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ke=!0),e.firstContext=null)}function $e(e){var t=e._currentValue;if(ks!==e)if(e={context:e,memoizedValue:t,next:null},sn===null){if(ll===null)throw Error(N(308));sn=e,ll.dependencies={lanes:0,firstContext:e}}else sn=sn.next=e;return t}var Mt=null;function Cs(e){Mt===null?Mt=[e]:Mt.push(e)}function ka(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Cs(t)):(n.next=l.next,l.next=n),t.interleaved=n,ut(e,r)}function ut(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ht=!1;function Es(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Na(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function it(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Nt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,ut(e,n)}return l=r.interleaved,l===null?(t.next=t,Cs(r)):(t.next=l.next,l.next=t),r.interleaved=t,ut(e,n)}function $r(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ds(e,n)}}function Ro(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function il(e,t,n,r){var l=e.updateQueue;ht=!1;var i=l.firstBaseUpdate,s=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,d=a.next;a.next=null,s===null?i=d:s.next=d,s=a;var v=e.alternate;v!==null&&(v=v.updateQueue,u=v.lastBaseUpdate,u!==s&&(u===null?v.firstBaseUpdate=d:u.next=d,v.lastBaseUpdate=a))}if(i!==null){var m=l.baseState;s=0,v=d=a=null,u=i;do{var h=u.lane,w=u.eventTime;if((r&h)===h){v!==null&&(v=v.next={eventTime:w,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var x=e,S=u;switch(h=t,w=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){m=x.call(w,m,h);break e}m=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,h=typeof x=="function"?x.call(w,m,h):x,h==null)break e;m=X({},m,h);break e;case 2:ht=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,h=l.effects,h===null?l.effects=[u]:h.push(u))}else w={eventTime:w,lane:h,tag:u.tag,payload:u.payload,callback:u.callback,next:null},v===null?(d=v=w,a=m):v=v.next=w,s|=h;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;h=u,u=h.next,h.next=null,l.lastBaseUpdate=h,l.shared.pending=null}}while(!0);if(v===null&&(a=m),l.baseState=a,l.firstBaseUpdate=d,l.lastBaseUpdate=v,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Wt|=s,e.lanes=s,e.memoizedState=m}}function Oo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Jl.transition;Jl.transition={};try{e(!1),t()}finally{V=n,Jl.transition=r}}function Aa(){return Ie().memoizedState}function kf(e,t,n){var r=Ct(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Va(e))Ba(t,n);else if(n=ka(e,t,n,r),n!==null){var l=me();Ke(n,e,r,l),Ha(n,t,r)}}function Nf(e,t,n){var r=Ct(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Va(e))Ba(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,u=i(s,n);if(l.hasEagerState=!0,l.eagerState=u,Ye(u,s)){var a=t.interleaved;a===null?(l.next=l,Cs(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=ka(e,t,l,r),n!==null&&(l=me(),Ke(n,e,r,l),Ha(n,t,r))}}function Va(e){var t=e.alternate;return e===Y||t!==null&&t===Y}function Ba(e,t){Hn=ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ha(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ds(e,n)}}var ul={readContext:$e,useCallback:ue,useContext:ue,useEffect:ue,useImperativeHandle:ue,useInsertionEffect:ue,useLayoutEffect:ue,useMemo:ue,useReducer:ue,useRef:ue,useState:ue,useDebugValue:ue,useDeferredValue:ue,useTransition:ue,useMutableSource:ue,useSyncExternalStore:ue,useId:ue,unstable_isNewReconciler:!1},jf={readContext:$e,useCallback:function(e,t){return Ze().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:Fo,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ur(4194308,4,Fa.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ur(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ur(4,2,e,t)},useMemo:function(e,t){var n=Ze();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ze();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=kf.bind(null,Y,e),[r.memoizedState,e]},useRef:function(e){var t=Ze();return e={current:e},t.memoizedState=e},useState:Do,useDebugValue:Ds,useDeferredValue:function(e){return Ze().memoizedState=e},useTransition:function(){var e=Do(!1),t=e[0];return e=Sf.bind(null,e[1]),Ze().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Y,l=Ze();if(Q){if(n===void 0)throw Error(N(407));n=n()}else{if(n=t(),ne===null)throw Error(N(349));Ht&30||_a(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Fo(Ta.bind(null,r,i,e),[e]),r.flags|=2048,ur(9,Pa.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Ze(),t=ne.identifierPrefix;if(Q){var n=lt,r=rt;n=(r&~(1<<32-Qe(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=sr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[qe]=t,e[rr]=r,qa(e,t,!1,!1),t.stateNode=e;e:{switch(s=gi(n,r),n){case"dialog":H("cancel",e),H("close",e),l=r;break;case"iframe":case"object":case"embed":H("load",e),l=r;break;case"video":case"audio":for(l=0;lSn&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304)}else{if(!r)if(e=sl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Q)return ae(t),null}else 2*J()-i.renderingStartTime>Sn&&n!==1073741824&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=J(),t.sibling=null,n=K.current,B(K,r?n&1|2:n&1),t):(ae(t),null);case 22:case 23:return Us(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ee&1073741824&&(ae(t),t.subtreeFlags&6&&(t.flags|=8192)):ae(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Rf(e,t){switch(ws(t),t.tag){case 1:return je(t.type)&&br(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(),W(Ne),W(de),Ps(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _s(t),null;case 13:if(W(K),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));gn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(K),null;case 4:return wn(),null;case 10:return Ns(t.type._context),null;case 22:case 23:return Us(),null;case 24:return null;default:return null}}var Tr=!1,ce=!1,Of=typeof WeakSet=="function"?WeakSet:Set,L=null;function on(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function Wi(e,t,n){try{n()}catch(r){G(e,t,r)}}var Qo=!1;function Df(e,t){if(_i=Gr,e=ia(),gs(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 s=0,u=-1,a=-1,d=0,v=0,m=e,h=null;t:for(;;){for(var w;m!==n||l!==0&&m.nodeType!==3||(u=s+l),m!==i||r!==0&&m.nodeType!==3||(a=s+r),m.nodeType===3&&(s+=m.nodeValue.length),(w=m.firstChild)!==null;)h=m,m=w;for(;;){if(m===e)break t;if(h===n&&++d===l&&(u=s),h===i&&++v===r&&(a=s),(w=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=w}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pi={focusedElem:e,selectionRange:n},Gr=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,C=x.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:Be(t.type,S),C);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(g){G(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return x=Qo,Qo=!1,x}function Wn(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&&Wi(t,n,i)}l=l.next}while(l!==r)}}function Nl(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 Qi(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 tc(e){var t=e.alternate;t!==null&&(e.alternate=null,tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qe],delete t[rr],delete t[zi],delete t[vf],delete t[gf])),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 nc(e){return e.tag===5||e.tag===3||e.tag===4}function Ko(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||nc(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 Ki(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=qr));else if(r!==4&&(e=e.child,e!==null))for(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}function Yi(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(Yi(e,t,n),e=e.sibling;e!==null;)Yi(e,t,n),e=e.sibling}var le=null,He=!1;function ft(e,t,n){for(n=n.child;n!==null;)rc(e,t,n),n=n.sibling}function rc(e,t,n){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(ml,n)}catch{}switch(n.tag){case 5:ce||on(n,t);case 6:var r=le,l=He;le=null,ft(e,t,n),le=r,He=l,le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):le.removeChild(n.stateNode));break;case 18:le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?Yl(e.parentNode,n):e.nodeType===1&&Yl(e,n),qn(e)):Yl(le,n.stateNode));break;case 4:r=le,l=He,le=n.stateNode.containerInfo,He=!0,ft(e,t,n),le=r,He=l;break;case 0:case 11:case 14:case 15:if(!ce&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Wi(n,t,s),l=l.next}while(l!==r)}ft(e,t,n);break;case 1:if(!ce&&(on(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){G(n,t,u)}ft(e,t,n);break;case 21:ft(e,t,n);break;case 22:n.mode&1?(ce=(r=ce)||n.memoizedState!==null,ft(e,t,n),ce=r):ft(e,t,n);break;default:ft(e,t,n)}}function Yo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Of),t.forEach(function(r){var l=Hf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ve(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mf(r/1960))-r,10e?16:e,yt===null)var r=!1;else{if(e=yt,yt=null,dl=0,$&6)throw Error(N(331));var l=$;for($|=4,L=e.current;L!==null;){var i=L,s=i.child;if(L.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aJ()-$s?Ut(e,0):Ms|=n),Ce(e,t)}function dc(e,t){t===0&&(e.mode&1?(t=xr,xr<<=1,!(xr&130023424)&&(xr=4194304)):t=1);var n=me();e=ut(e,t),e!==null&&(dr(e,t,n),Ce(e,n))}function Bf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),dc(e,n)}function Hf(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),dc(e,n)}var fc;fc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ne.current)ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ke=!1,Lf(e,t,n);ke=!!(e.flags&131072)}else ke=!1,Q&&t.flags&1048576&&va(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ar(e,t),e=t.pendingProps;var l=vn(t,de.current);pn(t,n),l=Ls(null,t,r,e,l,n);var i=zs();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,je(r)?(i=!0,el(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Cs(t),l.updater=kl,t.stateNode=l,l._reactInternals=t,$i(t,r,e,n),t=Ai(null,t,r,!0,i,n)):(t.tag=0,Q&&i&&ys(t),he(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ar(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Qf(r),e=Be(r,e),l){case 0:t=Ui(null,t,r,e,n);break e;case 1:t=Bo(null,t,r,e,n);break e;case 11:t=Ao(null,t,r,e,n);break e;case 14:t=Vo(null,t,r,Be(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:Be(r,l),Ui(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Bo(e,t,r,l,n);case 3:e:{if(Ga(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,ka(e,t),il(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=Ho(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=Ho(e,t,r,n,l);break e}else for(_e=kt(t.stateNode.containerInfo.firstChild),Pe=t,Q=!0,We=null,n=xa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(gn(),r===l){t=at(e,t,n);break e}he(e,t,r,n)}t=t.child}return t;case 5:return Na(t),e===null&&Di(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ti(r,l)?s=null:i!==null&&Ti(r,i)&&(t.flags|=32),Xa(e,t),he(e,t,s,n),t.child;case 6:return e===null&&Di(t),null;case 13:return Ja(e,t,n);case 4:return Es(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=yn(t,null,r,n):he(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ao(e,t,r,l,n);case 7:return he(e,t,t.pendingProps,n),t.child;case 8:return he(e,t,t.pendingProps.children,n),t.child;case 12:return he(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,B(rl,r._currentValue),r._currentValue=s,i!==null)if(Ye(i.value,s)){if(i.children===l.children&&!Ne.current){t=at(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=it(-1,n&-n),a.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var v=d.pending;v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Fi(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Fi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}he(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,pn(t,n),l=$e(l),r=r(l),t.flags|=1,he(e,t,r,n),t.child;case 14:return r=t.type,l=Be(r,t.pendingProps),l=Be(r.type,l),Vo(e,t,r,l,n);case 15:return Ka(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ar(e,t),t.tag=1,je(r)?(e=!0,el(t)):e=!1,pn(t,n),Ha(t,r,l),$i(t,r,l,n),Ai(null,t,r,!0,e,n);case 19:return Za(e,t,n);case 22:return Ya(e,t,n)}throw Error(N(156,t.tag))};function pc(e,t){return Au(e,t)}function Wf(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 Fe(e,t,n,r){return new Wf(e,t,n,r)}function Vs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qf(e){if(typeof e=="function")return Vs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ss)return 11;if(e===os)return 14}return 2}function Et(e,t){var n=e.alternate;return n===null?(n=Fe(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 Hr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Vs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return At(n.children,l,i,t);case is:s=8,l|=8;break;case oi:return e=Fe(12,n,t,l|2),e.elementType=oi,e.lanes=i,e;case ui:return e=Fe(13,n,t,l),e.elementType=ui,e.lanes=i,e;case ai:return e=Fe(19,n,t,l),e.elementType=ai,e.lanes=i,e;case Nu:return Cl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Su:s=10;break e;case ku:s=9;break e;case ss:s=11;break e;case os:s=14;break e;case pt:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Fe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function At(e,t,n,r){return e=Fe(7,e,r,t),e.lanes=n,e}function Cl(e,t,n,r){return e=Fe(22,e,r,t),e.elementType=Nu,e.lanes=n,e.stateNode={isHidden:!1},e}function ti(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function ni(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kf(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=Ml(0),this.expirationTimes=Ml(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ml(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Bs(e,t,n,r,l,i,s,u,a){return e=new Kf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Fe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Cs(i),e}function Yf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gc)}catch(e){console.error(e)}}gc(),gu.exports=Le;var qf=gu.exports,yc,tu=qf;yc=tu.createRoot,tu.hydrateRoot;async function ye(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function bf(){return ye("/api/archives")}async function ep(e){return ye(`/api/archives/${e}/entries`)}async function tp(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),ye(`/api/archives/${e}/entries/search?${r}`)}async function np(e,t){return ye(`/api/archives/${e}/entries/${t}`)}async function ri(e,t){return ye(`/api/archives/${e}/entries/${t}/tags`)}async function rp(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_path:n})});if(!r.ok)throw new Error(`Failed to add tag (${r.status})`)}async function lp(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`Remove failed (${r.status})`)}async function nu(e){return ye(`/api/archives/${e}/runs`)}async function li(e){return ye(`/api/archives/${e}/tags`)}async function ip(e,t){const n=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function sp(e,t){return ye(`/api/archives/${e}/capture_jobs/${t}`)}async function op(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function up(e,t){const n=await fetch("/api/auth/setup",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Setup failed");return n.json()}async function ap(e,t){const n=await fetch("/api/auth/login",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Login failed");return n.json()}async function cp(){await fetch("/api/auth/logout",{method:"POST"})}async function dp(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function fp(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display_name:e})});if(!t.ok)throw new Error(await t.text())}async function pp(e,t){const n=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_password:e,new_password:t})});if(!n.ok){let r=await n.text();try{r=JSON.parse(r).error??r}catch{}throw new Error(r)}}async function hp(){return ye("/api/auth/tokens")}async function mp(e){const t=await fetch("/api/auth/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error(await t.text());return t.json()}async function vp(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function gp(){return ye("/api/admin/instance-settings")}async function yp(e){const t=await fetch("/api/admin/instance-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function wp(){return ye("/api/admin/users")}async function xp(e,t,n){const r=await fetch("/api/admin/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:n||void 0})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error||`HTTP ${r.status}`)}return r.json()}async function Sp(e,t){const n=await fetch(`/api/admin/users/${e}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function kp(){return ye("/api/admin/roles")}async function Np(e,t){const n=await fetch("/api/admin/roles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,name:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function jp(e){return ye(`/api/archives/${e}/collections`)}async function Cp(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}return l.json()}async function Ep(e,t){return ye(`/api/archives/${e}/collections/${t}`)}async function _p(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections/${t}/entries`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({entry_uid:n,visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Pp(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"DELETE"});if(!r.ok){const l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error||r.statusText)}}async function Tp(e,t,n,r){const l=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Lp(e,t){return ye(`/api/archives/${e}/entries/${t}/collections`)}async function ru(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error??r.statusText)}}async function zp(e,t){const n=await fetch(`/api/archives/${e}/collections/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??n.statusText)}}const Rp=window.fetch;window.fetch=async(...e)=>{var n;const t=await Rp(...e);return t.status===401&&((typeof e[0]=="string"?e[0]:((n=e[0])==null?void 0:n.url)??"").includes("/api/auth/")||window.dispatchEvent(new CustomEvent("auth:expired"))),t};function Op({onLogin:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(null),[u,a]=y.useState(!1);async function d(v){v.preventDefault(),s(null),a(!0);try{const m=await ap(t,r);e(m)}catch(m){s(m.message)}finally{a(!1)}}return o.jsx("div",{className:"login-page",children:o.jsxs("div",{className:"login-card",children:[o.jsx("h1",{className:"login-brand",children:"Archivr"}),o.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),o.jsxs("form",{onSubmit:d,children:[o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),o.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:v=>n(v.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),o.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:v=>l(v.target.value),required:!0,autoComplete:"current-password"})]}),i&&o.jsx("p",{className:"login-error",children:i}),o.jsx("button",{className:"login-submit",type:"submit",disabled:u,children:u?"Signing in…":"Sign in"})]})]})})}function Dp({onComplete:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1);async function m(h){if(h.preventDefault(),r!==i){a("Passwords do not match");return}if(r.length<8){a("Password must be at least 8 characters");return}a(null),v(!0);try{await up(t,r),e()}catch(w){a(w.message)}finally{v(!1)}}return o.jsx("div",{className:"setup-page",children:o.jsxs("div",{className:"setup-card",children:[o.jsx("h1",{className:"setup-brand",children:"Archivr"}),o.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),o.jsxs("form",{onSubmit:m,children:[o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),o.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:h=>n(h.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),o.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:h=>l(h.target.value),required:!0,autoComplete:"new-password"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),o.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:h=>s(h.target.value),required:!0,autoComplete:"new-password"})]}),u&&o.jsx("p",{className:"setup-error",children:u}),o.jsx("button",{className:"setup-submit",type:"submit",disabled:d,children:d?"Creating account…":"Create account"})]})]})})}function Fp({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:s,setCurrentUser:u}=y.useContext(Ll)??{},[a,d]=y.useState(!1);async function v(){d(!0),await cp(),u(null),window.location.reload()}return o.jsxs("header",{className:"topbar",children:[o.jsx("div",{className:"brand",children:"Archivr"}),o.jsx("div",{className:"switcher",children:o.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>o.jsx("option",{value:m.id,children:m.label},m.id))})}),o.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","runs","admin","tags","collections","settings"].map(m=>o.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),o.jsx("button",{className:"capture-button",onClick:i,children:"+ Capture"}),s&&o.jsxs("div",{className:"user-menu",children:[o.jsx("span",{className:"user-name",children:s.display_name||s.username}),o.jsx("button",{className:"logout-btn",onClick:v,disabled:a,children:a?"Logging out…":"Log out"})]})]})}function Mp({open:e,archiveId:t,onClose:n,onCaptured:r}){const l=y.useRef(null),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1),[m,h]=y.useState(null),w=y.useRef(null);y.useEffect(()=>{const C=l.current;if(!C)return;const p=()=>{clearInterval(w.current),n()};return C.addEventListener("close",p),()=>C.removeEventListener("close",p)},[n]),y.useEffect(()=>{const C=l.current;C&&(e?(s(""),a(null),h(null),v(!1),clearInterval(w.current),C.open||C.showModal()):C.open&&C.close())},[e]);async function x(){if(!i.trim()){a("Enter a locator.");return}v(!0),a(null),h(null);try{const C=await ip(t,i.trim());h("running"),w.current=setInterval(async()=>{var p;try{const c=await sp(t,C.job_uid);c.status==="completed"?(clearInterval(w.current),w.current=null,v(!1),h("completed"),(p=l.current)==null||p.close(),r()):c.status==="failed"&&(clearInterval(w.current),w.current=null,v(!1),h("failed"),a(c.error_text||"Capture failed."))}catch(c){clearInterval(w.current),w.current=null,v(!1),a(c.message)}},500)}catch(C){a(C.message),v(!1)}}function S(){return d?m==="running"?"Running…":"Capturing…":"Capture"}return o.jsx("dialog",{ref:l,className:"capture-dialog",children:o.jsxs("div",{className:"capture-dialog-inner",children:[o.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),o.jsx("label",{htmlFor:"capture-locator",className:"capture-label",children:"Locator"}),o.jsx("input",{id:"capture-locator",className:"capture-input",type:"text",placeholder:"tweet:1234567890 or https://...",value:i,onChange:C=>s(C.target.value),onKeyDown:C=>{C.key==="Enter"&&x()},autoComplete:"off"}),u&&o.jsx("div",{className:"capture-error",children:u}),o.jsxs("div",{className:"capture-actions",children:[o.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var C;return(C=l.current)==null?void 0:C.close()},children:"Cancel"}),o.jsx("button",{type:"button",className:"capture-submit",onClick:x,disabled:d,children:S()})]})]})})}function wc(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&rString(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const lu={youtube:'',x:'',instagram:'',facebook:'',tiktok:'',reddit:'',snapchat:'',local:'',web:'',other:'?'};function Sc(e){return lu[e]??lu.other}function $p({entry:e,archiveId:t,isSelected:n,onSelect:r}){const[l,i]=y.useState(!1),u=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!l?o.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>i(!0),style:{objectFit:"contain"}}):o.jsx("span",{dangerouslySetInnerHTML:{__html:Sc(e.source_kind)}});return o.jsxs("div",{className:n?"is-selected":void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onClick:r,onKeyDown:a=>{a.key==="Enter"&&r()},children:[o.jsx("div",{className:"col-added",children:xc(e.archived_at)}),o.jsxs("div",{className:"col-title",children:[o.jsx("span",{className:"source-icon",children:u}),o.jsx("span",{className:"entry-title",children:It(e.title)||It(e.entry_uid)})]}),o.jsx("div",{className:"col-type",children:o.jsx("span",{className:"type-pill",children:It(e.entity_kind)})}),o.jsx("div",{className:"col-size",children:wc(e.total_artifact_bytes)}),o.jsx("div",{className:"url-cell col-url",children:It(e.original_url)})]})}function Ip({entries:e,selectedEntryUid:t,onSelectEntry:n,archiveId:r}){return o.jsx("section",{id:"archive-view",className:"view is-active",children:o.jsxs("div",{className:"entry-table",children:[o.jsxs("div",{className:"entry-header-row",children:[o.jsx("div",{className:"col-added",children:"Added"}),o.jsx("div",{className:"col-title",children:"Title"}),o.jsx("div",{className:"col-type",children:"Type"}),o.jsx("div",{className:"col-size",children:"Size"}),o.jsx("div",{className:"col-url",children:"Original URL"})]}),o.jsx("div",{id:"entries-body",children:e.map(l=>o.jsx($p,{entry:l,archiveId:r,isSelected:l.entry_uid===t,onSelect:()=>n(l)},l.entry_uid))})]})})}function Up(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Ap({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="running"?"run-status--running":"";return o.jsx("span",{className:`run-status ${t}`,children:e||"—"})}function Vp({runs:e}){return o.jsx("section",{id:"runs-view",className:"view is-active",children:o.jsxs("table",{className:"entry-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Started"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Requested"}),o.jsx("th",{children:"Completed"}),o.jsx("th",{children:"Failed"})]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map((t,n)=>o.jsxs("tr",{children:[o.jsx("td",{children:Up(t.started_at)}),o.jsx("td",{children:o.jsx(Ap,{status:t.status})}),o.jsx("td",{children:t.requested_count??"—"}),o.jsx("td",{children:t.completed_count??"—"}),o.jsx("td",{children:t.failed_count??"—"})]},n))})]})})}const Bp=4;function Hp({archives:e}){const{currentUser:t}=y.useContext(Ll)??{},n=t&&(t.role_bits&Bp)!==0,[r,l]=y.useState("users"),[i,s]=y.useState([]),[u,a]=y.useState([]),[d,v]=y.useState(!1),[m,h]=y.useState(null),[w,x]=y.useState(""),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(null),[j,_]=y.useState(!1),[T,z]=y.useState(""),[A,F]=y.useState(""),[Z,we]=y.useState(null),[fe,Xe]=y.useState(!1),Re=y.useCallback(async()=>{if(n){v(!0),h(null);try{const[k,R]=await Promise.all([wp(),kp()]);s(k),a(R)}catch(k){h(k.message)}finally{v(!1)}}},[n]);y.useEffect(()=>{Re()},[Re]);async function xe(k){const R=k.status==="active"?"disabled":"active";try{await Sp(k.user_uid,R),s(I=>I.map(O=>O.user_uid===k.user_uid?{...O,status:R}:O))}catch(I){h(I.message)}}async function Ue(k){if(k.preventDefault(),!w.trim()||!S){g("Username and password required");return}_(!0),g(null);try{await xp(w.trim(),S,p.trim()||void 0),x(""),C(""),c(""),await Re()}catch(R){g(R.message)}finally{_(!1)}}async function E(k){if(k.preventDefault(),!T.trim()||!A.trim()){we("Slug and name required");return}Xe(!0),we(null);try{await Np(T.trim(),A.trim()),z(""),F(""),await Re()}catch(R){we(R.message)}finally{Xe(!1)}}return n?o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsxs("div",{className:"view-tabs",children:[o.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),o.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),o.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&o.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Users"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Username"}),o.jsx("th",{children:"Email"}),o.jsx("th",{children:"Roles"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Actions"})]})}),o.jsx("tbody",{children:i.map(k=>o.jsxs("tr",{className:k.status==="disabled"?"admin-row-disabled":"",children:[o.jsx("td",{children:k.username}),o.jsx("td",{className:"muted",children:k.email||"—"}),o.jsx("td",{children:k.role_slugs.join(", ")||"—"}),o.jsx("td",{children:o.jsx("span",{className:`status-badge status-${k.status}`,children:k.status})}),o.jsx("td",{children:o.jsx("button",{className:"admin-action-btn",onClick:()=>xe(k),children:k.status==="active"?"Ban":"Unban"})})]},k.user_uid))})]}),o.jsx("h3",{children:"Create User"}),o.jsxs("form",{className:"admin-form",onSubmit:Ue,children:[o.jsx("input",{className:"admin-input",placeholder:"Username",value:w,onChange:k=>x(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:S,onChange:k=>C(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:k=>c(k.target.value)}),f&&o.jsx("div",{className:"form-msg form-msg--err",children:f}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create User"})]})]}),r==="roles"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Roles"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Slug"}),o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Level"}),o.jsx("th",{children:"Bit"}),o.jsx("th",{children:"Built-in"})]})}),o.jsx("tbody",{children:u.map(k=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("code",{children:k.slug})}),o.jsx("td",{children:k.name}),o.jsx("td",{children:k.level}),o.jsx("td",{children:k.bit_position}),o.jsx("td",{children:k.is_builtin?"✓":""})]},k.role_uid))})]}),o.jsx("h3",{children:"Create Custom Role"}),o.jsxs("form",{className:"admin-form",onSubmit:E,children:[o.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:T,onChange:k=>z(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:A,onChange:k=>F(k.target.value),required:!0}),Z&&o.jsx("div",{className:"form-msg form-msg--err",children:Z}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:fe,children:fe?"Creating…":"Create Role"})]})]}),r==="archives"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})]}):o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})}function kc({node:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){var s;const l=t===e.tag.full_path;function i(){const u=l?null:e.tag.full_path;n(u),r("archive")}return o.jsxs("li",{children:[o.jsx("button",{className:`tag-node-btn${l?" is-active":""}`,title:e.tag.full_path,onClick:i,children:e.tag.name}),((s=e.children)==null?void 0:s.length)>0&&o.jsx("div",{className:"tag-children",children:o.jsx("ul",{className:"tag-tree-list",children:e.children.map(u=>o.jsx(kc,{node:u,tagFilter:t,onTagFilterSet:n,onViewChange:r},u.tag.tag_uid))})})]})}function Wp({tagNodes:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){return o.jsx("section",{id:"tags-view",className:"view is-active",children:o.jsxs("div",{className:"tag-tree",children:[o.jsxs("div",{className:"tag-tree-header",children:[o.jsx("span",{className:"tag-tree-title",children:"Tags"}),t&&o.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",t]})]}),e.length===0?o.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):o.jsx("ul",{className:"tag-tree-list",children:e.map(l=>o.jsx(kc,{node:l,tagFilter:t,onTagFilterSet:n,onViewChange:r},l.tag.tag_uid))})]})})}const $n=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],Qp=e=>{var t;return((t=$n.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Kp({archiveId:e}){const[t,n]=y.useState([]),[r,l]=y.useState(!1),[i,s]=y.useState(null),[u,a]=y.useState(null),[d,v]=y.useState(null),[m,h]=y.useState(!1),[w,x]=y.useState(null),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(2),[j,_]=y.useState(!1),[T,z]=y.useState(null),[A,F]=y.useState(""),[Z,we]=y.useState(2),[fe,Xe]=y.useState(!1),[Re,xe]=y.useState(null),[Ue,E]=y.useState(!1),[k,R]=y.useState(""),I=y.useRef(null),O=t.find(P=>P.collection_uid===u)??null,pe=(O==null?void 0:O.slug)==="_default_",oe=y.useCallback(async()=>{if(e){l(!0),s(null);try{const P=await jp(e);n(P)}catch(P){s(P.message)}finally{l(!1)}}},[e]),Ge=y.useCallback(async P=>{if(!P){v(null);return}h(!0),x(null);try{const U=await Ep(e,P);v(U)}catch(U){x(U.message)}finally{h(!1)}},[e]);y.useEffect(()=>{oe()},[oe]),y.useEffect(()=>{Ge(u)},[u,Ge]),y.useEffect(()=>{Ue&&I.current&&I.current.focus()},[Ue]);async function D(P){P.preventDefault();const U=S.trim(),Ae=p.trim();if(!(!U||!Ae)){_(!0),z(null);try{const Rt=await Cp(e,U,Ae,f);C(""),c(""),g(2),await oe(),a(Rt.collection_uid)}catch(Rt){z(Rt.message)}finally{_(!1)}}}async function re(){const P=k.trim();if(!P||!O){E(!1);return}try{await ru(e,O.collection_uid,{name:P}),await oe(),v(U=>U&&{...U,name:P})}catch(U){s(U.message)}finally{E(!1)}}async function Xt(P){if(O)try{await ru(e,O.collection_uid,{default_visibility_bits:P}),await oe(),v(U=>U&&{...U,default_visibility_bits:P})}catch(U){s(U.message)}}async function dt(){if(O&&window.confirm(`Delete collection "${O.name}"? Entries will not be deleted.`))try{await zp(e,O.collection_uid),a(null),v(null),await oe()}catch(P){s(P.message)}}async function Nc(P){P.preventDefault();const U=A.trim();if(!(!U||!O)){Xe(!0),xe(null);try{await _p(e,O.collection_uid,U,Z),F(""),await Ge(O.collection_uid)}catch(Ae){xe(Ae.message)}finally{Xe(!1)}}}async function jc(P){if(O)try{await Pp(e,O.collection_uid,P),await Ge(O.collection_uid)}catch(U){x(U.message)}}async function Cc(P,U){if(O)try{await Tp(e,O.collection_uid,P,U),v(Ae=>Ae&&{...Ae,entries:Ae.entries.map(Rt=>Rt.entry_uid===P?{...Rt,collection_visibility_bits:U}:Rt)})}catch(Ae){x(Ae.message)}}return e?o.jsxs("div",{className:"collections-view",children:[o.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&o.jsx("div",{className:"muted",children:"Loading…"}),i&&o.jsxs("div",{className:"collections-error",children:[i," ",o.jsx("button",{onClick:()=>s(null),className:"coll-dismiss",children:"×"})]}),o.jsxs("div",{className:"collections-layout",children:[o.jsxs("div",{className:"collections-sidebar",children:[t.map(P=>o.jsxs("button",{className:`coll-sidebar-row${u===P.collection_uid?" is-active":""}`,onClick:()=>a(P.collection_uid),children:[o.jsx("span",{className:"coll-row-name",children:P.name}),o.jsx("span",{className:"coll-row-meta",children:Qp(P.default_visibility_bits)})]},P.collection_uid)),t.length===0&&!r&&o.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),O?o.jsxs("div",{className:"coll-detail",children:[o.jsxs("div",{className:"coll-detail-header",children:[Ue?o.jsx("input",{ref:I,className:"coll-rename-input",value:k,onChange:P=>R(P.target.value),onBlur:re,onKeyDown:P=>{P.key==="Enter"&&re(),P.key==="Escape"&&E(!1)}}):o.jsxs("h3",{className:`coll-detail-name${pe?"":" coll-detail-name--editable"}`,title:pe?void 0:"Click to rename",onClick:()=>{pe||(R(O.name),E(!0))},children:[(d==null?void 0:d.name)??O.name,!pe&&o.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!pe&&o.jsx("button",{className:"coll-delete-btn",onClick:dt,title:"Delete collection",children:"Delete"})]}),o.jsxs("div",{className:"coll-detail-vis",children:[o.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),o.jsx("select",{className:"coll-vis-select",value:(d==null?void 0:d.default_visibility_bits)??O.default_visibility_bits,onChange:P=>Xt(Number(P.target.value)),disabled:pe,children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),o.jsxs("div",{className:"coll-entries-section",children:[o.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&o.jsx("div",{className:"muted",children:"Loading…"}),w&&o.jsx("div",{className:"collections-error",children:w}),!m&&d&&(d.entries.length===0?o.jsx("div",{className:"muted",children:"No entries in this collection."}):o.jsx("ul",{className:"coll-entries-list",children:d.entries.map(P=>o.jsxs("li",{className:"coll-entry-row",children:[o.jsxs("div",{className:"coll-entry-info",children:[o.jsx("span",{className:"coll-entry-title",children:P.title||P.entry_uid}),o.jsx("span",{className:"coll-entry-kind muted",children:P.source_kind})]}),o.jsxs("div",{className:"coll-entry-actions",children:[o.jsx("select",{className:"coll-entry-vis-select",value:P.collection_visibility_bits,onChange:U=>Cc(P.entry_uid,Number(U.target.value)),children:$n.map(U=>o.jsx("option",{value:U.value,children:U.label},U.value))}),!pe&&o.jsx("button",{className:"coll-entry-remove",onClick:()=>jc(P.entry_uid),title:"Remove from collection",children:"×"})]})]},P.entry_uid))}))]}),!pe&&o.jsxs("form",{className:"coll-add-entry-form",onSubmit:Nc,children:[o.jsx("div",{className:"coll-section-heading",children:"Add entry"}),o.jsxs("div",{className:"coll-add-entry-row",children:[o.jsx("input",{className:"coll-add-entry-input",type:"text",value:A,onChange:P=>F(P.target.value),placeholder:"entry_uid",required:!0}),o.jsx("select",{className:"coll-vis-select",value:Z,onChange:P=>we(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))}),o.jsx("button",{className:"coll-add-btn",type:"submit",disabled:fe,children:fe?"…":"Add"})]}),Re&&o.jsx("div",{className:"collections-error",style:{marginTop:4},children:Re})]})]}):o.jsx("div",{className:"coll-detail coll-detail--empty",children:o.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),o.jsxs("details",{className:"coll-create-details",children:[o.jsx("summary",{children:"+ Create collection"}),o.jsxs("form",{className:"coll-create-form",onSubmit:D,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),o.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:S,onChange:P=>{C(P.target.value),p||c(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),o.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:P=>c(P.target.value),placeholder:"my-collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),o.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:f,onChange:P=>g(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),T&&o.jsx("div",{className:"collections-error",children:T}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create collection"})]})]})]}):o.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Yp=4;function Xp({tab:e,onTabChange:t}){const{currentUser:n,setCurrentUser:r}=y.useContext(Ll)??{},l=n&&(n.role_bits&Yp)!==0,i=["profile","tokens",...l?["instance"]:[]],s={profile:"Profile",tokens:"API Tokens",instance:"Instance"};return o.jsxs("section",{className:"admin-view",children:[o.jsx("h1",{children:"Settings"}),o.jsx("div",{className:"view-tabs",children:i.map(u=>o.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:s[u]},u))}),e==="profile"&&o.jsx(Gp,{currentUser:n,setCurrentUser:r}),e==="tokens"&&o.jsx(Jp,{}),e==="instance"&&l&&o.jsx(Zp,{})]})}function Gp({currentUser:e,setCurrentUser:t}){const[n,r]=y.useState((e==null?void 0:e.display_name)??""),[l,i]=y.useState(!1),[s,u]=y.useState(null),[a,d]=y.useState(""),[v,m]=y.useState(""),[h,w]=y.useState(""),[x,S]=y.useState(!1),[C,p]=y.useState(null);async function c(g){g.preventDefault(),i(!0),u(null);try{await fp(n),t(j=>({...j,display_name:n||null})),u({ok:!0,text:"Saved."})}catch(j){u({ok:!1,text:j.message})}finally{i(!1)}}async function f(g){if(g.preventDefault(),v!==h){p({ok:!1,text:"Passwords do not match."});return}S(!0),p(null);try{await pp(a,v),d(""),m(""),w(""),p({ok:!0,text:"Password changed."})}catch(j){p({ok:!1,text:j.message})}finally{S(!1)}}return o.jsxs("div",{style:{maxWidth:440},children:[o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Display Name"}),o.jsxs("form",{onSubmit:c,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),o.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:g=>r(g.target.value)})]}),s&&o.jsx("div",{className:`form-msg form-msg--${s.ok?"ok":"err"}`,children:s.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Change Password"}),o.jsxs("form",{onSubmit:f,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),o.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:a,onChange:g=>d(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),o.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:v,onChange:g=>m(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),o.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:h,onChange:g=>w(g.target.value),required:!0})]}),C&&o.jsx("div",{className:`form-msg form-msg--${C.ok?"ok":"err"}`,children:C.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function Jp(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(""),[a,d]=y.useState(!1),[v,m]=y.useState(null),h=y.useCallback(async()=>{r(!0),i(null);try{t(await hp())}catch(S){i(S.message)}finally{r(!1)}},[]);y.useEffect(()=>{h()},[h]);async function w(S){if(S.preventDefault(),!!s.trim()){d(!0);try{const C=await mp(s.trim());m(C),u(""),h()}catch(C){i(C.message)}finally{d(!1)}}}async function x(S){try{await vp(S),t(C=>C.filter(p=>p.token_uid!==S))}catch(C){i(C.message)}}return o.jsx("div",{style:{maxWidth:600},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"API Tokens"}),v&&o.jsxs("div",{className:"token-banner",children:[o.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",o.jsx("code",{children:v.raw_token}),o.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),o.jsxs("form",{className:"token-create-row",onSubmit:w,children:[o.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:s,onChange:S=>u(S.target.value),required:!0}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Creating…":"Create token"})]}),l&&o.jsx("div",{className:"form-msg form-msg--err",children:l}),n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):o.jsxs("div",{children:[e.length===0&&o.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(S=>o.jsxs("div",{className:"token-row",children:[o.jsxs("div",{className:"token-row-info",children:[o.jsx("strong",{children:S.name}),o.jsxs("div",{className:"muted",children:["Created ",S.created_at.slice(0,10),S.last_used_at&&` · Last used ${S.last_used_at.slice(0,10)}`]})]}),o.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(S.token_uid),children:"Revoke"})]},S.token_uid))]})]})})}function Zp(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(!1),[a,d]=y.useState(null);y.useEffect(()=>{(async()=>{try{t(await gp())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function v(m){m.preventDefault(),u(!0),d(null);try{await yp(e),d({ok:!0,text:"Saved."})}catch(h){d({ok:!1,text:h.message})}finally{u(!1)}}return n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):l?o.jsx("div",{className:"form-msg form-msg--err",children:l}):e?o.jsx("div",{style:{maxWidth:440},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Instance Settings"}),o.jsxs("form",{onSubmit:v,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,h])=>o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:!!e[m],onChange:w=>t(x=>({...x,[m]:w.target.checked}))}),h]},m)),o.jsxs("div",{className:"form-field",style:{marginTop:4},children:[o.jsx("label",{className:"form-label",children:"Default entry visibility"}),o.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(h=>({...h,default_entry_visibility:Number(m.target.value)})),children:[o.jsx("option",{value:0,children:"Private"}),o.jsx("option",{value:2,children:"Unlisted"}),o.jsx("option",{value:3,children:"Public"})]})]}),a&&o.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:s,children:s?"Saving…":"Save Settings"})]})]})}):null}const iu={0:"Private",1:"Public",2:"Users only",3:"Public"},qp=()=>o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function bp({archiveId:e,selectedEntry:t,onTagFilterSet:n,tagNodes:r,onTagsRefresh:l}){const[i,s]=y.useState(null),[u,a]=y.useState([]),[d,v]=y.useState(""),[m,h]=y.useState([]),[w,x]=y.useState(""),S=y.useRef(0);y.useEffect(()=>{if(!t||!e){s(null),a([]),h([]);return}const f=++S.current;s(null),a([]),Promise.all([np(e,t.entry_uid),ri(e,t.entry_uid),Lp(e,t.entry_uid)]).then(([g,j,_])=>{f===S.current&&(s(g),a(j),h(_))}).catch(()=>{})},[t,e]);async function C(){const f=d.trim();if(!(!f||!t))try{await rp(e,t.entry_uid,f),v(""),x("");const g=await ri(e,t.entry_uid);a(g),l()}catch(g){x(g.message)}}async function p(f){try{await lp(e,t.entry_uid,f);const g=await ri(e,t.entry_uid);a(g),l()}catch{}}const c=i?[["Added",xc(i.summary.archived_at)],["Source",i.summary.source_kind],["Type",i.summary.entity_kind],["Visibility",iu[i.summary.visibility]??i.summary.visibility],["Root",i.structured_root_relpath]]:[];return o.jsxs("aside",{className:"context-rail",children:[o.jsx("div",{className:"rail-eyebrow",children:"Context"}),t?i?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"rail-title",children:It(i.summary.title)||It(i.summary.entry_uid)}),i.summary.original_url&&o.jsxs("a",{className:"url-tile",href:i.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Sc(i.summary.source_kind)}}),o.jsx("span",{className:"u-text",children:i.summary.original_url}),o.jsx("span",{className:"ext",children:o.jsx(qp,{})})]}),o.jsx("div",{className:"meta-list",children:c.filter(([,f])=>f!=null&&f!=="").map(([f,g])=>o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-k",children:f}),o.jsx("span",{className:`meta-v${f==="Root"?" mono":""}`,children:It(g)})]},f))}),i.artifacts.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",o.jsx("span",{className:"num",children:i.artifacts.length})]}),o.jsx("ul",{className:"artifact-list",children:i.artifacts.map((f,g)=>o.jsx("li",{children:o.jsxs("a",{href:`/api/archives/${e}/entries/${i.summary.entry_uid}/artifacts/${g}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[o.jsx("span",{className:"artifact-name",children:f.artifact_role.replace(/_/g," ")}),o.jsx("span",{className:"artifact-size",children:f.byte_size!=null?wc(f.byte_size):"—"})]})},g))})]})]}):o.jsx("p",{className:"tags-empty",children:"Loading…"}):o.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Tags"}),u.length===0?o.jsx("p",{className:"tags-empty",children:"No tags yet."}):o.jsx("div",{className:"tags-wrap",children:u.map(f=>o.jsxs("span",{className:"tag-pill",title:f.full_path,children:[f.name,o.jsx("button",{className:"remove",title:`Remove tag ${f.full_path}`,onClick:()=>p(f.tag_uid),children:"×"})]},f.tag_uid))}),w&&o.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:w}),o.jsxs("div",{className:"tag-input-wrap",children:[o.jsx("span",{className:"hash",children:"/"}),o.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:d,onChange:f=>v(f.target.value),onKeyDown:f=>{f.key==="Enter"&&C()}}),o.jsx("button",{className:"tag-add-btn",onClick:C,children:"Add"})]})]}),m.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Collections"}),m.map(f=>o.jsxs("div",{className:"coll-row",children:[o.jsx("span",{className:"coll-name",children:f.collection_uid}),o.jsx("span",{className:"vis-badge",children:iu[f.visibility_bits]??`bits:${f.visibility_bits}`})]},f.collection_uid))]})]})]})}const Ll=y.createContext(null),eh=["archive","runs","admin","tags","collections","settings"],th=["profile","tokens","instance"];function ii(){const e=window.location.pathname.split("/").filter(Boolean),t=eh.includes(e[0])?e[0]:"archive",n=t==="settings"&&th.includes(e[1])?e[1]:"profile";return{view:t,settingsTab:n}}function nh(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function rh(){const[e,t]=y.useState("loading"),[n,r]=y.useState(null);y.useEffect(()=>{(async()=>{if(await op()){t("setup");return}const re=await dp();if(!re){t("login");return}r(re),t("authenticated")})()},[]),y.useEffect(()=>{const D=()=>{r(null),t("login")};return window.addEventListener("auth:expired",D),()=>window.removeEventListener("auth:expired",D)},[]),y.useEffect(()=>{const D=()=>{const{view:re,settingsTab:Xt}=ii();p(re),f(Xt)};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]);const[l,i]=y.useState([]),[s,u]=y.useState(null),[a,d]=y.useState([]),[v,m]=y.useState(null),[h,w]=y.useState(null),[x,S]=y.useState(null),[C,p]=y.useState(()=>ii().view),[c,f]=y.useState(()=>ii().settingsTab),[g,j]=y.useState(""),[_,T]=y.useState(""),[z,A]=y.useState(!1),[F,Z]=y.useState([]),[we,fe]=y.useState([]),[Xe,Re]=y.useState(!1),xe=y.useCallback(async(D,re,Xt)=>{if(D){A(!0);try{let dt;re||Xt?dt=await tp(D,re,Xt):dt=await ep(D),d(dt),T(dt.length===0?"No results":`${dt.length} result${dt.length===1?"":"s"}`)}catch{d([]),T("Search failed. Try again.")}finally{A(!1)}}},[]);y.useEffect(()=>{e==="authenticated"&&bf().then(D=>{if(i(D),D.length>0){const re=D[0].id;u(re)}})},[e]),y.useEffect(()=>{s&&(S(null),w(null),m(null),Promise.all([xe(s,"",null),nu(s).then(Z),li(s).then(fe)]))},[s]),y.useEffect(()=>{if(s===null)return;const D=setTimeout(()=>{xe(s,g,x)},300);return()=>clearTimeout(D)},[g,s]),y.useEffect(()=>{s!==null&&(x!==null&&p("archive"),xe(s,g,x))},[x,s]);const Ue=y.useCallback(D=>{u(D)},[]),E=y.useCallback(D=>{p(D),D==="tags"&&s&&li(s).then(fe)},[s]);y.useEffect(()=>{const D=nh(C,c);window.location.pathname!==D&&history.pushState(null,"",D)},[C,c]);const k=y.useCallback(D=>{m(D?D.entry_uid:null),w(D)},[]),R=y.useCallback(D=>{S(D)},[]),I=y.useCallback(()=>{S(null)},[]),O=y.useCallback(()=>{s&&li(s).then(fe)},[s]),pe=y.useCallback(()=>{Re(!0)},[]),oe=y.useCallback(()=>{Re(!1)},[]),Ge=y.useCallback(()=>{s&&Promise.all([xe(s,g,x),nu(s).then(Z)])},[s,g,x,xe]);return e==="loading"?o.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?o.jsx(Dp,{onComplete:()=>t("login")}):e==="login"?o.jsx(Op,{onLogin:D=>{r(D),t("authenticated")}}):o.jsx(Ll.Provider,{value:{currentUser:n,setCurrentUser:r},children:o.jsxs(o.Fragment,{children:[o.jsx(Fp,{archives:l,archiveId:s,onArchiveChange:Ue,view:C,onViewChange:E,onCaptureClick:pe}),o.jsxs("main",{className:"app-shell",children:[o.jsxs("div",{className:"workspace",children:[C==="archive"&&o.jsxs("div",{className:"toolbar",children:[o.jsxs("div",{className:"search-field",children:[o.jsx("span",{className:"ico","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"7"}),o.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),o.jsx("input",{className:"search-input",type:"search","aria-label":"Search archive","aria-busy":z,placeholder:"Search titles, URLs, types, tags…",value:g,onChange:D=>j(D.target.value)}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsxs("span",{className:"result-count",children:[_&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:_.split(" ")[0]})," ",_.split(" ").slice(1).join(" ")]}),x&&o.jsxs("button",{className:"tag-filter-badge",onClick:I,children:["× ",x]})]})]}),C==="archive"&&o.jsx(Ip,{entries:a,selectedEntryUid:v,onSelectEntry:k,archiveId:s,tagFilter:x,onClearTagFilter:I,searchQuery:g,onSearchChange:j,resultCount:_,searchBusy:z}),C==="runs"&&o.jsx(Vp,{runs:F}),C==="admin"&&o.jsx(Hp,{archives:l}),C==="tags"&&o.jsx(Wp,{tagNodes:we,tagFilter:x,onTagFilterSet:R,onViewChange:E}),C==="collections"&&o.jsx(Kp,{archiveId:s}),C==="settings"&&o.jsx(Xp,{tab:c,onTabChange:f})]}),o.jsx(bp,{archiveId:s,selectedEntry:h,onTagFilterSet:R,tagNodes:we,onTagsRefresh:O})]}),o.jsx(Mp,{open:Xe,archiveId:s,onClose:oe,onCaptured:Ge})]})})}yc(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(rh,{})})); +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function bl(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ii(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var _f=typeof WeakMap=="function"?WeakMap:Map;function Qa(e,t,n){n=it(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,Xi=r),Ii(e,t)},n}function Ka(e,t,n){n=it(-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(){Ii(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ii(e,t),typeof r!="function"&&(jt===null?jt=new Set([this]):jt.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Io(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new _f;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=Vf.bind(null,e,t,n),t.then(e,e))}function Uo(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 Ao(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=it(-1,1),t.tag=2,Nt(n,t,1))),n.lanes|=1),e)}var Pf=ct.ReactCurrentOwner,ke=!1;function he(e,t,n,r){t.child=e===null?Sa(t,null,n,r):yn(t,e.child,n,r)}function Vo(e,t,n,r,l){n=n.render;var i=t.ref;return pn(t,l),r=zs(e,t,n,r,i,l),n=Rs(),e!==null&&!ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,at(e,t,l)):(Q&&n&&ws(t),t.flags|=1,he(e,t,r,l),t.child)}function Bo(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Bs(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Ya(e,t,i,r,l)):(e=Hr(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 s=i.memoizedProps;if(n=n.compare,n=n!==null?n:er,n(s,r)&&e.ref===t.ref)return at(e,t,l)}return t.flags|=1,e=Et(i,r),e.ref=t.ref,e.return=t,t.child=e}function Ya(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(er(i,r)&&e.ref===t.ref)if(ke=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(ke=!0);else return t.lanes=e.lanes,at(e,t,l)}return Ui(e,t,n,r,l)}function Xa(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},B(un,Ee),Ee|=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,B(un,Ee),Ee|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,B(un,Ee),Ee|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,B(un,Ee),Ee|=r;return he(e,t,l,n),t.child}function Ga(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ui(e,t,n,r,l){var i=je(n)?Vt:de.current;return i=vn(t,i),pn(t,l),n=zs(e,t,n,r,i,l),r=Rs(),e!==null&&!ke?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,at(e,t,l)):(Q&&r&&ws(t),t.flags|=1,he(e,t,n,l),t.child)}function Ho(e,t,n,r,l){if(je(n)){var i=!0;el(t)}else i=!1;if(pn(t,l),t.stateNode===null)Ar(e,t),Wa(t,n,r),$i(t,n,r,l),r=!0;else if(e===null){var s=t.stateNode,u=t.memoizedProps;s.props=u;var a=s.context,d=n.contextType;typeof d=="object"&&d!==null?d=$e(d):(d=je(n)?Vt:de.current,d=vn(t,d));var v=n.getDerivedStateFromProps,m=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function";m||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u!==r||a!==d)&&$o(t,s,r,d),ht=!1;var h=t.memoizedState;s.state=h,il(t,r,s,l),a=t.memoizedState,u!==r||h!==a||Ne.current||ht?(typeof v=="function"&&(Mi(t,n,v,r),a=t.memoizedState),(u=ht||Mo(t,n,u,r,h,a,d))?(m||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),s.props=r,s.state=a,s.context=d,r=u):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Na(e,t),u=t.memoizedProps,d=t.type===t.elementType?u:Be(t.type,u),s.props=d,m=t.pendingProps,h=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=$e(a):(a=je(n)?Vt:de.current,a=vn(t,a));var w=n.getDerivedStateFromProps;(v=typeof w=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(u!==m||h!==a)&&$o(t,s,r,a),ht=!1,h=t.memoizedState,s.state=h,il(t,r,s,l);var x=t.memoizedState;u!==m||h!==x||Ne.current||ht?(typeof w=="function"&&(Mi(t,n,w,r),x=t.memoizedState),(d=ht||Mo(t,n,d,r,h,x,a)||!1)?(v||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,x,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,x,a)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),s.props=r,s.state=x,s.context=a,r=d):(typeof s.componentDidUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||u===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Ai(e,t,n,r,i,l)}function Ai(e,t,n,r,l,i){Ga(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&Po(t,n,!1),at(e,t,i);r=t.stateNode,Pf.current=t;var u=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=yn(t,e.child,null,i),t.child=yn(t,null,u,i)):he(e,t,u,i),t.memoizedState=r.state,l&&Po(t,n,!0),t.child}function Ja(e){var t=e.stateNode;t.pendingContext?_o(e,t.pendingContext,t.pendingContext!==t.context):t.context&&_o(e,t.context,!1),_s(e,t.containerInfo)}function Wo(e,t,n,r,l){return gn(),Ss(l),t.flags|=256,he(e,t,n,r),t.child}var Vi={dehydrated:null,treeContext:null,retryLane:0};function Bi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Za(e,t,n){var r=t.pendingProps,l=K.current,i=!1,s=(t.flags&128)!==0,u;if((u=s)||(u=e!==null&&e.memoizedState===null?!1:(l&2)!==0),u?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),B(K,l&1),e===null)return Di(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):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Cl(s,r,0,null),e=At(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Bi(n),t.memoizedState=Vi,e):Fs(t,s));if(l=e.memoizedState,l!==null&&(u=l.dehydrated,u!==null))return Tf(e,t,s,r,u,l,n);if(i){i=r.fallback,s=t.mode,l=e.child,u=l.sibling;var a={mode:"hidden",children:r.children};return!(s&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=Et(l,a),r.subtreeFlags=l.subtreeFlags&14680064),u!==null?i=Et(u,i):(i=At(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Bi(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Vi,r}return i=e.child,e=i.sibling,r=Et(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 Fs(e,t){return t=Cl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Pr(e,t,n,r){return r!==null&&Ss(r),yn(t,e.child,null,n),e=Fs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tf(e,t,n,r,l,i,s){if(n)return t.flags&256?(t.flags&=-257,r=bl(Error(N(422))),Pr(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=Cl({mode:"visible",children:r.children},l,0,null),i=At(i,l,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&yn(t,e.child,null,s),t.child.memoizedState=Bi(s),t.memoizedState=Vi,i);if(!(t.mode&1))return Pr(e,t,s,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var u=r.dgst;return r=u,i=Error(N(419)),r=bl(i,r,void 0),Pr(e,t,s,r)}if(u=(s&e.childLanes)!==0,ke||u){if(r=ne,r!==null){switch(s&-s){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|s)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,ut(e,l),Ke(r,e,l,-1))}return Vs(),r=bl(Error(N(421))),Pr(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Bf.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,_e=kt(l.nextSibling),Pe=t,Q=!0,We=null,e!==null&&(Oe[De++]=rt,Oe[De++]=lt,Oe[De++]=Bt,rt=e.id,lt=e.overflow,Bt=t),t=Fs(t,r.children),t.flags|=4096,t)}function Qo(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Fi(e.return,t,n)}function ei(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 qa(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(he(e,t,r.children,n),r=K.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&&Qo(e,n,t);else if(e.tag===19)Qo(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(B(K,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&&sl(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),ei(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&&sl(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}ei(t,!0,n,null,i);break;case"together":ei(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ar(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function at(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Wt|=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=Et(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Et(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Lf(e,t,n){switch(t.tag){case 3:Ja(t),gn();break;case 5:ja(t);break;case 1:je(t.type)&&el(t);break;case 4:_s(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;B(rl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(B(K,K.current&1),t.flags|=128,null):n&t.child.childLanes?Za(e,t,n):(B(K,K.current&1),e=at(e,t,n),e!==null?e.sibling:null);B(K,K.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return qa(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),B(K,K.current),r)break;return null;case 22:case 23:return t.lanes=0,Xa(e,t,n)}return at(e,t,n)}var ba,Hi,ec,tc;ba=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}};Hi=function(){};ec=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,$t(et.current);var i=null;switch(n){case"input":l=di(e,l),r=di(e,r),i=[];break;case"select":l=X({},l,{value:void 0}),r=X({},r,{value:void 0}),i=[];break;case"textarea":l=hi(e,l),r=hi(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=qr)}vi(n,r);var s;n=null;for(d in l)if(!r.hasOwnProperty(d)&&l.hasOwnProperty(d)&&l[d]!=null)if(d==="style"){var u=l[d];for(s in u)u.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Yn.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var a=r[d];if(u=l!=null?l[d]:void 0,r.hasOwnProperty(d)&&a!==u&&(a!=null||u!=null))if(d==="style")if(u){for(s in u)!u.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in a)a.hasOwnProperty(s)&&u[s]!==a[s]&&(n||(n={}),n[s]=a[s])}else n||(i||(i=[]),i.push(d,n)),n=a;else d==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,u=u?u.__html:void 0,a!=null&&u!==a&&(i=i||[]).push(d,a)):d==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(d,""+a):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Yn.hasOwnProperty(d)?(a!=null&&d==="onScroll"&&H("scroll",e),i||u===a||(i=[])):(i=i||[]).push(d,a))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};tc=function(e,t,n,r){n!==r&&(t.flags|=4)};function zn(e,t){if(!Q)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 ae(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 zf(e,t,n){var r=t.pendingProps;switch(xs(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ae(t),null;case 1:return je(t.type)&&br(),ae(t),null;case 3:return r=t.stateNode,wn(),W(Ne),W(de),Ts(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Er(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,We!==null&&(Zi(We),We=null))),Hi(e,t),ae(t),null;case 5:Ps(t);var l=$t(ir.current);if(n=t.type,e!==null&&t.stateNode!=null)ec(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 ae(t),null}if(e=$t(et.current),Er(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[qe]=t,r[rr]=i,e=(t.mode&1)!==0,n){case"dialog":H("cancel",r),H("close",r);break;case"iframe":case"object":case"embed":H("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[qe]=t,e[rr]=r,ba(e,t,!1,!1),t.stateNode=e;e:{switch(s=gi(n,r),n){case"dialog":H("cancel",e),H("close",e),l=r;break;case"iframe":case"object":case"embed":H("load",e),l=r;break;case"video":case"audio":for(l=0;lSn&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304)}else{if(!r)if(e=sl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Q)return ae(t),null}else 2*J()-i.renderingStartTime>Sn&&n!==1073741824&&(t.flags|=128,r=!0,zn(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=J(),t.sibling=null,n=K.current,B(K,r?n&1|2:n&1),t):(ae(t),null);case 22:case 23:return As(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ee&1073741824&&(ae(t),t.subtreeFlags&6&&(t.flags|=8192)):ae(t),null;case 24:return null;case 25:return null}throw Error(N(156,t.tag))}function Rf(e,t){switch(xs(t),t.tag){case 1:return je(t.type)&&br(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wn(),W(Ne),W(de),Ts(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ps(t),null;case 13:if(W(K),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(N(340));gn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return W(K),null;case 4:return wn(),null;case 10:return js(t.type._context),null;case 22:case 23:return As(),null;case 24:return null;default:return null}}var Tr=!1,ce=!1,Of=typeof WeakSet=="function"?WeakSet:Set,L=null;function on(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){G(e,t,r)}else n.current=null}function Wi(e,t,n){try{n()}catch(r){G(e,t,r)}}var Ko=!1;function Df(e,t){if(_i=Gr,e=sa(),ys(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 s=0,u=-1,a=-1,d=0,v=0,m=e,h=null;t:for(;;){for(var w;m!==n||l!==0&&m.nodeType!==3||(u=s+l),m!==i||r!==0&&m.nodeType!==3||(a=s+r),m.nodeType===3&&(s+=m.nodeValue.length),(w=m.firstChild)!==null;)h=m,m=w;for(;;){if(m===e)break t;if(h===n&&++d===l&&(u=s),h===i&&++v===r&&(a=s),(w=m.nextSibling)!==null)break;m=h,h=m.parentNode}m=w}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Pi={focusedElem:e,selectionRange:n},Gr=!1,L=t;L!==null;)if(t=L,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,L=e;else for(;L!==null;){t=L;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,C=x.memoizedState,p=t.stateNode,c=p.getSnapshotBeforeUpdate(t.elementType===t.type?S:Be(t.type,S),C);p.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var f=t.stateNode.containerInfo;f.nodeType===1?f.textContent="":f.nodeType===9&&f.documentElement&&f.removeChild(f.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(N(163))}}catch(g){G(t,t.return,g)}if(e=t.sibling,e!==null){e.return=t.return,L=e;break}L=t.return}return x=Ko,Ko=!1,x}function Wn(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&&Wi(t,n,i)}l=l.next}while(l!==r)}}function Nl(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 Qi(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 nc(e){var t=e.alternate;t!==null&&(e.alternate=null,nc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[qe],delete t[rr],delete t[zi],delete t[vf],delete t[gf])),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 rc(e){return e.tag===5||e.tag===3||e.tag===4}function Yo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rc(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 Ki(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=qr));else if(r!==4&&(e=e.child,e!==null))for(Ki(e,t,n),e=e.sibling;e!==null;)Ki(e,t,n),e=e.sibling}function Yi(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(Yi(e,t,n),e=e.sibling;e!==null;)Yi(e,t,n),e=e.sibling}var le=null,He=!1;function ft(e,t,n){for(n=n.child;n!==null;)lc(e,t,n),n=n.sibling}function lc(e,t,n){if(be&&typeof be.onCommitFiberUnmount=="function")try{be.onCommitFiberUnmount(ml,n)}catch{}switch(n.tag){case 5:ce||on(n,t);case 6:var r=le,l=He;le=null,ft(e,t,n),le=r,He=l,le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):le.removeChild(n.stateNode));break;case 18:le!==null&&(He?(e=le,n=n.stateNode,e.nodeType===8?Yl(e.parentNode,n):e.nodeType===1&&Yl(e,n),qn(e)):Yl(le,n.stateNode));break;case 4:r=le,l=He,le=n.stateNode.containerInfo,He=!0,ft(e,t,n),le=r,He=l;break;case 0:case 11:case 14:case 15:if(!ce&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Wi(n,t,s),l=l.next}while(l!==r)}ft(e,t,n);break;case 1:if(!ce&&(on(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){G(n,t,u)}ft(e,t,n);break;case 21:ft(e,t,n);break;case 22:n.mode&1?(ce=(r=ce)||n.memoizedState!==null,ft(e,t,n),ce=r):ft(e,t,n);break;default:ft(e,t,n)}}function Xo(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Of),t.forEach(function(r){var l=Hf.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Ve(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~i}if(r=l,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mf(r/1960))-r,10e?16:e,yt===null)var r=!1;else{if(e=yt,yt=null,dl=0,$&6)throw Error(N(331));var l=$;for($|=4,L=e.current;L!==null;){var i=L,s=i.child;if(L.flags&16){var u=i.deletions;if(u!==null){for(var a=0;aJ()-Is?Ut(e,0):$s|=n),Ce(e,t)}function fc(e,t){t===0&&(e.mode&1?(t=xr,xr<<=1,!(xr&130023424)&&(xr=4194304)):t=1);var n=me();e=ut(e,t),e!==null&&(dr(e,t,n),Ce(e,n))}function Bf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fc(e,n)}function Hf(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),fc(e,n)}var pc;pc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ne.current)ke=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ke=!1,Lf(e,t,n);ke=!!(e.flags&131072)}else ke=!1,Q&&t.flags&1048576&&ga(t,nl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ar(e,t),e=t.pendingProps;var l=vn(t,de.current);pn(t,n),l=zs(null,t,r,e,l,n);var i=Rs();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,je(r)?(i=!0,el(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Es(t),l.updater=kl,t.stateNode=l,l._reactInternals=t,$i(t,r,e,n),t=Ai(null,t,r,!0,i,n)):(t.tag=0,Q&&i&&ws(t),he(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ar(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Qf(r),e=Be(r,e),l){case 0:t=Ui(null,t,r,e,n);break e;case 1:t=Ho(null,t,r,e,n);break e;case 11:t=Vo(null,t,r,e,n);break e;case 14:t=Bo(null,t,r,Be(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:Be(r,l),Ui(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ho(e,t,r,l,n);case 3:e:{if(Ja(t),e===null)throw Error(N(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Na(e,t),il(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=xn(Error(N(423)),t),t=Wo(e,t,r,n,l);break e}else if(r!==l){l=xn(Error(N(424)),t),t=Wo(e,t,r,n,l);break e}else for(_e=kt(t.stateNode.containerInfo.firstChild),Pe=t,Q=!0,We=null,n=Sa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(gn(),r===l){t=at(e,t,n);break e}he(e,t,r,n)}t=t.child}return t;case 5:return ja(t),e===null&&Di(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,s=l.children,Ti(r,l)?s=null:i!==null&&Ti(r,i)&&(t.flags|=32),Ga(e,t),he(e,t,s,n),t.child;case 6:return e===null&&Di(t),null;case 13:return Za(e,t,n);case 4:return _s(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=yn(t,null,r,n):he(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Vo(e,t,r,l,n);case 7:return he(e,t,t.pendingProps,n),t.child;case 8:return he(e,t,t.pendingProps.children,n),t.child;case 12:return he(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,s=l.value,B(rl,r._currentValue),r._currentValue=s,i!==null)if(Ye(i.value,s)){if(i.children===l.children&&!Ne.current){t=at(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){s=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=it(-1,n&-n),a.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var v=d.pending;v===null?a.next=a:(a.next=v.next,v.next=a),d.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Fi(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(N(341));s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Fi(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}he(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,pn(t,n),l=$e(l),r=r(l),t.flags|=1,he(e,t,r,n),t.child;case 14:return r=t.type,l=Be(r,t.pendingProps),l=Be(r.type,l),Bo(e,t,r,l,n);case 15:return Ya(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Be(r,l),Ar(e,t),t.tag=1,je(r)?(e=!0,el(t)):e=!1,pn(t,n),Wa(t,r,l),$i(t,r,l,n),Ai(null,t,r,!0,e,n);case 19:return qa(e,t,n);case 22:return Xa(e,t,n)}throw Error(N(156,t.tag))};function hc(e,t){return Vu(e,t)}function Wf(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 Fe(e,t,n,r){return new Wf(e,t,n,r)}function Bs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Qf(e){if(typeof e=="function")return Bs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===os)return 11;if(e===us)return 14}return 2}function Et(e,t){var n=e.alternate;return n===null?(n=Fe(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 Hr(e,t,n,r,l,i){var s=2;if(r=e,typeof e=="function")Bs(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Zt:return At(n.children,l,i,t);case ss:s=8,l|=8;break;case oi:return e=Fe(12,n,t,l|2),e.elementType=oi,e.lanes=i,e;case ui:return e=Fe(13,n,t,l),e.elementType=ui,e.lanes=i,e;case ai:return e=Fe(19,n,t,l),e.elementType=ai,e.lanes=i,e;case ju:return Cl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ku:s=10;break e;case Nu:s=9;break e;case os:s=11;break e;case us:s=14;break e;case pt:s=16,r=null;break e}throw Error(N(130,e==null?e:typeof e,""))}return t=Fe(s,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function At(e,t,n,r){return e=Fe(7,e,r,t),e.lanes=n,e}function Cl(e,t,n,r){return e=Fe(22,e,r,t),e.elementType=ju,e.lanes=n,e.stateNode={isHidden:!1},e}function ti(e,t,n){return e=Fe(6,e,null,t),e.lanes=n,e}function ni(e,t,n){return t=Fe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kf(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=Ml(0),this.expirationTimes=Ml(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ml(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Hs(e,t,n,r,l,i,s,u,a){return e=new Kf(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Fe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Es(i),e}function Yf(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yc)}catch(e){console.error(e)}}yc(),yu.exports=Le;var qf=yu.exports,wc,nu=qf;wc=nu.createRoot,nu.hydrateRoot;async function ye(e){const t=await fetch(e);if(!t.ok)throw new Error(`${t.status} ${t.statusText}`);return t.json()}async function bf(){return ye("/api/archives")}async function ep(e){return ye(`/api/archives/${e}/entries`)}async function tp(e,t,n){const r=new URLSearchParams;return t&&r.set("q",t),n&&r.set("tag",n),ye(`/api/archives/${e}/entries/search?${r}`)}async function np(e,t){return ye(`/api/archives/${e}/entries/${t}`)}async function ri(e,t){return ye(`/api/archives/${e}/entries/${t}/tags`)}async function rp(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag_path:n})});if(!r.ok)throw new Error(`Failed to add tag (${r.status})`)}async function lp(e,t,n){const r=await fetch(`/api/archives/${e}/entries/${t}/tags/${n}`,{method:"DELETE"});if(!r.ok)throw new Error(`Remove failed (${r.status})`)}async function ru(e){return ye(`/api/archives/${e}/runs`)}async function li(e){return ye(`/api/archives/${e}/tags`)}async function ip(e,t){const n=await fetch(`/api/archives/${e}/captures`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locator:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function sp(e,t){return ye(`/api/archives/${e}/capture_jobs/${t}`)}async function op(){return(await(await fetch("/api/auth/setup")).json()).setup_required===!0}async function up(e,t){const n=await fetch("/api/auth/setup",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Setup failed");return n.json()}async function ap(e,t){const n=await fetch("/api/auth/login",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok)throw new Error((await n.json()).error||"Login failed");return n.json()}async function cp(){await fetch("/api/auth/logout",{method:"POST"})}async function dp(){const e=await fetch("/api/auth/me");return e.status===401?null:e.json()}async function fp(e){const t=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({display_name:e})});if(!t.ok)throw new Error(await t.text())}async function pp(e,t){const n=await fetch("/api/auth/me",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({current_password:e,new_password:t})});if(!n.ok){let r=await n.text();try{r=JSON.parse(r).error??r}catch{}throw new Error(r)}}async function hp(){return ye("/api/auth/tokens")}async function mp(e){const t=await fetch("/api/auth/tokens",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})});if(!t.ok)throw new Error(await t.text());return t.json()}async function vp(e){const t=await fetch(`/api/auth/tokens/${e}`,{method:"DELETE"});if(!t.ok)throw new Error(await t.text())}async function gp(){return ye("/api/admin/instance-settings")}async function yp(e){const t=await fetch("/api/admin/instance-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await t.text())}async function wp(){return ye("/api/admin/users")}async function xp(e,t,n){const r=await fetch("/api/admin/users",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t,email:n||void 0})});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error||`HTTP ${r.status}`)}return r.json()}async function Sp(e,t){const n=await fetch(`/api/admin/users/${e}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function kp(){return ye("/api/admin/roles")}async function Np(e,t){const n=await fetch("/api/admin/roles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:e,name:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||`HTTP ${n.status}`)}return n.json()}async function jp(e){return ye(`/api/archives/${e}/collections`)}async function Cp(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,slug:n,default_visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}return l.json()}async function Ep(e,t){return ye(`/api/archives/${e}/collections/${t}`)}async function _p(e,t,n,r=2){const l=await fetch(`/api/archives/${e}/collections/${t}/entries`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({entry_uid:n,visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Pp(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"DELETE"});if(!r.ok){const l=await r.json().catch(()=>({error:r.statusText}));throw new Error(l.error||r.statusText)}}async function Tp(e,t,n,r){const l=await fetch(`/api/archives/${e}/collections/${t}/entries/${n}`,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify({visibility_bits:r})});if(!l.ok){const i=await l.json().catch(()=>({error:l.statusText}));throw new Error(i.error||l.statusText)}}async function Lp(e,t){return ye(`/api/archives/${e}/entries/${t}/collections`)}async function lu(e,t,n){const r=await fetch(`/api/archives/${e}/collections/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const l=await r.json().catch(()=>({}));throw new Error(l.error??r.statusText)}}async function zp(e,t){const n=await fetch(`/api/archives/${e}/collections/${t}`,{method:"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??n.statusText)}}const Rp=window.fetch;window.fetch=async(...e)=>{var n;const t=await Rp(...e);return t.status===401&&((typeof e[0]=="string"?e[0]:((n=e[0])==null?void 0:n.url)??"").includes("/api/auth/")||window.dispatchEvent(new CustomEvent("auth:expired"))),t};function Op({onLogin:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(null),[u,a]=y.useState(!1);async function d(v){v.preventDefault(),s(null),a(!0);try{const m=await ap(t,r);e(m)}catch(m){s(m.message)}finally{a(!1)}}return o.jsx("div",{className:"login-page",children:o.jsxs("div",{className:"login-card",children:[o.jsx("h1",{className:"login-brand",children:"Archivr"}),o.jsx("p",{className:"login-tagline",children:"Sign in to your archive"}),o.jsxs("form",{onSubmit:d,children:[o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-username",children:"Username"}),o.jsx("input",{className:"login-input",id:"login-username",type:"text",value:t,onChange:v=>n(v.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"login-field",children:[o.jsx("label",{className:"login-label",htmlFor:"login-password",children:"Password"}),o.jsx("input",{className:"login-input",id:"login-password",type:"password",value:r,onChange:v=>l(v.target.value),required:!0,autoComplete:"current-password"})]}),i&&o.jsx("p",{className:"login-error",children:i}),o.jsx("button",{className:"login-submit",type:"submit",disabled:u,children:u?"Signing in…":"Sign in"})]})]})})}function Dp({onComplete:e}){const[t,n]=y.useState(""),[r,l]=y.useState(""),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1);async function m(h){if(h.preventDefault(),r!==i){a("Passwords do not match");return}if(r.length<8){a("Password must be at least 8 characters");return}a(null),v(!0);try{await up(t,r),e()}catch(w){a(w.message)}finally{v(!1)}}return o.jsx("div",{className:"setup-page",children:o.jsxs("div",{className:"setup-card",children:[o.jsx("h1",{className:"setup-brand",children:"Archivr"}),o.jsx("p",{className:"setup-tagline",children:"Create your owner account to get started."}),o.jsxs("form",{onSubmit:m,children:[o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-username",children:"Username"}),o.jsx("input",{className:"setup-input",id:"setup-username",type:"text",value:t,onChange:h=>n(h.target.value),autoFocus:!0,required:!0,autoComplete:"username"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-password",children:"Password"}),o.jsx("input",{className:"setup-input",id:"setup-password",type:"password",value:r,onChange:h=>l(h.target.value),required:!0,autoComplete:"new-password"})]}),o.jsxs("div",{className:"setup-field",children:[o.jsx("label",{className:"setup-label",htmlFor:"setup-confirm",children:"Confirm password"}),o.jsx("input",{className:"setup-input",id:"setup-confirm",type:"password",value:i,onChange:h=>s(h.target.value),required:!0,autoComplete:"new-password"})]}),u&&o.jsx("p",{className:"setup-error",children:u}),o.jsx("button",{className:"setup-submit",type:"submit",disabled:d,children:d?"Creating account…":"Create account"})]})]})})}function Fp({archives:e,archiveId:t,onArchiveChange:n,view:r,onViewChange:l,onCaptureClick:i}){const{currentUser:s,setCurrentUser:u}=y.useContext(Ll)??{},[a,d]=y.useState(!1);async function v(){d(!0),await cp(),u(null),window.location.reload()}return o.jsxs("header",{className:"topbar",children:[o.jsx("div",{className:"brand",children:"Archivr"}),o.jsx("div",{className:"switcher",children:o.jsx("select",{"aria-label":"Select archive",value:t??"",onChange:m=>n(m.target.value),children:e.map(m=>o.jsx("option",{value:m.id,children:m.label},m.id))})}),o.jsx("nav",{className:"nav","aria-label":"Primary",children:["archive","runs","admin","tags","collections","settings"].map(m=>o.jsx("button",{className:`nav-link${r===m?" is-active":""}`,onClick:()=>l(m),children:m.charAt(0).toUpperCase()+m.slice(1)},m))}),o.jsx("button",{className:"capture-button",onClick:i,children:"+ Capture"}),s&&o.jsxs("div",{className:"user-menu",children:[o.jsx("span",{className:"user-name",children:s.display_name||s.username}),o.jsx("button",{className:"logout-btn",onClick:v,disabled:a,children:a?"Logging out…":"Log out"})]})]})}function Mp({open:e,archiveId:t,onClose:n,onCaptured:r}){const l=y.useRef(null),[i,s]=y.useState(""),[u,a]=y.useState(null),[d,v]=y.useState(!1),[m,h]=y.useState(null),w=y.useRef(null);y.useEffect(()=>{const C=l.current;if(!C)return;const p=()=>{clearInterval(w.current),n()};return C.addEventListener("close",p),()=>C.removeEventListener("close",p)},[n]),y.useEffect(()=>{const C=l.current;C&&(e?(s(""),a(null),h(null),v(!1),clearInterval(w.current),C.open||C.showModal()):C.open&&C.close())},[e]);async function x(){if(!i.trim()){a("Enter a locator.");return}v(!0),a(null),h(null);try{const C=await ip(t,i.trim());h("running"),w.current=setInterval(async()=>{var p;try{const c=await sp(t,C.job_uid);c.status==="completed"?(clearInterval(w.current),w.current=null,v(!1),h("completed"),(p=l.current)==null||p.close(),r()):c.status==="failed"&&(clearInterval(w.current),w.current=null,v(!1),h("failed"),a(c.error_text||"Capture failed."))}catch(c){clearInterval(w.current),w.current=null,v(!1),a(c.message)}},500)}catch(C){a(C.message),v(!1)}}function S(){return d?m==="running"?"Running…":"Capturing…":"Capture"}return o.jsx("dialog",{ref:l,className:"capture-dialog",children:o.jsxs("div",{className:"capture-dialog-inner",children:[o.jsx("h2",{className:"capture-dialog-title",children:"Capture"}),o.jsx("label",{htmlFor:"capture-locator",className:"capture-label",children:"Locator"}),o.jsx("input",{id:"capture-locator",className:"capture-input",type:"text",placeholder:"tweet:1234567890 or https://...",value:i,onChange:C=>s(C.target.value),onKeyDown:C=>{C.key==="Enter"&&x()},autoComplete:"off"}),u&&o.jsx("div",{className:"capture-error",children:u}),o.jsxs("div",{className:"capture-actions",children:[o.jsx("button",{type:"button",className:"capture-cancel",onClick:()=>{var C;return(C=l.current)==null?void 0:C.close()},children:"Cancel"}),o.jsx("button",{type:"button",className:"capture-submit",onClick:x,disabled:d,children:S()})]})]})})}function qi(e){if(!e)return"0 B";const t=["B","KB","MB","GB"];let n=e,r=0;for(;n>=1024&&rString(r).padStart(2,"0");return`${t.getUTCFullYear()}-${n(t.getUTCMonth()+1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`}const iu={youtube:'',x:'',instagram:'',facebook:'',tiktok:'',reddit:'',snapchat:'',local:'',web:'',other:'?'};function Sc(e){return iu[e]??iu.other}function $p({entry:e,archiveId:t,isSelected:n,onSelect:r}){const[l,i]=y.useState(!1),u=e.source_kind==="web"&&e.entity_kind==="page"&&e.has_favicon&&t&&!l?o.jsx("img",{src:`/api/archives/${t}/entries/${e.entry_uid}/favicon`,width:"16",height:"16",alt:"",onError:()=>i(!0),style:{objectFit:"contain"}}):o.jsx("span",{dangerouslySetInnerHTML:{__html:Sc(e.source_kind)}});return o.jsxs("div",{className:n?"is-selected":void 0,tabIndex:0,"data-entry-uid":e.entry_uid,onClick:r,onKeyDown:a=>{a.key==="Enter"&&r()},children:[o.jsx("div",{className:"col-added",children:xc(e.archived_at)}),o.jsxs("div",{className:"col-title",children:[o.jsx("span",{className:"source-icon",children:u}),o.jsx("span",{className:"entry-title",children:It(e.title)||It(e.entry_uid)})]}),o.jsx("div",{className:"col-type",children:o.jsx("span",{className:"type-pill",children:It(e.entity_kind)})}),o.jsxs("div",{className:"col-size",children:[o.jsx("span",{className:"size-total",children:qi(e.total_artifact_bytes)}),e.cached_bytes>0&&e.total_artifact_bytes>0&&o.jsxs("span",{className:"size-cached-pct",title:`${qi(e.cached_bytes)} already on disk from an earlier entry`,children:[Math.round(e.cached_bytes/e.total_artifact_bytes*100),"% cached"]})]}),o.jsx("div",{className:"url-cell col-url",children:It(e.original_url)})]})}function Ip({entries:e,selectedEntryUid:t,onSelectEntry:n,archiveId:r}){return o.jsx("section",{id:"archive-view",className:"view is-active",children:o.jsxs("div",{className:"entry-table",children:[o.jsxs("div",{className:"entry-header-row",children:[o.jsx("div",{className:"col-added",children:"Added"}),o.jsx("div",{className:"col-title",children:"Title"}),o.jsx("div",{className:"col-type",children:"Type"}),o.jsx("div",{className:"col-size",children:"Size"}),o.jsx("div",{className:"col-url",children:"Original URL"})]}),o.jsx("div",{id:"entries-body",children:e.map(l=>o.jsx($p,{entry:l,archiveId:r,isSelected:l.entry_uid===t,onSelect:()=>n(l)},l.entry_uid))})]})})}function Up(e){if(!e)return"—";try{return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return e}}function Ap({status:e}){const t=e==="completed"?"run-status--completed":e==="failed"?"run-status--failed":e==="running"?"run-status--running":"";return o.jsx("span",{className:`run-status ${t}`,children:e||"—"})}function Vp({runs:e}){return o.jsx("section",{id:"runs-view",className:"view is-active",children:o.jsxs("table",{className:"entry-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Started"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Requested"}),o.jsx("th",{children:"Completed"}),o.jsx("th",{children:"Failed"})]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,style:{color:"var(--muted)",padding:"24px 16px",textAlign:"center"},children:"No runs yet."})}):e.map((t,n)=>o.jsxs("tr",{children:[o.jsx("td",{children:Up(t.started_at)}),o.jsx("td",{children:o.jsx(Ap,{status:t.status})}),o.jsx("td",{children:t.requested_count??"—"}),o.jsx("td",{children:t.completed_count??"—"}),o.jsx("td",{children:t.failed_count??"—"})]},n))})]})})}const Bp=4;function Hp({archives:e}){const{currentUser:t}=y.useContext(Ll)??{},n=t&&(t.role_bits&Bp)!==0,[r,l]=y.useState("users"),[i,s]=y.useState([]),[u,a]=y.useState([]),[d,v]=y.useState(!1),[m,h]=y.useState(null),[w,x]=y.useState(""),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(null),[j,_]=y.useState(!1),[T,z]=y.useState(""),[A,F]=y.useState(""),[Z,we]=y.useState(null),[fe,Xe]=y.useState(!1),Re=y.useCallback(async()=>{if(n){v(!0),h(null);try{const[k,R]=await Promise.all([wp(),kp()]);s(k),a(R)}catch(k){h(k.message)}finally{v(!1)}}},[n]);y.useEffect(()=>{Re()},[Re]);async function xe(k){const R=k.status==="active"?"disabled":"active";try{await Sp(k.user_uid,R),s(I=>I.map(O=>O.user_uid===k.user_uid?{...O,status:R}:O))}catch(I){h(I.message)}}async function Ue(k){if(k.preventDefault(),!w.trim()||!S){g("Username and password required");return}_(!0),g(null);try{await xp(w.trim(),S,p.trim()||void 0),x(""),C(""),c(""),await Re()}catch(R){g(R.message)}finally{_(!1)}}async function E(k){if(k.preventDefault(),!T.trim()||!A.trim()){we("Slug and name required");return}Xe(!0),we(null);try{await Np(T.trim(),A.trim()),z(""),F(""),await Re()}catch(R){we(R.message)}finally{Xe(!1)}}return n?o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsxs("div",{className:"view-tabs",children:[o.jsx("button",{className:`view-tab${r==="users"?" is-active":""}`,onClick:()=>l("users"),children:"Users"}),o.jsx("button",{className:`view-tab${r==="roles"?" is-active":""}`,onClick:()=>l("roles"),children:"Roles"}),o.jsx("button",{className:`view-tab${r==="archives"?" is-active":""}`,onClick:()=>l("archives"),children:"Archives"})]}),m&&o.jsx("div",{className:"form-msg form-msg--err",children:m}),r==="users"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Users"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Username"}),o.jsx("th",{children:"Email"}),o.jsx("th",{children:"Roles"}),o.jsx("th",{children:"Status"}),o.jsx("th",{children:"Actions"})]})}),o.jsx("tbody",{children:i.map(k=>o.jsxs("tr",{className:k.status==="disabled"?"admin-row-disabled":"",children:[o.jsx("td",{children:k.username}),o.jsx("td",{className:"muted",children:k.email||"—"}),o.jsx("td",{children:k.role_slugs.join(", ")||"—"}),o.jsx("td",{children:o.jsx("span",{className:`status-badge status-${k.status}`,children:k.status})}),o.jsx("td",{children:o.jsx("button",{className:"admin-action-btn",onClick:()=>xe(k),children:k.status==="active"?"Ban":"Unban"})})]},k.user_uid))})]}),o.jsx("h3",{children:"Create User"}),o.jsxs("form",{className:"admin-form",onSubmit:Ue,children:[o.jsx("input",{className:"admin-input",placeholder:"Username",value:w,onChange:k=>x(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"password",placeholder:"Password (min 8 chars)",value:S,onChange:k=>C(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",type:"email",placeholder:"Email (optional)",value:p,onChange:k=>c(k.target.value)}),f&&o.jsx("div",{className:"form-msg form-msg--err",children:f}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create User"})]})]}),r==="roles"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Roles"}),d?o.jsx("p",{className:"muted",children:"Loading…"}):o.jsxs("table",{className:"admin-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"Slug"}),o.jsx("th",{children:"Name"}),o.jsx("th",{children:"Level"}),o.jsx("th",{children:"Bit"}),o.jsx("th",{children:"Built-in"})]})}),o.jsx("tbody",{children:u.map(k=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("code",{children:k.slug})}),o.jsx("td",{children:k.name}),o.jsx("td",{children:k.level}),o.jsx("td",{children:k.bit_position}),o.jsx("td",{children:k.is_builtin?"✓":""})]},k.role_uid))})]}),o.jsx("h3",{children:"Create Custom Role"}),o.jsxs("form",{className:"admin-form",onSubmit:E,children:[o.jsx("input",{className:"admin-input",placeholder:"Slug (e.g. moderator)",value:T,onChange:k=>z(k.target.value),required:!0}),o.jsx("input",{className:"admin-input",placeholder:"Display Name (e.g. Moderator)",value:A,onChange:k=>F(k.target.value),required:!0}),Z&&o.jsx("div",{className:"form-msg form-msg--err",children:Z}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:fe,children:fe?"Creating…":"Create Role"})]})]}),r==="archives"&&o.jsxs("div",{className:"admin-section",children:[o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})]}):o.jsxs("section",{id:"admin-view",className:"view admin-view is-active",children:[o.jsx("h1",{children:"Admin"}),o.jsx("p",{className:"muted",children:"You need admin privileges to access this panel."}),o.jsx("h2",{children:"Mounted Archives"}),o.jsx("div",{className:"admin-list",children:e.map(k=>o.jsxs("div",{className:"admin-archive",children:[o.jsx("strong",{children:k.label}),o.jsx("div",{className:"muted",children:k.archive_path})]},k.id))})]})}function kc({node:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){var s;const l=t===e.tag.full_path;function i(){const u=l?null:e.tag.full_path;n(u),r("archive")}return o.jsxs("li",{children:[o.jsx("button",{className:`tag-node-btn${l?" is-active":""}`,title:e.tag.full_path,onClick:i,children:e.tag.name}),((s=e.children)==null?void 0:s.length)>0&&o.jsx("div",{className:"tag-children",children:o.jsx("ul",{className:"tag-tree-list",children:e.children.map(u=>o.jsx(kc,{node:u,tagFilter:t,onTagFilterSet:n,onViewChange:r},u.tag.tag_uid))})})]})}function Wp({tagNodes:e,tagFilter:t,onTagFilterSet:n,onViewChange:r}){return o.jsx("section",{id:"tags-view",className:"view is-active",children:o.jsxs("div",{className:"tag-tree",children:[o.jsxs("div",{className:"tag-tree-header",children:[o.jsx("span",{className:"tag-tree-title",children:"Tags"}),t&&o.jsxs("span",{className:"tag-tree-active",children:["Filtering: ",t]})]}),e.length===0?o.jsx("p",{className:"muted",style:{padding:"8px 0"},children:"No tags yet."}):o.jsx("ul",{className:"tag-tree-list",children:e.map(l=>o.jsx(kc,{node:l,tagFilter:t,onTagFilterSet:n,onViewChange:r},l.tag.tag_uid))})]})})}const $n=[{value:0,label:"Private"},{value:2,label:"Users only"},{value:3,label:"Public"}],Qp=e=>{var t;return((t=$n.find(n=>n.value===e))==null?void 0:t.label)??String(e)};function Kp({archiveId:e}){const[t,n]=y.useState([]),[r,l]=y.useState(!1),[i,s]=y.useState(null),[u,a]=y.useState(null),[d,v]=y.useState(null),[m,h]=y.useState(!1),[w,x]=y.useState(null),[S,C]=y.useState(""),[p,c]=y.useState(""),[f,g]=y.useState(2),[j,_]=y.useState(!1),[T,z]=y.useState(null),[A,F]=y.useState(""),[Z,we]=y.useState(2),[fe,Xe]=y.useState(!1),[Re,xe]=y.useState(null),[Ue,E]=y.useState(!1),[k,R]=y.useState(""),I=y.useRef(null),O=t.find(P=>P.collection_uid===u)??null,pe=(O==null?void 0:O.slug)==="_default_",oe=y.useCallback(async()=>{if(e){l(!0),s(null);try{const P=await jp(e);n(P)}catch(P){s(P.message)}finally{l(!1)}}},[e]),Ge=y.useCallback(async P=>{if(!P){v(null);return}h(!0),x(null);try{const U=await Ep(e,P);v(U)}catch(U){x(U.message)}finally{h(!1)}},[e]);y.useEffect(()=>{oe()},[oe]),y.useEffect(()=>{Ge(u)},[u,Ge]),y.useEffect(()=>{Ue&&I.current&&I.current.focus()},[Ue]);async function D(P){P.preventDefault();const U=S.trim(),Ae=p.trim();if(!(!U||!Ae)){_(!0),z(null);try{const Rt=await Cp(e,U,Ae,f);C(""),c(""),g(2),await oe(),a(Rt.collection_uid)}catch(Rt){z(Rt.message)}finally{_(!1)}}}async function re(){const P=k.trim();if(!P||!O){E(!1);return}try{await lu(e,O.collection_uid,{name:P}),await oe(),v(U=>U&&{...U,name:P})}catch(U){s(U.message)}finally{E(!1)}}async function Xt(P){if(O)try{await lu(e,O.collection_uid,{default_visibility_bits:P}),await oe(),v(U=>U&&{...U,default_visibility_bits:P})}catch(U){s(U.message)}}async function dt(){if(O&&window.confirm(`Delete collection "${O.name}"? Entries will not be deleted.`))try{await zp(e,O.collection_uid),a(null),v(null),await oe()}catch(P){s(P.message)}}async function Nc(P){P.preventDefault();const U=A.trim();if(!(!U||!O)){Xe(!0),xe(null);try{await _p(e,O.collection_uid,U,Z),F(""),await Ge(O.collection_uid)}catch(Ae){xe(Ae.message)}finally{Xe(!1)}}}async function jc(P){if(O)try{await Pp(e,O.collection_uid,P),await Ge(O.collection_uid)}catch(U){x(U.message)}}async function Cc(P,U){if(O)try{await Tp(e,O.collection_uid,P,U),v(Ae=>Ae&&{...Ae,entries:Ae.entries.map(Rt=>Rt.entry_uid===P?{...Rt,collection_visibility_bits:U}:Rt)})}catch(Ae){x(Ae.message)}}return e?o.jsxs("div",{className:"collections-view",children:[o.jsx("h2",{className:"collections-heading",children:"Collections"}),r&&o.jsx("div",{className:"muted",children:"Loading…"}),i&&o.jsxs("div",{className:"collections-error",children:[i," ",o.jsx("button",{onClick:()=>s(null),className:"coll-dismiss",children:"×"})]}),o.jsxs("div",{className:"collections-layout",children:[o.jsxs("div",{className:"collections-sidebar",children:[t.map(P=>o.jsxs("button",{className:`coll-sidebar-row${u===P.collection_uid?" is-active":""}`,onClick:()=>a(P.collection_uid),children:[o.jsx("span",{className:"coll-row-name",children:P.name}),o.jsx("span",{className:"coll-row-meta",children:Qp(P.default_visibility_bits)})]},P.collection_uid)),t.length===0&&!r&&o.jsx("div",{className:"muted",style:{padding:"8px 12px"},children:"No collections yet."})]}),O?o.jsxs("div",{className:"coll-detail",children:[o.jsxs("div",{className:"coll-detail-header",children:[Ue?o.jsx("input",{ref:I,className:"coll-rename-input",value:k,onChange:P=>R(P.target.value),onBlur:re,onKeyDown:P=>{P.key==="Enter"&&re(),P.key==="Escape"&&E(!1)}}):o.jsxs("h3",{className:`coll-detail-name${pe?"":" coll-detail-name--editable"}`,title:pe?void 0:"Click to rename",onClick:()=>{pe||(R(O.name),E(!0))},children:[(d==null?void 0:d.name)??O.name,!pe&&o.jsx("span",{className:"coll-edit-hint",children:" ✎"})]}),!pe&&o.jsx("button",{className:"coll-delete-btn",onClick:dt,title:"Delete collection",children:"Delete"})]}),o.jsxs("div",{className:"coll-detail-vis",children:[o.jsx("span",{className:"coll-vis-label",children:"Default visibility"}),o.jsx("select",{className:"coll-vis-select",value:(d==null?void 0:d.default_visibility_bits)??O.default_visibility_bits,onChange:P=>Xt(Number(P.target.value)),disabled:pe,children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),o.jsxs("div",{className:"coll-entries-section",children:[o.jsx("div",{className:"coll-section-heading",children:"Entries"}),m&&o.jsx("div",{className:"muted",children:"Loading…"}),w&&o.jsx("div",{className:"collections-error",children:w}),!m&&d&&(d.entries.length===0?o.jsx("div",{className:"muted",children:"No entries in this collection."}):o.jsx("ul",{className:"coll-entries-list",children:d.entries.map(P=>o.jsxs("li",{className:"coll-entry-row",children:[o.jsxs("div",{className:"coll-entry-info",children:[o.jsx("span",{className:"coll-entry-title",children:P.title||P.entry_uid}),o.jsx("span",{className:"coll-entry-kind muted",children:P.source_kind})]}),o.jsxs("div",{className:"coll-entry-actions",children:[o.jsx("select",{className:"coll-entry-vis-select",value:P.collection_visibility_bits,onChange:U=>Cc(P.entry_uid,Number(U.target.value)),children:$n.map(U=>o.jsx("option",{value:U.value,children:U.label},U.value))}),!pe&&o.jsx("button",{className:"coll-entry-remove",onClick:()=>jc(P.entry_uid),title:"Remove from collection",children:"×"})]})]},P.entry_uid))}))]}),!pe&&o.jsxs("form",{className:"coll-add-entry-form",onSubmit:Nc,children:[o.jsx("div",{className:"coll-section-heading",children:"Add entry"}),o.jsxs("div",{className:"coll-add-entry-row",children:[o.jsx("input",{className:"coll-add-entry-input",type:"text",value:A,onChange:P=>F(P.target.value),placeholder:"entry_uid",required:!0}),o.jsx("select",{className:"coll-vis-select",value:Z,onChange:P=>we(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))}),o.jsx("button",{className:"coll-add-btn",type:"submit",disabled:fe,children:fe?"…":"Add"})]}),Re&&o.jsx("div",{className:"collections-error",style:{marginTop:4},children:Re})]})]}):o.jsx("div",{className:"coll-detail coll-detail--empty",children:o.jsx("div",{className:"muted",children:"Select a collection to view details."})})]}),o.jsxs("details",{className:"coll-create-details",children:[o.jsx("summary",{children:"+ Create collection"}),o.jsxs("form",{className:"coll-create-form",onSubmit:D,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-name",children:"Name"}),o.jsx("input",{className:"capture-input",id:"coll-name",type:"text",value:S,onChange:P=>{C(P.target.value),p||c(P.target.value.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-slug",children:"Slug"}),o.jsx("input",{className:"capture-input",id:"coll-slug",type:"text",value:p,onChange:P=>c(P.target.value),placeholder:"my-collection",required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"coll-vis",children:"Default visibility"}),o.jsx("select",{className:"capture-input",id:"coll-vis",style:{height:42},value:f,onChange:P=>g(Number(P.target.value)),children:$n.map(P=>o.jsx("option",{value:P.value,children:P.label},P.value))})]}),T&&o.jsx("div",{className:"collections-error",children:T}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:j,children:j?"Creating…":"Create collection"})]})]})]}):o.jsx("div",{className:"view-placeholder",children:"Select an archive."})}const Yp=4;function Xp({tab:e,onTabChange:t}){const{currentUser:n,setCurrentUser:r}=y.useContext(Ll)??{},l=n&&(n.role_bits&Yp)!==0,i=["profile","tokens",...l?["instance"]:[]],s={profile:"Profile",tokens:"API Tokens",instance:"Instance"};return o.jsxs("section",{className:"admin-view",children:[o.jsx("h1",{children:"Settings"}),o.jsx("div",{className:"view-tabs",children:i.map(u=>o.jsx("button",{className:`view-tab${e===u?" is-active":""}`,onClick:()=>t(u),children:s[u]},u))}),e==="profile"&&o.jsx(Gp,{currentUser:n,setCurrentUser:r}),e==="tokens"&&o.jsx(Jp,{}),e==="instance"&&l&&o.jsx(Zp,{})]})}function Gp({currentUser:e,setCurrentUser:t}){const[n,r]=y.useState((e==null?void 0:e.display_name)??""),[l,i]=y.useState(!1),[s,u]=y.useState(null),[a,d]=y.useState(""),[v,m]=y.useState(""),[h,w]=y.useState(""),[x,S]=y.useState(!1),[C,p]=y.useState(null);async function c(g){g.preventDefault(),i(!0),u(null);try{await fp(n),t(j=>({...j,display_name:n||null})),u({ok:!0,text:"Saved."})}catch(j){u({ok:!1,text:j.message})}finally{i(!1)}}async function f(g){if(g.preventDefault(),v!==h){p({ok:!1,text:"Passwords do not match."});return}S(!0),p(null);try{await pp(a,v),d(""),m(""),w(""),p({ok:!0,text:"Password changed."})}catch(j){p({ok:!1,text:j.message})}finally{S(!1)}}return o.jsxs("div",{style:{maxWidth:440},children:[o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Display Name"}),o.jsxs("form",{onSubmit:c,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"display-name",children:"Name shown in the UI"}),o.jsx("input",{className:"field-input",id:"display-name",placeholder:(e==null?void 0:e.username)??"",value:n,onChange:g=>r(g.target.value)})]}),s&&o.jsx("div",{className:`form-msg form-msg--${s.ok?"ok":"err"}`,children:s.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:l,children:l?"Saving…":"Save"})]})]}),o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Change Password"}),o.jsxs("form",{onSubmit:f,children:[o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"cur-pw",children:"Current password"}),o.jsx("input",{className:"field-input",id:"cur-pw",type:"password",value:a,onChange:g=>d(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"new-pw",children:"New password"}),o.jsx("input",{className:"field-input",id:"new-pw",type:"password",value:v,onChange:g=>m(g.target.value),required:!0})]}),o.jsxs("div",{className:"form-field",children:[o.jsx("label",{className:"form-label",htmlFor:"confirm-pw",children:"Confirm new password"}),o.jsx("input",{className:"field-input",id:"confirm-pw",type:"password",value:h,onChange:g=>w(g.target.value),required:!0})]}),C&&o.jsx("div",{className:`form-msg form-msg--${C.ok?"ok":"err"}`,children:C.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:x,children:x?"Changing…":"Change Password"})]})]})]})}function Jp(){const[e,t]=y.useState([]),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(""),[a,d]=y.useState(!1),[v,m]=y.useState(null),h=y.useCallback(async()=>{r(!0),i(null);try{t(await hp())}catch(S){i(S.message)}finally{r(!1)}},[]);y.useEffect(()=>{h()},[h]);async function w(S){if(S.preventDefault(),!!s.trim()){d(!0);try{const C=await mp(s.trim());m(C),u(""),h()}catch(C){i(C.message)}finally{d(!1)}}}async function x(S){try{await vp(S),t(C=>C.filter(p=>p.token_uid!==S))}catch(C){i(C.message)}}return o.jsx("div",{style:{maxWidth:600},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"API Tokens"}),v&&o.jsxs("div",{className:"token-banner",children:[o.jsx("strong",{children:"Token created."})," Copy it now — it won't be shown again.",o.jsx("code",{children:v.raw_token}),o.jsx("button",{className:"token-dismiss",onClick:()=>m(null),children:"Dismiss"})]}),o.jsxs("form",{className:"token-create-row",onSubmit:w,children:[o.jsx("input",{className:"field-input field-input--flex",placeholder:"Token name",value:s,onChange:S=>u(S.target.value),required:!0}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:a,children:a?"Creating…":"Create token"})]}),l&&o.jsx("div",{className:"form-msg form-msg--err",children:l}),n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):o.jsxs("div",{children:[e.length===0&&o.jsx("div",{className:"muted",children:"No tokens yet."}),e.map(S=>o.jsxs("div",{className:"token-row",children:[o.jsxs("div",{className:"token-row-info",children:[o.jsx("strong",{children:S.name}),o.jsxs("div",{className:"muted",children:["Created ",S.created_at.slice(0,10),S.last_used_at&&` · Last used ${S.last_used_at.slice(0,10)}`]})]}),o.jsx("button",{className:"btn-danger",style:{fontSize:12,padding:"4px 10px"},onClick:()=>x(S.token_uid),children:"Revoke"})]},S.token_uid))]})]})})}function Zp(){const[e,t]=y.useState(null),[n,r]=y.useState(!0),[l,i]=y.useState(null),[s,u]=y.useState(!1),[a,d]=y.useState(null);y.useEffect(()=>{(async()=>{try{t(await gp())}catch(m){i(m.message)}finally{r(!1)}})()},[]);async function v(m){m.preventDefault(),u(!0),d(null);try{await yp(e),d({ok:!0,text:"Saved."})}catch(h){d({ok:!1,text:h.message})}finally{u(!1)}}return n?o.jsx("div",{className:"muted",children:"Loading\\u2026"}):l?o.jsx("div",{className:"form-msg form-msg--err",children:l}):e?o.jsx("div",{style:{maxWidth:440},children:o.jsxs("div",{className:"form-section",children:[o.jsx("h2",{children:"Instance Settings"}),o.jsxs("form",{onSubmit:v,children:[[["public_index_enabled","Public index (unauthenticated browsing)"],["public_entry_content_enabled","Public entry content"],["open_registration_enabled","Open registration"]].map(([m,h])=>o.jsxs("label",{className:"checkbox-row",children:[o.jsx("input",{type:"checkbox",checked:!!e[m],onChange:w=>t(x=>({...x,[m]:w.target.checked}))}),h]},m)),o.jsxs("div",{className:"form-field",style:{marginTop:4},children:[o.jsx("label",{className:"form-label",children:"Default entry visibility"}),o.jsxs("select",{className:"field-input",value:e.default_entry_visibility,onChange:m=>t(h=>({...h,default_entry_visibility:Number(m.target.value)})),children:[o.jsx("option",{value:0,children:"Private"}),o.jsx("option",{value:2,children:"Unlisted"}),o.jsx("option",{value:3,children:"Public"})]})]}),a&&o.jsx("div",{className:`form-msg form-msg--${a.ok?"ok":"err"}`,children:a.text}),o.jsx("button",{className:"btn-primary",type:"submit",disabled:s,children:s?"Saving…":"Save Settings"})]})]})}):null}const su={0:"Private",1:"Public",2:"Users only",3:"Public"},qp=()=>o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o.jsx("path",{d:"M7 17 17 7M9 7h8v8"})});function bp({archiveId:e,selectedEntry:t,onTagFilterSet:n,tagNodes:r,onTagsRefresh:l}){const[i,s]=y.useState(null),[u,a]=y.useState([]),[d,v]=y.useState(""),[m,h]=y.useState([]),[w,x]=y.useState(""),S=y.useRef(0);y.useEffect(()=>{if(!t||!e){s(null),a([]),h([]);return}const f=++S.current;s(null),a([]),Promise.all([np(e,t.entry_uid),ri(e,t.entry_uid),Lp(e,t.entry_uid)]).then(([g,j,_])=>{f===S.current&&(s(g),a(j),h(_))}).catch(()=>{})},[t,e]);async function C(){const f=d.trim();if(!(!f||!t))try{await rp(e,t.entry_uid,f),v(""),x("");const g=await ri(e,t.entry_uid);a(g),l()}catch(g){x(g.message)}}async function p(f){try{await lp(e,t.entry_uid,f);const g=await ri(e,t.entry_uid);a(g),l()}catch{}}const c=i?[["Added",xc(i.summary.archived_at)],["Source",i.summary.source_kind],["Type",i.summary.entity_kind],["Visibility",su[i.summary.visibility]??i.summary.visibility],["Root",i.structured_root_relpath]]:[];return o.jsxs("aside",{className:"context-rail",children:[o.jsx("div",{className:"rail-eyebrow",children:"Context"}),t?i?o.jsxs(o.Fragment,{children:[o.jsx("h2",{className:"rail-title",children:It(i.summary.title)||It(i.summary.entry_uid)}),i.summary.original_url&&o.jsxs("a",{className:"url-tile",href:i.summary.original_url,target:"_blank",rel:"noopener noreferrer",children:[o.jsx("span",{className:"ico",dangerouslySetInnerHTML:{__html:Sc(i.summary.source_kind)}}),o.jsx("span",{className:"u-text",children:i.summary.original_url}),o.jsx("span",{className:"ext",children:o.jsx(qp,{})})]}),o.jsx("div",{className:"meta-list",children:c.filter(([,f])=>f!=null&&f!=="").map(([f,g])=>o.jsxs("div",{className:"meta-item",children:[o.jsx("span",{className:"meta-k",children:f}),o.jsx("span",{className:`meta-v${f==="Root"?" mono":""}`,children:It(g)})]},f))}),i.artifacts.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsxs("div",{className:"rail-section-heading",children:["Artifacts ",o.jsx("span",{className:"num",children:i.artifacts.length})]}),o.jsx("ul",{className:"artifact-list",children:i.artifacts.map((f,g)=>o.jsx("li",{children:o.jsxs("a",{href:`/api/archives/${e}/entries/${i.summary.entry_uid}/artifacts/${g}`,target:"_blank",rel:"noopener noreferrer",className:"artifact-link",children:[o.jsx("span",{className:"artifact-name",children:f.artifact_role.replace(/_/g," ")}),o.jsx("span",{className:"artifact-size",children:f.byte_size!=null?qi(f.byte_size):"—"})]})},g))})]})]}):o.jsx("p",{className:"tags-empty",children:"Loading…"}):o.jsx("p",{className:"tags-empty",children:"Select an entry."}),t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Tags"}),u.length===0?o.jsx("p",{className:"tags-empty",children:"No tags yet."}):o.jsx("div",{className:"tags-wrap",children:u.map(f=>o.jsxs("span",{className:"tag-pill",title:f.full_path,children:[f.name,o.jsx("button",{className:"remove",title:`Remove tag ${f.full_path}`,onClick:()=>p(f.tag_uid),children:"×"})]},f.tag_uid))}),w&&o.jsx("p",{className:"form-msg form-msg--err",style:{margin:"0 0 8px"},children:w}),o.jsxs("div",{className:"tag-input-wrap",children:[o.jsx("span",{className:"hash",children:"/"}),o.jsx("input",{className:"tag-input",type:"text",placeholder:"science/cs",autoComplete:"off",value:d,onChange:f=>v(f.target.value),onKeyDown:f=>{f.key==="Enter"&&C()}}),o.jsx("button",{className:"tag-add-btn",onClick:C,children:"Add"})]})]}),m.length>0&&o.jsxs("div",{className:"rail-section",children:[o.jsx("div",{className:"rail-section-heading",children:"Collections"}),m.map(f=>o.jsxs("div",{className:"coll-row",children:[o.jsx("span",{className:"coll-name",children:f.collection_uid}),o.jsx("span",{className:"vis-badge",children:su[f.visibility_bits]??`bits:${f.visibility_bits}`})]},f.collection_uid))]})]})]})}const Ll=y.createContext(null),eh=["archive","runs","admin","tags","collections","settings"],th=["profile","tokens","instance"];function ii(){const e=window.location.pathname.split("/").filter(Boolean),t=eh.includes(e[0])?e[0]:"archive",n=t==="settings"&&th.includes(e[1])?e[1]:"profile";return{view:t,settingsTab:n}}function nh(e,t){return e==="archive"?"/":e==="settings"?`/settings/${t}`:`/${e}`}function rh(){const[e,t]=y.useState("loading"),[n,r]=y.useState(null);y.useEffect(()=>{(async()=>{if(await op()){t("setup");return}const re=await dp();if(!re){t("login");return}r(re),t("authenticated")})()},[]),y.useEffect(()=>{const D=()=>{r(null),t("login")};return window.addEventListener("auth:expired",D),()=>window.removeEventListener("auth:expired",D)},[]),y.useEffect(()=>{const D=()=>{const{view:re,settingsTab:Xt}=ii();p(re),f(Xt)};return window.addEventListener("popstate",D),()=>window.removeEventListener("popstate",D)},[]);const[l,i]=y.useState([]),[s,u]=y.useState(null),[a,d]=y.useState([]),[v,m]=y.useState(null),[h,w]=y.useState(null),[x,S]=y.useState(null),[C,p]=y.useState(()=>ii().view),[c,f]=y.useState(()=>ii().settingsTab),[g,j]=y.useState(""),[_,T]=y.useState(""),[z,A]=y.useState(!1),[F,Z]=y.useState([]),[we,fe]=y.useState([]),[Xe,Re]=y.useState(!1),xe=y.useCallback(async(D,re,Xt)=>{if(D){A(!0);try{let dt;re||Xt?dt=await tp(D,re,Xt):dt=await ep(D),d(dt),T(dt.length===0?"No results":`${dt.length} result${dt.length===1?"":"s"}`)}catch{d([]),T("Search failed. Try again.")}finally{A(!1)}}},[]);y.useEffect(()=>{e==="authenticated"&&bf().then(D=>{if(i(D),D.length>0){const re=D[0].id;u(re)}})},[e]),y.useEffect(()=>{s&&(S(null),w(null),m(null),Promise.all([xe(s,"",null),ru(s).then(Z),li(s).then(fe)]))},[s]),y.useEffect(()=>{if(s===null)return;const D=setTimeout(()=>{xe(s,g,x)},300);return()=>clearTimeout(D)},[g,s]),y.useEffect(()=>{s!==null&&(x!==null&&p("archive"),xe(s,g,x))},[x,s]);const Ue=y.useCallback(D=>{u(D)},[]),E=y.useCallback(D=>{p(D),D==="tags"&&s&&li(s).then(fe)},[s]);y.useEffect(()=>{const D=nh(C,c);window.location.pathname!==D&&history.pushState(null,"",D)},[C,c]);const k=y.useCallback(D=>{m(D?D.entry_uid:null),w(D)},[]),R=y.useCallback(D=>{S(D)},[]),I=y.useCallback(()=>{S(null)},[]),O=y.useCallback(()=>{s&&li(s).then(fe)},[s]),pe=y.useCallback(()=>{Re(!0)},[]),oe=y.useCallback(()=>{Re(!1)},[]),Ge=y.useCallback(()=>{s&&Promise.all([xe(s,g,x),ru(s).then(Z)])},[s,g,x,xe]);return e==="loading"?o.jsx("div",{className:"auth-loading",children:"Loading\\u2026"}):e==="setup"?o.jsx(Dp,{onComplete:()=>t("login")}):e==="login"?o.jsx(Op,{onLogin:D=>{r(D),t("authenticated")}}):o.jsx(Ll.Provider,{value:{currentUser:n,setCurrentUser:r},children:o.jsxs(o.Fragment,{children:[o.jsx(Fp,{archives:l,archiveId:s,onArchiveChange:Ue,view:C,onViewChange:E,onCaptureClick:pe}),o.jsxs("main",{className:"app-shell",children:[o.jsxs("div",{className:"workspace",children:[C==="archive"&&o.jsxs("div",{className:"toolbar",children:[o.jsxs("div",{className:"search-field",children:[o.jsx("span",{className:"ico","aria-hidden":"true",children:o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[o.jsx("circle",{cx:"11",cy:"11",r:"7"}),o.jsx("line",{x1:"16.5",y1:"16.5",x2:"21",y2:"21"})]})}),o.jsx("input",{className:"search-input",type:"search","aria-label":"Search archive","aria-busy":z,placeholder:"Search titles, URLs, types, tags…",value:g,onChange:D=>j(D.target.value)}),o.jsx("span",{className:"kbd",children:"⌘K"})]}),o.jsxs("span",{className:"result-count",children:[_&&o.jsxs(o.Fragment,{children:[o.jsx("b",{children:_.split(" ")[0]})," ",_.split(" ").slice(1).join(" ")]}),x&&o.jsxs("button",{className:"tag-filter-badge",onClick:I,children:["× ",x]})]})]}),C==="archive"&&o.jsx(Ip,{entries:a,selectedEntryUid:v,onSelectEntry:k,archiveId:s,tagFilter:x,onClearTagFilter:I,searchQuery:g,onSearchChange:j,resultCount:_,searchBusy:z}),C==="runs"&&o.jsx(Vp,{runs:F}),C==="admin"&&o.jsx(Hp,{archives:l}),C==="tags"&&o.jsx(Wp,{tagNodes:we,tagFilter:x,onTagFilterSet:R,onViewChange:E}),C==="collections"&&o.jsx(Kp,{archiveId:s}),C==="settings"&&o.jsx(Xp,{tab:c,onTabChange:f})]}),o.jsx(bp,{archiveId:s,selectedEntry:h,onTagFilterSet:R,tagNodes:we,onTagsRefresh:O})]}),o.jsx(Mp,{open:Xe,archiveId:s,onClose:oe,onCaptured:Ge})]})})}wc(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(rh,{})})); diff --git a/crates/archivr-server/static/assets/index-MrdP6h9x.css b/crates/archivr-server/static/assets/index-MrdP6h9x.css deleted file mode 100644 index 5e9ef16..0000000 --- a/crates/archivr-server/static/assets/index-MrdP6h9x.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Spectral:wght@500;600&display=swap";:root{color-scheme:light;--ink: #20251f;--muted: #6b6f66;--muted-2: #8a8d83;--paper: #f5f0e7;--paper-2: #e9e1d2;--paper-3: #fffaf0;--line: #d2c6b5;--line-soft: #e5dccd;--accent: #8d3f30;--accent-2: #b78342;--link: #245f72;--top: #141d18;--field: #fffdf7;--r: 3px;--r2: 6px;--r3: 10px;--sans: "Helvetica Neue", Helvetica, Arial, sans-serif;--serif: "Spectral", Georgia, "Times New Roman", serif;--display: "Cormorant Garamond", Georgia, serif}*{box-sizing:border-box}body{margin:0;min-height:100vh;background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:14px;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}button,input,select{font:inherit}.workspace,.context-rail{scrollbar-width:thin;scrollbar-color:var(--line) transparent}.workspace::-webkit-scrollbar,.context-rail::-webkit-scrollbar{width:11px;height:11px}.workspace::-webkit-scrollbar-track,.context-rail::-webkit-scrollbar-track{background:transparent}.workspace::-webkit-scrollbar-thumb,.context-rail::-webkit-scrollbar-thumb{background:var(--line);border-radius:999px;border:3px solid transparent;background-clip:padding-box}.workspace::-webkit-scrollbar-thumb:hover,.context-rail::-webkit-scrollbar-thumb:hover{background:var(--muted-2);background-clip:padding-box;border:3px solid transparent}.topbar{height:58px;display:grid;grid-template-columns:auto auto 1fr auto auto;align-items:center;gap:26px;padding:0 22px;background:var(--top);color:#efe6d6;border-bottom:3px solid var(--accent)}.brand{font-family:var(--display);font-weight:600;font-size:30px;line-height:1;letter-spacing:.01em;color:#f4ead8}.switcher{position:relative;display:inline-flex;align-items:center}.switcher select{-moz-appearance:none;appearance:none;-webkit-appearance:none;border:1px solid rgba(247,238,223,.2);background:#f7eedf0f;color:#f1e8d8;font-family:var(--sans);font-weight:550;font-size:13.5px;letter-spacing:.04em;padding:8px 32px 8px 15px;cursor:pointer;border-radius:6px;transition:background .15s ease,border-color .15s ease}.switcher select:hover{background:#f7eedf1c;border-color:#f7eedf57}.switcher:after{content:"";position:absolute;right:15px;top:50%;width:6px;height:6px;margin-top:-5px;border-right:1.2px solid #b6ab98;border-bottom:1.2px solid #b6ab98;transform:rotate(45deg);pointer-events:none}.nav{display:flex;gap:22px;justify-content:flex-end;min-width:0}.nav-link{border:0;background:transparent;color:#cdc1ad;cursor:pointer;padding:6px 0;font-size:12.5px;font-weight:600;letter-spacing:.1em;text-transform:uppercase;position:relative}.nav-link:hover,.nav-link.is-active{color:#f4ead8}.nav-link.is-active:after{content:"";position:absolute;left:0;right:0;bottom:-2px;height:1px;background:var(--accent-2)}.capture-button{display:inline-flex;align-items:center;gap:8px;position:relative;overflow:hidden;border:0;background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 88%,#fff) 0%,var(--accent) 55%);color:#f7eddd;padding:10px 18px;cursor:pointer;font-size:12px;font-weight:600;letter-spacing:.15em;text-transform:uppercase;border-radius:var(--r);box-shadow:inset 0 1px #fff5e629,0 1px 2px #141d184d;transition:filter .18s ease,box-shadow .18s ease}.capture-button:hover{filter:brightness(.93);box-shadow:inset 0 1px #fff5e61f,0 2px 6px #141d1857}.capture-button:before{content:"";position:absolute;top:0;bottom:0;left:0;width:45%;background:linear-gradient(100deg,transparent 0%,rgba(255,246,232,.45) 50%,transparent 100%);transform:translate(-180%) skew(-18deg);pointer-events:none}@media (prefers-reduced-motion: no-preference){.capture-button:hover:before{animation:cap-sheen .7s ease}}@keyframes cap-sheen{0%{transform:translate(-180%) skew(-18deg)}to{transform:translate(340%) skew(-18deg)}}.app-shell{height:calc(100vh - 58px);display:grid;grid-template-columns:minmax(0,1fr) 340px}.workspace{min-width:0;overflow:auto;display:flex;flex-direction:column}.view{display:none}.view.is-active{display:block}.toolbar{position:sticky;top:0;z-index:3;display:flex;align-items:center;gap:16px;padding:12px 22px;background:color-mix(in srgb,var(--paper) 88%,white);border-bottom:1px solid var(--line-soft)}.search-field{position:relative;flex:1 1 auto;min-width:0;display:flex;align-items:center;height:42px;background:var(--field);border:1px solid var(--line);border-radius:20px;transition:border-color .15s ease,box-shadow .15s ease}.search-field:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent)}.search-field .ico{display:grid;place-items:center;width:46px;height:100%;color:var(--muted-2);flex-shrink:0}.search-field .ico svg{width:16px;height:16px}.search-input{flex:1;min-width:0;height:100%;border:0;background:transparent;color:var(--ink);padding:0 6px 0 0;font-size:14px;letter-spacing:.01em;outline:none}.search-input::placeholder{color:var(--muted-2)}.search-field .kbd{margin-right:12px;display:inline-flex;align-items:center;padding:3px 7px;font-size:11px;color:var(--muted);background:var(--paper-2);border:1px solid var(--line-soft);border-radius:var(--r);flex-shrink:0}.result-count{flex-shrink:0;font-size:13px;color:var(--muted);letter-spacing:.02em;white-space:nowrap}.result-count b{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}.tag-filter-badge{display:inline-flex;align-items:center;gap:4px;background:var(--accent);color:#fff;border:0;border-radius:var(--r);font-size:12px;padding:2px 8px;cursor:pointer;margin-left:8px}.tag-filter-badge:hover{opacity:.85}.entry-table{width:100%;font-size:12.5px}.entry-header-row{display:flex;align-items:stretch;position:sticky;top:67px;z-index:2;background:color-mix(in srgb,var(--paper) 92%,white);border-bottom:1px solid var(--line-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em}.entry-header-row>div{padding:9px 10px;flex-shrink:0;font-weight:600;display:flex;align-items:center}#entries-body>div{display:flex;align-items:center;cursor:default;border-bottom:1px solid var(--line-soft)}#entries-body>div>div{padding:7px 10px;flex-shrink:0;overflow:hidden}#entries-body>div:nth-child(2n){background:#f2ede5}#entries-body>div:nth-child(odd){background:var(--paper-3)}#entries-body>div.is-selected{background:#eee2d2;outline:2px solid var(--accent);outline-offset:-2px}.col-added{width:162px;color:var(--muted)}.col-title{flex:1 1 0;min-width:0;overflow:hidden;display:flex;align-items:center;gap:.42em}.col-type{width:116px}.col-size{width:96px}.col-url{flex:0 0 30%;min-width:0;overflow:hidden}.entry-header-row>div:first-child,#entries-body>div>div:first-child{padding-left:22px}.entry-header-row>div:last-child,#entries-body>div>div:last-child{padding-right:22px}.entry-title{color:var(--link);font-weight:700;min-width:0}.entry-header-row>div{padding:9px 10px;flex-shrink:0;font-weight:600}.source-icon{display:flex;align-items:center;justify-content:center;width:1.05em;height:1.05em;flex-shrink:0}.source-icon>*{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.source-icon svg{width:100%;height:100%}.url-cell{color:#555b55;word-break:break-all}.type-pill{display:inline-block;padding:2px 6px;background:#d8e3df;color:#275a5f;border:1px solid #bfd0ca;border-radius:var(--r)}#runs-view .entry-table{border-collapse:collapse;table-layout:auto}#runs-view .entry-table th{position:sticky;top:0;z-index:1;text-align:left;padding:10px;background:color-mix(in srgb,var(--paper) 92%,white);color:var(--muted);border-bottom:1px solid var(--line-soft);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em}#runs-view .entry-table td{padding:10px;border-bottom:1px solid var(--line-soft);vertical-align:top}#runs-view .entry-table tr:nth-child(2n) td{background:#f2ede5}#runs-view .entry-table tr:nth-child(odd) td{background:var(--paper-3)}.context-rail{border-left:1px solid var(--line);background:var(--paper);padding:20px 20px 32px;overflow:auto}.rail-eyebrow{font-size:10.5px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;color:var(--muted-2);margin-bottom:16px}.rail-title{display:block;font-family:var(--sans);font-weight:700;font-size:15.5px;line-height:1.4;color:var(--ink);margin:0 0 16px;word-break:break-word}.url-tile{display:flex;align-items:center;gap:9px;padding:10px 12px;background:var(--paper-3);border:1px solid var(--line);border-radius:var(--r3);margin-bottom:20px;text-decoration:none}.url-tile:hover{background:var(--field);border-color:var(--accent)}.url-tile .ico{color:var(--ink);flex-shrink:0;display:grid;place-items:center}.url-tile .ico svg{width:15px;height:15px}.url-tile .u-text{min-width:0;flex:1;font-size:12.5px;color:var(--link);font-family:ui-monospace,SF Mono,Menlo,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.url-tile .ext{color:var(--muted-2);flex-shrink:0}.url-tile .ext svg{width:13px;height:13px;display:block}.meta-list{margin-bottom:24px;border-top:1px solid var(--line-soft)}.meta-item{display:grid;grid-template-columns:92px 1fr;gap:14px;align-items:baseline;padding:9px 0;border-bottom:1px solid var(--line-soft)}.meta-k{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-2)}.meta-v{font-size:13.5px;color:var(--ink);word-break:break-word;line-height:1.4}.meta-v.mono{font-family:ui-monospace,SF Mono,Menlo,monospace;font-size:12px;color:var(--muted)}.rail-section{margin-bottom:24px}.rail-section-heading{display:flex;align-items:baseline;gap:8px;font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.12em;color:var(--muted-2);margin-bottom:9px;padding-bottom:8px;border-bottom:1px solid var(--line)}.rail-section-heading .num{color:var(--muted-2);font-weight:600}.artifact-list{list-style:none;margin:0;padding:0}.artifact-link{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:7px 2px;border-bottom:1px solid var(--line-soft);text-decoration:none}.artifact-link:last-child{border-bottom:0}.artifact-name{font-size:13px;color:var(--link);min-width:0;word-break:break-word}.artifact-link:hover .artifact-name{text-decoration:underline}.artifact-size{font-size:11.5px;color:var(--muted-2);flex-shrink:0;font-variant-numeric:tabular-nums}.tags-wrap{display:flex;flex-wrap:wrap;gap:7px;margin:0 0 12px}.tag-pill{display:inline-flex;align-items:center;gap:7px;background:var(--paper-2);border:1px solid var(--line);border-radius:var(--r);font-size:12px;padding:4px 7px 4px 10px;color:var(--ink)}.tag-pill .remove{border:0;background:transparent;cursor:pointer;color:var(--muted-2);width:15px;height:15px;display:grid;place-items:center;font-size:13px;line-height:1}.tag-pill .remove:hover{color:var(--accent)}.tags-empty{font-size:13px;color:var(--muted);margin:0 0 11px}.tag-input-wrap{display:flex;align-items:center;gap:8px;background:var(--field);border:1px solid var(--line);border-radius:var(--r2);padding:2px 2px 2px 11px;transition:border-color .15s ease,box-shadow .15s ease}.tag-input-wrap:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 12%,transparent)}.tag-input-wrap .hash{color:var(--muted-2);font-size:13px}.tag-input{flex:1;min-width:0;border:0;background:transparent;color:var(--ink);font-size:13px;padding:6px 0;outline:none;font-family:ui-monospace,SF Mono,Menlo,monospace}.tag-add-btn{border:0;background:var(--ink);color:var(--paper-3);padding:6px 13px;font-size:11.5px;letter-spacing:.06em;text-transform:uppercase;border-radius:var(--r);cursor:pointer;white-space:nowrap}.tag-add-btn:hover{background:#2c332b}.coll-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 13px;background:var(--field);border:1px solid var(--line);border-radius:var(--r2);margin-bottom:6px;transition:border-color .15s ease}.coll-row:hover{border-color:var(--accent)}.coll-name{font-size:13px;color:var(--ink);font-weight:500}.vis-badge{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);background:var(--paper-2);border:1px solid var(--line-soft);border-radius:999px;padding:3px 10px}.vis-badge:before{content:"";width:6px;height:6px;border-radius:50%;background:var(--accent-2)}.capture-dialog{border:1px solid var(--line);background:var(--paper);padding:0;min-width:360px;max-width:520px;border-radius:var(--r3);box-shadow:0 20px 60px #141d1847}.capture-dialog::backdrop{background:#141d1873}.capture-dialog-inner{padding:28px}.capture-dialog-title{margin:0 0 16px;font-size:22px;font-family:var(--display);font-weight:600}.capture-label{display:block;font-size:11px;font-weight:600;margin-bottom:6px;color:var(--muted-2);text-transform:uppercase;letter-spacing:.06em}.capture-input{width:100%;height:44px;border:1px solid var(--line);background:var(--field);color:var(--ink);padding:0 14px;font-size:15px;margin-bottom:10px;border-radius:var(--r2);outline:none;transition:border-color .15s ease,box-shadow .15s ease}.capture-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 14%,transparent)}.form-field .capture-input{margin-bottom:0}.capture-error{color:var(--accent);font-size:13px;margin-bottom:10px;min-height:18px}.capture-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px}.capture-cancel{border:1px solid var(--line);background:none;color:var(--ink);padding:8px 18px;border-radius:var(--r);cursor:pointer}.capture-cancel:hover{background:var(--paper-2)}.capture-submit{border:0;background:var(--ink);color:var(--paper);padding:8px 20px;border-radius:var(--r);cursor:pointer;font-weight:600}.capture-submit:hover{opacity:.85}.capture-submit:disabled{opacity:.45;cursor:default}.muted{color:var(--muted)}.admin-view{padding:22px}.admin-list{display:grid;gap:10px;max-width:780px}.admin-archive{border:1px solid var(--line);background:var(--paper-3);padding:12px;border-radius:var(--r2)}.tag-tree{padding:20px 22px;max-width:320px}.tag-tree-header{display:flex;align-items:baseline;gap:10px;margin-bottom:14px;border-bottom:1px solid var(--line-soft);padding-bottom:10px}.tag-tree-title{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.07em}.tag-tree-active{font-size:12px;color:var(--muted-2);font-style:italic}.tag-tree-list{list-style:none;margin:0;padding:0}.tag-children{padding-left:16px}.tag-node-btn{border:0;background:transparent;color:var(--link);cursor:pointer;padding:3px 0;text-align:left;font-size:13px;display:block;width:100%}.tag-node-btn:hover{text-decoration:underline}.tag-node-btn.is-active{font-weight:600;color:var(--ink)}.collections-view{padding:24px}.collections-heading{margin:0 0 16px;font-size:22px;font-family:var(--display);font-weight:600}.collections-error{color:var(--accent);font-size:13px;margin-bottom:8px}.coll-dismiss{background:none;border:none;cursor:pointer;color:var(--accent);font-size:16px;line-height:1;padding:0 4px}.collections-layout{display:grid;grid-template-columns:220px 1fr;gap:0;border:1px solid var(--line);border-radius:var(--r2);min-height:340px}.collections-sidebar{border-right:1px solid var(--line);overflow-y:auto}.coll-sidebar-row{display:flex;flex-direction:column;width:100%;padding:10px 14px;border:none;border-bottom:1px solid var(--line-soft);background:none;cursor:pointer;text-align:left;gap:2px}.coll-sidebar-row:hover{background:var(--paper-2)}.coll-sidebar-row.is-active{background:var(--paper-2);border-left:3px solid var(--accent)}.coll-row-name{font-size:14px;font-weight:600;color:var(--ink)}.coll-row-meta{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.coll-detail{padding:20px 24px;display:flex;flex-direction:column;gap:16px}.coll-detail--empty{justify-content:center;align-items:center}.coll-detail-header{display:flex;align-items:center;gap:12px}.coll-detail-name{margin:0;font-size:18px;font-family:var(--display);font-weight:600;flex:1}.coll-detail-name--editable{cursor:pointer}.coll-detail-name--editable:hover{color:var(--link)}.coll-edit-hint{font-size:14px;opacity:.5;margin-left:4px}.coll-rename-input{flex:1;font-size:16px;font-family:var(--display);border:1px solid var(--line);padding:4px 8px;background:var(--field);color:var(--ink);border-radius:var(--r)}.coll-delete-btn{border:1px solid var(--accent);background:none;color:var(--accent);padding:5px 12px;font-size:13px;cursor:pointer;border-radius:var(--r)}.coll-delete-btn:hover{background:var(--accent);color:var(--paper)}.coll-detail-vis{display:flex;align-items:center;gap:10px}.coll-vis-label{font-size:13px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;white-space:nowrap}.coll-vis-select{border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:4px 8px;font-size:13px;border-radius:var(--r)}.coll-section-heading{font-size:11px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:8px}.coll-entries-section{flex:1}.coll-entries-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}.coll-entry-row{display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid var(--line-soft)}.coll-entry-info{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}.coll-entry-title{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.coll-entry-kind{font-size:11px;text-transform:uppercase;letter-spacing:.04em}.coll-entry-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.coll-entry-vis-select{border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:3px 6px;font-size:12px;border-radius:var(--r)}.coll-entry-remove{border:none;background:none;cursor:pointer;color:var(--muted);font-size:18px;line-height:1;padding:0 4px}.coll-entry-remove:hover{color:var(--accent)}.coll-add-entry-form{border-top:1px solid var(--line-soft);padding-top:12px}.coll-add-entry-row{display:flex;gap:8px;align-items:center}.coll-add-entry-input{flex:1;border:1px solid var(--line);background:var(--paper-3);color:var(--ink);padding:6px 10px;font-size:13px;min-width:0;border-radius:var(--r)}.coll-add-btn{border:none;background:var(--ink);color:var(--paper);padding:6px 14px;font-size:13px;font-weight:600;cursor:pointer;white-space:nowrap;border-radius:var(--r)}.coll-add-btn:hover{opacity:.85}.coll-add-btn:disabled{opacity:.45;cursor:default}.auth-loading{min-height:100vh;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:15px;background:var(--paper)}.user-menu{display:flex;align-items:center;gap:14px;padding-left:6px;flex-shrink:0}.user-name{font-size:12.5px;color:var(--muted-2);letter-spacing:.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:140px}.logout-btn{border:1px solid rgba(255,255,255,.18);background:transparent;color:#c8bfb0;font-size:12px;padding:4px 11px;border-radius:var(--r);cursor:pointer;white-space:nowrap;transition:background .15s,color .15s}.logout-btn:hover{background:#ffffff1a;color:var(--paper)}.logout-btn:disabled{opacity:.5;cursor:default}.login-page,.setup-page{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;background:var(--paper)}.login-card,.setup-card{width:100%;max-width:360px;padding:40px 36px 44px;background:var(--paper-3);border:1px solid var(--line);border-radius:var(--r3);box-shadow:0 2px 20px #141d1812}.login-brand,.setup-brand{font-family:var(--display);font-size:32px;font-weight:600;color:var(--ink);letter-spacing:-.01em;margin:0 0 6px}.login-tagline,.setup-tagline{font-size:13px;color:var(--muted);margin:0 0 28px}.login-field,.setup-field{display:flex;flex-direction:column;gap:5px;margin-bottom:14px}.login-label,.setup-label{font-size:11.5px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.login-input,.setup-input{width:100%;border:1px solid var(--line);background:var(--field);color:var(--ink);padding:9px 11px;font-size:14px;border-radius:var(--r2);outline:none;transition:border-color .15s}.login-input:focus,.setup-input:focus{border-color:var(--accent)}.login-error,.setup-error{font-size:13px;color:var(--accent);margin:4px 0 8px}.login-submit,.setup-submit{width:100%;margin-top:8px;border:none;background:var(--top);color:var(--paper);font-size:14px;font-weight:600;padding:11px 16px;border-radius:var(--r2);cursor:pointer;letter-spacing:.02em;transition:opacity .15s}.login-submit:hover,.setup-submit:hover{opacity:.85}.login-submit:disabled,.setup-submit:disabled{opacity:.45;cursor:default}.view-tabs{display:flex;gap:2px;margin-bottom:22px;border-bottom:1px solid var(--line-soft);padding-bottom:0}.view-tab{border:none;background:none;color:var(--muted);font-size:13px;font-weight:600;padding:7px 14px;cursor:pointer;border-bottom:2px solid transparent;margin-bottom:-1px;letter-spacing:.02em;transition:color .12s;text-transform:uppercase;letter-spacing:.06em;font-size:11.5px}.view-tab:hover{color:var(--ink)}.view-tab.is-active{color:var(--ink);border-bottom-color:var(--accent)}.form-section{margin-bottom:32px}.form-section h2{font-size:14px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:0 0 14px}.form-row{display:flex;gap:8px;margin-bottom:10px}.form-field{display:flex;flex-direction:column;gap:5px;margin-bottom:12px}.form-label{font-size:11.5px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}.field-input{border:1px solid var(--line);background:var(--field);color:var(--ink);padding:8px 10px;font-size:13.5px;border-radius:var(--r);outline:none;transition:border-color .15s;min-width:0}.field-input:focus{border-color:var(--accent)}.field-input--flex{flex:1}.form-msg{font-size:13px;margin:6px 0}.form-msg--ok{color:var(--link)}.form-msg--err{color:var(--accent)}.btn-primary{border:none;background:var(--top);color:var(--paper);font-size:13px;font-weight:600;padding:8px 16px;border-radius:var(--r);cursor:pointer;white-space:nowrap}.btn-primary:hover{opacity:.85}.btn-primary:disabled{opacity:.45;cursor:default}.btn-ghost{border:1px solid var(--line);background:none;color:var(--ink);font-size:13px;padding:7px 14px;border-radius:var(--r);cursor:pointer}.btn-ghost:hover{background:var(--paper-2)}.btn-danger{border:1px solid var(--accent);background:none;color:var(--accent);font-size:13px;padding:7px 14px;border-radius:var(--r);cursor:pointer}.btn-danger:hover{background:var(--accent);color:var(--paper)}.admin-view h1{font-family:var(--display);font-weight:600;font-size:26px;margin:0 0 20px}.admin-table{width:100%;border-collapse:collapse;font-size:13px;margin-bottom:28px}.admin-table th{text-align:left;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);padding:8px 10px;border-bottom:1px solid var(--line);background:var(--paper-2)}.admin-table th:first-child{padding-left:16px}.admin-table td{padding:9px 10px;border-bottom:1px solid var(--line-soft);color:var(--ink);vertical-align:middle}.admin-table td:first-child{padding-left:16px}.admin-table tr:hover td{background:var(--paper-2)}.admin-row-disabled td{opacity:.45}.admin-section{margin-bottom:36px;max-width:860px}.admin-section h2{font-size:14px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:0 0 14px}.admin-section h3{font-size:13px;font-weight:700;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;margin:22px 0 10px}.admin-form{display:flex;flex-direction:column;gap:8px;max-width:480px}.admin-input{border:1px solid var(--line);background:var(--field);color:var(--ink);padding:8px 10px;font-size:13.5px;border-radius:var(--r);outline:none;transition:border-color .15s}.admin-input:focus{border-color:var(--accent)}.admin-action-btn{border:1px solid var(--line);background:none;color:var(--ink);font-size:12px;padding:4px 10px;border-radius:var(--r);cursor:pointer;white-space:nowrap}.admin-action-btn:hover{border-color:var(--accent);color:var(--accent)}.status-badge{display:inline-block;padding:2px 8px;border-radius:var(--r);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.status-active{background:#d8eddf;color:#235c35;border:1px solid #b4d9be}.status-disabled{background:#ede8e0;color:var(--muted);border:1px solid var(--line)}.run-status{display:inline-block;padding:2px 8px;border-radius:var(--r);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em}.run-status--completed{background:#d8eddf;color:#235c35;border:1px solid #b4d9be}.run-status--failed{background:#f5ddd8;color:#8d3f30;border:1px solid #e0b8b0}.run-status--running{background:#dde8f5;color:#245f72;border:1px solid #b8cde0}.token-banner{background:#d8eddf;border:1px solid #b4d9be;padding:12px 14px;margin-bottom:16px;font-size:13px;border-radius:var(--r2)}.token-banner code{word-break:break-all;display:block;margin-top:6px;padding:6px 8px;background:var(--field);border:1px solid var(--line);border-radius:var(--r);font-size:12px;font-family:ui-monospace,SF Mono,Menlo,monospace}.token-dismiss{margin-top:8px;font-size:12px;border:1px solid var(--line);background:none;cursor:pointer;padding:3px 8px;border-radius:var(--r);color:var(--muted)}.token-dismiss:hover{background:var(--paper-2)}.token-row{display:flex;align-items:center;justify-content:space-between;border:1px solid var(--line);background:var(--paper-3);padding:10px 12px;border-radius:var(--r);margin-bottom:6px}.token-row-info strong{font-size:14px;display:block}.token-row-info .muted{font-size:12px;margin-top:2px}.token-create-row{display:flex;gap:8px;margin-bottom:16px}.checkbox-row{display:flex;align-items:center;gap:10px;margin-bottom:12px;cursor:pointer;font-size:14px}.checkbox-row input[type=checkbox]{width:15px;height:15px;accent-color:var(--accent)}.coll-create-details{margin-top:16px}.coll-create-details summary{font-weight:600;cursor:pointer;font-size:13px;color:var(--link);list-style:none;display:flex;align-items:center;gap:6px;padding:8px 12px;border:1px solid var(--line-soft);border-radius:var(--r2);background:var(--paper-3);width:fit-content}.coll-create-details summary:hover{background:var(--paper-2)}.coll-create-details[open] summary{border-bottom-left-radius:0;border-bottom-right-radius:0}.coll-create-form{border:1px solid var(--line-soft);border-top:none;padding:14px;border-radius:0 0 var(--r2) var(--r2);background:var(--paper-3);display:flex;flex-direction:column;gap:10px;max-width:440px}@media (max-width: 900px){.topbar{grid-template-columns:1fr auto;height:auto;min-height:58px;padding:12px}.switcher,.nav{grid-column:1 / -1}.nav{justify-content:flex-start;overflow-x:auto}.app-shell{height:auto;grid-template-columns:1fr}.context-rail{border-left:0;border-top:1px solid var(--line)}.entry-table{min-width:860px}} diff --git a/crates/archivr-server/static/index.html b/crates/archivr-server/static/index.html index 1965bff..49f1a48 100644 --- a/crates/archivr-server/static/index.html +++ b/crates/archivr-server/static/index.html @@ -4,8 +4,8 @@ Archivr - - + +
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 5e21ede..fa4902b 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -241,7 +241,7 @@ export default function App() { )} {view === 'archive' && ( - {valueText(entry.entity_kind)} -
{formatBytes(entry.total_artifact_bytes)}
+
+ {formatBytes(entry.total_artifact_bytes)} + {entry.cached_bytes > 0 && entry.total_artifact_bytes > 0 && ( + + {Math.round(entry.cached_bytes / entry.total_artifact_bytes * 100)}% cached + + )} +
{valueText(entry.original_url)}
); diff --git a/frontend/src/styles.css b/frontend/src/styles.css index f66850b..6f363a4 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -310,7 +310,16 @@ select { .col-added { width: 162px; color: var(--muted); } .col-title { flex: 1 1 0; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 0.42em; } .col-type { width: 116px; } -.col-size { width: 96px; } +.col-size { width: 100px; display: flex; flex-direction: column; justify-content: center; gap: 1px; } +.size-total { font-variant-numeric: tabular-nums; } +.size-cached-pct { + font-size: 10px; + color: var(--muted); + opacity: 0.8; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} .col-url { flex: 0 0 30%; min-width: 0; overflow: hidden; } .entry-header-row > div:first-child,